diff --git a/Source/EditorOptFrm.dfm b/Source/EditorOptFrm.dfm index 5c99880e..f7bfc96a 100644 --- a/Source/EditorOptFrm.dfm +++ b/Source/EditorOptFrm.dfm @@ -621,7 +621,6 @@ object EditorOptForm: TEditorOptForm TabOrder = 3 CodeFolding.ShowCollapsedLine = True UseCodeFolding = False - Gutter.AutoSize = True Gutter.BorderStyle = gbsNone Gutter.DigitCount = 2 Gutter.Font.Charset = DEFAULT_CHARSET @@ -629,11 +628,25 @@ object EditorOptForm: TEditorOptForm Gutter.Font.Height = -12 Gutter.Font.Name = 'Courier New' Gutter.Font.Style = [] - Gutter.LeftOffset = 4 - Gutter.RightOffset = 21 Gutter.ShowLineNumbers = True - Gutter.Width = 32 Gutter.GradientEndColor = clBackground + Gutter.Bands = < + item + Kind = gbkMarks + Visible = True + Width = 13 + end + item + Kind = gbkLineNumbers + end + item + Kind = gbkFold + end + item + Kind = gbkMargin + Visible = True + Width = 3 + end> HideSelection = True Highlighter = cpp Lines.Strings = ( @@ -663,10 +676,6 @@ object EditorOptForm: TEditorOptForm OnSpecialLineColors = CppEditSpecialLineColors OnStatusChange = cppEditStatusChange RemovedKeystrokes = < - item - Command = ecDeleteLastChar - ShortCut = 8200 - end item Command = ecLineBreak ShortCut = 8205 @@ -860,16 +869,30 @@ object EditorOptForm: TEditorOptForm TabStop = False CodeFolding.ShowCollapsedLine = True UseCodeFolding = False - Gutter.AutoSize = True Gutter.BorderStyle = gbsNone Gutter.Font.Charset = DEFAULT_CHARSET Gutter.Font.Color = clWindowText Gutter.Font.Height = -12 Gutter.Font.Name = 'Courier New' Gutter.Font.Style = [] - Gutter.LeftOffset = 4 - Gutter.RightOffset = 21 Gutter.ShowLineNumbers = True + Gutter.Bands = < + item + Kind = gbkMarks + Visible = True + Width = 13 + end + item + Kind = gbkLineNumbers + end + item + Kind = gbkFold + end + item + Kind = gbkMargin + Visible = True + Width = 3 + end> Highlighter = cpp Options = [eoAutoIndent, eoHideShowScrollbars, eoKeepCaretX, eoSmartTabs, eoTabIndent, eoTrimTrailingSpaces] TabWidth = 4 @@ -933,16 +956,30 @@ object EditorOptForm: TEditorOptForm TabStop = False CodeFolding.ShowCollapsedLine = True UseCodeFolding = False - Gutter.AutoSize = True Gutter.BorderStyle = gbsNone Gutter.Font.Charset = DEFAULT_CHARSET Gutter.Font.Color = clWindowText Gutter.Font.Height = -12 Gutter.Font.Name = 'Courier New' Gutter.Font.Style = [] - Gutter.LeftOffset = 4 - Gutter.RightOffset = 21 Gutter.ShowLineNumbers = True + Gutter.Bands = < + item + Kind = gbkMarks + Visible = True + Width = 13 + end + item + Kind = gbkLineNumbers + end + item + Kind = gbkFold + end + item + Kind = gbkMargin + Visible = True + Width = 3 + end> Highlighter = cpp Options = [eoAutoIndent, eoHideShowScrollbars, eoKeepCaretX, eoSmartTabs, eoTabIndent, eoTrimTrailingSpaces] TabWidth = 4 diff --git a/Source/EditorOptFrm.pas b/Source/EditorOptFrm.pas index 09beb806..d35c6e65 100644 --- a/Source/EditorOptFrm.pas +++ b/Source/EditorOptFrm.pas @@ -26,7 +26,7 @@ interface Dialogs, ComCtrls, StdCtrls, ExtCtrls, Spin, SynEdit, SynEditHighlighter, SynHighlighterCpp, Buttons, ClassBrowser, CppParser, CppTokenizer, StrUtils, Grids, - CppPreprocessor; + CppPreprocessor, SynEditCodeFolding; type // Keep history of what we have accessed (does not mean changed) diff --git a/Source/LangFrm.dfm b/Source/LangFrm.dfm index c8f7d28d..1d9194cc 100644 --- a/Source/LangFrm.dfm +++ b/Source/LangFrm.dfm @@ -141,7 +141,23 @@ object LangForm: TLangForm Gutter.Font.Height = -11 Gutter.Font.Name = 'Courier New' Gutter.Font.Style = [] - Gutter.RightOffset = 21 + Gutter.Bands = < + item + Kind = gbkMarks + Visible = True + Width = 13 + end + item + Kind = gbkLineNumbers + end + item + Kind = gbkFold + end + item + Kind = gbkMargin + Visible = True + Width = 3 + end> Lines.Strings = ( '#include ' '' diff --git a/Source/VCL/SynEdit/.gitattributes b/Source/VCL/SynEdit/.gitattributes new file mode 100644 index 00000000..4f818451 --- /dev/null +++ b/Source/VCL/SynEdit/.gitattributes @@ -0,0 +1,13 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.pas text +*.dfm text + +# Declare files that will always have CRLF line endings on checkout. + +# Denote all files that are truly binary and should not be modified. +*.exe binary +*.res binary \ No newline at end of file diff --git a/Source/VCL/SynEdit/.gitignore b/Source/VCL/SynEdit/.gitignore index 9006d961..14549105 100644 --- a/Source/VCL/SynEdit/.gitignore +++ b/Source/VCL/SynEdit/.gitignore @@ -9,7 +9,6 @@ *.rsm *.stat *.map -*.lib # Generated source # ################### @@ -18,11 +17,6 @@ # Backup files # ################### *.~* -*.bak -*.#00 -*.pch -*.Patch -/__history # IDE Files # ################### @@ -42,8 +36,4 @@ /Win32 /Win64 /OSX32 - -# C++ Files # -################### -*.prjmgc - +/__history diff --git a/Source/VCL/SynEdit/ChangeLog.htm b/Source/VCL/SynEdit/ChangeLog.htm new file mode 100644 index 00000000..905f6fad --- /dev/null +++ b/Source/VCL/SynEdit/ChangeLog.htm @@ -0,0 +1,1644 @@ + + + SynEdit - Version history and changelog + + + +

SynEdit - Version history and changelog

+ +

Contributors:

+ +
+ Andre Mens, + Andrey Ustinov, + Andy Colson, + Anthony Steele, + Arentjan Banck, + Bruno Mikkelsen, + Colin Laplace, + Daniel Parnell, + David H. Muir, + Dean Harmon, + Eden Kirin, + Erik B. Berry, + Falko Jens Wagner, + Flávio Etrusco, + Gerald Nunn, + Jan Fiala, + James D. Richardson, + Jeff Rafter, + Johan Visser, + Jonathan Halterman, + Jordan Russell, + Lasse Vagsather Karlsen, + Lorant Toth, + Maël Hörz, + Marko Njezic, + Martin Pley, + Mattias Gaertner, + Michael Beck, + Michael Hieke, + Morten J. Skovrup, + Murad Kakabayev, + Pieter Polak, + Primoz Gabrijelcic, + Roman Silin, + Satya, + Sheng Quanhu, + Sören Spröβig, + Stefan van As, + Steve Sutherland, + Sven Blankenberg, + Tony De Buys, + Woo Young Bum +
+
+ +

[SynEdit 1.04]

+ + +
+ +

SynEdit 1.03 released 2000-11-26

+ + +
+ +

SynEdit 1.02 released 2000-10-03

+ + +
+ +

SynEdit 1.01 released 2000-07-28

+ + +
+ +

SynEdit 1.0 released 2000-06-28

+
+ +

+$Id: ChangeLog.htm,v 1.5.2.1 2004/10/09 18:34:26 maelh Exp $ +

+ + + + diff --git a/Source/VCL/SynEdit/Doc/CodeFolding.md b/Source/VCL/SynEdit/CodeFolding.md similarity index 100% rename from Source/VCL/SynEdit/Doc/CodeFolding.md rename to Source/VCL/SynEdit/CodeFolding.md diff --git a/Source/VCL/SynEdit/Delphinus.Info.json b/Source/VCL/SynEdit/Delphinus.Info.json new file mode 100644 index 00000000..6ac785d6 --- /dev/null +++ b/Source/VCL/SynEdit/Delphinus.Info.json @@ -0,0 +1,7 @@ +{ + "id": "{1FD66E41-B157-4C69-BC56-BCC3CCF0C47E}", + "license_type": "MPL-1.1", + "picture": "Logo.png", + "platforms": "Win32;Win64", + "package_compiler_min": 21 +} \ No newline at end of file diff --git a/Source/VCL/SynEdit/Delphinus.Install.json b/Source/VCL/SynEdit/Delphinus.Install.json new file mode 100644 index 00000000..0f309c45 --- /dev/null +++ b/Source/VCL/SynEdit/Delphinus.Install.json @@ -0,0 +1,80 @@ +{ + "search_pathes": [{ + "pathes": "Source", + "platforms": "Win32;Win64" + }], + + "browsing_pathes": [{ + "pathes": "Source", + "platforms": "Win32;Win64" + }], + + "source_folders": [{ + "folder": ".", + "recursive": true, + "filter": "*" + }], + + "projects": [ + { + "project": "Packages\\2010\\SynEdit.groupproj", + "compiler_min": 21, + "compiler_max": 21 + }, + { + "project": "Packages\\XE\\SynEdit.groupproj", + "compiler_min": 22, + "compiler_max": 22 + }, + { + "project": "Packages\\XE2\\SynEdit.groupproj", + "compiler_min": 23, + "compiler_max": 23 + }, + { + "project": "Packages\\XE3\\SynEdit.groupproj", + "compiler_min": 24, + "compiler_max": 24 + }, + { + "project": "Packages\\XE4\\SynEdit.groupproj", + "compiler_min": 25, + "compiler_max": 25 + }, + { + "project": "Packages\\XE5\\SynEdit.groupproj", + "compiler_min": 26, + "compiler_max": 26 + }, + { + "project": "Packages\\XE6\\SynEdit.groupproj", + "compiler_min": 27, + "compiler_max": 27 + }, + { + "project": "Packages\\XE7\\SynEdit.groupproj", + "compiler_min": 28, + "compiler_max": 28 + }, + { + "project": "Packages\\XE8\\SynEdit.groupproj", + "compiler_min": 29, + "compiler_max": 29 + }, + { + "project": "Packages\\10S\\SynEdit.groupproj", + "compiler_min": 30, + "compiler_max": 30 + }, + { + "project": "Packages\\101B\\SynEdit.groupproj", + "compiler_min": 31, + "compiler_max": 31 + }, + { + "project": "Packages\\102T\\SynEdit.groupproj", + "compiler_min": 32, + "compiler_max": 32 + } + ] +} \ No newline at end of file diff --git a/Source/VCL/SynEdit/Demos/AutoCompleteDemo/AutoCompleteDemo1.dpr b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/AutoCompleteDemo1.dpr new file mode 100644 index 00000000..81006984 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/AutoCompleteDemo1.dpr @@ -0,0 +1,49 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: AutoCompleteDemo1.dpr, released 2000-06-25. + +The Original Code is part of the AutoCompleteDemo1 project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: AutoCompleteDemo1.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program AutoCompleteDemo1; + +uses + Forms, + frmMain1 in 'frmMain1.pas' {Form1}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/AutoCompleteDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/ReadMe.txt new file mode 100644 index 00000000..0905274c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/ReadMe.txt @@ -0,0 +1,14 @@ +AutoCompleteDemo.dpr +-------------------- + +- Needs Delphi 2 or higher + +- Demonstrates the TSynAutoComplete class from the SynEditAutoComplete.pas file. + This is not registered on the component palette, it is created at runtime. + Later the various components in SynEditAutoComplete.pas and + SynCompletionProposal.pas should be integrated. +- The advantages compared with the old auto completion class are: + * Reads Delphi DCI style files. + * Undo is performed in one step. + * Recognizes partial shortcuts ("pro" instead of "proc" if there is no other + completion that starts with "pro"). diff --git a/Source/VCL/SynEdit/Demos/AutoCompleteDemo/delphi32.dci b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/delphi32.dci new file mode 100644 index 00000000..3854e716 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/delphi32.dci @@ -0,0 +1,137 @@ +[arrayd | Array-Deklaration (var)] +array[0..|] of ; + +[arrayc | Array-Deklaration (const)] +array[0..|] of = (); + +[cases | case-Anweisung] +case | of + : ; + : ; +end; + +[casee | case-Anweisung (mit else)] +case | of + : ; + : ; +else ; +end; + +[classf | Klassendeklaration (mit allen Bestandteilen)] +T| = class(T) +private + +protected + +public + +published + +end; + +[classd | Klassendeklaration (keine weiteren Bestandteile)] +T| = class(T) + +end; + +[classc | Klassendeklaration (mit Überschreiben von Create/Destroy)] +T| = class(T) +private + +protected + +public + constructor Create; override; + destructor Destroy; override; +published + +end; + +[fors | for (ohne begin/end)] +for | := to do + +[forb | for-Anweisung] +for | := to do +begin + +end; + +[function | Funktionsdeklaration] +function |(): ; +begin + +end; + +[ifs | if (ohne begin/end)] +if | then + +[ifb | if-Anweisung] +if | then +begin + +end; + +[ife | if then (ohne begin/end) else (ohne begin/end)] +if | then + +else + +[ifeb | if then else] +if | then +begin + +end +else +begin + +end; + +[procedure | Prozedurdeklaration] +procedure |(); +begin + +end; + +[trye | try except] +try + | +except + +end; + +[tryf | try finally] +try + | +finally + +end; + +[trycf | try finally (mit Create/Free)] +|variable := typename.Create; +try + +finally + variable.Free; +end; + +[whileb | while-Anweisung] +while | do +begin + +end; + +[whiles | while (ohne begin)] +while | do + +[withb | with-Anweisung] +with | do +begin + +end; + +[withs | with (ohne begin)] +with | do + +[set | settings.inc] +{$I settings.inc} +| diff --git a/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.dfm b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.dfm new file mode 100644 index 00000000..84b7764c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.dfm @@ -0,0 +1,67 @@ +object Form1: TForm1 + Left = 66 + Top = 78 + Width = 584 + Height = 362 + Caption = 'Autocompletion demo' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Menu = MainMenu1 + OldCreateOrder = True + Position = poDefault + OnClose = FormClose + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 576 + Height = 308 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Highlighter = SynPasSyn1 + Lines.Strings = ( + '// Press to invoke autocompletion, and to undo' + '' + 'arrayc' + 'classf' + 'pro') + RemovedKeystrokes = < + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecContextHelp + ShortCut = 112 + end> + AddedKeystrokes = <> + end + object SynPasSyn1: TSynPasSyn + Left = 276 + Top = 104 + end + object MainMenu1: TMainMenu + Left = 276 + Top = 56 + object miNewForm: TMenuItem + Caption = '&New form' + OnClick = miNewFormClick + end + end +end diff --git a/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.pas b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.pas new file mode 100644 index 00000000..30f95b99 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/AutoCompleteDemo/frmMain1.pas @@ -0,0 +1,90 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: frmMain1.pas, released 2000-06-25. + +The Original Code is part of the AutoCompleteDemo1 project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: frmMain1.pas,v 1.2 2000/11/22 08:34:13 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit frmMain1; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEditHighlighter, SynHighlighterPas, SynEdit, SynEditKeyCmds, + SynEditAutoComplete, Menus; + +type + TForm1 = class(TForm) + SynEdit1: TSynEdit; + SynPasSyn1: TSynPasSyn; + MainMenu1: TMainMenu; + miNewForm: TMenuItem; + procedure FormCreate(Sender: TObject); + procedure miNewFormClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + private + fAutoComplete: TSynAutoComplete; + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +procedure TForm1.FormCreate(Sender: TObject); +begin + if Application.MainForm = nil then begin + fAutoComplete := TSynAutoComplete.Create(Self); + fAutoComplete.Editor := SynEdit1; + fAutoComplete.AutoCompleteList.LoadFromFile('Delphi32.dci'); + end else + Form1.fAutoComplete.AddEditor(SynEdit1); + SynEdit1.AddKey(ecAutoCompletion, word('J'), [ssCtrl], 0, []); +end; + +procedure TForm1.miNewFormClick(Sender: TObject); +begin + with TForm1.Create(Application) do + Show; +end; + +procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); +begin + Action := caFree; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/D4Demo/D4demo.dpr b/Source/VCL/SynEdit/Demos/D4Demo/D4demo.dpr new file mode 100644 index 00000000..b9263cd4 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/D4demo.dpr @@ -0,0 +1,57 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: D4Demo.dpr, released 2000-06-23. + +The Original Code is the D4Demo project of the mwEdit component suite +by Martin Waldenburg and other developers. +The Original Author of the D4Demo project is Primoz Gabrijelcic. +Portions written by Primoz Gabrijelcic are copyright 1998 Primoz Gabrijelcic. +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: D4demo.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - printing has been removed from D4Demo, since it is covered in greater + detail in a dedicated example. +-------------------------------------------------------------------------------} + +program D4demo; + +uses + Forms, + EditU2 in 'EditU2.pas' {DemoMainForm}, + Unit2 in 'Unit2.pas' {Form2}, + uHighlighterProcs in '..\uHighlighterProcs.pas'; + +{$R *.RES} + +begin + Application.Initialize; + Application.Title := 'SynEdit Demo'; + Application.CreateForm(TDemoMainForm, DemoMainForm); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/D4Demo/EditU2.dfm b/Source/VCL/SynEdit/Demos/D4Demo/EditU2.dfm new file mode 100644 index 00000000..21c28a6f --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/EditU2.dfm @@ -0,0 +1,2390 @@ +object DemoMainForm: TDemoMainForm + Left = 287 + Top = 202 + Width = 685 + Height = 440 + Caption = 'SynEdit General Demo' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + Visible = True + OnCreate = FormCreate + OnDestroy = FormDestroy + OnResize = FormResize + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object PageControl1: TPageControl + Left = 0 + Top = 0 + Width = 677 + Height = 113 + ActivePage = TabSheet2 + Align = alTop + TabOrder = 0 + object tabFile: TTabSheet + Caption = 'File' + object outFilename: TLabel + Left = 88 + Top = 12 + Width = 42 + Height = 13 + Caption = 'Filename' + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object btnLoad: TButton + Left = 8 + Top = 6 + Width = 75 + Height = 25 + Caption = '&Load' + TabOrder = 0 + OnClick = btnLoadClick + end + object cbReadonly: TCheckBox + Left = 8 + Top = 35 + Width = 73 + Height = 17 + Caption = '&ReadOnly' + TabOrder = 1 + OnClick = cbReadonlyClick + end + end + object tabDisplay: TTabSheet + Caption = 'Display' + object Label12: TLabel + Left = 107 + Top = 36 + Width = 56 + Height = 13 + Caption = '&Right Edge:' + FocusControl = inpRightEdge + end + object Label13: TLabel + Left = 325 + Top = 42 + Width = 53 + Height = 13 + Caption = 'Scroll B&ars:' + FocusControl = cbxScrollBars + end + object Label14: TLabel + Left = 409 + Top = 12 + Width = 27 + Height = 13 + Caption = '&Color:' + FocusControl = cbxColor + end + object Label15: TLabel + Left = 409 + Top = 36 + Width = 78 + Height = 13 + Caption = 'Sel. &Foreground:' + FocusControl = cbxForeground + end + object Label16: TLabel + Left = 409 + Top = 60 + Width = 82 + Height = 13 + Caption = 'Sel. &Background:' + FocusControl = cbxBackground + end + object Label26: TLabel + Left = 107 + Top = 12 + Width = 86 + Height = 13 + Caption = 'E&xtra line spacing:' + end + object Label28: TLabel + Left = 107 + Top = 60 + Width = 83 + Height = 13 + Caption = 'Right Edge Color:' + FocusControl = cbxREColor + end + object cbHideSelection: TCheckBox + Left = 8 + Top = 11 + Width = 97 + Height = 17 + Caption = 'Hide &Selection' + TabOrder = 0 + OnClick = cbHideSelectionClick + end + object inpRightEdge: TSpinEdit + Left = 195 + Top = 33 + Width = 49 + Height = 22 + MaxLength = 3 + MaxValue = 999 + MinValue = 0 + TabOrder = 1 + Value = 80 + OnChange = inpRightEdgeChange + end + object cbScrollPastEOL: TCheckBox + Left = 8 + Top = 35 + Width = 97 + Height = 17 + Caption = 'Scroll Past &EOL' + TabOrder = 2 + OnClick = cbScrollPastEOLClick + end + object cbxScrollBars: TComboBox + Left = 325 + Top = 57 + Width = 81 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 3 + OnChange = cbxScrollBarsChange + Items.Strings = ( + 'None' + 'Horizontal' + 'Vertical' + 'Both') + end + object cbxColor: TComboBox + Left = 494 + Top = 9 + Width = 128 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 4 + OnChange = cbxColorChange + end + object cbxForeground: TComboBox + Left = 494 + Top = 33 + Width = 128 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 5 + OnChange = cbxForegroundChange + end + object cbxBackground: TComboBox + Left = 494 + Top = 57 + Width = 128 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 6 + OnChange = cbxBackgroundChange + end + object btnFont: TButton + Left = 263 + Top = 9 + Width = 121 + Height = 25 + Caption = 'F&ont' + TabOrder = 7 + OnClick = btnFontClick + end + object inpExtraLineSpacing: TSpinEdit + Left = 195 + Top = 9 + Width = 49 + Height = 22 + MaxLength = 3 + MaxValue = 99 + MinValue = -99 + TabOrder = 8 + Value = 0 + OnChange = inpExtraLineSpacingChange + end + object cbxREColor: TComboBox + Left = 195 + Top = 57 + Width = 128 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 9 + OnChange = cbxREColorChange + end + object cbHalfPageScroll: TCheckBox + Left = 8 + Top = 59 + Width = 97 + Height = 17 + Caption = '&HalfPage Scroll' + TabOrder = 10 + OnClick = cbHalfPageScrollClick + end + end + object tabEdit: TTabSheet + Caption = 'Edit' + object Label29: TLabel + Left = 8 + Top = 61 + Width = 53 + Height = 13 + Caption = '&Tab Width:' + FocusControl = inpTabWidth + end + object cbAutoIndent: TCheckBox + Left = 8 + Top = 11 + Width = 97 + Height = 17 + Caption = '&AutoIndent' + TabOrder = 0 + OnClick = cbAutoIndentClick + end + object cbWantTabs: TCheckBox + Left = 8 + Top = 35 + Width = 97 + Height = 17 + Caption = '&Want Tabs' + TabOrder = 1 + OnClick = cbWantTabsClick + end + object inpTabWidth: TSpinEdit + Left = 72 + Top = 57 + Width = 57 + Height = 22 + MaxValue = 16 + MinValue = 1 + TabOrder = 2 + Value = 2 + OnChange = inpTabWidthChange + end + object cbDragDropEdit: TCheckBox + Left = 148 + Top = 11 + Width = 129 + Height = 17 + Caption = 'Drag and drop editing' + TabOrder = 3 + OnClick = cbDragDropEditClick + end + end + object tabSearch: TTabSheet + Caption = 'Search' + object lblSearchResult: TLabel + Left = 268 + Top = 12 + Width = 481 + Height = 13 + AutoSize = False + Caption = 'lblSearchResult' + Font.Charset = DEFAULT_CHARSET + Font.Color = clRed + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object btnSearch: TButton + Left = 8 + Top = 6 + Width = 75 + Height = 25 + Caption = '&Search...' + TabOrder = 0 + OnClick = btnSearchClick + end + object btnSearchNext: TButton + Left = 92 + Top = 6 + Width = 75 + Height = 25 + Caption = '&Next' + Enabled = False + TabOrder = 1 + OnClick = btnSearchNextPrevClick + end + object btnSearchPrev: TButton + Left = 176 + Top = 6 + Width = 75 + Height = 25 + Caption = '&Previous' + Enabled = False + TabOrder = 2 + OnClick = btnSearchNextPrevClick + end + object btnReplace: TButton + Left = 8 + Top = 42 + Width = 75 + Height = 25 + Caption = '&Replace...' + TabOrder = 3 + OnClick = btnReplaceClick + end + end + object tabCaret: TTabSheet + Caption = 'Caret' + object Label7: TLabel + Left = 8 + Top = 12 + Width = 57 + Height = 13 + Caption = '&Insert Caret:' + FocusControl = cbxInsertCaret + end + object Label8: TLabel + Left = 8 + Top = 36 + Width = 76 + Height = 13 + Caption = '&Overwrite Caret:' + FocusControl = cbxOverwriteCaret + end + object cbxInsertCaret: TComboBox + Left = 88 + Top = 9 + Width = 97 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 0 + OnChange = cbxInsertCaretChange + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') + end + object cbxOverwriteCaret: TComboBox + Left = 88 + Top = 33 + Width = 97 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 1 + OnChange = cbxOverwriteCaretChange + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') + end + object cbInsertMode: TCheckBox + Left = 8 + Top = 59 + Width = 80 + Height = 17 + Caption = 'Insert &Mode' + TabOrder = 2 + OnClick = cbInsertModeClick + end + end + object tabGutter: TTabSheet + Caption = 'Gutter' + object Label5: TLabel + Left = 8 + Top = 12 + Width = 59 + Height = 13 + Caption = 'Gutter &Color:' + FocusControl = cbxGutterColor + end + object Label6: TLabel + Left = 8 + Top = 36 + Width = 63 + Height = 13 + Caption = 'Gutter &Width:' + FocusControl = inpGutterWidth + end + object Label30: TLabel + Left = 8 + Top = 60 + Width = 55 + Height = 13 + Caption = '&Digit Count:' + FocusControl = inpDigitCount + end + object Label31: TLabel + Left = 240 + Top = 12 + Width = 52 + Height = 13 + Caption = 'L&eft Offset:' + FocusControl = inpLeftOffset + end + object Label32: TLabel + Left = 240 + Top = 36 + Width = 59 + Height = 13 + Caption = '&Right Offset:' + FocusControl = inpRightOffset + end + object cbxGutterColor: TComboBox + Left = 80 + Top = 9 + Width = 137 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 0 + OnChange = cbxGutterColorChange + end + object cbLineNumbers: TCheckBox + Left = 392 + Top = 11 + Width = 97 + Height = 17 + Caption = 'Line &Numbers' + TabOrder = 3 + OnClick = cbLineNumbersClick + end + object cbLeadingZeros: TCheckBox + Left = 392 + Top = 35 + Width = 97 + Height = 17 + Caption = '&Leading Zeros' + TabOrder = 4 + OnClick = cbLeadingZerosClick + end + object cbZeroStart: TCheckBox + Left = 392 + Top = 59 + Width = 97 + Height = 17 + Caption = '&Zero Start' + TabOrder = 5 + OnClick = cbZeroStartClick + end + object inpGutterWidth: TSpinEdit + Left = 80 + Top = 33 + Width = 57 + Height = 22 + MaxValue = 100 + MinValue = 0 + TabOrder = 1 + Value = 2 + OnChange = inpGutterWidthChange + end + object inpDigitCount: TSpinEdit + Left = 80 + Top = 57 + Width = 57 + Height = 22 + MaxLength = 2 + MaxValue = 99 + MinValue = 1 + TabOrder = 2 + Value = 4 + OnChange = inpDigitCountChange + end + object inpLeftOffset: TSpinEdit + Left = 312 + Top = 9 + Width = 57 + Height = 22 + MaxValue = 100 + MinValue = 0 + TabOrder = 6 + Value = 16 + OnChange = inpLeftOffsetChange + end + object inpRightOffset: TSpinEdit + Left = 312 + Top = 31 + Width = 57 + Height = 22 + MaxLength = 2 + MaxValue = 99 + MinValue = 1 + TabOrder = 7 + Value = 2 + OnChange = inpRightOffsetChange + end + object cbAutoSize: TCheckBox + Left = 504 + Top = 11 + Width = 97 + Height = 17 + Caption = 'Auto &Size' + TabOrder = 8 + OnClick = cbAutoSizeClick + end + object cbGutterVisible: TCheckBox + Left = 504 + Top = 35 + Width = 97 + Height = 17 + Caption = '&Visible' + TabOrder = 9 + OnClick = cbGutterVisibleClick + end + object cbUseFontStyle: TCheckBox + Left = 504 + Top = 59 + Width = 97 + Height = 17 + Caption = '&Use font style' + TabOrder = 10 + OnClick = cbUseFontStyleClick + end + end + object tabBookmarks: TTabSheet + Caption = 'Marks' + object Label4: TLabel + Left = 144 + Top = 12 + Width = 56 + Height = 13 + Caption = '&Left Margin:' + end + object SpeedButton1: TSpeedButton + Tag = 10 + Left = 312 + Top = 56 + Width = 23 + Height = 22 + AllowAllUp = True + GroupIndex = 1 + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + DDDDDDDD999DDDDDDDDDDD9999999DDDDDDDD999999999DDDDDDD999999999DD + DDDD99000000099DDDDD99000000099DDDDD99000000099DDDDDD999999999DD + DDDDD999999999DDDDDDDD9999999DDDDDDDDDDD999DDDDDDDDD} + OnClick = SpeedButtonClick + end + object SpeedButton2: TSpeedButton + Tag = 11 + Left = 336 + Top = 56 + Width = 23 + Height = 22 + AllowAllUp = True + GroupIndex = 1 + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD20DD200DDD + 02DDDDD2022220D02DDDDDDD00A22200DDDDDDDDD2A6220DDDDDDD22D2AA220D + 22DDDDD002AA22000DDDDDDDD2AA22DDDDDDDDDD002AA000DDDDDDD028220082 + 0DDDDDD2D912019D2DDDDDDDDD1A21DDDDDDDDDDD0D22D0DDDDD} + OnClick = SpeedButtonClick + end + object SpeedButton3: TSpeedButton + Tag = 12 + Left = 360 + Top = 56 + Width = 23 + Height = 22 + AllowAllUp = True + GroupIndex = 1 + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD3333333333DDDDD38BBBBBBBB + 83DDDD3BBBB00BBBB3DDDD3BBBBBBBBBB3DDDD38BBB00BBB83DDDDD3BBB00BBB + 3DDDDDD78BB00BB87DDDDDDD3BB00BB3DDDDDDDD78B00B87DDDDDDDDD3BBBB3D + DDDDDDDDD37BB73DDDDDDDDDDD3333DDDDDDDDDDDDDDDDDDDDDD} + OnClick = SpeedButtonClick + end + object SpeedButton4: TSpeedButton + Tag = 13 + Left = 384 + Top = 56 + Width = 23 + Height = 22 + AllowAllUp = True + GroupIndex = 1 + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD44DDD + DDDDDDDDDDEC4DDDDDDDDDDDDDDDDDDDDDDDDDDDDDEC4DDDDDDDDDDDDDEC4DDD + DDDDDDDDDDEC4DDDDDDDDDDDDDDEC4DDDDDDDDDDD44DEC4DDDDDDDDDEC4DEC4D + DDDDDDDDEC44CC4DDDDDDDDDDECCC4DDDDDDDDDDDDEEEDDDDDDD} + OnClick = SpeedButtonClick + end + object SpeedButton5: TSpeedButton + Tag = 14 + Left = 408 + Top = 56 + Width = 23 + Height = 22 + AllowAllUp = True + GroupIndex = 1 + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + DDDDDDDDDDDDDCCEDDDDDDCDDDDDDDCCEDDDDDDCDDDDDDCCCEDDDDDDCCCCCCCC + CCEDDDDCDDDDDDCCCEDDDDCDDDDDDDCCEDDDDDDDDDDDDCCEDDDDDDDDDDDDDDDD + DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD} + OnClick = SpeedButtonClick + end + object Label25: TLabel + Left = 144 + Top = 36 + Width = 41 + Height = 13 + Caption = '&X Offset:' + end + object cbEnableKeys: TCheckBox + Left = 8 + Top = 11 + Width = 97 + Height = 17 + Caption = 'Enable &Keys' + TabOrder = 0 + OnClick = cbEnableKeysClick + end + object cbGlyphsVisible: TCheckBox + Left = 8 + Top = 35 + Width = 97 + Height = 17 + Caption = '&Glyphs Visible' + TabOrder = 1 + OnClick = cbGlyphsVisibleClick + end + object inpLeftMargin: TSpinEdit + Left = 208 + Top = 9 + Width = 57 + Height = 22 + MaxValue = 100 + MinValue = 0 + TabOrder = 3 + Value = 2 + OnChange = inpLeftMarginChange + end + object cbInternalImages: TCheckBox + Left = 8 + Top = 59 + Width = 97 + Height = 17 + Caption = '&Internal Images' + TabOrder = 2 + OnClick = cbInternalImagesClick + end + object inpXOffset: TSpinEdit + Left = 208 + Top = 33 + Width = 57 + Height = 22 + MaxValue = 100 + MinValue = 0 + TabOrder = 4 + Value = 12 + OnChange = inpXOffsetChange + end + object Label2: TMemo + Left = 312 + Top = 8 + Width = 225 + Height = 45 + TabStop = False + BorderStyle = bsNone + Lines.Strings = ( + 'Ctrl+Shift+ sets/moves/clears, ' + 'Ctrl+ jumps.' + 'Click into gutter to set/clear gutter marks.') + ParentColor = True + ReadOnly = True + TabOrder = 5 + end + end + object tabUndo: TTabSheet + Caption = 'Undo' + object Label11: TLabel + Left = 8 + Top = 40 + Width = 52 + Height = 13 + Caption = 'Ma&x Undo:' + FocusControl = inpMaxUndo + end + object Label19: TLabel + Left = 144 + Top = 12 + Width = 374 + Height = 13 + Caption = + 'Shortcut for Undo is Alt+Backspace. Shortcut for Redo is Alt+Shi' + + 'ft+Backspace.' + WordWrap = True + end + object btnUndo: TButton + Left = 8 + Top = 6 + Width = 57 + Height = 25 + Caption = '&Undo' + Enabled = False + TabOrder = 0 + OnClick = btnUndoClick + end + object inpMaxUndo: TSpinEdit + Left = 72 + Top = 37 + Width = 57 + Height = 22 + MaxValue = 9999 + MinValue = 0 + TabOrder = 1 + Value = 10 + OnChange = inpMaxUndoChange + end + object btnRedo: TButton + Left = 72 + Top = 6 + Width = 57 + Height = 25 + Caption = '&Redo' + Enabled = False + TabOrder = 2 + OnClick = btnRedoClick + end + end + object tabHighlighter: TTabSheet + Caption = 'Highlighter' + object Label1: TLabel + Left = 8 + Top = 38 + Width = 63 + Height = 13 + Caption = '&Use Settings:' + FocusControl = cbxSettingsSelect + end + object Label3: TLabel + Left = 8 + Top = 1 + Width = 53 + Height = 13 + Caption = '&Highlighter:' + FocusControl = cbxHighlighterSelect + end + object Label23: TLabel + Left = 328 + Top = 1 + Width = 84 + Height = 13 + Caption = '&Foreground Color:' + FocusControl = cbxAttrForeground + end + object Label24: TLabel + Left = 328 + Top = 38 + Width = 88 + Height = 13 + Caption = 'Bac&kground Color:' + FocusControl = cbxAttrBackground + end + object Label22: TLabel + Left = 224 + Top = 1 + Width = 42 + Height = 13 + Caption = 'A&ttribute:' + FocusControl = cbxAttrSelect + end + object cbxHighlighterSelect: TComboBox + Left = 8 + Top = 15 + Width = 105 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 0 + OnChange = cbxHighlighterSelectChange + end + object cbxSettingsSelect: TComboBox + Left = 8 + Top = 52 + Width = 105 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 1 + OnChange = cbxSettingsSelectChange + end + object cbxAttrSelect: TComboBox + Left = 224 + Top = 15 + Width = 97 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 5 + OnChange = cbxAttrSelectChange + Items.Strings = ( + 'Assembler' + 'Comment' + 'Identifier' + 'Number' + 'Operator' + 'Pragma' + 'Preprocessor' + 'Reserved word' + 'Symbol' + 'Space' + 'String' + 'Variable') + end + object cbxAttrBackground: TComboBox + Left = 328 + Top = 52 + Width = 121 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 6 + OnChange = cbxAttrBackgroundChange + end + object cbxAttrForeground: TComboBox + Left = 328 + Top = 15 + Width = 121 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 7 + OnChange = cbxAttrForegroundChange + end + object btnKeywords: TButton + Left = 120 + Top = 54 + Width = 89 + Height = 19 + Caption = '&Reserved Words' + TabOrder = 4 + OnClick = btnKeywordsClick + end + object grbAttrComments: TGroupBox + Left = 457 + Top = 32 + Width = 161 + Height = 49 + Caption = ' Comments' + TabOrder = 9 + object cbCommentsBas: TCheckBox + Left = 104 + Top = 13 + Width = 41 + Height = 17 + Caption = 'B&as' + TabOrder = 4 + OnClick = cbCommentsClick + end + object cbCommentsAsm: TCheckBox + Left = 56 + Top = 27 + Width = 41 + Height = 17 + Caption = 'As&m' + TabOrder = 3 + OnClick = cbCommentsClick + end + object cbCommentsPas: TCheckBox + Left = 8 + Top = 27 + Width = 41 + Height = 17 + Caption = '&Pas' + TabOrder = 1 + OnClick = cbCommentsClick + end + object cbCommentsAnsi: TCheckBox + Left = 8 + Top = 13 + Width = 41 + Height = 17 + Caption = 'A&nsi' + TabOrder = 0 + OnClick = cbCommentsClick + end + object cbCommentsC: TCheckBox + Left = 56 + Top = 13 + Width = 41 + Height = 17 + Caption = '&C' + TabOrder = 2 + OnClick = cbCommentsClick + end + end + object grbAttrStyle: TGroupBox + Left = 457 + Top = 0 + Width = 161 + Height = 33 + Caption = ' Style ' + TabOrder = 8 + object cbStyleBold: TCheckBox + Left = 8 + Top = 13 + Width = 33 + Height = 17 + Caption = '&B' + TabOrder = 0 + OnClick = cbFontStyleClick + end + object cbStyleStrikeOut: TCheckBox + Left = 110 + Top = 13 + Width = 33 + Height = 17 + Caption = '&S' + TabOrder = 3 + OnClick = cbFontStyleClick + end + object cbStyleUnderline: TCheckBox + Left = 76 + Top = 13 + Width = 31 + Height = 17 + Caption = '&U' + TabOrder = 2 + OnClick = cbFontStyleClick + end + object cbStyleItalic: TCheckBox + Left = 42 + Top = 13 + Width = 28 + Height = 17 + Caption = '&I' + TabOrder = 1 + OnClick = cbFontStyleClick + end + end + object btnSaveToReg: TButton + Left = 120 + Top = 16 + Width = 89 + Height = 19 + Caption = 'Sa&ve to Reg' + TabOrder = 2 + OnClick = btnSaveToRegClick + end + object btnLoadFromReg: TButton + Left = 120 + Top = 35 + Width = 89 + Height = 19 + Caption = '&Load from Reg' + TabOrder = 3 + OnClick = btnLoadFromRegClick + end + end + object tabExporter: TTabSheet + Caption = 'Export' + object Label27: TLabel + Left = 8 + Top = 31 + Width = 42 + Height = 13 + Caption = '&Exporter:' + FocusControl = cbxExporterSelect + end + object cbxExporterSelect: TComboBox + Left = 8 + Top = 50 + Width = 136 + Height = 21 + Style = csDropDownList + ItemHeight = 0 + TabOrder = 1 + OnChange = cbxExporterSelectChange + end + object cbExportSelected: TCheckBox + Left = 8 + Top = 11 + Width = 121 + Height = 17 + Caption = 'E&xport selected only' + TabOrder = 0 + end + object btnExportToFile: TButton + Left = 160 + Top = 14 + Width = 110 + Height = 24 + Caption = 'Export to &file...' + TabOrder = 2 + OnClick = btnExportToFileClick + end + object btnExportToClipboard: TButton + Left = 160 + Top = 48 + Width = 110 + Height = 24 + Caption = 'Export to clipboard' + TabOrder = 3 + OnClick = btnExportToClipboardClick + end + end + object tabInfo: TTabSheet + Caption = 'Info' + object Label9: TLabel + Left = 8 + Top = 12 + Width = 46 + Height = 13 + Caption = 'Left &Char:' + FocusControl = inpLeftChar + end + object Label10: TLabel + Left = 8 + Top = 60 + Width = 47 + Height = 13 + Caption = 'Line &Text:' + FocusControl = inpLineText + end + object Label17: TLabel + Left = 192 + Top = 12 + Width = 38 + Height = 13 + Caption = 'Caret &X:' + FocusControl = inpCaretX + end + object Label18: TLabel + Left = 192 + Top = 36 + Width = 38 + Height = 13 + Caption = 'Caret &Y:' + FocusControl = inpCaretY + end + object Label20: TLabel + Left = 8 + Top = 36 + Width = 45 + Height = 13 + Caption = 'Top &Line:' + FocusControl = inpTopLine + end + object Label21: TLabel + Left = 376 + Top = 12 + Width = 54 + Height = 13 + Caption = 'Line Count:' + end + object inpLineText: TEdit + Left = 56 + Top = 57 + Width = 457 + Height = 21 + Color = clBtnFace + ReadOnly = True + TabOrder = 2 + end + object outLineCount: TEdit + Left = 440 + Top = 9 + Width = 73 + Height = 21 + ParentColor = True + ReadOnly = True + TabOrder = 5 + end + object inpLeftChar: TSpinEdit + Left = 56 + Top = 9 + Width = 65 + Height = 22 + MaxValue = 1024 + MinValue = 0 + TabOrder = 0 + Value = 0 + OnChange = inpLeftCharChange + end + object inpTopLine: TSpinEdit + Left = 56 + Top = 33 + Width = 65 + Height = 22 + MaxValue = 0 + MinValue = 0 + TabOrder = 1 + Value = 0 + OnChange = inpTopLineChange + end + object inpCaretX: TSpinEdit + Left = 232 + Top = 9 + Width = 65 + Height = 22 + MaxValue = 0 + MinValue = 0 + TabOrder = 3 + Value = 0 + OnChange = inpCaretXChange + end + object inpCaretY: TSpinEdit + Left = 232 + Top = 33 + Width = 65 + Height = 22 + MaxValue = 0 + MinValue = 0 + TabOrder = 4 + Value = 0 + OnChange = inpCaretYChange + end + end + object TabSheet1: TTabSheet + Caption = 'Keyboard' + object KeyCmdList: TListView + Left = 8 + Top = 2 + Width = 254 + Height = 80 + Columns = < + item + Caption = 'Command' + Width = 0 + end + item + Caption = 'Keystroke' + Width = 0 + end> + ColumnClick = False + HideSelection = False + ReadOnly = True + TabOrder = 0 + ViewStyle = vsReport + end + object btnEdit: TButton + Left = 268 + Top = 6 + Width = 75 + Height = 25 + Caption = '&Edit' + TabOrder = 1 + OnClick = btnEditClick + end + end + object TabSheet2: TTabSheet + Caption = 'Completion' + ImageIndex = 14 + object Label34: TLabel + Left = 8 + Top = 45 + Width = 42 + Height = 13 + Caption = 'A&ttribute:' + FocusControl = cbCompletionAttr + end + object Label35: TLabel + Left = 112 + Top = 45 + Width = 27 + Height = 13 + Caption = '&Color:' + FocusControl = cbxCompletionColor + end + object Memo2: TMemo + Left = 8 + Top = 4 + Width = 269 + Height = 21 + BorderStyle = bsNone + Lines.Strings = ( + 'Press Ctrl+Space for Completion Proposal demo.') + ParentColor = True + TabOrder = 0 + end + object Memo3: TMemo + Left = 320 + Top = 4 + Width = 273 + Height = 57 + BorderStyle = bsNone + Lines.Strings = ( + 'Type "bg" (without quotes) and press Shift+Space for ' + 'Auto Complete demo.' + 'Type "findfirst" (without quotes) and press Shift+Space ' + 'for another Auto Complete demo.') + ParentColor = True + TabOrder = 1 + end + object cbShrinkList: TCheckBox + Left = 8 + Top = 24 + Width = 193 + Height = 17 + Caption = '&Shrink List (like Delphi 6)' + Checked = True + State = cbChecked + TabOrder = 2 + OnClick = cbShrinkListClick + end + object cbCompletionAttr: TComboBox + Left = 8 + Top = 59 + Width = 97 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 3 + OnChange = cbCompletionAttrChange + Items.Strings = ( + 'Background' + 'Text' + 'Selected' + 'SelectedText') + end + object cbxCompletionColor: TComboBox + Left = 112 + Top = 59 + Width = 121 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 4 + OnChange = cbxCompletionColorChange + end + end + object tabEvents: TTabSheet + Caption = 'Events' + object cbEnableEventLog: TCheckBox + Left = 8 + Top = 11 + Width = 128 + Height = 17 + Caption = 'Enable &Event Logging' + TabOrder = 0 + OnClick = cbEnableEventLogClick + end + object lbEventLog: TListBox + Left = 144 + Top = 8 + Width = 225 + Height = 72 + ItemHeight = 13 + TabOrder = 2 + end + object cbMouse: TCheckBox + Left = 392 + Top = 8 + Width = 97 + Height = 17 + Caption = '&Mouse events' + TabOrder = 3 + end + object cbDrag: TCheckBox + Left = 392 + Top = 40 + Width = 145 + Height = 17 + Caption = '&Drag and drop events' + Checked = True + State = cbChecked + TabOrder = 5 + end + object cbKeyboard: TCheckBox + Left = 392 + Top = 24 + Width = 193 + Height = 17 + Caption = '&Keyboard and Command events' + Checked = True + State = cbChecked + TabOrder = 4 + end + object cbOther: TCheckBox + Left = 392 + Top = 56 + Width = 97 + Height = 17 + Caption = '&Other events' + Checked = True + State = cbChecked + TabOrder = 6 + end + object btnClear: TButton + Left = 8 + Top = 55 + Width = 75 + Height = 25 + Caption = '&Clear' + TabOrder = 1 + OnClick = btnClearClick + end + end + object tabAbout: TTabSheet + Caption = 'About' + object Label33: TLabel + Left = 8 + Top = 7 + Width = 172 + Height = 24 + Caption = 'SynEdit demo app' + Font.Charset = DEFAULT_CHARSET + Font.Color = clMaroon + Font.Height = -19 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Memo1: TMemo + Left = 8 + Top = 44 + Width = 593 + Height = 29 + BorderStyle = bsNone + Lines.Strings = ( + 'Written by Primoz Gabrijelcic, primoz.gabrijelcic@altavista.net.' + + 'Contributors: Carlos Wijders, Brad Stowers, Heedong Lim, Michael' + + ' Hieke.') + ParentColor = True + TabOrder = 0 + end + end + end + object StatusBar: TStatusBar + Left = 0 + Top = 387 + Width = 677 + Height = 19 + Panels = < + item + Width = 64 + end + item + Alignment = taCenter + Width = 60 + end + item + Alignment = taCenter + Width = 64 + end + item + Bevel = pbNone + Width = 50 + end> + SimplePanel = False + end + object SynEditor: TSynEdit + Left = 0 + Top = 113 + Width = 677 + Height = 274 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 2 + OnClick = SynEditorClick + OnDblClick = SynEditorDblClick + OnDragDrop = SynEditorDragDrop + OnDragOver = SynEditorDragOver + OnEndDrag = SynEditorEndDrag + OnEnter = SynEditorEnter + OnExit = SynEditorExit + OnKeyDown = SynEditorKeyDown + OnKeyPress = SynEditorKeyPress + OnKeyUp = SynEditorKeyUp + OnMouseDown = SynEditorMouseDown + OnMouseMove = SynEditorMouseMove + OnMouseUp = SynEditorMouseUp + OnStartDrag = SynEditorStartDrag + BookMarkOptions.BookmarkImages = ImageList1 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Terminal' + Gutter.Font.Style = [] + Options = [eoAutoIndent, eoDragDropEditing, eoDropFiles, eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces] + OnChange = SynEditorChange + OnCommandProcessed = SynEditorCommandProcessed + OnContextHelp = SynEditorContextHelp + OnDropFiles = SynEditorDropFiles + OnGutterClick = SynEditorGutterClick + OnPaint = SynEditorPaint + OnPlaceBookmark = SynEditorPlaceBookmark + OnProcessCommand = SynEditorProcessCommand + OnProcessUserCommand = SynEditorProcessUserCommand + OnReplaceText = SynEditorReplaceText + OnStatusChange = SynEditorStatusChange + RemovedKeystrokes = < + item + Command = ecDeleteLastChar + ShortCut = 8200 + end + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecContextHelp + ShortCut = 112 + end> + AddedKeystrokes = < + item + Command = ecContextHelp + ShortCut = 16496 + end> + end + object OpenDialog1: TOpenDialog + Left = 40 + Top = 132 + end + object FontDialog1: TFontDialog + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MinFontSize = 0 + MaxFontSize = 0 + Options = [fdEffects, fdFixedPitchOnly] + Left = 72 + Top = 132 + end + object ImageList1: TImageList + Left = 104 + Top = 132 + Bitmap = { + 494C01010F001300040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000004000000001002000000000000040 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000080 + 8000008080000080800000808000008080000080800000808000008080000080 + 8000008080000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000808000C0C0 + C00000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF00C0C0C0000080800000000000000000000000000000000000000000000000 + 0000000000000000000000000000800000008000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000080800000FF + FF0000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FFFF0000FF + FF0000FFFF000080800000000000000000000000000000000000000000000000 + 00000000000000000000FFFF0000FF0000008000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FFFF + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000080800000FF + FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF + FF0000FFFF000080800000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000FF0000000000 + 0000000000000000000000000000000000000000000000000000FF000000FF00 + 0000FFFF00000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000808000C0C0 + C00000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FFFF0000FF + FF00C0C0C0000080800000000000000000000000000000000000000000000000 + 00000000000000000000FFFF0000FF0000008000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000000000000000000000000000000000000000000000000000FF000000FF00 + 0000FF000000FFFF000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000080 + 800000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FFFF0000FF + FF00008080000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFF0000FF0000008000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 0000FF000000FF000000FFFF0000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008080 + 8000C0C0C00000FFFF0000FFFF00000000000000000000FFFF0000FFFF00C0C0 + C000808080000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFF0000FF0000008000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000000000000000000000000000000000000000000000000000FF000000FF00 + 0000FF000000FFFF000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000080800000FFFF0000FFFF00000000000000000000FFFF0000FFFF000080 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFF0000FF00000080000000000000000000 + 0000000000000000000000000000000000000000000000000000FF0000000000 + 0000000000000000000000000000000000000000000000000000FF000000FF00 + 0000FFFF00000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000080808000C0C0C00000FFFF00000000000000000000FFFF00C0C0C0008080 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000008000000080000000C0C0C000FFFF0000FF000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FFFF + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000080800000FFFF0000FFFF0000FFFF0000FFFF00008080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFF0000FF00000080000000C0C0C000FFFF0000FF000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000008080008080800000FFFF0000FFFF0080808000008080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFF0000FF0000008000000080000000FF000000FF000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000808000008080000080800000808000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFF0000FF000000FF000000FF00000080000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFF0000FFFF0000FFFF000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF0000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF0000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000008000000000 + 0000000000000000000000800000000000000000000000000000000000000000 + 00000000000000800000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF0000000000000000000000000000000000000000000000000000000000 + 00000000FF000000FF000000FF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000080 + 0000000000000080000000800000008000000080000000000000000000000000 + 00000080000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000000000000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000FF0000008000000080000000800000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF00008000008080000000FFFF0000FFFF0000800000FF0000008080 + 8000FF000000000000000000000000000000000000000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF000000FF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000080000000FF0000808000000080000000800000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF000000000000000000000000000000000000000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF000000FF00000000000000 + 0000000000000000000000000000000000000000000000000000008000000080 + 0000000000000080000000FF000000FF00000080000000800000000000000000 + 00000080000000800000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF0000000000000000000000000000000000FF000000FF00000000000000 + 000000000000000000000000000000000000000000000000FF000000FF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000080000000FF000000FF00000080000000800000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF0000000000000000000000000000000000FF000000FF00000000000000 + 000000000000000000000000000000000000000000000000FF000000FF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000080000000FF000000FF00000080000000800000000000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF0000000000000000000000000000000000FF000000FF00000000000000 + 000000000000000000000000000000000000000000000000FF000000FF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000080000000FF000000FF000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF000000000000000000000000000000000000000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF000000FF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000800000C0C0C00000800000008000000000000000000000C0C0C0000080 + 0000000000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF000000000000000000000000000000000000000000FF000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF000000FF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000080 + 0000000000000000FF00000080000080000000000000000080000000FF000000 + 000000800000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 00000000000000000000000000000000000000000000000000000000FF000000 + FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000800000FF00000080000000008000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000FF000000FF000000FF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000008000000080000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0000080 + 000080800000008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000000FFFF00008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000800000808000000080000000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000080800000008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000000FFFF00008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000800000808000000080000000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF00008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000080800000008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF00808000000080000000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF008080000000800000808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF008080000000800000808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF00008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF00808000000080000000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000800000808000000080000080800000FF000000FF00 + 00000000000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF008080000000800000808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000000FFFF00008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000000FFFF00008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000080800000008000008080000000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000000FFFF0000FFFF008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF0080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 000000FFFF008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000080800000008000008080000000FFFF0080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 00008080000000FFFF0000FFFF00008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 000000FFFF0000800000808000000080000000FFFF0000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 0000008000008080000000FFFF00808000000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0008080 + 00000080000000FFFF0000FFFF0000FFFF000080000080800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000C0C0C0000080 + 0000808000000080000080800000008000008080000000800000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF00000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF0000008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF0000000000000000000000000000000000000000000000FF000000C0C0 + C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080 + 8000FF000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000000000000000000000000000000000000000000000000000000000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000400000000100010000000000000200000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFFFFFF0000FFFFFFFFFFFF0000 + FFFFFFFFFFFF0000E007FFFFFFFF0000C003FE7FFFFF0000C003FC7FFF8F0000 + C003FFFFDFC70000C003FC7FEFC30000E007FC7FF0010000E007FC7FEFC30000 + F00FFE3FDFC70000F00FF81FFF8F0000F81FF01FFFFF0000F81FF01FFFFF0000 + FC3FF83FFFFF0000FFFFFC7FFFFF0000FFFFFFFFFFFFFFFF801F801FFFFFFFFF + 800F800FFFFFFFFF80078007FFFFFFFF80078007FFFFCC7380078007F1FFE027 + 80078007C07FF00F80078007803FF81F80078007803FC81380078007001FE007 + 80078007001FF83F80078007001FF00F80078007803FE007C007C007803FE817 + E00FE00FC07FFC3FFFFFFFFFF1FFFA5FFFFFFFFFFFFFFFFF801F801F801F801F + 800F800F800F800F800780078007800780078007800780078007800780078007 + 8007800780078007800780078007800780078007800780078007800780078007 + 800780078007800780078007800780078007800780078007C007C007C007C007 + E00FE00FE00FE00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF801F801F801F801F + 800F800F800F800F800780078007800780078007800780078007800780078007 + 8007800780078007800780078007800780078007800780078007800780078007 + 800780078007800780078007800780078007800780078007C007C007C007C007 + E00FE00FE00FE00FFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} + end + object FindDialog1: TFindDialog + OnFind = DoFindText + Left = 136 + Top = 132 + end + object ReplaceDialog1: TReplaceDialog + OnFind = DoFindText + OnReplace = DoReplaceText + Left = 168 + Top = 132 + end + object SaveDialog1: TSaveDialog + Title = 'Export to' + Left = 200 + Top = 132 + end + object SynExporterHTML1: TSynExporterHTML + Color = clWindow + DefaultFilter = 'HTML Document (*.htm,*.html)|*.htm;*.html' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Title = 'Untitled' + UseBackground = False + Left = 300 + Top = 164 + end + object SynExporterRTF1: TSynExporterRTF + Color = clWindow + DefaultFilter = 'Rich Text Format (*.rtf)|*.rtf' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Title = 'Untitled' + UseBackground = False + Left = 332 + Top = 164 + end + object SynCompletionProposal1: TSynCompletionProposal + Options = [scoLimitToMatchedText, scoEndCharCompletion] + ItemList.Strings = ( + 'SynEdit' + 'SynCompletionProposal demo' + '' + 'Select line, then press Enter.' + 'Line will be copied to the editor.') + NbLinesInWindow = 6 + Width = 262 + EndOfTokenChr = '()[].' + TriggerChars = '.' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clBtnText + TitleFont.Height = -11 + TitleFont.Name = 'MS Sans Serif' + TitleFont.Style = [fsBold] + Columns = <> + ShortCut = 16416 + Editor = SynEditor + Left = 392 + Top = 164 + end + object SynAutoComplete1: TSynAutoComplete + AutoCompleteList.Strings = ( + 'bg' + '=begin' + '= |' + '=end;' + 'findfirst' + '=err := FindFirst('#39'*.*'#39',0,S);' + '=if err = 0 then begin' + '= repeat' + '= |' + '= err := FindNext(S);' + '= until err <> 0;' + '= FindClose(S);' + '=end;') + EndOfTokenChr = '()[].' + Editor = SynEditor + ShortCut = 8224 + Options = [] + Left = 428 + Top = 164 + end + object SynHC11Syn1: TSynHC11Syn + DefaultFilter = '68HC11 Assembler files (*.hc11,*.asm,*.asc)|*.HC11;*.ASM;*.ASC' + Left = 72 + Top = 240 + end + object SynADSP21xxSyn1: TSynADSP21xxSyn + DefaultFilter = 'DSP files (*.dsp,*.inc)|*.DSP;*.INC' + Left = 104 + Top = 240 + end + object SynAWKSyn1: TSynAWKSyn + DefaultFilter = 'AWK Script (*.awk)|*.awk' + Left = 136 + Top = 240 + end + object SynBaanSyn1: TSynBaanSyn + DefaultFilter = 'Baan 4GL files (*.cln)|*.cln' + Left = 168 + Top = 240 + end + object SynCppSyn1: TSynCppSyn + DefaultFilter = 'C++ files (*.cpp,*.h,*.hpp)|*.cpp;*.h;*.hpp' + Left = 200 + Top = 240 + end + object SynCacheSyn1: TSynCacheSyn + DefaultFilter = 'Cache files (*.mac,*.inc,*.int)|*.mac;*.inc;*.int' + Left = 232 + Top = 240 + end + object SynCACSyn1: TSynCACSyn + DefaultFilter = 'CA-Clipper files (*.prg, *.ch, *.inc)|*.prg;*.ch;*.inc' + Left = 264 + Top = 240 + end + object SynCssSyn1: TSynCssSyn + Left = 296 + Top = 240 + end + object SynDfmSyn1: TSynDfmSyn + DefaultFilter = 'Delphi/C++ Builder Form Files (*.dfm)|*.dfm' + Left = 328 + Top = 240 + end + object SynFortranSyn1: TSynFortranSyn + Left = 360 + Top = 240 + end + object SynFoxproSyn1: TSynFoxproSyn + Left = 392 + Top = 240 + end + object SynGalaxySyn1: TSynGalaxySyn + DefaultFilter = 'Galaxy files (*.gtv,*.galrep,*.txt)|*.gtv;*.galrep;*.txt' + KeyWords.Strings = ( + '#END' + '#GALAXY' + 'A' + 'ANONYMOUS' + 'AUTOUNLOAD' + 'B' + 'BATTLEPROTOCOL' + 'C' + 'CAP' + 'CARGO' + 'COL' + 'COMPRESS' + 'D' + 'DRIVE' + 'E' + 'EMP' + 'F' + 'FLEET' + 'FLEETTABLES' + 'G' + 'GALAXYTV' + 'GPLUS' + 'GROUPFORECAST' + 'H' + 'I' + 'J' + 'L' + 'M' + 'MACHINEREPORT' + 'MAT' + 'N' + 'NAMECASE' + 'NO' + 'O' + 'OPTIONS' + 'P' + 'PLANETFORECAST' + 'PRODTABLE' + 'PRODUCE' + 'Q' + 'R' + 'ROUTESFORECAST' + 'S' + 'SEND' + 'SHIELDS' + 'SHIPTYPEFORECAST' + 'SORTGROUPS' + 'T' + 'TWOCOL' + 'U' + 'UNDERSCORES' + 'V' + 'W' + 'WAR' + 'WEAPONS' + 'X' + 'Y' + 'Z') + Left = 424 + Top = 240 + end + object SynDmlSyn1: TSynDmlSyn + DefaultFilter = 'GEMBASE files (*.dml,*.gem)|*.DML;*.GEM' + Left = 456 + Top = 240 + end + object SynGeneralSyn1: TSynGeneralSyn + Comments = [] + DetectPreprocessor = False + IdentifierChars = '_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + Left = 520 + Top = 240 + end + object SynHTMLSyn1: TSynHTMLSyn + DefaultFilter = 'HTML Document (*.htm,*.html)|*.htm;*.html' + Left = 552 + Top = 240 + end + object SynIniSyn1: TSynIniSyn + Left = 584 + Top = 240 + end + object SynInnoSyn1: TSynInnoSyn + DefaultFilter = 'Inno Setup Script files (*.iss)|*.iss' + Left = 40 + Top = 272 + end + object SynJavaSyn1: TSynJavaSyn + DefaultFilter = 'Java files (*.java)|*.java' + Left = 72 + Top = 272 + end + object SynJScriptSyn1: TSynJScriptSyn + DefaultFilter = 'Javascript files (*.js)|*.js' + Left = 104 + Top = 272 + end + object SynKixSyn1: TSynKixSyn + DefaultFilter = 'Kix Scripts (*.kix)|*.kix' + Left = 136 + Top = 272 + end + object SynVBScriptSyn1: TSynVBScriptSyn + DefaultFilter = 'VBScript files (*.vbs)|*.vbs' + Left = 168 + Top = 272 + end + object SynBatSyn1: TSynBatSyn + DefaultFilter = 'MS-DOS Batch Files (*.bat)|*.bat' + Left = 200 + Top = 272 + end + object SynPerlSyn1: TSynPerlSyn + DefaultFilter = 'Perl files (*.pl,*.pm,*.cgi)|*.pl;*.pm;*.cgi' + Left = 232 + Top = 272 + end + object SynPHPSyn1: TSynPHPSyn + DefaultFilter = + 'PHP files (*.php,*.php3,*.phtml,*.inc)|*.php;*.php3;*.phtml;*.in' + + 'c' + Left = 264 + Top = 272 + end + object SynProgressSyn1: TSynProgressSyn + DefaultFilter = 'Progress Files (*.w,*.p,*.i)|*.w;*.p;*.i' + Left = 296 + Top = 272 + end + object SynPythonSyn1: TSynPythonSyn + DefaultFilter = 'Python files (*.py)|*.py' + Left = 328 + Top = 272 + end + object SynSQLSyn1: TSynSQLSyn + DefaultFilter = 'SQL files (*.sql)|*.sql' + SQLDialect = sqlSybase + Left = 360 + Top = 272 + end + object SynSMLSyn1: TSynSMLSyn + Left = 392 + Top = 272 + end + object SynTclTkSyn1: TSynTclTkSyn + DefaultFilter = 'Tcl/Tk files (*.tcl)|*.tcl' + Left = 424 + Top = 272 + end + object SynVBSyn1: TSynVBSyn + DefaultFilter = 'Visual Basic files (*.bas)|*.bas' + Left = 456 + Top = 272 + end + object SynAsmSyn1: TSynAsmSyn + Left = 488 + Top = 272 + end + object SynEditPythonBehaviour1: TSynEditPythonBehaviour + Left = 328 + Top = 304 + end + object SynModelicaSyn1: TSynModelicaSyn + DefaultFilter = 'Modelica files (*.mo)|*.mo' + Left = 520 + Top = 272 + end + object SynM3Syn1: TSynM3Syn + DefaultFilter = 'Modula-3 files (*.m3)|*.m3' + Left = 552 + Top = 272 + end + object SynGWScriptSyn1: TSynGWScriptSyn + DefaultFilter = 'GW-TEL Script Files (*.gws)|*.gws' + Left = 584 + Top = 272 + end + object SynCPMSyn1: TSynCPMSyn + Left = 40 + Top = 240 + end + object SynIdlSyn1: TSynIdlSyn + Left = 488 + Top = 240 + end + object SynHP48Syn1: TSynHP48Syn + DefaultFilter = 'HP48 Files (*.s,*.sou,*.a,*.hp)|*.s;*.sou;*.a;*.hp' + BaseRange = rsRpl + Left = 616 + Top = 240 + end + object SynPasSyn1: TSynPasSyn + Left = 616 + Top = 272 + end + object SynSDDSyn1: TSynSDDSyn + Left = 40 + Top = 304 + end + object SynMsgSyn1: TSynMsgSyn + Left = 72 + Top = 304 + end + object SynUnrealSyn1: TSynUnrealSyn + Left = 104 + Top = 304 + end + object SynXMLSyn1: TSynXMLSyn + DefaultFilter = + 'XML Document (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;' + + '*.xslt;*.dtd' + WantBracesParsed = False + Left = 136 + Top = 304 + end + object SynSTSyn1: TSynSTSyn + DefaultFilter = 'Pascal Files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc' + Left = 168 + Top = 304 + end +end diff --git a/Source/VCL/SynEdit/Demos/D4Demo/EditU2.pas b/Source/VCL/SynEdit/Demos/D4Demo/EditU2.pas new file mode 100644 index 00000000..2c770f69 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/EditU2.pas @@ -0,0 +1,1686 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: EditU2.pas, released 2000-06-23. + +The Original Code is the D4Demo project of the mwEdit component suite +by Martin Waldenburg and other developers. +The Original Author of the D4Demo project is Primoz Gabrijelcic. +Portions written by Primoz Gabrijelcic are copyright 1998 Primoz Gabrijelcic. +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: EditU2.pas,v 1.11.2.3 2008/09/14 16:24:56 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - printing has been removed from D4Demo, since it is covered in greater + detail in a dedicated example. +-------------------------------------------------------------------------------} + +unit EditU2; + +{$I SynEdit.inc} +{$J+} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + ExtCtrls, StdCtrls, ComCtrls, {$IFDEF SYN_COMPILER_4_UP} ImgList, {$ENDIF} + Menus, Buttons, Spin, SynEdit, SynUnicode, + SynHighlighterASM, SynHighlighterVB, + SynHighlighterTclTk, SynHighlighterSML, SynHighlighterSQL, + SynHighlighterProgress, SynHighlighterPHP, SynHighlighterPerl, + SynHighlighterPas, SynHighlighterBat, SynHighlighterVBScript, + SynHighlighterKix, SynHighlighterJScript, SynHighlighterJava, + SynHighlighterInno, SynHighlighterIni, SynHighlighterHTML, + SynHighlighterGeneral, SynHighlighterDml, SynHighlighterFoxpro, + SynHighlighterFortran, SynHighlighterDfm, SynHighlighterCss, + SynHighlighterCAC, SynHighlighterCache, SynHighlighterBaan, + SynHighlighterADSP21xx, SynHighlighterHC11, SynEditHighlighter, + SynHighlighterCpp, SynEditKeyCmds, SynExportRTF, SynEditExport, + SynExportHTML, SynEditKeyCmdsEditor, SynCompletionProposal, + SynEditPythonBehaviour, SynHighlighterPython, SynHighlighterHP48, + SynHighlighterGalaxy, SynHighlighterAWK, SynHighlighterModelica, + SynHighlighterM3, SynHighlighterGWS, SynHighlighterXML, + SynHighlighterUnreal, SynHighlighterMsg, SynHighlighterSDD, + SynHighlighterIDL, SynHighlighterCPM, SynHighlighterST; + +type + TDemoMainForm = class(TForm) + OpenDialog1: TOpenDialog; + PageControl1: TPageControl; + tabBookmarks: TTabSheet; + cbEnableKeys: TCheckBox; + cbGlyphsVisible: TCheckBox; + Label4: TLabel; + inpLeftMargin: TSpinEdit; + tabGutter: TTabSheet; + Label5: TLabel; + tabHighlighter: TTabSheet; + Label3: TLabel; + cbxHighlighterSelect: TComboBox; + cbxSettingsSelect: TComboBox; + Label1: TLabel; + tabCaret: TTabSheet; + cbxInsertCaret: TComboBox; + Label7: TLabel; + Label8: TLabel; + cbxOverwriteCaret: TComboBox; + cbInsertMode: TCheckBox; + tabUndo: TTabSheet; + btnUndo: TButton; + tabFile: TTabSheet; + btnLoad: TButton; + tabInfo: TTabSheet; + Label9: TLabel; + Label10: TLabel; + inpLineText: TEdit; + Label11: TLabel; + inpMaxUndo: TSpinEdit; + cbReadonly: TCheckBox; + tabDisplay: TTabSheet; + outFilename: TLabel; + Label17: TLabel; + Label18: TLabel; + Label20: TLabel; + Label21: TLabel; + outLineCount: TEdit; + tabEvents: TTabSheet; + FontDialog1: TFontDialog; + cbxGutterColor: TComboBox; + inpLeftChar: TSpinEdit; + inpTopLine: TSpinEdit; + inpCaretX: TSpinEdit; + inpCaretY: TSpinEdit; + cbEnableEventLog: TCheckBox; + lbEventLog: TListBox; + Label19: TLabel; + cbxAttrSelect: TComboBox; + cbxAttrBackground: TComboBox; + cbxAttrForeground: TComboBox; + Label23: TLabel; + Label24: TLabel; + grbAttrStyle: TGroupBox; + btnKeywords: TButton; + grbAttrComments: TGroupBox; + cbStyleStrikeOut: TCheckBox; + cbStyleUnderline: TCheckBox; + cbStyleItalic: TCheckBox; + cbStyleBold: TCheckBox; + btnSaveToReg: TButton; + btnLoadFromReg: TButton; + StatusBar: TStatusBar; + TabSheet1: TTabSheet; + KeyCmdList: TListView; + btnEdit: TButton; + ImageList1: TImageList; + cbInternalImages: TCheckBox; + SpeedButton1: TSpeedButton; + SpeedButton2: TSpeedButton; + SpeedButton3: TSpeedButton; + SpeedButton4: TSpeedButton; + SpeedButton5: TSpeedButton; + Label25: TLabel; + inpXOffset: TSpinEdit; + btnRedo: TButton; + cbCommentsBas: TCheckBox; + cbCommentsAsm: TCheckBox; + cbCommentsPas: TCheckBox; + cbCommentsAnsi: TCheckBox; + cbCommentsC: TCheckBox; + Label22: TLabel; + cbLineNumbers: TCheckBox; + cbLeadingZeros: TCheckBox; + cbZeroStart: TCheckBox; + cbMouse: TCheckBox; + cbDrag: TCheckBox; + cbKeyboard: TCheckBox; + cbOther: TCheckBox; + btnClear: TButton; + tabExporter: TTabSheet; + cbxExporterSelect: TComboBox; + Label27: TLabel; + tabEdit: TTabSheet; + cbAutoIndent: TCheckBox; + cbWantTabs: TCheckBox; + Label6: TLabel; + inpGutterWidth: TSpinEdit; + Label29: TLabel; + inpTabWidth: TSpinEdit; + Label30: TLabel; + inpDigitCount: TSpinEdit; + Label31: TLabel; + inpLeftOffset: TSpinEdit; + inpRightOffset: TSpinEdit; + Label32: TLabel; + FindDialog1: TFindDialog; + ReplaceDialog1: TReplaceDialog; + tabSearch: TTabSheet; + btnSearch: TButton; + btnSearchNext: TButton; + btnSearchPrev: TButton; + lblSearchResult: TLabel; + btnReplace: TButton; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + Label15: TLabel; + Label16: TLabel; + Label26: TLabel; + Label28: TLabel; + cbHideSelection: TCheckBox; + inpRightEdge: TSpinEdit; + cbScrollPastEOL: TCheckBox; + cbxScrollBars: TComboBox; + cbxColor: TComboBox; + cbxForeground: TComboBox; + cbxBackground: TComboBox; + btnFont: TButton; + inpExtraLineSpacing: TSpinEdit; + cbxREColor: TComboBox; + cbHalfPageScroll: TCheckBox; + cbAutoSize: TCheckBox; + cbDragDropEdit: TCheckBox; + Label2: TMemo; + cbGutterVisible: TCheckBox; + cbUseFontStyle: TCheckBox; + cbExportSelected: TCheckBox; + btnExportToFile: TButton; + SaveDialog1: TSaveDialog; + btnExportToClipboard: TButton; + SynEditor: TSynEdit; + SynExporterHTML1: TSynExporterHTML; + SynExporterRTF1: TSynExporterRTF; + SynCompletionProposal1: TSynCompletionProposal; + SynAutoComplete1: TSynAutoComplete; + tabAbout: TTabSheet; + Label33: TLabel; + Memo1: TMemo; + SynHC11Syn1: TSynHC11Syn; + SynADSP21xxSyn1: TSynADSP21xxSyn; + SynAWKSyn1: TSynAWKSyn; + SynBaanSyn1: TSynBaanSyn; + SynCppSyn1: TSynCppSyn; + SynCacheSyn1: TSynCacheSyn; + SynCACSyn1: TSynCACSyn; + SynCssSyn1: TSynCssSyn; + SynDfmSyn1: TSynDfmSyn; + SynFortranSyn1: TSynFortranSyn; + SynFoxproSyn1: TSynFoxproSyn; + SynGalaxySyn1: TSynGalaxySyn; + SynDmlSyn1: TSynDmlSyn; + SynGeneralSyn1: TSynGeneralSyn; + SynHTMLSyn1: TSynHTMLSyn; + SynIniSyn1: TSynIniSyn; + SynInnoSyn1: TSynInnoSyn; + SynJavaSyn1: TSynJavaSyn; + SynJScriptSyn1: TSynJScriptSyn; + SynKixSyn1: TSynKixSyn; + SynVBScriptSyn1: TSynVBScriptSyn; + SynBatSyn1: TSynBatSyn; + SynPerlSyn1: TSynPerlSyn; + SynPHPSyn1: TSynPHPSyn; + SynProgressSyn1: TSynProgressSyn; + SynPythonSyn1: TSynPythonSyn; + SynSQLSyn1: TSynSQLSyn; + SynSMLSyn1: TSynSMLSyn; + SynTclTkSyn1: TSynTclTkSyn; + SynVBSyn1: TSynVBSyn; + SynAsmSyn1: TSynAsmSyn; + SynEditPythonBehaviour1: TSynEditPythonBehaviour; + SynModelicaSyn1: TSynModelicaSyn; + SynM3Syn1: TSynM3Syn; + TabSheet2: TTabSheet; + Memo2: TMemo; + Memo3: TMemo; + cbShrinkList: TCheckBox; + Label34: TLabel; + cbCompletionAttr: TComboBox; + cbxCompletionColor: TComboBox; + Label35: TLabel; + SynGWScriptSyn1: TSynGWScriptSyn; + SynCPMSyn1: TSynCPMSyn; + SynIdlSyn1: TSynIdlSyn; + SynHP48Syn1: TSynHP48Syn; + SynPasSyn1: TSynPasSyn; + SynSDDSyn1: TSynSDDSyn; + SynMsgSyn1: TSynMsgSyn; + SynUnrealSyn1: TSynUnrealSyn; + SynXMLSyn1: TSynXMLSyn; + SynSTSyn1: TSynSTSyn; + procedure btnLoadClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure cbReadonlyClick(Sender: TObject); + procedure cbHideSelectionClick(Sender: TObject); + procedure cbScrollPastEOLClick(Sender: TObject); + procedure cbHalfPageScrollClick(Sender: TObject); + procedure inpExtraLineSpacingChange(Sender: TObject); + procedure inpRightEdgeChange(Sender: TObject); + procedure cbxREColorChange(Sender: TObject); + procedure cbxScrollBarsChange(Sender: TObject); + procedure cbxColorChange(Sender: TObject); + procedure cbxForegroundChange(Sender: TObject); + procedure cbxBackgroundChange(Sender: TObject); + procedure btnFontClick(Sender: TObject); + procedure cbAutoIndentClick(Sender: TObject); + procedure cbWantTabsClick(Sender: TObject); + procedure inpTabWidthChange(Sender: TObject); + procedure cbDragDropEditClick(Sender: TObject); + procedure cbxInsertCaretChange(Sender: TObject); + procedure cbxOverwriteCaretChange(Sender: TObject); + procedure cbInsertModeClick(Sender: TObject); + procedure cbxGutterColorChange(Sender: TObject); + procedure inpGutterWidthChange(Sender: TObject); + procedure inpDigitCountChange(Sender: TObject); + procedure inpLeftOffsetChange(Sender: TObject); + procedure inpRightOffsetChange(Sender: TObject); + procedure cbLineNumbersClick(Sender: TObject); + procedure cbLeadingZerosClick(Sender: TObject); + procedure cbZeroStartClick(Sender: TObject); + procedure cbAutoSizeClick(Sender: TObject); + procedure cbGutterVisibleClick(Sender: TObject); + procedure cbUseFontStyleClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure cbEnableKeysClick(Sender: TObject); + procedure cbGlyphsVisibleClick(Sender: TObject); + procedure cbInternalImagesClick(Sender: TObject); + procedure inpLeftMarginChange(Sender: TObject); + procedure inpXOffsetChange(Sender: TObject); + procedure btnUndoClick(Sender: TObject); + procedure btnRedoClick(Sender: TObject); + procedure inpMaxUndoChange(Sender: TObject); + procedure SynEditorChange(Sender: TObject); + procedure SynEditorClick(Sender: TObject); + procedure SynEditorCommandProcessed(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); + procedure SynEditorDblClick(Sender: TObject); + procedure SynEditorDragDrop(Sender, Source: TObject; X, Y: Integer); + procedure SynEditorDragOver(Sender, Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); + procedure SynEditorDropFiles(Sender: TObject; X, Y: Integer; + AFiles: TUnicodeStrings); + procedure SynEditorEnter(Sender: TObject); + procedure SynEditorExit(Sender: TObject); + procedure SynEditorKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure SynEditorKeyPress(Sender: TObject; var Key: WideChar); + procedure SynEditorKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure SynEditorMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure SynEditorMouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure SynEditorMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure SynEditorPaint(Sender: TObject; ACanvas: TCanvas); + procedure SynEditorEndDrag(Sender, Target: TObject; X, Y: Integer); + procedure SynEditorPlaceBookmark(Sender: TObject; + var Mark: TSynEditMark); + procedure SynEditorProcessCommand(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); + procedure SynEditorProcessUserCommand(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); + procedure SynEditorReplaceText(Sender: TObject; const ASearch, + AReplace: UnicodeString; Line, Column: Integer; + var Action: TSynReplaceAction); + procedure SynEditorStartDrag(Sender: TObject; + var DragObject: TDragObject); + procedure SynEditorStatusChange(Sender: TObject; + Changes: TSynStatusChanges); + procedure cbxExporterSelectChange(Sender: TObject); + procedure FormResize(Sender: TObject); + procedure inpLeftCharChange(Sender: TObject); + procedure inpTopLineChange(Sender: TObject); + procedure inpCaretXChange(Sender: TObject); + procedure inpCaretYChange(Sender: TObject); + procedure cbEnableEventLogClick(Sender: TObject); + procedure btnClearClick(Sender: TObject); + procedure cbxHighlighterSelectChange(Sender: TObject); + procedure cbxAttrSelectChange(Sender: TObject); + procedure cbxSettingsSelectChange(Sender: TObject); + procedure cbxAttrForegroundChange(Sender: TObject); + procedure cbxAttrBackgroundChange(Sender: TObject); + procedure cbFontStyleClick(Sender: TObject); + procedure btnSaveToRegClick(Sender: TObject); + procedure btnLoadFromRegClick(Sender: TObject); + procedure btnKeywordsClick(Sender: TObject); + procedure cbCommentsClick(Sender: TObject); + procedure btnEditClick(Sender: TObject); + procedure SpeedButtonClick(Sender: TObject); + procedure btnSearchClick(Sender: TObject); + procedure btnSearchNextPrevClick(Sender: TObject); + procedure btnReplaceClick(Sender: TObject); + procedure DoFindText(Sender: TObject); + procedure DoReplaceText(Sender: TObject); + procedure btnExportToFileClick(Sender: TObject); + procedure btnExportToClipboardClick(Sender: TObject); + procedure SynEditorContextHelp(Sender: TObject; word: UnicodeString); + procedure cbShrinkListClick(Sender: TObject); + procedure cbCompletionAttrChange(Sender: TObject); + procedure cbxCompletionColorChange(Sender: TObject); + procedure SynEditorGutterClick(Sender: TObject; Button: TMouseButton; + X, Y, Line: Integer; Mark: TSynEditMark); + private + fDisableMarkButtons: boolean; + fFileName: string; + fHighlighters: TStringList; + fMarkButtons: array [0..4] of TSpeedButton; + fShown: boolean; + procedure EnumerateExporters; + function GetSelectedExporter: TSynCustomExporter; + procedure LoadFile(const AFileName: string; AReadOnly: boolean); + procedure LogEvent(AEvent: string); + procedure RebuildMarks; + procedure RecalcLeftMargin; + procedure ReloadAttributes; + procedure ResetMarkButtons; + procedure ShowSuccess(ASuccess: boolean); + procedure UpdateCanExport; + procedure UpdateEditorSettings; + procedure UpdateKeystrokesList; + end; + +var + DemoMainForm: TDemoMainForm; + +implementation + +{$R *.DFM} + +uses + uHighlighterProcs, Unit2, Clipbrd, SynEditTypes, SynEditSearch; + +const + Colors: array[1..42 {sic!}] of TColor = (clBlack, clMaroon, clGreen, clOlive, + clNavy, clPurple, clTeal, clDkGray, clLtGray, clRed, clLime, + clYellow, clBlue, clFuchsia, clAqua, clWhite, clScrollBar, + clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, + clWindowFrame, clMenuText, clWindowText, clCaptionText, + clActiveBorder, clInactiveBorder, clAppWorkSpace, clHighlight, + clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, + clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, + clInfoText, clInfoBk, clNone); + +function ColorToIndex(AColor: TColor): integer; +var + i: integer; +begin + Result := 0; + for i := Low(Colors) to High(Colors) do + if Colors[i] = AColor then begin + Result := i - 1; + break; + end; +end; + +function IndexToColor(AIndex: integer): TColor; +begin + Result := Colors[AIndex + 1]; +end; + +{ TDemoMainForm } + +procedure TDemoMainForm.FormCreate(Sender: TObject); +var + s: string; + AColors: TStringList; + i: integer; +begin + fHighlighters := TStringList.Create; + GetHighlighters(Self, fHighlighters, FALSE); + EnumerateExporters; + UpdateKeystrokesList; + // setup highlighter selection combobox + cbxHighlighterSelect.Items.Assign(fHighlighters); + cbxHighlighterSelect.Items.Insert(0, '(none)'); + // setup file open dialog filter + s := GetHighlightersFilter(fHighlighters); + if (s <> '') and (s[Length(s)] <> '|') then + s := s + '|'; + s := s + 'All files (*.*)|*.*'; + OpenDialog1.Filter := s; + // fill comboboxes with color strings + AColors := TStringList.Create; + try + for i := Low(Colors) to High(Colors) do begin + if ColorToIdent(Colors[i], s) then + AColors.Add(s); + end; + cbxREColor.Items.Assign(AColors); + cbxColor.Items.Assign(AColors); + cbxForeground.Items.Assign(AColors); + cbxBackground.Items.Assign(AColors); + cbxGutterColor.Items.Assign(AColors); + cbxAttrForeground.Items.Assign(AColors); + cbxAttrBackground.Items.Assign(AColors); + cbxCompletionColor.Items.Assign(AColors); + finally + AColors.Free; + end; + // initialization of other controls + PageControl1.ActivePage := tabFile; + FontDialog1.Font.Assign(SynEditor.Font); + + fMarkButtons[0] := SpeedButton1; + fMarkButtons[1] := SpeedButton2; + fMarkButtons[2] := SpeedButton3; + fMarkButtons[3] := SpeedButton4; + fMarkButtons[4] := SpeedButton5; + + //intializes a search engine + SynEditor.SearchEngine := TSynEditSearch.Create( SynEditor ); +end; + +procedure TDemoMainForm.FormDestroy(Sender: TObject); +begin + fHighlighters.Free; +end; + +procedure TDemoMainForm.FormShow(Sender: TObject); +begin + if not fShown then begin + fShown := TRUE; + UpdateEditorSettings; + cbxHighlighterSelect.ItemIndex := 0; + cbxHighlighterSelectChange(Sender); + // update the statusbar panels + SynEditorStatusChange(Self, [scAll]); + end; +end; + +procedure TDemoMainForm.FormResize(Sender: TObject); +begin + inpGutterWidth.MaxValue := SynEditor.Width + 1; + if inpGutterWidth.Value > inpGutterWidth.MaxValue then + inpGutterWidth.Value := inpGutterWidth.MaxValue; +end; + +procedure TDemoMainForm.EnumerateExporters; +var + i: integer; + s: string; +begin + cbxExporterSelect.Items.Add('(All registered formats)'); + for i := 0 to ComponentCount - 1 do begin + if not (Components[i] is TSynCustomExporter) then + continue; + s := (Components[i] as TSynCustomExporter).FormatName; + if s <> '' then + cbxExporterSelect.Items.Add(s); + end; + cbxExporterSelect.ItemIndex := 0; + cbxExporterSelectChange(Self); +end; + +function TDemoMainForm.GetSelectedExporter: TSynCustomExporter; +var + i: integer; +begin + for i := 0 to ComponentCount - 1 do begin + if not (Components[i] is TSynCustomExporter) then + continue; + Result := TSynCustomExporter(Components[i]); + if Result.FormatName = cbxExporterSelect.Text then + exit; + end; + Result := nil; +end; + +procedure TDemoMainForm.LoadFile(const AFileName: string; AReadOnly: boolean); +var + backCursor: TCursor; + bWasText: boolean; +begin + backCursor := Cursor; + try + Cursor := crHourGlass; + Windows.SetCursor(Screen.Cursors[crHourGlass]); + + fFileName := AFileName; + outFilename.Caption := AFileName; + outFilename.Visible := TRUE; + with SynEditor do begin + Highlighter := GetHighlighterFromFileExt(fHighlighters, + ExtractFileExt(AFileName)); + with cbxHighlighterSelect do begin + if Highlighter <> nil then + ItemIndex := Items.IndexOf(Highlighter.LanguageName) + else + ItemIndex := 0; + end; + cbxHighlighterSelectChange(Self); + if Highlighter = SynDfmSyn1 then + LoadDFMFile2Strings(AFileName, SynEditor.Lines, bWasText) + else + Lines.LoadFromFile(AFileName); + Modified := FALSE; + ReadOnly := AReadOnly; + cbReadonly.Checked := AReadOnly; + SetFocus; + end; + finally + Cursor := backCursor; + end; +end; + +procedure TDemoMainForm.LogEvent(AEvent: string); +begin + if cbEnableEventLog.Checked then + lbEventLog.Items.Insert(0, TimeToStr(Now) + ' ' + AEvent); +end; + +procedure TDemoMainForm.RebuildMarks; +var + i: integer; +begin + with SynEditor do begin + BeginUpdate; + try + for i := 0 to Marks.Count-1 do begin + if Marks[i].IsBookmark then + Marks[i].InternalImage := cbInternalImages.Checked; + end; + finally + EndUpdate; + end; + end; +end; + +procedure TDemoMainForm.RecalcLeftMargin; + + procedure ValidateSpinEditValue(SE: TSpinEdit; Value: integer); + begin + if SE.Value <> Value then SE.Value := Value; + end; + +begin + with SynEditor do begin + inpLeftMargin.MaxValue := Gutter.Width; + if inpLeftMargin.Value > inpLeftMargin.MaxValue then + inpLeftMargin.Value := inpLeftMargin.MaxValue; + ValidateSpinEditValue(inpGutterWidth, Gutter.Width); + ValidateSpinEditValue(inpDigitCount, Gutter.DigitCount); + ValidateSpinEditValue(inpLeftOffset, Gutter.LeftOffset); + ValidateSpinEditValue(inpRightOffset, Gutter.RightOffset); + end; +end; + +procedure TDemoMainForm.ReloadAttributes; +var + i: integer; +begin + if SynEditor.Highlighter <> nil then begin + cbxAttrSelect.Items.Clear; + for i := 0 to SynEditor.Highlighter.AttrCount - 1 do + cbxAttrSelect.Items.Add(SynEditor.Highlighter.Attribute[i].Name); + cbxAttrSelect.ItemIndex := 0; + end; + cbxAttrSelectChange(Self); +end; + +procedure TDemoMainForm.ResetMarkButtons; +var + marks: TSynEditMarks; + i: integer; +begin + fDisableMarkButtons := true; + try + SynEditor.Marks.GetMarksForLine(SynEditor.CaretY, marks); + for i := 0 to 4 do + fMarkButtons[i].Down := false; + for i := 1 to MAX_MARKS do begin + if not assigned(marks[i]) then break; + if not marks[i].IsBookmark then + fMarkButtons[marks[i].ImageIndex-10].Down := true; + end; + finally + fDisableMarkButtons := false; + end; +end; + +procedure TDemoMainForm.ShowSuccess(ASuccess: boolean); +begin + if ASuccess then + StatusBar.Panels[3].Text := 'Success' + else + StatusBar.Panels[3].Text := 'Failure'; +end; + +procedure TDemoMainForm.UpdateCanExport; +begin + btnExportToClipboard.Enabled := SynEditor.Highlighter <> nil; + btnExportToFile.Enabled := (SynEditor.Highlighter <> nil) + and (cbxExporterSelect.ItemIndex > 0); +end; + +procedure TDemoMainForm.UpdateEditorSettings; +begin + with SynEditor do begin + cbReadonly.Checked := ReadOnly; + cbHideSelection.Checked := HideSelection; + cbScrollPastEOL.Checked := eoScrollPastEOL in Options; + cbHalfPageScroll.Checked := eoHalfPageScroll in Options; + inpExtraLineSpacing.Value := ExtraLineSpacing; + inpRightEdge.Value := RightEdge; + cbxREColor.ItemIndex := ColorToIndex(RightEdgeColor); + cbxScrollBars.ItemIndex := Ord(Scrollbars); + with SynEditor.Font do + btnFont.Caption := Name + ' ' + IntToStr(Size); + cbxColor.ItemIndex := ColorToIndex(Color); + cbxForeground.ItemIndex := ColorToIndex(SelectedColor.Foreground); + cbxBackground.ItemIndex := ColorToIndex(SelectedColor.Background); + cbAutoIndent.Checked := eoAutoIndent in Options; + cbWantTabs.Checked := WantTabs; + inpTabWidth.Value := TabWidth; + cbDragDropEdit.Checked := eoDragDropEditing in Options; + cbxInsertCaret.ItemIndex := Ord(InsertCaret); + cbxOverwriteCaret.ItemIndex := Ord(OverwriteCaret); + cbInsertMode.Checked := InsertMode; + cbxGutterColor.ItemIndex := ColorToIndex(Gutter.Color); + inpGutterWidth.Value := Gutter.Width; + inpDigitCount.Value := Gutter.DigitCount; + inpLeftOffset.Value := Gutter.LeftOffset; + inpRightOffset.Value := Gutter.RightOffset; + cbLineNumbers.Checked := Gutter.ShowLineNumbers; + cbLeadingZeros.Checked := Gutter.LeadingZeros; + cbZeroStart.Checked := Gutter.ZeroStart; + cbAutoSize.Checked := Gutter.AutoSize; + cbGutterVisible.Checked := Gutter.Visible; + cbUseFontStyle.Checked := Gutter.UseFontStyle; + cbEnableKeys.Checked := BookMarkOptions.EnableKeys; + cbGlyphsVisible.Checked := BookMarkOptions.GlyphsVisible; + cbInternalImages.Checked := BookMarkOptions.BookmarkImages = nil; + inpLeftMargin.Value := BookMarkOptions.LeftMargin; + inpXOffset.Value := BookmarkOptions.XOffset; + inpMaxUndo.Value := MaxUndo; + cbxAttrSelect.ItemIndex := 0; + cbxAttrSelectChange(Self); + end; +end; + +procedure TDemoMainForm.UpdateKeystrokesList; +var + i: integer; +begin + with KeyCmdList.Items do begin + BeginUpdate; + try + Clear; + for i := 0 to SynEditor.Keystrokes.Count - 1 do + with Add do begin + Caption := EditorCommandToCodeString(SynEditor.Keystrokes[i].Command); + if SynEditor.Keystrokes[i].ShortCut = 0 then + SubItems.Add('') + else + SubItems.Add(Menus.ShortCutToText(SynEditor.Keystrokes[i].ShortCut)); + end; + finally + EndUpdate; + end; + end; +end; + +procedure TDemoMainForm.btnLoadClick(Sender: TObject); +begin + if OpenDialog1.Execute then + LoadFile(OpenDialog1.FileName, ofReadOnly in OpenDialog1.Options); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbReadonlyClick(Sender: TObject); +begin + SynEditor.ReadOnly := cbReadonly.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbHideSelectionClick(Sender: TObject); +begin + SynEditor.HideSelection := cbHideSelection.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbScrollPastEOLClick(Sender: TObject); +begin + if cbScrollPastEOL.Checked then + SynEditor.Options := SynEditor.Options + [eoScrollPastEol]; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbHalfPageScrollClick(Sender: TObject); +begin + if cbHalfPageScroll.Checked then + SynEditor.Options := SynEditor.Options + [eoHalfPageScroll]; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpExtraLineSpacingChange(Sender: TObject); +begin + try SynEditor.ExtraLineSpacing := inpExtraLineSpacing.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpRightEdgeChange(Sender: TObject); +begin + try SynEditor.RightEdge := inpRightEdge.Value; + except end; + RecalcLeftMargin; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxREColorChange(Sender: TObject); +begin + SynEditor.RightEdgeColor := IndexToColor(cbxREColor.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxScrollBarsChange(Sender: TObject); +begin + SynEditor.Scrollbars := TScrollStyle(cbxScrollBars.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxColorChange(Sender: TObject); +begin + SynEditor.Color := IndexToColor(cbxColor.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxForegroundChange(Sender: TObject); +begin + SynEditor.SelectedColor.Foreground := IndexToColor(cbxForeground.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxBackgroundChange(Sender: TObject); +begin + SynEditor.SelectedColor.Background := IndexToColor(cbxBackground.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.btnFontClick(Sender: TObject); +begin + if FontDialog1.Execute then begin + SynEditor.Font.Assign(FontDialog1.Font); + UpdateEditorSettings; + SynEditor.SetFocus; + end; +end; + +procedure TDemoMainForm.cbAutoIndentClick(Sender: TObject); +begin + if cbAutoIndent.Checked then + SynEditor.Options := SynEditor.Options + [eoAutoIndent]; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbWantTabsClick(Sender: TObject); +begin + SynEditor.WantTabs := cbWantTabs.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpTabWidthChange(Sender: TObject); +begin + try SynEditor.TabWidth := inpTabWidth.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbDragDropEditClick(Sender: TObject); +begin + if cbDragDropEdit.Checked then + SynEditor.Options := SynEditor.Options + [eoDragDropEditing]; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxInsertCaretChange(Sender: TObject); +begin + SynEditor.InsertCaret := TSynEditCaretType(cbxInsertCaret.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxOverwriteCaretChange(Sender: TObject); +begin + SynEditor.OverwriteCaret := TSynEditCaretType(cbxOverwriteCaret.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbInsertModeClick(Sender: TObject); +begin + SynEditor.InsertMode := cbInsertMode.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxGutterColorChange(Sender: TObject); +begin + SynEditor.Gutter.Color := IndexToColor(cbxGutterColor.ItemIndex); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpGutterWidthChange(Sender: TObject); +begin + try SynEditor.Gutter.Width := inpGutterWidth.Value; + except end; + RecalcLeftMargin; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpDigitCountChange(Sender: TObject); +begin + try SynEditor.Gutter.DigitCount := inpDigitCount.Value; + except end; + RecalcLeftMargin; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpLeftOffsetChange(Sender: TObject); +begin + try SynEditor.Gutter.LeftOffset := inpLeftOffset.Value; + except end; + RecalcLeftMargin; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpRightOffsetChange(Sender: TObject); +begin + try SynEditor.Gutter.RightOffset := inpRightOffset.Value; + except end; + RecalcLeftMargin; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbLineNumbersClick(Sender: TObject); +begin + SynEditor.Gutter.ShowLineNumbers := cbLineNumbers.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbLeadingZerosClick(Sender: TObject); +begin + SynEditor.Gutter.LeadingZeros := cbLeadingZeros.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbZeroStartClick(Sender: TObject); +begin + SynEditor.Gutter.ZeroStart := cbZeroStart.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbAutoSizeClick(Sender: TObject); +begin + SynEditor.Gutter.AutoSize := cbAutoSize.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbGutterVisibleClick(Sender: TObject); +begin + SynEditor.Gutter.Visible := cbGutterVisible.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbUseFontStyleClick(Sender: TObject); +begin + SynEditor.Gutter.UseFontStyle := cbUseFontStyle.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbEnableKeysClick(Sender: TObject); +begin + SynEditor.BookMarkOptions.EnableKeys := cbEnableKeys.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbGlyphsVisibleClick(Sender: TObject); +begin + SynEditor.BookMarkOptions.GlyphsVisible := cbGlyphsVisible.Checked; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbInternalImagesClick(Sender: TObject); +begin + RebuildMarks; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpLeftMarginChange(Sender: TObject); +begin + try SynEditor.BookMarkOptions.LeftMargin := inpLeftMargin.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpXOffsetChange(Sender: TObject); +begin + try SynEditor.BookMarkOptions.XOffset := inpXOffset.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.btnUndoClick(Sender: TObject); +begin + SynEditor.Undo; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.btnRedoClick(Sender: TObject); +begin + SynEditor.Redo; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpMaxUndoChange(Sender: TObject); +begin + try SynEditor.MaxUndo := inpMaxUndo.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.SynEditorChange(Sender: TObject); +begin + btnUndo.Enabled := SynEditor.CanUndo; + btnRedo.Enabled := SynEditor.CanRedo; + outLineCount.Text := IntToStr(SynEditor.Lines.Count); + if cbOther.Checked then + LogEvent('OnChange'); +end; + +procedure TDemoMainForm.SynEditorClick(Sender: TObject); +begin + if cbMouse.Checked then + LogEvent('OnClick'); +end; + +procedure TDemoMainForm.SynEditorCommandProcessed(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); +begin + if cbKeyboard.Checked then + LogEvent('OnCommandProcessed'); +end; + +procedure TDemoMainForm.SynEditorDblClick(Sender: TObject); +begin + if cbMouse.Checked then + LogEvent('OnDblClick'); +end; + +procedure TDemoMainForm.SynEditorDragDrop(Sender, Source: TObject; X, + Y: Integer); +begin + if cbDrag.Checked then + LogEvent('OnDragDrop'); +end; + +procedure TDemoMainForm.SynEditorDragOver(Sender, Source: TObject; X, + Y: Integer; State: TDragState; var Accept: Boolean); +begin + if cbDrag.Checked then + LogEvent('OnDragOver'); +end; + +procedure TDemoMainForm.SynEditorDropFiles(Sender: TObject; X, Y: Integer; + AFiles: TUnicodeStrings); +begin + if cbOther.Checked then + LogEvent('OnDropFiles'); + if AFiles.Count >= 1 then + LoadFile(AFiles[0], FALSE); +end; + +procedure TDemoMainForm.SynEditorEndDrag(Sender, Target: TObject; X, + Y: Integer); +begin + if cbDrag.Checked then + LogEvent('OnEndDrag'); +end; + +procedure TDemoMainForm.SynEditorEnter(Sender: TObject); +begin + if cbOther.Checked then + LogEvent('OnEnter'); +end; + +procedure TDemoMainForm.SynEditorExit(Sender: TObject); +begin + if cbOther.Checked then + LogEvent('OnExit'); +end; + +procedure TDemoMainForm.SynEditorKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if cbKeyboard.Checked then + LogEvent('OnKeyDown'); +end; + +procedure TDemoMainForm.SynEditorKeyPress(Sender: TObject; var Key: WideChar); +begin + if cbKeyboard.Checked then + LogEvent('OnKeyPress'); +end; + +procedure TDemoMainForm.SynEditorKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if cbKeyboard.Checked then + LogEvent('OnKeyUp'); +end; + +procedure TDemoMainForm.SynEditorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + if cbMouse.Checked then + LogEvent('OnMouseDown'); +end; + +procedure TDemoMainForm.SynEditorMouseMove(Sender: TObject; + Shift: TShiftState; X, Y: Integer); +begin + if cbMouse.Checked then + LogEvent('OnMouseMove'); +end; + +procedure TDemoMainForm.SynEditorMouseUp(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + if cbMouse.Checked then + LogEvent('OnMouseUp'); +end; + +procedure TDemoMainForm.SynEditorPaint(Sender: TObject; ACanvas: TCanvas); +begin + if cbOther.Checked then + LogEvent('OnPaint'); +end; + +procedure TDemoMainForm.SynEditorPlaceBookmark(Sender: TObject; + var Mark: TSynEditMark); +begin + if cbOther.Checked then + LogEvent('OnPlaceBookmark'); + if Mark.IsBookmark then + Mark.InternalImage := cbInternalImages.Checked; +end; + +procedure TDemoMainForm.SynEditorProcessCommand(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); +begin + if cbKeyboard.Checked then + LogEvent('OnProcessCommand'); +end; + +procedure TDemoMainForm.SynEditorProcessUserCommand(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); +begin + if cbKeyboard.Checked then + LogEvent('OnProcessUserCommand'); +end; + +procedure TDemoMainForm.SynEditorReplaceText(Sender: TObject; + const ASearch, AReplace: UnicodeString; Line, Column: Integer; + var Action: TSynReplaceAction); +begin + if cbOther.Checked then + LogEvent('OnReplaceText'); +end; + +procedure TDemoMainForm.SynEditorStartDrag(Sender: TObject; + var DragObject: TDragObject); +begin + if cbDrag.Checked then + LogEvent('OnStartDrag'); +end; + +procedure TDemoMainForm.SynEditorStatusChange(Sender: TObject; + Changes: TSynStatusChanges); +const + ModifiedStrs: array[boolean] of string = ('', 'Modified'); + InsertModeStrs: array[boolean] of string = ('Overwrite', 'Insert'); +var + p: TBufferCoord; + Token: UnicodeString; + Attri: TSynHighlighterAttributes; +begin + // Note: scAll for new file loaded + // caret position has changed + if Changes * [scAll, scCaretX, scCaretY] <> [] then begin + p := SynEditor.CaretXY; + // Detach OnChange events from spin edits, + // because re-setting caret position clears selection + inpCaretX.OnChange := nil; + inpCaretY.OnChange := nil; + inpCaretX.Value := p.Char; + inpCaretY.Value := p.Line; + // Re-attach OnChange events to spin edits + inpCaretX.OnChange := inpCaretXChange; + inpCaretY.OnChange := inpCaretYChange; + inpLineText.Text := SynEditor.LineText; + outLineCount.Text := IntToStr(SynEditor.Lines.Count); + Statusbar.Panels[0].Text := Format('%6d:%3d', [p.Line, p.Char]); + ResetMarkButtons; + end; + // horz scroll position has changed + if Changes * [scAll, scLeftChar] <> [] then + inpLeftChar.Value := SynEditor.LeftChar; + // vert scroll position has changed + if Changes * [scAll, scTopLine] <> [] then + inpTopLine.Value := SynEditor.TopLine; + // InsertMode property has changed + if Changes * [scAll, scInsertMode, scReadOnly] <> [] then begin + if SynEditor.ReadOnly then + Statusbar.Panels[2].Text := 'ReadOnly' + else + Statusbar.Panels[2].Text := InsertModeStrs[SynEditor.InsertMode]; + end; + // Modified property has changed + if Changes * [scAll, scModified] <> [] then + Statusbar.Panels[1].Text := ModifiedStrs[SynEditor.Modified]; + // selection has changed + if Changes * [scAll, scSelection] <> [] then + cbExportSelected.Enabled := SynEditor.SelAvail; + // select highlighter attribute at caret + if (SynEditor.Highlighter <> nil) and (Changes * [scAll, scCaretX, scCaretY] <> []) + then begin + if not SynEditor.GetHighlighterAttriAtRowCol(SynEditor.CaretXY, Token, + Attri) + then + Attri := SynEditor.Highlighter.WhitespaceAttribute; + if Assigned(Attri) then begin + cbxAttrSelect.ItemIndex := cbxAttrSelect.Items.IndexOf(Attri.Name); + cbxAttrSelectChange(Self); + end; + end; +end; + +procedure TDemoMainForm.cbxExporterSelectChange(Sender: TObject); +begin + UpdateCanExport; +end; + +procedure TDemoMainForm.inpLeftCharChange(Sender: TObject); +begin + try SynEditor.LeftChar := inpLeftChar.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpTopLineChange(Sender: TObject); +begin + try SynEditor.TopLine := inpTopLine.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpCaretXChange(Sender: TObject); +begin + try SynEditor.CaretX := inpCaretX.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.inpCaretYChange(Sender: TObject); +begin + try SynEditor.CaretY := inpCaretY.Value; + except end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbEnableEventLogClick(Sender: TObject); +begin + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.btnClearClick(Sender: TObject); +begin + lbEventLog.Clear; +end; + +procedure TDemoMainForm.cbxHighlighterSelectChange(Sender: TObject); +var + i: integer; + HasHighlighter: boolean; +begin + SynEditor.Highlighter := nil; + HasHighlighter := FALSE; + for i := 0 to fHighlighters.Count - 1 do begin + if cbxHighlighterSelect.Text = fHighlighters[i] then begin + SynEditor.Highlighter := fHighlighters.Objects[i] as TSynCustomHighlighter; + HasHighlighter := TRUE; + break; + end; + end; + cbxExporterSelect.Enabled := HasHighlighter; + UpdateCanExport; + StatusBar.Panels[3].Text := ''; + // highlighter user settings + cbxSettingsSelect.Items.Clear; + if HasHighlighter and (hcUserSettings in SynEditor.Highlighter.Capabilities) then + SynEditor.Highlighter.EnumUserSettings(cbxSettingsSelect.Items); + cbxSettingsSelect.Enabled := cbxSettingsSelect.Items.Count > 0; + + btnSaveToReg.Enabled := HasHighlighter + and (hcRegistry in SynEditor.Highlighter.Capabilities); + btnLoadFromReg.Enabled := btnSaveToReg.Enabled; + + cbxAttrSelect.Enabled := HasHighlighter; + cbxAttrForeground.Enabled := HasHighlighter; + cbxAttrBackground.Enabled := HasHighlighter; + grbAttrStyle.Enabled := HasHighlighter; + if SynEditor.Highlighter is TSynGeneralSyn then begin + grbAttrComments.Enabled := TRUE; + with SynEditor.Highlighter as TSynGeneralSyn do begin + cbCommentsAnsi.Checked := csAnsiStyle in Comments; + cbCommentsPas.Checked := csPasStyle in Comments; + cbCommentsC.Checked := csCStyle in Comments; + cbCommentsAsm.Checked := csAsmStyle in Comments; + cbCommentsBas.Checked := csBasStyle in Comments; + end; + end else + grbAttrComments.Enabled := FALSE; + if SynEditor.Highlighter is TSynPythonSyn then + SynEditPythonBehaviour1.Editor := SynEditor + else + SynEditPythonBehaviour1.Editor := nil; + btnKeywords.Enabled := grbAttrComments.Enabled; + ReloadAttributes; + + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxAttrSelectChange(Sender: TObject); +var + Attr: TSynHighlighterAttributes; +begin + Attr := TSynHighlighterAttributes.Create('', ''); + try + if SynEditor.Highlighter <> nil then + Attr.Assign(SynEditor.Highlighter.Attribute[cbxAttrSelect.ItemIndex]); + cbxAttrForeground.ItemIndex := ColorToIndex(Attr.Foreground); + cbxAttrBackground.ItemIndex := ColorToIndex(Attr.Background); + cbStyleBold.Checked := (fsBold in Attr.Style); + cbStyleItalic.Checked := (fsItalic in Attr.Style); + cbStyleUnderLine.Checked := (fsUnderline in Attr.Style); + cbStyleStrikeOut.Checked := (fsStrikeOut in Attr.Style); + finally + Attr.Free; + end; +end; + +procedure TDemoMainForm.cbxSettingsSelectChange(Sender: TObject); +begin + ShowSuccess(SynEditor.Highlighter.UseUserSettings(cbxSettingsSelect.ItemIndex)); + ReloadAttributes; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.cbxAttrForegroundChange(Sender: TObject); +begin + if SynEditor.Highlighter <> nil then begin + SynEditor.Highlighter.Attribute[cbxAttrSelect.ItemIndex].Foreground := + IndexToColor(cbxAttrForeground.ItemIndex); + end; +end; + +procedure TDemoMainForm.cbxAttrBackgroundChange(Sender: TObject); +begin + if SynEditor.Highlighter <> nil then begin + SynEditor.Highlighter.Attribute[cbxAttrSelect.ItemIndex].Background := + IndexToColor(cbxAttrBackground.ItemIndex); + end; +end; + +procedure TDemoMainForm.cbFontStyleClick(Sender: TObject); +var + Style: TFontStyles; +begin + if SynEditor.Highlighter <> nil then begin + Style := []; + if cbStyleBold.Checked then + Include(Style, fsBold); + if cbStyleItalic.Checked then + Include(Style, fsItalic); + if cbStyleUnderLine.Checked then + Include(Style, fsUnderline); + if cbStyleStrikeOut.Checked then + Include(Style, fsStrikeOut); + SynEditor.Highlighter.Attribute[cbxAttrSelect.ItemIndex].Style := Style; + end; +end; + +const + csRegKeyRoot = 'Software\SynEdit\Highlighters\'; + +procedure TDemoMainForm.btnSaveToRegClick(Sender: TObject); +begin + ShowSuccess(SynEditor.Highlighter.SaveToRegistry(HKEY_CURRENT_USER, + csRegKeyRoot + cbxHighlighterSelect.Text)); +end; + +procedure TDemoMainForm.btnLoadFromRegClick(Sender: TObject); +begin + if SynEditor.Highlighter.LoadFromRegistry(HKEY_CURRENT_USER, + csRegKeyRoot + cbxHighlighterSelect.Text) + then begin + ShowSuccess(TRUE); + cbxAttrSelectChange(Self); + end else + ShowSuccess(FALSE); +end; + +procedure TDemoMainForm.btnKeywordsClick(Sender: TObject); +var + Highlighter: TSynGeneralSyn; +begin + Highlighter := SynEditor.HighLighter as TSynGeneralSyn; + + Form2 := TForm2.Create(Self); + try + Form2.lbKeywords.Items.Assign(Highlighter.Keywords); + if Form2.ShowModal = mrOk then + Highlighter.Keywords.Assign(Form2.lbKeywords.Items); + finally + Form2.Free; + Form2 := nil; + end; +end; + +procedure TDemoMainForm.cbCommentsClick(Sender: TObject); +var + CmntSet: TCommentStyles; +begin + CmntSet := []; + if cbCommentsAnsi.Checked then + Include(CmntSet, csAnsiStyle); + if cbCommentsPas.Checked then + Include(CmntSet, csPasStyle); + if cbCommentsC.Checked then + Include(CmntSet, csCStyle); + if cbCommentsAsm.Checked then + Include(CmntSet, csAsmStyle); + if cbCommentsBas.Checked then + Include(CmntSet, csBasStyle); + (SynEditor.Highlighter as TSynGeneralSyn).Comments := CmntSet; +end; + +procedure TDemoMainForm.btnEditClick(Sender: TObject); +var + Dlg: TSynEditKeystrokesEditorForm; +begin + Dlg := TSynEditKeystrokesEditorForm.Create(Self); + try + Dlg.Caption := 'SynEdit Demo Keystroke Editor'; + Dlg.Keystrokes := SynEditor.Keystrokes; + if Dlg.ShowModal = mrOk then begin + SynEditor.Keystrokes := Dlg.Keystrokes; + UpdateKeystrokesList; + end; + finally + Dlg.Free; + end; +end; + +procedure TDemoMainForm.SpeedButtonClick(Sender: TObject); +var + p: TBufferCoord; + Mark: TSynEditMark; +begin + if not fDisableMarkButtons then with SynEditor do begin + p := CaretXY; + Marks.ClearLine(p.Line); + if (Sender as TSpeedButton).Down then begin + Mark := TSynEditMark.Create(SynEditor); + with Mark do begin + Line := p.Line; + Char := p.Char; + ImageIndex := (Sender as TSpeedButton).Tag; + Visible := TRUE; + InternalImage := BookMarkOptions.BookMarkImages = nil; + end; + Marks.Place(Mark); + end; + end; +end; + +procedure TDemoMainForm.btnSearchClick(Sender: TObject); +begin + FindDialog1.Execute; + btnSearchNext.Enabled := TRUE; + btnSearchPrev.Enabled := TRUE; +end; + +procedure TDemoMainForm.btnSearchNextPrevClick(Sender: TObject); +begin + if (Sender = btnSearchNext) then + FindDialog1.Options := FindDialog1.Options + [frDown] + else if (Sender = btnSearchPrev) then + FindDialog1.Options := FindDialog1.Options - [frDown]; + DoFindText(Sender); + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.DoFindText(Sender: TObject); +var + rOptions: TSynSearchOptions; + dlg: TFindDialog; + sSearch: string; +begin + if Sender = ReplaceDialog1 then + dlg := ReplaceDialog1 + else + dlg := FindDialog1; + sSearch := dlg.FindText; + if Length(sSearch) = 0 then begin + Beep; + lblSearchResult.Caption := 'Can''t search for empty text!'; + lblSearchResult.Visible := TRUE; + end else begin + rOptions := []; + if not (frDown in dlg.Options) then + Include(rOptions, ssoBackwards); + if frMatchCase in dlg.Options then + Include(rOptions, ssoMatchCase); + if frWholeWord in dlg.Options then + Include(rOptions, ssoWholeWord); + if SynEditor.SearchReplace(sSearch, '', rOptions) = 0 then begin + Beep; + lblSearchResult.Caption := 'SearchText ''' + sSearch + ''' not found!'; + lblSearchResult.Visible := TRUE; + end else + lblSearchResult.Visible := FALSE; + end; +end; + +procedure TDemoMainForm.DoReplaceText(Sender: TObject); +var + rOptions: TSynSearchOptions; + sSearch: string; +begin + sSearch := ReplaceDialog1.FindText; + if Length(sSearch) = 0 then begin + Beep; + lblSearchResult.Caption := 'Can''t replace an empty text!'; + lblSearchResult.Visible := TRUE; + end else begin + rOptions := [ssoReplace]; + if frMatchCase in ReplaceDialog1.Options then + Include(rOptions, ssoMatchCase); + if frWholeWord in ReplaceDialog1.Options then + Include(rOptions, ssoWholeWord); + if frReplaceAll in ReplaceDialog1.Options then + Include(rOptions, ssoReplaceAll); + if SynEditor.SearchReplace(sSearch, ReplaceDialog1.ReplaceText, rOptions) = 0 + then begin + Beep; + lblSearchResult.Caption := 'SearchText ''' + sSearch + + ''' could not be replaced!'; + lblSearchResult.Visible := TRUE; + end else + lblSearchResult.Visible := FALSE; + end; +end; + +procedure TDemoMainForm.btnReplaceClick(Sender: TObject); +begin + ReplaceDialog1.Execute; +end; + +procedure TDemoMainForm.btnExportToFileClick(Sender: TObject); +var + Exporter: TSynCustomExporter; +begin + Exporter := GetSelectedExporter; + // can't export to file in several formats at the same time... + if Assigned(Exporter) then + with SaveDialog1 do begin + Filter := Exporter.DefaultFilter; + if Execute then with Exporter do begin + ExportAsText := TRUE; + Highlighter := SynEditor.Highlighter; + if fFileName <> '' then + Title := '"' + fFileName + '" exported as ' + FormatName; + if cbExportSelected.Checked and SynEditor.SelAvail then + ExportRange(SynEditor.Lines, SynEditor.BlockBegin, SynEditor.BlockEnd) + else + ExportAll(SynEditor.Lines); + SaveToFile(FileName); + end; + end; + SynEditor.SetFocus; +end; + +procedure TDemoMainForm.btnExportToClipboardClick(Sender: TObject); +var + Exporter: TSynCustomExporter; + SelectedOnly: boolean; + i: integer; + + procedure DoExport; + begin + with Exporter do begin + ExportAsText := FALSE; + Highlighter := SynEditor.Highlighter; + if SelectedOnly then + ExportRange(SynEditor.Lines, SynEditor.BlockBegin, SynEditor.BlockEnd) + else + ExportAll(SynEditor.Lines); + CopyToClipboard; + Highlighter := nil; + end; + end; + +begin + Clipboard.Open; + try + SelectedOnly := cbExportSelected.Checked and SynEditor.SelAvail; + if SelectedOnly then + Clipboard.AsText := SynEditor.SelText + else + Clipboard.AsText := SynEditor.Lines.Text; + // is exporter selected? + Exporter := GetSelectedExporter; + if Exporter <> nil then + DoExport + else for i := 0 to ComponentCount - 1 do begin + if not (Components[i] is TSynCustomExporter) then + continue; + Exporter := TSynCustomExporter(Components[i]); + DoExport; + end; + finally + Clipboard.Close; + end; +end; + +procedure TDemoMainForm.SynEditorContextHelp(Sender: TObject; word: UnicodeString); +var + hlpmsg : array[0..255] of char; +begin + StrFmt(hlpmsg, 'Need help for %s?', [word]); + with Application do + MessageBox(hlpmsg, PChar(Title), mb_ok or mb_iconquestion); +end; + +procedure TDemoMainForm.cbShrinkListClick(Sender: TObject); +var + iOptions: TSynCompletionOptions; +begin + iOptions := SynCompletionProposal1.Options; + if cbShrinkList.Checked then + Include( iOptions, scoLimitToMatchedText ) + else + Exclude( iOptions, scoLimitToMatchedText ); + SynCompletionProposal1.Options := iOptions; +end; + +procedure TDemoMainForm.cbCompletionAttrChange(Sender: TObject); +var + idx : Integer; +begin + idx := -1; + case cbCompletionAttr.ItemIndex of + 0 : idx := ColorToIndex(SynCompletionProposal1.ClBackground); + 1 : idx := ColorToIndex(SynCompletionProposal1.Font.Color); + 2 : idx := ColorToIndex(SynCompletionProposal1.ClSelect); + 3 : idx := ColorToIndex(SynCompletionProposal1.ClSelectedText); + end; + cbxCompletionColor.ItemIndex := idx; +end; + +procedure TDemoMainForm.cbxCompletionColorChange(Sender: TObject); +begin + case cbCompletionAttr.ItemIndex of + 0 : SynCompletionProposal1.ClBackground := IndexToColor(cbxCompletionColor.ItemIndex); + 1 : SynCompletionProposal1.Font.Color := IndexToColor(cbxCompletionColor.ItemIndex); + 2 : SynCompletionProposal1.ClSelect := IndexToColor(cbxCompletionColor.ItemIndex); + 3 : SynCompletionProposal1.ClSelectedText := IndexToColor(cbxCompletionColor.ItemIndex); + end; +end; + +procedure TDemoMainForm.SynEditorGutterClick(Sender: TObject; + Button: TMouseButton; X, Y, Line: Integer; Mark: TSynEditMark); +begin + if cbOther.Checked then + LogEvent('OnGutterClick'); + SynEditor.CaretY := Line; + if not assigned(mark) then begin // place first mark + SpeedButton1.Down := true; + SpeedButton1.Click; + end else + if (not mark.IsBookmark) and (mark.ImageIndex >= SpeedButton1.Tag) then begin + if mark.ImageIndex = SpeedButton5.Tag then begin // remove mark + SpeedButton5.Down := false; + SpeedButton5.Click; + end else + mark.ImageIndex := mark.ImageIndex + 1; + end; + ResetMarkButtons; + +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/D4Demo/ImageListGlyphs.bmp b/Source/VCL/SynEdit/Demos/D4Demo/ImageListGlyphs.bmp new file mode 100644 index 00000000..fca9ff70 Binary files /dev/null and b/Source/VCL/SynEdit/Demos/D4Demo/ImageListGlyphs.bmp differ diff --git a/Source/VCL/SynEdit/Demos/D4Demo/ReadMe.txt b/Source/VCL/SynEdit/Demos/D4Demo/ReadMe.txt new file mode 100644 index 00000000..2be9dcac --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/ReadMe.txt @@ -0,0 +1,8 @@ +D4Demo.dpr +---------- + +- Needs Delphi 4 or higher + +- Shows (nearly) all the properties of the SynEdit control, and all of the + highlighters. + diff --git a/Source/VCL/SynEdit/Demos/D4Demo/Unit2.dfm b/Source/VCL/SynEdit/Demos/D4Demo/Unit2.dfm new file mode 100644 index 00000000..c99a4746 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/Unit2.dfm @@ -0,0 +1,76 @@ +object Form2: TForm2 + Left = 345 + Top = 197 + BorderStyle = bsDialog + Caption = 'Reserved Words' + ClientHeight = 320 + ClientWidth = 271 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + PixelsPerInch = 96 + TextHeight = 13 + object lbKeywords: TListBox + Left = 8 + Top = 8 + Width = 177 + Height = 305 + ItemHeight = 13 + TabOrder = 0 + end + object btnLoad: TButton + Left = 192 + Top = 104 + Width = 75 + Height = 25 + Caption = '&Load' + TabOrder = 1 + OnClick = btnLoadClick + end + object btnClose: TButton + Left = 192 + Top = 136 + Width = 75 + Height = 25 + Caption = '&Close' + ModalResult = 1 + TabOrder = 2 + end + object btnAdd: TButton + Left = 192 + Top = 8 + Width = 75 + Height = 25 + Caption = '&Add' + TabOrder = 3 + OnClick = btnAddClick + end + object btnEdit: TButton + Left = 192 + Top = 40 + Width = 75 + Height = 25 + Caption = '&Edit' + TabOrder = 4 + OnClick = btnEditClick + end + object btnDelete: TButton + Left = 192 + Top = 72 + Width = 75 + Height = 25 + Caption = '&Delete' + TabOrder = 5 + OnClick = btnDeleteClick + end + object OpenDialog1: TOpenDialog + Filter = 'Text Files (*.txt)|*.txt|All Files (*.*)|*.*' + Left = 192 + Top = 272 + end +end diff --git a/Source/VCL/SynEdit/Demos/D4Demo/Unit2.pas b/Source/VCL/SynEdit/Demos/D4Demo/Unit2.pas new file mode 100644 index 00000000..16ff7526 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/D4Demo/Unit2.pas @@ -0,0 +1,112 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: Unit2.pas, released 2000-06-23. + +The Original Code is the D4Demo project of the mwEdit component suite +by Martin Waldenburg and other developers. +The Original Author of the D4Demo project is Primoz Gabrijelcic. +Portions written by Primoz Gabrijelcic are copyright 1998 Primoz Gabrijelcic. +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: Unit2.pas,v 1.2 2000/11/22 08:34:13 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - printing has been removed from D4Demo, since it is covered in greater + detail in a dedicated example. +-------------------------------------------------------------------------------} + +unit Unit2; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls; + +type + TForm2 = class(TForm) + lbKeywords: TListBox; + btnLoad: TButton; + btnClose: TButton; + OpenDialog1: TOpenDialog; + btnAdd: TButton; + btnEdit: TButton; + btnDelete: TButton; + procedure btnLoadClick(Sender: TObject); + procedure btnDeleteClick(Sender: TObject); + procedure btnAddClick(Sender: TObject); + procedure btnEditClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.DFM} + +procedure TForm2.btnLoadClick(Sender: TObject); +begin + if OpenDialog1.Execute then + lbKeywords.Items.LoadFromFile(OpenDialog1.FileName); +end; + +procedure TForm2.btnDeleteClick(Sender: TObject); +begin + if lbKeywords.ItemIndex <> -1 then + lbKeywords.Items.Delete(lbKeywords.ItemIndex); +end; + +procedure TForm2.btnAddClick(Sender: TObject); +var + val: string; +begin + val := Inputbox('Add Reserved Word', 'Reserved Word:', ''); + if val <> '' then + lbKeywords.Items.Add(val); +end; + +procedure TForm2.btnEditClick(Sender: TObject); +var + val: string; +begin + if lbKeywords.ItemIndex <> -1 then begin + val := Inputbox('Edit Reserved Word', 'Reserved Word:', lbKeywords.Items[lbKeywords.ItemIndex]); + if val <> lbKeywords.Items[lbKeywords.ItemIndex] then + lbKeywords.Items.Add(val); + end; +end; + +end. + + \ No newline at end of file diff --git a/Source/VCL/SynEdit/Demos/DBSynEditDemo/DBEditDemo1.dpr b/Source/VCL/SynEdit/Demos/DBSynEditDemo/DBEditDemo1.dpr new file mode 100644 index 00000000..35ab575b --- /dev/null +++ b/Source/VCL/SynEdit/Demos/DBSynEditDemo/DBEditDemo1.dpr @@ -0,0 +1,50 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: DBEditDemo1.dpr, released 2000-06-23. + +The Original Code is part of the DBEditDemo1 project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: DBEditDemo1.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program DBEditDemo1; + +uses + Forms, + uMain1 in 'uMain1.pas' {Form1}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/Source/VCL/SynEdit/Demos/DBSynEditDemo/DemoSrc.dbf b/Source/VCL/SynEdit/Demos/DBSynEditDemo/DemoSrc.dbf new file mode 100644 index 00000000..e48447a8 Binary files /dev/null and b/Source/VCL/SynEdit/Demos/DBSynEditDemo/DemoSrc.dbf differ diff --git a/Source/VCL/SynEdit/Demos/DBSynEditDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/DBSynEditDemo/ReadMe.txt new file mode 100644 index 00000000..ee8119df --- /dev/null +++ b/Source/VCL/SynEdit/Demos/DBSynEditDemo/ReadMe.txt @@ -0,0 +1,6 @@ +DBEditDemo1.dpr +--------------- + +- Needs Delphi 2 or higher. +- Demonstrates the TDBSynEdit component. + diff --git a/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.dfm b/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.dfm new file mode 100644 index 00000000..64de4ab1 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.dfm @@ -0,0 +1,447 @@ +object Form1: TForm1 + Left = 140 + Top = 102 + Width = 556 + Height = 394 + Caption = 'Form1' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 548 + Height = 33 + Align = alTop + BevelOuter = bvNone + TabOrder = 0 + object DBNavigator1: TDBNavigator + Left = 4 + Top = 4 + Width = 240 + Height = 25 + DataSource = DataSource1 + TabOrder = 0 + end + object DBEdit1: TDBEdit + Left = 256 + Top = 5 + Width = 153 + Height = 24 + DataSource = DataSource1 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + TabOrder = 1 + end + end + object DBSynEdit1: TDBSynEdit + Left = 0 + Top = 33 + Width = 548 + Height = 327 + DataSource = DataSource1 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentColor = False + ParentFont = False + TabOrder = 1 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + RemovedKeystrokes = < + item + Command = ecDeleteLastChar + ShortCut = 8200 + end + item + Command = ecDeleteLastWord + ShortCut = 16392 + end + item + Command = ecUndo + ShortCut = 32776 + end + item + Command = ecRedo + ShortCut = 40968 + end + item + Command = ecLineBreak + ShortCut = 13 + end + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecTab + ShortCut = 9 + end + item + Command = ecShiftTab + ShortCut = 8201 + end + item + Command = ecContextHelp + ShortCut = 112 + end + item + Command = ecSelectAll + ShortCut = 16449 + end + item + Command = ecCopy + ShortCut = 16451 + end + item + Command = ecPaste + ShortCut = 16470 + end + item + Command = ecCut + ShortCut = 16472 + end + item + Command = ecBlockIndent + ShortCut = 24649 + end + item + Command = ecBlockUnindent + ShortCut = 24661 + end + item + Command = ecLineBreak + ShortCut = 16461 + end + item + Command = ecInsertLine + ShortCut = 16462 + end + item + Command = ecDeleteWord + ShortCut = 16468 + end + item + Command = ecDeleteLine + ShortCut = 16473 + end + item + Command = ecDeleteEOL + ShortCut = 24665 + end + item + Command = ecUndo + ShortCut = 16474 + end + item + Command = ecRedo + ShortCut = 24666 + end + item + Command = ecGotoMarker0 + ShortCut = 16432 + end + item + Command = ecGotoMarker1 + ShortCut = 16433 + end + item + Command = ecGotoMarker2 + ShortCut = 16434 + end + item + Command = ecGotoMarker3 + ShortCut = 16435 + end + item + Command = ecGotoMarker4 + ShortCut = 16436 + end + item + Command = ecGotoMarker5 + ShortCut = 16437 + end + item + Command = ecGotoMarker6 + ShortCut = 16438 + end + item + Command = ecGotoMarker7 + ShortCut = 16439 + end + item + Command = ecGotoMarker8 + ShortCut = 16440 + end + item + Command = ecGotoMarker9 + ShortCut = 16441 + end + item + Command = ecSetMarker0 + ShortCut = 24624 + end + item + Command = ecSetMarker1 + ShortCut = 24625 + end + item + Command = ecSetMarker2 + ShortCut = 24626 + end + item + Command = ecSetMarker3 + ShortCut = 24627 + end + item + Command = ecSetMarker4 + ShortCut = 24628 + end + item + Command = ecSetMarker5 + ShortCut = 24629 + end + item + Command = ecSetMarker6 + ShortCut = 24630 + end + item + Command = ecSetMarker7 + ShortCut = 24631 + end + item + Command = ecSetMarker8 + ShortCut = 24632 + end + item + Command = ecSetMarker9 + ShortCut = 24633 + end + item + Command = ecNormalSelect + ShortCut = 24654 + end + item + Command = ecColumnSelect + ShortCut = 24643 + end + item + Command = ecLineSelect + ShortCut = 24652 + end> + AddedKeystrokes = < + item + Command = ecDeleteLastWord + ShortCut = 8200 + end + item + Command = ecUndo + ShortCut = 16392 + end + item + Command = ecRedo + ShortCut = 32776 + end + item + Command = ecLineBreak + ShortCut = 40968 + end + item + Command = ecSelectAll + ShortCut = 13 + end + item + Command = ecCopy + ShortCut = 16449 + end + item + Command = ecBlockIndent + ShortCut = 16451 + end + item + Command = ecLineBreak + ShortCut = 24649 + end + item + Command = ecInsertLine + ShortCut = 16461 + end + item + Command = ecDeleteWord + ShortCut = 16462 + end + item + Command = ecBlockUnindent + ShortCut = 16468 + end + item + Command = ecPaste + ShortCut = 24661 + end + item + Command = ecCut + ShortCut = 16470 + end + item + Command = ecDeleteLine + ShortCut = 16472 + end + item + Command = ecDeleteEOL + ShortCut = 16473 + end + item + Command = ecUndo + ShortCut = 24665 + end + item + Command = ecRedo + ShortCut = 16474 + end + item + Command = ecGotoMarker0 + ShortCut = 24666 + end + item + Command = ecGotoMarker1 + ShortCut = 16432 + end + item + Command = ecGotoMarker2 + ShortCut = 16433 + end + item + Command = ecGotoMarker3 + ShortCut = 16434 + end + item + Command = ecGotoMarker4 + ShortCut = 16435 + end + item + Command = ecGotoMarker5 + ShortCut = 16436 + end + item + Command = ecGotoMarker6 + ShortCut = 16437 + end + item + Command = ecGotoMarker7 + ShortCut = 16438 + end + item + Command = ecGotoMarker8 + ShortCut = 16439 + end + item + Command = ecGotoMarker9 + ShortCut = 16440 + end + item + Command = ecSetMarker0 + ShortCut = 16441 + end + item + Command = ecSetMarker1 + ShortCut = 24624 + end + item + Command = ecSetMarker2 + ShortCut = 24625 + end + item + Command = ecSetMarker3 + ShortCut = 24626 + end + item + Command = ecSetMarker4 + ShortCut = 24627 + end + item + Command = ecSetMarker5 + ShortCut = 24628 + end + item + Command = ecSetMarker6 + ShortCut = 24629 + end + item + Command = ecSetMarker7 + ShortCut = 24630 + end + item + Command = ecSetMarker8 + ShortCut = 24631 + end + item + Command = ecSetMarker9 + ShortCut = 24632 + end + item + Command = ecNormalSelect + ShortCut = 24633 + end + item + Command = ecColumnSelect + ShortCut = 24654 + end + item + Command = ecLineSelect + ShortCut = 24643 + end + item + Command = ecTab + ShortCut = 24652 + end + item + Command = ecShiftTab + ShortCut = 9 + end + item + Command = ecMatchBracket + ShortCut = 8201 + end> + end + object DataSource1: TDataSource + DataSet = Table1 + OnDataChange = DataSource1DataChange + Left = 72 + Top = 92 + end + object Table1: TTable + AfterOpen = UpdateHighlighterNeeded + AfterEdit = UpdateHighlighterNeeded + AfterPost = UpdateHighlighterNeeded + AfterDelete = UpdateHighlighterNeeded + OnUpdateRecord = Table1UpdateRecord + Left = 112 + Top = 92 + end + object SynPasSyn1: TSynPasSyn + Left = 72 + Top = 152 + end + object SynPerlSyn1: TSynPerlSyn + DefaultFilter = 'Perl files (*.pl,*.pm,*.cgi)|*.pl;*.pm;*.cgi' + Left = 112 + Top = 152 + end +end diff --git a/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.pas b/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.pas new file mode 100644 index 00000000..ea4285a2 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/DBSynEditDemo/uMain1.pas @@ -0,0 +1,147 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: uMain1.pas, released 2000-06-23. + +The Original Code is part of the DBEditDemo1 project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: uMain1.pas,v 1.2 2000/11/22 08:34:13 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit uMain1; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, Mask, DBCtrls, SynEdit, SynDBEdit, Db, DBTables, ExtCtrls, + SynEditHighlighter, SynHighlighterPas, SynHighlighterPerl; + +type + TForm1 = class(TForm) + Panel1: TPanel; + DataSource1: TDataSource; + Table1: TTable; + DBSynEdit1: TDBSynEdit; + DBNavigator1: TDBNavigator; + DBEdit1: TDBEdit; + SynPasSyn1: TSynPasSyn; + SynPerlSyn1: TSynPerlSyn; + procedure FormCreate(Sender: TObject); + procedure UpdateHighlighterNeeded(DataSet: TDataSet); + procedure Table1UpdateRecord(DataSet: TDataSet; + UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction); + procedure DataSource1DataChange(Sender: TObject; Field: TField); + private + fUpdateHL: boolean; + procedure IdleAction(Sender: TObject; var Done: Boolean); + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +const + SourceTableName = 'DemoSrc.dbf'; + HighlighterClassField = 'HLCLASS'; + DemoSourceField = 'SRC'; + +procedure TForm1.FormCreate(Sender: TObject); +var + TableName: string; + ASQL: TQuery; +begin + Application.OnIdle := IdleAction; + fUpdateHL := TRUE; + TableName := ExtractFilePath(Application.ExeName) + SourceTableName; + + if not FileExists(TableName) then begin + ASQL := TQuery.Create(Self); + try + ASQL.SQL.Text := + 'CREATE TABLE "' + TableName + '" ('#13#10 + + ' ' + HighlighterClassField + ' CHAR(20),'#13#10 + + ' ' + DemoSourceField + ' CHAR(250)'#13#10 + + ')'; + + ASQL.ExecSQL; + finally + ASQL.Free; + end; + end; + Table1.TableName := TableName; + Table1.Active := TRUE; + DBSynEdit1.DataField := DemoSourceField; + DBEdit1.DataField := HighlighterClassField; +end; + +procedure TForm1.UpdateHighlighterNeeded(DataSet: TDataSet); +begin + fUpdateHL := TRUE; +end; + +procedure TForm1.Table1UpdateRecord(DataSet: TDataSet; UpdateKind: TUpdateKind; + var UpdateAction: TUpdateAction); +begin + fUpdateHL := TRUE; +end; + +procedure TForm1.IdleAction(Sender: TObject; var Done: Boolean); +var + HLName: string; + i: integer; + HL: TSynCustomHighlighter; +begin + if fUpdateHL then begin + fUpdateHL := FALSE; + HLName := DBEdit1.Text; + HL := nil; + for i := 0 to ComponentCount - 1 do + if CompareText(Components[i].ClassName, HLName) = 0 then begin + if Components[i] is TSynCustomHighlighter then begin + HL := Components[i] as TSynCustomHighlighter; + break; + end; + end; + DBSynEdit1.Highlighter := HL; + end; +end; + +procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField); +begin + fUpdateHL := TRUE; +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/DemosVCL.bpg b/Source/VCL/SynEdit/Demos/DemosVCL.bpg new file mode 100644 index 00000000..8d3417af --- /dev/null +++ b/Source/VCL/SynEdit/Demos/DemosVCL.bpg @@ -0,0 +1,81 @@ +#------------------------------------------------------------------------------ +VERSION = BWS.01 +#------------------------------------------------------------------------------ +!ifndef ROOT +ROOT = $(MAKEDIR)\.. +!endif +#------------------------------------------------------------------------------ +MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** +DCC = $(ROOT)\bin\dcc32.exe $** +BRCC = $(ROOT)\bin\brcc32.exe $** +#------------------------------------------------------------------------------ +PROJECTS = AutoCompleteDemo1.exe CompletionProposalDemo.exe ParamCompletionDemo.exe \ + D4demo.exe DBEditDemo1.exe EditAppMDI.exe EditAppSDI.exe EditAppWorkbook.exe \ + ExportDemo.exe HighlighterDemo.exe MultiHighlight.exe PaintTransientDemo.exe pas2html.exe \ + PrintDemo1.exe TestPP.exe ScanTokensDemo.exe SearchReplaceDemo.exe SimpleIDEDemo.exe \ + SynAutoCorrectDemo.exe URLDemoWindows.exe +#------------------------------------------------------------------------------ +default: $(PROJECTS) +#------------------------------------------------------------------------------ + +AutoCompleteDemo1.exe: AutoCompleteDemo\AutoCompleteDemo1.dpr + $(DCC) + +CompletionProposalDemo.exe: CompletionProposalDemo\CompletionProposalDemo.dpr + $(DCC) + +ParamCompletionDemo.exe: CompletionProposalDemo\ParamCompletionDemo.dpr + $(DCC) + +D4demo.exe: D4Demo\D4demo.dpr + $(DCC) + +DBEditDemo1.exe: DBSynEditDemo\DBEditDemo1.dpr + $(DCC) + +EditAppMDI.exe: EditAppDemos\EditAppMDI.dpr + $(DCC) + +EditAppSDI.exe: EditAppDemos\EditAppSDI.dpr + $(DCC) + +EditAppWorkbook.exe: EditAppDemos\EditAppWorkbook.dpr + $(DCC) + +ExportDemo.exe: ExportDemo\ExportDemo.dpr + $(DCC) + +HighlighterDemo.exe: HighlighterDemo\HighlighterDemo.dpr + $(DCC) + +MultiHighlight.exe: MultiSynDemo\MultiHighlight.dpr + $(DCC) + +PaintTransientDemo.exe: OnPaintTransientDemo\PaintTransientDemo.dpr + $(DCC) + +pas2html.exe: pas2html\pas2html.dpr + $(DCC) + +PrintDemo1.exe: PrintDemo\PrintDemo1.dpr + $(DCC) + +TestPP.exe: PrintDemoNew\TestPP.dpr + $(DCC) + +ScanTokensDemo.exe: ScanTokensDemo\ScanTokensDemo.dpr + $(DCC) + +SearchReplaceDemo.exe: SearchReplaceDemo\SearchReplaceDemo.dpr + $(DCC) + +SimpleIDEDemo.exe: SimpleIDEDemo\SimpleIDEDemo.dpr + $(DCC) + +SynAutoCorrectDemo.exe: SynAutoCorrectDemo\SynAutoCorrectDemo.dpr + $(DCC) + +URLDemoWindows.exe: URLDemo\Windows\URLDemoWindows.dpr + $(DCC) + + diff --git a/Source/VCL/SynEdit/Demos/ExportDemo/ExportDemo.dpr b/Source/VCL/SynEdit/Demos/ExportDemo/ExportDemo.dpr new file mode 100644 index 00000000..277de36b --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ExportDemo/ExportDemo.dpr @@ -0,0 +1,50 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: ExportDemo.dpr, released 2000-06-23. + +The Original Code is part of the ExportDemo project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: ExportDemo.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program ExportDemo; + +uses + Forms, + frmExportMain in 'frmExportMain.pas' {Form1}, + uHighlighterProcs in '..\uHighlighterProcs.pas'; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/ExportDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/ExportDemo/ReadMe.txt new file mode 100644 index 00000000..d4c5f2e1 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ExportDemo/ReadMe.txt @@ -0,0 +1,7 @@ +ExportDemo.dpr +-------------- + +- Needs Delphi 2 or higher. +- Demonstrates export to files and to the clipboard using the TSynExporterHTML + and TSynExporterRTF components. + diff --git a/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.dfm b/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.dfm new file mode 100644 index 00000000..d6da622f --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.dfm @@ -0,0 +1,501 @@ +object Form1: TForm1 + Left = 160 + Top = 108 + Width = 576 + Height = 393 + Caption = 'SynEdit export demo' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Menu = menuMain + OldCreateOrder = True + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 568 + Height = 320 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + RemovedKeystrokes = < + item + Command = ecDeleteLastChar + ShortCut = 8200 + end + item + Command = ecDeleteLastWord + ShortCut = 16392 + end + item + Command = ecUndo + ShortCut = 32776 + end + item + Command = ecRedo + ShortCut = 40968 + end + item + Command = ecLineBreak + ShortCut = 13 + end + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecTab + ShortCut = 9 + end + item + Command = ecShiftTab + ShortCut = 8201 + end + item + Command = ecContextHelp + ShortCut = 112 + end + item + Command = ecSelectAll + ShortCut = 16449 + end + item + Command = ecCopy + ShortCut = 16451 + end + item + Command = ecPaste + ShortCut = 16470 + end + item + Command = ecCut + ShortCut = 16472 + end + item + Command = ecBlockIndent + ShortCut = 24649 + end + item + Command = ecBlockUnindent + ShortCut = 24661 + end + item + Command = ecLineBreak + ShortCut = 16461 + end + item + Command = ecInsertLine + ShortCut = 16462 + end + item + Command = ecDeleteWord + ShortCut = 16468 + end + item + Command = ecDeleteLine + ShortCut = 16473 + end + item + Command = ecDeleteEOL + ShortCut = 24665 + end + item + Command = ecUndo + ShortCut = 16474 + end + item + Command = ecRedo + ShortCut = 24666 + end + item + Command = ecGotoMarker0 + ShortCut = 16432 + end + item + Command = ecGotoMarker1 + ShortCut = 16433 + end + item + Command = ecGotoMarker2 + ShortCut = 16434 + end + item + Command = ecGotoMarker3 + ShortCut = 16435 + end + item + Command = ecGotoMarker4 + ShortCut = 16436 + end + item + Command = ecGotoMarker5 + ShortCut = 16437 + end + item + Command = ecGotoMarker6 + ShortCut = 16438 + end + item + Command = ecGotoMarker7 + ShortCut = 16439 + end + item + Command = ecGotoMarker8 + ShortCut = 16440 + end + item + Command = ecGotoMarker9 + ShortCut = 16441 + end + item + Command = ecSetMarker0 + ShortCut = 24624 + end + item + Command = ecSetMarker1 + ShortCut = 24625 + end + item + Command = ecSetMarker2 + ShortCut = 24626 + end + item + Command = ecSetMarker3 + ShortCut = 24627 + end + item + Command = ecSetMarker4 + ShortCut = 24628 + end + item + Command = ecSetMarker5 + ShortCut = 24629 + end + item + Command = ecSetMarker6 + ShortCut = 24630 + end + item + Command = ecSetMarker7 + ShortCut = 24631 + end + item + Command = ecSetMarker8 + ShortCut = 24632 + end + item + Command = ecSetMarker9 + ShortCut = 24633 + end + item + Command = ecNormalSelect + ShortCut = 24654 + end + item + Command = ecColumnSelect + ShortCut = 24643 + end + item + Command = ecLineSelect + ShortCut = 24652 + end> + AddedKeystrokes = < + item + Command = ecDeleteLastWord + ShortCut = 8200 + end + item + Command = ecUndo + ShortCut = 16392 + end + item + Command = ecRedo + ShortCut = 32776 + end + item + Command = ecLineBreak + ShortCut = 40968 + end + item + Command = ecSelectAll + ShortCut = 13 + end + item + Command = ecCopy + ShortCut = 16449 + end + item + Command = ecBlockIndent + ShortCut = 16451 + end + item + Command = ecLineBreak + ShortCut = 24649 + end + item + Command = ecInsertLine + ShortCut = 16461 + end + item + Command = ecDeleteWord + ShortCut = 16462 + end + item + Command = ecBlockUnindent + ShortCut = 16468 + end + item + Command = ecPaste + ShortCut = 24661 + end + item + Command = ecCut + ShortCut = 16470 + end + item + Command = ecDeleteLine + ShortCut = 16472 + end + item + Command = ecDeleteEOL + ShortCut = 16473 + end + item + Command = ecUndo + ShortCut = 24665 + end + item + Command = ecRedo + ShortCut = 16474 + end + item + Command = ecGotoMarker0 + ShortCut = 24666 + end + item + Command = ecGotoMarker1 + ShortCut = 16432 + end + item + Command = ecGotoMarker2 + ShortCut = 16433 + end + item + Command = ecGotoMarker3 + ShortCut = 16434 + end + item + Command = ecGotoMarker4 + ShortCut = 16435 + end + item + Command = ecGotoMarker5 + ShortCut = 16436 + end + item + Command = ecGotoMarker6 + ShortCut = 16437 + end + item + Command = ecGotoMarker7 + ShortCut = 16438 + end + item + Command = ecGotoMarker8 + ShortCut = 16439 + end + item + Command = ecGotoMarker9 + ShortCut = 16440 + end + item + Command = ecSetMarker0 + ShortCut = 16441 + end + item + Command = ecSetMarker1 + ShortCut = 24624 + end + item + Command = ecSetMarker2 + ShortCut = 24625 + end + item + Command = ecSetMarker3 + ShortCut = 24626 + end + item + Command = ecSetMarker4 + ShortCut = 24627 + end + item + Command = ecSetMarker5 + ShortCut = 24628 + end + item + Command = ecSetMarker6 + ShortCut = 24629 + end + item + Command = ecSetMarker7 + ShortCut = 24630 + end + item + Command = ecSetMarker8 + ShortCut = 24631 + end + item + Command = ecSetMarker9 + ShortCut = 24632 + end + item + Command = ecNormalSelect + ShortCut = 24633 + end + item + Command = ecColumnSelect + ShortCut = 24654 + end + item + Command = ecLineSelect + ShortCut = 24643 + end + item + Command = ecTab + ShortCut = 24652 + end + item + Command = ecShiftTab + ShortCut = 9 + end + item + Command = ecMatchBracket + ShortCut = 8201 + end> + end + object Statusbar: TStatusBar + Left = 0 + Top = 320 + Width = 568 + Height = 19 + Panels = <> + end + object menuMain: TMainMenu + Left = 40 + Top = 112 + object mFile: TMenuItem + Caption = '&File' + object miFileOpen: TMenuItem + Caption = '&Open...' + ShortCut = 16463 + OnClick = miFileOpenClick + end + object N1: TMenuItem + Caption = '-' + end + object miFileExit: TMenuItem + Caption = 'Exit' + ShortCut = 32883 + OnClick = miFileExitClick + end + end + object mExport: TMenuItem + Caption = '&Export' + OnClick = mExportClick + object miExportAsHTML: TMenuItem + Caption = 'As &HTML' + OnClick = miExportAsClicked + end + object miExportAsRTF: TMenuItem + Caption = 'As &RTF' + OnClick = miExportAsClicked + end + object miExportAllFormats: TMenuItem + Caption = '&All formats' + OnClick = miExportAsClicked + end + object N2: TMenuItem + Caption = '-' + end + object miExportToFile: TMenuItem + Caption = 'Export to &file...' + OnClick = miExportToFileClick + end + object N3: TMenuItem + Caption = '-' + end + object miExportClipboardNative: TMenuItem + Caption = 'Copy &native format to clipboard' + OnClick = miExportClipboardNativeClick + end + object miExportClipboardText: TMenuItem + Caption = 'Copy as &text to clipboard' + OnClick = miExportClipboardTextClick + end + end + end + object dlgFileOpen: TOpenDialog + Left = 40 + Top = 148 + end + object dlgFileSaveAs: TSaveDialog + Title = 'Export file as' + Left = 76 + Top = 148 + end + object SynExporterHTML1: TSynExporterHTML + Color = clWindow + DefaultFilter = 'HTML Document (*.htm,*.html)|*.htm;*.html' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Title = 'Untitled' + UseBackground = True + Left = 40 + Top = 184 + end + object SynExporterRTF1: TSynExporterRTF + Color = clWindow + DefaultFilter = 'Rich Text Format (*.rtf)|*.rtf' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Title = 'Untitled' + UseBackground = True + Left = 76 + Top = 184 + end + object SynCppSyn1: TSynCppSyn + DefaultFilter = 'C++ files (*.cpp,*.h,*.hpp)|*.cpp;*.h;*.hpp' + Left = 40 + Top = 8 + end + object SynDfmSyn1: TSynDfmSyn + DefaultFilter = 'Delphi/C++ Builder Form Files (*.dfm)|*.dfm' + Left = 72 + Top = 8 + end + object SynPasSyn1: TSynPasSyn + Left = 104 + Top = 8 + end +end diff --git a/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.pas b/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.pas new file mode 100644 index 00000000..2ea799c2 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ExportDemo/frmExportMain.pas @@ -0,0 +1,243 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: frmExportMain.pas, released 2000-06-23. + +The Original Code is part of the ExportDemo project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: frmExportMain.pas,v 1.2.2.1 2005/01/10 14:08:10 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit frmExportMain; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEdit, Menus, SynExportRTF, SynEditExport, SynExportHTML, + SynEditHighlighter, SynHighlighterPas, ComCtrls, SynHighlighterDfm, + SynHighlighterCpp; + +type + TForm1 = class(TForm) + menuMain: TMainMenu; + mFile: TMenuItem; + miFileOpen: TMenuItem; + N1: TMenuItem; + miFileExit: TMenuItem; + SynEdit1: TSynEdit; + dlgFileOpen: TOpenDialog; + dlgFileSaveAs: TSaveDialog; + mExport: TMenuItem; + miExportToFile: TMenuItem; + Statusbar: TStatusBar; + SynExporterHTML1: TSynExporterHTML; + SynExporterRTF1: TSynExporterRTF; + miExportAsHTML: TMenuItem; + miExportAsRTF: TMenuItem; + miExportAllFormats: TMenuItem; + N2: TMenuItem; + N3: TMenuItem; + miExportClipboardNative: TMenuItem; + miExportClipboardText: TMenuItem; + SynCppSyn1: TSynCppSyn; + SynDfmSyn1: TSynDfmSyn; + SynPasSyn1: TSynPasSyn; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure miFileOpenClick(Sender: TObject); + procedure miFileExitClick(Sender: TObject); + procedure miExportToFileClick(Sender: TObject); + procedure mExportClick(Sender: TObject); + procedure miExportAsClicked(Sender: TObject); + procedure miExportClipboardNativeClick(Sender: TObject); + procedure miExportClipboardTextClick(Sender: TObject); + private + fExportAs: integer; + fHighlighters: TStringList; + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +uses + uHighlighterProcs, Clipbrd; + +{ TForm1 } + +procedure TForm1.FormCreate(Sender: TObject); +begin + fHighlighters := TStringList.Create; + fHighlighters.Sorted := TRUE; + GetHighlighters(Self, fHighlighters, FALSE); + dlgFileOpen.Filter := GetHighlightersFilter(fHighlighters) + 'All files|*.*|'; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + fHighlighters.Free; +end; + +procedure TForm1.miFileOpenClick(Sender: TObject); +begin + if dlgFileOpen.Execute then begin + SynEdit1.Lines.LoadFromFile(dlgFileOpen.FileName); + SynEdit1.Highlighter := GetHighlighterFromFileExt(fHighlighters, + ExtractFileExt(dlgFileOpen.FileName)); + if Assigned(SynEdit1.Highlighter) then + Statusbar.SimpleText := 'Using highlighter for ' + + SynEdit1.Highlighter.GetFriendlyLanguageName + else + Statusbar.SimpleText := 'No highlighter assigned'; + end; +end; + +procedure TForm1.miFileExitClick(Sender: TObject); +begin + Close; +end; + +procedure TForm1.mExportClick(Sender: TObject); +var + HasText, IsEnabled: boolean; + i: integer; +begin + miExportAsHTML.Checked := fExportAs = 1; + miExportAsRTF.Checked := fExportAs = 2; + miExportAllFormats.Checked := fExportAs = 0; + + HasText := FALSE; + for i := 0 to SynEdit1.Lines.Count - 1 do + if SynEdit1.Lines[i] <> '' then begin + HasText := TRUE; + break; + end; + IsEnabled := HasText and Assigned(SynEdit1.Highlighter); + miExportClipboardNative.Enabled := IsEnabled; + IsEnabled := IsEnabled and (fExportAs > 0); + miExportToFile.Enabled := IsEnabled; + miExportClipboardText.Enabled := IsEnabled; +end; + +procedure TForm1.miExportToFileClick(Sender: TObject); +var + FileName: string; + Exporter: TSynCustomExporter; +begin + case fExportAs of + 1: dlgFileSaveAs.Filter := SynExporterHTML1.DefaultFilter; + 2: dlgFileSaveAs.Filter := SynExporterRTF1.DefaultFilter; + end; + if dlgFileSaveAs.Execute then begin + Exporter := nil; + FileName := dlgFileSaveAs.FileName; + case fExportAs of + 1: begin + if ExtractFileExt(FileName) = '' then + FileName := FileName + '.html'; + Exporter := SynExporterHTML1; + end; + 2: begin + if ExtractFileExt(FileName) = '' then + FileName := FileName + '.rtf'; + Exporter := SynExporterRTF1; + end; + end; + if Assigned(Exporter) then with Exporter do begin + Title := 'Source file exported to file'; + Highlighter := SynEdit1.Highlighter; + ExportAsText := TRUE; + ExportAll(SynEdit1.Lines); + SaveToFile(FileName); + end; + end; +end; + +procedure TForm1.miExportAsClicked(Sender: TObject); +begin + if Sender = miExportAsHTML then + fExportAs := 1 + else if Sender = miExportAsRTF then + fExportAs := 2 + else + fExportAs := 0; +end; + +procedure TForm1.miExportClipboardNativeClick(Sender: TObject); +begin + Clipboard.Open; + try + Clipboard.AsText := SynEdit1.Lines.Text; + // HTML? + if fExportAs in [0, 1] then with SynExporterHTML1 do begin + Title := 'Source file exported to clipboard (native format)'; + ExportAsText := FALSE; + Highlighter := SynEdit1.Highlighter; + ExportAll(SynEdit1.Lines); + CopyToClipboard; + end; + // RTF? + if fExportAs in [0, 2] then with SynExporterRTF1 do begin + Title := 'Source file exported to clipboard (native format)'; + ExportAsText := FALSE; + Highlighter := SynEdit1.Highlighter; + ExportAll(SynEdit1.Lines); + CopyToClipboard; + end; + finally + Clipboard.Close; + end; +end; + +procedure TForm1.miExportClipboardTextClick(Sender: TObject); +var + Exporter: TSynCustomExporter; +begin + Exporter := nil; + case fExportAs of + 1: Exporter := SynExporterHTML1; + 2: Exporter := SynExporterRTF1; + end; + if Assigned(Exporter) then with Exporter do begin + Title := 'Source file exported to clipboard (as text)'; + ExportAsText := TRUE; + Highlighter := SynEdit1.Highlighter; + ExportAll(SynEdit1.Lines); + CopyToClipboard; + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/Folding/FoldingDemo.dpr b/Source/VCL/SynEdit/Demos/Folding/FoldingDemo.dpr index b728383a..b46d2d7b 100644 --- a/Source/VCL/SynEdit/Demos/Folding/FoldingDemo.dpr +++ b/Source/VCL/SynEdit/Demos/Folding/FoldingDemo.dpr @@ -1,16 +1,18 @@ +// JCL_DEBUG_EXPERT_GENERATEJDBG OFF +// JCL_DEBUG_EXPERT_INSERTJDBG OFF program FoldingDemo; uses Vcl.Forms, - Unit1 in 'Unit1.pas' {Form1}, + Unit1 in 'Unit1.pas' {FormFoldingDemo}, Vcl.Themes, - uHighlighterProcs in 'uHighlighterProcs.pas'; + uHighlighterProcs in '..\uHighlighterProcs.pas'; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TFormFoldingDemo, FormFoldingDemo); Application.Run; end. diff --git a/Source/VCL/SynEdit/Demos/Folding/Unit1.dfm b/Source/VCL/SynEdit/Demos/Folding/Unit1.dfm index fb873271..dd62174a 100644 --- a/Source/VCL/SynEdit/Demos/Folding/Unit1.dfm +++ b/Source/VCL/SynEdit/Demos/Folding/Unit1.dfm @@ -1,4 +1,4 @@ -object Form1: TForm1 +object FormFoldingDemo: TFormFoldingDemo Left = 0 Top = 0 Caption = 'Folding Demo' @@ -15,14 +15,14 @@ object Form1: TForm1 OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 - object ActionMainMenuBar1: TActionMainMenuBar + object ActionMainMenuBar: TActionMainMenuBar Left = 0 Top = 0 Width = 635 Height = 25 UseSystemFont = False - ActionManager = ActionManager1 - Caption = 'ActionMainMenuBar1' + ActionManager = ActionManager + Caption = 'ActionMainMenuBar' Color = clMenuBar ColorMap.DisabledFontColor = 7171437 ColorMap.HighlightColor = clWhite @@ -35,7 +35,7 @@ object Form1: TForm1 Font.Style = [] Spacing = 0 end - object SynEdit1: TSynEdit + object SynEdit: TSynEdit Left = 0 Top = 25 Width = 635 @@ -47,16 +47,24 @@ object Form1: TForm1 Font.Name = 'Consolas' Font.Pitch = fpFixed Font.Style = [] - Font.Quality = fqClearTypeNatural - PopupMenu = PopupActionBar1 + PopupMenu = PopupActionBar TabOrder = 1 + CodeFolding.GutterShapeSize = 11 + CodeFolding.CollapsedLineColor = clGrayText + CodeFolding.FolderBarLinesColor = clGrayText + CodeFolding.IndentGuidesColor = clGray + CodeFolding.IndentGuides = True + CodeFolding.ShowCollapsedLine = False + CodeFolding.ShowHintMark = True UseCodeFolding = False Gutter.AutoSize = True Gutter.Font.Charset = DEFAULT_CHARSET - Gutter.Font.Color = clWindowText - Gutter.Font.Height = -13 + Gutter.Font.Color = clGrayText + Gutter.Font.Height = -12 Gutter.Font.Name = 'Consolas' Gutter.Font.Style = [] + Gutter.GradientStartColor = clWindowText + Gutter.GradientEndColor = clWindow Lines.Strings = ( 'This project demonstrates the code folding capabilities of Syned' + @@ -91,8 +99,8 @@ object Form1: TForm1 '[ssCtrl, ssShift]);' '' - 'Note: The JavaScript, and Python highlighters are Code Folding e' + - 'nabled, but' + 'Note: The JavaScript, DWS and Python highlighters are Code Foldi' + + 'ng enabled, but' 'the C++ highlighter is not. Code folding for C++ is provided by' + ' a Synedit ' @@ -104,38 +112,41 @@ object Form1: TForm1 'in the unit SynEditCodeFolding.pas.') Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabIndent, eoTabsToSpaces, eoTrimTrailingSpaces] TabWidth = 4 + OnGutterGetText = SynEditGutterGetText + OnStatusChange = SynEditStatusChange + FontSmoothing = fsmNone end - object ActionManager1: TActionManager + object ActionManager: TActionManager ActionBars = < item Items = < item Items = < item - Action = FileOpen1 + Action = ActionFileOpen ImageIndex = 7 ShortCut = 16463 end item - Action = ActSave + Action = ActionSave Caption = '&Save' end item - Action = FileSaveAs1 + Action = ActionFileSaveAs ImageIndex = 30 end item Caption = '-' end item - Action = FilePrintSetup1 + Action = ActionFilePrintSetup end item - Action = FilePageSetup1 + Action = ActionFilePageSetup Caption = 'Pa&ge Setup...' end item - Action = DialogPrintDlg1 + Action = ActionDialogPrintDlg Caption = 'P&rint...' ImageIndex = 14 ShortCut = 16464 @@ -144,7 +155,7 @@ object Form1: TForm1 Caption = '-' end item - Action = FileExit1 + Action = ActionFileExit ImageIndex = 43 end> Caption = '&File' @@ -152,31 +163,31 @@ object Form1: TForm1 item Items = < item - Action = EditCut1 + Action = ActionEditCut ImageIndex = 0 ShortCut = 16472 end item - Action = EditCopy1 + Action = ActionEditCopy ImageIndex = 1 ShortCut = 16451 end item - Action = EditPaste1 + Action = ActionEditPaste ImageIndex = 2 ShortCut = 16470 end item - Action = EditSelectAll1 + Action = ActionEditSelectAll ShortCut = 16449 end item - Action = EditUndo1 + Action = ActionEditUndo ImageIndex = 3 ShortCut = 16474 end item - Action = EditDelete1 + Action = ActionEditDelete ImageIndex = 5 ShortCut = 46 end> @@ -185,10 +196,10 @@ object Form1: TForm1 item Items = < item - Action = DialogFontEdit1 + Action = ActionDialogFontEdit end item - Action = actGutterLines + Action = ActionGutterLines Caption = '&Gutter Lines' end item @@ -197,16 +208,22 @@ object Form1: TForm1 item Items = < item - Action = actCPP - Caption = '&C++' + Action = ActionCPP end item - Action = actJavaScript - Caption = '&JavaScript' + Action = ActionDWS end item - Action = actPython - Caption = '&Python' + Action = ActionJavaScript + end + item + Action = ActionPython + end + item + Action = ActionPascal + end + item + Action = ActionXML end> Caption = '&Highlighter' UsageCount = 1 @@ -215,24 +232,24 @@ object Form1: TForm1 Caption = '-' end item - Action = actCodeFolding + Action = ActionCodeFolding Caption = '&Code Folding' end item Items = < item - Action = actShowCollapsedLines + Action = ActionShowCollapsedLines Caption = '&Collapsed Lines' end item - Action = actShowCollapsedMarks + Action = ActionShowCollapsedMarks Caption = 'C&ollapsed Marks' end item Caption = '-' end item - Action = actFoldShapeSize + Action = ActionFoldShapeSize Caption = '&Gutter Square Size..' end> Caption = 'Fo&lding Options' @@ -244,27 +261,27 @@ object Form1: TForm1 item Items = < item - Action = actFoldAll + Action = ActionFoldAll Caption = '&All' end item - Action = actFoldNearest + Action = ActionFoldNearest Caption = '&Nearest' end item - Action = actFoldRegions + Action = ActionFoldRegions Caption = '&Regions' end item - Action = actFoldLevel1 + Action = ActionFoldLevel1 Caption = '&Level 1' end item - Action = actFoldLevel2 + Action = ActionFoldLevel2 Caption = 'L&evel 2' end item - Action = actFoldLevel3 + Action = ActionFoldLevel3 Caption = 'Le&vel 3' end> Caption = 'F&old' @@ -273,27 +290,27 @@ object Form1: TForm1 item Items = < item - Action = actUnFoldAll + Action = ActionUnFoldAll Caption = '&All' end item - Action = actUnfoldNearest + Action = ActionUnfoldNearest Caption = '&Nearest' end item - Action = actUnfoldRegions + Action = ActionUnfoldRegions Caption = '&Regions' end item - Action = actUnfoldLevel1 + Action = ActionUnfoldLevel1 Caption = '&Level 1' end item - Action = actUnfoldLevel2 + Action = ActionUnfoldLevel2 Caption = 'L&evel 2' end item - Action = actUnfoldLevel3 + Action = ActionUnfoldLevel3 Caption = 'Le&vel 3' end> Caption = '&Unfold' @@ -301,45 +318,45 @@ object Form1: TForm1 end> Caption = '&View' end> - ActionBar = ActionMainMenuBar1 + ActionBar = ActionMainMenuBar end> - OnUpdate = ActionManager1Update - Left = 464 + OnUpdate = ActionManagerUpdate + Left = 440 Top = 32 StyleName = 'Platform Default' - object actShowCollapsedLines: TAction + object ActionShowCollapsedLines: TAction Category = 'Folding Options' AutoCheck = True Caption = 'Collapsed Lines' - OnExecute = actShowCollapsedLinesExecute + OnExecute = ActionShowCollapsedLinesExecute end - object FileOpen1: TFileOpen + object ActionFileOpen: TFileOpen Category = 'File' Caption = '&Open...' Hint = 'Open|Opens an existing file' ImageIndex = 7 ShortCut = 16463 - OnAccept = FileOpen1Accept + OnAccept = ActionFileOpenAccept end - object ActSave: TAction + object ActionSave: TAction Category = 'File' Caption = 'Save' - OnExecute = ActSaveExecute + OnExecute = ActionSaveExecute end - object FileSaveAs1: TFileSaveAs + object ActionFileSaveAs: TFileSaveAs Category = 'File' Caption = 'Save &As...' Dialog.Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing] Hint = 'Save As|Saves the active file with a new name' ImageIndex = 30 - OnAccept = FileSaveAs1Accept + OnAccept = ActionFileSaveAsAccept end - object FilePrintSetup1: TFilePrintSetup + object ActionFilePrintSetup: TFilePrintSetup Category = 'File' Caption = 'Print Set&up...' Hint = 'Print Setup' end - object FilePageSetup1: TFilePageSetup + object ActionFilePageSetup: TFilePageSetup Category = 'File' Caption = 'Page Set&up...' Dialog.MinMarginLeft = 0 @@ -353,61 +370,61 @@ object Form1: TForm1 Dialog.PageWidth = 21590 Dialog.PageHeight = 27940 end - object DialogPrintDlg1: TPrintDlg + object ActionDialogPrintDlg: TPrintDlg Category = 'File' Caption = '&Print...' ImageIndex = 14 ShortCut = 16464 - OnAccept = DialogPrintDlg1Accept + OnAccept = ActionDialogPrintDlgAccept end - object FileExit1: TFileExit + object ActionFileExit: TFileExit Category = 'File' Caption = 'E&xit' Hint = 'Exit|Quits the application' ImageIndex = 43 end - object EditCut1: TEditCut + object ActionEditCut: TEditCut Category = 'Edit' Caption = 'Cu&t' Hint = 'Cut|Cuts the selection and puts it on the Clipboard' ImageIndex = 0 ShortCut = 16472 end - object EditCopy1: TEditCopy + object ActionEditCopy: TEditCopy Category = 'Edit' Caption = '&Copy' Hint = 'Copy|Copies the selection and puts it on the Clipboard' ImageIndex = 1 ShortCut = 16451 end - object EditPaste1: TEditPaste + object ActionEditPaste: TEditPaste Category = 'Edit' Caption = '&Paste' Hint = 'Paste|Inserts Clipboard contents' ImageIndex = 2 ShortCut = 16470 end - object EditSelectAll1: TEditSelectAll + object ActionEditSelectAll: TEditSelectAll Category = 'Edit' Caption = 'Select &All' Hint = 'Select All|Selects the entire document' ShortCut = 16449 end - object EditUndo1: TEditUndo + object ActionEditUndo: TEditUndo Category = 'Edit' Caption = '&Undo' Hint = 'Undo|Reverts the last action' ImageIndex = 3 ShortCut = 16474 end - object EditDelete1: TEditDelete + object ActionEditDelete: TEditDelete Category = 'Edit' Caption = '&Delete' Hint = 'Delete|Erases the selection' ImageIndex = 5 ShortCut = 46 end - object DialogFontEdit1: TFontEdit + object ActionDialogFontEdit: TFontEdit Category = 'View' Caption = 'Select &Font...' Dialog.Font.Charset = DEFAULT_CHARSET @@ -416,190 +433,204 @@ object Form1: TForm1 Dialog.Font.Name = 'Tahoma' Dialog.Font.Style = [] Dialog.Options = [fdEffects, fdFixedPitchOnly] - Dialog.OnApply = DialogFontEdit1FontDialogApply Hint = 'Font Select' - BeforeExecute = DialogFontEdit1BeforeExecute + BeforeExecute = ActionDialogFontEditBeforeExecute end - object actGutterLines: TAction + object ActionGutterLines: TAction Category = 'View' AutoCheck = True Caption = 'Gutter Lines' - OnExecute = actGutterLinesExecute + OnExecute = ActionGutterLinesExecute end - object actCPP: TAction + object ActionCPP: TAction Category = 'Highlighter' - Caption = 'C++' - OnExecute = actCPPExecute + Caption = '&C++' + OnExecute = ActionCPPExecute end - object actJavaScript: TAction + object ActionJavaScript: TAction Category = 'Highlighter' - Caption = 'JavaScript' - OnExecute = actJavaScriptExecute + Caption = '&JavaScript' + OnExecute = ActionJavaScriptExecute end - object actPython: TAction + object ActionPython: TAction Category = 'Highlighter' - Caption = 'Python' - OnExecute = actPythonExecute + Caption = 'P&ython' + OnExecute = ActionPythonExecute end - object actCodeFolding: TAction + object ActionCodeFolding: TAction Category = 'View' AutoCheck = True Caption = 'Code Folding' - OnExecute = actCodeFoldingExecute + OnExecute = ActionCodeFoldingExecute end - object actFoldAll: TAction + object ActionFoldAll: TAction Category = 'Fold' Caption = 'All' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnFoldAll: TAction + object ActionUnFoldAll: TAction Category = 'Unfold' Caption = 'All' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actFoldNearest: TAction + object ActionFoldNearest: TAction Category = 'Fold' Caption = 'Nearest' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actFoldRegions: TAction + object ActionFoldRegions: TAction Category = 'Fold' Caption = 'Regions' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actFoldLevel1: TAction + object ActionFoldLevel1: TAction Category = 'Fold' Caption = 'Level 1' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actFoldLevel2: TAction + object ActionFoldLevel2: TAction Category = 'Fold' Caption = 'Level 2' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actFoldLevel3: TAction + object ActionFoldLevel3: TAction Category = 'Fold' Caption = 'Level 3' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnfoldNearest: TAction + object ActionUnfoldNearest: TAction Category = 'Unfold' Caption = 'Nearest' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnfoldRegions: TAction + object ActionUnfoldRegions: TAction Category = 'Unfold' Caption = 'Regions' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnfoldLevel1: TAction + object ActionUnfoldLevel1: TAction Category = 'Unfold' Caption = 'Level 1' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnfoldLevel2: TAction + object ActionUnfoldLevel2: TAction Category = 'Unfold' Caption = 'Level 2' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actUnfoldLevel3: TAction + object ActionUnfoldLevel3: TAction Category = 'Unfold' Caption = 'Level 3' - OnExecute = actFoldExecute - OnUpdate = actFoldUpdate + OnExecute = ActionFoldExecute + OnUpdate = ActionFoldUpdate end - object actShowCollapsedMarks: TAction + object ActionDWS: TAction + Category = 'Highlighter' + Caption = '&DelphiWebScript' + OnExecute = ActionDWSExecute + end + object ActionShowCollapsedMarks: TAction Category = 'Folding Options' AutoCheck = True Caption = 'Collapsed Marks' Checked = True - OnExecute = actShowCollapsedMarksExecute + OnExecute = ActionShowCollapsedMarksExecute end - object actFoldShapeSize: TAction + object ActionFoldShapeSize: TAction Category = 'Folding Options' Caption = 'Gutter Square Size..' - OnExecute = actFoldShapeSizeExecute + OnExecute = ActionFoldShapeSizeExecute + end + object ActionPascal: TAction + Category = 'Highlighter' + Caption = '&Pascal' + OnExecute = ActionPascalExecute + end + object ActionXML: TAction + Category = 'Highlighter' + Caption = '&XML' + OnExecute = ActionXMLExecute end end - object PopupActionBar1: TPopupActionBar - Left = 528 + object PopupActionBar: TPopupActionBar + Left = 532 Top = 32 object N1: TMenuItem Caption = '-' end - object Cut1: TMenuItem - Action = EditCut1 + object MenuItemCut: TMenuItem + Action = ActionEditCut end - object Copy1: TMenuItem - Action = EditCopy1 + object MenuItemCopy: TMenuItem + Action = ActionEditCopy end - object Paste1: TMenuItem - Action = EditPaste1 + object MenuItemPaste: TMenuItem + Action = ActionEditPaste end object N2: TMenuItem Caption = '-' end - object Fold1: TMenuItem + object MenuItemFold: TMenuItem Caption = 'Fold' - object All1: TMenuItem - Action = actFoldAll + object MenuItemFoldAll: TMenuItem + Action = ActionFoldAll end - object Nearest1: TMenuItem - Action = actFoldNearest + object MenuItemFoldNearest: TMenuItem + Action = ActionFoldNearest end - object Ranges1: TMenuItem - Action = actFoldRegions + object MenuItemFoldRanges: TMenuItem + Action = ActionFoldRegions end object N3: TMenuItem Caption = '-' end - object Level11: TMenuItem - Action = actFoldLevel1 + object MenuItemFoldLevel1: TMenuItem + Action = ActionFoldLevel1 end - object Level21: TMenuItem - Action = actFoldLevel2 + object MenuItemFoldLevel2: TMenuItem + Action = ActionFoldLevel2 end - object Level31: TMenuItem - Action = actFoldLevel3 + object MenuItemFoldLevel3: TMenuItem + Action = ActionFoldLevel3 end end - object Unfold1: TMenuItem + object MenuItemUnfold: TMenuItem Caption = 'Unfold' - object All2: TMenuItem - Action = actUnFoldAll + object MenuItemUnfoldAll: TMenuItem + Action = ActionUnFoldAll end - object Nearest2: TMenuItem - Action = actUnfoldNearest + object MenuItemUnfoldNearest: TMenuItem + Action = ActionUnfoldNearest end - object Ranges2: TMenuItem - Action = actUnfoldRegions + object MenuItemUnfoldRanges: TMenuItem + Action = ActionUnfoldRegions end object N4: TMenuItem Caption = '-' end - object Level12: TMenuItem - Action = actUnfoldLevel1 + object MenuItemUnfoldLevel1: TMenuItem + Action = ActionUnfoldLevel1 end - object Level22: TMenuItem - Action = actUnfoldLevel2 + object MenuItemUnfoldLevel2: TMenuItem + Action = ActionUnfoldLevel2 end - object Level32: TMenuItem - Action = actUnfoldLevel3 + object MenuItemUnfoldLevel3: TMenuItem + Action = ActionUnfoldLevel3 end end end - object SynEditPrint1: TSynEditPrint + object SynEditPrint: TSynEditPrint Copies = 1 Header.DefaultFont.Charset = DEFAULT_CHARSET Header.DefaultFont.Color = clBlack @@ -628,33 +659,56 @@ object Form1: TForm1 Font.Style = [] TabWidth = 8 Color = clWhite - Left = 472 + Left = 440 Top = 176 end - object SynCppSyn1: TSynCppSyn + object SynCppSyn: TSynCppSyn Options.AutoDetectEnabled = False Options.AutoDetectLineLimit = 0 Options.Visible = False - Left = 524 + Left = 532 Top = 80 end - object SynJScriptSyn1: TSynJScriptSyn + object SynJScriptSyn: TSynJScriptSyn Options.AutoDetectEnabled = False Options.AutoDetectLineLimit = 0 Options.Visible = False - Left = 472 + Left = 440 Top = 80 end - object SynPythonSyn1: TSynPythonSyn + object SynPythonSyn: TSynPythonSyn Options.AutoDetectEnabled = False Options.AutoDetectLineLimit = 0 Options.Visible = False - Left = 480 + Left = 440 Top = 128 end - object SynEditPythonBehaviour1: TSynEditPythonBehaviour - Editor = SynEdit1 - Left = 536 + object PythonBehaviour: TSynEditPythonBehaviour + Editor = SynEdit + Left = 532 Top = 128 end + object SynDWSSyn: TSynDWSSyn + DefaultFilter = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc' + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + Left = 532 + Top = 176 + end + object SynPasSyn: TSynPasSyn + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + Left = 440 + Top = 232 + end + object SynXMLSyn: TSynXMLSyn + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + WantBracesParsed = False + Left = 532 + Top = 232 + end end diff --git a/Source/VCL/SynEdit/Demos/Folding/Unit1.pas b/Source/VCL/SynEdit/Demos/Folding/Unit1.pas index 34b51636..331a60f0 100644 --- a/Source/VCL/SynEdit/Demos/Folding/Unit1.pas +++ b/Source/VCL/SynEdit/Demos/Folding/Unit1.pas @@ -3,260 +3,286 @@ interface uses - Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SynEdit, Vcl.Menus, Vcl.StdActns, - Vcl.ActnList, System.Actions, Vcl.ActnPopup, Vcl.ToolWin, Vcl.ActnMan, - Vcl.ActnCtrls, Vcl.ActnMenus, Vcl.PlatformDefaultStyleActnCtrls, SynEditPrint, - SynEditPythonBehaviour, SynHighlighterPython, SynHighlighterJScript, - SynEditHighlighter, SynHighlighterCpp, SynEditCodeFolding; + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, + Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SynEdit, Vcl.Menus, + Vcl.StdActns, Vcl.ActnList, System.Actions, Vcl.ActnPopup, Vcl.ToolWin, + Vcl.ActnMan, Vcl.ActnCtrls, Vcl.ActnMenus, Vcl.PlatformDefaultStyleActnCtrls, + SynEditPrint, SynEditPythonBehaviour, SynHighlighterPython, + SynEditCodeFolding, SynHighlighterJScript, SynEditHighlighter, + SynHighlighterCpp, SynHighlighterDWS, SynHighlighterPas, SynHighlighterXML; type - TForm1 = class(TForm) - ActionManager1: TActionManager; - ActionMainMenuBar1: TActionMainMenuBar; - PopupActionBar1: TPopupActionBar; - FileOpen1: TFileOpen; - FileSaveAs1: TFileSaveAs; - FilePrintSetup1: TFilePrintSetup; - FilePageSetup1: TFilePageSetup; - FileExit1: TFileExit; - DialogPrintDlg1: TPrintDlg; - EditCut1: TEditCut; - EditCopy1: TEditCopy; - EditPaste1: TEditPaste; - EditSelectAll1: TEditSelectAll; - EditUndo1: TEditUndo; - EditDelete1: TEditDelete; - Cut1: TMenuItem; - Copy1: TMenuItem; - Paste1: TMenuItem; - SynEdit1: TSynEdit; - DialogFontEdit1: TFontEdit; - ActSave: TAction; - SynEditPrint1: TSynEditPrint; - actGutterLines: TAction; - SynCppSyn1: TSynCppSyn; - SynJScriptSyn1: TSynJScriptSyn; - SynPythonSyn1: TSynPythonSyn; - SynEditPythonBehaviour1: TSynEditPythonBehaviour; - actCPP: TAction; - actJavaScript: TAction; - actPython: TAction; - actCodeFolding: TAction; - actFoldAll: TAction; - actUnFoldAll: TAction; - actFoldNearest: TAction; - actFoldRegions: TAction; - actFoldLevel1: TAction; - actFoldLevel2: TAction; - actFoldLevel3: TAction; - actUnfoldNearest: TAction; - actUnfoldRegions: TAction; - actUnfoldLevel1: TAction; - actUnfoldLevel2: TAction; - actUnfoldLevel3: TAction; + TFormFoldingDemo = class(TForm) + ActionCodeFolding: TAction; + ActionCPP: TAction; + ActionDialogFontEdit: TFontEdit; + ActionDialogPrintDlg: TPrintDlg; + ActionDWS: TAction; + ActionEditCopy: TEditCopy; + ActionEditCut: TEditCut; + ActionEditDelete: TEditDelete; + ActionEditPaste: TEditPaste; + ActionEditSelectAll: TEditSelectAll; + ActionEditUndo: TEditUndo; + ActionFileExit: TFileExit; + ActionFileOpen: TFileOpen; + ActionFilePageSetup: TFilePageSetup; + ActionFilePrintSetup: TFilePrintSetup; + ActionFileSaveAs: TFileSaveAs; + ActionFoldAll: TAction; + ActionFoldLevel1: TAction; + ActionFoldLevel2: TAction; + ActionFoldLevel3: TAction; + ActionFoldNearest: TAction; + ActionFoldRegions: TAction; + ActionFoldShapeSize: TAction; + ActionGutterLines: TAction; + ActionJavaScript: TAction; + ActionMainMenuBar: TActionMainMenuBar; + ActionManager: TActionManager; + ActionPascal: TAction; + ActionPython: TAction; + ActionSave: TAction; + ActionShowCollapsedLines: TAction; + ActionShowCollapsedMarks: TAction; + ActionUnFoldAll: TAction; + ActionUnfoldLevel1: TAction; + ActionUnfoldLevel2: TAction; + ActionUnfoldLevel3: TAction; + ActionUnfoldNearest: TAction; + ActionUnfoldRegions: TAction; + ActionXML: TAction; + MenuItemCopy: TMenuItem; + MenuItemCut: TMenuItem; + MenuItemFold: TMenuItem; + MenuItemFoldAll: TMenuItem; + MenuItemFoldLevel1: TMenuItem; + MenuItemFoldLevel2: TMenuItem; + MenuItemFoldLevel3: TMenuItem; + MenuItemFoldNearest: TMenuItem; + MenuItemFoldRanges: TMenuItem; + MenuItemPaste: TMenuItem; + MenuItemUnfold: TMenuItem; + MenuItemUnfoldAll: TMenuItem; + MenuItemUnfoldLevel1: TMenuItem; + MenuItemUnfoldLevel2: TMenuItem; + MenuItemUnfoldLevel3: TMenuItem; + MenuItemUnfoldNearest: TMenuItem; + MenuItemUnfoldRanges: TMenuItem; N1: TMenuItem; N2: TMenuItem; - Fold1: TMenuItem; - All1: TMenuItem; - Nearest1: TMenuItem; - Ranges1: TMenuItem; N3: TMenuItem; - Level11: TMenuItem; - Level21: TMenuItem; - Level31: TMenuItem; - Unfold1: TMenuItem; - All2: TMenuItem; - Nearest2: TMenuItem; - Ranges2: TMenuItem; N4: TMenuItem; - Level12: TMenuItem; - Level22: TMenuItem; - Level32: TMenuItem; - actShowCollapsedMarks: TAction; - actShowCollapsedLines: TAction; - actFoldShapeSize: TAction; - procedure FileOpen1Accept(Sender: TObject); - procedure FileSaveAs1Accept(Sender: TObject); - procedure ActSaveExecute(Sender: TObject); - procedure DialogPrintDlg1Accept(Sender: TObject); - procedure DialogFontEdit1FontDialogApply(Sender: TObject; Wnd: HWND); - procedure actGutterLinesExecute(Sender: TObject); - procedure actCPPExecute(Sender: TObject); - procedure actJavaScriptExecute(Sender: TObject); - procedure actPythonExecute(Sender: TObject); - procedure actCodeFoldingExecute(Sender: TObject); + PopupActionBar: TPopupActionBar; + PythonBehaviour: TSynEditPythonBehaviour; + SynCppSyn: TSynCppSyn; + SynDWSSyn: TSynDWSSyn; + SynEdit: TSynEdit; + SynEditPrint: TSynEditPrint; + SynJScriptSyn: TSynJScriptSyn; + SynPasSyn: TSynPasSyn; + SynPythonSyn: TSynPythonSyn; + SynXMLSyn: TSynXMLSyn; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); + procedure ActionCodeFoldingExecute(Sender: TObject); + procedure ActionCPPExecute(Sender: TObject); + procedure ActionDialogFontEditBeforeExecute(Sender: TObject); + procedure ActionDialogPrintDlgAccept(Sender: TObject); + procedure ActionDWSExecute(Sender: TObject); + procedure ActionFileOpenAccept(Sender: TObject); + procedure ActionFileSaveAsAccept(Sender: TObject); + procedure ActionFoldExecute(Sender: TObject); + procedure ActionFoldShapeSizeExecute(Sender: TObject); + procedure ActionFoldUpdate(Sender: TObject); + procedure ActionGutterLinesExecute(Sender: TObject); + procedure ActionJavaScriptExecute(Sender: TObject); + procedure ActionManagerUpdate(Action: TBasicAction; var Handled: Boolean); + procedure ActionPascalExecute(Sender: TObject); + procedure ActionPythonExecute(Sender: TObject); + procedure ActionSaveExecute(Sender: TObject); + procedure ActionShowCollapsedLinesExecute(Sender: TObject); + procedure ActionShowCollapsedMarksExecute(Sender: TObject); + procedure ActionXMLExecute(Sender: TObject); + procedure SynEditGutterGetText(Sender: TObject; aLine: Integer; + var aText: string); procedure ScanForFoldRanges(Sender: TObject; TopFoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); - procedure DialogFontEdit1BeforeExecute(Sender: TObject); - procedure actFoldExecute(Sender: TObject); - procedure actFoldUpdate(Sender: TObject); - procedure ActionManager1Update(Action: TBasicAction; var Handled: Boolean); - procedure actShowCollapsedLinesExecute(Sender: TObject); - procedure actShowCollapsedMarksExecute(Sender: TObject); - procedure actFoldShapeSizeExecute(Sender: TObject); + procedure SynEditStatusChange(Sender: TObject; Changes: TSynStatusChanges); private - { Private declarations } - Highlighters : TStringList; + FHighlighters: TStringList; + FOldCaretY: Integer; public - { Public declarations } - FileName : String; + FileName: string; end; var - Form1: TForm1; + FormFoldingDemo: TFormFoldingDemo; implementation uses SynEditTextBuffer, SynEditTypes, - uHighlighterProcs, SynEditKeyCmds; + SynEditKeyCmds, + uHighlighterProcs; {$R *.dfm} -procedure TForm1.actCodeFoldingExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionCodeFoldingExecute(Sender: TObject); begin - SynEdit1.UseCodeFolding := actCodeFolding.Checked; + SynEdit.UseCodeFolding := ActionCodeFolding.Checked; end; -procedure TForm1.actCPPExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionCPPExecute(Sender: TObject); begin - SynEditPythonBehaviour1.Editor := nil; - SynEdit1.OnScanForFoldRanges := ScanForFoldRanges; - SynEdit1.Highlighter := SynCppSyn1; + PythonBehaviour.Editor := nil; + SynEdit.OnScanForFoldRanges := ScanForFoldRanges; + SynEdit.Highlighter := SynCppSyn; end; -procedure TForm1.actFoldExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionDWSExecute(Sender: TObject); begin - SynEdit1.ExecuteCommand(TAction(Sender).Tag, ' ', nil); + PythonBehaviour.Editor := nil; + SynEdit.OnScanForFoldRanges := nil; + SynEdit.Highlighter := SynDwsSyn; end; -procedure TForm1.actFoldShapeSizeExecute(Sender: TObject); -Var - S : String; +procedure TFormFoldingDemo.ActionFoldExecute(Sender: TObject); +begin + SynEdit.ExecuteCommand(TAction(Sender).Tag, ' ', nil); +end; + +procedure TFormFoldingDemo.ActionFoldShapeSizeExecute(Sender: TObject); +var + S: string; Size : Integer; begin - Size := SynEdit1.CodeFolding.GutterShapeSize; + Size := SynEdit.CodeFolding.GutterShapeSize; S := InputBox('New Gutter Square Size', 'New size in pixels (odd number):', IntToStr(Size)); if TryStrToInt(S, Size) then - SynEdit1.CodeFolding.GutterShapeSize := Size; + SynEdit.CodeFolding.GutterShapeSize := Size; end; -procedure TForm1.actFoldUpdate(Sender: TObject); +procedure TFormFoldingDemo.ActionFoldUpdate(Sender: TObject); begin - TAction(Sender).Enabled := SynEdit1.UseCodeFolding; + TAction(Sender).Enabled := SynEdit.UseCodeFolding; end; -procedure TForm1.actGutterLinesExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionGutterLinesExecute(Sender: TObject); begin - Synedit1.Gutter.ShowLineNumbers := actGutterLines.Checked; + SynEdit.Gutter.ShowLineNumbers := ActionGutterLines.Checked; end; -procedure TForm1.ActionManager1Update(Action: TBasicAction; +procedure TFormFoldingDemo.ActionManagerUpdate(Action: TBasicAction; var Handled: Boolean); begin - actCodeFolding.Checked := SynEdit1.UseCodeFolding; - actShowCollapsedMarks.Checked := SynEdit1.CodeFolding.ShowCollapsedLine; - actShowCollapsedMarks.Checked := SynEdit1.CodeFolding.ShowHintMark; + ActionCodeFolding.Checked := SynEdit.UseCodeFolding; + ActionShowCollapsedMarks.Checked := SynEdit.CodeFolding.ShowCollapsedLine; + ActionShowCollapsedMarks.Checked := SynEdit.CodeFolding.ShowHintMark; end; -procedure TForm1.actJavaScriptExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionXMLExecute(Sender: TObject); begin - SynEditPythonBehaviour1.Editor := nil; - SynEdit1.OnScanForFoldRanges := nil; - SynEdit1.Highlighter := SynJScriptSyn1; + PythonBehaviour.Editor := nil; + SynEdit.OnScanForFoldRanges := nil; + SynEdit.Highlighter := SynXMLSyn; end; -procedure TForm1.actPythonExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionJavaScriptExecute(Sender: TObject); begin - SynEditPythonBehaviour1.Editor := Synedit1; - SynEditPythonBehaviour1.Editor := nil; - SynEdit1.Highlighter := SynPythonSyn1; + PythonBehaviour.Editor := nil; + SynEdit.OnScanForFoldRanges := nil; + SynEdit.Highlighter := SynJScriptSyn; end; -procedure TForm1.ActSaveExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionPythonExecute(Sender: TObject); begin - if FileName = '' then - FileSaveAs1.Execute - else - SynEdit1.Lines.SaveToFile(FileName); + PythonBehaviour.Editor := SynEdit; + PythonBehaviour.Editor := nil; + SynEdit.Highlighter := SynPythonSyn; end; -procedure TForm1.actShowCollapsedLinesExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionSaveExecute(Sender: TObject); begin - SynEdit1.CodeFolding.ShowCollapsedLine := TAction(Sender).Checked; + if FileName = '' then + ActionFileSaveAs.Execute + else + SynEdit.Lines.SaveToFile(FileName); end; -procedure TForm1.DialogFontEdit1BeforeExecute(Sender: TObject); +procedure TFormFoldingDemo.ActionShowCollapsedLinesExecute(Sender: TObject); begin - DialogFontEdit1.Dialog.Font := SynEdit1.Font; + SynEdit.CodeFolding.ShowCollapsedLine := TAction(Sender).Checked; end; -procedure TForm1.DialogFontEdit1FontDialogApply(Sender: TObject; Wnd: HWND); +procedure TFormFoldingDemo.ActionDialogFontEditBeforeExecute(Sender: TObject); begin - SynEdit1.Font.Assign(DialogFontEdit1.Dialog.Font); + ActionDialogFontEdit.Dialog.Font := SynEdit.Font; end; -procedure TForm1.DialogPrintDlg1Accept(Sender: TObject); +procedure TFormFoldingDemo.ActionDialogPrintDlgAccept(Sender: TObject); begin - SynEditPrint1.SynEdit := SynEdit1; - SynEditPrint1.Print; + SynEditPrint.SynEdit := SynEdit; + SynEditPrint.Print; end; -procedure TForm1.FileOpen1Accept(Sender: TObject); +procedure TFormFoldingDemo.ActionFileOpenAccept(Sender: TObject); begin - FileName := FileOpen1.Dialog.FileName; - SynEdit1.Lines.LoadFromFile(FileName); - SynEdit1.Highlighter := GetHighlighterFromFileExt(Highlighters, ExtractFileExt(FileName)); - if SynEdit1.Highlighter = SynPythonSyn1 then - SynEditPythonBehaviour1.Editor := SynEdit1 + FileName := ActionFileOpen.Dialog.FileName; + SynEdit.Lines.LoadFromFile(FileName); + SynEdit.Highlighter := GetHighlighterFromFileExt(FHighlighters, ExtractFileExt(FileName)); + if SynEdit.Highlighter = SynPythonSyn then + PythonBehaviour.Editor := SynEdit else - SynEditPythonBehaviour1.Editor := nil; - if SynEdit1.Highlighter = SynCppSyn1 then - SynEdit1.OnScanForFoldRanges := ScanForFoldRanges + PythonBehaviour.Editor := nil; + if SynEdit.Highlighter = SynCppSyn then + SynEdit.OnScanForFoldRanges := ScanForFoldRanges else - SynEdit1.OnScanForFoldRanges := nil; - SynEdit1.UseCodeFolding := actCodeFolding.Checked; + SynEdit.OnScanForFoldRanges := nil; + SynEdit.UseCodeFolding := ActionCodeFolding.Checked; + + if (SynEdit.Highlighter = SynPythonSyn) or (SynEdit.Highlighter = SynCppSyn) then + SynEdit.TabWidth := 4 + else + SynEdit.TabWidth := 2; end; -procedure TForm1.FileSaveAs1Accept(Sender: TObject); +procedure TFormFoldingDemo.ActionFileSaveAsAccept(Sender: TObject); begin - FileName := FileSaveAs1.Dialog.FileName; - SynEdit1.Lines.SaveToFile(FileName); + FileName := ActionFileSaveAs.Dialog.FileName; + SynEdit.Lines.SaveToFile(FileName); end; -procedure TForm1.FormCreate(Sender: TObject); +procedure TFormFoldingDemo.FormCreate(Sender: TObject); begin - Highlighters := TStringList.Create; - GetHighlighters(Self, Highlighters, False); - FileOpen1.Dialog.Filter := GetHighlightersFilter(Highlighters); - FileOpen1.Dialog.InitialDir := ExtractFilePath(Application.ExeName); - FileSaveAs1.Dialog.Filter := FileOpen1.Dialog.Filter; - - actFoldAll.Tag := ecFoldAll; - actFoldNearest.Tag := ecFoldNearest; - actFoldRegions.Tag := ecFoldRegions; - actFoldLevel1.Tag := ecFoldLevel1; - actFoldLevel2.Tag := ecFoldLevel2; - actFoldLevel3.Tag := ecFoldLevel3; - actUnFoldAll.Tag := ecUnfoldAll; - actUnfoldNearest.Tag := ecUnfoldNearest; - actUnfoldRegions.Tag := ecUnfoldRegions; - actUnfoldLevel1.Tag := ecUnfoldLevel1; - actUnfoldLevel2.Tag := ecUnfoldLevel2; - actUnfoldLevel3.Tag := ecUnfoldLevel3; + FHighlighters := TStringList.Create; + GetHighlighters(Self, FHighlighters, False); + ActionFileOpen.Dialog.Filter := GetHighlightersFilter(FHighlighters); + ActionFileOpen.Dialog.InitialDir := ExtractFilePath(Application.ExeName); + ActionFileSaveAs.Dialog.Filter := ActionFileOpen.Dialog.Filter; + + ActionFoldAll.Tag := ecFoldAll; + ActionFoldNearest.Tag := ecFoldNearest; + ActionFoldRegions.Tag := ecFoldRegions; + ActionFoldLevel1.Tag := ecFoldLevel1; + ActionFoldLevel2.Tag := ecFoldLevel2; + ActionFoldLevel3.Tag := ecFoldLevel3; + ActionUnFoldAll.Tag := ecUnfoldAll; + ActionUnfoldNearest.Tag := ecUnfoldNearest; + ActionUnfoldRegions.Tag := ecUnfoldRegions; + ActionUnfoldLevel1.Tag := ecUnfoldLevel1; + ActionUnfoldLevel2.Tag := ecUnfoldLevel2; + ActionUnfoldLevel3.Tag := ecUnfoldLevel3; end; -procedure TForm1.FormDestroy(Sender: TObject); +procedure TFormFoldingDemo.FormDestroy(Sender: TObject); begin - Highlighters.Free; + FHighlighters.Free; end; -procedure TForm1.ScanForFoldRanges(Sender: TObject; +procedure TFormFoldingDemo.ScanForFoldRanges(Sender: TObject; TopFoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine, ToLine: Integer); var @@ -268,8 +294,8 @@ procedure TForm1.ScanForFoldRanges(Sender: TObject; Token : string; Attr : TSynHighlighterAttributes; begin - Result := SynEdit1.GetHighlighterAttriAtRowCol(BufferCoord(Col, Line + 1), Token, Attr) and - (Attr = SynCppSyn1.CommentAttribute); + Result := SynEdit.GetHighlighterAttriAtRowCol(BufferCoord(Col, Line + 1), Token, Attr) and + (Attr = SynCppSyn.CommentAttribute); end; function LineHasChar(Line: Integer; character: char; @@ -290,7 +316,7 @@ procedure TForm1.ScanForFoldRanges(Sender: TObject; end; function FindBraces(Line: Integer) : Boolean; - Var + var Col : Integer; begin Result := False; @@ -328,23 +354,23 @@ procedure TForm1.ScanForFoldRanges(Sender: TObject; end; // for Col end; -function FoldRegion(Line: Integer): Boolean; -Var - S : string; -begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 14)) = '#PRAGMA REGION' then - begin - TopFoldRanges.StartFoldRange(Line + 1, FoldRegionType); - Result := True; - end - else if Uppercase(Copy(S, 1, 17)) = '#PRAGMA ENDREGION' then + function FoldRegion(Line: Integer): Boolean; + var + S : string; begin - TopFoldRanges.StopFoldRange(Line + 1, FoldRegionType); - Result := True; + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 14)) = '#PRAGMA REGION' then + begin + TopFoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 17)) = '#PRAGMA ENDREGION' then + begin + TopFoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; end; -end; begin for Line := FromLine to ToLine do @@ -382,9 +408,44 @@ function FoldRegion(Line: Integer): Boolean; end; // while Line end; -procedure TForm1.actShowCollapsedMarksExecute(Sender: TObject); +procedure TFormFoldingDemo.SynEditGutterGetText(Sender: TObject; aLine: Integer; + var aText: string); +begin + if aLine = TSynEdit(Sender).CaretY then + Exit; + + if aLine mod 10 <> 0 then + if aLine mod 5 <> 0 then + aText := '·' + else + aText := '-'; +end; + +procedure TFormFoldingDemo.SynEditStatusChange(Sender: TObject; + Changes: TSynStatusChanges); +Var + NewCaretY: Integer; +begin + if (scCaretY in Changes) and SynEdit.Gutter.Visible + and SynEdit.Gutter.ShowLineNumbers then + begin + NewCaretY := SynEdit.CaretY; + SynEdit.InvalidateGutterLine(FOldCaretY); + SynEdit.InvalidateGutterLine(NewCaretY); + FOldCaretY := NewCaretY; + end; +end; + +procedure TFormFoldingDemo.ActionShowCollapsedMarksExecute(Sender: TObject); +begin + SynEdit.CodeFolding.ShowHintMark := TAction(Sender).Checked; +end; + +procedure TFormFoldingDemo.ActionPascalExecute(Sender: TObject); begin - SynEdit1.CodeFolding.ShowHintMark := TAction(Sender).Checked; + PythonBehaviour.Editor := nil; + SynEdit.OnScanForFoldRanges := nil; + SynEdit.Highlighter := SynPasSyn; end; end. diff --git a/Source/VCL/SynEdit/Demos/Folding/demo.pas b/Source/VCL/SynEdit/Demos/Folding/demo.pas new file mode 100644 index 00000000..71237743 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/Folding/demo.pas @@ -0,0 +1,421 @@ +unit Unit1; +(* + Unit documentation +*) + + +interface +{$REGION interface} +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, + Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SynEdit, Vcl.Menus, + Vcl.StdActns, Vcl.ActnList, System.Actions, Vcl.ActnPopup, Vcl.ToolWin, +{$IFDEF CPPU64} + Vcl.ActnMan, Vcl.ActnCtrls, Vcl.ActnMenus, Vcl.PlatformDefaultStyleActnCtrls, + SynEditPrint, SynEditPythonBehaviour, SynHighlighterPython, +{$ENDIF CPPU64} + SynEditCodeFolding, SynHighlighterJScript, SynEditHighlighter, + SynHighlighterCpp, SynHighlighterDWS; + +type + + TPerson = record + Name: string; + SurName: string; + end; + + TForm1 = class(TForm) + ActionManager1: TActionManager; + ActionMainMenuBar1: TActionMainMenuBar; + PopupActionBar1: TPopupActionBar; + FileOpen1: TFileOpen; + FileSaveAs1: TFileSaveAs; + FilePrintSetup1: TFilePrintSetup; + FilePageSetup1: TFilePageSetup; + FileExit1: TFileExit; + DialogPrintDlg1: TPrintDlg; + EditCut1: TEditCut; + EditCopy1: TEditCopy; + EditPaste1: TEditPaste; + EditSelectAll1: TEditSelectAll; + EditUndo1: TEditUndo; + EditDelete1: TEditDelete; + Cut1: TMenuItem; + Copy1: TMenuItem; + Paste1: TMenuItem; + SynEdit1: TSynEdit; + DialogFontEdit1: TFontEdit; + ActSave: TAction; + SynEditPrint1: TSynEditPrint; + actGutterLines: TAction; + SynCppSyn1: TSynCppSyn; + SynJScriptSyn1: TSynJScriptSyn; + SynPythonSyn1: TSynPythonSyn; + PythonBehaviour: TSynEditPythonBehaviour; + actCPP: TAction; + actJavaScript: TAction; + actPython: TAction; + actCodeFolding: TAction; + actFoldAll: TAction; + actUnFoldAll: TAction; + actFoldNearest: TAction; + actFoldRegions: TAction; + actFoldLevel1: TAction; + actFoldLevel2: TAction; + actFoldLevel3: TAction; + actUnfoldNearest: TAction; + actUnfoldRegions: TAction; + actUnfoldLevel1: TAction; + actUnfoldLevel2: TAction; + actUnfoldLevel3: TAction; + N1: TMenuItem; + N2: TMenuItem; + Fold1: TMenuItem; + All1: TMenuItem; + Nearest1: TMenuItem; + Ranges1: TMenuItem; + N3: TMenuItem; + Level11: TMenuItem; + Level21: TMenuItem; + Level31: TMenuItem; + Unfold1: TMenuItem; + All2: TMenuItem; + Nearest2: TMenuItem; + Ranges2: TMenuItem; + N4: TMenuItem; + Level12: TMenuItem; + Level22: TMenuItem; + Level32: TMenuItem; + actShowCollapsedMarks: TAction; + actShowCollapsedLines: TAction; + actFoldShapeSize: TAction; + SynDWSSyn1: TSynDWSSyn; + actDWS: TAction; + procedure FileOpen1Accept(Sender: TObject); + procedure FileSaveAs1Accept(Sender: TObject); + procedure ActSaveExecute(Sender: TObject); + procedure DialogPrintDlg1Accept(Sender: TObject); + procedure actGutterLinesExecute(Sender: TObject); + procedure actCPPExecute(Sender: TObject); + procedure actJavaScriptExecute(Sender: TObject); + procedure actPythonExecute(Sender: TObject); + procedure actCodeFoldingExecute(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure ScanForFoldRanges(Sender: TObject; TopFoldRanges: + TSynFoldRanges; LinesToScan: TStrings; FromLine: Integer; + ToLine: Integer); + procedure DialogFontEdit1BeforeExecute(Sender: TObject); + procedure actFoldExecute(Sender: TObject); + procedure actFoldUpdate(Sender: TObject); + procedure ActionManager1Update(Action: TBasicAction; var Handled: Boolean); + procedure actShowCollapsedLinesExecute(Sender: TObject); + procedure actShowCollapsedMarksExecute(Sender: TObject); + procedure actFoldShapeSizeExecute(Sender: TObject); + procedure actDWSExecute(Sender: TObject); + private + { Private declarations } + Highlighters : TStringList; + public + { Public declarations } + FileName : String; + end; + +var + Form1: TForm1; +{$ENDREGION interface} +implementation + +uses + SynEditTextBuffer, + SynEditTypes, + uHighlighterProcs, SynEditKeyCmds; + +{$R *.dfm} + +function CountBits(const AValue: Longword): Byte; +asm + mov ecx, eax + xor al, al + test ecx, ecx + jz @@ending + @@counting: + shr ecx, 1 + adc al, 0 + test ecx, ecx + jnz @@counting + @@ending: +end; + +procedure TForm1.actCodeFoldingExecute(Sender: TObject); +begin + SynEdit1.UseCodeFolding := actCodeFolding.Checked; +end; + +procedure TForm1.actCPPExecute(Sender: TObject); +begin + PythonBehaviour.Editor := nil; + SynEdit1.OnScanForFoldRanges := ScanForFoldRanges; + SynEdit1.Highlighter := SynCppSyn1; +end; + +procedure TForm1.actDWSExecute(Sender: TObject); +begin + PythonBehaviour.Editor := nil; + SynEdit1.OnScanForFoldRanges := nil; + SynEdit1.Highlighter := SynDwsSyn1; +end; + +procedure TForm1.actFoldExecute(Sender: TObject); +begin + SynEdit1.ExecuteCommand(TAction(Sender).Tag, ' ', nil); +end; + +procedure TForm1.actFoldShapeSizeExecute(Sender: TObject); +var + S : String; + Size : Integer; +begin + Size := SynEdit1.CodeFolding.GutterShapeSize; + S := InputBox('New Gutter Square Size', 'New size in pixels (odd number):', IntToStr(Size)); + if TryStrToInt(S, Size) then + SynEdit1.CodeFolding.GutterShapeSize := Size; +end; + +procedure TForm1.actFoldUpdate(Sender: TObject); +begin + TAction(Sender).Enabled := SynEdit1.UseCodeFolding; +end; + +procedure TForm1.actGutterLinesExecute(Sender: TObject); +begin + Synedit1.Gutter.ShowLineNumbers := actGutterLines.Checked; +end; + +procedure TForm1.ActionManager1Update(Action: TBasicAction; + var Handled: Boolean); +begin + actCodeFolding.Checked := SynEdit1.UseCodeFolding; + actShowCollapsedMarks.Checked := SynEdit1.CodeFolding.ShowCollapsedLine; + actShowCollapsedMarks.Checked := SynEdit1.CodeFolding.ShowHintMark; +end; + +procedure TForm1.actJavaScriptExecute(Sender: TObject); +begin + PythonBehaviour.Editor := nil; + SynEdit1.OnScanForFoldRanges := nil; + SynEdit1.Highlighter := SynJScriptSyn1; +end; + +procedure TForm1.actPythonExecute(Sender: TObject); +begin + PythonBehaviour.Editor := Synedit1; + PythonBehaviour.Editor := nil; + SynEdit1.Highlighter := SynPythonSyn1; +end; + +procedure TForm1.ActSaveExecute(Sender: TObject); +begin + if FileName = '' then + FileSaveAs1.Execute + else + SynEdit1.Lines.SaveToFile(FileName); +end; + +procedure TForm1.actShowCollapsedLinesExecute(Sender: TObject); +begin + SynEdit1.CodeFolding.ShowCollapsedLine := TAction(Sender).Checked; +end; + +procedure TForm1.DialogFontEdit1BeforeExecute(Sender: TObject); +begin + DialogFontEdit1.Dialog.Font := SynEdit1.Font; +end; + +procedure TForm1.DialogPrintDlg1Accept(Sender: TObject); +begin + SynEditPrint1.SynEdit := SynEdit1; + SynEditPrint1.Print; +end; + +procedure TForm1.FileOpen1Accept(Sender: TObject); +begin + FileName := FileOpen1.Dialog.FileName; + SynEdit1.Lines.LoadFromFile(FileName); + SynEdit1.Highlighter := GetHighlighterFromFileExt(Highlighters, ExtractFileExt(FileName)); + if SynEdit1.Highlighter = SynPythonSyn1 then + PythonBehaviour.Editor := SynEdit1 + else + PythonBehaviour.Editor := nil; + if SynEdit1.Highlighter = SynCppSyn1 then + SynEdit1.OnScanForFoldRanges := ScanForFoldRanges + else + SynEdit1.OnScanForFoldRanges := nil; + SynEdit1.UseCodeFolding := actCodeFolding.Checked; +end; + +procedure TForm1.FileSaveAs1Accept(Sender: TObject); +begin + FileName := FileSaveAs1.Dialog.FileName; + SynEdit1.Lines.SaveToFile(FileName); +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Highlighters := TStringList.Create; + GetHighlighters(Self, Highlighters, False); + FileOpen1.Dialog.Filter := GetHighlightersFilter(Highlighters); + FileOpen1.Dialog.InitialDir := ExtractFilePath(Application.ExeName); + FileSaveAs1.Dialog.Filter := FileOpen1.Dialog.Filter; + + actFoldAll.Tag := ecFoldAll; + actFoldNearest.Tag := ecFoldNearest; + actFoldRegions.Tag := ecFoldRegions; + actFoldLevel1.Tag := ecFoldLevel1; + actFoldLevel2.Tag := ecFoldLevel2; + actFoldLevel3.Tag := ecFoldLevel3; + actUnFoldAll.Tag := ecUnfoldAll; + actUnfoldNearest.Tag := ecUnfoldNearest; + actUnfoldRegions.Tag := ecUnfoldRegions; + actUnfoldLevel1.Tag := ecUnfoldLevel1; + actUnfoldLevel2.Tag := ecUnfoldLevel2; + actUnfoldLevel3.Tag := ecUnfoldLevel3; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + Highlighters.Free; +end; + +procedure TForm1.ScanForFoldRanges(Sender: TObject; + TopFoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine, + ToLine: Integer); +var + CurLine: String; + Line: Integer; + + function InsideComment(Line : Integer; Col : Integer): Boolean; + var + Token : string; + Attr : TSynHighlighterAttributes; + begin + Result := SynEdit1.GetHighlighterAttriAtRowCol(BufferCoord(Col, Line + 1), Token, Attr) and + (Attr = SynCppSyn1.CommentAttribute); + end; + + function LineHasChar(Line: Integer; character: char; + StartCol : Integer): boolean; // faster than Pos! + var + i: Integer; + begin + result := false; + for I := StartCol to Length(CurLine) do begin + if CurLine[i] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if not InsideComment(Line, I) then begin + result := true; + break; + end; + end; + end; + end; + + function FindBraces(Line: Integer) : Boolean; + var + Col : Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if not InsideComment(Line, Col) then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + TopFoldRanges.StartFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + break; + end; + end else if CurLine[col] = '}' then + begin + // Char must have symbol attri too + if not InsideComment(Line, Col) then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + TopFoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + break; + end; + end; + end; // for Col + end; + +function FoldRegion(Line: Integer): Boolean; +var + S : string; +begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 14)) = '#PRAGMA REGION' then + begin + TopFoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 17)) = '#PRAGMA ENDREGION' then + begin + TopFoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; +end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline comments (Fold Type 2) + if SynHighlighterCpp.TRangeState(TSynEditStringList(LinesToScan).Ranges[Line]) = + SynHighlighterCpp.rsANSIc + then + begin + if (Line = 0) or (SynHighlighterCpp.TRangeState(TSynEditStringList(LinesToScan).Ranges[Line-1]) <> + SynHighlighterCpp.rsANSIc) + then + TopFoldRanges.StartFoldRange(Line + 1, 2) + else + TopFoldRanges.NoFoldInfo(Line + 1); + Continue; + end + else if (Line > 0) and (SynHighlighterCpp.TRangeState(TSynEditStringList(LinesToScan).Ranges[Line-1]) = + SynHighlighterCpp.rsANSIc) + then + begin + TopFoldRanges.StopFoldRange(Line + 1, 2); + Continue; + end; + + // Find Fold regions + CurLine := LinesToScan[Line]; + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + CurLine := LinesToScan[Line]; + if not FindBraces(Line) then + TopFoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; + +procedure TForm1.actShowCollapsedMarksExecute(Sender: TObject); +begin + SynEdit1.CodeFolding.ShowHintMark := TAction(Sender).Checked; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/Folding/uHighlighterProcs.pas b/Source/VCL/SynEdit/Demos/Folding/uHighlighterProcs.pas deleted file mode 100644 index 145ec1f6..00000000 --- a/Source/VCL/SynEdit/Demos/Folding/uHighlighterProcs.pas +++ /dev/null @@ -1,126 +0,0 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: uHighlighterProcs.pas, released 2000-06-23. - -The Initial Author of the Original Code is Michael Hieke. -All Rights Reserved. - -Contributors to the SynEdit project 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: uHighlighterProcs.pas,v 1.3 2002/06/15 06:57:24 etrusco Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit uHighlighterProcs; - -interface - -uses - Classes, SynEditHighlighter; - -procedure GetHighlighters(AOwner: TComponent; AHighlighters: TStringList; - AppendToList: boolean); -function GetHighlightersFilter(AHighlighters: TStringList): string; -function GetHighlighterFromFileExt(AHighlighters: TStringList; - Extension: string): TSynCustomHighlighter; - -implementation - -uses - SysUtils; - -procedure GetHighlighters(AOwner: TComponent; AHighlighters: TStringList; - AppendToList: boolean); -var - i: integer; - Highlighter: TSynCustomHighlighter; -begin - if Assigned(AOwner) and Assigned(AHighlighters) then begin - if not AppendToList then - AHighlighters.Clear; - for i := AOwner.ComponentCount - 1 downto 0 do begin - if not (AOwner.Components[i] is TSynCustomHighlighter) then - continue; - Highlighter := AOwner.Components[i] as TSynCustomHighlighter; - // only one highlighter for each language - if AHighlighters.IndexOf(Highlighter.GetLanguageName) = -1 then - AHighlighters.AddObject(Highlighter.GetLanguageName, Highlighter); - end; - AHighlighters.Sort; - end; -end; - -function GetHighlightersFilter(AHighlighters: TStringList): string; -var - i: integer; - Highlighter: TSynCustomHighlighter; -begin - Result := ''; - if Assigned(AHighlighters) then - for i := 0 to AHighlighters.Count - 1 do begin - if not (AHighlighters.Objects[i] is TSynCustomHighlighter) then - continue; - Highlighter := TSynCustomHighlighter(AHighlighters.Objects[i]); - if Highlighter.DefaultFilter = '' then - continue; - Result := Result + Highlighter.DefaultFilter; - if Result[Length(Result)] <> '|' then - Result := Result + '|'; - end; -end; - -function GetHighlighterFromFileExt(AHighlighters: TStringList; - Extension: string): TSynCustomHighlighter; -var - ExtLen: integer; - i, j: integer; - Highlighter: TSynCustomHighlighter; - Filter: string; -begin - Extension := LowerCase(Extension); - ExtLen := Length(Extension); - if Assigned(AHighlighters) and (ExtLen > 0) then begin - for i := 0 to AHighlighters.Count - 1 do begin - if not (AHighlighters.Objects[i] is TSynCustomHighlighter) then - continue; - Highlighter := TSynCustomHighlighter(AHighlighters.Objects[i]); - Filter := LowerCase(Highlighter.DefaultFilter); - j := Pos('|', Filter); - if j > 0 then begin - Delete(Filter, 1, j); - j := Pos(Extension, Filter); - if (j > 0) and - ((j + ExtLen > Length(Filter)) or (Filter[j + ExtLen] = ';')) - then begin - Result := Highlighter; - exit; - end; - end; - end; - end; - Result := nil; -end; - -end. diff --git a/Source/VCL/SynEdit/Demos/GutterDemo/GutterDemo.dpr b/Source/VCL/SynEdit/Demos/GutterDemo/GutterDemo.dpr new file mode 100644 index 00000000..b0388688 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/GutterDemo/GutterDemo.dpr @@ -0,0 +1,47 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: HighlighterDemo.dpr, released 2001-08-28. + +The Original Code is part of the HighlighterDemo project, written by Pieter Polak +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: HighlighterDemo.dpr,v 1.2 2004/01/22 03:37:47 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program GutterDemo; + +uses + Forms, + uMain in 'uMain.pas' {FormMain}; + +begin + Application.Initialize; + Application.CreateForm(TFormMain, FormMain); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/GutterDemo/uMain.dfm b/Source/VCL/SynEdit/Demos/GutterDemo/uMain.dfm new file mode 100644 index 00000000..481dfb5c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/GutterDemo/uMain.dfm @@ -0,0 +1,338 @@ +object FormMain: TFormMain + Left = 268 + Top = 107 + Caption = 'Gutter demo' + ClientHeight = 801 + ClientWidth = 916 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + OnCreate = FormCreate + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit: TSynEdit + Left = 0 + Top = 89 + Width = 916 + Height = 712 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clRed + Gutter.Font.Height = -16 + Gutter.Font.Name = 'Comic Sans MS' + Gutter.Font.Style = [fsItalic] + Gutter.ShowLineNumbers = True + Gutter.UseFontStyle = False + Gutter.GradientEndColor = 13883354 + Highlighter = SynDWSSyn + Lines.Strings = ( + '{ Syntax highlighting }' + '' + 'procedure TForm1.Button1Click(Sender: TObject);' + 'var' + ' Number, I, X: Integer;' + 'begin' + ' Number := 123456;' + ' Caption := '#39'The Number is'#39' + #32 + IntToStr(Number);' + ' for I := 0 to Number do' + ' begin' + ' Inc(X);' + ' Dec(X);' + ' X := X + 1.0;' + ' X := X - $5E;' + ' end;' + ' {$R+}' + ' asm' + ' mov AX, 1234H' + ' mov Number, AX' + ' end;' + ' {$R-}' + 'end;') + FontSmoothing = fsmNone + RemovedKeystrokes = < + item + Command = ecCut + ShortCut = 8238 + end + item + Command = ecPaste + ShortCut = 8237 + end + item + Command = ecDeleteChar + ShortCut = 46 + end + item + Command = ecContextHelp + ShortCut = 112 + end + item + Command = ecPaste + ShortCut = 16470 + end + item + Command = ecCut + ShortCut = 16472 + end + item + Command = ecBlockIndent + ShortCut = 24649 + end + item + Command = ecBlockUnindent + ShortCut = 24661 + end + item + Command = ecLineBreak + ShortCut = 16461 + end + item + Command = ecInsertLine + ShortCut = 16462 + end + item + Command = ecDeleteWord + ShortCut = 16468 + end> + AddedKeystrokes = < + item + Command = ecPaste + ShortCut = 8238 + end + item + Command = ecDeleteChar + ShortCut = 8237 + end + item + Command = ecCut + ShortCut = 46 + end + item + Command = ecContextHelp + ShortCut = 16496 + end + item + Command = ecBlockIndent + ShortCut = 16470 + end + item + Command = ecLineBreak + ShortCut = 16472 + end + item + Command = ecInsertLine + ShortCut = 24649 + end + item + Command = ecDeleteWord + ShortCut = 24661 + end + item + Command = ecBlockUnindent + ShortCut = 16461 + end + item + Command = ecPaste + ShortCut = 16462 + end + item + Command = ecCut + ShortCut = 16468 + end> + end + object Panel: TPanel + Left = 0 + Top = 0 + Width = 916 + Height = 89 + Align = alTop + BevelOuter = bvNone + ShowCaption = False + TabOrder = 1 + object ShapeColorBackground: TShape + Left = 464 + Top = 32 + Width = 16 + Height = 16 + Brush.Color = clBtnFace + OnMouseDown = ShapeColorBackgroundMouseDown + end + object LabelColor: TLabel + Left = 393 + Top = 33 + Width = 27 + Height = 13 + Caption = 'Color:' + end + object ShapeColorBorder: TShape + Left = 464 + Top = 55 + Width = 16 + Height = 16 + Brush.Color = clWindow + OnMouseDown = ShapeColorBorderMouseDown + end + object LabelBorderColor: TLabel + Left = 393 + Top = 56 + Width = 61 + Height = 13 + Caption = 'Border Color:' + end + object LabelGradientStart: TLabel + Left = 513 + Top = 32 + Width = 95 + Height = 13 + Caption = 'Gradient Start Color:' + end + object LabelGradientStop: TLabel + Left = 513 + Top = 56 + Width = 95 + Height = 13 + Caption = 'Gradient Stop Color:' + end + object ShapeGradientStopColor: TShape + Left = 614 + Top = 55 + Width = 16 + Height = 16 + Brush.Color = clWindow + OnMouseDown = ShapeGradientStopColorMouseDown + end + object ShapeGradientStartColor: TShape + Left = 614 + Top = 32 + Width = 16 + Height = 16 + Brush.Color = clBtnFace + OnMouseDown = ShapeGradientStartColorMouseDown + end + object CheckBoxShowLineNumbers: TCheckBox + Left = 8 + Top = 32 + Width = 129 + Height = 17 + Caption = 'Show line numbers' + TabOrder = 0 + OnClick = CheckBoxShowLineNumbersClick + end + object CheckBoxCustomPaint: TCheckBox + Left = 136 + Top = 9 + Width = 129 + Height = 17 + Caption = 'Custom Paint' + TabOrder = 1 + OnClick = CheckBoxCustomPaintClick + end + object CheckBoxVisible: TCheckBox + Left = 8 + Top = 9 + Width = 129 + Height = 17 + Caption = 'Visible' + Checked = True + State = cbChecked + TabOrder = 2 + OnClick = CheckBoxVisibleClick + end + object CheckBoxCustomLineNumbers: TCheckBox + Left = 136 + Top = 32 + Width = 129 + Height = 17 + Caption = 'Custom Line Numbers' + TabOrder = 3 + OnClick = CheckBoxCustomLineNumbersClick + end + object CheckBoxLeadingZeroes: TCheckBox + Left = 271 + Top = 9 + Width = 100 + Height = 17 + Caption = 'Leading Zeros' + TabOrder = 4 + OnClick = CheckBoxLeadingZeroesClick + end + object CheckBoxUseFontStyle: TCheckBox + Left = 271 + Top = 32 + Width = 100 + Height = 17 + Caption = 'Use Font Style' + TabOrder = 5 + OnClick = CheckBoxUseFontStyleClick + end + object CheckBoxAutoSize: TCheckBox + Left = 393 + Top = 9 + Width = 72 + Height = 17 + Caption = 'Auto Size' + TabOrder = 6 + OnClick = CheckBoxAutoSizeClick + end + object CheckBoxZeroStart: TCheckBox + Left = 271 + Top = 55 + Width = 72 + Height = 17 + Caption = 'Zero Start' + TabOrder = 7 + OnClick = CheckBoxZeroStartClick + end + object CheckBoxShowModifications: TCheckBox + Left = 8 + Top = 55 + Width = 129 + Height = 17 + Caption = 'Show modifications' + TabOrder = 8 + OnClick = CheckBoxShowModificationsClick + end + object CheckBoxGradient: TCheckBox + Left = 513 + Top = 9 + Width = 64 + Height = 17 + Caption = 'Gradient' + TabOrder = 9 + OnClick = CheckBoxGradientClick + end + object CheckBoxDirect2D: TCheckBox + Left = 737 + Top = 31 + Width = 64 + Height = 17 + Caption = 'Direct2D' + TabOrder = 10 + OnClick = CheckBoxDirect2DClick + end + end + object SynDWSSyn: TSynDWSSyn + DefaultFilter = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc' + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + Left = 296 + Top = 144 + end + object ColorDialog: TColorDialog + Options = [cdSolidColor] + Left = 144 + Top = 56 + end +end diff --git a/Source/VCL/SynEdit/Demos/GutterDemo/uMain.pas b/Source/VCL/SynEdit/Demos/GutterDemo/uMain.pas new file mode 100644 index 00000000..74c06c07 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/GutterDemo/uMain.pas @@ -0,0 +1,250 @@ +unit uMain; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdActns, ActnList, StdCtrls, ExtCtrls, + SynEdit, SynEditHighlighter, SynHighlighterDWS; + +type + TFormMain = class(TForm) + CheckBoxAutoSize: TCheckBox; + CheckBoxCustomLineNumbers: TCheckBox; + CheckBoxCustomPaint: TCheckBox; + CheckBoxDirect2D: TCheckBox; + CheckBoxGradient: TCheckBox; + CheckBoxLeadingZeroes: TCheckBox; + CheckBoxShowLineNumbers: TCheckBox; + CheckBoxShowModifications: TCheckBox; + CheckBoxUseFontStyle: TCheckBox; + CheckBoxVisible: TCheckBox; + CheckBoxZeroStart: TCheckBox; + ColorDialog: TColorDialog; + LabelBorderColor: TLabel; + LabelColor: TLabel; + LabelGradientStart: TLabel; + LabelGradientStop: TLabel; + Panel: TPanel; + ShapeColorBackground: TShape; + ShapeColorBorder: TShape; + ShapeGradientStartColor: TShape; + ShapeGradientStopColor: TShape; + SynDWSSyn: TSynDWSSyn; + SynEdit: TSynEdit; + procedure FormCreate(Sender: TObject); + procedure CheckBoxAutoSizeClick(Sender: TObject); + procedure CheckBoxCustomLineNumbersClick(Sender: TObject); + procedure CheckBoxCustomPaintClick(Sender: TObject); + procedure CheckBoxGradientClick(Sender: TObject); + procedure CheckBoxLeadingZeroesClick(Sender: TObject); + procedure CheckBoxShowLineNumbersClick(Sender: TObject); + procedure CheckBoxShowModificationsClick(Sender: TObject); + procedure CheckBoxUseFontStyleClick(Sender: TObject); + procedure CheckBoxVisibleClick(Sender: TObject); + procedure CheckBoxZeroStartClick(Sender: TObject); + procedure ShapeColorBackgroundMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ShapeColorBorderMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ShapeGradientStartColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ShapeGradientStopColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure SynEditGutterGetText(Sender: TObject; aLine: Integer; + var aText: string); + procedure SynEditGutterPaint(Sender: TObject; aLine, X, Y: Integer); + procedure FormShow(Sender: TObject); + procedure CheckBoxDirect2DClick(Sender: TObject); + end; + +var + FormMain: TFormMain; + +implementation + +{$R *.DFM} + +{ TFormMain } + +procedure TFormMain.FormCreate(Sender: TObject); +begin + ShapeColorBackground.Brush.Color := SynEdit.Gutter.Color; + ShapeColorBorder.Brush.Color := SynEdit.Gutter.BorderColor; + ShapeGradientStartColor.Brush.Color := SynEdit.Gutter.GradientStartColor; + ShapeGradientStopColor.Brush.Color := SynEdit.Gutter.GradientEndColor; + CheckBoxAutoSize.Checked := SynEdit.Gutter.AutoSize; + CheckBoxLeadingZeroes.Checked := SynEdit.Gutter.LeadingZeros; + CheckBoxShowLineNumbers.Checked := SynEdit.Gutter.ShowLineNumbers; + CheckBoxShowModifications.Checked := SynEdit.Gutter.ShowModification; + CheckBoxZeroStart.Checked := SynEdit.Gutter.ZeroStart; + CheckBoxUseFontStyle.Checked := SynEdit.Gutter.UseFontStyle; + CheckBoxDirect2D.Checked := SynEdit.UseDirect2D; +end; + +procedure TFormMain.FormShow(Sender: TObject); +begin + SynEdit.UseDirect2D := False; +end; + +procedure TFormMain.CheckBoxAutoSizeClick(Sender: TObject); +begin + SynEdit.Gutter.AutoSize := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxCustomLineNumbersClick(Sender: TObject); +begin + if CheckBoxCustomLineNumbers.Checked then + SynEdit.OnGutterGetText := SynEditGutterGetText + else + SynEdit.OnGutterGetText := nil; + SynEdit.InvalidateGutter; +end; + +procedure TFormMain.CheckBoxCustomPaintClick(Sender: TObject); +begin + if CheckBoxCustomPaint.Checked then + SynEdit.OnGutterPaint := SynEditGutterPaint + else + SynEdit.OnGutterPaint := nil; + SynEdit.InvalidateGutter; +end; + +procedure TFormMain.CheckBoxDirect2DClick(Sender: TObject); +begin + SynEdit.UseDirect2D := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxGradientClick(Sender: TObject); +begin + SynEdit.Gutter.Gradient := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxLeadingZeroesClick(Sender: TObject); +begin + SynEdit.Gutter.LeadingZeros := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxShowLineNumbersClick(Sender: TObject); +begin + SynEdit.Gutter.ShowLineNumbers := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxShowModificationsClick(Sender: TObject); +begin + SynEdit.Gutter.ShowModification := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxUseFontStyleClick(Sender: TObject); +begin + SynEdit.Gutter.UseFontStyle := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.CheckBoxVisibleClick(Sender: TObject); +begin + SynEdit.Gutter.Visible := CheckBoxVisible.Checked; +end; + +procedure TFormMain.CheckBoxZeroStartClick(Sender: TObject); +begin + SynEdit.Gutter.ZeroStart := TCheckBox(Sender).Checked; +end; + +procedure TFormMain.ShapeColorBackgroundMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ColorDialog.Color := ShapeColorBackground.Brush.Color; + if ColorDialog.Execute then + begin + ShapeColorBackground.Brush.Color := ColorDialog.Color; + SynEdit.Gutter.Color := ColorDialog.Color; + end; +end; + +procedure TFormMain.ShapeColorBorderMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ColorDialog.Color := ShapeColorBorder.Brush.Color; + if ColorDialog.Execute then + begin + ShapeColorBorder.Brush.Color := ColorDialog.Color; + SynEdit.Gutter.BorderColor := ColorDialog.Color; + end; +end; + +procedure TFormMain.ShapeGradientStartColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ColorDialog.Color := ShapeGradientStartColor.Brush.Color; + if ColorDialog.Execute then + begin + ShapeGradientStartColor.Brush.Color := ColorDialog.Color; + SynEdit.Gutter.GradientStartColor := ColorDialog.Color; + end; +end; + +procedure TFormMain.ShapeGradientStopColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ColorDialog.Color := ShapeGradientStopColor.Brush.Color; + if ColorDialog.Execute then + begin + ShapeGradientStopColor.Brush.Color := ColorDialog.Color; + SynEdit.Gutter.GradientEndColor := ColorDialog.Color; + end; +end; + +procedure TFormMain.SynEditGutterGetText(Sender: TObject; aLine: Integer; + var aText: string); +begin + if aLine = TSynEdit(Sender).CaretY then + Exit; + + if aLine mod 10 <> 0 then + if aLine mod 5 <> 0 then + aText := '·' + else + aText := '-'; +end; + +procedure TFormMain.SynEditGutterPaint(Sender: TObject; aLine, X, Y: Integer); +var + StrLineNumber: string; + LineNumberRect: TRect; + GutterWidth, Offset: Integer; + OldFont: TFont; +begin + with TSynEdit(Sender), Canvas do + begin + Brush.Style := bsClear; + GutterWidth := Gutter.Width - 5; + if (ALine = 1) or (ALine = CaretY) or ((ALine mod 10) = 0) then + begin + StrLineNumber := IntToStr(ALine); + LineNumberRect := Rect(x, y, GutterWidth, y + LineHeight); + OldFont := TFont.Create; + try + OldFont.Assign(Canvas.Font); + Canvas.Font := Gutter.Font; + Canvas.TextRect(LineNumberRect, StrLineNumber, [tfVerticalCenter, + tfSingleLine, tfRight]); + Canvas.Font := OldFont; + finally + OldFont.Free; + end; + end + else + begin + Canvas.Pen.Color := Gutter.Font.Color; + if (ALine mod 5) = 0 then + Offset := 5 + else + Offset := 2; + Inc(y, LineHeight div 2); + Canvas.MoveTo(GutterWidth - Offset, y); + Canvas.LineTo(GutterWidth, y); + end; + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/HighlighterDemo.dpr b/Source/VCL/SynEdit/Demos/HighlighterDemo/HighlighterDemo.dpr new file mode 100644 index 00000000..283d5711 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/HighlighterDemo.dpr @@ -0,0 +1,47 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: HighlighterDemo.dpr, released 2001-08-28. + +The Original Code is part of the HighlighterDemo project, written by Pieter Polak +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: HighlighterDemo.dpr,v 1.2 2004/01/22 03:37:47 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program HighlighterDemo; + +uses + Forms, + uMain in 'uMain.pas' {Form1}; + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/HighlighterDemo/ReadMe.txt new file mode 100644 index 00000000..b908e857 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/ReadMe.txt @@ -0,0 +1,6 @@ +HighlighterDemo.dpr +------------------- + +- Needs Delphi 2 or higher +- Shows how to create your own highlighter using a grammar file and the SynGen + utility. diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.msg b/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.msg new file mode 100644 index 00000000..35a95f68 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.msg @@ -0,0 +1,53 @@ +TSynSampleSyn {first Identifier is considered to be the Class Name } +tk {second Identifier is considered to be the Identifier Prefix } +IdentStart '_', 'a'..'z', 'A'..'Z':: '_', '0'..'9', 'a'..'z', 'A'..'Z':: + +TOKENTYPES +Identifier +Comment Style=[fsItalic]|Foreground=clNavy +Space +String Foreground=clRed +Key Style=[fsBold] +Test Background=clSilver|Foreground=clBlue|Style=[fsUnderline, fsItalic] +|><| + +KEYS +Hello +World +|><| + +KEYS Test +SynEdit +|><| + +CHARS + +'A'..'Z', 'a'..'z', '_':: Ident +BeginProc + fTokenID := IdentKind(fLine + Run); + inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do + Inc(Run); +EndProc + +|><| + +ENCLOSEDBY + +Comment,BraceComment,{,},MultiLine +Comment,CStyleComment,/*,*/,MultiLine +String,String,"," + +|><| + +SAMPLESOURCE +{ Sample source for the demo highlighter } + +This highlighter will recognize the words Hello and +World as keywords. It will also highlight "Strings". + +And a special keyword type: SynEdit + +/* This style of comments is also highlighted */ +|><| + diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.pas b/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.pas new file mode 100644 index 00000000..6f4d101d --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/SynHighlighterSample.pas @@ -0,0 +1,525 @@ +{------------------------------------------------------------------------------- +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: D:\Quellen\Komponenten\SynEdit\Demos\HighlighterDemo\SynHighlighterSample.pas, released 2008-10-25. +Description: +The initial author of this file is Maël Hörz. +Copyright (c) 2008, 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: SynHighlighterSample.pas,v 1.6.2.13 2008/10/25 23:30:31 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNHIGHLIGHTERSAMPLE} +unit SynHighlighterSample; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFDEF SYN_CLX} + QGraphics, + QSynEditTypes, + QSynEditHighlighter, + QSynUnicode, +{$ELSE} + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, +{$ENDIF} + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkComment, + tkIdentifier, + tkKey, + tkNull, + tkSpace, + tkString, + tkTest, + tkUnknown); + + TRangeState = (rsUnKnown, rsBraceComment, rsCStyleComment, rsString); + + TProcTableProc = procedure of object; + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynSampleSyn = class(TSynCustomHighlighter) + private + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..2] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fTestAttri: TSynHighlighterAttributes; + function HashKey(Str: PWideChar): Cardinal; + function FuncHello(Index: Integer): TtkTokenKind; + function FuncSynedit(Index: Integer): TtkTokenKind; + function FuncWorld(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 BraceCommentOpenProc; + procedure BraceCommentProc; + procedure CStyleCommentOpenProc; + procedure CStyleCommentProc; + 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 CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property TestAttri: TSynHighlighterAttributes read fTestAttri write fTestAttri; + end; + +implementation + +uses +{$IFDEF SYN_CLX} + QSynEditStrConst; +{$ELSE} + SynEditStrConst; +{$ENDIF} + +resourcestring + SYNS_FilterTest = 'All files (*.*)|*.*'; + SYNS_LangTest = 'Test'; + SYNS_FriendlyLangTest = 'Test'; + SYNS_AttrTest = 'Test'; + SYNS_FriendlyAttrTest = 'Test'; + +const + // as this language is case-insensitive keywords *must* be in lowercase + KeyWords: array[0..2] of UnicodeString = ( + 'hello', 'synedit', 'world' + ); + + KeyIndices: array[0..2] of Integer = ( + 0, 2, 1 + ); + +procedure TSynSampleSyn.InitIdent; +var + i: Integer; +begin + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[i] = -1 then + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[0] := FuncHello; + fIdentFuncTable[2] := FuncSynedit; + fIdentFuncTable[1] := FuncWorld; +end; + +{$Q-} +function TSynSampleSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 3 + Ord(Str^); + inc(Str); + end; + Result := Result mod 3; + fStringLen := Str - fToIdent; +end; +{$Q+} + +function TSynSampleSyn.FuncHello(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSampleSyn.FuncSynedit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkTest + else + Result := tkIdentifier; +end; + +function TSynSampleSyn.FuncWorld(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSampleSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynSampleSyn.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 TSynSampleSyn.SpaceProc; +begin + inc(Run); + fTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); +end; + +procedure TSynSampleSyn.NullProc; +begin + fTokenID := tkNull; + inc(Run); +end; + +procedure TSynSampleSyn.CRProc; +begin + fTokenID := tkSpace; + inc(Run); + if fLine[Run] = #10 then + inc(Run); +end; + +procedure TSynSampleSyn.LFProc; +begin + fTokenID := tkSpace; + inc(Run); +end; + +procedure TSynSampleSyn.BraceCommentOpenProc; +begin + Inc(Run); + fRange := rsBraceComment; + fTokenID := tkComment; +end; + +procedure TSynSampleSyn.BraceCommentProc; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + fTokenID := tkComment; + 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 TSynSampleSyn.CStyleCommentOpenProc; +begin + Inc(Run); + if (fLine[Run] = '*') then + begin + Inc(Run, 1); + fRange := rsCStyleComment; + fTokenID := tkComment; + end + else + fTokenID := tkIdentifier; +end; + +procedure TSynSampleSyn.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 TSynSampleSyn.StringOpenProc; +begin + Inc(Run); + fRange := rsString; + StringProc; + fTokenID := tkString; +end; + +procedure TSynSampleSyn.StringProc; +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; + +constructor TSynSampleSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + fCaseSensitive := False; + + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clNavy; + AddAttribute(fCommentAttri); + + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clRed; + AddAttribute(fStringAttri); + + fTestAttri := TSynHighLighterAttributes.Create(SYNS_AttrTest, SYNS_FriendlyAttrTest); + fTestAttri.Style := [fsUnderline, fsItalic]; + fTestAttri.Foreground := clBlue; + fTestAttri.Background := clSilver; + AddAttribute(fTestAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + fDefaultFilter := SYNS_FilterTest; + fRange := rsUnknown; +end; + +procedure TSynSampleSyn.IdentProc; +begin + fTokenID := IdentKind(fLine + Run); + inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do + Inc(Run); +end; + +procedure TSynSampleSyn.UnknownProc; +begin + inc(Run); + fTokenID := tkUnknown; +end; + +procedure TSynSampleSyn.Next; +begin + fTokenPos := Run; + case fRange of + rsBraceComment: BraceCommentProc; + rsCStyleComment: CStyleCommentProc; + else + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + '{': BraceCommentOpenProc; + '/': CStyleCommentOpenProc; + '"': StringOpenProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + else + UnknownProc; + end; + end; + inherited; +end; + +function TSynSampleSyn.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 TSynSampleSyn.GetEol: Boolean; +begin + Result := Run = fLineLen + 1; +end; + +function TSynSampleSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := + 'Hello,SynEdit,World'; +end; + +function TSynSampleSyn.GetTokenID: TtkTokenKind; +begin + Result := fTokenId; +end; + +function TSynSampleSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkTest: Result := fTestAttri; + tkUnknown: Result := fIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynSampleSyn.GetTokenKind: Integer; +begin + Result := Ord(fTokenId); +end; + +function TSynSampleSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', '0'..'9', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +function TSynSampleSyn.GetSampleSource: UnicodeString; +begin + Result := + '{ Sample source for the demo highlighter }'#13#10 + + #13#10 + + 'This highlighter will recognize the words Hello and'#13#10 + + 'World as keywords. It will also highlight "Strings".'#13#10 + + #13#10 + + 'And a special keyword type: SynEdit'#13#10 + + '/* This style of comments is also highlighted */'; +end; + +function TSynSampleSyn.IsFilterStored: Boolean; +begin + Result := fDefaultFilter <> SYNS_FilterTest; +end; + +class function TSynSampleSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangTest; +end; + +class function TSynSampleSyn.GetLanguageName: string; +begin + Result := SYNS_LangTest; +end; + +procedure TSynSampleSyn.ResetRange; +begin + fRange := rsUnknown; +end; + +procedure TSynSampleSyn.SetRange(Value: Pointer); +begin + fRange := TRangeState(Value); +end; + +function TSynSampleSyn.GetRange: Pointer; +begin + Result := Pointer(fRange); +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynSampleSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.dfm b/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.dfm new file mode 100644 index 00000000..70a1d665 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.dfm @@ -0,0 +1,125 @@ +object Form1: TForm1 + Left = 268 + Top = 107 + Caption = 'Highlighter demo' + ClientHeight = 446 + ClientWidth = 688 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 688 + Height = 446 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Terminal' + Gutter.Font.Style = [] + RemovedKeystrokes = < + item + Command = ecCut + ShortCut = 8238 + end + item + Command = ecPaste + ShortCut = 8237 + end + item + Command = ecDeleteChar + ShortCut = 46 + end + item + Command = ecContextHelp + ShortCut = 112 + end + item + Command = ecPaste + ShortCut = 16470 + end + item + Command = ecCut + ShortCut = 16472 + end + item + Command = ecBlockIndent + ShortCut = 24649 + end + item + Command = ecBlockUnindent + ShortCut = 24661 + end + item + Command = ecLineBreak + ShortCut = 16461 + end + item + Command = ecInsertLine + ShortCut = 16462 + end + item + Command = ecDeleteWord + ShortCut = 16468 + end> + AddedKeystrokes = < + item + Command = ecPaste + ShortCut = 8238 + end + item + Command = ecDeleteChar + ShortCut = 8237 + end + item + Command = ecCut + ShortCut = 46 + end + item + Command = ecContextHelp + ShortCut = 16496 + end + item + Command = ecBlockIndent + ShortCut = 16470 + end + item + Command = ecLineBreak + ShortCut = 16472 + end + item + Command = ecInsertLine + ShortCut = 24649 + end + item + Command = ecDeleteWord + ShortCut = 24661 + end + item + Command = ecBlockUnindent + ShortCut = 16461 + end + item + Command = ecPaste + ShortCut = 16462 + end + item + Command = ecCut + ShortCut = 16468 + end> + end +end diff --git a/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.pas b/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.pas new file mode 100644 index 00000000..a8ff9b0f --- /dev/null +++ b/Source/VCL/SynEdit/Demos/HighlighterDemo/uMain.pas @@ -0,0 +1,76 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: uMain.pas, released 2001-08-28. + +The Original Code is part of the HighlighterDemo project, written by Pieter Polak +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: uMain.pas,v 1.2 2001/12/27 10:57:38 plpolak Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit uMain; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEdit; + +type + TForm1 = class(TForm) + SynEdit1: TSynEdit; + procedure FormCreate(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +uses + SynHighlighterSample; + +procedure TForm1.FormCreate(Sender: TObject); +var + HL: TSynSampleSyn; +begin + HL := TSynSampleSyn.Create(Self); + SynEdit1.Highlighter := HL; + + SynEdit1.ClearAll; + SynEdit1.Text := HL.SampleSource; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.dfm b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.dfm new file mode 100644 index 00000000..939e1e27 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.dfm @@ -0,0 +1,13659 @@ +object FormSynEditMinimap: TFormSynEditMinimap + Left = 393 + Top = 117 + Caption = 'SynEdit as MiniMap' + ClientHeight = 525 + ClientWidth = 1072 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnResize = FormResize + PixelsPerInch = 96 + TextHeight = 13 + object Splitter: TSplitter + Left = 150 + Top = 0 + Width = 5 + Height = 525 + Color = clBtnFace + ParentColor = False + end + object SynEdit: TSynEdit + Left = 155 + Top = 0 + Width = 917 + Height = 525 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + BorderStyle = bsNone + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clGrayText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Gutter.ShowLineNumbers = True + Gutter.Gradient = True + Highlighter = SynDWSSyn + Lines.Strings = ( + + '{---------------------------------------------------------------' + + '----------------' + + 'The contents of this file are subject to the Mozilla Public Lice' + + 'nse' + + '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.' + '' + 'The Original Code is: SynEdit.pas, released 2000-04-07.' + + 'The Original Code is based on mwCustomEdit.pas by Martin Waldenb' + + 'urg, part of' + 'the mwEdit component suite.' + + 'Portions created by Martin Waldenburg are Copyright (C) 1998 Mar' + + 'tin Waldenburg.' + 'Unicode translation by Ma'#235'l H'#246'rz.' + 'All Rights Reserved.' + '' + + 'Contributors to the SynEdit and mwEdit projects are listed in th' + + 'e' + 'Contributors.txt file.' + '' + + 'Alternatively, the contents of this file may be used under the t' + + 'erms of the' + + 'GNU General Public License Version 2 or later (the "GPL"), in wh' + + 'ich 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 f' + + 'ile' + + 'under the MPL, indicate your decision by deleting the provisions' + + ' above and' + + 'replace them with the notice and other provisions required by th' + + 'e GPL.' + + 'If you do not delete the provisions above, a recipient may use y' + + 'our version' + 'of this file under either the MPL or the GPL.' + '' + '$Id: SynEdit.pas,v 1.32 2012/01/05 15:30:39 Egg Exp $' + '' + + 'You may retrieve the latest version of this file at the SynEdit ' + + 'home page,' + 'located at http://SynEdit.SourceForge.net' + '' + 'Known Issues:' + + '- Undo is buggy when dealing with Hard Tabs (when inserting text' + + ' after EOL and' + ' when trimming).' + '' + + '----------------------------------------------------------------' + + '---------------}' + '//todo: remove SynEdit Clipboard Format?' + '//todo: in WordWrap mode, parse lines only once in PaintLines()' + + '//todo: Remove checks for WordWrap. Must abstract the behaviour ' + + 'with the plugins instead.' + '//todo: Move WordWrap glyph to the WordWrap plugin.' + '//todo: remove fShowSpecChar variable' + '//todo: remove the several Undo block types?' + '' + '{$IFNDEF QSYNEDIT}' + 'unit SynEdit;' + '{$ENDIF}' + '' + '{$I SynEdit.inc}' + '' + 'interface' + '' + 'uses' + '{$IFDEF SYN_CLX}' + ' {$IFDEF SYN_LINUX}' + ' Xlib,' + ' {$ENDIF}' + ' Qt,' + ' Types,' + ' QControls,' + ' QGraphics,' + ' QForms,' + ' QStdCtrls,' + ' QExtCtrls,' + ' QSynUnicode,' + '{$ELSE}' + ' Controls,' + ' Contnrs,' + ' Graphics,' + ' Forms,' + ' StdCtrls,' + ' ExtCtrls,' + ' Windows,' + ' Messages,' + ' {$IFDEF SYN_COMPILER_4_UP}' + ' StdActns,' + ' Dialogs,' + ' {$ENDIF}' + ' {$IFDEF SYN_COMPILER_7}' + ' Themes,' + ' {$ENDIF}' + ' SynUnicode,' + '{$ENDIF}' + '{$IFDEF SYN_CLX}' + ' kTextDrawer,' + ' QSynEditTypes,' + ' QSynEditKeyConst,' + ' QSynEditMiscProcs,' + ' QSynEditMiscClasses,' + ' QSynEditTextBuffer,' + ' QSynEditKeyCmds,' + ' QSynEditHighlighter,' + ' QSynEditKbdHandler,' + '{$ELSE}' + ' Imm,' + ' SynTextDrawer,' + ' SynEditTypes,' + ' SynEditKeyConst,' + ' SynEditMiscProcs,' + ' SynEditMiscClasses,' + ' SynEditTextBuffer,' + ' SynEditKeyCmds,' + ' SynEditHighlighter,' + ' SynEditKbdHandler,' + '{$ENDIF}' + '{$IFDEF UNICODE}' + ' WideStrUtils,' + '{$ENDIF}' + ' Math,' + ' SysUtils,' + ' Classes;' + '' + 'const' + '{$IFNDEF SYN_COMPILER_3_UP}' + ' // not defined in all Delphi versions' + ' WM_MOUSEWHEEL = $020A;' + '{$ENDIF}' + '' + ' // maximum scroll range' + ' MAX_SCROLL = 32767;' + '' + + ' // Max number of book/gutter marks returned from GetEditMarksF' + + 'orLine - that' + ' // really should be enough.' + ' MAX_MARKS = 16;' + '' + ' SYNEDIT_CLIPBOARD_FORMAT = '#39'SynEdit Control Block Type'#39';' + '' + 'var' + ' SynEditClipboardFormat: UINT;' + '' + 'type' + #9'TBufferCoord = SynEditTypes.TBufferCoord;' + #9'TDisplayCoord = SynEditTypes.TDisplayCoord;' + '' + '{$IFDEF SYN_CLX}' + ' TSynBorderStyle = bsNone..bsSingle;' + '{$ELSE}' + ' TSynBorderStyle = TBorderStyle;' + '{$ENDIF}' + '' + + ' TSynReplaceAction = (raCancel, raSkip, raReplace, raReplaceAll' + + ');' + '' + ' ESynEditError = class(ESynError);' + '' + + ' TDropFilesEvent = procedure(Sender: TObject; X, Y: Integer; AF' + + 'iles: TUnicodeStrings)' + ' of object;' + '' + + ' THookedCommandEvent = procedure(Sender: TObject; AfterProcessi' + + 'ng: Boolean;' + + ' var Handled: Boolean; var Command: TSynEditorCommand; var AC' + + 'har: WideChar;' + ' Data: pointer; HandlerData: pointer) of object;' + '' + + ' TPaintEvent = procedure(Sender: TObject; ACanvas: TCanvas) of ' + + 'object;' + '' + ' TProcessCommandEvent = procedure(Sender: TObject;' + + ' var Command: TSynEditorCommand; var AChar: WideChar; Data: p' + + 'ointer) of object;' + '' + + ' TReplaceTextEvent = procedure(Sender: TObject; const ASearch, ' + + 'AReplace:' + + ' UnicodeString; Line, Column: Integer; var Action: TSynReplac' + + 'eAction) of object;' + '' + + ' TSpecialLineColorsEvent = procedure(Sender: TObject; Line: Int' + + 'eger;' + ' var Special: Boolean; var FG, BG: TColor) of object;' + '' + ' TTransientType = (ttBefore, ttAfter);' + ' TPaintTransient = procedure(Sender: TObject; Canvas: TCanvas;' + ' TransientType: TTransientType) of object;' + '' + + ' TScrollEvent = procedure(Sender: TObject; ScrollBar: TScrollBa' + + 'rKind) of object;' + '' + + ' TGutterGetTextEvent = procedure(Sender: TObject; aLine: Intege' + + 'r;' + ' var aText: UnicodeString) of object;' + '' + ' TGutterPaintEvent = procedure(Sender: TObject; aLine: Integer;' + ' X, Y: Integer) of object;' + '' + + ' TSynEditCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfB' + + 'lock, ctBlock);' + '' + + ' TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesCh' + + 'anging,' + + ' sfIgnoreNextChar, sfCaretVisible, sfDblClicked, sfPossibleGu' + + 'tterClick,' + ' sfWaitForDragging, sfInsideRedo, sfGutterDragging);' + '' + ' TSynStateFlags = set of TSynStateFlag;' + '' + ' TScrollHintFormat = (shfTopLineOnly, shfTopToBottom);' + '' + ' TSynEditorOption = (' + + ' eoAltSetsColumnMode, //Holding down the Alt Key will p' + + 'ut the selection mode into columnar format' + + ' eoAutoIndent, //Will indent the caret on new li' + + 'nes with the same amount of leading white space as the preceding' + + ' line' + + ' eoAutoSizeMaxScrollWidth, //Automatically resizes the MaxSc' + + 'rollWidth property when inserting text' + + ' eoDisableScrollArrows, //Disables the scroll bar arrow b' + + 'uttons when you can'#39't scroll in that direction any more' + + ' eoDragDropEditing, //Allows you to select a block of' + + ' text and drag it within the document to another location' + + ' eoDropFiles, //Allows the editor accept OLE fi' + + 'le drops' + + ' eoEnhanceHomeKey, //enhances home key positioning, ' + + 'similar to visual studio' + + ' eoEnhanceEndKey, //enhances End key positioning, s' + + 'imilar to JDeveloper' + + ' eoGroupUndo, //When undoing/redoing actions, h' + + 'andle all continous changes of the same kind in one call instead' + + ' undoing/redoing each command separately' + + ' eoHalfPageScroll, //When scrolling with page-up and' + + ' page-down commands, only scroll a half page at a time' + + ' eoHideShowScrollbars, //if enabled, then the scrollbars' + + ' will only show when necessary. If you have ScrollPastEOL, then' + + ' it the horizontal bar will always be there (it uses MaxLength i' + + 'nstead)' + + ' eoKeepCaretX, //When moving through lines w/o C' + + 'ursor Past EOL, keeps the X position of the cursor' + + ' eoNoCaret, //Makes it so the caret is never ' + + 'visible' + ' eoNoSelection, //Disables selecting text' + + ' eoRightMouseMovesCursor, //When clicking with the right mo' + + 'use for a popup menu, move the cursor to that location' + ' eoScrollByOneLess, //Forces scrolling to be one less' + + ' eoScrollHintFollows, //The scroll hint follows the mou' + + 'se when scrolling vertically' + + ' eoScrollPastEof, //Allows the cursor to go past th' + + 'e end of file marker' + + ' eoScrollPastEol, //Allows the cursor to go past th' + + 'e last character into the white space at the end of a line' + + ' eoShowScrollHint, //Shows a hint of the visible lin' + + 'e numbers when scrolling vertically' + ' eoShowSpecialChars, //Shows the special Characters' + + ' eoSmartTabDelete, //similar to Smart Tabs, but when' + + ' you delete characters' + + ' eoSmartTabs, //When tabbing, the cursor will g' + + 'o to the next non-white space character of the previous line' + + ' eoSpecialLineDefaultFg, //disables the foreground text co' + + 'lor override when using the OnSpecialLineColor event' + + ' eoTabIndent, //When active and act as block indent, unindent when text is selected' + + ' eoTabsToSpaces, //Converts a tab character to a s' + + 'pecified number of space characters' + + ' eoTrimTrailingSpaces //Spaces at the end of lines will' + + ' be trimmed and not saved' + ' );' + '' + ' TSynEditorOptions = set of TSynEditorOption;' + '' + 'const' + + ' SYNEDIT_DEFAULT_OPTIONS = [eoAutoIndent, eoDragDropEditing, eo' + + 'EnhanceEndKey,' + + ' eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpac' + + 'es,' + ' eoSmartTabDelete, eoGroupUndo];' + '' + '{$IFNDEF SYN_CLX}' + 'type' + ' TCreateParamsW = record' + ' Caption: PWideChar;' + ' Style: DWORD;' + ' ExStyle: DWORD;' + ' X, Y: Integer;' + ' Width, Height: Integer;' + ' WndParent: HWnd;' + ' Param: Pointer;' + ' WindowClass: TWndClassW;' + ' WinClassName: array[0..63] of WideChar;' + ' InternalCaption: UnicodeString;' + ' end;' + '{$ENDIF}' + '' + 'type' + + '// use scAll to update a statusbar when another TCustomSynEdit g' + + 'ot the focus' + + ' TSynStatusChange = (scAll, scCaretX, scCaretY, scLeftChar, scT' + + 'opLine,' + ' scInsertMode, scModified, scSelection, scReadOnly);' + ' TSynStatusChanges = set of TSynStatusChange;' + '' + + ' TContextHelpEvent = procedure(Sender: TObject; word: UnicodeSt' + + 'ring)' + ' of object;' + '' + + ' TStatusChangeEvent = procedure(Sender: TObject; Changes: TSynS' + + 'tatusChanges)' + ' of object;' + '' + + ' TMouseCursorEvent = procedure(Sender: TObject; const aLineChar' + + 'Pos: TBufferCoord;' + ' var aCursor: TCursor) of object;' + '' + ' TCustomSynEdit = class;' + '' + ' TSynEditMark = class' + ' protected' + ' fLine, fChar, fImage: Integer;' + ' fEdit: TCustomSynEdit;' + ' fVisible: Boolean;' + ' fInternalImage: Boolean;' + ' fBookmarkNum: Integer;' + ' function GetEdit: TCustomSynEdit; virtual;' + ' procedure SetChar(const Value: Integer); virtual;' + ' procedure SetImage(const Value: Integer); virtual;' + ' procedure SetLine(const Value: Integer); virtual;' + ' procedure SetVisible(const Value: Boolean);' + ' procedure SetInternalImage(const Value: Boolean);' + ' function GetIsBookmark: Boolean;' + ' public' + ' constructor Create(AOwner: TCustomSynEdit);' + ' property Line: Integer read fLine write SetLine;' + ' property Char: Integer read fChar write SetChar;' + ' property Edit: TCustomSynEdit read fEdit;' + ' property ImageIndex: Integer read fImage write SetImage;' + + ' property BookmarkNumber: Integer read fBookmarkNum write fBo' + + 'okmarkNum;' + ' property Visible: Boolean read fVisible write SetVisible;' + + ' property InternalImage: Boolean read fInternalImage write Se' + + 'tInternalImage;' + ' property IsBookmark: Boolean read GetIsBookmark;' + ' end;' + '' + + ' TPlaceMarkEvent = procedure(Sender: TObject; var Mark: TSynEdi' + + 'tMark)' + ' of object;' + '' + ' TSynEditMarks = array[1..MAX_MARKS] of TSynEditMark;' + '' + + ' { A list of mark objects. Each object cause a litle picture to' + + ' be drawn in the gutter. }' + + ' TSynEditMarkList = class(TObjectList) // It makes m' + + 'ore sence to derive from TObjectList,' + + ' protected // as it auto' + + 'matically frees its members' + ' fEdit: TCustomSynEdit;' + ' fOnChange: TNotifyEvent;' + + ' procedure Notify(Ptr: Pointer; Action: TListNotification); o' + + 'verride;' + ' function GetItem(Index: Integer): TSynEditMark;' + ' procedure SetItem(Index: Integer; Item: TSynEditMark);' + + ' property OwnsObjects; // This is to' + + ' hide the inherited property,' + + ' public // because TS' + + 'ynEditMarkList always owns the marks' + ' constructor Create(AOwner: TCustomSynEdit);' + ' function First: TSynEditMark;' + ' function Last: TSynEditMark;' + ' function Extract(Item: TSynEditMark): TSynEditMark;' + ' procedure ClearLine(line: Integer);' + + ' procedure GetMarksForLine(line: Integer; var Marks: TSynEdit' + + 'Marks);' + ' procedure Place(mark: TSynEditMark);' + ' public' + + ' property Items[Index: Integer]: TSynEditMark read GetItem wr' + + 'ite SetItem; default;' + ' property Edit: TCustomSynEdit read fEdit;' + + ' property OnChange: TNotifyEvent read FOnChange write FOnChan' + + 'ge;' + ' end;' + '' + + ' TGutterClickEvent = procedure(Sender: TObject; Button: TMouseB' + + 'utton;' + ' X, Y, Line: Integer; Mark: TSynEditMark) of object;' + '' + ' // aIndex parameters of Line notifications are 0-based.' + ' // aRow parameter of GetRowLength() is 1-based.' + ' ISynEditBufferPlugin = interface' + ' // conversion methods' + + ' function BufferToDisplayPos(const aPos: TBufferCoord): TDisp' + + 'layCoord;' + + ' function DisplayToBufferPos(const aPos: TDisplayCoord): TBuf' + + 'ferCoord;' + ' function RowCount: Integer;' + ' function GetRowLength(aRow: Integer): Integer;' + ' // plugin notifications' + + ' function LinesInserted(aIndex: Integer; aCount: Integer): In' + + 'teger;' + + ' function LinesDeleted(aIndex: Integer; aCount: Integer): Int' + + 'eger;' + + ' function LinesPutted(aIndex: Integer; aCount: Integer): Inte' + + 'ger;' + ' // font or size change' + ' procedure DisplayChanged;' + ' // pretty clear, heh?' + ' procedure Reset;' + ' end;' + '' + ' TSynEditPlugin = class(TObject)' + ' private' + ' fOwner: TCustomSynEdit;' + ' protected' + ' procedure AfterPaint(ACanvas: TCanvas; const AClip: TRect;' + ' FirstLine, LastLine: Integer); virtual;' + + ' procedure PaintTransient(ACanvas: TCanvas; ATransientType: T' + + 'TransientType); virtual;' + ' procedure LinesInserted(FirstLine, Count: Integer); virtual;' + ' procedure LinesDeleted(FirstLine, Count: Integer); virtual;' + ' protected' + ' property Editor: TCustomSynEdit read fOwner;' + ' public' + ' constructor Create(AOwner: TCustomSynEdit);' + ' destructor Destroy; override;' + ' end;' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + ' TCustomSynEditSearchNotFoundEvent = procedure(Sender: TObject;' + ' FindText: UnicodeString) of object;' + '{$ENDIF}' + '' + ' TCustomSynEdit = class(TCustomControl)' + ' private' + '{$IFNDEF SYN_CLX}' + + ' procedure WMCancelMode(var Message: TMessage); message WM_CA' + + 'NCELMODE;' + + ' procedure WMCaptureChanged(var Msg: TMessage); message WM_CA' + + 'PTURECHANGED;' + ' procedure WMChar(var Msg: TWMChar); message WM_CHAR;' + ' procedure WMClear(var Msg: TMessage); message WM_CLEAR;' + ' procedure WMCopy(var Message: TMessage); message WM_COPY;' + ' procedure WMCut(var Message: TMessage); message WM_CUT;' + + ' procedure WMDropFiles(var Msg: TMessage); message WM_DROPFIL' + + 'ES;' + + ' procedure WMDestroy(var Message: TWMDestroy); message WM_DES' + + 'TROY;' + + ' procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEB' + + 'KGND;' + + ' procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_G' + + 'ETDLGCODE;' + + ' procedure WMGetText(var Msg: TWMGetText); message WM_GETTEXT' + + ';' + + ' procedure WMGetTextLength(var Msg: TWMGetTextLength); messag' + + 'e WM_GETTEXTLENGTH;' + ' procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL;' + ' procedure WMPaste(var Message: TMessage); message WM_PASTE;' + + ' procedure WMSetText(var Msg: TWMSetText); message WM_SETTEXT' + + ';' + ' procedure WMImeChar(var Msg: TMessage); message WM_IME_CHAR;' + + ' procedure WMImeComposition(var Msg: TMessage); message WM_IM' + + 'E_COMPOSITION;' + + ' procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOT' + + 'IFY;' + + ' procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KIL' + + 'LFOCUS;' + + ' procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SET' + + 'CURSOR;' + + ' procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFO' + + 'CUS;' + ' procedure WMSize(var Msg: TWMSize); message WM_SIZE;' + ' procedure WMUndo(var Msg: TMessage); message WM_UNDO;' + ' procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;' + '{$ENDIF}' + '{$IFNDEF SYN_COMPILER_6_UP}' + + ' procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEW' + + 'HEEL;' + '{$ENDIF}' + ' private' + ' fAlwaysShowCaret: Boolean;' + ' fBlockBegin: TBufferCoord;' + ' fBlockEnd: TBufferCoord;' + ' fCaretX: Integer;' + ' fLastCaretX: integer;' + ' fCaretY: Integer;' + ' fCharsInWindow: Integer;' + ' fCharWidth: Integer;' + ' fFontDummy: TFont;' + ' fInserting: Boolean;' + ' fLines: TUnicodeStrings;' + ' fOrigLines: TUnicodeStrings;' + ' fOrigUndoList: TSynEditUndoList;' + ' fOrigRedoList: TSynEditUndoList;' + ' fLinesInWindow: Integer;' + ' fLeftChar: Integer;' + ' fMaxScrollWidth: Integer;' + ' fPaintLock: Integer;' + ' fReadOnly: Boolean;' + ' fRightEdge: Integer;' + ' fRightEdgeColor: TColor;' + ' fScrollHintColor: TColor;' + ' fScrollHintFormat: TScrollHintFormat;' + ' FScrollBars: TScrollStyle;' + ' fTextHeight: Integer;' + ' fTextOffset: Integer;' + ' fTopLine: Integer;' + ' fHighlighter: TSynCustomHighlighter;' + ' fSelectedColor: TSynSelectedColor;' + ' fActiveLineColor: TColor;' + ' fUndoList: TSynEditUndoList;' + ' fRedoList: TSynEditUndoList;' + + ' fBookMarks: array[0..9] of TSynEditMark; // these are just r' + + 'eferences, fMarkList is the owner' + ' fMouseDownX: Integer;' + ' fMouseDownY: Integer;' + ' fBookMarkOpt: TSynBookMarkOpt;' + ' fBorderStyle: TSynBorderStyle;' + ' fHideSelection: Boolean;' + ' fMouseWheelAccumulator: Integer;' + ' fOverwriteCaret: TSynEditCaretType;' + ' fInsertCaret: TSynEditCaretType;' + ' fCaretOffset: TPoint;' + ' fKeyStrokes: TSynEditKeyStrokes;' + ' fModified: Boolean;' + ' fMarkList: TSynEditMarkList;' + ' fExtraLineSpacing: Integer;' + ' fSelectionMode: TSynSelectionMode;' + + ' fActiveSelectionMode: TSynSelectionMode; //mode of the activ' + + 'e selection' + ' fWantReturns: Boolean;' + ' fWantTabs: Boolean;' + ' fWordWrapPlugin: ISynEditBufferPlugin;' + ' fWordWrapGlyph: TSynGlyph;' + ' fCaretAtEOL: Boolean; // used by wordwrap' + '' + ' fGutter: TSynGutter;' + ' fTabWidth: Integer;' + ' fTextDrawer: TheTextDrawer;' + ' fInvalidateRect: TRect;' + ' fStateFlags: TSynStateFlags;' + ' fOptions: TSynEditorOptions;' + ' fStatusChanges: TSynStatusChanges;' + ' fLastKey: word;' + ' fLastShiftState: TShiftState;' + ' fSearchEngine: TSynEditSearchCustom;' + ' fHookedCommandHandlers: TObjectList;' + ' fKbdHandler: TSynEditKbdHandler;' + ' fFocusList: TList;' + ' fPlugins: TObjectList;' + ' fScrollTimer: TTimer;' + ' fScrollDeltaX, fScrollDeltaY: Integer;' + ' // event handlers' + ' fOnChange: TNotifyEvent;' + ' fOnClearMark: TPlaceMarkEvent;' + ' fOnCommandProcessed: TProcessCommandEvent;' + ' fOnDropFiles: TDropFilesEvent;' + ' fOnGutterClick: TGutterClickEvent;' + ' FOnKeyPressW: TKeyPressWEvent;' + ' fOnMouseCursor: TMouseCursorEvent;' + ' fOnPaint: TPaintEvent;' + ' fOnPlaceMark: TPlaceMarkEvent;' + ' fOnProcessCommand: TProcessCommandEvent;' + ' fOnProcessUserCommand: TProcessCommandEvent;' + ' fOnReplaceText: TReplaceTextEvent;' + ' fOnSpecialLineColors: TSpecialLineColorsEvent;' + ' fOnContextHelp: TContextHelpEvent;' + ' fOnPaintTransient: TPaintTransient;' + ' fOnScroll: TScrollEvent;' + ' fOnGutterGetText: TGutterGetTextEvent;' + ' fOnGutterPaint: TGutterPaintEvent;' + '' + ' fOnStatusChange: TStatusChangeEvent;' + ' fShowSpecChar: Boolean;' + ' FPaintTransientLock: Integer;' + ' FIsScrolling: Boolean;' + '' + ' fChainListCleared: TNotifyEvent;' + ' fChainListDeleted: TStringListChangeEvent;' + ' fChainListInserted: TStringListChangeEvent;' + ' fChainListPutted: TStringListChangeEvent;' + ' fChainLinesChanging: TNotifyEvent;' + ' fChainLinesChanged: TNotifyEvent;' + ' fChainedEditor: TCustomSynEdit;' + ' fChainUndoAdded: TNotifyEvent;' + ' fChainRedoAdded: TNotifyEvent;' + '' + ' FAdditionalWordBreakChars: TSysCharSet;' + ' FAdditionalIdentChars: TSysCharSet;' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + ' fSearchNotFound: TCustomSynEditSearchNotFoundEvent;' + ' OnFindBeforeSearch: TNotifyEvent;' + ' OnReplaceBeforeSearch: TNotifyEvent;' + ' OnCloseBeforeSearch: TNotifyEvent;' + ' SelStartBeforeSearch: integer;' + ' SelLengthBeforeSearch: integer;' + '{$ENDIF}' + '' + '{$IFNDEF SYN_CLX}' + ' FWindowProducedMessage: Boolean;' + '{$ENDIF}' + '' + '{$IFDEF SYN_LINUX}' + ' FDeadKeysFixed: Boolean;' + '{$ENDIF}' + '' + '{$IFDEF SYN_CLX}' + ' FHScrollBar : TSynEditScrollBar;' + ' FVScrollBar : TSynEditScrollBar;' + + ' procedure ScrollEvent(Sender: TObject; ScrollCode: TScrollCo' + + 'de; var ScrollPos: Integer);' + '{$ENDIF}' + '' + ' procedure BookMarkOptionsChanged(Sender: TObject);' + ' procedure ComputeCaret(X, Y: Integer);' + ' procedure ComputeScroll(X, Y: Integer);' + ' procedure DoBlockIndent;' + ' procedure DoBlockUnindent;' + ' procedure DoHomeKey(Selection:boolean);' + ' procedure DoEndKey(Selection: Boolean);' + ' procedure DoLinesDeleted(FirstLine, Count: integer);' + ' procedure DoLinesInserted(FirstLine, Count: integer);' + ' procedure DoShiftTabKey;' + ' procedure DoTabKey;' + ' procedure DoCaseChange(const Cmd : TSynEditorCommand);' + + ' function FindHookedCmdEvent(AHandlerProc: THookedCommandEven' + + 't): integer;' + ' procedure SynFontChanged(Sender: TObject);' + ' function GetBlockBegin: TBufferCoord;' + ' function GetBlockEnd: TBufferCoord;' + ' function GetCanPaste: Boolean;' + ' function GetCanRedo: Boolean;' + ' function GetCanUndo: Boolean;' + ' function GetCaretXY: TBufferCoord;' + ' function GetDisplayX: Integer;' + ' function GetDisplayY: Integer;' + ' function GetDisplayXY: TDisplayCoord;' + ' function GetDisplayLineCount: Integer;' + ' function GetFont: TFont;' + ' function GetHookedCommandHandlersCount: Integer;' + ' function GetLineText: UnicodeString;' + ' function GetMaxUndo: Integer;' + ' function GetOptions: TSynEditorOptions;' + ' function GetSelAvail: Boolean;' + ' function GetSelTabBlock: Boolean;' + ' function GetSelTabLine: Boolean;' + ' function GetSelText: UnicodeString;' + ' function SynGetText: UnicodeString;' + ' function GetWordAtCursor: UnicodeString;' + ' function GetWordAtMouse: UnicodeString;' + ' function GetWordWrap: Boolean;' + ' procedure GutterChanged(Sender: TObject);' + + ' procedure InsertBlock(const BB, BE: TBufferCoord; ChangeStr:' + + ' PWideChar; AddToUndoList: Boolean);' + ' function LeftSpaces(const Line: UnicodeString): Integer;' + + ' function LeftSpacesEx(const Line: UnicodeString; WantTabs: B' + + 'oolean): Integer;' + + ' function GetLeftSpacing(CharCount: Integer; WantTabs: Boolea' + + 'n): UnicodeString;' + ' procedure LinesChanging(Sender: TObject);' + + ' procedure MoveCaretAndSelection(const ptBefore, ptAfter: TBu' + + 'fferCoord;' + ' SelectionCommand: Boolean);' + + ' procedure MoveCaretHorz(DX: Integer; SelectionCommand: Boole' + + 'an);' + + ' procedure MoveCaretVert(DY: Integer; SelectionCommand: Boole' + + 'an);' + + ' procedure PluginsAfterPaint(ACanvas: TCanvas; const AClip: T' + + 'Rect;' + ' FirstLine, LastLine: Integer);' + ' procedure ReadAddedKeystrokes(Reader: TReader);' + ' procedure ReadRemovedKeystrokes(Reader: TReader);' + ' function ScanFrom(Index: Integer): Integer;' + ' procedure ScrollTimerHandler(Sender: TObject);' + ' procedure SelectedColorsChanged(Sender: TObject);' + ' procedure SetBlockBegin(Value: TBufferCoord);' + ' procedure SetBlockEnd(Value: TBufferCoord);' + ' procedure SetBorderStyle(Value: TSynBorderStyle);' + ' procedure SetCaretX(Value: Integer);' + ' procedure SetCaretY(Value: Integer);' + ' procedure InternalSetCaretX(Value: Integer);' + ' procedure InternalSetCaretY(Value: Integer);' + ' procedure SetInternalDisplayXY(const aPos: TDisplayCoord);' + ' procedure SetActiveLineColor(Value: TColor);' + ' procedure SetExtraLineSpacing(const Value: Integer);' + ' procedure SetFont(const Value: TFont);' + ' procedure SetGutter(const Value: TSynGutter);' + ' procedure SetGutterWidth(Value: Integer);' + ' procedure SetHideSelection(const Value: Boolean);' + + ' procedure SetHighlighter(const Value: TSynCustomHighlighter)' + + ';' + ' procedure SetInsertCaret(const Value: TSynEditCaretType);' + ' procedure SetInsertMode(const Value: Boolean);' + ' procedure SetKeystrokes(const Value: TSynEditKeyStrokes);' + ' procedure SetLeftChar(Value: Integer);' + ' procedure SetLines(Value: TUnicodeStrings);' + ' procedure SetLineText(Value: UnicodeString);' + ' procedure SetMaxScrollWidth(Value: Integer);' + ' procedure SetMaxUndo(const Value: Integer);' + ' procedure SetModified(Value: Boolean);' + ' procedure SetOptions(Value: TSynEditorOptions);' + ' procedure SetOverwriteCaret(const Value: TSynEditCaretType);' + ' procedure SetRightEdge(Value: Integer);' + ' procedure SetRightEdgeColor(Value: TColor);' + ' procedure SetScrollBars(const Value: TScrollStyle);' + ' procedure SetSearchEngine(Value: TSynEditSearchCustom);' + ' procedure SetSelectionMode(const Value: TSynSelectionMode);' + + ' procedure SetActiveSelectionMode(const Value: TSynSelectionM' + + 'ode);' + ' procedure SetSelTextExternal(const Value: UnicodeString);' + ' procedure SetTabWidth(Value: Integer);' + ' procedure SynSetText(const Value: UnicodeString);' + ' procedure SetTopLine(Value: Integer);' + ' procedure SetWordWrap(const Value: Boolean);' + ' procedure SetWordWrapGlyph(const Value: TSynGlyph);' + ' procedure WordWrapGlyphChange(Sender: TObject);' + ' procedure SizeOrFontChanged(bFont: boolean);' + + ' procedure ProperSetLine(ALine: Integer; const ALineText: Uni' + + 'codeString);' + ' procedure UpdateModifiedStatus;' + ' procedure UndoRedoAdded(Sender: TObject);' + ' procedure UpdateLastCaretX;' + ' procedure UpdateScrollBars;' + ' procedure WriteAddedKeystrokes(Writer: TWriter);' + ' procedure WriteRemovedKeystrokes(Writer: TWriter);' + ' procedure SetAdditionalIdentChars(const Value: TSysCharSet);' + + ' procedure SetAdditionalWordBreakChars(const Value: TSysCharS' + + 'et);' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + + ' procedure DoSearchFindFirstExecute(Action: TSearchFindFirst)' + + ';' + ' procedure DoSearchFindExecute(Action: TSearchFind);' + ' procedure DoSearchReplaceExecute(Action: TSearchReplace);' + ' procedure DoSearchFindNextExecute(Action: TSearchFindNext);' + ' procedure FindDialogFindFirst(Sender: TObject);' + ' procedure FindDialogFind(Sender: TObject);' + ' function SearchByFindDialog(FindDialog: TFindDialog) : bool;' + ' procedure FindDialogClose(Sender: TObject);' + '{$ENDIF}' + ' protected' + ' FIgnoreNextChar: Boolean;' + ' FCharCodeString: string;' + '{$IFDEF SYN_COMPILER_6_UP}' + + ' function DoMouseWheel(Shift: TShiftState; WheelDelta: Intege' + + 'r;' + ' MousePos: TPoint): Boolean; override;' + '{$ENDIF}' + '{$IFDEF SYN_CLX}' + ' procedure Resize; override;' + ' function GetClientOrigin: TPoint; override;' + ' function GetClientRect: TRect; override;' + ' function WidgetFlags: Integer; override;' + + ' procedure KeyString(var S: UnicodeString; var Handled: Boole' + + 'an); override;' + ' function NeedKey(Key: Integer; Shift: TShiftState;' + ' const KeyText: UnicodeString): Boolean; override;' + '{$ELSE}' + ' procedure CreateParams(var Params: TCreateParams); override;' + ' procedure CreateWnd; override;' + ' procedure DestroyWnd; override;' + + ' procedure InvalidateRect(const aRect: TRect; aErase: Boolean' + + '); virtual;' + '{$ENDIF}' + ' procedure DblClick; override;' + ' procedure DecPaintLock;' + ' procedure DefineProperties(Filer: TFiler); override;' + ' procedure DoChange; virtual;' + '{$IFDEF SYN_CLX}' + ' procedure DoKeyPressW(var Key: WideChar);' + '{$ELSE}' + ' procedure DoKeyPressW(var Message: TWMKey);' + '{$ENDIF}' + ' procedure DragCanceled; override;' + ' procedure DragOver(Source: TObject; X, Y: Integer;' + ' State: TDragState; var Accept: Boolean); override;' + ' function GetReadOnly: boolean; virtual;' + ' procedure HighlighterAttrChanged(Sender: TObject);' + ' procedure IncPaintLock;' + ' procedure InitializeCaret;' + + ' procedure KeyUp(var Key: Word; Shift: TShiftState); override' + + ';' + + ' procedure KeyDown(var Key: Word; Shift: TShiftState); overri' + + 'de;' + ' procedure KeyPress(var Key: Char); override;' + ' procedure KeyPressW(var Key: WideChar); virtual;' + ' procedure LinesChanged(Sender: TObject); virtual;' + ' procedure ListCleared(Sender: TObject);' + + ' procedure ListDeleted(Sender: TObject; aIndex: Integer; aCou' + + 'nt: Integer);' + + ' procedure ListInserted(Sender: TObject; Index: Integer; aCou' + + 'nt: Integer);' + + ' procedure ListPutted(Sender: TObject; Index: Integer; aCount' + + ': Integer);' + ' //helper procs to chain list commands' + ' procedure ChainListCleared(Sender: TObject);' + + ' procedure ChainListDeleted(Sender: TObject; aIndex: Integer;' + + ' aCount: Integer);' + + ' procedure ChainListInserted(Sender: TObject; aIndex: Integer' + + '; aCount: Integer);' + + ' procedure ChainListPutted(Sender: TObject; aIndex: Integer; ' + + 'aCount: Integer);' + ' procedure ChainLinesChanging(Sender: TObject);' + ' procedure ChainLinesChanged(Sender: TObject);' + ' procedure ChainUndoRedoAdded(Sender: TObject);' + ' procedure ScanRanges;' + ' procedure Loaded; override;' + ' procedure MarkListChange(Sender: TObject);' + + ' procedure MouseDown(Button: TMouseButton; Shift: TShiftState' + + '; X, Y:' + ' Integer); override;' + + ' procedure MouseMove(Shift: TShiftState; X, Y: Integer); over' + + 'ride;' + + ' procedure MouseUp(Button: TMouseButton; Shift: TShiftState; ' + + 'X, Y: Integer);' + ' override;' + + ' procedure NotifyHookedCommandHandlers(AfterProcessing: Boole' + + 'an;' + + ' var Command: TSynEditorCommand; var AChar: WideChar; Data:' + + ' pointer); virtual;' + ' procedure Paint; override;' + ' procedure PaintGutter(const AClip: TRect; const aFirstRow,' + ' aLastRow: Integer); virtual;' + + ' procedure PaintTextLines(AClip: TRect; const aFirstRow, aLas' + + 'tRow,' + ' FirstCol, LastCol: Integer); virtual;' + ' procedure RecalcCharExtent;' + ' procedure RedoItem;' + + ' procedure InternalSetCaretXY(const Value: TBufferCoord); vir' + + 'tual;' + ' procedure SetCaretXY(const Value: TBufferCoord); virtual;' + + ' procedure SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: ' + + 'TBufferCoord); virtual;' + ' procedure SetName(const Value: TComponentName); override;' + ' procedure SetReadOnly(Value: boolean); virtual;' + ' procedure SetWantReturns(Value: Boolean);' + ' procedure SetSelTextPrimitive(const Value: UnicodeString);' + + ' procedure SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode' + + '; Value: PWideChar;' + ' AddToUndoList: Boolean);' + ' procedure SetWantTabs(Value: Boolean);' + ' procedure StatusChanged(AChanges: TSynStatusChanges);' + + ' // If the translations requires Data, memory will be allocat' + + 'ed for it via a' + + ' // GetMem call. The client must call FreeMem on Data if it ' + + 'is not NIL.' + ' function TranslateKeyCode(Code: word; Shift: TShiftState;' + ' var Data: pointer): TSynEditorCommand;' + ' procedure UndoItem;' + ' procedure UpdateMouseCursor; virtual;' + ' protected' + ' fGutterWidth: Integer;' + ' fInternalImage: TSynInternalImage;' + ' procedure HideCaret;' + ' procedure ShowCaret;' + + ' procedure DoOnClearBookmark(var Mark: TSynEditMark); virtual' + + ';' + + ' procedure DoOnCommandProcessed(Command: TSynEditorCommand; A' + + 'Char: WideChar;' + ' Data: pointer); virtual;' + + ' // no method DoOnDropFiles, intercept the WM_DROPFILES inste' + + 'ad' + + ' procedure DoOnGutterClick(Button: TMouseButton; X, Y: Intege' + + 'r); virtual;' + ' procedure DoOnPaint; virtual;' + + ' procedure DoOnPaintTransientEx(TransientType: TTransientType' + + '; Lock: Boolean); virtual;' + + ' procedure DoOnPaintTransient(TransientType: TTransientType);' + + ' virtual;' + '' + ' procedure DoOnPlaceMark(var Mark: TSynEditMark); virtual;' + ' procedure DoOnProcessCommand(var Command: TSynEditorCommand;' + ' var AChar: WideChar; Data: pointer); virtual;' + + ' function DoOnReplaceText(const ASearch, AReplace: UnicodeStr' + + 'ing;' + ' Line, Column: Integer): TSynReplaceAction; virtual;' + ' function DoOnSpecialLineColors(Line: Integer;' + ' var Foreground, Background: TColor): Boolean; virtual;' + + ' procedure DoOnStatusChange(Changes: TSynStatusChanges); virt' + + 'ual;' + ' function GetSelEnd: integer;' + ' function GetSelStart: integer;' + ' function GetSelLength: integer;' + ' procedure SetSelEnd(const Value: integer);' + ' procedure SetSelStart(const Value: integer);' + ' procedure SetSelLength(const Value: integer);' + ' procedure SetAlwaysShowCaret(const Value: Boolean);' + + ' function ShrinkAtWideGlyphs(const S: UnicodeString; First: I' + + 'nteger;' + ' var CharCount: Integer): UnicodeString;' + ' procedure LinesHookChanged;' + ' property InternalCaretX: Integer write InternalSetCaretX;' + ' property InternalCaretY: Integer write InternalSetCaretY;' + + ' property InternalCaretXY: TBufferCoord write InternalSetCare' + + 'tXY;' + ' public' + ' constructor Create(AOwner: TComponent); override;' + ' destructor Destroy; override;' + ' property Canvas;' + + ' property SelStart: Integer read GetSelStart write SetSelStar' + + 't;' + ' property SelEnd: Integer read GetSelEnd write SetSelEnd;' + ' property AlwaysShowCaret: Boolean read FAlwaysShowCaret' + ' write SetAlwaysShowCaret;' + ' procedure UpdateCaret;' + '{$IFDEF SYN_COMPILER_4_UP}' + + ' procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1' + + ': TShiftState;' + ' Key2: word = 0; SS2: TShiftState = []);' + '{$ELSE}' + + ' procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1' + + ': TShiftState;' + ' Key2: word; SS2: TShiftState);' + '{$ENDIF}' + ' procedure BeginUndoBlock;' + ' procedure BeginUpdate;' + ' function CaretInView: Boolean;' + ' function CharIndexToRowCol(Index: Integer): TBufferCoord;' + ' procedure Clear;' + ' procedure ClearAll;' + ' procedure ClearBookMark(BookMark: Integer);' + ' procedure ClearSelection;' + + ' procedure CommandProcessor(Command: TSynEditorCommand; AChar' + + ': WideChar;' + ' Data: pointer); virtual;' + ' procedure ClearUndo;' + ' procedure CopyToClipboard;' + ' procedure CutToClipboard;' + ' procedure DoCopyToClipboard(const SText: UnicodeString);' + + ' procedure DragDrop(Source: TObject; X, Y: Integer); override' + + ';' + ' procedure EndUndoBlock;' + ' procedure EndUpdate;' + ' procedure EnsureCursorPosVisible;' + ' procedure EnsureCursorPosVisibleEx(ForceToMiddle: Boolean;' + ' EvenIfVisible: Boolean = False);' + ' procedure FindMatchingBracket; virtual;' + ' function GetMatchingBracket: TBufferCoord; virtual;' + + ' function GetMatchingBracketEx(const APoint: TBufferCoord): T' + + 'BufferCoord; virtual;' + '{$IFDEF SYN_COMPILER_4_UP}' + + ' function ExecuteAction(Action: TBasicAction): Boolean; overr' + + 'ide;' + '{$ENDIF}' + + ' procedure ExecuteCommand(Command: TSynEditorCommand; AChar: ' + + 'WideChar;' + ' Data: pointer); virtual;' + + ' function ExpandAtWideGlyphs(const S: UnicodeString): Unicode' + + 'String;' + + ' function GetBookMark(BookMark: Integer; var X, Y: Integer): ' + + 'Boolean;' + + ' function GetHighlighterAttriAtRowCol(const XY: TBufferCoord;' + + ' var Token: UnicodeString;' + ' var Attri: TSynHighlighterAttributes): Boolean;' + + ' function GetHighlighterAttriAtRowColEx(const XY: TBufferCoor' + + 'd; var Token: UnicodeString;' + ' var TokenType, Start: Integer;' + ' var Attri: TSynHighlighterAttributes): boolean;' + + ' function GetPositionOfMouse(out aPos: TBufferCoord): Boolean' + + ';' + ' function GetWordAtRowCol(XY: TBufferCoord): UnicodeString;' + ' procedure GotoBookMark(BookMark: Integer); virtual;' + ' procedure GotoLineAndCenter(ALine: Integer); virtual;' + ' function IsIdentChar(AChar: WideChar): Boolean; virtual;' + ' function IsWhiteChar(AChar: WideChar): Boolean; virtual;' + ' function IsWordBreakChar(AChar: WideChar): Boolean; virtual;' + ' procedure InvalidateGutter;' + ' procedure InvalidateGutterLine(aLine: integer);' + + ' procedure InvalidateGutterLines(FirstLine, LastLine: integer' + + ');' + ' procedure InvalidateLine(Line: integer);' + ' procedure InvalidateLines(FirstLine, LastLine: integer);' + ' procedure InvalidateSelection;' + ' function IsBookmark(BookMark: Integer): Boolean;' + + ' function IsPointInSelection(const Value: TBufferCoord): Bool' + + 'ean;' + ' procedure LockUndo;' + + ' function BufferToDisplayPos(const p: TBufferCoord): TDisplay' + + 'Coord;' + + ' function DisplayToBufferPos(const p: TDisplayCoord): TBuffer' + + 'Coord;' + ' function LineToRow(aLine: Integer): Integer;' + ' function RowToLine(aRow: Integer): Integer;' + ' procedure Notification(AComponent: TComponent;' + ' Operation: TOperation); override;' + ' procedure PasteFromClipboard;' + '' + ' function NextWordPos: TBufferCoord; virtual;' + + ' function NextWordPosEx(const XY: TBufferCoord): TBufferCoord' + + '; virtual;' + ' function WordStart: TBufferCoord; virtual;' + + ' function WordStartEx(const XY: TBufferCoord): TBufferCoord; ' + + 'virtual;' + ' function WordEnd: TBufferCoord; virtual;' + + ' function WordEndEx(const XY: TBufferCoord): TBufferCoord; vi' + + 'rtual;' + ' function PrevWordPos: TBufferCoord; virtual;' + + ' function PrevWordPosEx(const XY: TBufferCoord): TBufferCoord' + + '; virtual;' + '' + ' function PixelsToRowColumn(aX, aY: Integer): TDisplayCoord;' + + ' function PixelsToNearestRowColumn(aX, aY: Integer): TDisplay' + + 'Coord;' + ' procedure Redo;' + + ' procedure RegisterCommandHandler(const AHandlerProc: THooked' + + 'CommandEvent;' + ' AHandlerData: pointer);' + + ' function RowColumnToPixels(const RowCol: TDisplayCoord): TPo' + + 'int;' + ' function RowColToCharIndex(RowCol: TBufferCoord): Integer;' + + ' function SearchReplace(const ASearch, AReplace: UnicodeStrin' + + 'g;' + ' AOptions: TSynSearchOptions): Integer;' + ' procedure SelectAll;' + + ' procedure SetBookMark(BookMark: Integer; X: Integer; Y: Inte' + + 'ger);' + + ' procedure SetCaretAndSelection(const ptCaret, ptBefore, ptAf' + + 'ter: TBufferCoord);' + ' procedure SetDefaultKeystrokes; virtual;' + ' procedure SetSelWord;' + ' procedure SetWordBlock(Value: TBufferCoord);' + ' procedure Undo;' + ' procedure UnlockUndo;' + + ' procedure UnregisterCommandHandler(AHandlerProc: THookedComm' + + 'andEvent);' + '{$IFDEF SYN_COMPILER_4_UP}' + + ' function UpdateAction(Action: TBasicAction): Boolean; overri' + + 'de;' + '{$ENDIF}' + ' procedure SetFocus; override;' + '' + ' procedure AddKeyUpHandler(aHandler: TKeyEvent);' + ' procedure RemoveKeyUpHandler(aHandler: TKeyEvent);' + ' procedure AddKeyDownHandler(aHandler: TKeyEvent);' + ' procedure RemoveKeyDownHandler(aHandler: TKeyEvent);' + ' procedure AddKeyPressHandler(aHandler: TKeyPressWEvent);' + ' procedure RemoveKeyPressHandler(aHandler: TKeyPressWEvent);' + ' procedure AddFocusControl(aControl: TWinControl);' + ' procedure RemoveFocusControl(aControl: TWinControl);' + ' procedure AddMouseDownHandler(aHandler: TMouseEvent);' + ' procedure RemoveMouseDownHandler(aHandler: TMouseEvent);' + ' procedure AddMouseUpHandler(aHandler: TMouseEvent);' + ' procedure RemoveMouseUpHandler(aHandler: TMouseEvent);' + + ' procedure AddMouseCursorHandler(aHandler: TMouseCursorEvent)' + + ';' + + ' procedure RemoveMouseCursorHandler(aHandler: TMouseCursorEve' + + 'nt);' + '' + '{$IFDEF SYN_CLX}' + + ' function EventFilter(Sender: QObjectH; Event: QEventH): Bool' + + 'ean; override;' + '{$ELSE}' + ' procedure WndProc(var Msg: TMessage); override;' + '{$ENDIF}' + ' procedure SetLinesPointer(ASynEdit: TCustomSynEdit);' + ' procedure RemoveLinesPointer;' + ' procedure HookTextBuffer(aBuffer: TSynEditStringList;' + ' aUndo, aRedo: TSynEditUndoList);' + ' procedure UnHookTextBuffer;' + ' public' + + ' property AdditionalIdentChars: TSysCharSet read FAdditionalI' + + 'dentChars write SetAdditionalIdentChars;' + + ' property AdditionalWordBreakChars: TSysCharSet read FAdditio' + + 'nalWordBreakChars write SetAdditionalWordBreakChars;' + + ' property BlockBegin: TBufferCoord read GetBlockBegin write S' + + 'etBlockBegin;' + + ' property BlockEnd: TBufferCoord read GetBlockEnd write SetBl' + + 'ockEnd;' + ' property CanPaste: Boolean read GetCanPaste;' + ' property CanRedo: Boolean read GetCanRedo;' + ' property CanUndo: Boolean read GetCanUndo;' + ' property CaretX: Integer read fCaretX write SetCaretX;' + ' property CaretY: Integer read fCaretY write SetCaretY;' + + ' property CaretXY: TBufferCoord read GetCaretXY write SetCare' + + 'tXY;' + ' property ActiveLineColor: TColor read fActiveLineColor' + ' write SetActiveLineColor default clNone;' + ' property DisplayX: Integer read GetDisplayX;' + ' property DisplayY: Integer read GetDisplayY;' + ' property DisplayXY: TDisplayCoord read GetDisplayXY;' + ' property DisplayLineCount: Integer read GetDisplayLineCount;' + ' property CharsInWindow: Integer read fCharsInWindow;' + ' property CharWidth: Integer read fCharWidth;' + ' property Color;' + ' property Font: TFont read GetFont write SetFont;' + ' property Highlighter: TSynCustomHighlighter' + ' read fHighlighter write SetHighlighter;' + ' property LeftChar: Integer read fLeftChar write SetLeftChar;' + ' property LineHeight: Integer read fTextHeight;' + ' property LinesInWindow: Integer read fLinesInWindow;' + + ' property LineText: UnicodeString read GetLineText write SetL' + + 'ineText;' + ' property Lines: TUnicodeStrings read fLines write SetLines;' + ' property Marks: TSynEditMarkList read fMarkList;' + + ' property MaxScrollWidth: Integer read fMaxScrollWidth write ' + + 'SetMaxScrollWidth' + ' default 1024;' + ' property Modified: Boolean read fModified write SetModified;' + ' property PaintLock: Integer read fPaintLock;' + + ' property ReadOnly: Boolean read GetReadOnly write SetReadOnl' + + 'y default False;' + + ' property SearchEngine: TSynEditSearchCustom read fSearchEngi' + + 'ne write SetSearchEngine;' + ' property SelAvail: Boolean read GetSelAvail;' + + ' property SelLength: Integer read GetSelLength write SetSelLe' + + 'ngth;' + ' property SelTabBlock: Boolean read GetSelTabBlock;' + ' property SelTabLine: Boolean read GetSelTabLine;' + + ' property SelText: UnicodeString read GetSelText write SetSel' + + 'TextExternal;' + ' property StateFlags: TSynStateFlags read fStateFlags;' + + ' property Text: UnicodeString read SynGetText write SynSetTex' + + 't;' + ' property TopLine: Integer read fTopLine write SetTopLine;' + ' property WordAtCursor: UnicodeString read GetWordAtCursor;' + ' property WordAtMouse: UnicodeString read GetWordAtMouse;' + ' property UndoList: TSynEditUndoList read fUndoList;' + ' property RedoList: TSynEditUndoList read fRedoList;' + ' public' + ' property OnProcessCommand: TProcessCommandEvent' + ' read FOnProcessCommand write FOnProcessCommand;' + '' + ' property BookMarkOptions: TSynBookMarkOpt' + ' read fBookMarkOpt write fBookMarkOpt;' + + ' property BorderStyle: TSynBorderStyle read FBorderStyle writ' + + 'e SetBorderStyle' + ' default bsSingle;' + ' property ExtraLineSpacing: Integer' + + ' read fExtraLineSpacing write SetExtraLineSpacing default 0' + + ';' + ' property Gutter: TSynGutter read fGutter write SetGutter;' + + ' property HideSelection: Boolean read fHideSelection write Se' + + 'tHideSelection' + ' default False;' + ' property InsertCaret: TSynEditCaretType read FInsertCaret' + ' write SetInsertCaret default ctVerticalLine;' + + ' property InsertMode: boolean read fInserting write SetInsert' + + 'Mode' + ' default true;' + ' property IsScrolling : Boolean read FIsScrolling;' + ' property Keystrokes: TSynEditKeyStrokes' + ' read FKeystrokes write SetKeystrokes stored False;' + + ' property MaxUndo: Integer read GetMaxUndo write SetMaxUndo d' + + 'efault 1024;' + + ' property Options: TSynEditorOptions read GetOptions write Se' + + 'tOptions' + ' default SYNEDIT_DEFAULT_OPTIONS;' + + ' property OverwriteCaret: TSynEditCaretType read FOverwriteCa' + + 'ret' + ' write SetOverwriteCaret default ctBlock;' + + ' property RightEdge: Integer read fRightEdge write SetRightEd' + + 'ge default 80;' + ' property RightEdgeColor: TColor' + + ' read fRightEdgeColor write SetRightEdgeColor default clSil' + + 'ver;' + ' property ScrollHintColor: TColor read fScrollHintColor' + ' write fScrollHintColor default clInfoBk;' + + ' property ScrollHintFormat: TScrollHintFormat read fScrollHin' + + 'tFormat' + ' write fScrollHintFormat default shfTopLineOnly;' + ' property ScrollBars: TScrollStyle' + ' read FScrollBars write SetScrollBars default ssBoth;' + ' property SelectedColor: TSynSelectedColor' + ' read FSelectedColor write FSelectedColor;' + ' property SelectionMode: TSynSelectionMode' + + ' read FSelectionMode write SetSelectionMode default smNorma' + + 'l;' + + ' property ActiveSelectionMode: TSynSelectionMode read fActive' + + 'SelectionMode' + ' write SetActiveSelectionMode stored False;' + + ' property TabWidth: integer read fTabWidth write SetTabWidth ' + + 'default 8;' + + ' property WantReturns: boolean read fWantReturns write SetWan' + + 'tReturns default True;' + + ' property WantTabs: boolean read fWantTabs write SetWantTabs ' + + 'default False;' + + ' property WordWrap: boolean read GetWordWrap write SetWordWra' + + 'p default False;' + + ' property WordWrapGlyph: TSynGlyph read fWordWrapGlyph write ' + + 'SetWordWrapGlyph;' + + ' property OnChange: TNotifyEvent read FOnChange write FOnChan' + + 'ge;' + ' property OnClearBookmark: TPlaceMarkEvent read fOnClearMark' + ' write fOnClearMark;' + ' property OnCommandProcessed: TProcessCommandEvent' + ' read fOnCommandProcessed write fOnCommandProcessed;' + ' property OnContextHelp: TContextHelpEvent' + ' read fOnContextHelp write fOnContextHelp;' + + ' property OnDropFiles: TDropFilesEvent read fOnDropFiles writ' + + 'e fOnDropFiles;' + ' property OnGutterClick: TGutterClickEvent' + ' read fOnGutterClick write fOnGutterClick;' + + ' property OnGutterGetText: TGutterGetTextEvent read fOnGutter' + + 'GetText' + ' write fOnGutterGetText;' + + ' property OnGutterPaint: TGutterPaintEvent read fOnGutterPain' + + 't' + ' write fOnGutterPaint;' + + ' property OnMouseCursor: TMouseCursorEvent read fOnMouseCurso' + + 'r' + ' write fOnMouseCursor;' + + ' property OnKeyPress: TKeyPressWEvent read FOnKeyPressW write' + + ' FOnKeyPressW;' + ' property OnPaint: TPaintEvent read fOnPaint write fOnPaint;' + ' property OnPlaceBookmark: TPlaceMarkEvent' + ' read FOnPlaceMark write FOnPlaceMark;' + ' property OnProcessUserCommand: TProcessCommandEvent' + ' read FOnProcessUserCommand write FOnProcessUserCommand;' + + ' property OnReplaceText: TReplaceTextEvent read fOnReplaceTex' + + 't' + ' write fOnReplaceText;' + ' property OnSpecialLineColors: TSpecialLineColorsEvent' + ' read fOnSpecialLineColors write fOnSpecialLineColors;' + ' property OnStatusChange: TStatusChangeEvent' + ' read fOnStatusChange write fOnStatusChange;' + ' property OnPaintTransient: TPaintTransient' + ' read fOnPaintTransient write fOnPaintTransient;' + ' property OnScroll: TScrollEvent' + ' read fOnScroll write fOnScroll;' + ' published' + ' property Cursor default crIBeam;' + '{$IFDEF SYN_COMPILER_6_UP}' + ' property OnSearchNotFound: TCustomSynEditSearchNotFoundEvent' + ' read fSearchNotFound write fSearchNotFound;' + '{$ENDIF}' + ' end;' + '' + ' TSynEdit = class(TCustomSynEdit)' + ' published' + ' // inherited properties' + ' property Align;' + '{$IFDEF SYN_COMPILER_4_UP}' + ' property Anchors;' + ' property Constraints;' + '{$ENDIF}' + ' property Color;' + ' property ActiveLineColor;' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' property Ctl3D;' + ' property ParentCtl3D;' + '{$ENDIF}' + ' property Enabled;' + ' property Font;' + ' property Height;' + ' property Name;' + ' property ParentColor default False;' + ' property ParentFont default False;' + ' property ParentShowHint;' + ' property PopupMenu;' + ' property ShowHint;' + ' property TabOrder;' + ' property TabStop default True;' + ' property Visible;' + ' property Width;' + ' // inherited events' + ' property OnClick;' + ' property OnDblClick;' + ' property OnDragDrop;' + ' property OnDragOver;' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + '{$IFDEF SYN_COMPILER_4_UP}' + ' property OnEndDock;' + ' property OnStartDock;' + '{$ENDIF}' + '{$ENDIF}' + ' property OnEndDrag;' + ' property OnEnter;' + ' property OnExit;' + ' property OnKeyDown;' + ' property OnKeyPress;' + ' property OnKeyUp;' + ' property OnMouseDown;' + ' property OnMouseMove;' + ' property OnMouseUp;' + ' property OnMouseWheel;' + ' property OnMouseWheelDown;' + ' property OnMouseWheelUp;' + ' property OnStartDrag;' + ' // TCustomSynEdit properties' + ' property BookMarkOptions;' + ' property BorderStyle;' + ' property ExtraLineSpacing;' + ' property Gutter;' + ' property HideSelection;' + ' property Highlighter;' + '{$IFNDEF SYN_CLX}' + ' property ImeMode;' + ' property ImeName;' + '{$ENDIF}' + ' property InsertCaret;' + ' property InsertMode;' + ' property Keystrokes;' + ' property Lines;' + ' property MaxScrollWidth;' + ' property MaxUndo;' + ' property Options;' + ' property OverwriteCaret;' + ' property ReadOnly;' + ' property RightEdge;' + ' property RightEdgeColor;' + ' property ScrollHintColor;' + ' property ScrollHintFormat;' + ' property ScrollBars;' + ' property SearchEngine;' + ' property SelectedColor;' + ' property SelectionMode;' + ' property TabWidth;' + ' property WantReturns;' + ' property WantTabs;' + ' property WordWrap;' + ' property WordWrapGlyph;' + ' // TCustomSynEdit events' + ' property OnChange;' + ' property OnClearBookmark;' + ' property OnCommandProcessed;' + ' property OnContextHelp;' + ' property OnDropFiles;' + ' property OnGutterClick;' + ' property OnGutterGetText;' + ' property OnGutterPaint;' + ' property OnMouseCursor;' + ' property OnPaint;' + ' property OnPlaceBookmark;' + ' property OnProcessCommand;' + ' property OnProcessUserCommand;' + ' property OnReplaceText;' + ' property OnScroll;' + ' property OnSpecialLineColors;' + ' property OnStatusChange;' + ' property OnPaintTransient;' + ' end;' + '' + 'implementation' + '' + '{$R SynEdit.res}' + '' + 'uses' + '{$IFDEF SYN_COMPILER_6_UP}' + ' Consts,' + '{$ENDIF}' + '{$IFDEF SYN_CLX}' + ' QStdActns,' + ' QClipbrd,' + ' QSynEditWordWrap,' + ' QSynEditStrConst;' + '{$ELSE}' + ' Clipbrd,' + ' ShellAPI,' + ' SynEditWordWrap,' + ' SynEditStrConst;' + '{$ENDIF}' + '' + '{$IFDEF SYN_CLX}' + 'const' + + ' FrameWidth = 2; { the border width when BoderStyle = bsSingle ' + + '(until we support TWidgetStyle...) }' + '{$ENDIF}' + '' + 'function CeilOfIntDiv(Dividend: Cardinal; Divisor: Word): Word;' + 'Var' + ' Remainder: Word;' + 'begin' + ' DivMod(Dividend, Divisor, Result, Remainder);' + ' if Remainder > 0 then' + ' Inc(Result);' + 'end;' + '' + + 'function TrimTrailingSpaces(const S: UnicodeString): UnicodeStri' + + 'ng;' + 'var' + ' I: Integer;' + 'begin' + ' I := Length(S);' + ' while (I > 0) and ((S[I] = #32) or (S[I] = #9)) do' + ' Dec(I);' + ' Result := Copy(S, 1, I);' + 'end;' + '' + '{ THookedCommandHandlerEntry }' + '' + 'type' + ' THookedCommandHandlerEntry = class(TObject)' + ' private' + ' fEvent: THookedCommandEvent;' + ' fData: pointer;' + + ' constructor Create(AEvent: THookedCommandEvent; AData: point' + + 'er);' + + ' function Equals(AEvent: THookedCommandEvent): Boolean; {$IFD' + + 'EF UNICODE} reintroduce; {$ENDIF}' + ' end;' + '' + + 'constructor THookedCommandHandlerEntry.Create(AEvent: THookedCom' + + 'mandEvent;' + ' AData: pointer);' + 'begin' + ' inherited Create;' + ' fEvent := AEvent;' + ' fData := AData;' + 'end;' + '' + + 'function THookedCommandHandlerEntry.Equals(AEvent: THookedComman' + + 'dEvent): Boolean;' + 'begin' + ' with TMethod(fEvent) do' + + ' Result := (Code = TMethod(AEvent).Code) and (Data = TMethod(' + + 'AEvent).Data);' + 'end;' + '' + '{ TCustomSynEdit }' + '' + + 'function TCustomSynEdit.PixelsToNearestRowColumn(aX, aY: Integer' + + '): TDisplayCoord;' + '// Result is in display coordinates' + 'var' + ' f: Single;' + 'begin' + '{$IFDEF SYN_CLX}' + ' with ClientRect.TopLeft do' + ' begin' + ' Dec(aX, X);' + ' Dec(aY, Y);' + ' end;' + '{$ENDIF}' + ' f := (aX - fGutterWidth - 2) / fCharWidth;' + ' // don'#39't return a partially visible last line' + ' if aY >= fLinesInWindow * fTextHeight then' + ' begin' + ' aY := fLinesInWindow * fTextHeight - 1;' + ' if aY < 0 then' + ' aY := 0;' + ' end;' + ' Result.Column := Max(1, LeftChar + Round(f));' + ' Result.Row := Max(1, TopLine + (aY div fTextHeight));' + 'end;' + '' + + 'function TCustomSynEdit.PixelsToRowColumn(aX, aY: Integer): TDis' + + 'playCoord;' + 'begin' + '{$IFDEF SYN_CLX}' + ' with ClientRect.TopLeft do' + ' begin' + ' Dec(aX, X);' + ' Dec(aY, Y);' + ' end;' + '{$ENDIF}' + + ' Result.Column := Max(1, LeftChar + ((aX - fGutterWidth - 2) di' + + 'v fCharWidth));' + ' Result.Row := Max(1, TopLine + (aY div fTextHeight));' + 'end;' + '' + + 'function TCustomSynEdit.RowColumnToPixels(const RowCol: TDisplay' + + 'Coord): TPoint;' + 'begin' + ' Result.X := (RowCol.Column-1) * fCharWidth + fTextOffset;' + ' Result.Y := (RowCol.Row - fTopLine) * fTextHeight;' + '{$IFDEF SYN_CLX}' + ' with ClientRect.TopLeft do' + ' begin' + ' Inc(Result.X, X);' + ' Inc(Result.Y, Y);' + ' end;' + '{$ENDIF}' + 'end;' + '' + 'procedure TCustomSynEdit.ComputeCaret(X, Y: Integer);' + '//X,Y are pixel coordinates' + 'var' + ' vCaretNearestPos : TDisplayCoord;' + 'begin' + ' vCaretNearestPos := PixelsToNearestRowColumn(X, Y);' + + ' vCaretNearestPos.Row := MinMax(vCaretNearestPos.Row, 1, Displa' + + 'yLineCount);' + ' SetInternalDisplayXY(vCaretNearestPos);' + 'end;' + '' + 'procedure TCustomSynEdit.ComputeScroll(X, Y: Integer);' + '//X,Y are pixel coordinates' + 'var' + ' iScrollBounds: TRect; { relative to the client area }' + 'begin' + ' { don'#39't scroll if dragging text from other control }' + ' if (not MouseCapture) and (not Dragging) then' + ' begin' + ' fScrollTimer.Enabled := False;' + ' Exit;' + ' end;' + '' + + ' iScrollBounds := Bounds(fGutterWidth, 0, fCharsInWindow * fCha' + + 'rWidth,' + ' fLinesInWindow * fTextHeight);' + ' if BorderStyle = bsNone then' + ' InflateRect(iScrollBounds, -2, -2);' + '' + ' if X < iScrollBounds.Left then' + ' fScrollDeltaX := (X - iScrollBounds.Left) div fCharWidth - 1' + ' else if X >= iScrollBounds.Right then' + + ' fScrollDeltaX := (X - iScrollBounds.Right) div fCharWidth + ' + + '1' + ' else' + ' fScrollDeltaX := 0;' + '' + ' if Y < iScrollBounds.Top then' + ' fScrollDeltaY := (Y - iScrollBounds.Top) div fTextHeight - 1' + ' else if Y >= iScrollBounds.Bottom then' + + ' fScrollDeltaY := (Y - iScrollBounds.Bottom) div fTextHeight ' + + '+ 1' + ' else' + ' fScrollDeltaY := 0;' + '' + + ' fScrollTimer.Enabled := (fScrollDeltaX <> 0) or (fScrollDeltaY' + + ' <> 0);' + 'end;' + '' + + 'procedure TCustomSynEdit.DoCopyToClipboard(const SText: UnicodeS' + + 'tring);' + '{$IFNDEF SYN_CLX}' + 'var' + ' Mem: HGLOBAL;' + ' P: PByte;' + ' SLen: Integer;' + '{$ENDIF}' + 'begin' + ' if SText = '#39#39' then Exit;' + ' SetClipboardText(SText);' + '{$IFDEF SYN_CLX}' + 'end;' + '{$ELSE}' + ' SLen := Length(SText);' + + ' // Open and Close are the only TClipboard methods we use becau' + + 'se TClipboard' + + ' // is very hard (impossible) to work with if you want to put m' + + 'ore than one' + ' // format on it at a time.' + ' Clipboard.Open;' + ' try' + + ' // Copy it in our custom format so we know what kind of bloc' + + 'k it is.' + ' // That effects how it is pasted in.' + + ' // This format is kept as ANSI to be compatible with program' + + 's using the' + ' // ANSI version of Synedit.' + ' Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,' + ' sizeof(TSynSelectionMode) + SLen + 1);' + ' if Mem <> 0 then' + ' begin' + ' P := GlobalLock(Mem);' + ' try' + ' if P <> nil then' + ' begin' + + ' // Our format: TSynSelectionMode value followed by An' + + 'si-text.' + ' PSynSelectionMode(P)^ := fActiveSelectionMode;' + ' inc(P, SizeOf(TSynSelectionMode));' + ' Move(PAnsiChar(AnsiString(SText))^, P^, SLen + 1);' + ' SetClipboardData(SynEditClipboardFormat, Mem);' + ' end;' + ' finally' + ' GlobalUnlock(Mem);' + ' end;' + ' end;' + + ' // Don'#39't free Mem! It belongs to the clipboard now, and it ' + + 'will free it' + ' // when it is done with it.' + ' finally' + ' Clipboard.Close;' + ' end;' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.CopyToClipboard;' + 'var' + ' SText: UnicodeString;' + ' ChangeTrim: Boolean;' + 'begin' + ' if SelAvail then' + ' begin' + + ' ChangeTrim := (fActiveSelectionMode = smColumn) and (eoTrimT' + + 'railingSpaces in Options);' + ' try' + ' if ChangeTrim then' + ' Exclude(fOptions, eoTrimTrailingSpaces);' + ' SText := SelText;' + ' finally' + ' if ChangeTrim then' + ' Include(fOptions, eoTrimTrailingSpaces);' + ' end;' + ' DoCopyToClipboard(SText);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.CutToClipboard;' + 'begin' + ' if not ReadOnly and SelAvail then' + ' begin' + ' BeginUndoBlock;' + ' try' + ' DoCopyToClipboard(SelText);' + ' SelText := '#39#39';' + ' finally' + ' EndUndoBlock;' + ' end;' + ' end;' + 'end;' + '' + 'constructor TCustomSynEdit.Create(AOwner: TComponent);' + 'begin' + ' inherited Create(AOwner);' + ' fLines := TSynEditStringList.Create(ExpandAtWideGlyphs);' + ' fOrigLines := fLines;' + ' with TSynEditStringList(fLines) do' + ' begin' + ' OnChange := LinesChanged;' + ' OnChanging := LinesChanging;' + ' OnCleared := ListCleared;' + ' OnDeleted := ListDeleted;' + ' OnInserted := ListInserted;' + ' OnPutted := ListPutted;' + ' end;' + ' fFontDummy := TFont.Create;' + ' fUndoList := TSynEditUndoList.Create;' + ' fUndoList.OnAddedUndo := UndoRedoAdded;' + ' fOrigUndoList := fUndoList;' + ' fRedoList := TSynEditUndoList.Create;' + ' fRedoList.OnAddedUndo := UndoRedoAdded;' + ' fOrigRedoList := fRedoList;' + '' + '{$IFDEF SYN_COMPILER_4_UP}' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' DoubleBuffered := False;' + '{$ENDIF}' + '{$ENDIF}' + ' fActiveLineColor := clNone;' + ' fSelectedColor := TSynSelectedColor.Create;' + ' fSelectedColor.OnChange := SelectedColorsChanged;' + ' fBookMarkOpt := TSynBookMarkOpt.Create(Self);' + ' fBookMarkOpt.OnChange := BookMarkOptionsChanged;' + + '// fRightEdge has to be set before FontChanged is called for the' + + ' first time' + ' fRightEdge := 80;' + ' fGutter := TSynGutter.Create;' + ' fGutter.OnChange := GutterChanged;' + ' fGutterWidth := fGutter.Width;' + + ' fWordWrapGlyph := TSynGlyph.Create(HINSTANCE, '#39'SynEditWrapped'#39 + + ', clLime);' + ' fWordWrapGlyph.OnChange := WordWrapGlyphChange;' + ' fTextOffset := fGutterWidth + 2;' + ' ControlStyle := ControlStyle + [csOpaque, csSetCaption];' + '{$IFDEF SYN_COMPILER_7_UP}' + ' {$IFNDEF SYN_CLX}' + ' ControlStyle := ControlStyle + [csNeedsBorderPaint];' + ' {$ENDIF}' + '{$ENDIF}' + ' Height := 150;' + ' Width := 200;' + ' Cursor := crIBeam;' + ' Color := clWindow;' + '{$IFDEF SYN_WIN32}' + ' fFontDummy.Name := '#39'Courier New'#39';' + ' fFontDummy.Size := 10;' + '{$ENDIF}' + '{$IFDEF SYN_KYLIX}' + ' fFontDummy.Name := '#39'adobe-courier'#39';' + ' if fFontDummy.Name = '#39'adobe-courier'#39' then' + ' fFontDummy.Size := 12' + ' else begin' + ' fFontDummy.Name := '#39'terminal'#39';' + ' fFontDummy.Size := 14;' + ' end;' + '{$ENDIF}' + '{$IFDEF SYN_COMPILER_3_UP}' + ' fFontDummy.CharSet := DEFAULT_CHARSET;' + '{$ENDIF}' + ' fTextDrawer := TheTextDrawer.Create([fsBold], fFontDummy);' + ' Font.Assign(fFontDummy);' + ' Font.OnChange := SynFontChanged;' + ' ParentFont := False;' + ' ParentColor := False;' + ' TabStop := True;' + ' fInserting := True;' + ' fMaxScrollWidth := 1024;' + ' fScrollBars := ssBoth;' + ' fBorderStyle := bsSingle;' + ' fInsertCaret := ctVerticalLine;' + ' fOverwriteCaret := ctBlock;' + ' FSelectionMode := smNormal;' + ' fActiveSelectionMode := smNormal;' + ' fFocusList := TList.Create;' + ' fKbdHandler := TSynEditKbdHandler.Create;' + ' fKeystrokes := TSynEditKeyStrokes.Create(Self);' + ' fMarkList := TSynEditMarkList.Create(self);' + ' fMarkList.OnChange := MarkListChange;' + ' SetDefaultKeystrokes;' + ' fRightEdgeColor := clSilver;' + ' fWantReturns := True;' + ' fWantTabs := False;' + ' fTabWidth := 8;' + ' fLeftChar := 1;' + ' fTopLine := 1;' + ' fCaretX := 1;' + ' fLastCaretX := 1;' + ' fCaretY := 1;' + ' fBlockBegin.Char := 1;' + ' fBlockBegin.Line := 1;' + ' fBlockEnd := fBlockBegin;' + ' fOptions := SYNEDIT_DEFAULT_OPTIONS;' + ' fScrollTimer := TTimer.Create(Self);' + ' fScrollTimer.Enabled := False;' + ' fScrollTimer.Interval := 100;' + ' fScrollTimer.OnTimer := ScrollTimerHandler;' + '' + '{$IFDEF SYN_CLX}' + + ' InputKeys := [ikArrows, ikChars, ikReturns, ikEdit, ikNav, ikE' + + 'sc];' + '' + ' FHScrollBar := TSynEditScrollbar.Create(self);' + ' FHScrollBar.Kind := sbHorizontal;' + ' FHScrollBar.Height := CYHSCROLL;' + ' FHScrollBar.OnScroll := ScrollEvent;' + ' FVScrollBar := TSynEditScrollbar.Create(self);' + ' FVScrollBar.Kind := sbVertical;' + ' FVScrollBar.Width := CXVSCROLL;' + ' FVScrollBar.OnScroll := ScrollEvent;' + '' + ' // Set parent after BOTH scrollbars are created.' + ' FHScrollBar.Parent := Self;' + ' FHScrollBar.Color := clScrollBar;' + ' FVScrollBar.Parent := Self;' + ' FVScrollBar.Color := clScrollBar;' + '{$ENDIF}' + ' fScrollHintColor := clInfoBk;' + ' fScrollHintFormat := shfTopLineOnly;' + '' + ' SynFontChanged(nil);' + 'end;' + '' + '{$IFNDEF SYN_CLX}' + + 'procedure TCustomSynEdit.CreateParams(var Params: TCreateParams)' + + ';' + 'const' + ' BorderStyles: array[TBorderStyle] of DWORD = (0, WS_BORDER);' + ' ClassStylesOff = CS_VREDRAW or CS_HREDRAW;' + 'begin' + + ' // Clear WindowText to avoid it being used as Caption, or else' + + ' window creation will' + + ' // fail if it'#39's bigger than 64KB. It'#39's useless to set the Capt' + + 'ion anyway.' + ' StrDispose(WindowText);' + ' WindowText := nil;' + ' inherited CreateParams(Params);' + ' with Params do' + ' begin' + + ' WindowClass.Style := WindowClass.Style and not ClassStylesOf' + + 'f;' + + ' Style := Style or BorderStyles[fBorderStyle] or WS_CLIPCHILD' + + 'REN;' + '' + + ' if NewStyleControls and Ctl3D and (fBorderStyle = bsSingle) ' + + 'then' + ' begin' + ' Style := Style and not WS_BORDER;' + ' ExStyle := ExStyle or WS_EX_CLIENTEDGE;' + ' end;' + '' + '{$IFNDEF UNICODE}' + ' if not (csDesigning in ComponentState) then' + ' begin' + + ' // Necessary for unicode support, especially IME won'#39't wor' + + 'k else' + ' if Win32PlatformIsUnicode then' + ' WindowClass.lpfnWndProc := @DefWindowProcW;' + ' end;' + '{$ENDIF}' + ' end;' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.DecPaintLock;' + 'var' + ' vAuxPos: TDisplayCoord;' + 'begin' + ' Assert(fPaintLock > 0);' + ' Dec(fPaintLock);' + ' if (fPaintLock = 0) and HandleAllocated then' + ' begin' + ' if sfScrollbarChanged in fStateFlags then' + ' UpdateScrollbars;' + ' // Locks the caret inside the visible area' + + ' if WordWrap and ([scCaretX,scCaretY] * fStatusChanges <> [])' + + ' then' + ' begin' + ' vAuxPos := DisplayXY;' + + ' // This may happen in the last row of a line or in rows wh' + + 'ich length is' + + ' // greater than CharsInWindow (Tabs and Spaces are allowed' + + ' beyond' + ' // CharsInWindow while wrapping the lines)' + + ' if (vAuxPos.Column > CharsInWindow +1) and (CharsInWindow ' + + '> 0) then' + ' begin' + ' if fCaretAtEOL then' + ' fCaretAtEOL := False' + ' else' + ' begin' + ' if scCaretY in fStatusChanges then' + ' begin' + ' vAuxPos.Column := CharsInWindow + 1;' + ' fCaretX := DisplayToBufferPos(vAuxPos).Char;' + ' Include(fStatusChanges,scCaretX);' + ' UpdateLastCaretX;' + ' end;' + ' end;' + ' Include(fStateFlags, sfCaretChanged);' + ' end;' + ' end;' + ' if sfCaretChanged in fStateFlags then' + ' UpdateCaret;' + ' if fStatusChanges <> [] then' + ' DoOnStatusChange(fStatusChanges);' + ' end;' + 'end;' + '' + 'destructor TCustomSynEdit.Destroy;' + 'begin' + ' Highlighter := nil;' + ' if (fChainedEditor <> nil) or (fLines <> fOrigLines) then' + ' RemoveLinesPointer;' + '' + ' inherited Destroy;' + '' + ' // free listeners while other fields are still valid' + '' + + ' // do not use FreeAndNil, it first nils and then freey causing' + + ' problems with' + ' // code accessing fHookedCommandHandlers while destruction' + ' fHookedCommandHandlers.Free;' + ' fHookedCommandHandlers := nil;' + + ' // do not use FreeAndNil, it first nils and then frees causing' + + ' problems with' + ' // code accessing fPlugins while destruction' + ' fPlugins.Free;' + ' fPlugins := nil;' + '' + ' fMarkList.Free;' + ' fBookMarkOpt.Free;' + ' fKeyStrokes.Free;' + ' fKbdHandler.Free;' + ' fFocusList.Free;' + ' fSelectedColor.Free;' + ' fOrigUndoList.Free;' + ' fOrigRedoList.Free;' + ' fGutter.Free;' + ' fWordWrapGlyph.Free;' + ' fTextDrawer.Free;' + ' fInternalImage.Free;' + ' fFontDummy.Free;' + ' fOrigLines.Free;' + 'end;' + '' + 'function TCustomSynEdit.GetBlockBegin: TBufferCoord;' + 'begin' + ' if (fBlockEnd.Line < fBlockBegin.Line)' + + ' or ((fBlockEnd.Line = fBlockBegin.Line) and (fBlockEnd.Char ' + + '< fBlockBegin.Char))' + ' then' + ' Result := fBlockEnd' + ' else' + ' Result := fBlockBegin;' + 'end;' + '' + 'function TCustomSynEdit.GetBlockEnd: TBufferCoord;' + 'begin' + ' if (fBlockEnd.Line < fBlockBegin.Line)' + + ' or ((fBlockEnd.Line = fBlockBegin.Line) and (fBlockEnd.Char ' + + '< fBlockBegin.Char))' + ' then' + ' Result := fBlockBegin' + ' else' + ' Result := fBlockEnd;' + 'end;' + '' + 'procedure TCustomSynEdit.SynFontChanged(Sender: TObject);' + 'begin' + ' RecalcCharExtent;' + ' SizeOrFontChanged(True);' + 'end;' + '' + 'function TCustomSynEdit.GetFont: TFont;' + 'begin' + ' Result := inherited Font;' + 'end;' + '' + 'function TCustomSynEdit.GetLineText: UnicodeString;' + 'begin' + ' if (CaretY >= 1) and (CaretY <= Lines.Count) then' + ' Result := Lines[CaretY - 1]' + ' else' + ' Result := '#39#39';' + 'end;' + '' + 'function TCustomSynEdit.GetSelAvail: Boolean;' + 'begin' + ' Result := (fBlockBegin.Char <> fBlockEnd.Char) or' + + ' ((fBlockBegin.Line <> fBlockEnd.Line) and (fActiveSelectionM' + + 'ode <> smColumn));' + 'end;' + '' + 'function TCustomSynEdit.GetSelTabBlock: Boolean;' + 'begin' + + ' Result := (fBlockBegin.Line <> fBlockEnd.Line) and (fActiveSel' + + 'ectionMode <> smColumn);' + 'end;' + '' + 'function TCustomSynEdit.GetSelTabLine: Boolean;' + 'begin' + + ' Result := (BlockBegin.Char <= 1) and (BlockEnd.Char > length(L' + + 'ines[CaretY - 1])) and SelAvail;' + 'end;' + '' + 'function TCustomSynEdit.GetSelText: UnicodeString;' + '' + + ' function CopyPadded(const S: UnicodeString; Index, Count: Inte' + + 'ger): UnicodeString;' + ' var' + ' SrcLen: Integer;' + ' DstLen: Integer;' + ' i: Integer;' + ' P: PWideChar;' + ' begin' + ' SrcLen := Length(S);' + ' DstLen := Index + Count;' + ' if SrcLen >= DstLen then' + ' Result := Copy(S, Index, Count)' + ' else begin' + ' SetLength(Result, DstLen);' + ' P := PWideChar(Result);' + ' WStrCopy(P, PWideChar(Copy(S, Index, Count)));' + ' Inc(P, Length(S));' + ' for i := 0 to DstLen - Srclen - 1 do' + ' P[i] := #32;' + ' end;' + ' end;' + '' + + ' procedure CopyAndForward(const S: UnicodeString; Index, Count:' + + ' Integer; var P:' + ' PWideChar);' + ' var' + ' pSrc: PWideChar;' + ' SrcLen: Integer;' + ' DstLen: Integer;' + ' begin' + ' SrcLen := Length(S);' + ' if (Index <= SrcLen) and (Count > 0) then' + ' begin' + ' Dec(Index);' + ' pSrc := PWideChar(S) + Index;' + ' DstLen := Min(SrcLen - Index, Count);' + ' Move(pSrc^, P^, DstLen * sizeof(WideChar));' + ' Inc(P, DstLen);' + ' P^ := #0;' + ' end;' + ' end;' + '' + + ' function CopyPaddedAndForward(const S: UnicodeString; Index, C' + + 'ount: Integer;' + ' var P: PWideChar): Integer;' + ' var' + ' OldP: PWideChar;' + ' Len, i: Integer;' + ' begin' + ' Result := 0;' + ' OldP := P;' + ' CopyAndForward(S, Index, Count, P);' + ' Len := Count - (P - OldP);' + ' if not (eoTrimTrailingSpaces in Options) then' + ' begin' + ' for i := 0 to Len - 1 do' + ' P[i] := #32;' + ' Inc(P, Len);' + ' end' + ' else' + ' Result:= Len;' + ' end;' + '' + 'var' + ' First, Last, TotalLen: Integer;' + ' ColFrom, ColTo: Integer;' + ' I: Integer;' + ' l, r: Integer;' + ' s: UnicodeString;' + ' P: PWideChar;' + ' cRow: Integer;' + ' vAuxLineChar: TBufferCoord;' + ' vAuxRowCol: TDisplayCoord;' + ' vTrimCount: Integer;' + 'begin' + ' if not SelAvail then' + ' Result := '#39#39 + ' else begin' + ' ColFrom := BlockBegin.Char;' + ' First := BlockBegin.Line - 1;' + ' //' + ' ColTo := BlockEnd.Char;' + ' Last := BlockEnd.Line - 1;' + ' //' + ' TotalLen := 0;' + ' case fActiveSelectionMode of' + ' smNormal:' + ' if (First = Last) then' + ' Result := Copy(Lines[First], ColFrom, ColTo - ColFrom)' + ' else begin' + ' // step1: calculate total length of result string' + + ' TotalLen := Max(0, Length(Lines[First]) - ColFrom + 1)' + + ';' + ' for i := First + 1 to Last - 1 do' + ' Inc(TotalLen, Length(Lines[i]));' + ' Inc(TotalLen, ColTo - 1);' + ' Inc(TotalLen, Length(SLineBreak) * (Last - First));' + ' // step2: build up result string' + ' SetLength(Result, TotalLen);' + ' P := PWideChar(Result);' + ' CopyAndForward(Lines[First], ColFrom, MaxInt, P);' + '' + ' CopyAndForward(SLineBreak, 1, MaxInt, P);' + '' + ' for i := First + 1 to Last - 1 do' + ' begin' + ' CopyAndForward(Lines[i], 1, MaxInt, P);' + ' CopyAndForward(SLineBreak, 1, MaxInt, P);' + ' end;' + ' CopyAndForward(Lines[Last], 1, ColTo - 1, P);' + ' end;' + ' smColumn:' + ' begin' + ' with BufferToDisplayPos(BlockBegin) do' + ' begin' + ' First := Row;' + ' ColFrom := Column;' + ' end;' + ' with BufferToDisplayPos(BlockEnd) do' + ' begin' + ' Last := Row;' + ' ColTo := Column;' + ' end;' + ' if ColFrom > ColTo then' + ' SwapInt(ColFrom, ColTo);' + + ' // step1: pre-allocate string large enough for worst c' + + 'ase' + ' TotalLen := ((ColTo - ColFrom) + Length(sLineBreak)) *' + ' (Last - First +1);' + ' SetLength(Result, TotalLen);' + ' P := PWideChar(Result);' + '' + ' // step2: copy chunks to the pre-allocated string' + ' TotalLen := 0;' + ' for cRow := First to Last do' + ' begin' + ' vAuxRowCol.Row := cRow;' + ' vAuxRowCol.Column := ColFrom;' + ' vAuxLineChar := DisplayToBufferPos(vAuxRowCol);' + ' l := vAuxLineChar.Char;' + ' s := Lines[vAuxLineChar.Line - 1];' + ' vAuxRowCol.Column := ColTo;' + ' r := DisplayToBufferPos(vAuxRowCol).Char;' + '' + ' vTrimCount := CopyPaddedAndForward(s, l, r - l, P);' + + ' TotalLen := TotalLen + (r - l) - vTrimCount + Length' + + '(sLineBreak);' + ' CopyAndForward(sLineBreak, 1, MaxInt, P);' + ' end;' + ' SetLength(Result, TotalLen - Length(sLineBreak));' + ' end;' + ' smLine:' + ' begin' + ' // If block selection includes LastLine,' + + ' // line break code(s) of the last line will not be add' + + 'ed.' + ' // step1: calculate total length of result string' + ' for i := First to Last do' + + ' Inc(TotalLen, Length(Lines[i]) + Length(SLineBreak))' + + ';' + ' if Last = Lines.Count then' + ' Dec(TotalLen, Length(SLineBreak));' + ' // step2: build up result string' + ' SetLength(Result, TotalLen);' + ' P := PWideChar(Result);' + ' for i := First to Last - 1 do' + ' begin' + ' CopyAndForward(Lines[i], 1, MaxInt, P);' + ' CopyAndForward(SLineBreak, 1, MaxInt, P);' + ' end;' + ' CopyAndForward(Lines[Last], 1, MaxInt, P);' + ' if (Last + 1) < Lines.Count then' + ' CopyAndForward(SLineBreak, 1, MaxInt, P);' + ' end;' + ' end;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.SynGetText: UnicodeString;' + 'begin' + ' Result := Lines.Text;' + 'end;' + '' + 'function TCustomSynEdit.GetWordAtCursor: UnicodeString;' + 'begin' + ' Result:=GetWordAtRowCol(CaretXY);' + 'end;' + '' + 'procedure TCustomSynEdit.HideCaret;' + 'begin' + ' if sfCaretVisible in fStateFlags then' + '{$IFDEF SYN_CLX}' + ' kTextDrawer.HideCaret(Self);' + '{$ELSE}' + ' if Windows.HideCaret(Handle) then' + '{$ENDIF}' + ' Exclude(fStateFlags, sfCaretVisible);' + 'end;' + '' + 'procedure TCustomSynEdit.IncPaintLock;' + 'begin' + ' inc(fPaintLock);' + 'end;' + '' + 'procedure TCustomSynEdit.InvalidateGutter;' + 'begin' + ' InvalidateGutterLines(-1, -1);' + 'end;' + '' + 'procedure TCustomSynEdit.InvalidateGutterLine(aLine: Integer);' + 'begin' + ' if (aLine < 1) or (aLine > Lines.Count) then' + ' Exit;' + '' + ' InvalidateGutterLines(aLine, aLine);' + 'end;' + '' + + 'procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLi' + + 'ne: integer);' + + '// note: FirstLine and LastLine don'#39't need to be in correct orde' + + 'r' + 'var' + ' rcInval: TRect;' + 'begin' + ' if Visible and HandleAllocated then' + ' if (FirstLine = -1) and (LastLine = -1) then' + ' begin' + ' rcInval := Rect(0, 0, fGutterWidth, ClientHeight);' + '{$IFDEF SYN_CLX}' + ' with GetClientRect do' + ' OffsetRect(rcInval, Left, Top);' + '{$ENDIF}' + ' if sfLinesChanging in fStateFlags then' + ' UnionRect(fInvalidateRect, fInvalidateRect, rcInval)' + ' else' + ' InvalidateRect(rcInval, False);' + ' end' + ' else begin' + ' { find the visible lines first }' + ' if (LastLine < FirstLine) then' + ' SwapInt(LastLine, FirstLine);' + ' if WordWrap then' + ' begin' + ' FirstLine := LineToRow(FirstLine);' + ' if LastLine <= Lines.Count then' + ' LastLine := LineToRow(LastLine)' + ' else' + ' LastLine := MaxInt;' + ' end;' + ' FirstLine := Max(FirstLine, TopLine);' + ' LastLine := Min(LastLine, TopLine + LinesInWindow);' + ' { any line visible? }' + ' if (LastLine >= FirstLine) then' + ' begin' + ' rcInval := Rect(0, fTextHeight * (FirstLine - TopLine),' + ' fGutterWidth, fTextHeight * (LastLine - TopLine + 1));' + '{$IFDEF SYN_CLX}' + ' with GetClientRect do' + ' OffsetRect(rcInval, Left, Top);' + '{$ENDIF}' + ' if sfLinesChanging in fStateFlags then' + ' UnionRect(fInvalidateRect, fInvalidateRect, rcInval)' + ' else' + ' InvalidateRect(rcInval, False);' + ' end;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: in' + + 'teger);' + + '// note: FirstLine and LastLine don'#39't need to be in correct orde' + + 'r' + 'var' + ' rcInval: TRect;' + 'begin' + ' if Visible and HandleAllocated then' + ' if (FirstLine = -1) and (LastLine = -1) then' + ' begin' + ' rcInval := ClientRect;' + ' Inc(rcInval.Left, fGutterWidth);' + ' if sfLinesChanging in fStateFlags then' + ' UnionRect(fInvalidateRect, fInvalidateRect, rcInval)' + ' else' + ' InvalidateRect(rcInval, False);' + ' end' + ' else begin' + ' FirstLine := Max(FirstLine,1);' + ' LastLine := Max(LastLine,1);' + ' { find the visible lines first }' + ' if (LastLine < FirstLine) then' + ' SwapInt(LastLine, FirstLine);' + '' + ' if LastLine >= Lines.Count then' + + ' LastLine := MaxInt; // paint empty space beyond last lin' + + 'e' + '' + ' if WordWrap then' + ' begin' + ' FirstLine := LineToRow(FirstLine);' + ' // Could avoid this conversion if (First = Last) and' + + ' // (Length < CharsInWindow) but the dependency isn'#39't wor' + + 'th IMO.' + ' if LastLine < Lines.Count then' + ' LastLine := LineToRow(LastLine + 1) - 1;' + ' end;' + '' + + ' // TopLine is in display coordinates, so FirstLine and Las' + + 'tLine must be' + ' // converted previously.' + ' FirstLine := Max(FirstLine, TopLine);' + ' LastLine := Min(LastLine, TopLine + LinesInWindow);' + '' + ' { any line visible? }' + ' if (LastLine >= FirstLine) then' + ' begin' + + ' rcInval := Rect(fGutterWidth, fTextHeight * (FirstLine -' + + ' TopLine),' + ' ClientWidth, fTextHeight * (LastLine - TopLine + 1));' + '{$IFDEF SYN_CLX}' + ' with GetClientRect do' + ' OffsetRect(rcInval, Left, Top);' + '{$ENDIF}' + ' if sfLinesChanging in fStateFlags then' + ' UnionRect(fInvalidateRect, fInvalidateRect, rcInval)' + ' else' + ' InvalidateRect(rcInval, False);' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.InvalidateSelection;' + 'begin' + ' InvalidateLines(BlockBegin.Line, BlockEnd.Line);' + 'end;' + '' + '{$IFDEF SYN_COMPILER_5}' + + 'function TryStrToInt(const S: string; out Value: Integer): Boole' + + 'an;' + 'var' + ' E: Integer;' + 'begin' + ' Val(S, Value, E);' + ' Result := E = 0;' + 'end;' + '{$ENDIF}' + '' + + 'procedure TCustomSynEdit.KeyUp(var Key: Word; Shift: TShiftState' + + ');' + '{$IFDEF SYN_LINUX}' + 'var' + ' Code: Byte;' + '{$ENDIF}' + '{$IFNDEF SYN_CLX}' + 'var' + ' CharCode: Integer;' + ' KeyMsg: TWMKey;' + '{$ENDIF}' + 'begin' + ' {$IFDEF SYN_LINUX}' + + ' // uniform Keycode: key has the same value wether Shift is pre' + + 'ssed or not' + ' if Key <= 255 then' + ' begin' + ' Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key);' + ' Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0);' + + ' if AnsiChar(Key) in ['#39'a'#39'..'#39'z'#39'] then Key := Ord(UpCase(AnsiCh' + + 'ar(Key)));' + ' end;' + ' {$ENDIF}' + '' + ' {$IFNDEF SYN_CLX}' + + ' if (ssAlt in Shift) and (Key >= VK_NUMPAD0) and (Key <= VK_NUM' + + 'PAD9) then' + + ' FCharCodeString := FCharCodeString + IntToStr(Key - VK_NUMPA' + + 'D0);' + '' + ' if Key = VK_MENU then' + ' begin' + + ' if (FCharCodeString <> '#39#39') and TryStrToInt(FCharCodeString, ' + + 'CharCode) and' + ' (CharCode >= 256) and (CharCode <= 65535) then' + ' begin' + ' KeyMsg.Msg := WM_CHAR;' + ' KeyMsg.CharCode := CharCode;' + ' KeyMsg.Unused := 0;' + ' KeyMsg.KeyData := 0;' + ' DoKeyPressW(KeyMsg);' + ' FIgnoreNextChar := True;' + ' end;' + ' FCharCodeString := '#39#39';' + ' end;' + ' {$ENDIF}' + '' + ' inherited;' + ' fKbdHandler.ExecuteKeyUp(Self, Key, Shift);' + 'end;' + '' + + 'procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftSta' + + 'te);' + 'var' + ' Data: pointer;' + ' C: WideChar;' + ' Cmd: TSynEditorCommand;' + ' {$IFDEF SYN_LINUX}' + ' Code: Byte;' + ' {$ENDIF}' + 'begin' + ' {$IFDEF SYN_LINUX}' + + ' // uniform Keycode: key has the same value wether Shift is pre' + + 'ssed or not' + ' if Key <= 255 then' + ' begin' + ' Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key);' + ' Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0);' + + ' if AnsiChar(Key) in ['#39'a'#39'..'#39'z'#39'] then Key := Ord(UpCase(AnsiCh' + + 'ar(Key)));' + ' end;' + ' {$ENDIF}' + ' inherited;' + ' fKbdHandler.ExecuteKeyDown(Self, Key, Shift);' + '' + ' Data := nil;' + ' C := #0;' + ' try' + ' Cmd := TranslateKeyCode(Key, Shift, Data);' + ' if Cmd <> ecNone then begin' + ' Key := 0; // eat it.' + ' Include(fStateFlags, sfIgnoreNextChar);' + ' CommandProcessor(Cmd, C, Data);' + ' end' + ' else' + ' Exclude(fStateFlags, sfIgnoreNextChar);' + ' finally' + ' if Data <> nil then' + ' FreeMem(Data);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.Loaded;' + 'begin' + ' inherited Loaded;' + ' GutterChanged(Self);' + ' UpdateScrollBars;' + 'end;' + '' + 'procedure TCustomSynEdit.KeyPress(var Key: Char);' + '{$IFDEF SYN_CLX}' + 'var' + ' KeyW: WideChar;' + '{$ENDIF}' + 'begin' + '{$IFDEF SYN_CLX}' + ' KeyW := WideChar(Key);' + ' DoKeyPressW(KeyW);' + ' if KeyW > High(AnsiChar) then' + ' Key := #0' + ' else' + ' Key := AnsiChar(KeyW);' + '{$ELSE}' + ' // for Windows, don'#39't do anything here' + '{$ENDIF}' + 'end;' + '' + '{$IFDEF SYN_CLX}' + 'procedure TCustomSynEdit.DoKeyPressW(var Key: WideChar);' + 'begin' + ' if (csNoStdEvents in ControlStyle) then Exit;' + '' + ' if (Key <> #0) and Assigned(FOnKeyPressW) then' + ' FOnKeyPressW(Self, Key);' + '' + ' if WideChar(Key) <> #0 then' + ' KeyPressW(Key);' + 'end;' + '{$ELSE}' + 'type' + ' TAccessWinControl = class(TWinControl);' + '' + + '{.$MESSAGE '#39'Check what must be adapted in DoKeyPressW and relate' + + 'd methods'#39'}' + 'procedure TCustomSynEdit.DoKeyPressW(var Message: TWMKey);' + 'var' + ' Form: TCustomForm;' + ' Key: WideChar;' + 'begin' + ' if FIgnoreNextChar then' + ' begin' + ' FIgnoreNextChar := False;' + ' Exit;' + ' end;' + '' + ' Key := WideChar(Message.CharCode);' + '' + ' Form := GetParentForm(Self);' + + ' if (Form <> nil) and (Form <> TWinControl(Self)) and Form.KeyP' + + 'review and' + + ' (Key <= High(AnsiChar)) and TAccessWinControl(Form).DoKeyPre' + + 'ss(Message)' + ' then' + ' Exit;' + ' Key := WideChar(Message.CharCode);' + '' + ' if (csNoStdEvents in ControlStyle) then Exit;' + '' + ' if Assigned(FOnKeyPressW) then' + ' FOnKeyPressW(Self, Key);' + '' + ' if WideChar(Key) <> #0 then' + ' KeyPressW(Key);' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.KeyPressW(var Key: WideChar);' + 'begin' + ' // don'#39't fire the event if key is to be ignored' + ' if not (sfIgnoreNextChar in fStateFlags) then' + ' begin' + ' fKbdHandler.ExecuteKeyPress(Self, Key);' + ' CommandProcessor(ecChar, Key, nil);' + ' end' + ' else' + ' // don'#39't ignore further keys' + ' Exclude(fStateFlags, sfIgnoreNextChar);' + 'end;' + '' + + 'function TCustomSynEdit.LeftSpaces(const Line: UnicodeString): I' + + 'nteger;' + 'begin' + ' Result := LeftSpacesEx(Line, False);' + 'end;' + '' + + 'function TCustomSynEdit.LeftSpacesEx(const Line: UnicodeString; ' + + 'WantTabs: Boolean): Integer;' + 'var' + ' p: PWideChar;' + 'begin' + ' p := PWideChar(Line);' + ' if Assigned(p) and (eoAutoIndent in fOptions) then' + ' begin' + ' Result := 0;' + ' while (p^ >= #1) and (p^ <= #32) do' + ' begin' + ' if (p^ = #9) and WantTabs then' + ' Inc(Result, TabWidth)' + ' else' + ' Inc(Result);' + ' Inc(p);' + ' end;' + ' end' + ' else' + ' Result := 0;' + 'end;' + '' + + 'function TCustomSynEdit.GetLeftSpacing(CharCount: Integer; WantT' + + 'abs: Boolean): UnicodeString;' + 'begin' + + ' if WantTabs and not(eoTabsToSpaces in Options) and (CharCount ' + + '>= TabWidth) then' + ' Result := UnicodeStringOfChar(#9, CharCount div TabWidth) +' + ' UnicodeStringOfChar(#32, CharCount mod TabWidth)' + ' else' + ' Result := UnicodeStringOfChar(#32, CharCount);' + 'end;' + '' + 'procedure TCustomSynEdit.LinesChanging(Sender: TObject);' + 'begin' + ' Include(fStateFlags, sfLinesChanging);' + 'end;' + '' + 'procedure TCustomSynEdit.LinesChanged(Sender: TObject);' + 'var' + ' vOldMode: TSynSelectionMode;' + 'begin' + ' Exclude(fStateFlags, sfLinesChanging);' + ' if HandleAllocated then' + ' begin' + ' UpdateScrollBars;' + ' vOldMode := fActiveSelectionMode;' + ' SetBlockBegin(CaretXY);' + ' fActiveSelectionMode := vOldMode;' + ' InvalidateRect(fInvalidateRect, False);' + ' FillChar(fInvalidateRect, SizeOf(TRect), 0);' + ' if fGutter.ShowLineNumbers and fGutter.AutoSize then' + ' fGutter.AutoSizeDigitCount(Lines.Count);' + ' if not (eoScrollPastEof in Options) then' + ' TopLine := TopLine;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.MouseDown(Button: TMouseButton; Shift: ' + + 'TShiftState;' + ' X, Y: Integer);' + 'var' + ' bWasSel: Boolean;' + ' bStartDrag: Boolean;' + ' TmpBegin, TmpEnd: TBufferCoord;' + 'begin' + ' {$IFDEF SYN_CLX}' + ' if not PtInRect(GetClientRect, Point(X,Y)) then' + ' Exit;' + ' {$ENDIF}' + '' + ' TmpBegin := FBlockBegin;' + ' TmpEnd := FBlockEnd;' + '' + ' bWasSel := False;' + ' bStartDrag := False;' + ' if Button = mbLeft then' + ' begin' + ' if SelAvail then' + ' begin' + ' //remember selection state, as it will be cleared later' + ' bWasSel := True;' + ' fMouseDownX := X;' + ' fMouseDownY := Y;' + ' end;' + ' end;' + '' + ' inherited MouseDown(Button, Shift, X, Y);' + '' + ' if (Button = mbLeft) and (ssDouble in Shift) then Exit;' + '' + ' fKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y);' + '' + ' if (Button in [mbLeft, mbRight]) then' + ' begin' + ' if Button = mbRight then' + ' begin' + ' if (eoRightMouseMovesCursor in Options) and' + + ' (SelAvail and not IsPointInSelection(DisplayToBufferPos' + + '(PixelsToRowColumn(X, Y)))' + ' or not SelAvail) then' + ' begin' + ' InvalidateSelection;' + ' FBlockEnd := FBlockBegin;' + ' ComputeCaret(X, Y);' + ' end' + ' else' + ' Exit;' + ' end' + ' else' + ' ComputeCaret(X, Y);' + ' end;' + '' + ' if Button = mbLeft then' + ' begin' + + ' //I couldn'#39't track down why, but sometimes (and definately n' + + 'ot all the time)' + + ' //the block positioning is lost. This makes sure that the b' + + 'lock is' + + ' //maintained in case they started a drag operation on the bl' + + 'ock' + ' FBlockBegin := TmpBegin;' + ' FBlockEnd := TmpEnd;' + '' + ' MouseCapture := True;' + + ' //if mousedown occurred in selected block begin drag operati' + + 'on' + ' Exclude(fStateFlags, sfWaitForDragging);' + + ' if bWasSel and (eoDragDropEditing in fOptions) and (X >= fGu' + + 'tterWidth + 2)' + + ' and (SelectionMode = smNormal) and IsPointInSelection(Disp' + + 'layToBufferPos(PixelsToRowColumn(X, Y))) then' + ' begin' + ' bStartDrag := True' + ' end;' + ' end;' + '' + ' if (Button = mbLeft) and bStartDrag then' + ' Include(fStateFlags, sfWaitForDragging)' + ' else' + ' begin' + ' if not (sfDblClicked in fStateFlags) then' + ' begin' + ' if ssShift in Shift then' + + ' //BlockBegin and BlockEnd are restored to their original' + + ' position in the' + + ' //code from above and SetBlockEnd will take care of prop' + + 'er invalidation' + ' SetBlockEnd(CaretXY)' + ' else' + ' begin' + + ' if (eoAltSetsColumnMode in Options) and (fActiveSelectio' + + 'nMode <> smLine) then' + ' begin' + ' if ssAlt in Shift then' + ' SelectionMode := smColumn' + ' else' + ' SelectionMode := smNormal;' + ' end;' + + ' //Selection mode must be set before calling SetBlockBegi' + + 'n' + ' SetBlockBegin(CaretXY);' + ' end;' + ' end;' + ' end;' + '' + ' if (X < fGutterWidth) then' + ' Include(fStateFlags, sfPossibleGutterClick);' + + ' if (sfPossibleGutterClick in fStateFlags) and (Button = mbRigh' + + 't) then' + ' begin' + ' DoOnGutterClick(Button, X, Y)' + ' end;' + '' + ' SetFocus;' + '{$IFNDEF SYN_CLX}' + ' Windows.SetFocus(Handle);' + '{$ENDIF}' + 'end;' + '' + + 'procedure TCustomSynEdit.MouseMove(Shift: TShiftState; X, Y: Int' + + 'eger);' + 'var' + ' P: TDisplayCoord;' + 'begin' + '{$IFDEF SYN_CLX}' + ' if not InDragDropOperation then' + ' UpdateMouseCursor;' + '{$ENDIF}' + ' inherited MouseMove(Shift, x, y);' + ' if MouseCapture and (sfWaitForDragging in fStateFlags) then' + ' begin' + ' if (Abs(fMouseDownX - X) >= GetSystemMetrics(SM_CXDRAG))' + + ' or (Abs(fMouseDownY - Y) >= GetSystemMetrics(SM_CYDRAG)) t' + + 'hen' + ' begin' + ' Exclude(fStateFlags, sfWaitForDragging);' + ' BeginDrag(False);' + '{$IFDEF SYN_CLX}' + ' MouseCapture := False;' + '{$ENDIF}' + ' end;' + ' end' + ' else if (ssLeft in Shift) and MouseCapture then' + ' begin' + ' // should we begin scrolling?' + ' ComputeScroll(X, Y);' + ' { compute new caret }' + ' P := PixelsToNearestRowColumn(X, Y);' + ' P.Row := MinMax(P.Row, 1, DisplayLineCount);' + ' if fScrollDeltaX <> 0 then' + ' P.Column := DisplayX;' + ' if fScrollDeltaY <> 0 then' + ' P.Row := DisplayY;' + ' InternalCaretXY := DisplayToBufferPos(P);' + ' BlockEnd := CaretXY;' + + ' if (sfPossibleGutterClick in fStateFlags) and (FBlockBegin.L' + + 'ine <> CaretXY.Line) then' + ' Include(fStateFlags, sfGutterDragging);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ScrollTimerHandler(Sender: TObject);' + 'var' + ' iMousePos: TPoint;' + ' C: TDisplayCoord;' + ' X, Y: Integer;' + ' vCaret: TBufferCoord;' + 'begin' + ' GetCursorPos( iMousePos );' + ' iMousePos := ScreenToClient( iMousePos );' + ' C := PixelsToRowColumn( iMousePos.X, iMousePos.Y );' + ' C.Row := MinMax(C.Row, 1, DisplayLineCount);' + ' if fScrollDeltaX <> 0 then' + ' begin' + ' LeftChar := LeftChar + fScrollDeltaX;' + ' X := LeftChar;' + ' if fScrollDeltaX > 0 then // scrolling right?' + ' Inc(X, CharsInWindow);' + ' C.Column := X;' + ' end;' + ' if fScrollDeltaY <> 0 then' + ' begin' + '{$IFDEF SYN_CLX}' + ' if ssShift in Application.KeyState then' + '{$ELSE}' + ' if GetKeyState(SYNEDIT_SHIFT) < 0 then' + '{$ENDIF}' + ' TopLine := TopLine + fScrollDeltaY * LinesInWindow' + ' else' + ' TopLine := TopLine + fScrollDeltaY;' + ' Y := TopLine;' + ' if fScrollDeltaY > 0 then // scrolling down?' + ' Inc(Y, LinesInWindow - 1);' + ' C.Row := MinMax(Y, 1, DisplayLineCount);' + ' end;' + ' vCaret := DisplayToBufferPos(C);' + ' if (CaretX <> vCaret.Char) or (CaretY <> vCaret.Line) then' + ' begin' + ' // changes to line / column in one go' + ' IncPaintLock;' + ' try' + ' InternalCaretXY := vCaret;' + + ' // if MouseCapture is True we'#39're changing selection. other' + + 'wise we'#39're dragging' + ' if MouseCapture then' + ' SetBlockEnd(CaretXY);' + ' finally' + ' DecPaintLock;' + ' end;' + ' end;' + ' ComputeScroll(iMousePos.x, iMousePos.y);' + 'end;' + '' + + 'procedure TCustomSynEdit.MouseUp(Button: TMouseButton; Shift: TS' + + 'hiftState;' + ' X, Y: Integer);' + 'begin' + ' inherited MouseUp(Button, Shift, X, Y);' + ' fKbdHandler.ExecuteMouseUp(Self, Button, Shift, X, Y);' + '' + ' fScrollTimer.Enabled := False;' + + ' if (Button = mbRight) and (Shift = [ssRight]) and Assigned(Pop' + + 'upMenu) then' + ' exit;' + ' MouseCapture := False;' + + ' if (sfPossibleGutterClick in fStateFlags) and (X < fGutterWidt' + + 'h) and (Button <> mbRight) then' + ' begin' + ' DoOnGutterClick(Button, X, Y)' + ' end' + + ' else if fStateFlags * [sfDblClicked, sfWaitForDragging] = [sfW' + + 'aitForDragging] then' + ' begin' + ' ComputeCaret(X, Y);' + ' if not(ssShift in Shift) then' + ' SetBlockBegin(CaretXY);' + ' SetBlockEnd(CaretXY);' + ' Exclude(fStateFlags, sfWaitForDragging);' + ' end;' + ' Exclude(fStateFlags, sfDblClicked);' + ' Exclude(fStateFlags, sfPossibleGutterClick);' + ' Exclude(fStateFlags, sfGutterDragging);' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnGutterClick(Button: TMouseButton; X' + + ', Y: Integer);' + 'var' + ' i : Integer;' + ' offs : Integer;' + ' line : Integer;' + ' allmrk: TSynEditMarks;' + ' mark : TSynEditMark;' + 'begin' + ' if Assigned(fOnGutterClick) then' + ' begin' + ' line := DisplayToBufferPos(PixelsToRowColumn(X,Y)).Line;' + ' if line <= Lines.Count then' + ' begin' + ' Marks.GetMarksForLine(line, allmrk);' + ' offs := 0;' + ' mark := nil;' + ' for i := 1 to MAX_MARKS do' + ' begin' + ' if assigned(allmrk[i]) then' + ' begin' + ' Inc(offs, BookMarkOptions.XOffset);' + ' if X < offs then' + ' begin' + ' mark := allmrk[i];' + ' break;' + ' end;' + ' end;' + ' end; //for' + ' fOnGutterClick(Self, Button, X, Y, line, mark);' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.Paint;' + 'var' + ' rcClip, rcDraw: TRect;' + ' nL1, nL2, nC1, nC2: Integer;' + '{$IFDEF SYN_CLX}' + ' iRestoreViewPort: Boolean;' + ' iClientRect: TRect;' + ' iClientRegion: QRegionH;' + ' iClip: QRegionH;' + '{$ENDIF}' + 'begin' + '{$IFDEF SYN_CLX}' + ' { draws the lower-right corner of the scrollbars }' + ' if FHScrollBar.Visible and FVScrollBar.Visible then' + ' begin' + ' Canvas.Brush.Color := FHScrollBar.Color;' + ' Canvas.FillRect(Bounds(FVScrollBar.Left, FHScrollBar.Top,' + ' FVScrollBar.Width, FHScrollBar.Height));' + ' end;' + ' { validates the NC area }' + ' iClientRect := GetClientRect;' + + ' iClientRegion := QRegion_create(@iClientRect, QRegionRegionTyp' + + 'e_Rectangle);' + ' iClip := QPainter_clipRegion(Canvas.Handle);' + ' QRegion_intersect(iClip, iClip, iClientRegion);' + ' QRegion_destroy(iClientRegion);' + ' if BorderStyle <> bsNone then' + ' begin' + ' { draws the border }' + ' iClientRect := Rect( 0, 0, Width, Height );' + ' QClxDrawUtil_DrawWinPanel(Canvas.Handle, @iClientRect,' + ' Palette.ColorGroup(cgActive), True, QBrushH(0));' + ' { sets transformation to ignore NC area }' + ' OffsetRect(iClientRect, FrameWidth, FrameWidth);' + ' QPainter_setViewport(Canvas.Handle, @iClientRect);' + ' iRestoreViewPort := True;' + ' end' + ' else' + ' iRestoreViewPort := False;' + ' { Compute the invalidated rect. }' + ' rcClip := Canvas.ClipRect;' + ' OffsetRect(rcClip, - iClientRect.Left, - iClientRect.Top);' + '{$ELSE}' + + ' // Get the invalidated rect. Compute the invalid area in lines' + + ' / columns.' + ' rcClip := Canvas.ClipRect;' + '{$ENDIF}' + ' // columns' + ' nC1 := LeftChar;' + ' if (rcClip.Left > fGutterWidth + 2) then' + ' Inc(nC1, (rcClip.Left - fGutterWidth - 2) div CharWidth);' + ' nC2 := LeftChar +' + + ' (rcClip.Right - fGutterWidth - 2 + CharWidth - 1) div CharWi' + + 'dth;' + ' // lines' + ' nL1 := Max(TopLine + rcClip.Top div fTextHeight, TopLine);' + + ' nL2 := MinMax(TopLine + (rcClip.Bottom + fTextHeight - 1) div ' + + 'fTextHeight,' + ' 1, DisplayLineCount);' + ' // Now paint everything while the caret is hidden.' + ' HideCaret;' + ' try' + + ' // First paint the gutter area if it was (partly) invalidate' + + 'd.' + ' if (rcClip.Left < fGutterWidth) then' + ' begin' + ' rcDraw := rcClip;' + ' rcDraw.Right := fGutterWidth;' + ' PaintGutter(rcDraw, nL1, nL2);' + ' end;' + ' // Then paint the text area if it was (partly) invalidated.' + ' if (rcClip.Right > fGutterWidth) then' + ' begin' + ' rcDraw := rcClip;' + ' rcDraw.Left := Max(rcDraw.Left, fGutterWidth);' + ' PaintTextLines(rcDraw, nL1, nL2, nC1, nC2);' + ' end;' + ' PluginsAfterPaint(Canvas, rcClip, nL1, nL2);' + '{$IFDEF SYN_CLX}' + ' if iRestoreViewPort then' + ' QPainter_setViewport(Canvas.Handle, 0, 0, Width, Height);' + '{$ENDIF}' + ' // If there is a custom paint handler call it.' + ' DoOnPaint;' + ' DoOnPaintTransient(ttAfter);' + ' finally' + ' UpdateCaret;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.PaintGutter(const AClip: TRect;' + ' const aFirstRow, aLastRow: Integer);' + '' + + ' procedure DrawMark(aMark: TSynEditMark; var aGutterOff: Intege' + + 'r;' + ' aMarkRow: Integer);' + ' begin' + + ' if (not aMark.InternalImage) and Assigned(fBookMarkOpt.Bookm' + + 'arkImages) then' + ' begin' + + ' if aMark.ImageIndex <= fBookMarkOpt.BookmarkImages.Count t' + + 'hen' + ' begin' + + ' if aMark.IsBookmark = BookMarkOptions.DrawBookmarksFirst' + + ' then' + ' aGutterOff := 0' + ' else if aGutterOff = 0 then' + ' aGutterOff := fBookMarkOpt.XOffset;' + ' with fBookMarkOpt do' + ' BookmarkImages.Draw(Canvas, LeftMargin + aGutterOff,' + + ' (aMarkRow - TopLine) * fTextHeight, aMark.ImageIndex' + + ');' + ' Inc(aGutterOff, fBookMarkOpt.XOffset);' + ' end;' + ' end' + ' else begin' + ' if aMark.ImageIndex in [0..9] then' + ' begin' + ' if not Assigned(fInternalImage) then' + ' begin' + ' fInternalImage := TSynInternalImage.Create(HINSTANCE,' + ' '#39'SynEditInternalImages'#39', 10);' + ' end;' + ' if aGutterOff = 0 then' + ' begin' + ' fInternalImage.Draw(Canvas, aMark.ImageIndex,' + ' fBookMarkOpt.LeftMargin + aGutterOff,' + ' (aMarkRow - TopLine) * fTextHeight, fTextHeight);' + ' end;' + ' Inc(aGutterOff, fBookMarkOpt.XOffset);' + ' end;' + ' end;' + ' end;' + '' + 'var' + ' cLine: Integer;' + ' cMark: Integer;' + ' rcLine: TRect;' + ' aGutterOffs: PIntArray;' + ' bHasOtherMarks: Boolean;' + ' s: UnicodeString;' + ' vFirstLine: Integer;' + ' vLastLine: Integer;' + ' vMarkRow: Integer;' + ' vGutterRow: Integer;' + ' vLineTop: Integer;' + '{$IFNDEF SYN_CLX}' + ' dc: HDC;' + ' TextSize: TSize;' + '{$ENDIF}' + 'begin' + ' vFirstLine := RowToLine(aFirstRow);' + ' vLastLine := RowToLine(aLastRow);' + ' //todo: Does the following comment still apply?' + + ' // Changed to use fTextDrawer.BeginDrawing and fTextDrawer.End' + + 'Drawing only' + + ' // when absolutely necessary. Note: Never change brush / pen ' + + '/ font of the' + + ' // canvas inside of this block (only through methods of fTextD' + + 'rawer)!' + + ' // If we have to draw the line numbers then we don'#39't want to e' + + 'rase' + + ' // the background first. Do it line by line with TextRect inst' + + 'ead' + ' // and fill only the area after the last visible line.' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' dc := Canvas.Handle;' + '{$ENDIF}' + '' + ' if fGutter.Gradient then' + + ' SynDrawGradient(Canvas, fGutter.GradientStartColor, fGutter.' + + 'GradientEndColor,' + + ' fGutter.GradientSteps, Rect(0, 0, fGutterWidth, ClientHeig' + + 'ht), True);' + '' + ' Canvas.Brush.Color := fGutter.Color;' + '' + ' if fGutter.ShowLineNumbers then' + ' begin' + ' if fGutter.UseFontStyle then' + ' fTextDrawer.SetBaseFont(fGutter.Font)' + ' else' + ' fTextDrawer.Style := [];' + '{$IFDEF SYN_CLX}' + ' fTextDrawer.BeginDrawing(canvas);' + '{$ELSE}' + ' fTextDrawer.BeginDrawing(dc);' + '{$ENDIF}' + ' try' + ' if fGutter.UseFontStyle then' + ' fTextDrawer.SetForeColor(fGutter.Font.Color)' + ' else' + ' fTextDrawer.SetForeColor(Self.Font.Color);' + ' fTextDrawer.SetBackColor(fGutter.Color);' + '' + ' // prepare the rect initially' + ' rcLine := AClip;' + ' rcLine.Right := Max(rcLine.Right, fGutterWidth - 2);' + ' rcLine.Bottom := rcLine.Top;' + '' + ' for cLine := vFirstLine to vLastLine do' + ' begin' + ' vLineTop := (LineToRow(cLine) - TopLine) * fTextHeight;' + ' if WordWrap and not fGutter.Gradient then' + ' begin' + + ' // erase space between wrapped lines (from previous li' + + 'ne to current one)' + ' rcLine.Top := rcLine.Bottom;' + ' rcLine.Bottom := vLineTop;' + ' with rcLine do' + + ' fTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLin' + + 'e, '#39#39', 0);' + ' end;' + ' // next line rect' + ' rcLine.Top := vLineTop;' + ' rcLine.Bottom := rcLine.Top + fTextHeight;' + '' + ' s := fGutter.FormatLineNumber(cLine);' + ' if Assigned(OnGutterGetText) then' + ' OnGutterGetText(Self, cLine, s);' + '{$IFDEF SYN_CLX}' + ' if fGutter.Gradient then' + ' Canvas.Brush.Style := bsClear' + ' else' + ' Canvas.Brush.Style := bsSolid;' + ' Canvas.FillRect(rcLine);' + + ' Canvas.TextRect(rcLine, fGutter.LeftOffset, rcLine.Top, ' + + 's);' + ' // restore brush' + ' if fGutter.Gradient then' + ' Canvas.Brush.Style := bsSolid;' + '{$ELSE}' + ' TextSize := GetTextSize(DC, PWideChar(s), Length(s));' + ' if fGutter.Gradient then' + ' begin' + ' SetBkMode(DC, TRANSPARENT);' + + ' Windows.ExtTextOutW(DC, (fGutterWidth - fGutter.RightO' + + 'ffset - 2) - TextSize.cx,' + + ' rcLine.Top + ((fTextHeight - Integer(TextSize.cy)) d' + + 'iv 2), 0,' + ' @rcLine, PWideChar(s), Length(s), nil);' + ' SetBkMode(DC, OPAQUE);' + ' end' + ' else' + + ' Windows.ExtTextOutW(DC, (fGutterWidth - fGutter.RightO' + + 'ffset - 2) - TextSize.cx,' + + ' rcLine.Top + ((fTextHeight - Integer(TextSize.cy)) d' + + 'iv 2), ETO_OPAQUE,' + ' @rcLine, PWideChar(s), Length(s), nil);' + '{$ENDIF}' + ' end;' + ' // now erase the remaining area if any' + + ' if (AClip.Bottom > rcLine.Bottom) and not fGutter.Gradient' + + ' then' + ' begin' + ' rcLine.Top := rcLine.Bottom;' + ' rcLine.Bottom := AClip.Bottom;' + ' with rcLine do' + + ' fTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine,' + + ' '#39#39', 0);' + ' end;' + ' finally' + ' fTextDrawer.EndDrawing;' + ' if fGutter.UseFontStyle then' + ' fTextDrawer.SetBaseFont(Self.Font);' + ' end;' + ' end' + ' else if not fGutter.Gradient then' + ' Canvas.FillRect(AClip);' + '' + '{$IFDEF SYN_WIN32}' + ' // draw word wrap glyphs transparently over gradient' + ' if fGutter.Gradient then' + ' Canvas.Brush.Style := bsClear;' + '{$ENDIF}' + ' // paint wrapped line glyphs' + ' if WordWrap and fWordWrapGlyph.Visible then' + ' for cLine := aFirstRow to aLastRow do' + ' if LineToRow(RowToLine(cLine)) <> cLine then' + ' fWordWrapGlyph.Draw(Canvas,' + + ' (fGutterWidth - fGutter.RightOffset ' + + '- 2) - fWordWrapGlyph.Width,' + + ' (cLine - TopLine) * fTextHeight, fTe' + + 'xtHeight);' + '{$IFDEF SYN_WIN32}' + ' // restore brush' + ' if fGutter.Gradient then' + ' Canvas.Brush.Style := bsSolid;' + '{$ENDIF}' + '' + ' // the gutter separator if visible' + + ' if (fGutter.BorderStyle <> gbsNone) and (AClip.Right >= fGutte' + + 'rWidth - 2) then' + ' with Canvas do' + ' begin' + ' Pen.Color := fGutter.BorderColor;' + ' Pen.Width := 1;' + ' with AClip do' + ' begin' + ' if fGutter.BorderStyle = gbsMiddle then' + ' begin' + ' MoveTo(fGutterWidth - 2, Top);' + ' LineTo(fGutterWidth - 2, Bottom);' + ' Pen.Color := fGutter.Color;' + ' end;' + ' MoveTo(fGutterWidth - 1, Top);' + ' LineTo(fGutterWidth - 1, Bottom);' + ' end;' + ' end;' + '' + ' // now the gutter marks' + ' if BookMarkOptions.GlyphsVisible and (Marks.Count > 0)' + ' and (vLastLine >= vFirstLine) then' + ' begin' + + ' aGutterOffs := AllocMem((aLastRow - aFirstRow + 1) * SizeOf(' + + 'Integer));' + ' try' + + ' // Instead of making a two pass loop we look while drawing' + + ' the bookmarks' + ' // whether there is any other mark to be drawn' + ' bHasOtherMarks := False;' + ' for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do' + + ' if Visible and (Line >= vFirstLine) and (Line <= vLastLi' + + 'ne) then' + ' begin' + + ' if IsBookmark <> BookMarkOptions.DrawBookmarksFirst th' + + 'en' + ' bHasOtherMarks := True' + ' else begin' + ' vMarkRow := LineToRow(Line);' + ' if vMarkRow >= aFirstRow then' + + ' DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFir' + + 'stRow], vMarkRow);' + ' end' + ' end;' + ' if bHasOtherMarks then' + + ' for cMark := 0 to Marks.Count - 1 do with Marks[cMark] d' + + 'o' + ' begin' + + ' if Visible and (IsBookmark <> BookMarkOptions.DrawBook' + + 'marksFirst)' + + ' and (Line >= vFirstLine) and (Line <= vLastLine) the' + + 'n' + ' begin' + ' vMarkRow := LineToRow(Line);' + ' if vMarkRow >= aFirstRow then' + + ' DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFir' + + 'stRow], vMarkRow);' + ' end;' + ' end;' + ' if Assigned(OnGutterPaint) then' + ' for cLine := vFirstLine to vLastLine do' + ' begin' + ' vGutterRow := LineToRow(cLine);' + + ' OnGutterPaint(Self, cLine, aGutterOffs[vGutterRow - aF' + + 'irstRow],' + ' (vGutterRow - TopLine) * LineHeight);' + ' end;' + ' finally' + ' FreeMem(aGutterOffs);' + ' end;' + ' end' + ' else if Assigned(OnGutterPaint) then' + ' begin' + ' for cLine := vFirstLine to vLastLine do' + ' begin' + ' vGutterRow := LineToRow(cLine);' + + ' OnGutterPaint(Self, cLine, 0, (vGutterRow - TopLine) * Lin' + + 'eHeight);' + ' end;' + ' end;' + 'end;' + '' + + '// Inserts filling chars into a string containing chars that dis' + + 'play as glyphs' + + '// wider than an average glyph. (This is often the case with Asi' + + 'an glyphs, which' + '// are usually wider than latin glpyhs)' + + '// This is only to simplify paint-operations and has nothing to ' + + 'do with' + '// multi-byte chars.' + + 'function TCustomSynEdit.ExpandAtWideGlyphs(const S: UnicodeStrin' + + 'g): UnicodeString;' + 'var' + ' i, j, CountOfAvgGlyphs: Integer;' + 'begin' + ' Result := S;' + ' j := 0;' + ' SetLength(Result, Length(S) * 2); // speed improvement' + ' for i := 1 to Length(S) do' + ' begin' + ' inc(j);' + + ' CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(S[i])' + + ', fCharWidth);' + '' + ' if j + CountOfAvgGlyphs > Length(Result) then' + ' SetLength(Result, Length(Result) + 128);' + '' + ' // insert CountOfAvgGlyphs filling chars' + ' while CountOfAvgGlyphs > 1 do' + ' begin' + ' Result[j] := FillerChar;' + ' inc(j);' + ' dec(CountOfAvgGlyphs);' + ' end;' + '' + ' Result[j] := S[i];' + ' end;' + '' + ' SetLength(Result, j);' + 'end;' + '' + '// does the opposite of ExpandAtWideGlyphs' + + 'function TCustomSynEdit.ShrinkAtWideGlyphs(const S: UnicodeStrin' + + 'g; First: Integer;' + ' var CharCount: Integer): UnicodeString;' + 'var' + ' i, j: Integer;' + 'begin' + ' SetLength(Result, Length(S));' + '' + ' i := First;' + ' j := 0;' + ' while i < First + CharCount do' + ' begin' + ' inc(j);' + ' while S[i] = FillerChar do' + ' inc(i);' + ' Result[j] := S[i];' + ' inc(i);' + ' end;' + '' + ' SetLength(Result, j);' + ' CharCount := j;' + 'end;' + '' + + 'procedure TCustomSynEdit.PaintTextLines(AClip: TRect; const aFir' + + 'stRow, aLastRow,' + ' FirstCol, LastCol: Integer);' + 'var' + ' bDoRightEdge: Boolean; // right edge' + ' nRightEdge: Integer;' + ' // selection info' + ' bAnySelection: Boolean; // any selection visible?' + ' vSelStart: TDisplayCoord; // start of selected area' + ' vSelEnd: TDisplayCoord; // end of selected area' + ' // info about normal and selected text and background colors' + ' bSpecialLine, bLineSelected, bCurrentLine: Boolean;' + ' colFG, colBG: TColor;' + ' colSelFG, colSelBG: TColor;' + ' // info about selection of the current line' + ' nLineSelStart, nLineSelEnd: Integer;' + ' bComplexLine: Boolean;' + ' // painting the background and the text' + ' rcLine, rcToken: TRect;' + ' TokenAccu: record' + ' // Note: s is not managed as a string, it will only grow!!!' + + ' // Never use AppendStr or "+", use Len and MaxLen instead an' + + 'd' + ' // copy the string chars directly. This is for efficiency.' + ' Len, MaxLen, CharsBefore: Integer;' + ' s: UnicodeString;' + ' TabString: UnicodeString;' + ' FG, BG: TColor;' + ' Style: TFontStyles;' + ' end;' + '{$IFNDEF SYN_CLX}' + ' dc: HDC;' + '{$ENDIF}' + ' SynTabGlyphString: UnicodeString;' + '' + ' vFirstLine: Integer;' + ' vLastLine: Integer;' + '' + '{ local procedures }' + '' + ' function colEditorBG: TColor;' + ' var' + ' iAttri: TSynHighlighterAttributes;' + ' begin' + ' if (ActiveLineColor <> clNone) and (bCurrentLine) then' + ' Result := ActiveLineColor' + ' else begin' + ' Result := Color;' + ' if Highlighter <> nil then' + ' begin' + ' iAttri := Highlighter.WhitespaceAttribute;' + + ' if (iAttri <> nil) and (iAttri.Background <> clNone) the' + + 'n' + ' Result := iAttri.Background;' + ' end;' + ' end;' + ' end;' + '' + ' procedure ComputeSelectionInfo;' + ' var' + ' vStart: TBufferCoord;' + ' vEnd: TBufferCoord;' + ' begin' + ' bAnySelection := False;' + ' // Only if selection is visible anyway.' + ' if not HideSelection or Self.Focused then' + ' begin' + ' bAnySelection := True;' + ' // Get the *real* start of the selected area.' + ' if fBlockBegin.Line < fBlockEnd.Line then' + ' begin' + ' vStart := fBlockBegin;' + ' vEnd := fBlockEnd;' + ' end' + ' else if fBlockBegin.Line > fBlockEnd.Line then' + ' begin' + ' vEnd := fBlockBegin;' + ' vStart := fBlockEnd;' + ' end' + ' else if fBlockBegin.Char <> fBlockEnd.Char then' + ' begin' + ' // No selection at all, or it is only on this line.' + ' vStart.Line := fBlockBegin.Line;' + ' vEnd.Line := vStart.Line;' + ' if fBlockBegin.Char < fBlockEnd.Char then' + ' begin' + ' vStart.Char := fBlockBegin.Char;' + ' vEnd.Char := fBlockEnd.Char;' + ' end' + ' else' + ' begin' + ' vStart.Char := fBlockEnd.Char;' + ' vEnd.Char := fBlockBegin.Char;' + ' end;' + ' end' + ' else' + ' bAnySelection := False;' + + ' // If there is any visible selection so far, then test if ' + + 'there is an' + ' // intersection with the area to be painted.' + ' if bAnySelection then' + ' begin' + ' // Don'#39't care if the selection is not visible.' + + ' bAnySelection := (vEnd.Line >= vFirstLine) and (vStart.L' + + 'ine <= vLastLine);' + ' if bAnySelection then' + ' begin' + + ' // Transform the selection from text space into screen' + + ' space' + ' vSelStart := BufferToDisplayPos(vStart);' + ' vSelEnd := BufferToDisplayPos(vEnd);' + + ' // In the column selection mode sort the begin and end' + + ' of the selection,' + ' // this makes the painting code simpler.' + + ' if (fActiveSelectionMode = smColumn) and (vSelStart.Co' + + 'lumn > vSelEnd.Column) then' + ' SwapInt(vSelStart.Column, vSelEnd.Column);' + ' end;' + ' end;' + ' end;' + ' end;' + '' + ' procedure SetDrawingColors(Selected: Boolean);' + ' begin' + ' with fTextDrawer do' + ' if Selected then' + ' begin' + ' SetBackColor(colSelBG);' + ' SetForeColor(colSelFG);' + ' Canvas.Brush.Color := colSelBG;' + ' end' + ' else begin' + ' SetBackColor(colBG);' + ' SetForeColor(colFG);' + ' Canvas.Brush.Color := colBG;' + ' end;' + ' end;' + '' + ' function ColumnToXValue(Col: Integer): Integer;' + ' begin' + ' Result := fTextOffset + Pred(Col) * fCharWidth;' + ' end;' + '' + + ' //todo: Review SpecialChars and HardTabs painting. Token param' + + 'eter of PaintToken procedure could very probably be passed by re' + + 'ference.' + '' + + ' // Note: The PaintToken procedure will take care of invalid pa' + + 'rameters' + ' // like empty token rect or invalid indices into TokenLen.' + ' // CharsBefore tells if Token starts at column one or not' + ' procedure PaintToken(Token: UnicodeString;' + ' TokenLen, CharsBefore, First, Last: Integer);' + ' var' + ' Text: UnicodeString;' + ' Counter, nX, nCharsToPaint: Integer;' + ' sTabbedToken: UnicodeString;' + ' DoTabPainting: Boolean;' + + ' i, TabStart, TabLen, CountOfAvgGlyphs, VisibleGlyphPart, Fil' + + 'lerCount,' + ' NonFillerPos: Integer;' + ' rcTab: TRect;' + ' const' + ' ETOOptions = [tooOpaque, tooClipped];' + ' begin' + ' sTabbedToken := Token;' + ' DoTabPainting := False;' + '' + ' Counter := Last - CharsBefore;' + ' while Counter > First - CharsBefore - 1 do' + ' begin' + ' if Length(Token) >= Counter then' + ' begin' + ' if fShowSpecChar and (Token[Counter] = #32) then' + ' Token[Counter] := SynSpaceGlyph' + ' else if Token[Counter] = #9 then' + ' begin' + + ' Token[Counter] := #32; //Tabs painted differently if ' + + 'necessary' + ' DoTabPainting := fShowSpecChar;' + ' end;' + ' end;' + ' Dec(Counter);' + ' end;' + '' + ' if (Last >= First) and (rcToken.Right > rcToken.Left) then' + ' begin' + ' nX := ColumnToXValue(First);' + '' + ' Dec(First, CharsBefore);' + ' Dec(Last, CharsBefore);' + '' + ' if (First > TokenLen) then' + ' begin' + ' nCharsToPaint := 0;' + ' Text := '#39#39';' + ' end' + ' else' + ' begin' + ' FillerCount := 0;' + ' NonFillerPos := First;' + ' while Token[NonFillerPos] = FillerChar do' + ' begin' + ' inc(FillerCount);' + ' inc(NonFillerPos);' + ' end;' + '' + + ' CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(T' + + 'oken[NonFillerPos]) , fCharWidth);' + '' + ' // first visible part of the glyph (1-based)' + + ' // (the glyph is visually sectioned in parts of size fCh' + + 'arWidth)' + ' VisibleGlyphPart := CountOfAvgGlyphs - FillerCount;' + '' + ' // clip off invisible parts' + ' nX := nX - fCharWidth * (VisibleGlyphPart - 1);' + '' + + ' nCharsToPaint := Min(Last - First + 1, TokenLen - First ' + + '+ 1);' + '' + ' // clip off partially visible glyphs at line end' + ' if WordWrap then' + ' while nX + fCharWidth * nCharsToPaint > ClientWidth do' + ' begin' + ' dec(nCharsToPaint);' + + ' while (nCharsToPaint > 0) and (Token[First + nCharsT' + + 'oPaint - 1] = FillerChar) do' + ' dec(nCharsToPaint);' + ' end;' + '' + + ' // same as copy(Token, First, nCharsToPaint) and remove ' + + 'filler chars' + ' Text := ShrinkAtWideGlyphs(Token, First, nCharsToPaint);' + ' end;' + '' + + ' fTextDrawer.ExtTextOut(nX, rcToken.Top, ETOOptions, rcToke' + + 'n,' + ' PWideChar(Text), nCharsToPaint);' + '' + ' if DoTabPainting then' + ' begin' + ' // fix everything before the FirstChar' + + ' for i := 1 to First - 1 do // wipe the tex' + + 't out so we don'#39't' + + ' if sTabbedToken[i] = #9 then // count it out' + + ' of the range' + + ' sTabbedToken[i] := #32; // we'#39're lookin' + + 'g for' + '' + ' TabStart := pos(#9, sTabbedToken);' + ' rcTab.Top := rcToken.Top;' + ' rcTab.Bottom := rcToken.Bottom;' + + ' while (TabStart > 0) and (TabStart >= First) and (TabSta' + + 'rt <= Last) do' + ' begin' + ' TabLen := 1;' + + ' while (TabStart + CharsBefore + TabLen - 1) mod FTabWi' + + 'dth <> 0 do inc(TabLen);' + ' Text := SynTabGlyphString;' + '' + + ' nX := ColumnToXValue(CharsBefore + TabStart + (TabLen ' + + 'div 2) - 1);' + ' if TabLen mod 2 = 0 then' + ' nX := nX + (fCharWidth div 2)' + ' else nX := nX + fCharWidth;' + '' + ' rcTab.Left := nX;' + ' rcTab.Right := nX + fTextDrawer.GetCharWidth;' + '' + + ' fTextDrawer.ExtTextOut(nX, rcTab.Top, ETOOptions, rcTa' + + 'b,' + ' PWideChar(Text), 1);' + '' + + ' for i := 0 to TabLen - 1 do //wipe the text ' + + 'out so we don'#39't' + ' sTabbedToken[TabStart + i] := #32; //count it again' + '' + ' TabStart := pos(#9, sTabbedToken);' + ' end;' + ' end;' + ' rcToken.Left := rcToken.Right;' + ' end;' + ' end;' + '' + '{$IFNDEF SYN_CLX}' + ' procedure AdjustEndRect;' + ' // trick to avoid clipping the last pixels of text in italic,' + + ' // see also AdjustLastCharWidth() in TheTextDrawer.ExtTextOut(' + + ')' + ' var' + ' LastChar: Cardinal;' + ' NormalCharWidth, RealCharWidth: Integer;' + ' CharInfo: TABC;' + ' tm: TTextMetricA;' + ' begin' + ' LastChar := Ord(TokenAccu.s[TokenAccu.Len]);' + + ' NormalCharWidth := fTextDrawer.TextWidth(WideChar(LastChar))' + + ';' + ' RealCharWidth := NormalCharWidth;' + ' if Win32PlatformIsUnicode then' + ' begin' + + ' if GetCharABCWidthsW(Canvas.Handle, LastChar, LastChar, Ch' + + 'arInfo) then' + ' begin' + ' RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB);' + ' if CharInfo.abcC >= 0 then' + ' Inc(RealCharWidth, CharInfo.abcC);' + ' end' + ' else if LastChar < Ord(High(AnsiChar)) then' + ' begin' + ' GetTextMetricsA(Canvas.Handle, tm);' + ' RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang;' + ' end;' + ' end' + ' else if WideChar(LastChar) <= High(AnsiChar) then' + ' begin' + + ' if GetCharABCWidths(Canvas.Handle, LastChar, LastChar, Cha' + + 'rInfo) then' + ' begin' + ' RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB);' + ' if CharInfo.abcC >= 0 then' + ' Inc(RealCharWidth, CharInfo.abcC);' + ' end' + ' else if LastChar < Ord(High(AnsiChar)) then' + ' begin' + ' GetTextMetricsA(Canvas.Handle, tm);' + ' RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang;' + ' end;' + ' end;' + '' + ' if RealCharWidth > NormalCharWidth then' + ' Inc(rcToken.Left, RealCharWidth - NormalCharWidth);' + ' end;' + '{$ENDIF}' + '' + ' procedure PaintHighlightToken(bFillToEOL: Boolean);' + ' var' + ' bComplexToken: Boolean;' + ' nC1, nC2, nC1Sel, nC2Sel: Integer;' + ' bU1, bSel, bU2: Boolean;' + ' nX1, nX2: Integer;' + ' begin' + ' // Compute some helper variables.' + ' nC1 := Max(FirstCol, TokenAccu.CharsBefore + 1);' + + ' nC2 := Min(LastCol, TokenAccu.CharsBefore + TokenAccu.Len + ' + + '1);' + ' if bComplexLine then' + ' begin' + ' bU1 := (nC1 < nLineSelStart);' + ' bSel := (nC1 < nLineSelEnd) and (nC2 >= nLineSelStart);' + ' bU2 := (nC2 >= nLineSelEnd);' + ' bComplexToken := bSel and (bU1 or bU2);' + ' end' + ' else' + ' begin' + ' bU1 := False; // to shut up Compiler warning Delphi 2' + ' bSel := bLineSelected;' + ' bU2 := False; // to shut up Compiler warning Delphi 2' + ' bComplexToken := False;' + ' end;' + ' // Any token chars accumulated?' + ' if (TokenAccu.Len > 0) then' + ' begin' + ' // Initialize the colors and the font style.' + ' if not bSpecialLine then' + ' begin' + ' colBG := TokenAccu.BG;' + ' colFG := TokenAccu.FG;' + ' end;' + '' + + ' if bSpecialLine and (eoSpecialLineDefaultFg in fOptions) t' + + 'hen' + ' colFG := TokenAccu.FG;' + '' + ' fTextDrawer.SetStyle(TokenAccu.Style);' + ' // Paint the chars' + ' if bComplexToken then' + ' begin' + ' // first unselected part of the token' + ' if bU1 then' + ' begin' + ' SetDrawingColors(False);' + ' rcToken.Right := ColumnToXValue(nLineSelStart);' + ' with TokenAccu do' + ' PaintToken(s, Len, CharsBefore, nC1, nLineSelStart);' + ' end;' + ' // selected part of the token' + ' SetDrawingColors(True);' + ' nC1Sel := Max(nLineSelStart, nC1);' + ' nC2Sel := Min(nLineSelEnd, nC2);' + ' rcToken.Right := ColumnToXValue(nC2Sel);' + ' with TokenAccu do' + ' PaintToken(s, Len, CharsBefore, nC1Sel, nC2Sel);' + ' // second unselected part of the token' + ' if bU2 then' + ' begin' + ' SetDrawingColors(False);' + ' rcToken.Right := ColumnToXValue(nC2);' + ' with TokenAccu do' + ' PaintToken(s, Len, CharsBefore, nLineSelEnd, nC2);' + ' end;' + ' end' + ' else' + ' begin' + ' SetDrawingColors(bSel);' + ' rcToken.Right := ColumnToXValue(nC2);' + ' with TokenAccu do' + ' PaintToken(s, Len, CharsBefore, nC1, nC2);' + ' end;' + ' end;' + '' + ' // Fill the background to the end of this line if necessary.' + ' if bFillToEOL and (rcToken.Left < rcLine.Right) then' + ' begin' + ' if not bSpecialLine then colBG := colEditorBG;' + ' if bComplexLine then' + ' begin' + ' nX1 := ColumnToXValue(nLineSelStart);' + ' nX2 := ColumnToXValue(nLineSelEnd);' + ' if (rcToken.Left < nX1) then' + ' begin' + ' SetDrawingColors(False);' + ' rcToken.Right := nX1;' + '{$IFNDEF SYN_CLX}' + + ' if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) the' + + 'n' + ' AdjustEndRect;' + '{$ENDIF}' + ' Canvas.FillRect(rcToken);' + ' rcToken.Left := nX1;' + ' end;' + ' if (rcToken.Left < nX2) then' + ' begin' + ' SetDrawingColors(True);' + ' rcToken.Right := nX2;' + '{$IFNDEF SYN_CLX}' + + ' if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) the' + + 'n' + ' AdjustEndRect;' + '{$ENDIF}' + ' Canvas.FillRect(rcToken);' + ' rcToken.Left := nX2;' + ' end;' + ' if (rcToken.Left < rcLine.Right) then' + ' begin' + ' SetDrawingColors(False);' + ' rcToken.Right := rcLine.Right;' + '{$IFNDEF SYN_CLX}' + + ' if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) the' + + 'n' + ' AdjustEndRect;' + '{$ENDIF}' + ' Canvas.FillRect(rcToken);' + ' end;' + ' end' + ' else' + ' begin' + ' SetDrawingColors(bLineSelected);' + ' rcToken.Right := rcLine.Right;' + '{$IFNDEF SYN_CLX}' + ' if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then' + ' AdjustEndRect;' + '{$ENDIF}' + ' Canvas.FillRect(rcToken);' + ' end;' + ' end;' + ' end;' + '' + ' // Store the token chars with the attributes in the TokenAccu' + + ' // record. This will paint any chars already stored if there i' + + 's' + ' // a (visible) change in the attributes.' + ' procedure AddHighlightToken(const Token: UnicodeString;' + ' CharsBefore, TokenLen: Integer;' + ' Foreground, Background: TColor;' + ' Style: TFontStyles);' + ' var' + ' bCanAppend: Boolean;' + ' bSpacesTest, bIsSpaces: Boolean;' + ' i: Integer;' + '' + ' function TokenIsSpaces: Boolean;' + ' var' + ' pTok: PWideChar;' + ' begin' + ' if not bSpacesTest then' + ' begin' + ' bSpacesTest := True;' + ' pTok := PWideChar(Token);' + ' while pTok^ <> #0 do' + ' begin' + ' if pTok^ <> #32 then' + ' break;' + ' Inc(pTok);' + ' end;' + ' bIsSpaces := pTok^ = #0;' + ' end;' + ' Result := bIsSpaces;' + ' end;' + '' + ' begin' + ' if (Background = clNone) or' + ' ((ActiveLineColor <> clNone) and (bCurrentLine)) then' + ' begin' + ' Background := colEditorBG;' + ' end;' + ' if Foreground = clNone then Foreground := Font.Color;' + + ' // Do we have to paint the old chars first, or can we just a' + + 'ppend?' + ' bCanAppend := False;' + ' bSpacesTest := False;' + ' if (TokenAccu.Len > 0) then' + ' begin' + ' // font style must be the same or token is only spaces' + ' if (TokenAccu.Style = Style)' + + ' or (not (fsUnderline in Style) and not (fsUnderline in T' + + 'okenAccu.Style)' + ' and TokenIsSpaces) then' + ' begin' + ' // either special colors or same colors' + + ' if (bSpecialLine and not (eoSpecialLineDefaultFg in fOpt' + + 'ions)) or bLineSelected or' + ' // background color must be the same and' + ' ((TokenAccu.BG = Background) and' + + ' // foreground color must be the same or token is only ' + + 'spaces' + ' ((TokenAccu.FG = Foreground) or TokenIsSpaces)) then' + ' begin' + ' bCanAppend := True;' + ' end;' + ' end;' + + ' // If we can'#39't append it, then we have to paint the old to' + + 'ken chars first.' + ' if not bCanAppend then' + ' PaintHighlightToken(False);' + ' end;' + ' // Don'#39't use AppendStr because it'#39's more expensive.' + ' if bCanAppend then' + ' begin' + ' if (TokenAccu.Len + TokenLen > TokenAccu.MaxLen) then' + ' begin' + ' TokenAccu.MaxLen := TokenAccu.Len + TokenLen + 32;' + ' SetLength(TokenAccu.s, TokenAccu.MaxLen);' + ' end;' + ' for i := 1 to TokenLen do' + ' TokenAccu.s[TokenAccu.Len + i] := Token[i];' + ' Inc(TokenAccu.Len, TokenLen);' + ' end' + ' else' + ' begin' + ' TokenAccu.Len := TokenLen;' + ' if (TokenAccu.Len > TokenAccu.MaxLen) then' + ' begin' + ' TokenAccu.MaxLen := TokenAccu.Len + 32;' + ' SetLength(TokenAccu.s, TokenAccu.MaxLen);' + ' end;' + ' for i := 1 to TokenLen do' + ' TokenAccu.s[i] := Token[i];' + ' TokenAccu.CharsBefore := CharsBefore;' + ' TokenAccu.FG := Foreground;' + ' TokenAccu.BG := Background;' + ' TokenAccu.Style := Style;' + ' end;' + ' end;' + '' + ' procedure PaintLines;' + ' var' + ' nLine: Integer; // line index for the loop' + ' cRow: Integer;' + ' sLine: UnicodeString; // the current line (tab expanded)' + ' sLineExpandedAtWideGlyphs: UnicodeString;' + ' sToken: UnicodeString; // highlighter token info' + ' nTokenPos, nTokenLen: Integer;' + ' attr: TSynHighlighterAttributes;' + ' vAuxPos: TDisplayCoord;' + ' vFirstChar: Integer;' + ' vLastChar: Integer;' + ' vStartRow: Integer;' + ' vEndRow: Integer;' + ' begin' + + ' // Initialize rcLine for drawing. Note that Top and Bottom a' + + 're updated' + ' // inside the loop. Get only the starting point for this.' + ' rcLine := AClip;' + ' rcLine.Left := fGutterWidth + 2;' + ' rcLine.Bottom := (aFirstRow - TopLine) * fTextHeight;' + + ' // Make sure the token accumulator string doesn'#39't get reassi' + + 'gned to often.' + ' if Assigned(fHighlighter) then' + ' begin' + ' TokenAccu.MaxLen := Max(128, fCharsInWindow);' + ' SetLength(TokenAccu.s, TokenAccu.MaxLen);' + ' end;' + + ' // Now loop through all the lines. The indices are valid for' + + ' Lines.' + ' for nLine := vFirstLine to vLastLine do' + ' begin' + + ' sLine := TSynEditStringList(Lines).ExpandedStrings[nLine -' + + ' 1];' + ' sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine);' + ' // determine whether will be painted with ActiveLineColor' + ' bCurrentLine := CaretY = nLine;' + + ' // Initialize the text and background colors, maybe the li' + + 'ne should' + ' // use special values for them.' + ' colFG := Font.Color;' + ' colBG := colEditorBG;' + + ' bSpecialLine := DoOnSpecialLineColors(nLine, colFG, colBG)' + + ';' + ' if bSpecialLine then' + ' begin' + + ' // The selection colors are just swapped, like seen in D' + + 'elphi.' + ' colSelFG := colBG;' + ' colSelBG := colFG;' + ' end' + ' else' + ' begin' + ' colSelFG := fSelectedColor.Foreground;' + ' colSelBG := fSelectedColor.Background;' + ' end;' + '' + ' vStartRow := Max(LineToRow(nLine), aFirstRow);' + ' vEndRow := Min(LineToRow(nLine + 1) - 1, aLastRow);' + ' for cRow := vStartRow to vEndRow do' + ' begin' + ' if WordWrap then' + ' begin' + ' vAuxPos.Row := cRow;' + ' if Assigned(fHighlighter) then' + ' vAuxPos.Column := FirstCol' + ' else' + + ' // When no highlighter is assigned, we must always s' + + 'tart from the' + + ' // first char in a row and PaintToken will do the ac' + + 'tual clipping' + ' vAuxPos.Column := 1;' + + ' vFirstChar := fWordWrapPlugin.DisplayToBufferPos(vAuxP' + + 'os).Char;' + ' vAuxPos.Column := LastCol;' + + ' vLastChar := fWordWrapPlugin.DisplayToBufferPos(vAuxPo' + + 's).Char;' + ' end' + ' else' + ' begin' + ' vFirstChar := FirstCol;' + ' vLastChar := LastCol;' + ' end;' + + ' // Get the information about the line selection. Three d' + + 'ifferent parts' + + ' // are possible (unselected before, selected, unselected' + + ' after), only' + + ' // unselected or only selected means bComplexLine will b' + + 'e False. Start' + + ' // with no selection, compute based on the visible colum' + + 'ns.' + ' bComplexLine := False;' + ' nLineSelStart := 0;' + ' nLineSelEnd := 0;' + ' // Does the selection intersect the visible area?' + + ' if bAnySelection and (cRow >= vSelStart.Row) and (cRow <' + + '= vSelEnd.Row) then' + ' begin' + + ' // Default to a fully selected line. This is correct f' + + 'or the smLine' + + ' // selection mode and a good start for the smNormal mo' + + 'de.' + ' nLineSelStart := FirstCol;' + ' nLineSelEnd := LastCol + 1;' + ' if (fActiveSelectionMode = smColumn) or' + + ' ((fActiveSelectionMode = smNormal) and (cRow = vSelS' + + 'tart.Row)) then' + ' begin' + ' if (vSelStart.Column > LastCol) then' + ' begin' + ' nLineSelStart := 0;' + ' nLineSelEnd := 0;' + ' end' + ' else if (vSelStart.Column > FirstCol) then' + ' begin' + ' nLineSelStart := vSelStart.Column;' + ' bComplexLine := True;' + ' end;' + ' end;' + ' if (fActiveSelectionMode = smColumn) or' + + ' ((fActiveSelectionMode = smNormal) and (cRow = vSelE' + + 'nd.Row)) then' + ' begin' + ' if (vSelEnd.Column < FirstCol) then' + ' begin' + ' nLineSelStart := 0;' + ' nLineSelEnd := 0;' + ' end' + ' else if (vSelEnd.Column < LastCol) then' + ' begin' + ' nLineSelEnd := vSelEnd.Column;' + ' bComplexLine := True;' + ' end;' + ' end;' + ' end; //endif bAnySelection' + '' + ' // Update the rcLine rect to this line.' + ' rcLine.Top := rcLine.Bottom;' + ' Inc(rcLine.Bottom, fTextHeight);' + '' + + ' bLineSelected := not bComplexLine and (nLineSelStart > 0' + + ');' + ' rcToken := rcLine;' + '' + + ' if not Assigned(fHighlighter) or not fHighlighter.Enable' + + 'd then' + ' begin' + ' // Remove text already displayed (in previous rows)' + + ' if (vFirstChar <> FirstCol) or (vLastChar <> LastCol) ' + + 'then' + + ' sToken := Copy(sLineExpandedAtWideGlyphs, vFirstChar' + + ', vLastChar - vFirstChar)' + ' else' + + ' sToken := Copy(sLineExpandedAtWideGlyphs, 1, vLastCh' + + 'ar);' + + ' if fShowSpecChar and (Length(sLineExpandedAtWideGlyphs' + + ') < vLastChar) then' + ' sToken := sToken + SynLineBreakGlyph;' + ' nTokenLen := Length(sToken);' + ' if bComplexLine then' + ' begin' + ' SetDrawingColors(False);' + + ' rcToken.Left := Max(rcLine.Left, ColumnToXValue(Firs' + + 'tCol));' + + ' rcToken.Right := Min(rcLine.Right, ColumnToXValue(nL' + + 'ineSelStart));' + + ' PaintToken(sToken, nTokenLen, 0, FirstCol, nLineSelS' + + 'tart);' + + ' rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLin' + + 'eSelEnd));' + + ' rcToken.Right := Min(rcLine.Right, ColumnToXValue(La' + + 'stCol));' + + ' PaintToken(sToken, nTokenLen, 0, nLineSelEnd, LastCo' + + 'l);' + ' SetDrawingColors(True);' + + ' rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLin' + + 'eSelStart));' + + ' rcToken.Right := Min(rcLine.Right, ColumnToXValue(nL' + + 'ineSelEnd));' + + ' PaintToken(sToken, nTokenLen, 0, nLineSelStart, nLin' + + 'eSelEnd - 1);' + ' end' + ' else' + ' begin' + ' SetDrawingColors(bLineSelected);' + ' PaintToken(sToken, nTokenLen, 0, FirstCol, LastCol);' + ' end;' + ' end' + ' else' + ' begin' + + ' // Initialize highlighter with line text and range inf' + + 'o. It is' + + ' // necessary because we probably did not scan to the e' + + 'nd of the last' + + ' // line - the internal highlighter range might be wron' + + 'g.' + ' if nLine = 1 then' + ' fHighlighter.ResetRange' + ' else' + + ' fHighlighter.SetRange(TSynEditStringList(Lines).Rang' + + 'es[nLine - 2]);' + + ' fHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineE' + + 'xpandedAtWideGlyphs,' + ' nLine - 1);' + + ' // Try to concatenate as many tokens as possible to mi' + + 'nimize the count' + + ' // of ExtTextOutW calls necessary. This depends on the' + + ' selection state' + + ' // or the line having special colors. For spaces the f' + + 'oreground color' + ' // is ignored as well.' + ' TokenAccu.Len := 0;' + ' nTokenPos := 0;' + ' nTokenLen := 0;' + ' attr := nil;' + + ' // Test first whether anything of this token is visibl' + + 'e.' + ' while not fHighlighter.GetEol do' + ' begin' + ' nTokenPos := fHighlighter.GetExpandedTokenPos;' + ' sToken := fHighlighter.GetExpandedToken;' + ' nTokenLen := Length(sToken);' + ' if nTokenPos + nTokenLen >= vFirstChar then' + ' begin' + ' if nTokenPos + nTokenLen > vLastChar then' + ' begin' + ' if nTokenPos > vLastChar then' + ' break;' + ' if WordWrap then' + ' nTokenLen := vLastChar - nTokenPos - 1' + ' else' + ' nTokenLen := vLastChar - nTokenPos;' + ' end;' + + ' // Remove offset generated by tokens already displ' + + 'ayed (in previous rows)' + ' Dec(nTokenPos, vFirstChar - FirstCol);' + + ' // It'#39's at least partially visible. Get the token ' + + 'attributes now.' + ' attr := fHighlighter.GetTokenAttribute;' + ' if Assigned(attr) then' + + ' AddHighlightToken(sToken, nTokenPos, nTokenLen, ' + + 'attr.Foreground,' + ' attr.Background, attr.Style)' + ' else' + + ' AddHighlightToken(sToken, nTokenPos, nTokenLen, ' + + 'colFG, colBG,' + ' Font.Style);' + ' end;' + ' // Let the highlighter scan the next token.' + ' fHighlighter.Next;' + ' end;' + + ' // Draw anything that'#39's left in the TokenAccu record. ' + + 'Fill to the end' + ' // of the invalid area with the correct colors.' + ' if fShowSpecChar and fHighlighter.GetEol then' + ' begin' + + ' if (attr = nil) or (attr <> fHighlighter.CommentAttr' + + 'ibute) then' + ' attr := fHighlighter.WhitespaceAttribute;' + + ' AddHighlightToken(SynLineBreakGlyph, nTokenPos + nTo' + + 'kenLen, 1,' + ' attr.Foreground, attr.Background, []);' + ' end;' + ' PaintHighlightToken(True);' + ' end;' + + ' // Now paint the right edge if necessary. We do it line ' + + 'by line to reduce' + + ' // the flicker. Should not cost very much anyway, compar' + + 'ed to the many' + ' // calls to ExtTextOutW.' + ' if bDoRightEdge then' + ' begin' + ' Canvas.MoveTo(nRightEdge, rcLine.Top);' + ' Canvas.LineTo(nRightEdge, rcLine.Bottom + 1);' + ' end;' + ' end; //endfor cRow' + ' bCurrentLine := False;' + ' end; //endfor cLine' + ' end;' + '' + '{ end local procedures }' + '' + 'begin' + ' vFirstLine := RowToLine(aFirstRow);' + ' vLastLine := RowToLine(aLastRow);' + '' + ' bCurrentLine := False;' + + ' // If the right edge is visible and in the invalid area, prepa' + + 're to paint it.' + + ' // Do this first to realize the pen when getting the dc variab' + + 'le.' + ' SynTabGlyphString := SynTabGlyph;' + ' bDoRightEdge := False;' + ' if (fRightEdge > 0) then' + ' begin // column value' + + ' nRightEdge := fTextOffset + fRightEdge * fCharWidth; // pixe' + + 'l value' + + ' if (nRightEdge >= AClip.Left) and (nRightEdge <= AClip.Right' + + ') then' + ' begin' + ' bDoRightEdge := True;' + ' Canvas.Pen.Color := fRightEdgeColor;' + ' Canvas.Pen.Width := 1;' + ' end;' + ' end;' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + + ' // Do everything else with API calls. This (maybe) realizes th' + + 'e new pen color.' + ' dc := Canvas.Handle;' + '{$ENDIF}' + + ' // If anything of the two pixel space before the text area is ' + + 'visible, then' + ' // fill it with the component background color.' + ' if (AClip.Left < fGutterWidth + 2) then' + ' begin' + ' rcToken := AClip;' + ' rcToken.Left := Max(AClip.Left, fGutterWidth);' + ' rcToken.Right := fGutterWidth + 2;' + ' // Paint whole left edge of the text with same color.' + ' // (value of WhiteAttribute can vary in e.g. MultiSyn)' + ' if Highlighter <> nil then' + ' Highlighter.ResetRange;' + ' Canvas.Brush.Color := colEditorBG;' + ' Canvas.FillRect(rcToken);' + ' // Adjust the invalid area to not include this area.' + ' AClip.Left := rcToken.Right;' + ' end;' + + ' // Paint the visible text lines. To make this easier, compute ' + + 'first the' + + ' // necessary information about the selected area: is there any' + + ' visible' + ' // selected area, and what are its lines / columns?' + ' if (vLastLine >= vFirstLine) then' + ' begin' + ' ComputeSelectionInfo;' + ' fTextDrawer.Style := Font.Style;' + '{$IFDEF SYN_CLX}' + ' fTextDrawer.BeginDrawing(Canvas);' + '{$ELSE}' + ' fTextDrawer.BeginDrawing(dc);' + '{$ENDIF}' + ' try' + ' PaintLines;' + ' finally' + ' fTextDrawer.EndDrawing;' + ' end;' + ' end;' + + ' // If there is anything visible below the last line, then fill' + + ' this as well.' + ' rcToken := AClip;' + ' rcToken.Top := (aLastRow - TopLine + 1) * fTextHeight;' + ' if (rcToken.Top < rcToken.Bottom) then' + ' begin' + ' if Highlighter <> nil then' + ' Highlighter.ResetRange;' + ' Canvas.Brush.Color := colEditorBG;' + ' Canvas.FillRect(rcToken);' + ' // Draw the right edge if necessary.' + ' if bDoRightEdge then' + ' begin' + ' Canvas.MoveTo(nRightEdge, rcToken.Top);' + ' Canvas.LineTo(nRightEdge, rcToken.Bottom + 1);' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.PasteFromClipboard;' + 'var' + ' AddPasteEndMarker: boolean;' + ' vStartOfBlock: TBufferCoord;' + ' vEndOfBlock: TBufferCoord;' + ' StoredPaintLock: Integer;' + ' PasteMode: TSynSelectionMode;' + '{$IFNDEF SYN_CLX}' + ' Mem: HGLOBAL;' + ' P: PByte;' + '{$ENDIF}' + 'begin' + ' if not CanPaste then' + ' exit;' + ' DoOnPaintTransient(ttBefore);' + ' BeginUndoBlock;' + ' AddPasteEndMarker := False;' + ' PasteMode := SelectionMode;' + ' try' + '{$IFNDEF SYN_CLX}' + ' // Check for our special format and read PasteMode.' + + ' // The text is ignored as it is ANSI-only to stay compatible' + + ' with programs' + ' // using the ANSI version of SynEdit.' + ' //' + + ' // Instead we take the text stored in CF_UNICODETEXT or CF_T' + + 'EXT.' + ' if Clipboard.HasFormat(SynEditClipboardFormat) then' + ' begin' + ' Clipboard.Open;' + ' try' + ' Mem := Clipboard.GetAsHandle(SynEditClipboardFormat);' + ' P := GlobalLock(Mem);' + ' try' + ' if P <> nil then' + ' PasteMode := PSynSelectionMode(P)^;' + ' finally' + ' GlobalUnlock(Mem);' + ' end' + ' finally' + ' Clipboard.Close;' + ' end;' + ' end;' + '{$ENDIF}' + + ' fUndoList.AddChange(crPasteBegin, BlockBegin, BlockEnd, '#39#39', ' + + 'smNormal);' + ' AddPasteEndMarker := True;' + ' if SelAvail then' + ' begin' + + ' fUndoList.AddChange(crDelete, fBlockBegin, fBlockEnd, SelT' + + 'ext,' + ' fActiveSelectionMode);' + ' end' + ' else' + ' ActiveSelectionMode := SelectionMode;' + '' + ' if SelAvail then' + ' begin' + ' vStartOfBlock := BlockBegin;' + ' vEndOfBlock := BlockEnd;' + ' fBlockBegin := vStartOfBlock;' + ' fBlockEnd := vEndOfBlock;' + '' + + ' // Pasting always occurs at column 0 when current selectio' + + 'n is' + ' // smLine type' + ' if fActiveSelectionMode = smLine then' + ' vStartOfBlock.Char := 1;' + ' end' + ' else' + ' vStartOfBlock := CaretXY;' + '' + + ' SetSelTextPrimitiveEx(PasteMode, PWideChar(GetClipboardText)' + + ', True);' + ' vEndOfBlock := BlockEnd;' + ' if PasteMode = smNormal then' + + ' fUndoList.AddChange(crPaste, vStartOfBlock, vEndOfBlock, S' + + 'elText,' + ' PasteMode)' + ' else if PasteMode = smColumn then' + ' // Do nothing. Moved to InsertColumn' + ' else if PasteMode = smLine then' + ' if CaretX = 1 then' + + ' fUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBloc' + + 'k.Line),' + + ' BufferCoord(CharsInWindow, vEndOfBlock.Line - 1), SelT' + + 'ext, smLine)' + ' else' + + ' fUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBloc' + + 'k.Line),' + ' vEndOfBlock, SelText, smNormal);' + ' finally' + ' if AddPasteEndMarker then' + + ' fUndoList.AddChange(crPasteEnd, BlockBegin, BlockEnd, '#39#39', ' + + 'smNormal);' + ' EndUndoBlock;' + ' end;' + '' + + ' // ClientRect can be changed by UpdateScrollBars if eoHideShow' + + 'ScrollBars' + ' // is enabled' + ' if eoHideShowScrollBars in Options then' + ' begin' + ' StoredPaintLock := fPaintLock;' + ' try' + ' fPaintLock := 0;' + ' UpdateScrollBars;' + ' finally' + ' fPaintLock := StoredPaintLock;' + ' end;' + ' end;' + '' + ' EnsureCursorPosVisible;' + ' // Selection should have changed...' + ' StatusChanged([scSelection]);' + ' DoOnPaintTransient(ttAfter);' + 'end;' + '' + 'procedure TCustomSynEdit.SelectAll;' + 'var' + ' LastPt: TBufferCoord;' + 'begin' + ' LastPt.Char := 1;' + ' LastPt.Line := Lines.Count;' + ' if LastPt.Line > 0 then' + ' Inc(LastPt.Char, Length(Lines[LastPt.Line - 1]))' + ' else' + ' LastPt.Line := 1;' + ' SetCaretAndSelection(LastPt, BufferCoord(1, 1), LastPt);' + ' // Selection should have changed...' + ' StatusChanged([scSelection]);' + 'end;' + '' + 'procedure TCustomSynEdit.SetBlockBegin(Value: TBufferCoord);' + 'var' + ' nInval1, nInval2: Integer;' + ' SelChanged: Boolean;' + 'begin' + ' ActiveSelectionMode := SelectionMode;' + ' if (eoScrollPastEol in Options) and not WordWrap then' + ' Value.Char := MinMax(Value.Char, 1, fMaxScrollWidth + 1)' + ' else' + ' Value.Char := Max(Value.Char, 1);' + ' Value.Line := MinMax(Value.Line, 1, Lines.Count);' + ' if (fActiveSelectionMode = smNormal) then' + ' if (Value.Line >= 1) and (Value.Line <= Lines.Count) then' + + ' Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]' + + ') + 1)' + ' else' + ' Value.Char := 1;' + ' if SelAvail then' + ' begin' + ' if fBlockBegin.Line < fBlockEnd.Line then' + ' begin' + ' nInval1 := Min(Value.Line, fBlockBegin.Line);' + ' nInval2 := Max(Value.Line, fBlockEnd.Line);' + ' end' + ' else' + ' begin' + ' nInval1 := Min(Value.Line, fBlockEnd.Line);' + ' nInval2 := Max(Value.Line, fBlockBegin.Line);' + ' end;' + ' fBlockBegin := Value;' + ' fBlockEnd := Value;' + ' InvalidateLines(nInval1, nInval2);' + ' SelChanged := True;' + ' end' + ' else' + ' begin' + ' SelChanged :=' + + ' (fBlockBegin.Char <> Value.Char) or (fBlockBegin.Line <> V' + + 'alue.Line) or' + + ' (fBlockEnd.Char <> Value.Char) or (fBlockEnd.Line <> Value' + + '.Line);' + ' fBlockBegin := Value;' + ' fBlockEnd := Value;' + ' end;' + ' if SelChanged then' + ' StatusChanged([scSelection]);' + 'end;' + '' + 'procedure TCustomSynEdit.SetBlockEnd(Value: TBufferCoord);' + 'var' + ' nLine: Integer;' + 'begin' + ' ActiveSelectionMode := SelectionMode;' + ' if not (eoNoSelection in Options) then' + ' begin' + ' if (eoScrollPastEol in Options) and not WordWrap then' + ' Value.Char := MinMax(Value.Char, 1, fMaxScrollWidth + 1)' + ' else' + ' Value.Char := Max(Value.Char, 1);' + ' Value.Line := MinMax(Value.Line, 1, Lines.Count);' + ' if (fActiveSelectionMode = smNormal) then' + ' if (Value.Line >= 1) and (Value.Line <= Lines.Count) then' + + ' Value.Char := Min(Value.Char, Length(Lines[Value.Line - ' + + '1]) + 1)' + ' else' + ' Value.Char := 1;' + + ' if (Value.Char <> fBlockEnd.Char) or (Value.Line <> fBlockEn' + + 'd.Line) then' + ' begin' + + ' if (Value.Char <> fBlockEnd.Char) or (Value.Line <> fBlock' + + 'End.Line) then' + ' begin' + + ' if (fActiveSelectionMode = smColumn) and (Value.Char <> ' + + 'fBlockEnd.Char) then' + ' begin' + ' InvalidateLines(' + + ' Min(fBlockBegin.Line, Min(fBlockEnd.Line, Value.Line' + + ')),' + + ' Max(fBlockBegin.Line, Max(fBlockEnd.Line, Value.Line' + + ')));' + ' fBlockEnd := Value;' + ' end' + ' else begin' + ' nLine := fBlockEnd.Line;' + ' fBlockEnd := Value;' + + ' if (fActiveSelectionMode <> smColumn) or (fBlockBegin.' + + 'Char <> fBlockEnd.Char) then' + ' InvalidateLines(nLine, fBlockEnd.Line);' + ' end;' + ' StatusChanged([scSelection]);' + ' end;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetCaretX(Value: Integer);' + 'var' + ' vNewCaret: TBufferCoord;' + 'begin' + ' vNewCaret.Char := Value;' + ' vNewCaret.Line := CaretY;' + ' SetCaretXY(vNewCaret);' + 'end;' + '' + 'procedure TCustomSynEdit.SetCaretY(Value: Integer);' + 'var' + ' vNewCaret: TBufferCoord;' + 'begin' + ' vNewCaret.Line := Value;' + ' vNewCaret.Char := CaretX;' + ' SetCaretXY(vNewCaret);' + 'end;' + '' + 'procedure TCustomSynEdit.InternalSetCaretX(Value: Integer);' + 'var' + ' vNewCaret: TBufferCoord;' + 'begin' + ' vNewCaret.Char := Value;' + ' vNewCaret.Line := CaretY;' + ' InternalSetCaretXY(vNewCaret);' + 'end;' + '' + 'procedure TCustomSynEdit.InternalSetCaretY(Value: Integer);' + 'var' + ' vNewCaret: TBufferCoord;' + 'begin' + ' vNewCaret.Line := Value;' + ' vNewCaret.Char := CaretX;' + ' InternalSetCaretXY(vNewCaret);' + 'end;' + '' + 'function TCustomSynEdit.GetCaretXY: TBufferCoord;' + 'begin' + ' Result.Char := CaretX;' + ' Result.Line := CaretY;' + 'end;' + '' + 'function TCustomSynEdit.GetDisplayX: Integer;' + 'begin' + ' Result := DisplayXY.Column;' + 'end;' + '' + 'function TCustomSynEdit.GetDisplayY: Integer;' + 'begin' + ' if not WordWrap then' + ' Result := CaretY' + ' else' + ' Result := DisplayXY.Row;' + 'end;' + '' + 'Function TCustomSynEdit.GetDisplayXY: TDisplayCoord;' + 'begin' + ' Result := BufferToDisplayPos(CaretXY);' + ' if WordWrap and fCaretAtEOL then' + ' begin' + ' if Result.Column = 1 then' + ' begin' + ' Dec(Result.Row);' + + ' Result.Column := fWordWrapPlugin.GetRowLength(Result.Row) ' + + '+1;' + ' end' + ' else begin' + + ' // Work-around situations where fCaretAtEOL should have be' + + 'en updated because of' + + ' //text change (it'#39's only valid when Column = 1). Updating ' + + 'it in ProperSetLine()' + ' //would probably be the right thing, but...' + ' fCaretAtEOL := False;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetCaretXY(const Value: TBufferCoord);' + + '//there are two setCaretXY methods. One Internal, one External.' + + ' The published' + '//property CaretXY (re)sets the block as well' + 'begin' + ' IncPaintLock;' + ' try' + ' Include(fStatusChanges, scSelection);' + ' SetCaretXYEx(True, Value);' + ' if SelAvail then' + ' InvalidateSelection;' + ' fBlockBegin.Char := fCaretX;' + ' fBlockBegin.Line := fCaretY;' + ' fBlockEnd := fBlockBegin;' + ' finally' + ' DecPaintLock;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.InternalSetCaretXY(const Value: TBuffer' + + 'Coord);' + 'begin' + ' SetCaretXYEx(True, Value);' + 'end;' + '' + 'procedure TCustomSynEdit.UpdateLastCaretX;' + 'begin' + ' fLastCaretX := DisplayX;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetCaretXYEx(CallEnsureCursorPos: Boole' + + 'an; Value: TBufferCoord);' + 'var' + ' nMaxX: Integer;' + ' vTriggerPaint: boolean;' + 'begin' + ' fCaretAtEOL := False;' + ' vTriggerPaint := HandleAllocated;' + ' if vTriggerPaint then' + ' DoOnPaintTransient(ttBefore);' + ' if WordWrap then' + ' nMaxX := MaxInt' + ' else' + ' nMaxX := MaxScrollWidth + 1;' + ' if Value.Line > Lines.Count then' + ' Value.Line := Lines.Count;' + ' if Value.Line < 1 then' + ' begin' + + ' // this is just to make sure if Lines stringlist should be e' + + 'mpty' + ' Value.Line := 1;' + ' if not (eoScrollPastEol in fOptions) then' + ' nMaxX := 1;' + ' end' + ' else' + ' begin' + ' if not (eoScrollPastEol in fOptions) then' + ' nMaxX := Length(Lines[Value.Line - 1]) + 1;' + ' end;' + + ' if (Value.Char > nMaxX) and (not(eoScrollPastEol in Options) o' + + 'r' + ' not(eoAutoSizeMaxScrollWidth in Options)) then' + ' begin' + ' Value.Char := nMaxX;' + ' end;' + ' if Value.Char < 1 then' + ' Value.Char := 1;' + ' if (Value.Char <> fCaretX) or (Value.Line <> fCaretY) then' + ' begin' + ' IncPaintLock;' + ' try' + ' // simply include the flags, fPaintLock is > 0' + ' if fCaretX <> Value.Char then' + ' begin' + ' fCaretX := Value.Char;' + ' Include(fStatusChanges, scCaretX);' + ' end;' + ' if fCaretY <> Value.Line then' + ' begin' + ' if ActiveLineColor <> clNone then' + ' begin' + ' InvalidateLine(Value.Line);' + ' InvalidateLine(fCaretY);' + ' end;' + ' fCaretY := Value.Line;' + ' Include(fStatusChanges, scCaretY);' + ' end;' + + ' // Call UpdateLastCaretX before DecPaintLock because the e' + + 'vent handler it' + + ' // calls could raise an exception, and we don'#39't want fLast' + + 'CaretX to be' + ' // left in an undefined state if that happens.' + ' UpdateLastCaretX;' + ' if CallEnsureCursorPos then' + ' EnsureCursorPosVisible;' + ' Include(fStateFlags, sfCaretChanged);' + ' Include(fStateFlags, sfScrollbarChanged);' + ' finally' + ' DecPaintLock;' + ' end;' + ' end' + ' else begin' + + ' // Also call UpdateLastCaretX if the caret didn'#39't move. Apps' + + ' don'#39't know' + + ' // anything about fLastCaretX and they shouldn'#39't need to. So' + + ', to avoid any' + + ' // unwanted surprises, always update fLastCaretX whenever Ca' + + 'retXY is' + ' // assigned to.' + + ' // Note to SynEdit developers: If this is undesirable in som' + + 'e obscure' + + ' // case, just save the value of fLastCaretX before assigning' + + ' to CaretXY and' + ' // restore it afterward as appropriate.' + ' UpdateLastCaretX;' + ' end;' + ' if vTriggerPaint then' + ' DoOnPaintTransient(ttAfter);' + 'end;' + '' + 'function TCustomSynEdit.CaretInView: Boolean;' + 'var' + ' vCaretRowCol: TDisplayCoord;' + 'begin' + ' vCaretRowCol := DisplayXY;' + ' Result := (vCaretRowCol.Column >= LeftChar)' + ' and (vCaretRowCol.Column <= LeftChar + CharsInWindow)' + ' and (vCaretRowCol.Row >= TopLine)' + ' and (vCaretRowCol.Row <= TopLine + LinesInWindow);' + 'end;' + '' + 'procedure TCustomSynEdit.SetActiveLineColor(Value: TColor);' + 'begin' + ' if (fActiveLineColor<>Value) then' + ' begin' + ' fActiveLineColor:=Value;' + ' InvalidateLine(CaretY);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetFont(const Value: TFont);' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + 'var' + ' DC: HDC;' + ' Save: THandle;' + ' Metrics: TTextMetric;' + ' AveCW, MaxCW: Integer;' + '{$ENDIF}' + 'begin' + '{$IFDEF SYN_CLX}' + ' inherited Font := Value;' + '{$ELSE}' + ' DC := GetDC(0);' + ' Save := SelectObject(DC, Value.Handle);' + ' GetTextMetrics(DC, Metrics);' + ' SelectObject(DC, Save);' + ' ReleaseDC(0, DC);' + ' with Metrics do' + ' begin' + ' AveCW := tmAveCharWidth;' + ' MaxCW := tmMaxCharWidth;' + ' end;' + ' case AveCW = MaxCW of' + ' True: inherited Font := Value;' + ' False:' + ' begin' + ' with fFontDummy do' + ' begin' + ' Color := Value.Color;' + ' Pitch := fpFixed;' + ' Size := Value.Size;' + ' Style := Value.Style;' + ' Name := Value.Name;' + ' end;' + ' inherited Font := fFontDummy;' + ' end;' + ' end;' + '{$ENDIF}' + ' TSynEditStringList(fLines).FontChanged;' + ' if fGutter.ShowLineNumbers then' + ' GutterChanged(Self);' + 'end;' + '' + 'procedure TCustomSynEdit.SetGutterWidth(Value: Integer);' + 'begin' + ' Value := Max(Value, 0);' + ' if fGutterWidth <> Value then' + ' begin' + ' fGutterWidth := Value;' + + ' fTextOffset := fGutterWidth + 2 - (LeftChar - 1) * fCharWidt' + + 'h;' + ' if HandleAllocated then' + ' begin' + + ' fCharsInWindow := Max(ClientWidth - fGutterWidth - 2, 0) d' + + 'iv fCharWidth;' + ' if WordWrap then' + ' fWordWrapPlugin.DisplayChanged;' + ' UpdateScrollBars;' + ' Invalidate;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetLeftChar(Value: Integer);' + 'var' + ' MaxVal: Integer;' + ' iDelta: Integer;' + ' iTextArea: TRect;' + 'begin' + ' if WordWrap then' + ' Value := 1;' + '' + ' if eoScrollPastEol in Options then' + ' begin' + ' if eoAutoSizeMaxScrollWidth in Options then' + ' MaxVal := MaxInt - CharsInWindow' + ' else' + ' MaxVal := MaxScrollWidth - CharsInWindow + 1' + ' end' + ' else' + ' begin' + ' MaxVal := TSynEditStringList(Lines).LengthOfLongestLine;' + ' if MaxVal > CharsInWindow then' + ' MaxVal := MaxVal - CharsInWindow + 1' + ' else' + ' MaxVal := 1;' + ' end;' + ' Value := MinMax(Value, 1, MaxVal);' + ' if Value <> fLeftChar then' + ' begin' + ' iDelta := fLeftChar - Value;' + ' fLeftChar := Value;' + + ' fTextOffset := fGutterWidth + 2 - (LeftChar - 1) * fCharWidt' + + 'h;' + ' if Abs(iDelta) < CharsInWindow then' + ' begin' + ' iTextArea := ClientRect;' + ' Inc(iTextArea.Left, fGutterWidth + 2);' + '{$IFDEF SYN_CLX}' + ' ScrollWindow(Self, iDelta * CharWidth, 0, @iTextArea);' + '{$ELSE}' + + ' ScrollWindow(Handle, iDelta * CharWidth, 0, @iTextArea, @i' + + 'TextArea);' + '{$ENDIF}' + ' end' + ' else' + ' InvalidateLines(-1, -1);' + + ' if (Options >= [eoAutoSizeMaxScrollWidth, eoScrollPastEol]) ' + + 'and' + ' (MaxScrollWidth < LeftChar + CharsInWindow) then' + ' begin' + ' MaxScrollWidth := LeftChar + CharsInWindow' + ' end' + ' else' + ' UpdateScrollBars;' + ' StatusChanged([scLeftChar]);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetLines(Value: TUnicodeStrings);' + 'begin' + ' Lines.Assign(Value);' + 'end;' + '' + 'procedure TCustomSynEdit.SetLineText(Value: UnicodeString);' + 'begin' + ' if (CaretY >= 1) and (CaretY <= Max(1, Lines.Count)) then' + ' Lines[CaretY - 1] := Value;' + 'end;' + '' + 'procedure TCustomSynEdit.SetName(const Value: TComponentName);' + 'var' + ' TextToName: Boolean;' + 'begin' + + ' TextToName := (ComponentState * [csDesigning, csLoading] = [cs' + + 'Designing])' + ' and (TrimRight(Text) = Name);' + ' inherited SetName(Value);' + ' if TextToName then' + ' Text := Value;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetScrollBars(const Value: TScrollStyle' + + ');' + 'begin' + ' if (FScrollBars <> Value) then' + ' begin' + ' FScrollBars := Value;' + ' UpdateScrollBars;' + ' Invalidate;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetSelTextPrimitive(const Value: Unicod' + + 'eString);' + 'begin' + + ' SetSelTextPrimitiveEx(fActiveSelectionMode, PWideChar(Value), ' + + 'True);' + 'end;' + '' + + '// This is really a last minute change and I hope I did it right' + + '.' + + '// Reason for this modification: next two lines will loose the C' + + 'aretX position' + + '// if eoScrollPastEol is not set in Options. That is not really ' + + 'a good idea' + '// as we would typically want the cursor to stay where it is.' + + '// To fix this (in the absence of a better idea), I changed the ' + + 'code in' + + '// DeleteSelection not to trim the string if eoScrollPastEol is ' + + 'not set.' + + 'procedure TCustomSynEdit.SetSelTextPrimitiveEx(PasteMode: TSynSe' + + 'lectionMode;' + ' Value: PWideChar; AddToUndoList: Boolean);' + 'var' + ' BB, BE: TBufferCoord;' + ' TempString: UnicodeString;' + '' + ' procedure DeleteSelection;' + ' var' + ' x, MarkOffset, MarkOffset2: Integer;' + ' UpdateMarks: Boolean;' + ' begin' + ' UpdateMarks := False;' + ' MarkOffset := 0;' + ' MarkOffset2 := 0;' + ' case fActiveSelectionMode of' + ' smNormal:' + ' begin' + ' if Lines.Count > 0 then' + ' begin' + + ' // Create a string that contains everything on the' + + ' first line up' + + ' // to the selection mark, and everything on the la' + + 'st line after' + ' // the selection mark.' + ' if BB.Char > 1 then' + ' MarkOffset2 := 1;' + + ' TempString := Copy(Lines[BB.Line - 1], 1, BB.Char - ' + + '1) +' + ' Copy(Lines[BE.Line - 1], BE.Char, MaxInt);' + ' // Delete all lines in the selection range.' + + ' TSynEditStringList(Lines).DeleteLines(BB.Line, BE.Li' + + 'ne - BB.Line);' + + ' // Put the stuff that was outside of selection bac' + + 'k in.' + + ' if Options >= [eoScrollPastEol, eoTrimTrailingSpaces' + + '] then' + ' TempString := TrimTrailingSpaces(TempString);' + ' Lines[BB.Line - 1] := TempString;' + ' end;' + ' UpdateMarks := True;' + ' InternalCaretXY := BB;' + ' end;' + ' smColumn:' + ' begin' + ' // swap X if needed' + ' if BB.Char > BE.Char then' + ' SwapInt(Integer(BB.Char), Integer(BE.Char));' + '' + ' for x := BB.Line - 1 to BE.Line - 1 do' + ' begin' + ' TempString := Lines[x];' + ' Delete(TempString, BB.Char, BE.Char - BB.Char);' + ' ProperSetLine(x, TempString);' + ' end;' + + ' // Lines never get deleted completely, so keep caret a' + + 't end.' + + ' InternalCaretXY := BufferCoord(BB.Char, fBlockEnd.Line' + + ');' + + ' // Column deletion never removes a line entirely, so n' + + 'o mark' + ' // updating is needed here.' + ' end;' + ' smLine:' + ' begin' + ' if BE.Line = Lines.Count then' + ' begin' + ' Lines[BE.Line - 1] := '#39#39';' + ' for x := BE.Line - 2 downto BB.Line - 1 do' + ' Lines.Delete(x);' + ' end' + ' else begin' + ' for x := BE.Line - 1 downto BB.Line - 1 do' + ' Lines.Delete(x);' + ' end;' + ' // smLine deletion always resets to first column.' + ' InternalCaretXY := BufferCoord(1, BB.Line);' + ' UpdateMarks := TRUE;' + ' MarkOffset := 1;' + ' end;' + ' end;' + ' // Update marks' + ' if UpdateMarks then' + + ' DoLinesDeleted(BB.Line + MarkOffset2, BE.Line - BB.Line + ' + + 'MarkOffset);' + ' end;' + '' + ' procedure InsertText;' + '' + ' function CountLines(p: PWideChar): Integer;' + ' begin' + ' Result := 0;' + ' while p^ <> #0 do' + ' begin' + ' if p^ = #13 then' + ' Inc(p);' + ' if p^ = #10 then' + ' Inc(p);' + ' Inc(Result);' + ' p := GetEOL(p);' + ' end;' + ' end;' + '' + ' function InsertNormal: Integer;' + ' var' + ' sLeftSide: UnicodeString;' + ' sRightSide: UnicodeString;' + ' Str: UnicodeString;' + ' Start: PWideChar;' + ' P: PWideChar;' + ' begin' + ' Result := 0;' + ' sLeftSide := Copy(LineText, 1, CaretX - 1);' + ' if CaretX - 1 > Length(sLeftSide) then' + ' begin' + ' sLeftSide := sLeftSide + UnicodeStringOfChar(#32,' + ' CaretX - 1 - Length(sLeftSide));' + ' end;' + + ' sRightSide := Copy(LineText, CaretX, Length(LineText) - (C' + + 'aretX - 1));' + ' // step1: insert the first line of Value into current line' + ' Start := PWideChar(Value);' + ' P := GetEOL(Start);' + ' if P^ <> #0 then' + ' begin' + ' Str := sLeftSide + Copy(Value, 1, P - Start);' + ' ProperSetLine(CaretY - 1, Str);' + + ' TSynEditStringList(Lines).InsertLines(CaretY, CountLines' + + '(P));' + ' end' + ' else begin' + ' Str := sLeftSide + Value + sRightSide;' + ' ProperSetLine(CaretY -1, Str);' + ' end;' + ' // step2: insert left lines of Value' + ' while P^ <> #0 do' + ' begin' + ' if P^ = #13 then' + ' Inc(P);' + ' if P^ = #10 then' + ' Inc(P);' + ' Inc(fCaretY);' + ' Include(fStatusChanges, scCaretY);' + ' Start := P;' + ' P := GetEOL(Start);' + ' if P = Start then' + ' begin' + ' if p^ <> #0 then' + ' Str := '#39#39 + ' else' + ' Str := sRightSide;' + ' end' + ' else begin' + ' SetString(Str, Start, P - Start);' + ' if p^ = #0 then' + ' Str := Str + sRightSide' + ' end;' + ' ProperSetLine(CaretY -1, Str);' + ' Inc(Result);' + ' end;' + ' if eoTrimTrailingSpaces in Options then' + ' if sRightSide = '#39#39' then' + ' fCaretX := GetExpandedLength(Str, TabWidth) + 1' + ' else' + + ' fCaretX := 1 + Length(Lines[CaretY - 1]) - Length(Trim' + + 'TrailingSpaces(sRightSide))' + + ' else fCaretX := 1 + Length(Lines[CaretY - 1]) - Length(sRi' + + 'ghtSide);' + ' StatusChanged([scCaretX]);' + ' end;' + '' + ' function InsertColumn: Integer;' + ' var' + ' Str: UnicodeString;' + ' Start: PWideChar;' + ' P: PWideChar;' + ' Len: Integer;' + ' InsertPos: Integer;' + ' LineBreakPos: TBufferCoord;' + ' begin' + ' Result := 0;' + ' // Insert string at current position' + ' InsertPos := CaretX;' + ' Start := PWideChar(Value);' + ' repeat' + ' P := GetEOL(Start);' + ' if P <> Start then' + ' begin' + ' SetLength(Str, P - Start);' + ' Move(Start^, Str[1], (P - Start) * sizeof(WideChar));' + ' if CaretY > Lines.Count then' + ' begin' + ' Inc(Result);' + + ' TempString := UnicodeStringOfChar(#32, InsertPos - 1' + + ') + Str;' + ' Lines.Add('#39#39');' + ' if AddToUndoList then' + ' begin' + ' LineBreakPos.Line := CaretY -1;' + + ' LineBreakPos.Char := Length(Lines[CaretY - 2]) + 1' + + ';' + + ' fUndoList.AddChange(crLineBreak, LineBreakPos, Lin' + + 'eBreakPos, '#39#39', smNormal);' + ' end;' + ' end' + ' else begin' + ' TempString := Lines[CaretY - 1];' + ' Len := Length(TempString);' + ' if Len < InsertPos then' + ' begin' + ' TempString :=' + + ' TempString + UnicodeStringOfChar(#32, InsertPos ' + + '- Len - 1) + Str' + ' end' + ' else' + ' Insert(Str, TempString, InsertPos);' + ' end;' + ' ProperSetLine(CaretY - 1, TempString);' + ' // Add undo change here from PasteFromClipboard' + ' if AddToUndoList then' + ' begin' + + ' fUndoList.AddChange(crPaste, BufferCoord(InsertPos, ' + + 'CaretY),' + + ' BufferCoord(InsertPos + (P - Start), CaretY), '#39#39',' + + ' fActiveSelectionMode);' + ' end;' + ' end;' + ' if P^ = #13 then' + ' begin' + ' Inc(P);' + ' if P^ = #10 then' + ' Inc(P);' + ' Inc(fCaretY);' + ' Include(fStatusChanges, scCaretY);' + ' end;' + ' Start := P;' + ' until P^ = #0;' + ' Inc(fCaretX, Length(Str));' + ' Include(fStatusChanges, scCaretX);' + ' end;' + '' + ' function InsertLine: Integer;' + ' var' + ' Start: PWideChar;' + ' P: PWideChar;' + ' Str: UnicodeString;' + ' n: Integer;' + ' begin' + ' Result := 0;' + ' fCaretX := 1;' + ' // Insert string before current line' + ' Start := PWideChar(Value);' + ' repeat' + ' P := GetEOL(Start);' + ' if P <> Start then' + ' begin' + ' SetLength(Str, P - Start);' + ' Move(Start^, Str[1], (P - Start) * sizeof(WideChar));' + ' end' + ' else' + ' Str := '#39#39';' + ' if (P^ = #0) then' + ' begin' + ' n := Lines.Count;' + ' if (n >= CaretY) then' + ' Lines[CaretY - 1] := Str + Lines[CaretY - 1]' + ' else' + ' Lines.Add(Str);' + ' if eoTrimTrailingSpaces in Options then' + + ' Lines[CaretY - 1] := TrimTrailingSpaces(Lines[CaretY' + + ' - 1]);' + ' fCaretX := 1 + Length(Str);' + ' end' + ' else begin' + ' //--------- KV from SynEditStudio' + ' if (CaretY = Lines.Count) or InsertMode then' + ' begin' + ' Lines.Insert(CaretY -1, '#39#39');' + ' Inc(Result);' + ' end;' + ' //---------' + ' ProperSetLine(CaretY - 1, Str);' + ' Inc(fCaretY);' + ' Include(fStatusChanges, scCaretY);' + ' Inc(Result);' + ' if P^ = #13 then' + ' Inc(P);' + ' if P^ = #10 then' + ' Inc(P);' + ' Start := P;' + ' end;' + ' until P^ = #0;' + ' StatusChanged([scCaretX]);' + ' end;' + '' + ' var' + ' StartLine: Integer;' + ' StartCol: Integer;' + ' InsertedLines: Integer;' + ' begin' + ' if Value = '#39#39' then' + ' Exit;' + '' + ' StartLine := CaretY;' + ' StartCol := CaretX;' + ' case PasteMode of' + ' smNormal:' + ' InsertedLines := InsertNormal;' + ' smColumn:' + ' InsertedLines := InsertColumn;' + ' smLine:' + ' InsertedLines := InsertLine;' + ' else' + ' InsertedLines := 0;' + ' end;' + + ' // We delete selected based on the current selection mode, b' + + 'ut paste' + + ' // what'#39's on the clipboard according to what it was when cop' + + 'ied.' + ' // Update marks' + ' if InsertedLines > 0 then' + ' begin' + ' if (PasteMode = smNormal) and (StartCol > 1) then' + ' Inc(StartLine);' + ' DoLinesInserted(StartLine, InsertedLines);' + ' end;' + ' // Force caret reset' + ' InternalCaretXY := CaretXY;' + ' end;' + '' + 'begin' + ' IncPaintLock;' + ' Lines.BeginUpdate;' + ' try' + ' BB := BlockBegin;' + ' BE := BlockEnd;' + ' if SelAvail then' + ' begin' + ' DeleteSelection;' + ' InternalCaretXY := BB;' + ' end;' + ' if (Value <> nil) and (Value[0] <> #0) then' + ' InsertText;' + ' if CaretY < 1 then' + ' InternalCaretY := 1;' + ' finally' + ' Lines.EndUpdate;' + ' DecPaintLock;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SynSetText(const Value: UnicodeString);' + 'begin' + ' Lines.Text := Value;' + 'end;' + '' + 'procedure TCustomSynEdit.SetTopLine(Value: Integer);' + 'var' + ' Delta: Integer;' + '{$IFDEF SYN_CLX}' + ' iClip: TRect;' + '{$ENDIF}' + 'begin' + ' if (eoScrollPastEof in Options) then' + ' Value := Min(Value, DisplayLineCount)' + ' else' + ' Value := Min(Value, DisplayLineCount - fLinesInWindow + 1);' + ' Value := Max(Value, 1);' + ' if Value <> TopLine then' + ' begin' + ' Delta := TopLine - Value;' + ' fTopLine := Value;' + ' if Abs(Delta) < fLinesInWindow then' + '{$IFDEF SYN_CLX}' + ' begin' + ' iClip := GetClientRect;' + ' ScrollWindow(Self, 0, fTextHeight * Delta, @iClip);' + ' end' + '{$ELSE}' + ' ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil)' + '{$ENDIF}' + ' else' + ' Invalidate;' + '' + ' UpdateWindow(Handle);' + ' UpdateScrollBars;' + ' StatusChanged([scTopLine]);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ShowCaret;' + 'begin' + + ' if not (eoNoCaret in Options) and not (sfCaretVisible in fStat' + + 'eFlags) then' + ' begin' + '{$IFDEF SYN_CLX}' + ' kTextDrawer.ShowCaret(Self);' + '{$ELSE}' + ' if Windows.ShowCaret(Handle) then' + '{$ENDIF}' + ' Include(fStateFlags, sfCaretVisible);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.UpdateCaret;' + 'var' + ' CX, CY: Integer;' + ' iClientRect: TRect;' + ' vCaretDisplay: TDisplayCoord;' + ' vCaretPix: TPoint;' + '{$IFNDEF SYN_CLX}' + ' cf: TCompositionForm;' + '{$ENDIF}' + 'begin' + ' if (PaintLock <> 0) or not (Focused or FAlwaysShowCaret) then' + ' Include(fStateFlags, sfCaretChanged)' + ' else' + ' begin' + ' Exclude(fStateFlags, sfCaretChanged);' + ' vCaretDisplay := DisplayXY;' + + ' if WordWrap and (vCaretDisplay.Column > CharsInWindow + 1) t' + + 'hen' + ' vCaretDisplay.Column := CharsInWindow + 1;' + ' vCaretPix := RowColumnToPixels(vCaretDisplay);' + ' CX := vCaretPix.X + FCaretOffset.X;' + ' CY := vCaretPix.Y + FCaretOffset.Y;' + ' iClientRect := GetClientRect;' + ' Inc(iClientRect.Left, fGutterWidth);' + ' if (CX >= iClientRect.Left) and (CX < iClientRect.Right)' + + ' and (CY >= iClientRect.Top) and (CY < iClientRect.Bottom) ' + + 'then' + ' begin' + ' SetCaretPos(CX, CY);' + ' ShowCaret;' + ' end' + ' else' + ' begin' + ' SetCaretPos(CX, CY);' + ' HideCaret;' + ' end;' + '{$IFNDEF SYN_CLX}' + ' cf.dwStyle := CFS_POINT;' + ' cf.ptCurrentPos := Point(CX, CY);' + ' ImmSetCompositionWindow(ImmGetContext(Handle), @cf);' + '{$ENDIF}' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.UpdateScrollBars;' + 'var' + ' nMaxScroll: Integer;' + '{$IFNDEF SYN_CLX}' + ' ScrollInfo: TScrollInfo;' + ' iRightChar: Integer;' + '{$ELSE}' + ' iClientRect: TRect;' + '' + ' procedure CalcScrollbarsVisible;' + ' begin' + ' if not HandleAllocated or (PaintLock <> 0) then' + ' Include(fStateFlags, sfScrollbarChanged)' + ' else begin' + ' Exclude(fStateFlags, sfScrollbarChanged);' + ' if fScrollBars <> ssNone then' + ' begin' + + ' if (fScrollBars in [ssBoth, ssHorizontal]) and (not Word' + + 'Wrap) then' + ' begin' + ' if eoScrollPastEol in Options then' + ' nMaxScroll := MaxScrollWidth' + ' else' + + ' nMaxScroll := Max(TSynEditStringList(Lines).LengthOf' + + 'LongestLine, 1);' + '' + ' FHScrollBar.Min := 1;' + + ' FHScrollBar.Max := nMaxScroll; // Qt handles values ab' + + 'ove MAX_SCROLL' + ' FHScrollBar.Position := LeftChar;' + + ' FHScrollBar.LargeChange := CharsInWindow - Ord(eoScrol' + + 'lByOneLess in fOptions);' + '' + ' if eoHideShowScrollbars in Options then' + ' FHScrollBar.Visible := nMaxScroll > CharsInWindow' + ' else FHScrollBar.Visible := True;' + '' + ' end' + ' else' + ' FHScrollBar.Visible := False;' + '' + ' if fScrollBars in [ssBoth, ssVertical] then' + ' begin' + ' nMaxScroll := DisplayLineCount;' + ' if eoScrollPastEof in Options then' + ' Inc(nMaxScroll, LinesInWindow - 1);' + '' + ' FVScrollBar.Min := 1;' + ' FVScrollBar.Max := Max(1, nMaxScroll);' + + ' FVScrollBar.LargeChange := LinesInWindow shr Ord(eoHal' + + 'fPageScroll in fOptions);' + ' FVScrollBar.Position := TopLine;' + '' + ' if eoHideShowScrollbars in Options then' + ' FVScrollBar.Visible := nMaxScroll > LinesInWindow' + ' else' + ' FVScrollBar.Visible := True;' + ' end' + ' else' + ' FVScrollBar.Visible:=FALSE;' + ' end' + ' else' + ' begin' + ' FHScrollBar.Visible := False;' + ' FVScrollBar.Visible := False;' + ' end;' + ' end;' + ' end;' + '' + '{$ENDIF}' + 'begin' + '{$IFNDEF SYN_CLX}' + ' if not HandleAllocated or (PaintLock <> 0) then' + ' Include(fStateFlags, sfScrollbarChanged)' + ' else begin' + ' Exclude(fStateFlags, sfScrollbarChanged);' + ' if fScrollBars <> ssNone then' + ' begin' + ' ScrollInfo.cbSize := SizeOf(ScrollInfo);' + ' ScrollInfo.fMask := SIF_ALL;' + ' if not(eoHideShowScrollbars in Options) then' + ' begin' + + ' ScrollInfo.fMask := ScrollInfo.fMask or SIF_DISABLENOSCR' + + 'OLL;' + ' end;' + '' + ' if Visible then SendMessage(Handle, WM_SETREDRAW, 0, 0);' + '' + + ' if (fScrollBars in [ssBoth, ssHorizontal]) and not WordWra' + + 'p then' + ' begin' + ' if eoScrollPastEol in Options then' + ' nMaxScroll := MaxScrollWidth' + ' else' + + ' nMaxScroll := Max(TSynEditStringList(Lines).LengthOfLo' + + 'ngestLine, 1);' + ' if nMaxScroll <= MAX_SCROLL then' + ' begin' + ' ScrollInfo.nMin := 1;' + ' ScrollInfo.nMax := nMaxScroll;' + ' ScrollInfo.nPage := CharsInWindow;' + ' ScrollInfo.nPos := LeftChar;' + ' end' + ' else begin' + ' ScrollInfo.nMin := 0;' + ' ScrollInfo.nMax := MAX_SCROLL;' + + ' ScrollInfo.nPage := MulDiv(MAX_SCROLL, CharsInWindow, ' + + 'nMaxScroll);' + + ' ScrollInfo.nPos := MulDiv(MAX_SCROLL, LeftChar, nMaxSc' + + 'roll);' + ' end;' + '' + + ' ShowScrollBar(Handle, SB_HORZ, not(eoHideShowScrollbars ' + + 'in Options) or' + + ' (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > CharsInWin' + + 'dow));' + ' SetScrollInfo(Handle, SB_HORZ, ScrollInfo, True);' + '' + ' //Now for the arrows' + + ' if (eoDisableScrollArrows in Options) or (nMaxScroll <= ' + + 'CharsInWindow) then' + ' begin' + ' iRightChar := LeftChar + CharsInWindow -1;' + ' if (LeftChar <= 1) and (iRightChar >= nMaxScroll) then' + ' begin' + ' EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_BOTH);' + ' end' + ' else begin' + ' EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH);' + ' if (LeftChar <= 1) then' + ' EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_LEFT)' + ' else if iRightChar >= nMaxScroll then' + + ' EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_RIGHT' + + ')' + ' end;' + ' end' + ' else' + ' EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH);' + ' end' + ' else' + ' ShowScrollBar(Handle, SB_HORZ, False);' + '' + ' if fScrollBars in [ssBoth, ssVertical] then' + ' begin' + ' nMaxScroll := DisplayLineCount;' + ' if (eoScrollPastEof in Options) then' + ' Inc(nMaxScroll, LinesInWindow - 1);' + ' if nMaxScroll <= MAX_SCROLL then' + ' begin' + ' ScrollInfo.nMin := 1;' + ' ScrollInfo.nMax := Max(1, nMaxScroll);' + ' ScrollInfo.nPage := LinesInWindow;' + ' ScrollInfo.nPos := TopLine;' + ' end' + ' else begin' + ' ScrollInfo.nMin := 0;' + ' ScrollInfo.nMax := MAX_SCROLL;' + + ' ScrollInfo.nPage := MulDiv(MAX_SCROLL, LinesInWindow, ' + + 'nMaxScroll);' + + ' ScrollInfo.nPos := MulDiv(MAX_SCROLL, TopLine, nMaxScr' + + 'oll);' + ' end;' + '' + + ' ShowScrollBar(Handle, SB_VERT, not(eoHideShowScrollbars ' + + 'in Options) or' + + ' (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > LinesInWin' + + 'dow));' + ' SetScrollInfo(Handle, SB_VERT, ScrollInfo, True);' + '' + + ' if (eoDisableScrollArrows in Options) or (nMaxScroll <= ' + + 'LinesInWindow) then' + ' begin' + + ' if (TopLine <= 1) and (nMaxScroll <= LinesInWindow) th' + + 'en' + ' begin' + ' EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_BOTH);' + ' end' + ' else begin' + ' EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH);' + ' if (TopLine <= 1) then' + ' EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_UP)' + + ' else if ((DisplayLineCount - TopLine - LinesInWindow' + + ' + 1) = 0) then' + + ' EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_DOWN)' + + ';' + ' end;' + ' end' + ' else' + ' EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH);' + '' + + ' if Visible then SendMessage(Handle, WM_SETREDRAW, -1, 0)' + + ';' + ' if fPaintLock=0 then' + ' Invalidate;' + '' + ' end' + ' else' + ' ShowScrollBar(Handle, SB_VERT, False);' + '' + ' end {endif fScrollBars <> ssNone}' + ' else' + ' ShowScrollBar(Handle, SB_BOTH, False);' + ' end;' + '{$ELSE}' + ' if FHScrollBar<>nil then' + ' begin' + ' CalcScrollBarsVisible;' + '' + ' iClientRect := GetClientRect;' + '' + ' FHScrollBar.Left := iClientRect.Left;' + ' FHScrollBar.Top := iClientRect.Bottom;' + ' FHScrollBar.Width := iClientRect.Right - iClientRect.Left;' + '' + ' FVScrollBar.Top := iClientRect.Top;' + ' FVScrollBar.Left := iClientRect.Right;' + + ' FVScrollBar.Height := iClientRect.Bottom - iClientRect.Top' + + ';' + ' end;' + '{$ENDIF}' + 'end;' + '' + '{$IFDEF SYN_CLX}' + + 'procedure TCustomSynEdit.ScrollEvent(Sender: TObject; ScrollCode' + + ': TScrollCode; var ScrollPos: Integer);' + 'var' + ' ScrollKind: TScrollBarKind;' + 'begin' + ' if Sender = FHScrollBar then' + ' begin' + ' ScrollKind := sbHorizontal;' + ' LeftChar := ScrollPos;' + ' end' + ' else if Sender = FVScrollBar then' + ' begin' + ' ScrollKind := sbVertical;' + ' TopLine := ScrollPos;' + ' end' + ' else' + ' Exit;' + + ' if Visible and CanFocus and not (csDesigning in ComponentState' + + ') then' + ' SetFocus' + ' else' + ' UpdateCaret;' + ' if Assigned(OnScroll) then OnScroll(Self,ScrollKind);' + 'end;' + '' + 'function TCustomSynEdit.GetClientRect: TRect;' + 'begin' + ' Result := Inherited GetClientRect;' + ' if FHScrollBar.Visible then' + ' Result.Bottom := Result.Bottom - CYHSCROLL;' + ' if FVScrollBar.Visible then' + ' Result.Right := Result.Right - CXVSCROLL;' + ' if BorderStyle <> bsNone then' + ' InflateRect(Result, -FrameWidth, -FrameWidth);' + 'end;' + '' + 'function TCustomSynEdit.GetClientOrigin: TPoint;' + 'begin' + ' Result := inherited GetClientOrigin;' + ' if BorderStyle <> bsNone then' + ' begin' + ' Inc(Result.X, FrameWidth);' + ' Inc(Result.Y, FrameWidth);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.Resize;' + 'begin' + ' inherited Resize;' + ' SizeOrFontChanged(False);' + 'end;' + '' + 'function TCustomSynEdit.WidgetFlags: Integer;' + 'begin' + ' Result := Integer(WidgetFlags_WRepaintNoErase);' + 'end;' + '{$ENDIF}' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + 'function TCustomSynEdit.DoMouseWheel(Shift: TShiftState;' + ' WheelDelta: Integer; MousePos: TPoint): Boolean;' + 'const' + ' WHEEL_DIVISOR = 120; // Mouse Wheel standard' + 'var' + ' iWheelClicks: Integer;' + ' iLinesToScroll: Integer;' + 'begin' + ' Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos);' + ' if Result then' + ' Exit;' + '{$IFDEF SYN_CLX}' + ' if ssCtrl in Application.KeyState then' + '{$ELSE}' + ' if GetKeyState(SYNEDIT_CONTROL) < 0 then' + '{$ENDIF}' + + ' iLinesToScroll := LinesInWindow shr Ord(eoHalfPageScroll in ' + + 'fOptions)' + ' else' + ' iLinesToScroll := 3;' + ' Inc(fMouseWheelAccumulator, WheelDelta);' + ' iWheelClicks := fMouseWheelAccumulator div WHEEL_DIVISOR;' + + ' fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DIV' + + 'ISOR;' + ' TopLine := TopLine - iWheelClicks * iLinesToScroll;' + ' Update;' + ' if Assigned(OnScroll) then OnScroll(Self,sbVertical);' + ' Result := True;' + 'end;' + '{$ENDIF}' + '' + '{$IFDEF SYN_CLX}' + + 'procedure TCustomSynEdit.KeyString(var S: UnicodeString; var Han' + + 'dled: Boolean);' + 'var' + ' i: Integer;' + 'begin' + ' inherited;' + ' Handled := True;' + ' for i := 1 to Length(S) do' + ' DoKeyPressW(S[i]);' + 'end;' + '' + + 'function TCustomSynEdit.NeedKey(Key: Integer; Shift: TShiftState' + + ';' + ' const KeyText: UnicodeString): Boolean;' + 'begin' + ' if ((Key = Key_Return) or (Key = Key_Enter)) then' + ' Result := WantReturns' + ' else' + ' Result := inherited NeedKey(Key, Shift, KeyText);' + 'end;' + '{$ENDIF SYN_CLX}' + '' + '{$IFNDEF SYN_CLX}' + 'procedure TCustomSynEdit.WMCaptureChanged(var Msg: TMessage);' + 'begin' + ' fScrollTimer.Enabled := False;' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.WMChar(var Msg: TWMChar);' + 'begin' + '{$IFNDEF UNICODE}' + ' if not Win32PlatformIsUnicode then' + ' Msg.CharCode := Word(KeyUnicode(AnsiChar(Msg.CharCode)));' + '{$ENDIF}' + '' + ' DoKeyPressW(Msg);' + 'end;' + '' + 'procedure TCustomSynEdit.WMClear(var Msg: TMessage);' + 'begin' + ' if not ReadOnly then' + ' SelText := '#39#39';' + 'end;' + '' + 'procedure TCustomSynEdit.WMCopy(var Message: TMessage);' + 'begin' + ' CopyToClipboard;' + ' Message.Result := ord(True);' + 'end;' + '' + 'procedure TCustomSynEdit.WMCut(var Message: TMessage);' + 'begin' + ' if not ReadOnly then' + ' CutToClipboard;' + ' Message.Result := ord(True);' + 'end;' + '' + 'procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage);' + 'var' + ' i, iNumberDropped: Integer;' + ' FileNameA: array[0..MAX_PATH - 1] of AnsiChar;' + ' FileNameW: array[0..MAX_PATH - 1] of WideChar;' + ' Point: TPoint;' + ' FilesList: TUnicodeStringList;' + 'begin' + ' try' + ' if Assigned(fOnDropFiles) then' + ' begin' + ' FilesList := TUnicodeStringList.Create;' + ' try' + + ' iNumberDropped := DragQueryFile(THandle(Msg.wParam), Car' + + 'dinal(-1),' + ' nil, 0);' + ' DragQueryPoint(THandle(Msg.wParam), Point);' + '' + ' if Win32PlatformIsUnicode then' + ' for i := 0 to iNumberDropped - 1 do' + ' begin' + ' DragQueryFileW(THandle(Msg.wParam), i, FileNameW,' + ' sizeof(FileNameW) div 2);' + ' FilesList.Add(FileNameW)' + ' end' + ' else' + ' for i := 0 to iNumberDropped - 1 do' + ' begin' + ' DragQueryFileA(THandle(Msg.wParam), i, FileNameA,' + ' sizeof(FileNameA));' + ' FilesList.Add(UnicodeString(FileNameA))' + ' end;' + ' fOnDropFiles(Self, Point.X, Point.Y, FilesList);' + ' finally' + ' FilesList.Free;' + ' end;' + ' end;' + ' finally' + ' Msg.Result := 0;' + ' DragFinish(THandle(Msg.wParam));' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.WMDestroy(var Message: TWMDestroy);' + 'begin' + ' {$IFDEF UNICODE}' + + ' // assign WindowText here, otherwise the VCL will call GetText' + + ' twice' + ' if WindowText = nil then' + ' WindowText := Lines.GetText;' + ' {$ENDIF}' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.WMEraseBkgnd(var Msg: TMessage);' + 'begin' + ' Msg.Result := 1;' + 'end;' + '' + 'procedure TCustomSynEdit.WMGetDlgCode(var Msg: TWMGetDlgCode);' + 'begin' + ' inherited;' + ' Msg.Result := Msg.Result or DLGC_WANTARROWS or DLGC_WANTCHARS;' + ' if fWantTabs then' + ' Msg.Result := Msg.Result or DLGC_WANTTAB;' + ' if fWantReturns then' + ' Msg.Result := Msg.Result or DLGC_WANTALLKEYS;' + 'end;' + '' + 'procedure TCustomSynEdit.WMGetText(var Msg: TWMGetText);' + 'begin' + ' if HandleAllocated and IsWindowUnicode(Handle) then' + ' begin' + + ' WStrLCopy(PWideChar(Msg.Text), PWideChar(Text), Msg.TextMax ' + + '- 1);' + ' Msg.Result := WStrLen(PWideChar(Msg.Text));' + ' end' + ' else' + ' begin' + + ' StrLCopy(PAnsiChar(Msg.Text), PAnsiChar(AnsiString(Text)), M' + + 'sg.TextMax - 1);' + ' Msg.Result := StrLen(PAnsiChar(Msg.Text));' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.WMGetTextLength(var Msg: TWMGetTextLeng' + + 'th);' + 'begin' + '{$IFDEF SYN_COMPILER_4_UP}' + + ' // Avoid (useless) temporary copy of WindowText while window i' + + 's recreated' + ' // because of docking.' + ' if csDocking in ControlState then' + ' Msg.Result := 0' + ' else' + '{$ENDIF}' + ' Msg.Result := Length(Text);' + 'end;' + '' + 'procedure TCustomSynEdit.WMHScroll(var Msg: TWMScroll);' + 'var' + ' iMaxWidth: integer;' + 'begin' + ' Msg.Result := 0;' + ' case Msg.ScrollCode of' + ' // Scrolls to start / end of the line' + ' SB_LEFT: LeftChar := 1;' + ' SB_RIGHT:' + ' if eoScrollPastEol in Options then' + ' LeftChar := MaxScrollWidth - CharsInWindow +1' + ' else' + + ' // Simply set LeftChar property to the LengthOfLongestLi' + + 'ne,' + + ' // it would do the range checking and constrain the valu' + + 'e if necessary' + + ' LeftChar := TSynEditStringList(Lines).LengthOfLongestLin' + + 'e;' + ' // Scrolls one char left / right' + ' SB_LINERIGHT: LeftChar := LeftChar + 1;' + ' SB_LINELEFT: LeftChar := LeftChar - 1;' + ' // Scrolls one page of chars left / right' + ' SB_PAGERIGHT: LeftChar := LeftChar' + ' + (fCharsInWindow - Ord(eoScrollByOneLess in fOptions));' + ' SB_PAGELEFT: LeftChar := LeftChar' + ' - (fCharsInWindow - Ord(eoScrollByOneLess in fOptions));' + ' // Scrolls to the current scroll bar position' + ' SB_THUMBPOSITION,' + ' SB_THUMBTRACK:' + ' begin' + ' FIsScrolling := True;' + ' if eoScrollPastEol in Options then' + ' iMaxWidth := MaxScrollWidth' + ' else' + + ' iMaxWidth := Max(TSynEditStringList(Lines).LengthOfLonge' + + 'stLine, 1);' + ' if iMaxWidth > MAX_SCROLL then' + ' LeftChar := MulDiv(iMaxWidth, Msg.Pos, MAX_SCROLL)' + ' else' + ' LeftChar := Msg.Pos;' + ' end;' + ' SB_ENDSCROLL: FIsScrolling := False;' + ' end;' + ' if Assigned(OnScroll) then OnScroll(Self,sbHorizontal);' + 'end;' + '' + 'function IsWindows98orLater: Boolean;' + 'begin' + ' Result := (Win32MajorVersion > 4) or' + ' (Win32MajorVersion = 4) and (Win32MinorVersion > 0);' + 'end;' + '' + 'procedure TCustomSynEdit.WMImeChar(var Msg: TMessage);' + 'begin' + + ' // do nothing here, the IME string is retrieved in WMImeCompos' + + 'ition' + '' + + ' // Handling the WM_IME_CHAR message stops Windows from sending' + + ' WM_CHAR' + ' // messages while using the IME' + 'end;' + '' + 'procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage);' + 'var' + ' imc: HIMC;' + ' PW: PWideChar;' + ' PA: PAnsiChar;' + ' PWLength: Integer;' + ' ImeCount: Integer;' + 'begin' + ' if (Msg.LParam and GCS_RESULTSTR) <> 0 then' + ' begin' + ' imc := ImmGetContext(Handle);' + ' try' + ' if IsWindows98orLater then' + ' begin' + + ' ImeCount := ImmGetCompositionStringW(imc, GCS_RESULTSTR,' + + ' nil, 0);' + + ' // ImeCount is always the size in bytes, also for Unicod' + + 'e' + ' GetMem(PW, ImeCount + sizeof(WideChar));' + ' try' + + ' ImmGetCompositionStringW(imc, GCS_RESULTSTR, PW, ImeCo' + + 'unt);' + ' PW[ImeCount div sizeof(WideChar)] := #0;' + ' CommandProcessor(ecImeStr, #0, PW);' + ' finally' + ' FreeMem(PW);' + ' end;' + ' end' + ' else' + ' begin' + + ' ImeCount := ImmGetCompositionStringA(imc, GCS_RESULTSTR,' + + ' nil, 0);' + + ' // ImeCount is always the size in bytes, also for Unicod' + + 'e' + ' GetMem(PA, ImeCount + sizeof(AnsiChar));' + ' try' + + ' ImmGetCompositionStringA(imc, GCS_RESULTSTR, PA, ImeCo' + + 'unt);' + ' PA[ImeCount] := #0;' + '' + + ' PWLength := MultiByteToWideChar(DefaultSystemCodePage,' + + ' 0, PA, ImeCount,' + ' nil, 0);' + ' GetMem(PW, (PWLength + 1) * sizeof(WideChar));' + ' try' + + ' MultiByteToWideChar(DefaultSystemCodePage, 0, PA, Im' + + 'eCount,' + ' PW, PWLength);' + ' CommandProcessor(ecImeStr, #0, PW);' + ' finally' + ' FreeMem(PW);' + ' end;' + ' finally' + ' FreeMem(PA);' + ' end;' + ' end;' + ' finally' + ' ImmReleaseContext(Handle, imc);' + ' end;' + ' end;' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage);' + 'var' + ' imc: HIMC;' + ' LogFontW: TLogFontW;' + ' LogFontA: TLogFontA;' + 'begin' + ' with Msg do' + ' begin' + ' case WParam of' + ' IMN_SETOPENSTATUS:' + ' begin' + ' imc := ImmGetContext(Handle);' + ' if imc <> 0 then' + ' begin' + ' if IsWindows98orLater then' + ' begin' + + ' GetObjectW(Font.Handle, SizeOf(TLogFontW), @LogFon' + + 'tW);' + ' ImmSetCompositionFontW(imc, @LogFontW);' + ' end' + ' else' + ' begin' + + ' GetObjectA(Font.Handle, SizeOf(TLogFontA), @LogFon' + + 'tA);' + ' ImmSetCompositionFontA(imc, @LogFontA);' + ' end;' + ' ImmReleaseContext(Handle, imc);' + ' end;' + ' end;' + ' end;' + ' end;' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.WMKillFocus(var Msg: TWMKillFocus);' + 'begin' + ' inherited;' + ' CommandProcessor(ecLostFocus, #0, nil);' + + ' //Added check for focused to prevent caret disappearing proble' + + 'm' + ' if Focused or FAlwaysShowCaret then' + ' exit;' + ' HideCaret;' + ' Windows.DestroyCaret;' + ' if FHideSelection and SelAvail then' + ' InvalidateSelection;' + 'end;' + '' + 'procedure TCustomSynEdit.WMPaste(var Message: TMessage);' + 'begin' + ' if not ReadOnly then' + ' PasteFromClipboard;' + ' Message.Result := ord(True);' + 'end;' + '' + 'procedure TCustomSynEdit.WMCancelMode(var Message:TMessage);' + 'begin' + '' + 'end;' + '' + 'procedure TCustomSynEdit.WMSetFocus(var Msg: TWMSetFocus);' + 'begin' + ' CommandProcessor(ecGotFocus, #0, nil);' + '' + ' InitializeCaret;' + ' if FHideSelection and SelAvail then' + ' InvalidateSelection;' + 'end;' + '' + 'procedure TCustomSynEdit.WMSetText(var Msg: TWMSetText);' + 'begin' + ' Msg.Result := 1;' + ' try' + ' if HandleAllocated and IsWindowUnicode(Handle) then' + ' Text := PWideChar(Msg.Text)' + ' else' + ' Text := UnicodeString(PAnsiChar(Msg.Text));' + ' except' + ' Msg.Result := 0;' + ' raise' + ' end' + 'end;' + '' + 'procedure TCustomSynEdit.WMSize(var Msg: TWMSize);' + 'begin' + ' inherited;' + ' SizeOrFontChanged(False);' + 'end;' + '' + 'procedure TCustomSynEdit.WMUndo(var Msg: TMessage);' + 'begin' + ' Undo;' + 'end;' + '' + 'var' + ' ScrollHintWnd: THintWindow;' + '' + 'function GetScrollHint: THintWindow;' + 'begin' + ' if ScrollHintWnd = nil then' + ' ScrollHintWnd := HintWindowClass.Create(Application);' + ' Result := ScrollHintWnd;' + 'end;' + '' + 'procedure TCustomSynEdit.WMVScroll(var Msg: TWMScroll);' + 'var' + ' s: string;' + ' rc: TRect;' + ' pt: TPoint;' + ' ScrollHint: THintWindow;' + ' ButtonH: Integer;' + ' ScrollInfo: TScrollInfo;' + 'begin' + ' Msg.Result := 0;' + ' case Msg.ScrollCode of' + ' // Scrolls to start / end of the text' + ' SB_TOP: TopLine := 1;' + ' SB_BOTTOM: TopLine := DisplayLineCount;' + ' // Scrolls one line up / down' + ' SB_LINEDOWN: TopLine := TopLine + 1;' + ' SB_LINEUP: TopLine := TopLine - 1;' + ' // Scrolls one page of lines up / down' + ' SB_PAGEDOWN: TopLine := TopLine' + ' + (fLinesInWindow - Ord(eoScrollByOneLess in fOptions));' + ' SB_PAGEUP: TopLine := TopLine' + ' - (fLinesInWindow - Ord(eoScrollByOneLess in fOptions));' + ' // Scrolls to the current scroll bar position' + ' SB_THUMBPOSITION,' + ' SB_THUMBTRACK:' + ' begin' + ' FIsScrolling := True;' + ' if DisplayLineCount > MAX_SCROLL then' + + ' TopLine := MulDiv(LinesInWindow + DisplayLineCount - 1' + + ', Msg.Pos,' + ' MAX_SCROLL)' + ' else' + ' TopLine := Msg.Pos;' + '' + ' if eoShowScrollHint in fOptions then' + ' begin' + ' ScrollHint := GetScrollHint;' + ' ScrollHint.Color := fScrollHintColor;' + ' case FScrollHintFormat of' + ' shfTopLineOnly:' + + ' s := Format(SYNS_ScrollInfoFmtTop, [RowToLine(TopL' + + 'ine)]);' + ' else' + + ' s := Format(SYNS_ScrollInfoFmt, [RowToLine(TopLine' + + '),' + + ' RowToLine(TopLine + Min(LinesInWindow, DisplayLi' + + 'neCount-TopLine))]);' + ' end;' + '' + '{$IFDEF SYN_COMPILER_3_UP}' + ' rc := ScrollHint.CalcHintRect(200, s, nil);' + '{$ELSE}' + ' rc := Rect(0, 0, TextWidth(ScrollHint.Canvas, s) + 6,' + ' TextHeight(ScrollHint.Canvas, s) + 4);' + '{$ENDIF}' + ' if eoScrollHintFollows in fOptions then' + ' begin' + ' ButtonH := GetSystemMetrics(SM_CYVSCROLL);' + '' + ' FillChar(ScrollInfo, SizeOf(ScrollInfo), 0);' + ' ScrollInfo.cbSize := SizeOf(ScrollInfo);' + ' ScrollInfo.fMask := SIF_ALL;' + ' GetScrollInfo(Handle, SB_VERT, ScrollInfo);' + '' + + ' pt := ClientToScreen(Point(ClientWidth - rc.Right - ' + + '4,' + + ' ((rc.Bottom - rc.Top) shr 1) + ' + + ' //half the size of the hint window' + + ' Round((ScrollInfo.nTrackPos / ScrollInfo.nMax) * ' + + ' //The percentage of the page that has been scrol' + + 'led' + + ' (ClientHeight - (ButtonH * 2))) ' + + ' //The height minus the arrow buttons' + + ' + ButtonH)); ' + + ' //The height of the top button' + ' end' + ' else' + + ' pt := ClientToScreen(Point(ClientWidth - rc.Right - ' + + '4, 10));' + '' + ' OffsetRect(rc, pt.x, pt.y);' + ' ScrollHint.ActivateHint(rc, s);' + '{$IFDEF SYN_COMPILER_3}' + ' SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0);' + '{$ENDIF}' + '{$IFNDEF SYN_COMPILER_3_UP}' + ' ScrollHint.Invalidate;' + '{$ENDIF}' + ' ScrollHint.Update;' + ' end;' + ' end;' + ' // Ends scrolling' + ' SB_ENDSCROLL:' + ' begin' + ' FIsScrolling := False;' + ' if eoShowScrollHint in fOptions then' + ' ShowWindow(GetScrollHint.Handle, SW_HIDE);' + ' end;' + ' end;' + ' Update;' + ' if Assigned(OnScroll) then OnScroll(Self,sbVertical);' + 'end;' + '{$ENDIF}' + '' + 'function TCustomSynEdit.ScanFrom(Index: Integer): Integer;' + 'var' + ' iRange: TSynEditRange;' + 'begin' + ' Result := Index;' + ' if Result >= Lines.Count then Exit;' + '' + ' if Result = 0 then' + ' fHighlighter.ResetRange' + ' else' + + ' fHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Resul' + + 't - 1]);' + '' + ' repeat' + ' fHighlighter.SetLine(Lines[Result], Result);' + ' fHighlighter.NextToEol;' + ' iRange := fHighlighter.GetRange;' + ' if TSynEditStringList(Lines).Ranges[Result] = iRange then' + ' Exit; // avoid the final Decrement' + ' TSynEditStringList(Lines).Ranges[Result] := iRange;' + ' Inc(Result);' + ' until (Result = Lines.Count);' + ' Dec(Result);' + 'end;' + '' + 'procedure TCustomSynEdit.ListCleared(Sender: TObject);' + 'begin' + ' if WordWrap then' + ' fWordWrapPlugin.Reset;' + '' + ' ClearUndo;' + ' // invalidate the *whole* client area' + ' FillChar(fInvalidateRect, SizeOf(TRect), 0);' + ' Invalidate;' + ' // set caret and selected block to start of text' + ' CaretXY := BufferCoord(1, 1);' + ' // scroll to start of text' + ' TopLine := 1;' + ' LeftChar := 1;' + ' Include(fStatusChanges, scAll);' + 'end;' + '' + + 'procedure TCustomSynEdit.ListDeleted(Sender: TObject; aIndex: In' + + 'teger;' + ' aCount: Integer);' + 'begin' + ' if Assigned(fHighlighter) and (Lines.Count > 0) then' + ' ScanFrom(aIndex);' + '' + ' if WordWrap then' + ' fWordWrapPlugin.LinesDeleted(aIndex, aCount);' + '' + ' InvalidateLines(aIndex + 1, MaxInt);' + ' InvalidateGutterLines(aIndex + 1, MaxInt);' + 'end;' + '' + + 'procedure TCustomSynEdit.ListInserted(Sender: TObject; Index: In' + + 'teger;' + ' aCount: Integer);' + 'var' + ' L: Integer;' + ' vLastScan: Integer;' + 'begin' + ' if Assigned(fHighlighter) and (Lines.Count > 0) then' + ' begin' + ' vLastScan := Index;' + ' repeat' + ' vLastScan := ScanFrom(vLastScan);' + ' Inc(vLastScan);' + ' until vLastScan >= Index + aCount;' + ' end;' + '' + ' if WordWrap then' + ' fWordWrapPlugin.LinesInserted(Index, aCount);' + '' + ' InvalidateLines(Index + 1, MaxInt);' + ' InvalidateGutterLines(Index + 1, MaxInt);' + '' + ' if (eoAutoSizeMaxScrollWidth in fOptions) then' + ' begin' + ' L := TSynEditStringList(Lines).ExpandedStringLengths[Index];' + ' if L > MaxScrollWidth then' + ' MaxScrollWidth := L;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.ListPutted(Sender: TObject; Index: Inte' + + 'ger;' + ' aCount: Integer);' + 'var' + ' L: Integer;' + ' vEndLine: Integer;' + 'begin' + ' vEndLine := Index +1;' + ' if WordWrap then' + ' begin' + ' if fWordWrapPlugin.LinesPutted(Index, aCount) <> 0 then' + ' vEndLine := MaxInt;' + ' InvalidateGutterLines(Index + 1, vEndLine);' + ' end;' + ' if Assigned(fHighlighter) then' + ' begin' + ' vEndLine := Max(vEndLine, ScanFrom(Index) + 1);' + + ' // If this editor is chained then the real owner of text buf' + + 'fer will probably' + + ' // have already parsed the changes, so ScanFrom will return ' + + 'immediately.' + ' if fLines <> fOrigLines then' + ' vEndLine := MaxInt;' + ' end;' + ' InvalidateLines(Index + 1, vEndLine);' + '' + ' if (eoAutoSizeMaxScrollWidth in fOptions) then' + ' begin' + ' L := TSynEditStringList(Lines).ExpandedStringLengths[Index];' + ' if L > MaxScrollWidth then' + ' MaxScrollWidth := L;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ScanRanges;' + 'var' + ' i: Integer;' + 'begin' + ' if Assigned(fHighlighter) and (Lines.Count > 0) then begin' + ' fHighlighter.ResetRange;' + ' i := 0;' + ' repeat' + ' fHighlighter.SetLine(Lines[i], i);' + ' fHighlighter.NextToEol;' + + ' TSynEditStringList(Lines).Ranges[i] := fHighlighter.GetRan' + + 'ge;' + ' Inc(i);' + ' until i >= Lines.Count;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetWordBlock(Value: TBufferCoord);' + 'var' + ' vBlockBegin: TBufferCoord;' + ' vBlockEnd: TBufferCoord;' + ' TempString: UnicodeString;' + '' + ' procedure CharScan;' + ' var' + ' cRun: Integer;' + ' begin' + ' { search BlockEnd }' + ' vBlockEnd.Char := Length(TempString);' + ' for cRun := Value.Char to Length(TempString) do' + ' if not IsIdentChar(TempString[cRun]) then' + ' begin' + ' vBlockEnd.Char := cRun;' + ' Break;' + ' end;' + ' { search BlockBegin }' + ' vBlockBegin.Char := 1;' + ' for cRun := Value.Char - 1 downto 1 do' + ' if not IsIdentChar(TempString[cRun]) then' + ' begin' + ' vBlockBegin.Char := cRun + 1;' + ' Break;' + ' end;' + ' end;' + '' + 'begin' + ' if (eoScrollPastEol in Options) and not WordWrap then' + ' Value.Char := MinMax(Value.Char, 1, fMaxScrollWidth + 1)' + ' else' + ' Value.Char := Max(Value.Char, 1);' + ' Value.Line := MinMax(Value.Line, 1, Lines.Count);' + + ' TempString := Lines[Value.Line - 1] + #0; //needed for CaretX ' + + '= LineLength + 1' + ' if Value.Char > Length(TempString) then' + ' begin' + + ' InternalCaretXY := BufferCoord(Length(TempString), Value.Lin' + + 'e);' + ' exit;' + ' end;' + '' + ' CharScan;' + '' + ' vBlockBegin.Line := Value.Line;' + ' vBlockEnd.Line := Value.Line;' + ' SetCaretAndSelection(vBlockEnd, vBlockBegin, vBlockEnd);' + ' InvalidateLine(Value.Line);' + ' StatusChanged([scSelection]);' + 'end;' + '' + 'procedure TCustomSynEdit.DblClick;' + 'var' + ' ptMouse: TPoint;' + 'begin' + ' GetCursorPos(ptMouse);' + ' ptMouse := ScreenToClient(ptMouse);' + ' if ptMouse.X >= fGutterWidth + 2 then' + ' begin' + ' if not (eoNoSelection in fOptions) then' + ' SetWordBlock(CaretXY);' + ' inherited;' + ' Include(fStateFlags, sfDblClicked);' + ' MouseCapture := False;' + ' end' + ' else' + ' inherited;' + 'end;' + '' + 'function TCustomSynEdit.GetCanUndo: Boolean;' + 'begin' + ' result := not ReadOnly and fUndoList.CanUndo;' + 'end;' + '' + 'function TCustomSynEdit.GetCanRedo: Boolean;' + 'begin' + ' result := not ReadOnly and fRedoList.CanUndo;' + 'end;' + '' + 'function TCustomSynEdit.GetCanPaste;' + 'begin' + ' Result := not ReadOnly and ClipboardProvidesText;' + 'end;' + '' + + 'procedure TCustomSynEdit.InsertBlock(const BB, BE: TBufferCoord;' + + ' ChangeStr: PWideChar;' + ' AddToUndoList: Boolean);' + '// used by BlockIndent and Redo' + 'begin' + ' SetCaretAndSelection(BB, BB, BE);' + ' ActiveSelectionMode := smColumn;' + ' SetSelTextPrimitiveEx(smColumn, ChangeStr, AddToUndoList);' + ' StatusChanged([scSelection]);' + 'end;' + '' + 'procedure TCustomSynEdit.Redo;' + '' + ' procedure RemoveGroupBreak;' + ' var' + ' Item: TSynEditUndoItem;' + ' OldBlockNumber: Integer;' + ' begin' + ' if fRedoList.LastChangeReason = crGroupBreak then' + ' begin' + ' OldBlockNumber := UndoList.BlockChangeNumber;' + ' Item := fRedoList.PopItem;' + ' try' + ' UndoList.BlockChangeNumber := Item.ChangeNumber;' + ' fUndoList.AddGroupBreak;' + ' finally' + ' UndoList.BlockChangeNumber := OldBlockNumber;' + ' Item.Free;' + ' end;' + ' UpdateModifiedStatus;' + ' end;' + ' end;' + '' + 'var' + ' Item: TSynEditUndoItem;' + ' OldChangeNumber: integer;' + ' SaveChangeNumber: integer;' + ' FLastChange : TSynChangeReason;' + ' FAutoComplete: Boolean;' + ' FPasteAction: Boolean;' + ' FSpecial1: Boolean;' + ' FSpecial2: Boolean;' + ' FKeepGoing: Boolean;' + 'begin' + ' if ReadOnly then' + ' exit;' + '' + ' FLastChange := FRedoList.LastChangeReason;' + ' FAutoComplete := FLastChange = crAutoCompleteBegin;' + ' FPasteAction := FLastChange = crPasteBegin;' + ' FSpecial1 := FLastChange = crSpecial1Begin;' + ' FSpecial2 := FLastChange = crSpecial2Begin;' + '' + ' Item := fRedoList.PeekItem;' + ' if Item <> nil then' + ' begin' + ' OldChangeNumber := Item.ChangeNumber;' + ' SaveChangeNumber := fUndoList.BlockChangeNumber;' + ' fUndoList.BlockChangeNumber := Item.ChangeNumber;' + ' try' + ' repeat' + ' RedoItem;' + ' Item := fRedoList.PeekItem;' + ' if Item = nil then' + ' FKeepGoing := False' + ' else begin' + ' if FAutoComplete then' + + ' FKeepGoing:= (FRedoList.LastChangeReason <> crAutoC' + + 'ompleteEnd)' + ' else if FPasteAction then' + + ' FKeepGoing:= (FRedoList.LastChangeReason <> crPaste' + + 'End)' + ' else if FSpecial1 then' + + ' FKeepGoing := (FRedoList.LastChangeReason <> crSpec' + + 'ial1End)' + ' else if FSpecial2 then' + + ' FKeepGoing := (FRedoList.LastChangeReason <> crSpec' + + 'ial2End)' + ' else if Item.ChangeNumber = OldChangeNumber then' + ' FKeepGoing := True' + ' else begin' + ' FKeepGoing := ((eoGroupUndo in FOptions) and' + ' (FLastChange = Item.ChangeReason) and' + ' not(FLastChange in [crIndent, crUnindent]));' + ' end;' + ' FLastChange := Item.ChangeReason;' + ' end;' + ' until not(FKeepGoing);' + '' + + ' //we need to eat the last command since it does nothing an' + + 'd also update modified status...' + + ' if (FAutoComplete and (FRedoList.LastChangeReason = crAuto' + + 'CompleteEnd)) or' + + ' (FPasteAction and (FRedoList.LastChangeReason = crPaste' + + 'End)) or' + + ' (FSpecial1 and (FRedoList.LastChangeReason = crSpecial1' + + 'End)) or' + + ' (FSpecial2 and (FRedoList.LastChangeReason = crSpecial2' + + 'End)) then' + ' begin' + ' RedoItem;' + ' UpdateModifiedStatus;' + ' end;' + '' + ' finally' + ' fUndoList.BlockChangeNumber := SaveChangeNumber;' + ' end;' + ' RemoveGroupBreak;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.RedoItem;' + 'var' + ' Item: TSynEditUndoItem;' + ' Run, StrToDelete: PWideChar;' + ' Len: Integer;' + ' TempString: UnicodeString;' + ' CaretPt: TBufferCoord;' + ' ChangeScrollPastEol: boolean;' + ' BeginX: integer;' + 'begin' + ' ChangeScrollPastEol := not (eoScrollPastEol in Options);' + ' Item := fRedoList.PopItem;' + ' if Assigned(Item) then' + ' try' + ' ActiveSelectionMode := Item.ChangeSelMode;' + ' IncPaintLock;' + ' Include(fOptions, eoScrollPastEol);' + ' fUndoList.InsideRedo := True;' + ' case Item.ChangeReason of' + ' crCaret:' + ' begin' + + ' fUndoList.AddChange(Item.ChangeReason, CaretXY, CaretX' + + 'Y, '#39#39', fActiveSelectionMode);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' crSelection:' + ' begin' + + ' fUndoList.AddChange(Item.ChangeReason, BlockBegin, Blo' + + 'ckEnd, '#39#39', fActiveSelectionMode);' + + ' SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Ite' + + 'm.ChangeEndPos);' + ' end;' + ' crInsert, crPaste, crDragDropInsert:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeS' + + 'tartPos,' + ' Item.ChangeStartPos);' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr),' + ' False);' + ' InternalCaretXY := Item.ChangeEndPos;' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, SelText, Item.ChangeSelMode);' + ' if Item.ChangeReason = crDragDropInsert then begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.Chang' + + 'eStartPos,' + ' Item.ChangeEndPos);' + ' end;' + ' end;' + ' crDeleteAfterCursor, crSilentDeleteAfterCursor:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeS' + + 'tartPos,' + ' Item.ChangeEndPos);' + ' TempString := SelText;' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr),' + ' False);' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, TempString, Item.ChangeSelMode);' + ' InternalCaretXY := Item.ChangeEndPos;' + ' end;' + ' crDelete, crSilentDelete:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeS' + + 'tartPos,' + ' Item.ChangeEndPos);' + ' TempString := SelText;' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr),' + ' False);' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, TempString, Item.ChangeSelMode);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' crLineBreak:' + ' begin' + ' CaretPt := Item.ChangeStartPos;' + ' SetCaretAndSelection(CaretPt, CaretPt, CaretPt);' + ' CommandProcessor(ecLineBreak, #13, nil);' + ' end;' + ' crIndent:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeSta' + + 'rtPos,' + ' Item.ChangeEndPos);' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + + ' Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMod' + + 'e);' + ' end;' + ' crUnindent :' + ' begin // re-delete the (raggered) column' + ' // Delete string' + ' StrToDelete := PWideChar(Item.ChangeStr);' + ' InternalCaretY := Item.ChangeStartPos.Line;' + ' if Item.ChangeSelMode = smColumn then' + + ' BeginX := Min(Item.ChangeStartPos.Char, Item.ChangeE' + + 'ndPos.Char)' + ' else' + ' BeginX := 1;' + ' repeat' + ' Run := GetEOL(StrToDelete);' + ' if Run <> StrToDelete then' + ' begin' + ' Len := Run - StrToDelete;' + ' if Len > 0 then' + ' begin' + ' TempString := Lines[CaretY - 1];' + ' Delete(TempString, BeginX, Len);' + ' Lines[CaretY - 1] := TempString;' + ' end;' + ' end' + ' else' + ' Len := 0;' + ' if Run^ = #13 then' + ' begin' + ' Inc(Run);' + ' if Run^ = #10 then' + ' Inc(Run);' + ' Inc(fCaretY);' + ' end;' + ' StrToDelete := Run;' + ' until Run^ = #0;' + ' if Item.ChangeSelMode = smColumn then' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.Chang' + + 'eStartPos,' + ' Item.ChangeEndPos)' + ' else begin' + ' // restore selection' + + ' CaretPt.Char := Item.ChangeStartPos.Char - fTabWidth' + + ';' + ' CaretPt.Line := Item.ChangeStartPos.Line;' + ' SetCaretAndSelection( CaretPt, CaretPt,' + + ' BufferCoord(Item.ChangeEndPos.Char - Len, Item.Cha' + + 'ngeEndPos.Line) );' + ' end;' + ' // add to undo list' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeSta' + + 'rtPos,' + + ' Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMo' + + 'de);' + ' end;' + ' crWhiteSpaceAdd:' + ' begin' + + ' fUndoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, '#39#39', Item.ChangeSelMode);' + + ' SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeEnd' + + 'Pos,' + ' Item.ChangeEndPos);' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr), True);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' end;' + ' finally' + ' fUndoList.InsideRedo := False;' + ' if ChangeScrollPastEol then' + ' Exclude(fOptions, eoScrollPastEol);' + ' Item.Free;' + ' DecPaintLock;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.Undo;' + '' + ' procedure RemoveGroupBreak;' + ' var' + ' Item: TSynEditUndoItem;' + ' OldBlockNumber: Integer;' + ' begin' + ' if fUndoList.LastChangeReason = crGroupBreak then' + ' begin' + ' OldBlockNumber := RedoList.BlockChangeNumber;' + ' try' + ' Item := fUndoList.PopItem;' + ' RedoList.BlockChangeNumber := Item.ChangeNumber;' + ' Item.Free;' + ' fRedoList.AddGroupBreak;' + ' finally' + ' RedoList.BlockChangeNumber := OldBlockNumber;' + ' end;' + ' end;' + ' end;' + '' + 'var' + ' Item: TSynEditUndoItem;' + ' OldChangeNumber: integer;' + ' SaveChangeNumber: integer;' + ' FLastChange : TSynChangeReason;' + ' FAutoComplete: Boolean;' + ' FPasteAction: Boolean;' + ' FSpecial1: Boolean;' + ' FSpecial2: Boolean;' + ' FKeepGoing: Boolean;' + 'begin' + ' if ReadOnly then' + ' exit;' + '' + ' RemoveGroupBreak;' + '' + ' FLastChange := FUndoList.LastChangeReason;' + ' FAutoComplete := FLastChange = crAutoCompleteEnd;' + ' FPasteAction := FLastChange = crPasteEnd;' + ' FSpecial1 := FLastChange = crSpecial1End;' + ' FSpecial2 := FLastChange = crSpecial2End;' + '' + ' Item := fUndoList.PeekItem;' + ' if Item <> nil then' + ' begin' + ' OldChangeNumber := Item.ChangeNumber;' + ' SaveChangeNumber := fRedoList.BlockChangeNumber;' + ' fRedoList.BlockChangeNumber := Item.ChangeNumber;' + '' + ' try' + ' repeat' + ' UndoItem;' + ' Item := fUndoList.PeekItem;' + ' if Item = nil then' + ' FKeepGoing := False' + ' else begin' + ' if FAutoComplete then' + + ' FKeepGoing := (FUndoList.LastChangeReason <> crAuto' + + 'CompleteBegin)' + ' else if FPasteAction then' + + ' FKeepGoing := (FUndoList.LastChangeReason <> crPast' + + 'eBegin)' + ' else if FSpecial1 then' + + ' FKeepGoing := (FUndoList.LastChangeReason <> crSpec' + + 'ial1Begin)' + ' else if FSpecial2 then' + + ' FKeepGoing := (FUndoList.LastChangeReason <> crSpec' + + 'ial2Begin)' + ' else if Item.ChangeNumber = OldChangeNumber then' + ' FKeepGoing := True' + ' else begin' + ' FKeepGoing := ((eoGroupUndo in FOptions) and' + ' (FLastChange = Item.ChangeReason) and' + ' not(FLastChange in [crIndent, crUnindent]));' + ' end;' + ' FLastChange := Item.ChangeReason;' + ' end;' + ' until not(FKeepGoing);' + '' + + ' //we need to eat the last command since it does nothing an' + + 'd also update modified status...' + + ' if (FAutoComplete and (FUndoList.LastChangeReason = crAuto' + + 'CompleteBegin)) or' + + ' (FPasteAction and (FUndoList.LastChangeReason = crPaste' + + 'Begin)) or' + + ' (FSpecial1 and (FUndoList.LastChangeReason = crSpecial1' + + 'Begin)) or' + + ' (FSpecial2 and (FUndoList.LastChangeReason = crSpecial2' + + 'Begin)) then' + ' begin' + ' UndoItem;' + ' UpdateModifiedStatus;' + ' end;' + '' + ' finally' + ' fRedoList.BlockChangeNumber := SaveChangeNumber;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.UndoItem;' + 'var' + ' Item: TSynEditUndoItem;' + ' TmpPos: TBufferCoord;' + ' TmpStr: UnicodeString;' + ' ChangeScrollPastEol: Boolean;' + ' BeginX: Integer;' + 'begin' + ' ChangeScrollPastEol := not (eoScrollPastEol in Options);' + ' Item := fUndoList.PopItem;' + ' if Assigned(Item) then' + ' try' + ' ActiveSelectionMode := Item.ChangeSelMode;' + ' IncPaintLock;' + ' Include(fOptions, eoScrollPastEol);' + ' case Item.ChangeReason of' + ' crCaret:' + ' begin' + + ' fRedoList.AddChange(Item.ChangeReason, CaretXY, CaretX' + + 'Y, '#39#39', fActiveSelectionMode);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' crSelection:' + ' begin' + + ' fRedoList.AddChange(Item.ChangeReason, BlockBegin, Blo' + + 'ckEnd, '#39#39', fActiveSelectionMode);' + + ' SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Ite' + + 'm.ChangeEndPos);' + ' end;' + ' crInsert, crPaste, crDragDropInsert:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeS' + + 'tartPos,' + ' Item.ChangeEndPos);' + ' TmpStr := SelText;' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr),' + ' False);' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, TmpStr, Item.ChangeSelMode);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' crDeleteAfterCursor, crDelete,' + ' crSilentDelete, crSilentDeleteAfterCursor,' + ' crDeleteAll:' + ' begin' + ' // If there'#39's no selection, we have to set' + ' // the Caret'#39's position manualy.' + ' if Item.ChangeSelMode = smColumn then' + ' TmpPos := BufferCoord(' + + ' Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Ch' + + 'ar),' + + ' Min(Item.ChangeStartPos.Line, Item.ChangeEndPos.Li' + + 'ne))' + ' else' + ' TmpPos := TBufferCoord(MinPoint(' + + ' TPoint(Item.ChangeStartPos), TPoint(Item.ChangeEnd' + + 'Pos)));' + ' if (Item.ChangeReason in [crDeleteAfterCursor,' + + ' crSilentDeleteAfterCursor]) and (TmpPos.Line > Lines' + + '.Count) then' + ' begin' + ' InternalCaretXY := BufferCoord(1, Lines.Count);' + ' fLines.Add('#39#39');' + ' end;' + ' CaretXY := TmpPos;' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr),' + ' False );' + ' if Item.ChangeReason in [crDeleteAfterCursor,' + ' crSilentDeleteAfterCursor]' + ' then' + ' TmpPos := Item.ChangeStartPos' + ' else' + ' TmpPos := Item.ChangeEndPos;' + + ' if Item.ChangeReason in [crSilentDelete, crSilentDelet' + + 'eAfterCursor]' + ' then' + ' InternalCaretXY := TmpPos' + ' else begin' + ' SetCaretAndSelection(TmpPos, Item.ChangeStartPos,' + ' Item.ChangeEndPos);' + ' end;' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, '#39#39', Item.ChangeSelMode);' + ' if Item.ChangeReason = crDeleteAll then begin' + ' InternalCaretXY := BufferCoord(1, 1);' + ' fBlockEnd := BufferCoord(1, 1);' + ' end;' + ' EnsureCursorPosVisible;' + ' end;' + ' crLineBreak:' + ' begin' + ' // If there'#39's no selection, we have to set' + ' // the Caret'#39's position manualy.' + ' InternalCaretXY := Item.ChangeStartPos;' + ' if CaretY > 0 then' + ' begin' + ' TmpStr := Lines.Strings[CaretY - 1];' + ' if (Length(TmpStr) < CaretX - 1)' + ' and (LeftSpaces(Item.ChangeStr) = 0)' + ' then' + + ' TmpStr := TmpStr + UnicodeStringOfChar(#32, CaretX' + + ' - 1 - Length(TmpStr));' + ' ProperSetLine(CaretY - 1, TmpStr + Item.ChangeStr);' + ' Lines.Delete(Item.ChangeEndPos.Line);' + ' end' + ' else' + ' ProperSetLine(CaretY - 1, Item.ChangeStr);' + ' DoLinesDeleted(CaretY + 1, 1);' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, '#39#39', Item.ChangeSelMode);' + ' end;' + ' crIndent:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeSta' + + 'rtPos,' + ' Item.ChangeEndPos);' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + + ' Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMod' + + 'e);' + ' end;' + + ' crUnindent: // reinsert the (raggered) column that was de' + + 'leted' + ' begin' + ' // reinsert the string' + ' if Item.ChangeSelMode <> smColumn then' + + ' InsertBlock(BufferCoord(1, Item.ChangeStartPos.Line)' + + ',' + ' BufferCoord(1, Item.ChangeEndPos.Line),' + ' PWideChar(Item.ChangeStr), False)' + ' else' + ' begin' + + ' BeginX := Min( Item.ChangeStartPos.Char, Item.Change' + + 'EndPos.Char );' + + ' InsertBlock(BufferCoord(BeginX, Item.ChangeStartPos.' + + 'Line),' + ' BufferCoord(BeginX, Item.ChangeEndPos.Line),' + ' PWideChar(Item.ChangeStr), False);' + ' end;' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.Change' + + 'StartPos,' + ' Item.ChangeEndPos);' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + + ' Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMo' + + 'de);' + ' end;' + ' crWhiteSpaceAdd:' + ' begin' + + ' SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeS' + + 'tartPos,' + ' Item.ChangeEndPos);' + ' TmpStr := SelText;' + + ' SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(It' + + 'em.ChangeStr), True);' + + ' fRedoList.AddChange(Item.ChangeReason, Item.ChangeStar' + + 'tPos,' + ' Item.ChangeEndPos, TmpStr, Item.ChangeSelMode);' + ' InternalCaretXY := Item.ChangeStartPos;' + ' end;' + ' end;' + ' finally' + ' if ChangeScrollPastEol then' + ' Exclude(fOptions, eoScrollPastEol);' + ' Item.Free;' + ' DecPaintLock;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ClearBookMark(BookMark: Integer);' + 'begin' + + ' if (BookMark in [0..9]) and assigned(fBookMarks[BookMark]) the' + + 'n' + ' begin' + ' DoOnClearBookmark(fBookMarks[BookMark]);' + ' FMarkList.Remove(fBookMarks[Bookmark]);' + ' fBookMarks[BookMark] := nil;' + ' end' + 'end;' + '' + 'procedure TCustomSynEdit.GotoBookMark(BookMark: Integer);' + 'var' + ' iNewPos: TBufferCoord;' + 'begin' + ' if (BookMark in [0..9]) and' + ' assigned(fBookMarks[BookMark]) and' + ' (fBookMarks[BookMark].Line <= fLines.Count)' + ' then' + ' begin' + ' iNewPos.Char := fBookMarks[BookMark].Char;' + ' iNewPos.Line := fBookMarks[BookMark].Line;' + + ' //call it this way instead to make sure that the caret ends ' + + 'up in the middle' + ' //if it is off screen (like Delphi does with bookmarks)' + ' SetCaretXYEx(False, iNewPos);' + ' EnsureCursorPosVisibleEx(True);' + ' if SelAvail then' + ' InvalidateSelection;' + ' fBlockBegin.Char := fCaretX;' + ' fBlockBegin.Line := fCaretY;' + ' fBlockEnd := fBlockBegin;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.GotoLineAndCenter(ALine: Integer);' + 'begin' + ' SetCaretXYEx( False, BufferCoord(1, ALine) );' + ' if SelAvail then' + ' InvalidateSelection;' + ' fBlockBegin.Char := fCaretX;' + ' fBlockBegin.Line := fCaretY;' + ' fBlockEnd := fBlockBegin;' + ' EnsureCursorPosVisibleEx(True);' + 'end;' + '' + + 'procedure TCustomSynEdit.SetBookMark(BookMark: Integer; X: Integ' + + 'er; Y: Integer);' + 'var' + ' mark: TSynEditMark;' + 'begin' + + ' if (BookMark in [0..9]) and (Y >= 1) and (Y <= Max(1, fLines.C' + + 'ount)) then' + ' begin' + ' mark := TSynEditMark.Create(self);' + ' with mark do' + ' begin' + ' Line := Y;' + ' Char := X;' + ' ImageIndex := Bookmark;' + ' BookmarkNumber := Bookmark;' + ' Visible := True;' + ' InternalImage := (fBookMarkOpt.BookmarkImages = nil);' + ' end;' + ' DoOnPlaceMark(Mark);' + ' if (mark <> nil) then' + ' begin' + ' if assigned(fBookMarks[BookMark]) then' + ' ClearBookmark(BookMark);' + ' fBookMarks[BookMark] := mark;' + ' FMarkList.Add(fBookMarks[BookMark]);' + ' end;' + ' end;' + 'end;' + '' + '{$IFNDEF SYN_CLX}' + 'function IsTextMessage(Msg: UINT): Boolean;' + 'begin' + + ' Result := (Msg = WM_SETTEXT) or (Msg = WM_GETTEXT) or (Msg = W' + + 'M_GETTEXTLENGTH);' + 'end;' + '' + 'procedure TCustomSynEdit.WndProc(var Msg: TMessage);' + 'const' + ' ALT_KEY_DOWN = $20000000;' + 'begin' + ' // Prevent Alt-Backspace from beeping' + ' if (Msg.Msg = WM_SYSCHAR) and (Msg.wParam = VK_BACK) and' + ' (Msg.lParam and ALT_KEY_DOWN <> 0)' + ' then' + ' Msg.Msg := 0;' + '' + + ' // handle direct WndProc calls that could happen through VCL-m' + + 'ethods like Perform' + ' if HandleAllocated and IsWindowUnicode(Handle) then' + ' if not FWindowProducedMessage then' + ' begin' + ' FWindowProducedMessage := True;' + ' if IsTextMessage(Msg.Msg) then' + ' begin' + ' with Msg do' + ' Result := SendMessageA(Handle, Msg, wParam, lParam);' + ' Exit;' + ' end;' + ' end' + ' else' + ' FWindowProducedMessage := False;' + '' + ' inherited;' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.ChainListCleared(Sender: TObject);' + 'begin' + ' if Assigned(fChainListCleared) then' + ' fChainListCleared(Sender);' + ' TSynEditStringList(fOrigLines).OnCleared(Sender);' + 'end;' + '' + + 'procedure TCustomSynEdit.ChainListDeleted(Sender: TObject; aInde' + + 'x: Integer;' + ' aCount: Integer);' + 'begin' + ' if Assigned(fChainListDeleted) then' + ' fChainListDeleted(Sender, aIndex, aCount);' + + ' TSynEditStringList(fOrigLines).OnDeleted(Sender, aIndex, aCoun' + + 't);' + 'end;' + '' + + 'procedure TCustomSynEdit.ChainListInserted(Sender: TObject; aInd' + + 'ex: Integer;' + ' aCount: Integer);' + 'begin' + ' if Assigned(fChainListInserted) then' + ' fChainListInserted(Sender, aIndex, aCount);' + + ' TSynEditStringList(fOrigLines).OnInserted(Sender, aIndex, aCou' + + 'nt);' + 'end;' + '' + + 'procedure TCustomSynEdit.ChainListPutted(Sender: TObject; aIndex' + + ': Integer;' + ' aCount: Integer);' + 'begin' + ' if Assigned(fChainListPutted) then' + ' fChainListPutted(Sender, aIndex, aCount);' + + ' TSynEditStringList(fOrigLines).OnPutted(Sender, aIndex, aCount' + + ');' + 'end;' + '' + 'procedure TCustomSynEdit.ChainLinesChanging(Sender: TObject);' + 'begin' + ' if Assigned(fChainLinesChanging) then' + ' fChainLinesChanging(Sender);' + ' TSynEditStringList(fOrigLines).OnChanging(Sender);' + 'end;' + '' + 'procedure TCustomSynEdit.ChainLinesChanged(Sender: TObject);' + 'begin' + ' if Assigned(fChainLinesChanged) then' + ' fChainLinesChanged(Sender);' + ' TSynEditStringList(fOrigLines).OnChange(Sender);' + 'end;' + '' + 'procedure TCustomSynEdit.ChainUndoRedoAdded(Sender: TObject);' + 'var' + ' iList: TSynEditUndoList;' + ' iHandler: TNotifyEvent;' + 'begin' + ' if Sender = fUndoList then' + ' begin' + ' iList := fOrigUndoList;' + ' iHandler := fChainUndoAdded;' + ' end' + ' else { if Sender = fRedoList then }' + ' begin' + ' iList := fOrigRedoList;' + ' iHandler := fChainRedoAdded;' + ' end;' + ' if Assigned(iHandler) then' + ' iHandler(Sender);' + ' iList.OnAddedUndo(Sender);' + 'end;' + '' + 'procedure TCustomSynEdit.UnHookTextBuffer;' + 'var' + ' vOldWrap: Boolean;' + 'begin' + ' Assert(fChainedEditor = nil);' + ' if fLines = fOrigLines then' + ' Exit;' + '' + ' vOldWrap := WordWrap;' + ' WordWrap := False;' + '' + ' //first put back the real methods' + ' with TSynEditStringList(fLines) do' + ' begin' + ' OnCleared := fChainListCleared;' + ' OnDeleted := fChainListDeleted;' + ' OnInserted := fChainListInserted;' + ' OnPutted := fChainListPutted;' + ' OnChanging := fChainLinesChanging;' + ' OnChange := fChainLinesChanged;' + ' end;' + ' fUndoList.OnAddedUndo := fChainUndoAdded;' + ' fRedoList.OnAddedUndo := fChainRedoAdded;' + '' + ' fChainListCleared := nil;' + ' fChainListDeleted := nil;' + ' fChainListInserted := nil;' + ' fChainListPutted := nil;' + ' fChainLinesChanging := nil;' + ' fChainLinesChanged := nil;' + ' fChainUndoAdded := nil;' + '' + ' //make the switch' + ' fLines := fOrigLines;' + ' fUndoList := fOrigUndoList;' + ' fRedoList := fOrigRedoList;' + ' LinesHookChanged;' + '' + ' WordWrap := vOldWrap;' + 'end;' + '' + + 'procedure TCustomSynEdit.HookTextBuffer(aBuffer: TSynEditStringL' + + 'ist;' + ' aUndo, aRedo: TSynEditUndoList);' + 'var' + ' vOldWrap: Boolean;' + 'begin' + ' Assert(fChainedEditor = nil);' + ' Assert(fLines = fOrigLines);' + '' + ' vOldWrap := WordWrap;' + ' WordWrap := False;' + '' + ' if fChainedEditor <> nil then' + ' RemoveLinesPointer' + ' else if fLines <> fOrigLines then' + ' UnHookTextBuffer;' + '' + ' //store the current values and put in the chained methods' + ' fChainListCleared := aBuffer.OnCleared;' + ' aBuffer.OnCleared := ChainListCleared;' + ' fChainListDeleted := aBuffer.OnDeleted;' + ' aBuffer.OnDeleted := ChainListDeleted;' + ' fChainListInserted := aBuffer.OnInserted;' + ' aBuffer.OnInserted := ChainListInserted;' + ' fChainListPutted := aBuffer.OnPutted;' + ' aBuffer.OnPutted := ChainListPutted;' + ' fChainLinesChanging := aBuffer.OnChanging;' + ' aBuffer.OnChanging := ChainLinesChanging;' + ' fChainLinesChanged := aBuffer.OnChange;' + ' aBuffer.OnChange := ChainLinesChanged;' + '' + ' fChainUndoAdded := aUndo.OnAddedUndo;' + ' aUndo.OnAddedUndo := ChainUndoRedoAdded;' + ' fChainRedoAdded := aRedo.OnAddedUndo;' + ' aRedo.OnAddedUndo := ChainUndoRedoAdded;' + '' + ' //make the switch' + ' fLines := aBuffer;' + ' fUndoList := aUndo;' + ' fRedoList := aRedo;' + ' LinesHookChanged;' + '' + ' WordWrap := vOldWrap;' + 'end;' + '' + 'procedure TCustomSynEdit.LinesHookChanged;' + 'var' + ' iLongestLineLength: Integer;' + 'begin' + ' Invalidate;' + ' if eoAutoSizeMaxScrollWidth in fOptions then' + ' begin' + + ' iLongestLineLength := TSynEditStringList(Lines).LengthOfLong' + + 'estLine;' + ' if iLongestLineLength > MaxScrollWidth then' + ' MaxScrollWidth := iLongestLineLength;' + ' end;' + ' UpdateScrollBars;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetLinesPointer(ASynEdit: TCustomSynEdi' + + 't);' + 'begin' + ' HookTextBuffer(TSynEditStringList(ASynEdit.Lines),' + ' ASynEdit.UndoList, ASynEdit.RedoList);' + '' + ' fChainedEditor := ASynEdit;' + ' ASynEdit.FreeNotification(Self);' + 'end;' + '' + 'procedure TCustomSynEdit.RemoveLinesPointer;' + 'begin' + ' {$IFDEF SYN_COMPILER_5_UP}' + ' if Assigned(fChainedEditor) then' + ' RemoveFreeNotification(fChainedEditor);' + ' {$ENDIF}' + ' fChainedEditor := nil;' + '' + ' UnHookTextBuffer;' + 'end;' + '' + '{$IFDEF SYN_CLX}' + + 'function TCustomSynEdit.EventFilter(Sender: QObjectH; Event: QEv' + + 'entH): Boolean;' + 'begin' + ' Result := inherited EventFilter(Sender, Event);' + ' case QEvent_type(Event) of' + ' QEventType_FocusIn:' + ' begin' + ' {$IFDEF SYN_LINUX}' + ' if not FDeadKeysFixed then' + ' begin' + ' FDeadKeysFixed := True;' + ' with TEdit.Create(Self) do' + ' begin' + ' Parent := Self;' + ' BorderStyle := bsNone;' + ' Color := Self.Color;' + ' ReadOnly := True;' + ' Top := ClientRect.Top;' + ' Left := ClientRect.Left + fGutterWidth + 2;' + ' Show;' + ' SetFocus;' + ' Free;' + ' end;' + ' SetFocus;' + ' end' + ' else' + ' {$ENDIF}' + ' begin' + ' InitializeCaret;' + ' if FHideSelection and SelAvail then' + ' InvalidateSelection;' + ' end;' + ' end;' + ' QEventType_FocusOut:' + ' begin' + ' HideCaret;' + ' kTextDrawer.DestroyCaret;' + ' if FHideSelection and SelAvail then' + ' InvalidateSelection;' + ' EndDrag(False);' + ' end;' + ' end;' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.DragCanceled;' + 'begin' + ' fScrollTimer.Enabled := False;' + ' inherited;' + 'end;' + '' + + 'procedure TCustomSynEdit.DragOver(Source: TObject; X, Y: Integer' + + ';' + ' State: TDragState; var Accept: Boolean);' + 'var' + ' vNewPos: TDisplayCoord;' + 'begin' + ' inherited;' + ' if (Source is TCustomSynEdit) and not ReadOnly then' + ' begin' + ' Accept := True;' + + ' //Ctrl is pressed => change cursor to indicate copy instead ' + + 'of move' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' if GetKeyState(VK_CONTROL) < 0 then' + ' DragCursor := crMultiDrag' + ' else' + ' DragCursor := crDrag;' + '{$ENDIF}' + ' if Dragging then //if the drag source is the SynEdit itself' + ' begin' + ' if State = dsDragLeave then //restore prev caret position' + ' ComputeCaret(FMouseDownX, FMouseDownY)' + ' else' + ' begin' + ' vNewPos := PixelsToNearestRowColumn(X, Y);' + + ' vNewPos.Column := MinMax(vNewPos.Column, LeftChar, LeftC' + + 'har + CharsInWindow - 1);' + + ' vNewPos.Row := MinMax(vNewPos.Row, TopLine, TopLine + Li' + + 'nesInWindow - 1);' + ' InternalCaretXY := DisplayToBufferPos(vNewPos);' + ' ComputeScroll(X, Y);' + ' end;' + ' end' + ' else //if is dragging from another SynEdit' + + ' ComputeCaret(X, Y); //position caret under the mouse curso' + + 'r' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.DragDrop(Source: TObject; X, Y: Integer' + + ');' + 'var' + ' vNewCaret: TBufferCoord;' + ' DoDrop, DropAfter, DropMove: Boolean;' + ' vBB, vBE: TBufferCoord;' + ' DragDropText: UnicodeString;' + ' ChangeScrollPastEOL: Boolean;' + 'begin' + ' if not ReadOnly and (Source is TCustomSynEdit)' + ' and TCustomSynEdit(Source).SelAvail then' + ' begin' + ' IncPaintLock;' + ' try' + ' inherited;' + ' ComputeCaret(X, Y);' + ' vNewCaret := CaretXY;' + ' // if from other control then move when SHIFT, else copy' + ' // if from Self then copy when CTRL, else move' + ' if Source <> Self then' + ' begin' + '{$IFDEF SYN_CLX}' + ' DropMove := ssShift in Application.KeyState;' + '{$ELSE}' + ' DropMove := GetKeyState(VK_SHIFT) < 0;' + '{$ENDIF}' + ' DoDrop := True;' + ' DropAfter := False;' + ' end' + ' else' + ' begin' + '{$IFDEF SYN_CLX}' + ' DropMove := not(ssCtrl in Application.KeyState);' + '{$ELSE}' + ' DropMove := GetKeyState(VK_CONTROL) >= 0;' + '{$ENDIF}' + ' vBB := BlockBegin;' + ' vBE := BlockEnd;' + ' DropAfter := (vNewCaret.Line > vBE.Line)' + + ' or ((vNewCaret.Line = vBE.Line) and ((vNewCaret.Char >' + + ' vBE.Char) or' + ' ((not DropMove) and (vNewCaret.Char = vBE.Char))));' + ' DoDrop := DropAfter or (vNewCaret.Line < vBB.Line)' + + ' or ((vNewCaret.Line = vBB.Line) and ((vNewCaret.Char <' + + ' vBB.Char) or' + ' ((not DropMove) and (vNewCaret.Char = vBB.Char))));' + ' end;' + ' if DoDrop then begin' + ' BeginUndoBlock;' + ' try' + ' DragDropText := TCustomSynEdit(Source).SelText;' + ' // delete the selected text if necessary' + ' if DropMove then' + ' begin' + ' if Source <> Self then' + ' TCustomSynEdit(Source).SelText := '#39#39 + ' else' + ' begin' + ' SelText := '#39#39';' + ' // adjust horizontal drop position' + ' if DropAfter and (vNewCaret.Line = vBE.Line) then' + ' Dec(vNewCaret.Char, vBE.Char - vBB.Char);' + ' // adjust vertical drop position' + ' if DropAfter and (vBE.Line > vBB.Line) then' + ' Dec(vNewCaret.Line, vBE.Line - vBB.Line);' + ' end;' + ' end;' + ' //todo: this is probably already done inside SelText' + ' // insert the selected text' + + ' ChangeScrollPastEOL := not (eoScrollPastEol in fOption' + + 's);' + ' try' + ' if ChangeScrollPastEOL then' + ' Include(fOptions, eoScrollPastEol);' + ' InternalCaretXY := vNewCaret;' + ' BlockBegin := vNewCaret;' + + ' { Add the text. Undo is locked so the action is reco' + + 'rded as crDragDropInsert' + ' instead of crInsert (code right bellow). }' + ' Assert(not SelAvail);' + ' LockUndo;' + ' try' + ' SelText := DragDropText;' + ' finally' + ' UnlockUndo;' + ' end;' + ' finally' + ' if ChangeScrollPastEOL then' + ' Exclude(fOptions, eoScrollPastEol);' + ' end;' + ' // save undo information' + ' if Source = Self then' + ' begin' + + ' fUndoList.AddChange(crDragDropInsert, vNewCaret, Blo' + + 'ckEnd, SelText,' + ' fActiveSelectionMode);' + ' end' + ' else begin' + ' fUndoList.AddChange(crInsert, vNewCaret, BlockEnd,' + ' SelText, fActiveSelectionMode);' + ' end;' + ' BlockEnd := CaretXY;' + ' CommandProcessor(ecSelGotoXY, #0, @vNewCaret);' + ' finally' + ' EndUndoBlock;' + ' end;' + ' end;' + ' finally' + ' DecPaintLock;' + ' end;' + ' end' + ' else' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.SetRightEdge(Value: Integer);' + 'begin' + ' if fRightEdge <> Value then' + ' begin' + ' fRightEdge := Value;' + ' Invalidate;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetRightEdgeColor(Value: TColor);' + 'var' + ' nX: Integer;' + ' rcInval: TRect;' + 'begin' + ' if fRightEdgeColor <> Value then' + ' begin' + ' fRightEdgeColor := Value;' + ' if HandleAllocated then' + ' begin' + ' nX := fTextOffset + fRightEdge * fCharWidth;' + ' rcInval := Rect(nX - 1, 0, nX + 1, Height);' + ' InvalidateRect(rcInval, False);' + ' end;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.GetMaxUndo: Integer;' + 'begin' + ' result := fUndoList.MaxUndoActions;' + 'end;' + '' + 'procedure TCustomSynEdit.SetMaxUndo(const Value: Integer);' + 'begin' + ' if Value > -1 then' + ' begin' + ' fUndoList.MaxUndoActions := Value;' + ' fRedoList.MaxUndoActions := Value;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.Notification(AComponent: TComponent;' + ' Operation: TOperation);' + 'begin' + ' inherited Notification(AComponent, Operation);' + ' if Operation = opRemove then' + ' begin' + ' if AComponent = fSearchEngine then' + ' begin' + ' SearchEngine := nil;' + ' end;' + '' + ' if AComponent = fHighlighter then' + ' begin' + ' Highlighter := nil;' + ' end;' + '' + ' if AComponent = fChainedEditor then' + ' begin' + ' RemoveLinesPointer;' + ' end;' + '' + ' if (fBookmarkOpt <> nil) then' + ' if (AComponent = fBookmarkOpt.BookmarkImages) then' + ' begin' + ' fBookmarkOpt.BookmarkImages := nil;' + ' InvalidateGutterLines(-1, -1);' + ' end;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetHighlighter(const Value: TSynCustomH' + + 'ighlighter);' + 'begin' + ' if Value <> fHighlighter then' + ' begin' + ' if Assigned(fHighlighter) then' + ' begin' + + ' fHighlighter.UnhookAttrChangeEvent(HighlighterAttrChanged)' + + ';' + '{$IFDEF SYN_COMPILER_5_UP}' + ' fHighlighter.RemoveFreeNotification(Self);' + '{$ENDIF}' + ' end;' + ' if Assigned(Value) then' + ' begin' + ' Value.HookAttrChangeEvent(HighlighterAttrChanged);' + ' Value.FreeNotification(Self);' + ' end;' + ' fHighlighter := Value;' + ' if not(csDestroying in ComponentState) then' + ' HighlighterAttrChanged(fHighlighter);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetBorderStyle(Value: TSynBorderStyle);' + 'begin' + ' if fBorderStyle <> Value then' + ' begin' + ' fBorderStyle := Value;' + '{$IFDEF SYN_CLX}' + ' Resize;' + ' Invalidate;' + '{$ELSE}' + ' RecreateWnd;' + '{$ENDIF}' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetHideSelection(const Value: Boolean);' + 'begin' + ' if fHideSelection <> Value then' + ' begin' + ' FHideSelection := Value;' + ' InvalidateSelection;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetInsertMode(const Value: Boolean);' + 'begin' + ' if fInserting <> Value then' + ' begin' + ' fInserting := Value;' + ' if not (csDesigning in ComponentState) then' + ' // Reset the caret.' + ' InitializeCaret;' + ' StatusChanged([scInsertMode]);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.InitializeCaret;' + 'var' + ' ct: TSynEditCaretType;' + ' cw, ch: Integer;' + 'begin' + + ' // CreateCaret automatically destroys the previous one, so we ' + + 'don'#39't have to' + ' // worry about cleaning up the old one here with DestroyCaret.' + + ' // Ideally, we will have properties that control what these tw' + + 'o carets look like.' + ' if InsertMode then' + ' ct := FInsertCaret' + ' else' + ' ct := FOverwriteCaret;' + ' case ct of' + ' ctHorizontalLine:' + ' begin' + ' cw := fCharWidth;' + ' ch := 2;' + ' FCaretOffset := Point(0, fTextHeight - 2);' + ' end;' + ' ctHalfBlock:' + ' begin' + ' cw := fCharWidth;' + ' ch := (fTextHeight - 2) div 2;' + ' FCaretOffset := Point(0, ch);' + ' end;' + ' ctBlock:' + ' begin' + ' cw := fCharWidth;' + ' ch := fTextHeight - 2;' + ' FCaretOffset := Point(0, 0);' + ' end;' + ' else' + ' begin // ctVerticalLine' + ' cw := 2;' + ' ch := fTextHeight - 2;' + ' FCaretOffset := Point(-1, 0);' + ' end;' + ' end;' + ' Exclude(fStateFlags, sfCaretVisible);' + '' + ' if Focused or FAlwaysShowCaret then' + ' begin' + ' {$IFDEF SYN_CLX}' + ' CreateCaret(self, 0, cw, ch);' + ' {$ELSE}' + ' CreateCaret(Handle, 0, cw, ch);' + ' {$ENDIF}' + ' UpdateCaret;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetInsertCaret(const Value: TSynEditCar' + + 'etType);' + 'begin' + ' if FInsertCaret <> Value then' + ' begin' + ' FInsertCaret := Value;' + ' InitializeCaret;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetOverwriteCaret(const Value: TSynEdit' + + 'CaretType);' + 'begin' + ' if FOverwriteCaret <> Value then' + ' begin' + ' FOverwriteCaret := Value;' + ' InitializeCaret;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetMaxScrollWidth(Value: Integer);' + 'begin' + ' Value := MinMax(Value, 1, MaxInt - 1);' + ' if MaxScrollWidth <> Value then' + ' begin' + ' fMaxScrollWidth := Value;' + ' if eoScrollPastEol in Options then' + ' UpdateScrollBars;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.EnsureCursorPosVisible;' + 'begin' + ' EnsureCursorPosVisibleEx(False);' + 'end;' + '' + + 'procedure TCustomSynEdit.EnsureCursorPosVisibleEx(ForceToMiddle:' + + ' Boolean;' + ' EvenIfVisible: Boolean = False);' + 'var' + ' TmpMiddle: Integer;' + ' VisibleX: Integer;' + ' vCaretRow: Integer;' + 'begin' + ' HandleNeeded;' + ' IncPaintLock;' + ' try' + ' // Make sure X is visible' + ' VisibleX := DisplayX;' + ' if VisibleX < LeftChar then' + ' LeftChar := VisibleX' + ' else if VisibleX >= CharsInWindow + LeftChar then' + ' LeftChar := VisibleX - CharsInWindow + 1' + ' else' + ' LeftChar := LeftChar;' + '' + ' // Make sure Y is visible' + ' vCaretRow := DisplayY;' + ' if ForceToMiddle then' + ' begin' + ' if vCaretRow < (TopLine - 1) then' + ' begin' + ' TmpMiddle := LinesInWindow div 2;' + ' if vCaretRow - TmpMiddle < 0 then' + ' TopLine := 1' + ' else' + ' TopLine := vCaretRow - TmpMiddle + 1;' + ' end' + ' else if vCaretRow > (TopLine + (LinesInWindow - 2)) then' + ' begin' + ' TmpMiddle := LinesInWindow div 2;' + ' TopLine := vCaretRow - (LinesInWindow - 1) + TmpMiddle;' + ' end' + ' { Forces to middle even if visible in viewport }' + ' else if EvenIfVisible then' + ' begin' + ' TmpMiddle := fLinesInWindow div 2;' + ' TopLine := vCaretRow - TmpMiddle + 1;' + ' end;' + ' end' + ' else begin' + ' if vCaretRow < TopLine then' + ' TopLine := vCaretRow' + + ' else if vCaretRow > TopLine + Max(1, LinesInWindow) - 1 th' + + 'en' + ' TopLine := vCaretRow - (LinesInWindow - 1)' + ' else' + ' TopLine := TopLine;' + ' end;' + ' finally' + ' DecPaintLock;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetKeystrokes(const Value: TSynEditKeyS' + + 'trokes);' + 'begin' + ' if Value = nil then' + ' FKeystrokes.Clear' + ' else' + ' FKeystrokes.Assign(Value);' + 'end;' + '' + 'procedure TCustomSynEdit.SetDefaultKeystrokes;' + 'begin' + ' FKeystrokes.ResetDefaults;' + 'end;' + '' + + '// If the translations requires Data, memory will be allocated f' + + 'or it via a' + + '// GetMem call. The client must call FreeMem on Data if it is n' + + 'ot NIL.' + '' + + 'function TCustomSynEdit.TranslateKeyCode(Code: word; Shift: TShi' + + 'ftState;' + ' var Data: pointer): TSynEditorCommand;' + 'var' + ' i: Integer;' + '{$IFNDEF SYN_COMPILER_3_UP}' + 'const' + ' VK_ACCEPT = $30;' + '{$ENDIF}' + 'begin' + + ' i := KeyStrokes.FindKeycode2(fLastKey, fLastShiftState, Code, ' + + 'Shift);' + ' if i >= 0 then' + ' Result := KeyStrokes[i].Command' + ' else begin' + ' i := Keystrokes.FindKeycode(Code, Shift);' + ' if i >= 0 then' + ' Result := Keystrokes[i].Command' + ' else' + ' Result := ecNone;' + ' end;' + '{$IFDEF SYN_CLX}' + ' if Result = ecNone then' + '{$ELSE}' + + ' if (Result = ecNone) and (Code >= VK_ACCEPT) and (Code <= VK_S' + + 'CROLL) then' + '{$ENDIF}' + ' begin' + ' fLastKey := Code;' + ' fLastShiftState := Shift;' + ' end' + ' else' + ' begin' + ' fLastKey := 0;' + ' fLastShiftState := [];' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.CommandProcessor(Command: TSynEditorCom' + + 'mand;' + ' AChar: WideChar; Data: pointer);' + 'begin' + + ' // first the program event handler gets a chance to process th' + + 'e command' + ' DoOnProcessCommand(Command, AChar, Data);' + ' if Command <> ecNone then' + ' begin' + + ' // notify hooked command handlers before the command is exec' + + 'uted inside of' + ' // the class' + ' NotifyHookedCommandHandlers(False, Command, AChar, Data);' + ' // internal command handler' + ' if (Command <> ecNone) and (Command < ecUserFirst) then' + ' ExecuteCommand(Command, AChar, Data);' + + ' // notify hooked command handlers after the command was exec' + + 'uted inside of' + ' // the class' + ' if Command <> ecNone then' + ' NotifyHookedCommandHandlers(True, Command, AChar, Data);' + ' end;' + ' DoOnCommandProcessed(Command, AChar, Data);' + 'end;' + '' + + 'procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorComma' + + 'nd; AChar: WideChar;' + ' Data: pointer);' + '' + ' procedure SetSelectedTextEmpty;' + ' var' + ' vSelText: UnicodeString;' + ' vUndoBegin, vUndoEnd: TBufferCoord;' + ' begin' + ' vUndoBegin := fBlockBegin;' + ' vUndoEnd := fBlockEnd;' + ' vSelText := SelText;' + ' SetSelTextPrimitive('#39#39');' + ' if (vUndoBegin.Line < vUndoEnd.Line) or (' + + ' (vUndoBegin.Line = vUndoEnd.Line) and (vUndoBegin.Char < v' + + 'UndoEnd.Char)) then' + ' begin' + + ' fUndoList.AddChange(crDelete, vUndoBegin, vUndoEnd, vSelTe' + + 'xt,' + ' fActiveSelectionMode);' + ' end' + ' else' + ' begin' + + ' fUndoList.AddChange(crDeleteAfterCursor, vUndoBegin, vUndo' + + 'End, vSelText,' + ' fActiveSelectionMode);' + ' end;' + ' end;' + '' + ' procedure ForceCaretX(aCaretX: integer);' + ' var' + ' vRestoreScroll: boolean;' + ' begin' + ' vRestoreScroll := not (eoScrollPastEol in fOptions);' + ' Include(fOptions, eoScrollPastEol);' + ' try' + ' InternalCaretX := aCaretX;' + ' finally' + ' if vRestoreScroll then' + ' Exclude(fOptions, eoScrollPastEol);' + ' end;' + ' end;' + '' + 'var' + ' CX: Integer;' + ' Len: Integer;' + ' Temp: UnicodeString;' + ' Temp2: UnicodeString;' + ' Helper: UnicodeString;' + ' TabBuffer: UnicodeString;' + ' SpaceBuffer: UnicodeString;' + ' SpaceCount1: Integer;' + ' SpaceCount2: Integer;' + ' BackCounter: Integer;' + ' StartOfBlock: TBufferCoord;' + ' EndOfBlock: TBufferCoord;' + ' bChangeScroll: Boolean;' + ' moveBkm: Boolean;' + ' WP: TBufferCoord;' + ' Caret: TBufferCoord;' + ' CaretNew: TBufferCoord;' + ' counter: Integer;' + ' InsDelta: Integer;' + ' iUndoBegin, iUndoEnd: TBufferCoord;' + ' vCaretRow: Integer;' + ' vTabTrim: integer;' + ' s: UnicodeString;' + ' i: Integer;' + 'begin' + ' IncPaintLock;' + ' try' + ' case Command of' + '// horizontal caret movement or selection' + ' ecLeft, ecSelLeft:' + ' MoveCaretHorz(-1, Command = ecSelLeft);' + ' ecRight, ecSelRight:' + ' MoveCaretHorz(1, Command = ecSelRight);' + ' ecPageLeft, ecSelPageLeft:' + ' MoveCaretHorz(-CharsInWindow, Command = ecSelPageLeft);' + ' ecPageRight, ecSelPageRight:' + ' MoveCaretHorz(CharsInWindow, Command = ecSelPageRight);' + ' ecLineStart, ecSelLineStart:' + ' begin' + ' DoHomeKey(Command = ecSelLineStart);' + ' end;' + ' ecLineEnd, ecSelLineEnd:' + ' DoEndKey(Command = ecSelLineEnd);' + '// vertical caret movement or selection' + ' ecUp, ecSelUp:' + ' begin' + ' MoveCaretVert(-1, Command = ecSelUp);' + ' Update;' + ' end;' + ' ecDown, ecSelDown:' + ' begin' + ' MoveCaretVert(1, Command = ecSelDown);' + ' Update;' + ' end;' + ' ecPageUp, ecSelPageUp, ecPageDown, ecSelPageDown:' + ' begin' + + ' counter := fLinesInWindow shr Ord(eoHalfPageScroll in ' + + 'fOptions);' + ' if eoScrollByOneLess in fOptions then' + ' Dec(counter);' + ' if (Command in [ecPageUp, ecSelPageUp]) then' + ' counter := -counter;' + ' TopLine := TopLine + counter;' + + ' MoveCaretVert(counter, Command in [ecSelPageUp, ecSelP' + + 'ageDown]);' + ' Update;' + ' end;' + ' ecPageTop, ecSelPageTop:' + ' begin' + ' CaretNew := DisplayToBufferPos(' + ' DisplayCoord(DisplayX, TopLine) );' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elPageTop);' + ' Update;' + ' end;' + ' ecPageBottom, ecSelPageBottom:' + ' begin' + ' CaretNew := DisplayToBufferPos(' + + ' DisplayCoord(DisplayX, TopLine + LinesInWindow -1) )' + + ';' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elPageBottom);' + ' Update;' + ' end;' + ' ecEditorTop, ecSelEditorTop:' + ' begin' + ' CaretNew.Char := 1;' + ' CaretNew.Line := 1;' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elEditorTop);' + ' Update;' + ' end;' + ' ecEditorBottom, ecSelEditorBottom:' + ' begin' + ' CaretNew.Char := 1;' + ' CaretNew.Line := Lines.Count;' + ' if (CaretNew.Line > 0) then' + + ' CaretNew.Char := Length(Lines[CaretNew.Line - 1]) + ' + + '1;' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elEditorBottom);' + ' Update;' + ' end;' + '// goto special line / column position' + ' ecGotoXY, ecSelGotoXY:' + ' if Assigned(Data) then' + ' begin' + + ' MoveCaretAndSelection(CaretXY, TBufferCoord(Data^), Co' + + 'mmand = ecSelGotoXY);' + ' Update;' + ' end;' + '// word selection' + ' ecWordLeft, ecSelWordLeft:' + ' begin' + ' CaretNew := PrevWordPos;' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elWordLeft);' + ' end;' + ' ecWordRight, ecSelWordRight:' + ' begin' + ' CaretNew := NextWordPos;' + + ' MoveCaretAndSelection(CaretXY, CaretNew, Command = ecS' + + 'elWordRight);' + ' end;' + ' ecSelWord:' + ' '#9'begin' + ' '#9' SetSelWord;' + ' '#9'end;' + ' ecSelectAll:' + ' begin' + ' SelectAll;' + ' end;' + ' ecDeleteLastChar:' + ' if not ReadOnly then begin' + ' DoOnPaintTransientEx(ttBefore,true);' + ' try' + ' if SelAvail then' + ' SetSelectedTextEmpty' + ' else begin' + ' Temp := LineText;' + + ' TabBuffer := TSynEditStringList(Lines).ExpandedStr' + + 'ings[CaretY - 1];' + ' Len := Length(Temp);' + ' Caret := CaretXY;' + ' vTabTrim := 0;' + ' if CaretX > Len + 1 then' + ' begin' + ' Helper := '#39#39';' + ' if eoSmartTabDelete in fOptions then' + ' begin' + + ' //It'#39's at the end of the line, move it to the ' + + 'length' + ' if Len > 0 then' + ' InternalCaretX := Len + 1' + ' else begin' + + ' //move it as if there were normal spaces the' + + 're' + ' SpaceCount1 := CaretX - 1;' + ' SpaceCount2 := 0;' + ' // unindent' + ' if SpaceCount1 > 0 then' + ' begin' + ' BackCounter := CaretY - 2;' + + ' //It'#39's better not to have if statement ins' + + 'ide loop' + + ' if (eoTrimTrailingSpaces in Options) and (' + + 'Len = 0) then' + ' while BackCounter >= 0 do' + ' begin' + + ' SpaceCount2 := LeftSpacesEx(Lines[Back' + + 'Counter], True);' + ' if SpaceCount2 < SpaceCount1 then' + ' break;' + ' Dec(BackCounter);' + ' end' + ' else' + ' while BackCounter >= 0 do' + ' begin' + + ' SpaceCount2 := LeftSpaces(Lines[BackCo' + + 'unter]);' + ' if SpaceCount2 < SpaceCount1 then' + ' break;' + ' Dec(BackCounter);' + ' end;' + + ' if (BackCounter = -1) and (SpaceCount2 > S' + + 'paceCount1) then' + ' SpaceCount2 := 0;' + ' end;' + ' if SpaceCount2 = SpaceCount1 then' + ' SpaceCount2 := 0;' + + ' fCaretX := fCaretX - (SpaceCount1 - SpaceCou' + + 'nt2);' + ' UpdateLastCaretX;' + + ' fStateFlags := fStateFlags + [sfCaretChanged' + + '];' + ' StatusChanged([scCaretX]);' + ' end;' + ' end' + ' else begin' + ' // only move caret one column' + ' InternalCaretX := CaretX - 1;' + ' end;' + ' end else if CaretX = 1 then begin' + ' // join this line with the last line if possible' + ' if CaretY > 1 then' + ' begin' + ' InternalCaretY := CaretY - 1;' + + ' InternalCaretX := Length(Lines[CaretY - 1]) + ' + + '1;' + ' Lines.Delete(CaretY);' + ' DoLinesDeleted(CaretY+1, 1);' + ' if eoTrimTrailingSpaces in Options then' + ' Temp := TrimTrailingSpaces(Temp);' + '' + ' LineText := LineText + Temp;' + ' Helper := #13#10;' + ' end;' + ' end' + ' else begin' + ' // delete text before the caret' + ' SpaceCount1 := LeftSpaces(Temp);' + ' SpaceCount2 := 0;' + + ' if (Temp[CaretX - 1] <= #32) and (SpaceCount1 = ' + + 'CaretX - 1) then' + ' begin' + ' if eoSmartTabDelete in fOptions then' + ' begin' + ' // unindent' + ' if SpaceCount1 > 0 then' + ' begin' + ' BackCounter := CaretY - 2;' + ' while BackCounter >= 0 do' + ' begin' + + ' SpaceCount2 := LeftSpaces(Lines[BackCoun' + + 'ter]);' + ' if SpaceCount2 < SpaceCount1 then' + ' break;' + ' Dec(BackCounter);' + ' end;' + + ' if (BackCounter = -1) and (SpaceCount2 > S' + + 'paceCount1) then' + ' SpaceCount2 := 0;' + ' end;' + ' if SpaceCount2 = SpaceCount1 then' + ' SpaceCount2 := 0;' + + ' Helper := Copy(Temp, 1, SpaceCount1 - SpaceC' + + 'ount2);' + ' Delete(Temp, 1, SpaceCount1 - SpaceCount2);' + ' end' + ' else begin' + ' SpaceCount2 := SpaceCount1;' + ' //how much till the next tab column' + + ' BackCounter := (DisplayX - 1) mod FTabWidth' + + ';' + + ' if BackCounter = 0 then BackCounter := FTabW' + + 'idth;' + '' + ' SpaceCount1 := 0;' + ' CX := DisplayX - BackCounter;' + ' while (SpaceCount1 < FTabWidth) and' + ' (SpaceCount1 < BackCounter) and' + ' (TabBuffer[CX] <> #9) do' + ' begin' + ' Inc(SpaceCount1);' + ' Inc(CX);' + ' end;' + ' {$IFOPT R+}' + + ' // Avoids an exception when compiled with $R' + + '+.' + + ' // '#39'CX'#39' can be '#39'Length(TabBuffer)+1'#39', which ' + + 'isn'#39't an AV and evaluates' + + ' //to #0. But when compiled with $R+, Delphi ' + + 'raises an Exception.' + ' if CX <= Length(TabBuffer) then' + ' {$ENDIF}' + ' if TabBuffer[CX] = #9 then' + ' SpaceCount1 := SpaceCount1 + 1;' + '' + ' if SpaceCount2 = SpaceCount1 then' + ' begin' + ' Helper := Copy(Temp, 1, SpaceCount1);' + ' Delete(Temp, 1, SpaceCount1);' + ' end' + ' else begin' + + ' Helper := Copy(Temp, SpaceCount2 - SpaceCo' + + 'unt1 + 1, SpaceCount1);' + + ' Delete(Temp, SpaceCount2 - SpaceCount1 + 1' + + ', SpaceCount1);' + ' end;' + ' SpaceCount2 := 0;' + ' end;' + + ' fCaretX := fCaretX - (SpaceCount1 - SpaceCount' + + '2);' + ' UpdateLastCaretX;' + + ' // Stores the previous "expanded" CaretX if th' + + 'e line contains tabs.' + + ' if (eoTrimTrailingSpaces in Options) and (Len ' + + '<> Length(TabBuffer)) then' + + ' vTabTrim := CharIndex2CaretPos(CaretX, TabWi' + + 'dth, Temp);' + ' ProperSetLine(CaretY - 1, Temp);' + ' fStateFlags := fStateFlags + [sfCaretChanged];' + ' StatusChanged([scCaretX]);' + + ' // Calculates a delta to CaretX to compensate ' + + 'for trimmed tabs.' + ' if vTabTrim <> 0 then' + ' if Length(Temp) <> Length(LineText) then' + + ' Dec(vTabTrim, CharIndex2CaretPos(CaretX, T' + + 'abWidth, LineText))' + ' else' + ' vTabTrim := 0;' + ' end' + ' else begin' + ' // delete char' + ' counter := 1;' + ' InternalCaretX := CaretX - counter;' + + ' // Stores the previous "expanded" CaretX if th' + + 'e line contains tabs.' + + ' if (eoTrimTrailingSpaces in Options) and (Len ' + + '<> Length(TabBuffer)) then' + + ' vTabTrim := CharIndex2CaretPos(CaretX, TabWi' + + 'dth, Temp);' + ' Helper := Copy(Temp, CaretX, counter);' + ' Delete(Temp, CaretX, counter);' + ' ProperSetLine(CaretY - 1, Temp);' + + ' // Calculates a delta to CaretX to compensate ' + + 'for trimmed tabs.' + ' if vTabTrim <> 0 then' + ' if Length(Temp) <> Length(LineText) then' + + ' Dec(vTabTrim, CharIndex2CaretPos(CaretX, T' + + 'abWidth, LineText))' + ' else' + ' vTabTrim := 0;' + ' end;' + ' end;' + + ' if (Caret.Char <> CaretX) or (Caret.Line <> CaretY' + + ') then' + ' begin' + + ' fUndoList.AddChange(crSilentDelete, CaretXY, Car' + + 'et, Helper,' + ' smNormal);' + ' if vTabTrim <> 0 then' + ' ForceCaretX(CaretX + vTabTrim);' + ' end;' + ' end;' + ' EnsureCursorPosVisible;' + ' finally' + ' DoOnPaintTransientEx(ttAfter,true);' + ' end;' + ' end;' + ' ecDeleteChar:' + ' if not ReadOnly then begin' + ' DoOnPaintTransient(ttBefore);' + '' + ' if SelAvail then' + ' SetSelectedTextEmpty' + ' else begin' + + ' // Call UpdateLastCaretX. Even though the caret does' + + 'n'#39't move, the' + + ' // current caret position should "stick" whenever te' + + 'xt is modified.' + ' UpdateLastCaretX;' + ' Temp := LineText;' + ' Len := Length(Temp);' + ' if CaretX <= Len then' + ' begin' + ' // delete char' + ' counter := 1;' + ' Helper := Copy(Temp, CaretX, counter);' + ' Caret.Char := CaretX + counter;' + ' Caret.Line := CaretY;' + ' Delete(Temp, CaretX, counter);' + ' ProperSetLine(CaretY - 1, Temp);' + ' end' + ' else begin' + ' // join line with the line after' + ' if CaretY < Lines.Count then' + ' begin' + + ' Helper := UnicodeStringOfChar(#32, CaretX - 1 - ' + + 'Len);' + + ' ProperSetLine(CaretY - 1, Temp + Helper + Lines[' + + 'CaretY]);' + ' Caret.Char := 1;' + ' Caret.Line := CaretY + 1;' + ' Helper := #13#10;' + ' Lines.Delete(CaretY);' + ' DoLinesDeleted(CaretY +1, 1);' + ' end;' + ' end;' + + ' if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) ' + + 'then' + ' begin' + + ' fUndoList.AddChange(crSilentDeleteAfterCursor, Car' + + 'etXY, Caret,' + ' Helper, smNormal);' + ' end;' + ' end;' + ' DoOnPaintTransient(ttAfter);' + ' end;' + ' ecDeleteWord, ecDeleteEOL:' + ' if not ReadOnly then begin' + ' DoOnPaintTransient(ttBefore);' + ' Len := Length(LineText);' + ' if Command = ecDeleteWord then' + ' begin' + ' WP := WordEnd;' + ' Temp := LineText;' + + ' if (WP.Char < CaretX) or ((WP.Char = CaretX) and (WP' + + '.Line < fLines.Count)) then' + ' begin' + ' if WP.Char > Len then' + ' begin' + ' Inc(WP.Line);' + ' WP.Char := 1;' + ' Temp := Lines[WP.Line - 1];' + ' end' + ' else if Temp[WP.Char] <> #32 then' + ' Inc(WP.Char);' + ' end;' + ' {$IFOPT R+}' + ' Temp := Temp + #0;' + ' {$ENDIF}' + ' if Temp <> '#39#39' then' + ' while Temp[WP.Char] = #32 do' + ' Inc(WP.Char);' + ' end' + ' else begin' + ' WP.Char := Len + 1;' + ' WP.Line := CaretY;' + ' end;' + ' if (WP.Char <> CaretX) or (WP.Line <> CaretY) then' + ' begin' + ' SetBlockBegin(CaretXY);' + ' SetBlockEnd(WP);' + ' ActiveSelectionMode := smNormal;' + ' Helper := SelText;' + + ' SetSelTextPrimitive(UnicodeStringOfChar('#39' '#39', CaretX ' + + '- BlockBegin.Char));' + + ' fUndoList.AddChange(crSilentDeleteAfterCursor, Caret' + + 'XY, WP,' + ' Helper, smNormal);' + ' InternalCaretXY := CaretXY;' + ' end;' + ' end;' + ' ecDeleteLastWord, ecDeleteBOL:' + ' if not ReadOnly then begin' + ' DoOnPaintTransient(ttBefore);' + ' if Command = ecDeleteLastWord then' + ' WP := PrevWordPos' + ' else begin' + ' WP.Char := 1;' + ' WP.Line := CaretY;' + ' end;' + ' if (WP.Char <> CaretX) or (WP.Line <> CaretY) then' + ' begin' + ' SetBlockBegin(CaretXY);' + ' SetBlockEnd(WP);' + ' ActiveSelectionMode := smNormal;' + ' Helper := SelText;' + ' SetSelTextPrimitive('#39#39');' + + ' fUndoList.AddChange(crSilentDelete, WP, CaretXY, Hel' + + 'per,' + ' smNormal);' + ' InternalCaretXY := WP;' + ' end;' + ' DoOnPaintTransient(ttAfter);' + ' end;' + ' ecDeleteLine:' + + ' if not ReadOnly and (Lines.Count > 0) and not ((CaretY =' + + ' Lines.Count) and (Length(Lines[CaretY - 1]) = 0))' + ' then begin' + ' DoOnPaintTransient(ttBefore);' + ' if SelAvail then' + ' SetBlockBegin(CaretXY);' + ' Helper := LineText;' + ' if CaretY = Lines.Count then' + ' begin' + ' Lines[CaretY - 1] := '#39#39';' + + ' fUndoList.AddChange(crSilentDeleteAfterCursor, Buffe' + + 'rCoord(1, CaretY),' + + ' BufferCoord(Length(Helper) + 1, CaretY), Helper, s' + + 'mNormal);' + ' end' + ' else begin' + ' Lines.Delete(CaretY - 1);' + ' Helper := Helper + #13#10;' + + ' fUndoList.AddChange(crSilentDeleteAfterCursor, Buffe' + + 'rCoord(1, CaretY),' + ' BufferCoord(1, CaretY + 1), Helper, smNormal);' + ' DoLinesDeleted(CaretY, 1);' + ' end;' + + ' InternalCaretXY := BufferCoord(1, CaretY); // like see' + + 'n in the Delphi editor' + ' end;' + ' ecClearAll:' + ' begin' + ' if not ReadOnly then ClearAll;' + ' end;' + ' ecInsertLine,' + ' ecLineBreak:' + ' if not ReadOnly then begin' + ' UndoList.BeginBlock;' + ' try' + ' if SelAvail then' + ' begin' + ' Helper := SelText;' + ' iUndoBegin := fBlockBegin;' + ' iUndoEnd := fBlockEnd;' + ' SetSelTextPrimitive('#39#39');' + + ' fUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd, ' + + 'Helper,' + ' fActiveSelectionMode);' + ' end;' + ' Temp := LineText;' + ' Temp2 := Temp;' + + '// This is sloppy, but the Right Thing would be to track the col' + + 'umn of markers' + + '// too, so they could be moved depending on whether they are aft' + + 'er the caret...' + ' InsDelta := Ord(CaretX = 1);' + ' Len := Length(Temp);' + ' if Len > 0 then' + ' begin' + ' if Len >= CaretX then' + ' begin' + ' if CaretX > 1 then' + ' begin' + ' Temp := Copy(LineText, 1, CaretX - 1);' + ' SpaceCount1 := LeftSpacesEx(Temp,true);' + ' Delete(Temp2, 1, CaretX - 1);' + + ' Lines.Insert(CaretY, GetLeftSpacing(SpaceCount1,' + + ' True) + Temp2);' + ' ProperSetLine(CaretY - 1, Temp);' + + ' fUndoList.AddChange(crLineBreak, CaretXY, CaretX' + + 'Y, Temp2,' + ' smNormal);' + ' if Command = ecLineBreak then' + ' InternalCaretXY := BufferCoord(' + + ' Length(GetLeftSpacing(SpaceCount1,true)) + 1' + + ',' + ' CaretY + 1);' + ' end' + ' else begin' + ' Lines.Insert(CaretY - 1, '#39#39');' + + ' fUndoList.AddChange(crLineBreak, CaretXY, CaretX' + + 'Y, Temp2,' + ' smNormal);' + ' if Command = ecLineBreak then' + ' InternalCaretY := CaretY + 1;' + ' end;' + ' end' + ' else begin' + ' SpaceCount2 := 0;' + ' BackCounter := CaretY;' + ' if eoAutoIndent in Options then' + ' begin' + ' repeat' + ' Dec(BackCounter);' + ' Temp := Lines[BackCounter];' + ' SpaceCount2 := LeftSpaces(Temp);' + ' until (BackCounter = 0) or (Temp <> '#39#39');' + ' end;' + ' Lines.Insert(CaretY, '#39#39');' + ' Caret := CaretXY;' + '' + + ' fUndoList.AddChange(crLineBreak, Caret, Caret, '#39#39',' + + ' smNormal); //KV' + ' if Command = ecLineBreak then' + ' begin' + ' InternalCaretXY := BufferCoord(1, CaretY +1);' + ' if SpaceCount2 > 0 then' + ' begin' + + ' SpaceBuffer := Copy(Lines[BackCounter], 1, Spa' + + 'ceCount2);' + ' for i := 1 to Length(SpaceBuffer) do' + ' if SpaceBuffer[i] = #9 then' + ' CommandProcessor(ecTab, #0, nil)' + ' else' + + ' CommandProcessor(ecChar, SpaceBuffer[i], n' + + 'il);' + ' end;' + ' end;' + ' end;' + ' end' + ' else begin' + ' if fLines.Count = 0 then' + ' fLines.Add('#39#39');' + ' SpaceCount2 := 0;' + ' if eoAutoIndent in Options then' + ' begin' + ' BackCounter := CaretY - 1;' + ' while BackCounter >= 0 do' + ' begin' + + ' SpaceCount2 := LeftSpacesEx(Lines[BackCounter],T' + + 'rue);' + ' if Length(Lines[BackCounter]) > 0 then break;' + ' dec(BackCounter);' + ' end;' + ' end;' + ' Lines.Insert(CaretY - 1, '#39#39');' + + ' fUndoList.AddChange(crLineBreak, CaretXY, CaretXY, '#39 + + #39', smNormal);' + ' if Command = ecLineBreak then' + ' InternalCaretX := SpaceCount2 + 1;' + ' if Command = ecLineBreak then' + ' InternalCaretY := CaretY + 1;' + ' end;' + ' DoLinesInserted(CaretY - InsDelta, 1);' + ' BlockBegin := CaretXY;' + ' BlockEnd := CaretXY;' + ' EnsureCursorPosVisible;' + ' UpdateLastCaretX;' + ' finally' + ' UndoList.EndBlock;' + ' end;' + ' end;' + ' ecTab:' + ' if not ReadOnly then DoTabKey;' + ' ecShiftTab:' + ' if not ReadOnly then DoShiftTabKey;' + ' ecMatchBracket:' + ' FindMatchingBracket;' + ' ecChar:' + ' // #127 is Ctrl + Backspace, #32 is space' + + ' if not ReadOnly and (AChar >= #32) and (AChar <> #127) t' + + 'hen' + ' begin' + ' if SelAvail then' + ' begin' + ' BeginUndoBlock;' + ' try' + ' Helper := SelText;' + ' iUndoBegin := fBlockBegin;' + ' iUndoEnd := fBlockEnd;' + ' StartOfBlock := BlockBegin;' + ' if fActiveSelectionMode = smLine then' + ' StartOfBlock.Char := 1;' + + ' fUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd' + + ', Helper,' + ' fActiveSelectionMode);' + ' SetSelTextPrimitive(AChar);' + ' if fActiveSelectionMode <> smColumn then' + ' begin' + + ' fUndoList.AddChange(crInsert, StartOfBlock, Bloc' + + 'kEnd, '#39#39',' + ' smNormal);' + ' end;' + ' finally' + ' EndUndoBlock;' + ' end;' + ' end' + ' else' + ' begin' + ' SpaceCount2 := 0;' + ' Temp := LineText;' + ' Len := Length(Temp);' + ' if Len < CaretX then' + ' begin' + ' if (Len > 0) then' + + ' SpaceBuffer := UnicodeStringOfChar(#32, CaretX -' + + ' Len - Ord(fInserting))' + ' else' + + ' SpaceBuffer := GetLeftSpacing(CaretX - Len - Ord' + + '(fInserting), True);' + ' SpaceCount2 := Length(SpaceBuffer);' + '' + ' Temp := Temp + SpaceBuffer;' + ' end;' + + ' // Added the check for whether or not we'#39're in inser' + + 't mode.' + + ' // If we are, we append one less space than we would' + + ' in overwrite mode.' + + ' // This is because in overwrite mode we have to put ' + + 'in a final space' + + ' // character which will be overwritten with the type' + + 'd character. If we put the' + + ' // extra space in in insert mode, it would be left a' + + 't the end of the line and' + + ' // cause problems unless eoTrimTrailingSpaces is set' + + '.' + ' bChangeScroll := not (eoScrollPastEol in fOptions);' + ' try' + + ' if bChangeScroll then Include(fOptions, eoScrollPa' + + 'stEol);' + ' StartOfBlock := CaretXY;' + '' + ' if fInserting then' + ' begin' + + ' if not WordWrap and not (eoAutoSizeMaxScrollWidt' + + 'h in Options)' + ' and (CaretX > MaxScrollWidth) then' + ' begin' + ' Exit;' + ' end;' + ' Insert(AChar, Temp, CaretX);' + + ' if (eoTrimTrailingSpaces in Options) and ((AChar' + + ' = #9) or (AChar = #32)) and (Length(TrimTrailingSpaces(LineText' + + ')) = 0) then' + + ' InternalCaretX := GetExpandedLength(Temp, TabW' + + 'idth) + 1' + ' else' + ' begin' + ' if Len = 0 then' + ' InternalCaretX := Length(Temp) + 1' + ' else' + ' InternalCaretX := CaretX + 1;' + ' end;' + ' ProperSetLine(CaretY - 1, Temp);' + ' if SpaceCount2 > 0 then' + ' begin' + ' BeginUndoBlock;' + ' try' + + ' //if we inserted spaces with this char, we n' + + 'eed to account for those' + ' //in the X Position' + + ' StartOfBlock.Char := StartOfBlock.Char - Spa' + + 'ceCount2;' + ' EndOfBlock := CaretXY;' + ' EndOfBlock.Char := EndOfBlock.Char - 1;' + ' //The added whitespace' + + ' fUndoList.AddChange(crWhiteSpaceAdd, EndOfBl' + + 'ock, StartOfBlock, '#39#39',' + ' smNormal);' + + ' StartOfBlock.Char := StartOfBlock.Char + Spa' + + 'ceCount2;' + '' + + ' fUndoList.AddChange(crInsert, StartOfBlock, ' + + 'CaretXY, '#39#39',' + ' smNormal);' + ' finally' + ' EndUndoBlock;' + ' end;' + ' end' + ' else begin' + + ' fUndoList.AddChange(crInsert, StartOfBlock, Ca' + + 'retXY, '#39#39',' + ' smNormal);' + ' end;' + ' end' + ' else begin' + '// Processing of case character covers on LeadByte.' + ' counter := 1;' + ' Helper := Copy(Temp, CaretX, counter);' + ' Temp[CaretX] := AChar;' + ' CaretNew.Char := CaretX + counter;' + ' CaretNew.Line := CaretY;' + ' ProperSetLine(CaretY - 1, Temp);' + + ' fUndoList.AddChange(crInsert, StartOfBlock, Care' + + 'tNew, Helper,' + ' smNormal);' + ' InternalCaretX := CaretX + 1;' + ' end;' + ' if CaretX >= LeftChar + fCharsInWindow then' + + ' LeftChar := LeftChar + Min(25, fCharsInWindow - ' + + '1);' + ' finally' + + ' if bChangeScroll then Exclude(fOptions, eoScrollPa' + + 'stEol);' + ' end;' + ' end;' + ' DoOnPaintTransient(ttAfter);' + ' end;' + ' ecUpperCase,' + ' ecLowerCase,' + ' ecToggleCase,' + ' ecTitleCase,' + ' ecUpperCaseBlock,' + ' ecLowerCaseBlock,' + ' ecToggleCaseBlock:' + ' if not ReadOnly then DoCaseChange(Command);' + ' ecUndo:' + ' begin' + ' if not ReadOnly then Undo;' + ' end;' + ' ecRedo:' + ' begin' + ' if not ReadOnly then Redo;' + ' end;' + ' ecGotoMarker0..ecGotoMarker9:' + ' begin' + ' if BookMarkOptions.EnableKeys then' + ' GotoBookMark(Command - ecGotoMarker0);' + ' end;' + ' ecSetMarker0..ecSetMarker9:' + ' begin' + ' if BookMarkOptions.EnableKeys then' + ' begin' + ' CX := Command - ecSetMarker0;' + ' if Assigned(Data) then' + ' Caret := TBufferCoord(Data^)' + ' else' + ' Caret := CaretXY;' + ' if assigned(fBookMarks[CX]) then' + ' begin' + ' moveBkm := (fBookMarks[CX].Line <> Caret.Line);' + ' ClearBookMark(CX);' + ' if moveBkm then' + ' SetBookMark(CX, Caret.Char, Caret.Line);' + ' end' + ' else' + ' SetBookMark(CX, Caret.Char, Caret.Line);' + ' end; // if BookMarkOptions.EnableKeys' + ' end;' + ' ecCut:' + ' begin' + ' if (not ReadOnly) and SelAvail then' + ' CutToClipboard;' + ' end;' + ' ecCopy:' + ' begin' + ' CopyToClipboard;' + ' end;' + ' ecPaste:' + ' begin' + ' if not ReadOnly then PasteFromClipboard;' + ' end;' + ' ecScrollUp, ecScrollDown:' + ' begin' + ' vCaretRow := DisplayY;' + + ' if (vCaretRow < TopLine) or (vCaretRow >= TopLine + Li' + + 'nesInWindow) then' + + ' // If the caret is not in view then, like the Delphi' + + ' editor, move' + ' // it in view and do nothing else' + ' EnsureCursorPosVisible' + ' else begin' + ' if Command = ecScrollUp then' + ' begin' + ' TopLine := TopLine - 1;' + ' if vCaretRow > TopLine + LinesInWindow - 1 then' + + ' MoveCaretVert((TopLine + LinesInWindow - 1) - vC' + + 'aretRow, False);' + ' end' + ' else begin' + ' TopLine := TopLine + 1;' + ' if vCaretRow < TopLine then' + ' MoveCaretVert(TopLine - vCaretRow, False);' + ' end;' + ' EnsureCursorPosVisible;' + ' Update;' + ' end;' + ' end;' + ' ecScrollLeft:' + ' begin' + ' LeftChar := LeftChar - 1;' + + ' // todo: The following code was commented out because ' + + 'it is not MBCS or hard-tab safe.' + ' //if CaretX > LeftChar + CharsInWindow then' + ' // InternalCaretX := LeftChar + CharsInWindow;' + ' Update;' + ' end;' + ' ecScrollRight:' + ' begin' + ' LeftChar := LeftChar + 1;' + + ' // todo: The following code was commented out because ' + + 'it is not MBCS or hard-tab safe.' + ' //if CaretX < LeftChar then' + ' // InternalCaretX := LeftChar;' + ' Update;' + ' end;' + ' ecInsertMode:' + ' begin' + ' InsertMode := True;' + ' end;' + ' ecOverwriteMode:' + ' begin' + ' InsertMode := False;' + ' end;' + ' ecToggleMode:' + ' begin' + ' InsertMode := not InsertMode;' + ' end;' + ' ecBlockIndent:' + ' if not ReadOnly then DoBlockIndent;' + ' ecBlockUnindent:' + ' if not ReadOnly then DoBlockUnindent;' + ' ecNormalSelect:' + ' SelectionMode := smNormal;' + ' ecColumnSelect:' + ' SelectionMode := smColumn;' + ' ecLineSelect:' + ' SelectionMode := smLine;' + ' ecContextHelp:' + ' begin' + ' if Assigned (fOnContextHelp) then' + ' fOnContextHelp (self,WordAtCursor);' + ' end;' + ' ecImeStr:' + ' if not ReadOnly then' + ' begin' + ' SetString(S, PWideChar(Data), WStrLen(Data));' + ' if SelAvail then' + ' begin' + ' BeginUndoBlock;' + ' try' + + ' fUndoList.AddChange(crDelete, fBlockBegin, fBlockE' + + 'nd, Helper,' + ' smNormal);' + ' StartOfBlock := fBlockBegin;' + ' SetSelTextPrimitive(s);' + + ' fUndoList.AddChange(crInsert, fBlockBegin, fBlockE' + + 'nd, Helper,' + ' smNormal);' + ' finally' + ' EndUndoBlock;' + ' end;' + ' InvalidateGutterLines(-1, -1);' + ' end' + ' else' + ' begin' + ' Temp := LineText;' + ' Len := Length(Temp);' + ' if Len < CaretX then' + + ' Temp := Temp + UnicodeStringOfChar(#32, CaretX - L' + + 'en - 1);' + ' bChangeScroll := not (eoScrollPastEol in fOptions);' + ' try' + + ' if bChangeScroll then Include(fOptions, eoScrollPa' + + 'stEol);' + ' StartOfBlock := CaretXY;' + ' Len := Length(s);' + ' if not fInserting then' + ' begin' + ' Helper := Copy(Temp, CaretX, Len);' + ' Delete(Temp, CaretX, Len);' + ' end;' + ' Insert(s, Temp, CaretX);' + ' InternalCaretX := (CaretX + Len);' + ' ProperSetLine(CaretY - 1, Temp);' + ' if fInserting then' + ' Helper := '#39#39';' + + ' fUndoList.AddChange(crInsert, StartOfBlock, CaretX' + + 'Y, Helper,' + ' smNormal);' + ' if CaretX >= LeftChar + fCharsInWindow then' + + ' LeftChar := LeftChar + min(25, fCharsInWindow - ' + + '1);' + ' finally' + + ' if bChangeScroll then Exclude(fOptions, eoScrollPa' + + 'stEol);' + ' end;' + ' end;' + ' end;' + ' end;' + ' finally' + ' DecPaintLock;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnCommandProcessed(Command: TSynEdito' + + 'rCommand;' + ' AChar: WideChar; Data: pointer);' + 'begin' + ' if Assigned(fOnCommandProcessed) then' + ' fOnCommandProcessed(Self, Command, AChar, Data);' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnProcessCommand(var Command: TSynEdi' + + 'torCommand;' + ' var AChar: WideChar; Data: pointer);' + 'begin' + ' if Command < ecUserFirst then' + ' begin' + ' if Assigned(FOnProcessCommand) then' + ' FOnProcessCommand(Self, Command, AChar, Data);' + ' end' + ' else begin' + ' if Assigned(FOnProcessUserCommand) then' + ' FOnProcessUserCommand(Self, Command, AChar, Data);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ClearAll;' + 'begin' + ' Lines.Clear;' + ' fMarkList.Clear; // fMarkList.Clear also frees all bookmarks,' + + ' FillChar(fBookMarks, sizeof(fBookMarks), 0); // so fBookMarks ' + + 'should be cleared too' + ' fUndoList.Clear;' + ' fRedoList.Clear;' + ' Modified := False;' + 'end;' + '' + 'procedure TCustomSynEdit.ClearSelection;' + 'begin' + ' if SelAvail then' + ' SelText := '#39#39';' + 'end;' + '' + + 'function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): T' + + 'BufferCoord;' + 'var' + ' CX, CY, LineLen: Integer;' + ' Line: UnicodeString;' + 'begin' + ' CX := XY.Char;' + ' CY := XY.Line;' + '' + ' // valid line?' + ' if (CY >= 1) and (CY <= Lines.Count) then' + ' begin' + ' Line := Lines[CY - 1];' + '' + ' LineLen := Length(Line);' + ' if CX >= LineLen then' + ' begin' + ' // find first IdentChar or multibyte char in the next line' + ' if CY < Lines.Count then' + ' begin' + ' Line := Lines[CY];' + ' Inc(CY);' + ' CX := StrScanForCharInCategory(Line, 1, IsIdentChar);' + ' if CX = 0 then' + ' Inc(CX);' + ' end;' + ' end' + ' else' + ' begin' + + ' // find next word-break-char if current char is an IdentCh' + + 'ar' + ' if IsIdentChar(Line[CX]) then' + + ' CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar' + + ');' + ' // if word-break-char found, find the next IdentChar' + ' if CX > 0 then' + ' CX := StrScanForCharInCategory(Line, CX, IsIdentChar);' + + ' // if one of those failed just position at the end of the ' + + 'line' + ' if CX = 0 then' + ' CX := LineLen + 1;' + ' end;' + ' end;' + ' Result.Char := CX;' + ' Result.Line := CY;' + 'end;' + '' + + 'function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBu' + + 'fferCoord;' + 'var' + ' CX, CY: Integer;' + ' Line: UnicodeString;' + 'begin' + ' CX := XY.Char;' + ' CY := XY.Line;' + ' // valid line?' + ' if (CY >= 1) and (CY <= Lines.Count) then' + ' begin' + ' Line := Lines[CY - 1];' + ' CX := Min(CX, Length(Line) + 1);' + '' + ' if CX > 1 then' + + ' begin // only find previous char, if not already on start o' + + 'f line' + + ' // if previous char isn'#39't a word-break-char search for the' + + ' last IdentChar' + ' if not IsWordBreakChar(Line[CX - 1]) then' + + ' CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBrea' + + 'kChar) + 1;' + ' end;' + ' end;' + ' Result.Char := CX;' + ' Result.Line := CY;' + 'end;' + '' + + 'function TCustomSynEdit.WordEndEx(const XY: TBufferCoord): TBuff' + + 'erCoord;' + 'var' + ' CX, CY: Integer;' + ' Line: UnicodeString;' + 'begin' + ' CX := XY.Char;' + ' CY := XY.Line;' + ' // valid line?' + ' if (CY >= 1) and (CY <= Lines.Count) then' + ' begin' + ' Line := Lines[CY - 1];' + '' + ' CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar);' + + ' // if no word-break-char is found just position at the end o' + + 'f the line' + ' if CX = 0 then' + ' CX := Length(Line) + 1;' + ' end;' + ' Result.Char := CX;' + ' Result.Line := CY;' + 'end;' + '' + + 'function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): T' + + 'BufferCoord;' + 'var' + ' CX, CY: Integer;' + ' Line: UnicodeString;' + 'begin' + ' CX := XY.Char;' + ' CY := XY.Line;' + ' // valid line?' + ' if (CY >= 1) and (CY <= Lines.Count) then' + ' begin' + ' Line := Lines[CY - 1];' + ' CX := Min(CX, Length(Line) + 1);' + '' + ' if CX <= 1 then' + ' begin' + ' // find last IdentChar in the previous line' + ' if CY > 1 then' + ' begin' + ' Dec(CY);' + ' Line := Lines[CY - 1];' + ' CX := Length(Line) + 1;' + ' end;' + ' end' + ' else' + ' begin' + + ' // if previous char is a word-break-char search for the la' + + 'st IdentChar' + ' if IsWordBreakChar(Line[CX - 1]) then' + + ' CX := StrRScanForCharInCategory(Line, CX - 1, IsIdentCha' + + 'r);' + ' if CX > 0 then' + ' // search for the first IdentChar of this "word"' + + ' CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBrea' + + 'kChar) + 1;' + ' if CX = 0 then' + ' begin' + ' // else just position at the end of the previous line' + ' if CY > 1 then' + ' begin' + ' Dec(CY);' + ' Line := Lines[CY - 1];' + ' CX := Length(Line) + 1;' + ' end' + ' else' + ' CX := 1;' + ' end;' + ' end;' + ' end;' + ' Result.Char := CX;' + ' Result.Line := CY;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetSelectionMode(const Value: TSynSelec' + + 'tionMode);' + 'begin' + ' if FSelectionMode <> Value then' + ' begin' + ' fSelectionMode := Value;' + ' ActiveSelectionMode := Value;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetActiveSelectionMode(const Value: TSy' + + 'nSelectionMode);' + 'begin' + ' if fActiveSelectionMode <> Value then' + ' begin' + ' if SelAvail then' + ' InvalidateSelection;' + ' fActiveSelectionMode := Value;' + ' if SelAvail then' + ' InvalidateSelection;' + ' StatusChanged([scSelection]);' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetAdditionalIdentChars(const Value: TS' + + 'ysCharSet);' + 'begin' + ' FAdditionalIdentChars := Value;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetAdditionalWordBreakChars(const Value' + + ': TSysCharSet);' + 'begin' + ' FAdditionalWordBreakChars := Value;' + 'end;' + '' + 'procedure TCustomSynEdit.BeginUndoBlock;' + 'begin' + ' fUndoList.BeginBlock;' + 'end;' + '' + 'procedure TCustomSynEdit.BeginUpdate;' + 'begin' + ' IncPaintLock;' + 'end;' + '' + 'procedure TCustomSynEdit.EndUndoBlock;' + 'begin' + ' fUndoList.EndBlock;' + 'end;' + '' + 'procedure TCustomSynEdit.EndUpdate;' + 'begin' + ' DecPaintLock;' + 'end;' + '' + 'procedure TCustomSynEdit.AddKey(Command: TSynEditorCommand;' + ' Key1: word; SS1: TShiftState; Key2: word; SS2: TShiftState);' + 'var' + ' Key: TSynEditKeyStroke;' + 'begin' + ' Key := Keystrokes.Add;' + ' Key.Command := Command;' + ' Key.Key := Key1;' + ' Key.Shift := SS1;' + ' Key.Key2 := Key2;' + ' Key.Shift2 := SS2;' + 'end;' + '' + '{ Called by FMarkList if change }' + 'procedure TCustomSynEdit.MarkListChange(Sender: TObject);' + 'begin' + ' InvalidateGutter;' + 'end;' + '' + 'function TCustomSynEdit.GetSelStart: integer;' + 'begin' + ' if GetSelAvail then' + ' Result := RowColToCharIndex(BlockBegin)' + ' else' + ' Result := RowColToCharIndex(CaretXY);' + 'end;' + '' + + 'procedure TCustomSynEdit.SetAlwaysShowCaret(const Value: Boolean' + + ');' + 'begin' + ' if FAlwaysShowCaret <> Value then' + ' begin' + ' FAlwaysShowCaret := Value;' + + ' if not(csDestroying in ComponentState) and not(focused) the' + + 'n' + ' begin' + ' if Value then' + ' begin' + ' InitializeCaret;' + ' end' + ' else' + ' begin' + ' HideCaret;' + ' {$IFDEF SYN_CLX}' + ' kTextDrawer.DestroyCaret;' + ' {$ELSE}' + ' Windows.DestroyCaret;' + ' {$ENDIF}' + ' end;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetSelStart(const Value: Integer);' + 'begin' + + ' { if we don'#39't call HandleNeeded, CharsInWindow may be 0 and Le' + + 'ftChar will' + ' be set to CaretX }' + ' HandleNeeded;' + ' InternalCaretXY := CharIndexToRowCol(Value);' + ' BlockBegin := CaretXY;' + 'end;' + '' + 'function TCustomSynEdit.GetSelEnd: Integer;' + 'begin' + ' if GetSelAvail then' + ' Result := RowColToCharIndex(Blockend)' + ' else' + ' Result := RowColToCharIndex(CaretXY);' + 'end;' + '' + 'procedure TCustomSynEdit.SetSelEnd(const Value: Integer);' + 'begin' + ' HandleNeeded;' + ' BlockEnd := CharIndexToRowCol( Value );' + 'end;' + '' + 'procedure TCustomSynEdit.SetSelWord;' + 'begin' + ' SetWordBlock(CaretXY);' + 'end;' + '' + + 'procedure TCustomSynEdit.SetExtraLineSpacing(const Value: Intege' + + 'r);' + 'begin' + ' fExtraLineSpacing := Value;' + ' SynFontChanged(self);' + 'end;' + '' + + 'function TCustomSynEdit.GetBookMark(BookMark: Integer; var X, Y:' + + ' Integer):' + ' Boolean;' + 'var' + ' i: Integer;' + 'begin' + ' Result := False;' + ' if assigned(Marks) then' + ' for i := 0 to Marks.Count - 1 do' + + ' if Marks[i].IsBookmark and (Marks[i].BookmarkNumber = Book' + + 'Mark) then' + ' begin' + ' X := Marks[i].Char;' + ' Y := Marks[i].Line;' + ' Result := True;' + ' Exit;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.IsBookmark(BookMark: Integer): Boolean;' + 'var' + ' x, y: Integer;' + 'begin' + ' Result := GetBookMark(BookMark, x, y);' + 'end;' + '' + 'procedure TCustomSynEdit.ClearUndo;' + 'begin' + ' fUndoList.Clear;' + ' fRedoList.Clear;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetSelTextExternal(const Value: Unicode' + + 'String);' + 'var' + ' StartOfBlock, EndOfBlock: TBufferCoord;' + 'begin' + ' BeginUndoBlock;' + ' try' + ' if SelAvail then' + ' begin' + ' fUndoList.AddChange(crDelete, fBlockBegin, fBlockEnd,' + ' SelText, fActiveSelectionMode);' + ' end' + ' else' + ' ActiveSelectionMode := SelectionMode;' + ' StartOfBlock := BlockBegin;' + ' EndOfBlock := BlockEnd;' + ' fBlockBegin := StartOfBlock;' + ' fBlockEnd := EndOfBlock;' + ' SetSelTextPrimitive(Value);' + ' if (Value <> '#39#39') and (fActiveSelectionMode <> smColumn) then' + + ' fUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, '#39#39', ' + + 'fActiveSelectionMode);' + ' finally' + ' EndUndoBlock;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SetGutter(const Value: TSynGutter);' + 'begin' + ' fGutter.Assign(Value);' + 'end;' + '' + 'procedure TCustomSynEdit.GutterChanged(Sender: TObject);' + 'var' + ' nW: Integer;' + 'begin' + ' if not (csLoading in ComponentState) then' + ' begin' + ' if fGutter.ShowLineNumbers and fGutter.AutoSize then' + ' fGutter.AutoSizeDigitCount(Lines.Count);' + ' if fGutter.UseFontStyle then' + ' begin' + ' fTextDrawer.SetBaseFont(fGutter.Font);' + ' nW := fGutter.RealGutterWidth(fTextDrawer.CharWidth);' + ' fTextDrawer.SetBaseFont(Font);' + ' end' + ' else' + ' nW := fGutter.RealGutterWidth(fCharWidth);' + ' if nW = fGutterWidth then' + ' InvalidateGutter' + ' else' + ' SetGutterWidth(nW);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.LockUndo;' + 'begin' + ' fUndoList.Lock;' + ' fRedoList.Lock;' + 'end;' + '' + 'procedure TCustomSynEdit.UnlockUndo;' + 'begin' + ' fUndoList.Unlock;' + ' fRedoList.Unlock;' + 'end;' + '' + '{$IFNDEF SYN_COMPILER_6_UP}' + 'procedure TCustomSynEdit.WMMouseWheel(var Msg: TMessage);' + 'var' + ' nDelta: Integer;' + ' nWheelClicks: Integer;' + '{$IFNDEF SYN_COMPILER_4_UP}' + 'const' + ' LinesToScroll = 3;' + ' WHEEL_DELTA = 120;' + ' WHEEL_PAGESCROLL = MAXDWORD;' + ' SPI_GETWHEELSCROLLLINES = 104;' + '{$ENDIF}' + 'begin' + ' if csDesigning in ComponentState then' + ' exit;' + '' + #9'Msg.Result := 1;' + '' + '{$IFDEF SYN_COMPILER_4_UP}' + + ' // In some occasions Windows will not properly initialize mous' + + 'e wheel, but' + + ' // will still keep sending WM_MOUSEWHEEL message. Calling inhe' + + 'rited procedure' + + ' // will re-initialize related properties (i.e. Mouse.WheelScro' + + 'llLines)' + ' inherited;' + '{$ENDIF}' + '' + ' if GetKeyState(VK_CONTROL) >= 0 then' + ' begin' + '{$IFDEF SYN_COMPILER_4_UP}' + ' nDelta := Mouse.WheelScrollLines' + '{$ELSE}' + + ' if not SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @nDe' + + 'lta, 0) then' + ' nDelta := LinesToScroll;' + '{$ENDIF}' + ' end' + ' else' + + ' nDelta := LinesInWindow shr Ord(eoHalfPageScroll in fOptions' + + ');' + '' + ' Inc(fMouseWheelAccumulator, SmallInt(Msg.wParamHi));' + ' nWheelClicks := fMouseWheelAccumulator div WHEEL_DELTA;' + + ' fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DEL' + + 'TA;' + + ' if (nDelta = Integer(WHEEL_PAGESCROLL)) or (nDelta > LinesInWi' + + 'ndow) then' + ' nDelta := LinesInWindow;' + ' TopLine := TopLine - (nDelta * nWheelClicks);' + ' Update;' + ' if Assigned(OnScroll) then OnScroll(Self,sbVertical);' + 'end;' + '{$ENDIF}' + '' + '{$IFNDEF SYN_CLX}' + 'procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor);' + 'begin' + ' if (Msg.HitTest = HTCLIENT) and (Msg.CursorWnd = Handle) and' + ' not(csDesigning in ComponentState) then' + ' begin' + ' UpdateMouseCursor;' + ' end' + ' else' + ' inherited;' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.SetTabWidth(Value: Integer);' + 'begin' + ' Value := MinMax(Value, 1, 256);' + ' if (Value <> fTabWidth) then begin' + ' fTabWidth := Value;' + ' TSynEditStringList(Lines).TabWidth := Value;' + ' Invalidate; // to redraw text containing tab chars' + ' if WordWrap then' + ' begin' + ' fWordWrapPlugin.Reset;' + ' InvalidateGutter;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SelectedColorsChanged(Sender: TObject);' + 'begin' + ' InvalidateSelection;' + 'end;' + '' + '// find / replace' + '' + + 'function TCustomSynEdit.SearchReplace(const ASearch, AReplace: U' + + 'nicodeString;' + ' AOptions: TSynSearchOptions): Integer;' + 'var' + + ' ptStart, ptEnd: TBufferCoord; // start and end of the search r' + + 'ange' + ' ptCurrent: TBufferCoord; // current search position' + ' nSearchLen, nReplaceLen, n, nFound: integer;' + ' nInLine: integer;' + ' bBackward, bFromCursor: boolean;' + ' bPrompt: boolean;' + ' bReplace, bReplaceAll: boolean;' + ' bEndUndoBlock: boolean;' + ' nAction: TSynReplaceAction;' + ' iResultOffset: Integer;' + '' + ' function InValidSearchRange(First, Last: Integer): Boolean;' + ' begin' + ' Result := True;' + + ' if (fActiveSelectionMode = smNormal) or not (ssoSelectedOnly' + + ' in AOptions) then' + ' begin' + + ' if ((ptCurrent.Line = ptStart.Line) and (First < ptStart.C' + + 'har)) or' + ' ((ptCurrent.Line = ptEnd.Line) and (Last > ptEnd.Char))' + ' then' + ' Result := False;' + ' end' + ' else' + ' if (fActiveSelectionMode = smColumn) then' + + ' // solves bug in search/replace when smColumn mode active ' + + 'and no selection' + + ' Result := (First >= ptStart.Char) and (Last <= ptEnd.Char)' + + ' or (ptEnd.Char - ptStart.Char < 1);' + ' end;' + '' + 'begin' + ' if not Assigned(fSearchEngine) then' + + ' raise ESynEditError.Create('#39'No search engine has been assign' + + 'ed'#39');' + '' + ' Result := 0;' + ' // can'#39't search for or replace an empty string' + ' if Length(ASearch) = 0 then exit;' + + ' // get the text range to search in, ignore the "Search in sele' + + 'ction only"' + ' // option if nothing is selected' + ' bBackward := (ssoBackwards in AOptions);' + ' bPrompt := (ssoPrompt in AOptions);' + ' bReplace := (ssoReplace in AOptions);' + ' bReplaceAll := (ssoReplaceAll in AOptions);' + ' bFromCursor := not (ssoEntireScope in AOptions);' + ' if not SelAvail then Exclude(AOptions, ssoSelectedOnly);' + ' if (ssoSelectedOnly in AOptions) then begin' + ' ptStart := BlockBegin;' + ' ptEnd := BlockEnd;' + ' // search the whole line in the line selection mode' + ' if (fActiveSelectionMode = smLine) then' + ' begin' + ' ptStart.Char := 1;' + ' ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1;' + ' end' + ' else if (fActiveSelectionMode = smColumn) then' + + ' // make sure the start column is smaller than the end colu' + + 'mn' + ' if (ptStart.Char > ptEnd.Char) then' + ' SwapInt(Integer(ptStart.Char), Integer(ptEnd.Char));' + + ' // ignore the cursor position when searching in the selectio' + + 'n' + ' if bBackward then' + ' ptCurrent := ptEnd' + ' else' + ' ptCurrent := ptStart;' + ' end' + ' else' + ' begin' + ' ptStart.Char := 1;' + ' ptStart.Line := 1;' + ' ptEnd.Line := Lines.Count;' + ' ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1;' + ' if bFromCursor then' + + ' if bBackward then ptEnd := CaretXY else ptStart := CaretXY' + + ';' + + ' if bBackward then ptCurrent := ptEnd else ptCurrent := ptSta' + + 'rt;' + ' end;' + ' // initialize the search engine' + ' fSearchEngine.Options := AOptions;' + ' fSearchEngine.Pattern := ASearch;' + + ' // search while the current search position is inside of the s' + + 'earch range' + ' nReplaceLen := 0;' + ' DoOnPaintTransient(ttBefore);' + ' if bReplaceAll and not bPrompt then' + ' begin' + ' IncPaintLock;' + ' BeginUndoBlock;' + ' bEndUndoBlock := True;' + ' end' + ' else' + ' bEndUndoBlock := False;' + ' try' + + ' while (ptCurrent.Line >= ptStart.Line) and (ptCurrent.Line <' + + '= ptEnd.Line) do' + ' begin' + + ' nInLine := fSearchEngine.FindAll(Lines[ptCurrent.Line - 1]' + + ');' + ' iResultOffset := 0;' + ' if bBackward then' + ' n := Pred(fSearchEngine.ResultCount)' + ' else' + ' n := 0;' + ' // Operate on all results in this line.' + ' while nInLine > 0 do' + ' begin' + + ' // An occurrence may have been replaced with a text of d' + + 'ifferent length' + ' nFound := fSearchEngine.Results[n] + iResultOffset;' + ' nSearchLen := fSearchEngine.Lengths[n];' + ' if bBackward then Dec(n) else Inc(n);' + ' Dec(nInLine);' + ' // Is the search result entirely in the search range?' + + ' if not InValidSearchRange(nFound, nFound + nSearchLen) t' + + 'hen continue;' + ' Inc(Result);' + + ' // Select the text, so the user can see it in the OnRepl' + + 'aceText event' + ' // handler or as the search result.' + '' + ' ptCurrent.Char := nFound;' + ' BlockBegin := ptCurrent;' + + ' // Be sure to use the Ex version of CursorPos so that it' + + ' appears in the middle if necessary' + ' SetCaretXYEx(False, BufferCoord(1, ptCurrent.Line));' + ' EnsureCursorPosVisibleEx(True);' + ' Inc(ptCurrent.Char, nSearchLen);' + ' BlockEnd := ptCurrent;' + ' InternalCaretXY := ptCurrent;' + + ' if bBackward then InternalCaretXY := BlockBegin else Int' + + 'ernalCaretXY := ptCurrent;' + ' // If it'#39's a search only we can leave the procedure now.' + ' if not (bReplace or bReplaceAll) then exit;' + + ' // Prompt and replace or replace all. If user chooses t' + + 'o replace' + ' // all after prompting, turn off prompting.' + ' if bPrompt and Assigned(fOnReplaceText) then' + ' begin' + + ' nAction := DoOnReplaceText(ASearch, AReplace, ptCurren' + + 't.Line, nFound);' + ' if nAction = raCancel then' + ' exit;' + ' end' + ' else' + ' nAction := raReplace;' + ' if nAction <> raSkip then' + ' begin' + + ' // user has been prompted and has requested to silentl' + + 'y replace all' + ' // so turn off prompting' + ' if nAction = raReplaceAll then begin' + ' if not bReplaceAll or bPrompt then' + ' begin' + ' bReplaceAll := True;' + ' IncPaintLock;' + ' end;' + ' bPrompt := False;' + ' if bEndUndoBlock = false then' + ' BeginUndoBlock;' + ' bEndUndoBlock:= true;' + ' end;' + ' // Allow advanced substition in the search engine' + ' SelText := fSearchEngine.Replace(SelText, AReplace);' + ' nReplaceLen := CaretX - nFound;' + ' end;' + ' // fix the caret position and the remaining results' + ' if not bBackward then begin' + ' InternalCaretX := nFound + nReplaceLen;' + + ' if (nSearchLen <> nReplaceLen) and (nAction <> raSkip)' + + ' then' + ' begin' + ' Inc(iResultOffset, nReplaceLen - nSearchLen);' + + ' if (fActiveSelectionMode <> smColumn) and (CaretY = ' + + 'ptEnd.Line) then' + ' begin' + ' Inc(ptEnd.Char, nReplaceLen - nSearchLen);' + ' BlockEnd := ptEnd;' + ' end;' + ' end;' + ' end;' + ' if not bReplaceAll then' + ' exit;' + ' end;' + ' // search next / previous line' + ' if bBackward then' + ' Dec(ptCurrent.Line)' + ' else' + ' Inc(ptCurrent.Line);' + ' end;' + ' finally' + ' if bReplaceAll and not bPrompt then DecPaintLock;' + ' if bEndUndoBlock then EndUndoBlock;' + ' DoOnPaintTransient( ttAfter );' + ' end;' + 'end;' + '' + + 'function TCustomSynEdit.IsPointInSelection(const Value: TBufferC' + + 'oord): boolean;' + 'var' + ' ptBegin, ptEnd: TBufferCoord;' + 'begin' + ' ptBegin := BlockBegin;' + ' ptEnd := BlockEnd;' + + ' if (Value.Line >= ptBegin.Line) and (Value.Line <= ptEnd.Line)' + + ' and' + + ' ((ptBegin.Line <> ptEnd.Line) or (ptBegin.Char <> ptEnd.Char' + + ')) then' + ' begin' + ' if fActiveSelectionMode = smLine then' + ' Result := True' + ' else if (fActiveSelectionMode = smColumn) then' + ' begin' + ' if (ptBegin.Char > ptEnd.Char) then' + + ' Result := (Value.Char >= ptEnd.Char) and (Value.Char < p' + + 'tBegin.Char)' + ' else if (ptBegin.Char < ptEnd.Char) then' + + ' Result := (Value.Char >= ptBegin.Char) and (Value.Char <' + + ' ptEnd.Char)' + ' else' + ' Result := False;' + ' end' + ' else' + + ' Result := ((Value.Line > ptBegin.Line) or (Value.Char >= p' + + 'tBegin.Char)) and' + + ' ((Value.Line < ptEnd.Line) or (Value.Char < ptEnd.Char))' + + ';' + ' end' + ' else' + ' Result := False;' + 'end;' + '' + 'procedure TCustomSynEdit.SetFocus;' + 'begin' + ' if (fFocusList.Count > 0) then' + ' begin' + ' if TWinControl (fFocusList.Last).CanFocus then' + ' TWinControl (fFocusList.Last).SetFocus;' + ' exit;' + ' end;' + ' inherited;' + 'end;' + '' + 'procedure TCustomSynEdit.UpdateMouseCursor;' + '' + '{$IFDEF SYN_CLX}' + ' procedure SetCursor(aCursor: QCursorH);' + ' begin' + ' QWidget_setCursor(Handle, aCursor);' + ' end;' + '{$ENDIF}' + '' + 'var' + ' ptCursor: TPoint;' + ' ptLineCol: TBufferCoord;' + ' iNewCursor: TCursor;' + 'begin' + ' GetCursorPos(ptCursor);' + ' ptCursor := ScreenToClient(ptCursor);' + '{$IFDEF SYN_CLX}' + ' //handle the scrollbars junction in the bottom-right corner' + ' if not PtInRect(ClientRect, ptCursor) then' + ' begin' + ' QWidget_setCursor(Handle, Screen.Cursors[crDefault]);' + ' Exit;' + ' end;' + '{$ENDIF}' + ' if (ptCursor.X < fGutterWidth) then' + ' SetCursor(Screen.Cursors[fGutter.Cursor])' + ' else begin' + + ' ptLineCol := DisplayToBufferPos(PixelsToRowColumn(ptCursor.X' + + ', ptCursor.Y));' + + ' if (eoDragDropEditing in fOptions) and (not MouseCapture) an' + + 'd IsPointInSelection(ptLineCol) then' + ' iNewCursor := crArrow' + ' else' + ' iNewCursor := Cursor;' + ' if Assigned(OnMouseCursor) then' + ' OnMouseCursor(Self, ptLineCol, iNewCursor);' + ' fKbdHandler.ExecuteMouseCursor(Self, ptLineCol, iNewCursor);' + ' SetCursor(Screen.Cursors[iNewCursor]);' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject)' + + ';' + 'begin' + ' InvalidateGutter;' + 'end;' + '' + 'function TCustomSynEdit.GetOptions: TSynEditorOptions;' + 'begin' + ' Result := fOptions;' + 'end;' + '' + 'procedure TCustomSynEdit.SetOptions(Value: TSynEditorOptions);' + 'const' + ' ScrollOptions = [eoDisableScrollArrows,eoHideShowScrollbars,' + ' eoScrollPastEof,eoScrollPastEol];' + 'var' + '{$IFNDEF SYN_CLX}' + ' bSetDrag: Boolean;' + '{$ENDIF}' + ' TmpBool: Boolean;' + ' bUpdateScroll: Boolean;' + ' vTempBlockBegin, vTempBlockEnd : TBufferCoord;' + 'begin' + ' if (Value <> fOptions) then' + ' begin' + '{$IFNDEF SYN_CLX}' + + ' bSetDrag := (eoDropFiles in fOptions) <> (eoDropFiles in Val' + + 'ue);' + '{$ENDIF}' + '' + ' if not (eoScrollPastEol in Options) then' + ' LeftChar := LeftChar;' + ' if not (eoScrollPastEof in Options) then' + ' TopLine := TopLine;' + '' + + ' bUpdateScroll := (Options * ScrollOptions) <> (Value * Scrol' + + 'lOptions);' + '' + ' fOptions := Value;' + '' + + ' // constrain caret position to MaxScrollWidth if eoScrollPas' + + 'tEol is enabled' + ' InternalCaretXY := CaretXY;' + ' if (eoScrollPastEol in Options) then' + ' begin' + ' vTempBlockBegin := BlockBegin;' + ' vTempBlockEnd := BlockEnd;' + ' SetBlockBegin(vTempBlockBegin);' + ' SetBlockEnd(vTempBlockEnd);' + ' end;' + '' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' // (un)register HWND as drop target' + + ' if bSetDrag and not (csDesigning in ComponentState) and Hand' + + 'leAllocated then' + ' DragAcceptFiles(Handle, (eoDropFiles in fOptions));' + '{$ENDIF}' + ' TmpBool := eoShowSpecialChars in Value;' + ' if TmpBool <> fShowSpecChar then' + ' begin' + ' fShowSpecChar := TmpBool;' + ' Invalidate;' + ' end;' + ' if bUpdateScroll then' + ' UpdateScrollBars;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.SizeOrFontChanged(bFont: boolean);' + 'begin' + ' if HandleAllocated and (fCharWidth <> 0) then' + ' begin' + + ' fCharsInWindow := Max(ClientWidth - fGutterWidth - 2, 0) div' + + ' fCharWidth;' + ' fLinesInWindow := ClientHeight div fTextHeight;' + ' if WordWrap then' + ' begin' + ' fWordWrapPlugin.DisplayChanged;' + ' Invalidate;' + ' end;' + ' if bFont then' + ' begin' + ' if Gutter.ShowLineNumbers then' + ' GutterChanged(Self)' + ' else' + ' UpdateScrollbars;' + ' InitializeCaret;' + ' Exclude(fStateFlags, sfCaretChanged);' + ' Invalidate;' + ' end' + ' else' + ' UpdateScrollbars;' + ' Exclude(fStateFlags, sfScrollbarChanged);' + ' if not (eoScrollPastEol in Options) then' + ' LeftChar := LeftChar;' + ' if not (eoScrollPastEof in Options) then' + ' TopLine := TopLine;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.MoveCaretHorz(DX: Integer; SelectionCom' + + 'mand: Boolean);' + 'var' + ' ptO, ptDst: TBufferCoord;' + ' s: UnicodeString;' + ' nLineLen: Integer;' + ' bChangeY: Boolean;' + ' vCaretRowCol: TDisplayCoord;' + 'begin' + ' if WordWrap then' + ' begin' + ' if DX > 0 then' + ' begin' + ' if fCaretAtEOL then' + ' begin' + ' fCaretAtEOL := False;' + ' UpdateLastCaretX;' + ' IncPaintLock;' + ' Include(fStateFlags, sfCaretChanged);' + ' DecPaintLock;' + ' Exit;' + ' end;' + ' end' + ' else' + ' begin // DX < 0. Handle ecLeft/ecPageLeft at BOL.' + + ' if (not fCaretAtEOL) and (CaretX > 1) and (DisplayX = 1) t' + + 'hen' + ' begin' + ' fCaretAtEOL := True;' + ' UpdateLastCaretX;' + ' if DisplayX > CharsInWindow +1 then' + + ' SetInternalDisplayXY( DisplayCoord(CharsInWindow +1, D' + + 'isplayY) )' + ' else begin' + ' IncPaintLock;' + ' Include(fStateFlags, sfCaretChanged);' + ' DecPaintLock;' + ' end;' + ' Exit;' + ' end;' + ' end;' + ' end;' + ' ptO := CaretXY;' + ' ptDst := ptO;' + ' s := LineText;' + ' nLineLen := Length(s);' + ' // only moving or selecting one char can change the line' + ' bChangeY := not (eoScrollPastEol in fOptions);' + + ' if bChangeY and (DX = -1) and (ptO.Char = 1) and (ptO.Line > 1' + + ') then' + ' begin' + ' // end of previous line' + ' Dec(ptDst.Line);' + ' ptDst.Char := Length(Lines[ptDst.Line - 1]) + 1;' + ' end' + + ' else if bChangeY and (DX = 1) and (ptO.Char > nLineLen) and (p' + + 'tO.Line < Lines.Count) then' + ' begin' + ' // start of next line' + ' Inc(ptDst.Line);' + ' ptDst.Char := 1;' + ' end' + ' else begin' + ' ptDst.Char := Max(1, ptDst.Char + DX);' + ' // don'#39't go past last char when ScrollPastEol option not set' + ' if (DX > 0) and bChangeY then' + ' ptDst.Char := Min(ptDst.Char, nLineLen + 1);' + ' end;' + ' // set caret and block begin / end' + ' MoveCaretAndSelection(fBlockBegin, ptDst, SelectionCommand);' + + ' // if caret is beyond CharsInWindow move to next row (this mea' + + 'ns there are' + ' // spaces/tabs at the end of the row)' + ' if WordWrap and (DX > 0) and (CaretX < Length(LineText)) then' + ' begin' + ' vCaretRowCol := DisplayXY;' + + ' if (vCaretRowCol.Column = 1) and (LineToRow(CaretY) <> vCare' + + 'tRowCol.Row) then' + ' begin' + ' fCaretAtEOL := True;' + ' UpdateLastCaretX;' + ' end' + ' else if vCaretRowCol.Column > CharsInWindow +1 then' + ' begin' + ' Inc(vCaretRowCol.Row);' + ' vCaretRowCol.Column := 1;' + ' InternalCaretXY := DisplayToBufferPos(vCaretRowCol);' + ' end;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.MoveCaretVert(DY: Integer; SelectionCom' + + 'mand: Boolean);' + 'var' + ' ptO, ptDst, vEOLTestPos: TDisplayCoord;' + ' vDstLineChar: TBufferCoord;' + ' SaveLastCaretX: Integer;' + 'begin' + ' ptO := DisplayXY;' + ' ptDst := ptO;' + '' + ' Inc(ptDst.Row, DY);' + ' if DY >= 0 then' + ' begin' + ' if RowToLine(ptDst.Row) > Lines.Count then' + ' ptDst.Row := Max(1, DisplayLineCount);' + ' end' + ' else begin' + ' if ptDst.Row < 1 then' + ' ptDst.Row := 1;' + ' end;' + '' + ' if (ptO.Row <> ptDst.Row) then' + ' begin' + ' if eoKeepCaretX in Options then' + ' ptDst.Column := fLastCaretX;' + ' end;' + ' vDstLineChar := DisplayToBufferPos(ptDst);' + ' SaveLastCaretX := fLastCaretX;' + '' + ' // set caret and block begin / end' + ' IncPaintLock;' + + ' MoveCaretAndSelection(fBlockBegin, vDstLineChar, SelectionComm' + + 'and);' + ' if WordWrap then' + ' begin' + ' vEOLTestPos := BufferToDisplayPos(vDstLineChar);' + + ' fCaretAtEOL := (vEOLTestPos.Column = 1) and (vEOLTestPos.Row' + + ' <> ptDst.Row);' + ' end;' + ' DecPaintLock;' + '' + + ' // Restore fLastCaretX after moving caret, since UpdateLastCar' + + 'etX, called by' + + ' // SetCaretXYEx, changes them. This is the one case where we d' + + 'on'#39't want that.' + ' fLastCaretX := SaveLastCaretX;' + 'end;' + '' + + 'procedure TCustomSynEdit.MoveCaretAndSelection(const ptBefore, p' + + 'tAfter: TBufferCoord;' + ' SelectionCommand: Boolean);' + 'begin' + ' if (eoGroupUndo in FOptions) and UndoList.CanUndo then' + ' fUndoList.AddGroupBreak;' + '' + ' IncPaintLock;' + ' if SelectionCommand then' + ' begin' + ' if not SelAvail then' + ' SetBlockBegin(ptBefore);' + ' SetBlockEnd(ptAfter);' + ' end' + ' else' + ' SetBlockBegin(ptAfter);' + ' InternalCaretXY := ptAfter;' + ' DecPaintLock;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetCaretAndSelection(const ptCaret, ptB' + + 'efore,' + ' ptAfter: TBufferCoord);' + 'var' + ' vOldMode: TSynSelectionMode;' + 'begin' + ' vOldMode := fActiveSelectionMode;' + ' IncPaintLock;' + ' try' + ' InternalCaretXY := ptCaret;' + ' SetBlockBegin(ptBefore);' + ' SetBlockEnd(ptAfter);' + ' finally' + ' ActiveSelectionMode := vOldMode;' + ' DecPaintLock;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.RecalcCharExtent;' + 'const' + + ' iFontStyles: array[0..3] of TFontStyles = ([], [fsItalic], [fs' + + 'Bold],' + ' [fsItalic, fsBold]);' + 'var' + ' iHasStyle: array[0..3] of Boolean;' + ' cAttr: Integer;' + ' cStyle: Integer;' + ' iCurr: TFontStyles;' + 'begin' + ' FillChar(iHasStyle, SizeOf(iHasStyle), 0);' + + ' if Assigned(fHighlighter) and (fHighlighter.AttrCount > 0) the' + + 'n begin' + ' for cAttr := 0 to fHighlighter.AttrCount - 1 do' + ' begin' + + ' iCurr := fHighlighter.Attribute[cAttr].Style * [fsItalic, ' + + 'fsBold];' + ' for cStyle := 0 to 3 do' + ' if iCurr = iFontStyles[cStyle] then' + ' begin' + ' iHasStyle[cStyle] := True;' + ' break;' + ' end;' + ' end;' + ' end' + ' else begin' + ' iCurr := Font.Style * [fsItalic, fsBold];' + ' for cStyle := 0 to 3 do' + ' if iCurr = iFontStyles[cStyle] then' + ' begin' + ' iHasStyle[cStyle] := True;' + ' break;' + ' end;' + ' end;' + '' + ' fTextHeight := 0;' + ' fCharWidth := 0;' + ' fTextDrawer.BaseFont := Self.Font;' + ' for cStyle := 0 to 3 do' + ' if iHasStyle[cStyle] then' + ' begin' + ' fTextDrawer.BaseStyle := iFontStyles[cStyle];' + ' fTextHeight := Max(fTextHeight, fTextDrawer.CharHeight);' + ' fCharWidth := Max(fCharWidth, fTextDrawer.CharWidth);' + ' end;' + ' Inc(fTextHeight, fExtraLineSpacing);' + 'end;' + '' + + 'procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject)' + + ';' + 'begin' + ' RecalcCharExtent;' + ' if Sender is TSynCustomHighlighter then' + ' begin' + ' Lines.BeginUpdate;' + ' try' + ' ScanRanges;' + ' finally' + ' Lines.EndUpdate;' + ' end;' + ' end' + ' else' + ' Invalidate;' + ' SizeOrFontChanged(True);' + 'end;' + '' + + 'procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChang' + + 'es);' + 'begin' + ' fStatusChanges := fStatusChanges + AChanges;' + ' if PaintLock = 0 then' + ' DoOnStatusChange(fStatusChanges);' + 'end;' + '' + + 'procedure TCustomSynEdit.DoCaseChange(const Cmd: TSynEditorComma' + + 'nd);' + '' + ' function ToggleCase(const aStr: UnicodeString): UnicodeString;' + ' var' + ' i: Integer;' + ' sLower: UnicodeString;' + ' begin' + ' Result := SynWideUpperCase(aStr);' + ' sLower := SynWideLowerCase(aStr);' + ' for i := 1 to Length(aStr) do' + ' begin' + ' if Result[i] = aStr[i] then' + ' Result[i] := sLower[i];' + ' end;' + ' end;' + '' + 'var' + ' w: UnicodeString;' + ' oldCaret, oldBlockBegin, oldBlockEnd: TBufferCoord;' + ' bHadSel : Boolean;' + 'begin' + ' Assert((Cmd >= ecUpperCase) and (Cmd <= ecToggleCaseBlock));' + ' if SelAvail then' + ' begin' + ' bHadSel := True;' + ' oldBlockBegin := BlockBegin;' + ' oldBlockEnd := BlockEnd;' + ' end' + ' else begin' + ' bHadSel := False;' + ' end;' + ' oldCaret := CaretXY;' + ' try' + ' if Cmd < ecUpperCaseBlock then' + ' begin' + ' { word commands }' + ' SetSelWord;' + ' if SelText = '#39#39' then' + ' begin' + ' { searches a previous word }' + ' InternalCaretXY := PrevWordPos;' + ' SetSelWord;' + ' if SelText = '#39#39' then' + ' begin' + + ' { try once more since PrevWordPos may have failed last' + + ' time.' + + ' (PrevWordPos "points" to the end of the previous line ' + + 'instead of the' + + ' beggining of the previous word if invoked (e.g.) when ' + + 'CaretX = 1) }' + ' InternalCaretXY := PrevWordPos;' + ' SetSelWord;' + ' end;' + ' end;' + ' end' + ' else begin' + ' { block commands }' + ' if not SelAvail then' + ' begin' + ' if CaretX <= Length(LineText) then' + ' MoveCaretHorz(1, True)' + ' else if CaretY < Lines.Count then' + ' InternalCaretXY := BufferCoord(1, CaretY +1);' + ' end;' + ' end;' + '' + ' w := SelText;' + ' if w <> '#39#39' then' + ' begin' + ' case Cmd of' + ' ecUpperCase, ecUpperCaseBlock:' + ' w := SynWideUpperCase(w);' + ' ecLowerCase, ecLowerCaseBlock:' + ' w := SynWideLowerCase(w);' + ' ecToggleCase, ecToggleCaseBlock:' + ' w := ToggleCase(w);' + ' ecTitleCase:' + + ' w := SynWideUpperCase(w[1]) + SynWideLowerCase(Copy(w,' + + ' 2, Length(w)));' + ' end;' + ' BeginUndoBlock;' + ' try' + ' if bHadSel then' + + ' fUndoList.AddChange(crSelection, oldBlockBegin, oldBlo' + + 'ckEnd, '#39#39', fActiveSelectionMode)' + ' else' + + ' fUndoList.AddChange(crSelection, oldCaret, oldCaret, '#39 + + #39', fActiveSelectionMode);' + + ' fUndoList.AddChange(crCaret, oldCaret, oldCaret, '#39#39', fAc' + + 'tiveSelectionMode);' + ' SelText := w;' + ' finally' + ' EndUndoBlock;' + ' end;' + ' end;' + ' finally' + ' { "word" commands do not restore Selection }' + ' if bHadSel and (Cmd >= ecUpperCaseBlock) then' + ' begin' + ' BlockBegin := oldBlockBegin;' + ' BlockEnd := oldBlockEnd;' + ' end;' + ' { "block" commands with empty Selection move the Caret }' + ' if bHadSel or (Cmd < ecUpperCaseBlock) then' + ' CaretXY := oldCaret;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.DoTabKey;' + 'var' + ' StartOfBlock: TBufferCoord;' + ' i, MinLen, iLine: integer;' + ' PrevLine, Spaces: UnicodeString;' + ' p: PWideChar;' + ' NewCaretX: integer;' + ' ChangeScroll: Boolean;' + ' nPhysX, nDistanceToTab, nSpacesToNextTabStop : Integer;' + ' OldSelTabLine, vIgnoreSmartTabs: Boolean;' + 'begin' + ' // Provide Visual Studio like block indenting' + ' OldSelTabLine := SelTabLine;' + + ' if (eoTabIndent in Options) and ((SelTabBlock) or (OldSelTabLi' + + 'ne)) then' + ' begin' + ' DoBlockIndent;' + ' if OldSelTabLine then' + ' begin' + ' if fBlockBegin.Char < fBlockEnd.Char then' + ' FBlockBegin.Char := 1' + ' else' + ' fBlockEnd.Char := 1;' + ' end;' + ' exit;' + ' end;' + ' i := 0;' + ' iLine := 0;' + ' MinLen := 0;' + ' vIgnoreSmartTabs := False;' + ' if eoSmartTabs in fOptions then' + ' begin' + ' iLine := CaretY - 1;' + ' if (iLine > 0) and (iLine < Lines.Count) then' + ' begin' + ' Dec(iLine);' + ' repeat' + ' //todo: rethink it' + ' MinLen := DisplayToBufferPos(DisplayCoord(' + + ' BufferToDisplayPos(CaretXY).Column, LineToRow(iLine + ' + + '1))).Char;' + ' PrevLine := Lines[iLine];' + ' if (Length(PrevLine) >= MinLen) then begin' + ' p := @PrevLine[MinLen];' + ' // scan over non-whitespaces' + ' repeat' + ' if (p^ = #9) or (p^ = #32) then break;' + ' Inc(i);' + ' Inc(p);' + ' until p^ = #0;' + ' // scan over whitespaces' + ' if p^ <> #0 then' + ' repeat' + ' if (p^ <> #9) and (p^ <> #32) then break;' + ' Inc(i);' + ' Inc(p);' + ' until p^ = #0;' + ' break;' + ' end;' + ' Dec(iLine);' + ' until iLine < 0;' + ' end' + ' else' + ' vIgnoreSmartTabs := True;' + ' end;' + ' fUndoList.BeginBlock;' + ' try' + ' if SelAvail then' + ' begin' + + ' fUndoList.AddChange(crDelete, fBlockBegin, fBlockEnd, SelT' + + 'ext,' + ' fActiveSelectionMode);' + ' SetSelTextPrimitive('#39#39');' + ' end;' + ' StartOfBlock := CaretXY;' + '' + ' if i = 0 then' + ' begin' + ' if (eoTabsToSpaces in fOptions) then' + ' begin' + ' i := TabWidth - (StartOfBlock.Char - 1) mod TabWidth;' + ' if i = 0 then' + ' i := TabWidth;' + ' end' + ' else' + ' i := TabWidth;' + ' end;' + '' + ' if eoTabsToSpaces in fOptions then' + ' begin' + ' Spaces := UnicodeStringOfChar(#32, i);' + ' NewCaretX := StartOfBlock.Char + i;' + ' end' + + ' else if (eoTrimTrailingSpaces in Options) and (StartOfBlock.' + + 'Char > Length(LineText)) then' + ' begin' + ' // work-around for trimming Tabs' + ' nPhysX := BufferToDisplayPos(CaretXY).Column;' + + ' if (eoSmartTabs in fOptions) and not vIgnoreSmartTabs and ' + + '(iLine > -1) then' + ' begin' + + ' i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ' + + ').Column;' + ' nDistanceToTab := i - nPhysX;' + ' end' + ' else' + + ' nDistanceToTab := TabWidth - ((nPhysX - 1) mod TabWidth)' + + ';' + ' NewCaretX := StartOfBlock.Char + nDistanceToTab;' + ' end' + ' else begin' + + ' if (eoSmartTabs in fOptions) and not vIgnoreSmartTabs and ' + + '(iLine > -1) then' + ' begin' + + ' Spaces := Copy(fLines[CaretXY.Line - 1], 1, CaretXY.Char' + + ' - 1);' + ' while Pos(#9, Spaces) > 0 do' + ' Delete(Spaces, Pos(#9, Spaces), 1);' + ' Spaces := WideTrim(Spaces);' + '' + + ' //smart tabs are only in the front of the line *NOT IN T' + + 'HE MIDDLE*' + ' if Spaces = '#39#39' then' + ' begin' + + ' i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1' + + ') ).Column;' + '' + ' nPhysX := DisplayX;' + ' nDistanceToTab := i - nPhysX;' + + ' nSpacesToNextTabStop := TabWidth - ((nPhysX - 1) mod T' + + 'abWidth);' + ' if nSpacesToNextTabStop <= nDistanceToTab then begin' + ' Spaces := #9;' + ' Dec(nDistanceToTab, nSpacesToNextTabStop);' + ' end;' + ' while nDistanceToTab >= TabWidth do begin' + ' Spaces := Spaces + #9;' + ' Dec(nDistanceToTab, TabWidth);' + ' end;' + ' if nDistanceToTab > 0 then' + + ' Spaces := Spaces + UnicodeStringOfChar(#32, nDistanc' + + 'eToTab);' + ' end else' + ' Spaces := #9;' + ' end' + ' else begin' + ' Spaces := #9;' + ' end;' + + ' if (eoTrimTrailingSpaces in Options) and (Length(TrimTrail' + + 'ingSpaces(LineText)) = 0) then' + + ' NewCaretX := StartOfBlock.Char + GetExpandedLength(Space' + + 's, TabWidth)' + ' else' + ' NewCaretX := StartOfBlock.Char + Length(Spaces);' + ' end;' + '' + ' SetSelTextPrimitive(Spaces);' + + ' // Undo is already handled in SetSelText when SelectionMode ' + + 'is Column' + ' if fActiveSelectionMode <> smColumn then' + ' begin' + + ' fUndoList.AddChange(crInsert, StartOfBlock, CaretXY, SelTe' + + 'xt,' + ' fActiveSelectionMode);' + ' end;' + ' finally' + ' fUndoList.EndBlock;' + ' end;' + '' + ' ChangeScroll := not(eoScrollPastEol in fOptions);' + ' try' + ' Include(fOptions, eoScrollPastEol);' + ' InternalCaretX := NewCaretX;' + ' finally' + ' if ChangeScroll then' + ' Exclude(fOptions, eoScrollPastEol);' + ' end;' + '' + ' EnsureCursorPosVisible;' + 'end;' + '' + 'procedure TCustomSynEdit.DoShiftTabKey;' + '// shift-tab key handling' + 'var' + ' NewX: Integer;' + ' Line: UnicodeString;' + ' LineLen: Integer;' + ' DestX: Integer;' + '' + ' MaxLen, iLine: Integer;' + ' PrevLine, OldSelText: UnicodeString;' + ' p: PWideChar;' + ' OldCaretXY: TBufferCoord;' + ' ChangeScroll: Boolean;' + 'begin' + ' // Provide Visual Studio like block indenting' + + ' if (eoTabIndent in Options) and ((SelTabBlock) or (SelTabLine)' + + ') then' + ' begin' + ' DoBlockUnIndent;' + ' exit;' + ' end;' + '' + ' NewX := CaretX;' + '' + ' if (NewX <> 1) and (eoSmartTabs in fOptions) then' + ' begin' + ' iLine := CaretY - 1;' + ' if (iLine > 0) and (iLine < Lines.Count) then' + ' begin' + ' Dec(iLine);' + ' MaxLen := CaretX - 1;' + ' repeat' + ' PrevLine := Lines[iLine];' + ' if (Length(PrevLine) >= MaxLen) then' + ' begin' + ' p := @PrevLine[MaxLen];' + ' // scan over whitespaces' + ' repeat' + ' if p^ <> #32 then break;' + ' Dec(NewX);' + ' Dec(p);' + ' until NewX = 1;' + ' // scan over non-whitespaces' + ' if NewX <> 1 then' + ' repeat' + ' if p^ = #32 then break;' + ' Dec(NewX);' + ' Dec(p);' + ' until NewX = 1;' + ' break;' + ' end;' + ' Dec(iLine);' + ' until iLine < 0;' + ' end;' + ' end;' + '' + ' if NewX = CaretX then' + ' begin' + ' Line := LineText;' + ' LineLen := Length(Line);' + '' + ' // find real un-tab position' + '' + ' DestX := ((CaretX - 2) div TabWidth) * TabWidth + 1;' + ' if NewX > LineLen then' + ' NewX := DestX' + ' else if (NewX > DestX) and (Line[NewX - 1] = #9) then' + ' dec(NewX)' + ' else begin' + + ' while (NewX > DestX) and ((NewX - 1 > LineLen) or (Line[Ne' + + 'wX - 1] = #32)) do' + ' dec(NewX);' + ' end;' + ' end;' + '' + ' // perform un-tab' + ' if (NewX <> CaretX) then' + ' begin' + ' SetBlockBegin(BufferCoord(NewX, CaretY));' + ' SetBlockEnd(CaretXY);' + ' OldCaretXY := CaretXY;' + '' + ' OldSelText := SelText;' + ' SetSelTextPrimitive('#39#39');' + '' + + ' fUndoList.AddChange(crSilentDelete, BufferCoord(NewX, CaretY' + + '),' + ' OldCaretXY, OldSelText, smNormal);' + '' + ' // KV' + ' ChangeScroll := not(eoScrollPastEol in fOptions);' + ' try' + ' Include(fOptions, eoScrollPastEol);' + ' InternalCaretX := NewX;' + ' finally' + ' if ChangeScroll then' + ' Exclude(fOptions, eoScrollPastEol);' + ' end;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.DoHomeKey(Selection: Boolean);' + '' + ' function LastCharInRow: Integer;' + ' var' + ' vPos: TDisplayCoord;' + ' begin' + ' if fLines.Count = 0 then' + ' Result := 1' + ' else' + ' begin' + ' vPos := DisplayXY;' + + ' vPos.Column := Min(CharsInWindow, fWordWrapPlugin.GetRowLe' + + 'ngth(vPos.Row) + 1);' + ' Result := DisplayToBufferPos(vPos).Char;' + ' end;' + ' end;' + '' + 'var' + ' newX: Integer;' + ' first_nonblank: Integer;' + ' s: UnicodeString;' + ' vNewPos: TDisplayCoord;' + ' vMaxX: Integer;' + 'begin' + ' // home key enhancement' + + ' if (eoEnhanceHomeKey in fOptions) and (LineToRow(CaretY) = Dis' + + 'playY) then' + ' begin' + ' s := fLines[CaretXY.Line - 1];' + '' + ' first_nonblank := 1;' + ' if WordWrap then' + ' vMaxX := LastCharInRow() -1' + ' else' + ' vMaxX := Length(s);' + ' while (first_nonblank <= vMaxX) and' + ' CharInSet(s[first_nonblank], [#32, #9])' + ' do' + ' inc(first_nonblank);' + ' dec(first_nonblank);' + '' + ' newX := CaretXY.Char - 1;' + '' + ' if (newX > first_nonblank) or (newX = 0) then' + ' newX := first_nonblank + 1' + ' else' + ' newX := 1;' + ' end' + ' else' + ' newX := 1;' + '' + ' if WordWrap then' + ' begin' + ' vNewPos.Row := DisplayY;' + + ' vNewPos.Column := BufferToDisplayPos(BufferCoord(newX, Caret' + + 'Y)).Column;' + + ' MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewPos), ' + + 'Selection);' + ' end' + ' else' + + ' MoveCaretAndSelection(CaretXY, BufferCoord(newX, CaretY), Se' + + 'lection);' + 'end;' + '' + 'procedure TCustomSynEdit.DoEndKey(Selection: Boolean);' + '' + ' function CaretInLastRow: Boolean;' + ' var' + ' vLastRow: Integer;' + ' begin' + ' if not WordWrap then' + ' Result := True' + ' else' + ' begin' + ' vLastRow := LineToRow(CaretY + 1) - 1;' + + ' // This check allows good behaviour with empty rows (this ' + + 'can be useful in a diff app ;-)' + ' while (vLastRow > 1)' + ' and (fWordWrapPlugin.GetRowLength(vLastRow) = 0)' + ' and (RowToLine(vLastRow) = CaretY) do' + ' begin' + ' Dec(vLastRow);' + ' end;' + ' Result := DisplayY = vLastRow;' + ' end;' + ' end;' + '' + ' function FirstCharInRow: Integer;' + ' var' + ' vPos: TDisplayCoord;' + ' begin' + ' vPos.Row := DisplayY;' + ' vPos.Column := 1;' + ' Result := DisplayToBufferPos(vPos).Char;' + ' end;' + '' + 'var' + ' vText: UnicodeString;' + ' vLastNonBlank: Integer;' + ' vNewX: Integer;' + ' vNewCaret: TDisplayCoord;' + ' vMinX: Integer;' + ' vEnhance: Boolean;' + 'begin' + ' if (eoEnhanceEndKey in fOptions) and CaretInLastRow then' + ' begin' + ' vEnhance := True;' + ' vText := LineText;' + ' vLastNonBlank := Length(vText);' + ' if WordWrap then' + ' vMinX := FirstCharInRow() - 1' + ' else' + ' vMinX := 0;' + + ' while (vLastNonBlank > vMinX) and CharInSet(vText[vLastNonBl' + + 'ank], [#32, #9]) do' + ' Dec(vLastNonBlank);' + '' + ' vNewX := CaretX - 1;' + ' if vNewX = vLastNonBlank then' + ' vNewX := Length(LineText) + 1' + ' else' + ' vNewX := vLastNonBlank + 1;' + ' end' + ' else' + ' begin' + ' vNewX := Length(LineText) + 1;' + ' vEnhance := False;' + ' end;' + '' + ' if WordWrap then' + ' begin' + ' vNewCaret.Row := DisplayY;' + ' if vEnhance then' + + ' vNewCaret.Column := BufferToDisplayPos(BufferCoord(vNewX, ' + + 'CaretY)).Column' + ' else' + + ' vNewCaret.Column := fWordWrapPlugin.GetRowLength(vNewCaret' + + '.Row) + 1;' + + ' vNewCaret.Column := Min(CharsInWindow + 1, vNewCaret.Column)' + + ';' + + ' MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewCaret)' + + ', Selection);' + ' // Updates fCaretAtEOL flag.' + ' SetInternalDisplayXY(vNewCaret);' + ' end' + ' else' + ' MoveCaretAndSelection(CaretXY,' + ' BufferCoord(vNewX, CaretY), Selection);' + 'end;' + '' + '{$IFNDEF SYN_CLX}' + 'procedure TCustomSynEdit.CreateWnd;' + 'begin' + ' inherited;' + '' + '{$IFNDEF UNICODE}' + ' if not (csDesigning in ComponentState) then' + ' begin' + ' // "redefine" window-procedure to get Unicode messages' + ' if Win32PlatformIsUnicode then' + + ' SetWindowLongW(Handle, GWL_WNDPROC, Integer(GetWindowLongA' + + '(Handle, GWL_WNDPROC)));' + ' end;' + '{$ENDIF}' + '' + + ' if (eoDropFiles in fOptions) and not (csDesigning in Component' + + 'State) then' + ' DragAcceptFiles(Handle, True);' + '' + ' UpdateScrollBars;' + 'end;' + '' + 'procedure TCustomSynEdit.DestroyWnd;' + 'begin' + + ' if (eoDropFiles in fOptions) and not (csDesigning in Component' + + 'State) then' + ' DragAcceptFiles(Handle, False);' + '' + '{$IFNDEF UNICODE}' + ' if not (csDesigning in ComponentState) then' + ' begin' + ' // restore window-procedure to what VCL expects' + ' if Win32PlatformIsUnicode then' + + ' SetWindowLongA(Handle, GWL_WNDPROC, Integer(GetWindowLongW' + + '(Handle, GWL_WNDPROC)));' + ' end;' + '{$ENDIF}' + '' + '{$IFDEF UNICODE}' + + ' // assign WindowText here, otherwise the VCL will call GetText' + + ' twice' + ' if WindowText = nil then' + ' WindowText := Lines.GetText;' + '{$ENDIF}' + ' inherited;' + 'end;' + '' + + 'procedure TCustomSynEdit.InvalidateRect(const aRect: TRect; aEra' + + 'se: Boolean);' + 'begin' + ' Windows.InvalidateRect(Handle, @aRect, aErase);' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.DoBlockIndent;' + 'var' + ' OrgCaretPos: TBufferCoord;' + ' BB, BE: TBufferCoord;' + ' Run, StrToInsert: PWideChar;' + ' e, x, i, InsertStrLen: Integer;' + ' Spaces: UnicodeString;' + ' OrgSelectionMode: TSynSelectionMode;' + ' InsertionPos: TBufferCoord;' + 'begin' + ' OrgSelectionMode := fActiveSelectionMode;' + ' OrgCaretPos := CaretXY;' + '' + ' StrToInsert := nil;' + ' if SelAvail then' + ' try' + ' // keep current selection detail' + ' BB := BlockBegin;' + ' BE := BlockEnd;' + '' + ' // build text to insert' + ' if (BE.Char = 1) then' + ' begin' + ' e := BE.Line - 1;' + ' x := 1;' + ' end' + ' else begin' + ' e := BE.Line;' + ' if eoTabsToSpaces in Options then' + ' x := CaretX + FTabWidth' + ' else x := CaretX + 1;' + ' end;' + ' if (eoTabsToSpaces in Options) then' + ' begin' + + ' InsertStrLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidt' + + 'h + 1;' + + ' // chars per line * lines-1 + last line +' + + ' null char' + ' StrToInsert := WStrAlloc(InsertStrLen);' + ' Run := StrToInsert;' + ' Spaces := UnicodeStringOfChar(#32, FTabWidth);' + ' end' + ' else begin' + ' InsertStrLen:= 3 * (e - BB.Line) + 2;' + + ' // #9#13#10 * lines-1 + (last line'#39's #9 + null cha' + + 'r)' + ' StrToInsert := WStrAlloc(InsertStrLen);' + ' Run := StrToInsert;' + ' Spaces := #9;' + ' end;' + ' for i := BB.Line to e-1 do' + ' begin' + ' WStrCopy(Run, PWideChar(Spaces + #13#10));' + ' Inc(Run, Length(spaces) + 2);' + ' end;' + ' WStrCopy(Run, PWideChar(Spaces));' + '' + ' fUndoList.BeginBlock;' + ' try' + ' InsertionPos.Line := BB.Line;' + ' if fActiveSelectionMode = smColumn then' + ' InsertionPos.Char := Min(BB.Char, BE.Char)' + ' else' + ' InsertionPos.Char := 1;' + + ' InsertBlock(InsertionPos, InsertionPos, StrToInsert, True)' + + ';' + ' fUndoList.AddChange(crIndent, BB, BE, '#39#39', smColumn);' + ' //We need to save the position of the end block for redo' + ' fUndoList.AddChange(crIndent,' + ' BufferCoord(BB.Char + length(Spaces), BB.Line),' + ' BufferCoord(BE.Char + length(Spaces), BE.Line),' + ' '#39#39', smColumn);' + ' finally' + ' fUndoList.EndBlock;' + ' end;' + '' + ' //adjust the x position of orgcaretpos appropriately' + ' OrgCaretPos.Char := X;' + ' finally' + ' if BE.Char > 1 then' + ' Inc(BE.Char, Length(Spaces));' + ' WStrDispose(StrToInsert);' + ' SetCaretAndSelection(OrgCaretPos,' + ' BufferCoord(BB.Char + Length(Spaces), BB.Line), BE);' + ' ActiveSelectionMode := OrgSelectionMode;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.DoBlockUnindent;' + 'var' + ' OrgCaretPos,' + ' BB, BE: TBufferCoord;' + ' Line, Run,' + ' FullStrToDelete,' + ' StrToDelete: PWideChar;' + + ' Len, x, StrToDeleteLen, i, TmpDelLen, FirstIndent, LastIndent,' + + ' e: Integer;' + ' TempString: UnicodeString;' + ' OrgSelectionMode: TSynSelectionMode;' + ' SomethingToDelete: Boolean;' + '' + ' function GetDelLen: Integer;' + ' var' + ' Run: PWideChar;' + ' begin' + ' Result := 0;' + ' Run := Line;' + ' //Take care of tab character' + ' if Run[0] = #9 then' + ' begin' + ' Result := 1;' + ' SomethingToDelete := True;' + ' exit;' + ' end;' + + ' //Deal with compound tabwidths Sometimes they have TabChars' + + ' after a few' + + ' //spaces, yet we need to delete the whole tab width even tho' + + 'ugh the char' + ' //count might not be FTabWidth because of the TabChar' + ' while (Run[0] = #32) and (Result < FTabWidth) do' + ' begin' + ' Inc(Result);' + ' Inc(Run);' + ' SomethingToDelete := True;' + ' end;' + ' if (Run[0] = #9) and (Result < FTabWidth) then' + ' Inc(Result);' + ' end;' + '' + 'begin' + ' OrgSelectionMode := fActiveSelectionMode;' + ' Len := 0;' + ' LastIndent := 0;' + ' if SelAvail then' + ' begin' + ' // store current selection detail' + ' BB := BlockBegin;' + ' BE := BlockEnd;' + ' OrgCaretPos := CaretXY;' + ' x := fCaretX;' + '' + ' // convert selection to complete lines' + ' if BE.Char = 1 then' + ' e := BE.Line - 1' + ' else' + ' e := BE.Line;' + '' + ' // build string to delete' + + ' StrToDeleteLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidt' + + 'h + 1;' + + ' // chars per line * lines-1 + last line + ' + + 'null char' + ' StrToDelete := WStrAlloc(StrToDeleteLen);' + ' StrToDelete[0] := #0;' + ' SomethingToDelete := False;' + ' for i := BB.Line to e-1 do' + ' begin' + ' Line := PWideChar(Lines[i - 1]);' + ' //'#39'Line'#39' is 0-based, '#39'BB.x'#39' is 1-based, so the '#39'-1'#39 + + ' //And must not increment '#39'Line'#39' pointer by more than its ' + + #39'Length'#39 + ' if fActiveSelectionMode = smColumn then' + + ' Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length' + + '(Lines[i - 1])]));' + + ' //Instead of doing a UnicodeStringOfChar, we need to get ' + + '*exactly* what was' + ' //being deleted incase there is a TabChar' + ' TmpDelLen := GetDelLen;' + + ' WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen)))' + + ';' + ' WStrCat(StrToDelete, PWideChar(UnicodeString(#13#10)));' + ' if (fCaretY = i) and (x <> 1) then' + ' x := x - TmpDelLen;' + ' end;' + ' Line := PWideChar(Lines[e - 1]);' + ' if fActiveSelectionMode = smColumn then' + + ' Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Li' + + 'nes[e - 1])]));' + ' TmpDelLen := GetDelLen;' + ' WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen)));' + ' if (fCaretY = e) and (x <> 1) then' + ' x := x - TmpDelLen;' + '' + ' FirstIndent := -1;' + ' FullStrToDelete := nil;' + ' // Delete string' + ' if SomethingToDelete then' + ' begin' + ' FullStrToDelete := StrToDelete;' + ' InternalCaretY := BB.Line;' + ' if fActiveSelectionMode <> smColumn then' + ' i := 1' + ' else' + ' i := Min(BB.Char, BE.Char);' + ' repeat' + ' Run := GetEOL(StrToDelete);' + ' if Run <> StrToDelete then' + ' begin' + ' Len := Run - StrToDelete;' + ' if FirstIndent = -1 then' + ' FirstIndent := Len;' + ' if Len > 0 then' + ' begin' + ' TempString := Lines[CaretY - 1];' + ' Delete(TempString, i, Len);' + ' Lines[CaretY - 1] := TempString;' + ' end;' + ' end;' + ' if Run^ = #13 then' + ' begin' + ' Inc(Run);' + ' if Run^ = #10 then' + ' Inc(Run);' + ' Inc(fCaretY);' + ' end;' + ' StrToDelete := Run;' + ' until Run^ = #0;' + ' LastIndent := Len;' + + ' fUndoList.AddChange(crUnindent, BB, BE, FullStrToDelete, f' + + 'ActiveSelectionMode);' + ' end;' + ' // restore selection' + ' if FirstIndent = -1 then' + ' FirstIndent := 0;' + ' //adjust the x position of orgcaretpos appropriately' + ' if fActiveSelectionMode = smColumn then' + ' SetCaretAndSelection(OrgCaretPos, BB, BE)' + ' else' + ' begin' + ' OrgCaretPos.Char := X;' + ' Dec(BB.Char, FirstIndent);' + ' Dec(BE.Char, LastIndent);' + ' SetCaretAndSelection(OrgCaretPos, BB, BE);' + ' end;' + ' ActiveSelectionMode := OrgSelectionMode;' + ' if FullStrToDelete <> nil then' + ' WStrDispose(FullStrToDelete)' + ' else' + ' WStrDispose(StrToDelete);' + ' end;' + 'end;' + '' + '{$IFDEF SYN_COMPILER_4_UP}' + + 'function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boo' + + 'lean;' + 'begin' + ' if Action is TEditAction then' + ' begin' + ' Result := Focused;' + ' if Result then' + ' begin' + ' if Action is TEditCut then' + ' CommandProcessor(ecCut, '#39' '#39', nil)' + ' else if Action is TEditCopy then' + ' CommandProcessor(ecCopy, '#39' '#39', nil)' + ' else if Action is TEditPaste then' + ' CommandProcessor(ecPaste, '#39' '#39', nil)' + '{$IFDEF SYN_COMPILER_5_UP}' + ' else if Action is TEditDelete then' + ' begin' + ' if SelAvail then' + ' ClearSelection' + ' else' + ' CommandProcessor(ecDeleteChar, '#39' '#39', nil)' + ' end' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' else if Action is TEditUndo then' + ' CommandProcessor(ecUndo, '#39' '#39', nil)' + '{$ENDIF}' + ' else if Action is TEditSelectAll then' + ' CommandProcessor(ecSelectAll, '#39' '#39', nil);' + '{$ENDIF}' + ' end' + ' end' + '{$IFDEF SYN_COMPILER_6_UP}' + ' else if Action is TSearchAction then' + ' begin' + ' Result := Focused;' + ' if Action is TSearchFindFirst then' + ' DoSearchFindFirstExecute(TSearchFindFirst(Action))' + ' else if Action is TSearchFind then' + ' DoSearchFindExecute(TSearchFind(Action))' + ' else if Action is TSearchReplace then' + ' DoSearchReplaceExecute(TSearchReplace(Action));' + ' end' + ' else if Action is TSearchFindNext then' + ' begin' + ' Result := Focused;' + ' DoSearchFindNextExecute(TSearchFindNext(Action))' + ' end' + '{$ENDIF}' + ' else' + ' Result := inherited ExecuteAction(Action);' + 'end;' + '' + + 'function TCustomSynEdit.UpdateAction(Action: TBasicAction): Bool' + + 'ean;' + 'begin' + ' if Action is TEditAction then' + ' begin' + ' Result := Focused;' + ' if Result then' + ' begin' + ' if Action is TEditCut then' + ' TEditAction(Action).Enabled := SelAvail and not ReadOnly' + ' else if Action is TEditCopy then' + ' TEditAction(Action).Enabled := SelAvail' + ' else if Action is TEditPaste then' + ' TEditAction(Action).Enabled := CanPaste' + '{$IFDEF SYN_COMPILER_5_UP}' + ' else if Action is TEditDelete then' + ' TEditAction(Action).Enabled := not ReadOnly' + '{$IFDEF SYN_CLX}' + '{$ELSE}' + ' else if Action is TEditUndo then' + ' TEditAction(Action).Enabled := CanUndo' + '{$ENDIF}' + ' else if Action is TEditSelectAll then' + ' TEditAction(Action).Enabled := True;' + '{$ENDIF}' + ' end;' + '{$IFDEF SYN_COMPILER_6_UP}' + ' end else if Action is TSearchAction then' + ' begin' + ' Result := Focused;' + ' if Result then' + ' begin' + ' if Action is TSearchFindFirst then' + + ' TSearchAction(Action).Enabled := (Text<>'#39#39') and assigned' + + '(fSearchEngine)' + ' else if Action is TSearchFind then' + + ' TSearchAction(Action).Enabled := (Text<>'#39#39') and assigned' + + '(fSearchEngine)' + ' else if Action is TSearchReplace then' + + ' TSearchAction(Action).Enabled := (Text<>'#39#39') and assigned' + + '(fSearchEngine);' + ' end;' + ' end else if Action is TSearchFindNext then' + ' begin' + ' Result := Focused;' + ' if Result then' + ' TSearchAction(Action).Enabled := (Text<>'#39#39')' + ' and (TSearchFindNext(Action).SearchFind <> nil)' + + ' and (TSearchFindNext(Action).SearchFind.Dialog.FindText ' + + '<> '#39#39');' + '{$ENDIF}' + ' end' + ' else' + ' Result := inherited UpdateAction(Action);' + 'end;' + '{$ENDIF}' + '' + 'procedure TCustomSynEdit.SetModified(Value: Boolean);' + 'begin' + ' if Value <> fModified then begin' + ' fModified := Value;' + + ' if (eoGroupUndo in Options) and (not Value) and UndoList.Can' + + 'Undo then' + ' UndoList.AddGroupBreak;' + ' UndoList.InitialState := not Value;' + ' StatusChanged([scModified]);' + ' end;' + 'end;' + '' + + 'function TCustomSynEdit.DoOnSpecialLineColors(Line: Integer; var' + + ' Foreground,' + ' Background: TColor): Boolean;' + 'begin' + ' Result := False;' + ' if Assigned(fOnSpecialLineColors) then' + + ' fOnSpecialLineColors(Self, Line, Result, Foreground, Backgro' + + 'und);' + 'end;' + '' + 'procedure TCustomSynEdit.InvalidateLine(Line: Integer);' + 'var' + ' rcInval: TRect;' + 'begin' + + ' if (not HandleAllocated) or (Line < 1) or (Line > Lines.Count)' + + ' or (not Visible) then' + ' Exit;' + '' + ' if WordWrap then' + ' begin' + ' InvalidateLines(Line, Line);' + ' Exit;' + ' end;' + '' + + ' if (Line >= TopLine) and (Line <= TopLine + LinesInWindow) the' + + 'n' + ' begin' + ' // invalidate text area of this line' + + ' rcInval := Rect(fGutterWidth, fTextHeight * (Line - TopLine)' + + ', ClientWidth, 0);' + ' rcInval.Bottom := rcInval.Top + fTextHeight;' + '{$IFDEF SYN_CLX}' + ' with GetClientRect do' + ' OffsetRect(rcInval, Left, Top);' + '{$ENDIF}' + ' if sfLinesChanging in fStateFlags then' + ' UnionRect(fInvalidateRect, fInvalidateRect, rcInval)' + ' else' + ' InvalidateRect(rcInval, False);' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.GetReadOnly: Boolean;' + 'begin' + ' Result := fReadOnly;' + 'end;' + '' + 'procedure TCustomSynEdit.SetReadOnly(Value: Boolean);' + 'begin' + ' if fReadOnly <> Value then' + ' begin' + ' fReadOnly := Value;' + ' StatusChanged([scReadOnly]);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.FindMatchingBracket;' + 'begin' + ' InternalCaretXY := GetMatchingBracket;' + 'end;' + '' + 'function TCustomSynEdit.GetMatchingBracket: TBufferCoord;' + 'begin' + ' Result := GetMatchingBracketEx(CaretXY);' + 'end;' + '' + + 'function TCustomSynEdit.GetMatchingBracketEx(const APoint: TBuff' + + 'erCoord): TBufferCoord;' + 'const' + + ' Brackets: array[0..7] of WideChar = ('#39'('#39', '#39')'#39', '#39'['#39', '#39']'#39', '#39'{'#39', ' + + #39'}'#39', '#39'<'#39', '#39'>'#39');' + 'var' + ' Line: UnicodeString;' + ' i, PosX, PosY, Len: Integer;' + ' Test, BracketInc, BracketDec: WideChar;' + ' NumBrackets: Integer;' + ' vDummy: UnicodeString;' + ' attr: TSynHighlighterAttributes;' + ' p: TBufferCoord;' + ' isCommentOrString: Boolean;' + 'begin' + ' Result.Char := 0;' + ' Result.Line := 0;' + ' // get char at caret' + ' PosX := APoint.Char;' + ' PosY := APoint.Line;' + ' Line := Lines[APoint.Line - 1];' + ' if Length(Line) >= PosX then' + ' begin' + ' Test := Line[PosX];' + ' // is it one of the recognized brackets?' + ' for i := Low(Brackets) to High(Brackets) do' + ' if Test = Brackets[i] then' + ' begin' + + ' // this is the bracket, get the matching one and the dir' + + 'ection' + ' BracketInc := Brackets[i];' + ' BracketDec := Brackets[i xor 1]; // 0 -> 1, 1 -> 0, ...' + + ' // search for the matching bracket (that is until NumBra' + + 'ckets = 0)' + ' NumBrackets := 1;' + ' if Odd(i) then' + ' begin' + ' repeat' + ' // search until start of line' + ' while PosX > 1 do' + ' begin' + ' Dec(PosX);' + ' Test := Line[PosX];' + ' p.Char := PosX;' + ' p.Line := PosY;' + ' if (Test = BracketInc) or (Test = BracketDec) then' + ' begin' + + ' if GetHighlighterAttriAtRowCol(p, vDummy, attr) ' + + 'then' + + ' isCommentOrString := (attr = Highlighter.Strin' + + 'gAttribute) or' + ' (attr = Highlighter.CommentAttribute)' + ' else' + ' isCommentOrString := False;' + + ' if (Test = BracketInc) and (not isCommentOrStrin' + + 'g) then' + ' Inc(NumBrackets)' + + ' else if (Test = BracketDec) and (not isCommentOr' + + 'String) then' + ' begin' + ' Dec(NumBrackets);' + ' if NumBrackets = 0 then' + ' begin' + + ' // matching bracket found, set caret and bai' + + 'l out' + ' Result := P;' + ' exit;' + ' end;' + ' end;' + ' end;' + ' end;' + ' // get previous line if possible' + ' if PosY = 1 then break;' + ' Dec(PosY);' + ' Line := Lines[PosY - 1];' + ' PosX := Length(Line) + 1;' + ' until False;' + ' end' + ' else begin' + ' repeat' + ' // search until end of line' + ' Len := Length(Line);' + ' while PosX < Len do' + ' begin' + ' Inc(PosX);' + ' Test := Line[PosX];' + ' p.Char := PosX;' + ' p.Line := PosY;' + ' if (Test = BracketInc) or (Test = BracketDec) then' + ' begin' + + ' if GetHighlighterAttriAtRowCol(p, vDummy, attr) ' + + 'then' + + ' isCommentOrString := (attr = Highlighter.Strin' + + 'gAttribute) or' + ' (attr = Highlighter.CommentAttribute)' + ' else' + ' isCommentOrString := False;' + + ' if (Test = BracketInc) and (not isCommentOrStrin' + + 'g) then' + ' Inc(NumBrackets)' + + ' else if (Test = BracketDec)and (not isCommentOrS' + + 'tring) then' + ' begin' + ' Dec(NumBrackets);' + ' if NumBrackets = 0 then' + ' begin' + + ' // matching bracket found, set caret and bai' + + 'l out' + ' Result := P;' + ' exit;' + ' end;' + ' end;' + ' end;' + ' end;' + ' // get next line if possible' + ' if PosY = Lines.Count then' + ' Break;' + ' Inc(PosY);' + ' Line := Lines[PosY - 1];' + ' PosX := 0;' + ' until False;' + ' end;' + ' // don'#39't test the other brackets, we'#39're done' + ' break;' + ' end;' + ' end;' + 'end;' + '' + + 'function TCustomSynEdit.GetHighlighterAttriAtRowCol(const XY: TB' + + 'ufferCoord;' + + ' var Token: UnicodeString; var Attri: TSynHighlighterAttributes' + + '): Boolean;' + 'var' + ' TmpType, TmpStart: Integer;' + 'begin' + + ' Result := GetHighlighterAttriAtRowColEx(XY, Token, TmpType, Tm' + + 'pStart, Attri);' + 'end;' + '' + + 'function TCustomSynEdit.GetHighlighterAttriAtRowColEx(const XY: ' + + 'TBufferCoord;' + ' var Token: UnicodeString; var TokenType, Start: Integer;' + ' var Attri: TSynHighlighterAttributes): boolean;' + 'var' + ' PosX, PosY: Integer;' + ' Line: UnicodeString;' + 'begin' + ' PosY := XY.Line - 1;' + + ' if Assigned(Highlighter) and (PosY >= 0) and (PosY < Lines.Cou' + + 'nt) then' + ' begin' + ' Line := Lines[PosY];' + ' if PosY = 0 then' + ' Highlighter.ResetRange' + ' else' + + ' Highlighter.SetRange(TSynEditStringList(Lines).Ranges[PosY' + + ' - 1]);' + ' Highlighter.SetLine(Line, PosY);' + ' PosX := XY.Char;' + ' if (PosX > 0) and (PosX <= Length(Line)) then' + ' while not Highlighter.GetEol do' + ' begin' + ' Start := Highlighter.GetTokenPos + 1;' + ' Token := Highlighter.GetToken;' + + ' if (PosX >= Start) and (PosX < Start + Length(Token)) th' + + 'en' + ' begin' + ' Attri := Highlighter.GetTokenAttribute;' + ' TokenType := Highlighter.GetTokenKind;' + ' Result := True;' + ' exit;' + ' end;' + ' Highlighter.Next;' + ' end;' + ' end;' + ' Token := '#39#39';' + ' Attri := nil;' + ' Result := False;' + 'end;' + '' + + 'function TCustomSynEdit.FindHookedCmdEvent(AHandlerProc: THooked' + + 'CommandEvent): Integer;' + 'var' + ' Entry: THookedCommandHandlerEntry;' + 'begin' + ' Result := GetHookedCommandHandlersCount - 1;' + ' while Result >= 0 do' + ' begin' + + ' Entry := THookedCommandHandlerEntry(fHookedCommandHandlers[R' + + 'esult]);' + ' if Entry.Equals(AHandlerProc) then' + ' break;' + ' Dec(Result);' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.GetHookedCommandHandlersCount: Integer;' + 'begin' + ' if Assigned(fHookedCommandHandlers) then' + ' Result := fHookedCommandHandlers.Count' + ' else' + ' Result := 0;' + 'end;' + '' + 'procedure TCustomSynEdit.RegisterCommandHandler(' + + ' const AHandlerProc: THookedCommandEvent; AHandlerData: pointer' + + ');' + 'begin' + ' if not Assigned(AHandlerProc) then' + ' begin' + '{$IFDEF SYN_DEVELOPMENT_CHECKS}' + + ' raise Exception.Create('#39'Event handler is NIL in RegisterComm' + + 'andHandler'#39');' + '{$ENDIF}' + ' exit;' + ' end;' + ' if not Assigned(fHookedCommandHandlers) then' + ' fHookedCommandHandlers := TObjectList.Create;' + ' if FindHookedCmdEvent(AHandlerProc) = -1 then' + + ' fHookedCommandHandlers.Add(THookedCommandHandlerEntry.Create' + + '(' + ' AHandlerProc, AHandlerData))' + ' else' + '{$IFDEF SYN_DEVELOPMENT_CHECKS}' + + ' raise Exception.CreateFmt('#39'Event handler (%p, %p) already re' + + 'gistered'#39',' + ' [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]);' + '{$ENDIF}' + 'end;' + '' + 'procedure TCustomSynEdit.UnregisterCommandHandler(AHandlerProc:' + ' THookedCommandEvent);' + 'var' + ' i: Integer;' + 'begin' + ' if not Assigned(AHandlerProc) then' + ' begin' + '{$IFDEF SYN_DEVELOPMENT_CHECKS}' + + ' raise Exception.Create('#39'Event handler is NIL in UnregisterCo' + + 'mmandHandler'#39');' + '{$ENDIF}' + ' exit;' + ' end;' + ' i := FindHookedCmdEvent(AHandlerProc);' + ' if i > -1 then' + ' fHookedCommandHandlers.Delete(i)' + ' else' + '{$IFDEF SYN_DEVELOPMENT_CHECKS}' + + ' raise Exception.CreateFmt('#39'Event handler (%p, %p) is not reg' + + 'istered'#39',' + ' [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]);' + '{$ENDIF}' + 'end;' + '' + + 'procedure TCustomSynEdit.NotifyHookedCommandHandlers(AfterProces' + + 'sing: Boolean;' + + ' var Command: TSynEditorCommand; var AChar: WideChar; Data: poi' + + 'nter);' + 'var' + ' Handled: Boolean;' + ' i: Integer;' + ' Entry: THookedCommandHandlerEntry;' + 'begin' + ' Handled := False;' + ' for i := 0 to GetHookedCommandHandlersCount - 1 do' + ' begin' + + ' Entry := THookedCommandHandlerEntry(fHookedCommandHandlers[i' + + ']);' + + ' // NOTE: Command should NOT be set to ecNone, because this m' + + 'ight interfere' + + ' // with other handlers. Set Handled to False instead (and c' + + 'heck its value' + ' // to not process the command twice).' + + ' Entry.fEvent(Self, AfterProcessing, Handled, Command, AChar,' + + ' Data,' + ' Entry.fData);' + ' end;' + ' if Handled then' + ' Command := ecNone;' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnClearBookmark(var Mark: TSynEditMar' + + 'k);' + 'begin' + ' if Assigned(fOnClearMark) then' + ' fOnClearMark(Self, Mark);' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnPaintTransientEx(TransientType: TTr' + + 'ansientType; Lock: Boolean);' + 'var' + ' DoTransient: Boolean;' + ' i: Integer;' + 'begin' + ' DoTransient:=(FPaintTransientLock=0);' + ' if Lock then' + ' begin' + ' if (TransientType=ttBefore) then inc(FPaintTransientLock)' + ' else' + ' begin' + ' dec(FPaintTransientLock);' + ' DoTransient:=(FPaintTransientLock=0);' + ' end;' + ' end;' + '' + ' if DoTransient then' + ' begin' + ' // plugins' + ' if fPlugins <> nil then' + ' for i := 0 to fPlugins.Count - 1 do' + + ' TSynEditPlugin(fPlugins[i]).PaintTransient(Canvas, Trans' + + 'ientType);' + ' // event' + ' if Assigned(fOnPaintTransient) then' + ' begin' + ' Canvas.Font.Assign(Font);' + ' Canvas.Brush.Color := Color;' + ' HideCaret;' + ' try' + ' fOnPaintTransient(Self, Canvas, TransientType);' + ' finally' + ' ShowCaret;' + ' end;' + ' end;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnPaintTransient(TransientType: TTran' + + 'sientType);' + 'begin' + ' DoOnPaintTransientEx(TransientType, False);' + 'end;' + '' + 'procedure TCustomSynEdit.DoOnPaint;' + 'begin' + ' if Assigned(fOnPaint) then' + ' begin' + ' Canvas.Font.Assign(Font);' + ' Canvas.Brush.Color := Color;' + ' fOnPaint(Self, Canvas);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.DoOnPlaceMark(var Mark: TSynEditMark);' + 'begin' + ' if Assigned(fOnPlaceMark) then' + ' fOnPlaceMark(Self, Mark);' + 'end;' + '' + + 'function TCustomSynEdit.DoOnReplaceText(const ASearch, AReplace:' + + ' UnicodeString;' + ' Line, Column: Integer): TSynReplaceAction;' + 'begin' + ' Result := raCancel;' + ' if Assigned(fOnReplaceText) then' + + ' fOnReplaceText(Self, ASearch, AReplace, Line, Column, Result' + + ');' + 'end;' + '' + + 'procedure TCustomSynEdit.DoOnStatusChange(Changes: TSynStatusCha' + + 'nges);' + 'begin' + ' if Assigned(fOnStatusChange) then' + ' begin' + ' fOnStatusChange(Self, fStatusChanges);' + ' fStatusChanges := [];' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.UpdateModifiedStatus;' + 'begin' + ' Modified := not UndoList.InitialState;' + 'end;' + '' + 'procedure TCustomSynEdit.UndoRedoAdded(Sender: TObject);' + 'begin' + ' UpdateModifiedStatus;' + '' + + ' // we have to clear the redo information, since adding undo in' + + 'fo removes' + ' // the necessary context to undo earlier edit actions' + ' if (Sender = fUndoList) and not fUndoList.InsideRedo and' + + ' (fUndoList.PeekItem<>nil) and (fUndoList.PeekItem.ChangeRea' + + 'son<>crGroupBreak) then' + ' fRedoList.Clear;' + ' if TSynEditUndoList(Sender).BlockCount = 0 then' + ' DoChange;' + 'end;' + '' + + 'function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): Unico' + + 'deString;' + 'var' + ' Line: UnicodeString;' + ' Len, Stop: Integer;' + 'begin' + ' Result := '#39#39';' + ' if (XY.Line >= 1) and (XY.Line <= Lines.Count) then' + ' begin' + ' Line := Lines[XY.Line - 1];' + ' Len := Length(Line);' + ' if Len = 0 then Exit;' + + ' if (XY.Char >= 1) and (XY.Char <= Len + 1) and IsIdentChar(L' + + 'ine[XY.Char]) then' + ' begin' + ' Stop := XY.Char;' + ' while (Stop <= Len) and IsIdentChar(Line[Stop]) do' + ' Inc(Stop);' + ' while (XY.Char > 1) and IsIdentChar(Line[XY.Char - 1]) do' + ' Dec(XY.Char);' + ' if Stop > XY.Char then' + ' Result := Copy(Line, XY.Char, Stop - XY.Char);' + ' end;' + ' end;' + 'end;' + '' + + 'function TCustomSynEdit.BufferToDisplayPos(const p: TBufferCoord' + + '): TDisplayCoord;' + + '// BufferToDisplayPos takes a position in the text and transform' + + 's it into' + '// the row and column it appears to be on the screen' + 'var' + ' s: UnicodeString;' + ' i, L: Integer;' + ' x, CountOfAvgGlyphs: Integer;' + 'begin' + ' Canvas.Font := Font;' + '' + ' Result := TDisplayCoord(p);' + ' if p.Line - 1 < Lines.Count then' + ' begin' + ' s := Lines[p.Line - 1];' + ' l := Length(s);' + ' x := 0;' + ' for i := 1 to p.Char - 1 do begin' + ' if (i <= l) and (s[i] = #9) then' + ' inc(x, TabWidth - (x mod TabWidth))' + ' else if i <= l then' + ' begin' + + ' CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(s' + + '[i]) , fCharWidth);' + ' inc(x, CountOfAvgGlyphs);' + ' end' + ' else' + ' inc(x);' + ' end;' + ' Result.Column := x + 1;' + ' end;' + ' if WordWrap then' + + ' Result := fWordWrapPlugin.BufferToDisplayPos(TBufferCoord(Re' + + 'sult));' + 'end;' + '' + + 'function TCustomSynEdit.DisplayToBufferPos(const p: TDisplayCoor' + + 'd): TBufferCoord;' + + '// DisplayToBufferPos takes a position on screen and transfrom i' + + 't' + '// into position of text' + 'var' + ' s: UnicodeString;' + ' i, L: Integer;' + ' x, CountOfAvgGlyphs: Integer;' + 'begin' + ' Canvas.Font := Font;' + '' + ' if WordWrap then' + ' Result := fWordWrapPlugin.DisplayToBufferPos(p)' + ' else' + ' Result := TBufferCoord(p);' + ' if Result.Line <= lines.Count then' + ' begin' + ' s := Lines[Result.Line -1];' + ' l := Length(s);' + ' x := 0;' + ' i := 0;' + '' + ' while x < Result.Char do' + ' begin' + ' inc(i);' + ' if (i <= l) and (s[i] = #9) then' + ' inc(x, TabWidth - (x mod TabWidth))' + ' else if i <= l then' + ' begin' + + ' CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(s' + + '[i]) , fCharWidth);' + ' inc(x, CountOfAvgGlyphs);' + ' end' + ' else' + ' inc(x);' + ' end;' + ' Result.Char := i;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.DoLinesDeleted(FirstLine, Count: Intege' + + 'r);' + 'var' + ' i: Integer;' + 'begin' + ' // gutter marks' + ' for i := 0 to Marks.Count - 1 do' + ' if Marks[i].Line >= FirstLine + Count then' + ' Marks[i].Line := Marks[i].Line - Count' + ' else if Marks[i].Line > FirstLine then' + ' Marks[i].Line := FirstLine;' + '' + ' // plugins' + ' if fPlugins <> nil then' + ' for i := 0 to fPlugins.Count - 1 do' + + ' TSynEditPlugin(fPlugins[i]).LinesDeleted(FirstLine, Count)' + + ';' + 'end;' + '' + + 'procedure TCustomSynEdit.DoLinesInserted(FirstLine, Count: Integ' + + 'er);' + 'var' + ' i: Integer;' + 'begin' + ' // gutter marks' + ' for i := 0 to Marks.Count - 1 do' + ' if Marks[i].Line >= FirstLine then' + ' Marks[i].Line := Marks[i].Line + Count;' + '' + ' // plugins' + ' if fPlugins <> nil then' + ' for i := 0 to fPlugins.Count - 1 do' + + ' TSynEditPlugin(fPlugins[i]).LinesInserted(FirstLine, Count' + + ');' + 'end;' + '' + + 'procedure TCustomSynEdit.PluginsAfterPaint(ACanvas: TCanvas; con' + + 'st AClip: TRect;' + ' FirstLine, LastLine: Integer);' + 'var' + ' i: Integer;' + 'begin' + ' if fPlugins <> nil then' + ' for i := 0 to fPlugins.Count - 1 do' + + ' TSynEditPlugin(fPlugins[i]).AfterPaint(ACanvas, AClip, Fir' + + 'stLine, LastLine);' + 'end;' + '' + + 'procedure TCustomSynEdit.ProperSetLine(ALine: Integer; const ALi' + + 'neText: UnicodeString);' + 'begin' + ' if eoTrimTrailingSpaces in Options then' + ' Lines[ALine] := TrimTrailingSpaces(ALineText)' + ' else' + ' Lines[ALine] := ALineText;' + 'end;' + '' + 'procedure TCustomSynEdit.AddKeyUpHandler(aHandler: TKeyEvent);' + 'begin' + ' fKbdHandler.AddKeyUpHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveKeyUpHandler(aHandler: TKeyEvent)' + + ';' + 'begin' + ' fKbdHandler.RemoveKeyUpHandler(aHandler);' + 'end;' + '' + 'procedure TCustomSynEdit.AddKeyDownHandler(aHandler: TKeyEvent);' + 'begin' + ' fKbdHandler.AddKeyDownHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveKeyDownHandler(aHandler: TKeyEven' + + 't);' + 'begin' + ' fKbdHandler.RemoveKeyDownHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.AddKeyPressHandler(aHandler: TKeyPressW' + + 'Event);' + 'begin' + ' fKbdHandler.AddKeyPressHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveKeyPressHandler(aHandler: TKeyPre' + + 'ssWEvent);' + 'begin' + ' fKbdHandler.RemoveKeyPressHandler(aHandler);' + 'end;' + '' + 'procedure TCustomSynEdit.AddFocusControl(aControl: TWinControl);' + 'begin' + ' fFocusList.Add(aControl);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveFocusControl(aControl: TWinContro' + + 'l);' + 'begin' + ' fFocusList.Remove(aControl);' + 'end;' + '' + 'function TCustomSynEdit.IsIdentChar(AChar: WideChar): Boolean;' + 'begin' + ' if Assigned(Highlighter) then' + ' Result := Highlighter.IsIdentChar(AChar)' + ' else' + ' Result := AChar >= #33;' + '' + ' if Assigned(Highlighter) then' + + ' Result := Result or CharInSet(AChar, Highlighter.AdditionalI' + + 'dentChars)' + ' else' + + ' Result := Result or CharInSet(AChar, Self.AdditionalIdentCha' + + 'rs);' + '' + ' Result := Result and not IsWordBreakChar(AChar);' + 'end;' + '' + 'function TCustomSynEdit.IsWhiteChar(AChar: WideChar): Boolean;' + 'begin' + ' if Assigned(Highlighter) then' + ' Result := Highlighter.IsWhiteChar(AChar)' + ' else' + ' case AChar of' + ' #0..#32:' + ' Result := True;' + ' else' + + ' Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar' + + '))' + ' end' + 'end;' + '' + + 'function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolea' + + 'n;' + 'begin' + ' if Assigned(Highlighter) then' + ' Result := Highlighter.IsWordBreakChar(AChar)' + ' else' + ' case AChar of' + + ' #0..#32, '#39'.'#39', '#39','#39', '#39';'#39', '#39':'#39', '#39'"'#39', '#39#39#39#39', '#39#180#39', '#39'`'#39', '#39#176#39', '#39'^'#39 + + ', '#39'!'#39', '#39'?'#39', '#39'&'#39',' + + ' '#39'$'#39', '#39'@'#39', '#39#167#39', '#39'%'#39', '#39'#'#39', '#39'~'#39', '#39'['#39', '#39']'#39', '#39'('#39', '#39')'#39', '#39'{'#39', '#39'}'#39 + + ', '#39'<'#39', '#39'>'#39',' + ' '#39'-'#39', '#39'='#39', '#39'+'#39', '#39'*'#39', '#39'/'#39', '#39'\'#39', '#39'|'#39':' + ' Result := True;' + ' else' + ' Result := False;' + ' end;' + '' + ' if Assigned(Highlighter) then' + ' begin' + + ' Result := Result or CharInSet(AChar, Highlighter.AdditionalW' + + 'ordBreakChars);' + + ' Result := Result and not CharInSet(AChar, Highlighter.Additi' + + 'onalIdentChars);' + ' end' + ' else' + ' begin' + + ' Result := Result or CharInSet(AChar, Self.AdditionalWordBrea' + + 'kChars);' + + ' Result := Result and not CharInSet(AChar, Self.AdditionalIde' + + 'ntChars);' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetSearchEngine(Value: TSynEditSearchCu' + + 'stom);' + 'begin' + ' if (fSearchEngine <> Value) then' + ' begin' + ' fSearchEngine := Value;' + ' if Assigned(fSearchEngine) then' + ' fSearchEngine.FreeNotification(Self);' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.NextWordPos: TBufferCoord;' + 'begin' + ' Result := NextWordPosEx(CaretXY);' + 'end;' + '' + 'function TCustomSynEdit.WordStart: TBufferCoord;' + 'begin' + ' Result := WordStartEx(CaretXY);' + 'end;' + '' + 'function TCustomSynEdit.WordEnd: TBufferCoord;' + 'begin' + ' Result := WordEndEx(CaretXY);' + 'end;' + '' + 'function TCustomSynEdit.PrevWordPos: TBufferCoord;' + 'begin' + ' Result := PrevWordPosEx(CaretXY);' + 'end;' + '' + + 'function TCustomSynEdit.GetPositionOfMouse(out aPos: TBufferCoor' + + 'd): Boolean;' + + '// Get XY caret position of mouse. Returns False if point is out' + + 'side the' + '// region of the SynEdit control.' + 'var' + ' Point: TPoint;' + 'begin' + + ' GetCursorPos(Point); // mouse position (on ' + + 'screen)' + + ' Point := Self.ScreenToClient(Point); // convert to SynEdit ' + + 'coordinates' + ' { Make sure it fits within the SynEdit bounds }' + + ' if (Point.X < 0) or (Point.Y < 0) or (Point.X > Self.Width) or' + + ' (Point.Y> Self.Height) then' + ' begin' + ' Result := False;' + ' Exit;' + ' end;' + '' + ' { inside the editor, get the word under the mouse pointer }' + + ' aPos := DisplayToBufferPos(PixelsToRowColumn(Point.X, Point.Y)' + + ');' + ' Result := True;' + 'end;' + '' + 'function TCustomSynEdit.GetWordAtMouse: UnicodeString;' + 'var' + ' Point: TBufferCoord;' + 'begin' + ' { Return the word under the mouse }' + ' if GetPositionOfMouse(Point) then // if point is valid' + + ' Result := Self.GetWordAtRowCol(Point); // return the point a' + + 't the mouse position' + 'end;' + '' + + 'function TCustomSynEdit.CharIndexToRowCol(Index: Integer): TBuff' + + 'erCoord;' + '{ Index is 0-based; Result.x and Result.y are 1-based }' + 'var' + ' x, y, Chars: Integer;' + 'begin' + ' x := 0;' + ' y := 0;' + ' Chars := 0;' + ' while y < Lines.Count do' + ' begin' + ' x := Length(Lines[y]);' + ' if Chars + x + 2 > Index then' + ' begin' + ' x := Index - Chars;' + ' break;' + ' end;' + ' Inc(Chars, x + 2);' + ' x := 0;' + ' Inc(y);' + ' end;' + ' Result.Char := x + 1;' + ' Result.Line := y + 1;' + 'end;' + '' + + 'function TCustomSynEdit.RowColToCharIndex(RowCol: TBufferCoord):' + + ' Integer;' + '{ Row and Col are 1-based; Result is 0-based }' + 'var' + ' synEditStringList : TSynEditStringList;' + 'begin' + ' RowCol.Line := Min(Lines.Count, RowCol.Line) - 1;' + ' synEditStringList := (FLines as TSynEditStringList);' + ' // CharIndexToRowCol assumes a line break size of two' + ' Result := synEditStringList.LineCharIndex(RowCol.Line)' + ' + RowCol.Line * 2 + (RowCol.Char -1);' + 'end;' + '' + 'procedure TCustomSynEdit.Clear;' + '{ just to attain interface compatibility with TMemo }' + 'begin' + ' ClearAll;' + 'end;' + '' + 'function TCustomSynEdit.GetSelLength: Integer;' + 'begin' + ' if SelAvail then' + + ' Result := RowColToCharIndex(BlockEnd) - RowColToCharIndex(Bl' + + 'ockBegin)' + ' else' + ' Result := 0;' + 'end;' + '' + 'procedure TCustomSynEdit.SetSelLength(const Value: Integer);' + 'var' + ' iNewCharIndex: Integer;' + ' iNewBegin: TBufferCoord;' + ' iNewEnd: TBufferCoord;' + 'begin' + ' iNewCharIndex := RowColToCharIndex(BlockBegin) + Value;' + ' if (Value >= 0) or (iNewCharIndex < 0) then' + ' begin' + ' if iNewCharIndex < 0 then' + ' begin' + ' iNewEnd.Char := Length(Lines[Lines.Count - 1]) + 1;' + ' iNewEnd.Line := Lines.Count;' + ' end' + ' else' + ' iNewEnd := CharIndexToRowCol(iNewCharIndex);' + ' SetCaretAndSelection(iNewEnd, BlockBegin, iNewEnd);' + ' end' + ' else begin' + ' iNewBegin := CharIndexToRowCol(iNewCharIndex);' + ' SetCaretAndSelection(iNewBegin, iNewBegin, BlockBegin);' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.DefineProperties(Filer: TFiler);' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + ' function CollectionsEqual(C1, C2: TCollection): Boolean;' + ' begin' + ' Result := Classes.CollectionsEqual(C1, C2, nil, nil);' + ' end;' + '{$ENDIF}' + '' + ' function HasKeyData: Boolean;' + ' var' + ' iDefKeys: TSynEditKeyStrokes;' + ' begin' + ' if Filer.Ancestor <> nil then' + ' begin' + ' Result := not CollectionsEqual(Keystrokes,' + ' TCustomSynEdit(Filer.Ancestor).Keystrokes);' + ' end' + ' else begin' + ' iDefKeys := TSynEditKeyStrokes.Create(nil);' + ' try' + ' iDefKeys.ResetDefaults;' + ' Result := not CollectionsEqual(Keystrokes, iDefKeys);' + ' finally' + ' iDefKeys.Free;' + ' end;' + ' end;' + ' end;' + '' + 'var' + ' iSaveKeyData: Boolean;' + 'begin' + ' inherited;' + '{$IFNDEF UNICODE}' + ' UnicodeDefineProperties(Filer, Self);' + '{$ENDIF}' + ' iSaveKeyData := HasKeyData;' + + ' Filer.DefineProperty('#39'RemovedKeystrokes'#39', ReadRemovedKeystroke' + + 's,' + ' WriteRemovedKeystrokes, iSaveKeyData);' + + ' Filer.DefineProperty('#39'AddedKeystrokes'#39', ReadAddedKeystrokes, W' + + 'riteAddedKeystrokes,' + ' iSaveKeyData);' + 'end;' + '' + 'procedure TCustomSynEdit.DoChange;' + 'begin' + ' if Assigned(fOnChange) then' + ' fOnChange(Self);' + 'end;' + '' + 'procedure TCustomSynEdit.ReadAddedKeystrokes(Reader: TReader);' + 'var' + ' iAddKeys: TSynEditKeyStrokes;' + ' cKey: Integer;' + 'begin' + ' if Reader.NextValue = vaCollection then' + ' Reader.ReadValue' + ' else' + ' Exit;' + ' iAddKeys := TSynEditKeyStrokes.Create(Self);' + ' try' + ' Reader.ReadCollection(iAddKeys);' + ' for cKey := 0 to iAddKeys.Count -1 do' + ' Keystrokes.Add.Assign(iAddKeys[cKey]);' + ' finally' + ' iAddKeys.Free;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.ReadRemovedKeystrokes(Reader: TReader);' + 'var' + ' iDelKeys: TSynEditKeyStrokes;' + ' cKey: Integer;' + ' iKey: TSynEditKeyStroke;' + ' iToDelete: Integer;' + 'begin' + ' if Reader.NextValue = vaCollection then' + ' Reader.ReadValue' + ' else' + ' Exit;' + ' iDelKeys := TSynEditKeyStrokes.Create(nil);' + ' try' + ' Reader.ReadCollection(iDelKeys);' + ' for cKey := 0 to iDelKeys.Count -1 do' + ' begin' + ' iKey := iDelKeys[cKey];' + + ' iToDelete := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.' + + 'ShortCut2);' + + ' if (iToDelete >= 0) and (Keystrokes[iToDelete].Command = i' + + 'Key.Command) then' + ' Keystrokes[iToDelete].Free;' + ' end;' + ' finally' + ' iDelKeys.Free;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.WriteAddedKeystrokes(Writer: TWriter);' + 'var' + ' iDefaultKeys: TSynEditKeyStrokes;' + ' iAddedKeys: TSynEditKeyStrokes;' + ' cKey: Integer;' + ' iKey: TSynEditKeyStroke;' + ' iDelIndex: Integer;' + 'begin' + ' iDefaultKeys := TSynEditKeyStrokes.Create(nil);' + ' try' + ' if Writer.Ancestor <> nil then' + ' iDefaultKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes)' + ' else' + ' iDefaultKeys.ResetDefaults;' + ' iAddedKeys := TSynEditKeyStrokes.Create(nil);' + ' try' + ' for cKey := 0 to Keystrokes.Count -1 do' + ' begin' + ' iKey := Keystrokes[cKey];' + + ' iDelIndex := iDefaultKeys.FindShortcut2(iKey.ShortCut, i' + + 'Key.ShortCut2);' + ' //if it'#39's not a default keystroke, add it' + + ' if (iDelIndex < 0) or (iDefaultKeys[iDelIndex].Command <' + + '> iKey.Command) then' + ' iAddedKeys.Add.Assign(iKey);' + ' end;' + ' Writer.WriteCollection(iAddedKeys);' + ' finally' + ' iAddedKeys.Free;' + ' end;' + ' finally' + ' iDefaultKeys.Free;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.WriteRemovedKeystrokes(Writer: TWriter)' + + ';' + 'var' + ' iRemovedKeys: TSynEditKeyStrokes;' + ' cKey: Integer;' + ' iKey: TSynEditKeyStroke;' + ' iFoundAt: Integer;' + 'begin' + ' iRemovedKeys := TSynEditKeyStrokes.Create(nil);' + ' try' + ' if Writer.Ancestor <> nil then' + ' iRemovedKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes)' + ' else' + ' iRemovedKeys.ResetDefaults;' + ' cKey := 0;' + ' while cKey < iRemovedKeys.Count do' + ' begin' + ' iKey := iRemovedKeys[cKey];' + + ' iFoundAt := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.S' + + 'hortCut2);' + + ' if (iFoundAt >= 0) and (Keystrokes[iFoundAt].Command = iKe' + + 'y.Command) then' + + ' iKey.Free //if exists in Keystrokes, then shouldn'#39't be i' + + 'n "removed" list' + ' else' + ' Inc(cKey);' + ' end;' + ' Writer.WriteCollection(iRemovedKeys);' + ' finally' + ' iRemovedKeys.Free;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.AddMouseDownHandler(aHandler: TMouseEve' + + 'nt);' + 'begin' + ' fKbdHandler.AddMouseDownHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveMouseDownHandler(aHandler: TMouse' + + 'Event);' + 'begin' + ' fKbdHandler.RemoveMouseDownHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.AddMouseUpHandler(aHandler: TMouseEvent' + + ');' + 'begin' + ' fKbdHandler.AddMouseUpHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveMouseUpHandler(aHandler: TMouseEv' + + 'ent);' + 'begin' + ' fKbdHandler.RemoveMouseUpHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.AddMouseCursorHandler(aHandler: TMouseC' + + 'ursorEvent);' + 'begin' + ' fKbdHandler.AddMouseCursorHandler(aHandler);' + 'end;' + '' + + 'procedure TCustomSynEdit.RemoveMouseCursorHandler(aHandler: TMou' + + 'seCursorEvent);' + 'begin' + ' fKbdHandler.RemoveMouseCursorHandler(aHandler);' + 'end;' + '' + '{$IFDEF SYN_COMPILER_6_UP}' + + 'procedure TCustomSynEdit.DoSearchFindFirstExecute(Action: TSearc' + + 'hFindFirst);' + 'begin' + ' OnFindBeforeSearch := Action.Dialog.OnFind;' + ' OnCloseBeforeSearch := Action.Dialog.OnClose;' + + ' SelStartBeforeSearch := SelStart; SelLengthBeforeSearch := Sel' + + 'Length;' + '' + ' Action.Dialog.OnFind := FindDialogFindFirst;' + ' Action.Dialog.OnClose := FindDialogClose;' + ' Action.Dialog.Execute();' + 'end;' + '' + + 'procedure TCustomSynEdit.DoSearchFindExecute(Action: TSearchFind' + + ');' + 'begin' + ' OnFindBeforeSearch := Action.Dialog.OnFind;' + ' OnCloseBeforeSearch := Action.Dialog.OnClose;' + '' + ' Action.Dialog.OnFind := FindDialogFind;' + ' Action.Dialog.OnClose := FindDialogClose;' + ' Action.Dialog.Execute();' + 'end;' + '' + + 'procedure TCustomSynEdit.DoSearchReplaceExecute(Action: TSearchR' + + 'eplace);' + 'begin' + ' OnFindBeforeSearch := Action.Dialog.OnFind;' + ' OnReplaceBeforeSearch := Action.Dialog.OnReplace;' + ' OnCloseBeforeSearch := Action.Dialog.OnClose;' + '' + ' Action.Dialog.OnFind := FindDialogFind;' + ' Action.Dialog.OnReplace := FindDialogFind;' + ' Action.Dialog.OnClose := FindDialogClose;' + ' Action.Dialog.Execute();' + 'end;' + '' + + 'procedure TCustomSynEdit.DoSearchFindNextExecute(Action: TSearch' + + 'FindNext);' + 'begin' + ' SearchByFindDialog(Action.SearchFind.Dialog);' + 'end;' + '' + 'procedure TCustomSynEdit.FindDialogFindFirst(Sender: TObject);' + 'begin' + ' TFindDialog(Sender).CloseDialog;' + '' + + ' if (SelStart = SelStartBeforeSearch) and (SelLength = SelLengt' + + 'hBeforeSearch) then' + ' begin' + ' SelStart := 0;' + ' SelLength := 0;' + ' end;' + '' + ' if Sender is TFindDialog then' + + ' if not SearchByFindDialog(TFindDialog(Sender)) and (SelStart' + + ' = 0) and (SelLength = 0) then' + ' begin' + ' SelStart := SelStartBeforeSearch;' + ' SelLength := SelLengthBeforeSearch;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.FindDialogFind(Sender: TObject);' + 'begin' + ' if Sender is TFindDialog then' + ' SearchByFindDialog(TFindDialog(Sender));' + 'end;' + '' + + 'function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDial' + + 'og) : bool;' + 'var' + ' Options :TSynSearchOptions;' + ' ReplaceText, MessageText :String;' + ' OldSelStart, OldSelLength: integer;' + 'begin' + + ' if (frReplaceAll in FindDialog.Options) then Options := [ssoRe' + + 'placeAll]' + + ' else if (frReplace in FindDialog.Options) then Options := [sso' + + 'Replace]' + ' else Options := [ssoSelectedOnly];' + '' + + ' if (frMatchCase in FindDialog.Options) then Options := Options' + + ' + [ssoMatchCase];' + + ' if (frWholeWord in FindDialog.Options) then Options := Options' + + ' + [ssoWholeWord];' + + ' if (not (frDown in FindDialog.Options)) then Options := Option' + + 's + [ssoBackwards];' + '' + ' if (ssoSelectedOnly in Options)' + ' then ReplaceText := '#39#39 + ' else ReplaceText := TReplaceDialog(FindDialog).ReplaceText;' + '' + ' OldSelStart := SelStart; OldSelLength := SelLength;' + + ' if (UpperCase(SelText) = UpperCase(FindDialog.FindText)) and n' + + 'ot (frReplace in FindDialog.Options) then' + ' SelStart := SelStart + SelLength' + ' else' + ' SelLength := 0;' + '' + + ' Result := SearchReplace(FindDialog.FindText, ReplaceText, Opti' + + 'ons) > 0;' + ' if not Result then' + ' begin' + ' SelStart := OldSelStart; SelLength := OldSelLength;' + ' if Assigned(OnSearchNotFound) then' + ' OnSearchNotFound(self, FindDialog.FindText)' + ' else' + ' begin' + + ' MessageText := Format(STextNotFound, [FindDialog.FindText]' + + ');' + ' ShowMessage(MessageText);' + ' end;' + ' end' + ' else if (frReplace in FindDialog.Options) then' + ' begin' + ' SelStart := SelStart - Length(FindDialog.FindText) - 1;' + ' SelLength := Length(FindDialog.FindText) + 1;' + ' end;' + 'end;' + '' + 'procedure TCustomSynEdit.FindDialogClose(Sender: TObject);' + 'begin' + ' TFindDialog(Sender).OnFind := OnFindBeforeSearch;' + ' if Sender is TReplaceDialog then' + ' TReplaceDialog(Sender).OnReplace := OnReplaceBeforeSearch;' + ' TFindDialog(Sender).OnClose := OnCloseBeforeSearch;' + 'end;' + '{$ENDIF}' + '' + 'function TCustomSynEdit.GetWordWrap: Boolean;' + 'begin' + ' Result := fWordWrapPlugin <> nil;' + 'end;' + '' + 'procedure TCustomSynEdit.SetWordWrap(const Value: Boolean);' + 'var' + ' vTempBlockBegin, vTempBlockEnd : TBufferCoord;' + ' vOldTopLine: Integer;' + ' vShowCaret: Boolean;' + 'begin' + ' if WordWrap <> Value then' + ' begin' + + ' Invalidate; // better Invalidate before changing LeftChar an' + + 'd TopLine' + ' vShowCaret := CaretInView;' + ' vOldTopLine := RowToLine(TopLine);' + ' if Value then' + ' begin' + ' fWordWrapPlugin := TSynWordWrapPlugin.Create(Self);' + ' LeftChar := 1;' + ' end' + ' else' + ' fWordWrapPlugin := nil;' + ' TopLine := LineToRow(vOldTopLine);' + ' UpdateScrollBars;' + '' + + ' // constrain caret position to MaxScrollWidth if eoScrollPas' + + 'tEol is enabled' + ' if (eoScrollPastEol in Options) then' + ' begin' + ' InternalCaretXY := CaretXY;' + ' vTempBlockBegin := BlockBegin;' + ' vTempBlockEnd := BlockEnd;' + ' SetBlockBegin(vTempBlockBegin);' + ' SetBlockEnd(vTempBlockEnd);' + ' end;' + ' if vShowCaret then' + ' EnsureCursorPosVisible;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.GetDisplayLineCount: Integer;' + 'begin' + ' if fWordWrapPlugin = nil then' + ' Result := Lines.Count' + ' else if Lines.Count = 0 then' + ' Result := 0' + ' else begin' + ' Result := fWordWrapPlugin.RowCount;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.LineToRow(aLine: Integer): Integer;' + 'var' + ' vBufferPos: TBufferCoord;' + 'begin' + ' if not WordWrap then' + ' Result := aLine' + ' else begin' + ' vBufferPos.Char := 1;' + ' vBufferPos.Line := aLine;' + ' Result := BufferToDisplayPos(vBufferPos).Row;' + ' end;' + 'end;' + '' + 'function TCustomSynEdit.RowToLine(aRow: Integer): Integer;' + 'var' + ' vDisplayPos: TDisplayCoord;' + 'begin' + ' if not WordWrap then' + ' Result := aRow' + ' else begin' + ' vDisplayPos.Column := 1;' + ' vDisplayPos.Row := aRow;' + ' Result := DisplayToBufferPos(vDisplayPos).Line;' + ' end;' + 'end;' + '' + + 'procedure TCustomSynEdit.SetInternalDisplayXY(const aPos: TDispl' + + 'ayCoord);' + 'begin' + ' IncPaintLock;' + ' InternalCaretXY := DisplayToBufferPos(aPos);' + + ' fCaretAtEOL := WordWrap and (aPos.Row <= fWordWrapPlugin.RowCo' + + 'unt) and' + ' (aPos.Column > fWordWrapPlugin.GetRowLength(aPos.Row)) and' + ' (DisplayY <> aPos.Row);' + ' DecPaintLock;' + ' UpdateLastCaretX;' + 'end;' + '' + 'procedure TCustomSynEdit.SetWantReturns(Value: Boolean);' + 'begin' + ' fWantReturns := Value;' + ' {$IFDEF SYN_CLX}' + ' if fWantReturns then' + ' InputKeys := InputKeys + [ikReturns]' + ' else' + ' InputKeys := InputKeys - [ikReturns];' + ' {$ENDIF}' + 'end;' + '' + 'procedure TCustomSynEdit.SetWantTabs(Value: Boolean);' + 'begin' + ' fWantTabs := Value;' + ' {$IFDEF SYN_CLX}' + ' if fWantTabs then' + ' InputKeys := InputKeys + [ikTabs]' + ' else' + ' InputKeys := InputKeys - [ikTabs];' + ' {$ENDIF}' + 'end;' + '' + + 'procedure TCustomSynEdit.SetWordWrapGlyph(const Value: TSynGlyph' + + ');' + 'begin' + ' fWordWrapGlyph.Assign(Value);' + 'end;' + '' + 'procedure TCustomSynEdit.WordWrapGlyphChange(Sender: TObject);' + 'begin' + ' if not (csLoading in ComponentState) then' + ' InvalidateGutter;' + 'end;' + '' + '' + '{ TSynEditMark }' + '' + 'function TSynEditMark.GetEdit: TCustomSynEdit;' + 'begin' + ' if FEdit <> nil then try' + ' if FEdit.Marks.IndexOf(self) = -1 then' + ' FEdit := nil;' + ' except' + ' FEdit := nil;' + ' end;' + ' Result := FEdit;' + 'end;' + '' + 'function TSynEditMark.GetIsBookmark: Boolean;' + 'begin' + ' Result := (fBookmarkNum >= 0);' + 'end;' + '' + 'procedure TSynEditMark.SetChar(const Value: Integer);' + 'begin' + ' FChar := Value;' + 'end;' + '' + 'procedure TSynEditMark.SetImage(const Value: Integer);' + 'begin' + ' FImage := Value;' + ' if fVisible and Assigned(fEdit) then' + ' fEdit.InvalidateGutterLines(fLine, fLine);' + 'end;' + '' + 'procedure TSynEditMark.SetInternalImage(const Value: Boolean);' + 'begin' + ' fInternalImage := Value;' + ' if fVisible and Assigned(fEdit) then' + ' fEdit.InvalidateGutterLines(fLine, fLine);' + 'end;' + '' + 'procedure TSynEditMark.SetLine(const Value: Integer);' + 'begin' + ' if fVisible and Assigned(fEdit) then' + ' begin' + ' if fLine > 0 then' + ' fEdit.InvalidateGutterLines(fLine, fLine);' + ' fLine := Value;' + ' fEdit.InvalidateGutterLines(fLine, fLine);' + ' end' + ' else' + ' fLine := Value;' + 'end;' + '' + 'procedure TSynEditMark.SetVisible(const Value: Boolean);' + 'begin' + ' if fVisible <> Value then' + ' begin' + ' fVisible := Value;' + ' if Assigned(fEdit) then' + ' fEdit.InvalidateGutterLines(fLine, fLine);' + ' end;' + 'end;' + '' + 'constructor TSynEditMark.Create(AOwner: TCustomSynEdit);' + 'begin' + ' inherited Create;' + ' fBookmarkNum := -1;' + ' fEdit := AOwner;' + 'end;' + '' + '{ TSynEditMarkList }' + '' + + 'procedure TSynEditMarkList.Notify(Ptr: Pointer; Action: TListNot' + + 'ification);' + 'begin' + ' inherited;' + ' if Assigned(FOnChange) then' + ' FOnChange(Self);' + 'end;' + '' + 'function TSynEditMarkList.GetItem(Index: Integer): TSynEditMark;' + 'begin' + ' Result := TSynEditMark(inherited GetItem(Index));' + 'end;' + '' + + 'procedure TSynEditMarkList.SetItem(Index: Integer; Item: TSynEdi' + + 'tMark);' + 'begin' + ' inherited SetItem(Index, Item);' + 'end;' + '' + 'constructor TSynEditMarkList.Create(AOwner: TCustomSynEdit);' + 'begin' + ' inherited Create;' + ' fEdit := AOwner;' + 'end;' + '' + 'function TSynEditMarkList.First: TSynEditMark;' + 'begin' + ' Result := TSynEditMark(inherited First);' + 'end;' + '' + 'function TSynEditMarkList.Last: TSynEditMark;' + 'begin' + ' result := TSynEditMark(inherited Last);' + 'end;' + '' + + 'function TSynEditMarkList.Extract(Item: TSynEditMark): TSynEditM' + + 'ark;' + 'begin' + ' Result := TSynEditMark(inherited Extract(Item));' + 'end;' + '' + 'procedure TSynEditMarkList.ClearLine(Line: Integer);' + 'var' + ' i: Integer;' + 'begin' + ' for i := Count - 1 downto 0 do' + ' if not Items[i].IsBookmark and (Items[i].Line = Line) then' + ' Delete(i);' + 'end;' + '' + + 'procedure TSynEditMarkList.GetMarksForLine(line: Integer; var ma' + + 'rks: TSynEditMarks);' + '//Returns up to maxMarks book/gutter marks for a chosen line.' + 'var' + ' cnt: Integer;' + ' i: Integer;' + 'begin' + ' FillChar(marks, SizeOf(marks), 0);' + ' cnt := 0;' + ' for i := 0 to Count - 1 do' + ' begin' + ' if Items[i].Line = line then' + ' begin' + ' Inc(cnt);' + ' marks[cnt] := Items[i];' + ' if cnt = MAX_MARKS then break;' + ' end;' + ' end;' + 'end;' + '' + 'procedure TSynEditMarkList.Place(mark: TSynEditMark);' + 'begin' + ' if assigned(fEdit) then' + ' if Assigned(fEdit.OnPlaceBookmark) then' + ' fEdit.OnPlaceBookmark(fEdit, mark);' + ' if assigned(mark) then' + ' Add(mark);' + 'end;' + '' + '{ TSynEditPlugin }' + '' + 'constructor TSynEditPlugin.Create(AOwner: TCustomSynEdit);' + 'begin' + ' inherited Create;' + ' if AOwner <> nil then' + ' begin' + ' fOwner := AOwner;' + ' if fOwner.fPlugins = nil then' + ' fOwner.fPlugins := TObjectList.Create;' + ' fOwner.fPlugins.Add(Self);' + ' end;' + 'end;' + '' + 'destructor TSynEditPlugin.Destroy;' + 'begin' + ' if fOwner <> nil then' + + ' fOwner.fPlugins.Extract(Self); // we are being destroyed, fO' + + 'wner should not free us' + ' inherited Destroy;' + 'end;' + '' + + 'procedure TSynEditPlugin.AfterPaint(ACanvas: TCanvas; const ACli' + + 'p: TRect;' + ' FirstLine, LastLine: Integer);' + 'begin' + ' // nothing' + 'end;' + '' + + 'procedure TSynEditPlugin.PaintTransient(ACanvas: TCanvas; ATrans' + + 'ientType: TTransientType);' + 'begin' + ' // nothing' + 'end;' + '' + + 'procedure TSynEditPlugin.LinesInserted(FirstLine, Count: Integer' + + ');' + 'begin' + ' // nothing' + 'end;' + '' + + 'procedure TSynEditPlugin.LinesDeleted(FirstLine, Count: Integer)' + + ';' + 'begin' + ' // nothing' + 'end;' + '' + '{$IFNDEF UNICODE}' + '{$IFNDEF SYN_CLX}' + 'var' + ' GetMsgHook: HHOOK;' + '' + + 'function GetMsgProc(Code: Integer; wParam: WPARAM; lParam: LPARA' + + 'M): LRESULT; stdcall;' + 'var' + '{$IFNDEF SYN_COMPILER_9_UP}' + ' WndProc: Pointer;' + '{$ENDIF}' + ' WinCtrl: TWinControl;' + 'begin' + ' WinCtrl := TCustomSynEdit(FindControl(PMsg(lParam)^.hWnd));' + ' if WinCtrl is TCustomSynEdit then' + ' begin' + ' TCustomSynEdit(WinCtrl).FWindowProducedMessage := True;' + '' + '{$IFNDEF SYN_COMPILER_9_UP}' + ' if Code = HC_ACTION then' + ' begin' + ' with PMsg(lParam)^ do' + ' case message of' + ' WM_CHAR:' + ' begin' + ' if wParam > Ord(High(AnsiChar)) then' + ' if IsWindowUnicode(hWnd) then' + ' begin' + + ' WndProc := Pointer(GetWindowLong(hWnd, GWL_WND' + + 'PROC));' + + ' CallWindowProcW(WndProc, hWnd, WM_CHAR, wParam' + + ', lParam);' + ' Message := WM_NULL;' + ' end;' + ' end;' + ' end;' + ' end;' + '{$ENDIF}' + '' + ' end;' + '' + ' Result := CallNextHookEx(GetMsgHook, Code, wParam, lParam);' + 'end;' + '{$ENDIF}' + '{$ENDIF}' + '' + 'initialization' + '{$IFNDEF SYN_CLX}' + '{$IFNDEF UNICODE}' + + ' if Win32PlatformIsUnicode and not (csDesigning in Application.' + + 'ComponentState) then' + ' begin' + + ' // Hooking GetMessage/PeekMessage-calls is necessary as the ' + + 'use of' + + ' // PeekMessageA in TApplication.ProcessMessage mutilates Uni' + + 'code-messages.' + + ' GetMsgHook := SetWindowsHookExW(WH_GETMESSAGE, GetMsgProc, 0' + + ',' + ' GetCurrentThreadId);' + ' end' + ' else' + ' GetMsgHook := 0;' + '{$ENDIF}' + + ' SynEditClipboardFormat := RegisterClipboardFormat(SYNEDIT_CLIP' + + 'BOARD_FORMAT);' + '{$ENDIF}' + '' + 'finalization' + '{$IFNDEF SYN_CLX}' + '{$IFNDEF UNICODE}' + ' if Win32PlatformIsUnicode and (GetMsgHook <> 0) then' + ' UnhookWindowsHookEx(GetMsgHook);' + '{$ENDIF}' + '{$ENDIF}' + '' + 'end.' + '' + '') + OnStatusChange = SynEditStatusChange + FontSmoothing = fsmNone + end + object SynEditMiniMap: TSynEdit + Left = 0 + Top = 0 + Width = 150 + Height = 525 + Align = alLeft + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -3 + Font.Name = 'Courier New' + Font.Style = [] + Font.Quality = fqAntialiased + TabOrder = 1 + OnEnter = SynEditMiniMapEnter + OnMouseUp = SynEditMiniMapMouseUp + BorderStyle = bsNone + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Gutter.LeftOffset = 0 + Gutter.Visible = False + Gutter.Width = 0 + Highlighter = SynDWSSyn + Lines.Strings = ( + 'SynEditMiniMap') + Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoNoCaret, eoNoSelection, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoSpecialLineDefaultFg, eoTabsToSpaces] + ReadOnly = True + ScrollBars = ssNone + TabWidth = 2 + WordWrapGlyph.Visible = False + OnSpecialLineColors = SynEditMiniMapSpecialLineColors + FontSmoothing = fsmNone + end + object SynDWSSyn: TSynDWSSyn + DefaultFilter = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc' + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + Left = 272 + Top = 32 + end +end diff --git a/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.pas b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.pas new file mode 100644 index 00000000..c462e81c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMap.pas @@ -0,0 +1,82 @@ +unit SynMiniMap; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, + Math, ExtCtrls, SynEdit, SynEditHighlighter, SynHighlighterDWS; + +type + TFormSynEditMinimap = class(TForm) + SynEdit: TSynEdit; + SynEditMiniMap: TSynEdit; + Splitter: TSplitter; + SynDWSSyn: TSynDWSSyn; + procedure FormCreate(Sender: TObject); + procedure FormResize(Sender: TObject); + procedure SynEditStatusChange(Sender: TObject; Changes: TSynStatusChanges); + procedure SynEditMiniMapSpecialLineColors(Sender: TObject; Line: Integer; + var Special: Boolean; var FG, BG: TColor); + procedure SynEditMiniMapMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure SynEditMiniMapEnter(Sender: TObject); + end; + +var + FormSynEditMinimap: TFormSynEditMinimap; + +implementation + +{$R *.dfm} + +{ TFormSynEditMinimap } + +procedure TFormSynEditMinimap.FormCreate(Sender: TObject); +begin + // double buffer both SynEdit instances + SynEditMiniMap.DoubleBuffered := True; + SynEdit.DoubleBuffered := True; + SynEditMiniMap.SetLinesPointer(SynEdit); +end; + +procedure TFormSynEditMinimap.FormResize(Sender: TObject); +begin + SynEditStatusChange(Self, []); +end; + +procedure TFormSynEditMinimap.SynEditMiniMapEnter(Sender: TObject); +begin + SynEdit.SetFocus; +end; + +procedure TFormSynEditMinimap.SynEditMiniMapMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + Coord: TDisplayCoord; +begin + Coord := SynEditMiniMap.PixelsToNearestRowColumn(X, Y); + SynEdit.CaretXY := SynEdit.DisplayToBufferPos(Coord); + SynEdit.Invalidate; + SynEdit.TopLine := Max(1, Coord.Row - (SynEdit.LinesInWindow div 2)); +end; + +procedure TFormSynEditMinimap.SynEditMiniMapSpecialLineColors(Sender: TObject; Line: Integer; + var Special: Boolean; var FG, BG: TColor); +begin + Special := (Cardinal(Line - SynEdit.TopLine) <= Cardinal(SynEdit.LinesInWindow)); + BG := clBtnFace; +end; + +procedure TFormSynEditMinimap.SynEditStatusChange(Sender: TObject; + Changes: TSynStatusChanges); +begin + if SynEditMiniMap.Tag = SynEdit.TopLine then + Exit; + SynEditMiniMap.Tag := SynEdit.TopLine; + SynEditMiniMap.TopLine := + Max(1, SynEdit.TopLine - (SynEditMiniMap.LinesInWindow - + SynEdit.LinesInWindow) div 2); + SynEditMiniMap.Invalidate; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMapTest.dpr b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMapTest.dpr new file mode 100644 index 00000000..0f516e59 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MiniMap/SynMiniMapTest.dpr @@ -0,0 +1,19 @@ +// JCL_DEBUG_EXPERT_GENERATEJDBG OFF +// JCL_DEBUG_EXPERT_INSERTJDBG OFF +program SynMiniMapTest; + +{$SetPEFlags $0001} +{$WEAKLINKRTTI ON} + +uses + Forms, + SynMiniMap in 'SynMiniMap.pas' {FormSynEditMinimap}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TFormSynEditMinimap, FormSynEditMinimap); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/MultiSynDemo/MultiHighlight.dpr b/Source/VCL/SynEdit/Demos/MultiSynDemo/MultiHighlight.dpr new file mode 100644 index 00000000..9ed47785 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MultiSynDemo/MultiHighlight.dpr @@ -0,0 +1,52 @@ +{------------------------------------------------------------------------------- +The purpose of this demo is to show how to implement the TSynMultiSyn control +allowing you to syntax highlight documents with many highlighters based on +schemes that you define. +-------------------------------------------------------------------------------- +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. + +The Original Code is: MultiHighlight.dpr, released 2001-03-31. + +The Original Code is part of the MultiSynDemo project, written by Leon Brown +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: MultiHighlight.dpr,v 1.2 2004/01/22 03:37:47 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program MultiHighlight; + +uses + Forms, + uMain in 'uMain.pas' {frmMain}; + +begin + Application.Initialize; + Application.CreateForm(TfrmMain, frmMain); + Application.Run; +end. + diff --git a/Source/VCL/SynEdit/Demos/MultiSynDemo/SynAC.txt b/Source/VCL/SynEdit/Demos/MultiSynDemo/SynAC.txt new file mode 100644 index 00000000..456ffa54 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MultiSynDemo/SynAC.txt @@ -0,0 +1,61 @@ +!-- += +!doct +=| +a +=| +applet += += += += +frame += += += +=| +head += +=| += += += += += +img +=? +link += + AddedKeystrokes = <> + end + object StatusBar1: TStatusBar + Left = 0 + Top = 322 + Width = 556 + Height = 19 + Panels = <> + SimplePanel = True + end + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 185 + Height = 322 + Align = alLeft + TabOrder = 2 + object Label1: TLabel + Left = 1 + Top = 1 + Width = 183 + Height = 81 + Align = alTop + AutoSize = False + Caption = + 'Use CTRL+SPACE to bring up the Completion Proposal. Use SHIFT+SP' + + 'ACE to invoke the AutoComplete for one of the keywords below.' + WordWrap = True + end + object ListBox1: TListBox + Left = 1 + Top = 82 + Width = 183 + Height = 239 + Align = alClient + ItemHeight = 13 + Items.Strings = ( + '!--' + '!doct' + 'a' + 'applet' + 'frame' + 'head' + 'img' + 'link' + 'script' + 'style' + 'table' + 'td' + 'th' + 'tr' + 'ul' + '') + TabOrder = 0 + OnDblClick = ListBox1DblClick + end + end + object SynCssSyn1: TSynCssSyn + CommentAttri.Foreground = clGray + NumberAttri.Foreground = clFuchsia + AttributeAttri.Foreground = clNavy + StringAttri.Foreground = clBlue + StringAttri.Style = [fsBold] + SymbolAttri.Foreground = clNavy + SymbolAttri.Style = [fsBold] + Left = 272 + Top = 64 + end + object SynMultiSyn1: TSynMultiSyn + Schemes = < + item + StartExpr = '' + Highlighter = SynCssSyn1 + MarkerAttri.Background = clNone + MarkerAttri.Foreground = clPurple + SchemeName = 'CSS Full' + end + item + StartExpr = '' + Highlighter = SynCssSyn1 + MarkerAttri.Background = clNone + MarkerAttri.Foreground = clFuchsia + SchemeName = 'CSS Style' + end + item + StartExpr = '' + Highlighter = SynJScriptSyn1 + MarkerAttri.Background = clNone + MarkerAttri.Foreground = clMaroon + SchemeName = 'JS Full' + end + item + StartExpr = '' + Highlighter = SynJScriptSyn1 + MarkerAttri.Background = clNone + MarkerAttri.Foreground = clRed + SchemeName = 'JS Script' + end> + DefaultHighlighter = SynHTMLSyn1 + Left = 208 + Top = 64 + end + object SynHTMLSyn1: TSynHTMLSyn + DefaultFilter = 'HTML Document (*.htm,*.html)|*.htm;*.html' + CommentAttri.Foreground = clGray + CommentAttri.Style = [fsItalic] + SymbolAttri.Foreground = clNavy + SymbolAttri.Style = [] + Left = 240 + Top = 64 + end + object SynJScriptSyn1: TSynJScriptSyn + DefaultFilter = 'JavaScript files (*.js)|*.js' + CommentAttri.Foreground = clGray + IdentifierAttri.Foreground = clTeal + IdentifierAttri.Style = [fsBold] + KeyAttri.Foreground = clPurple + NumberAttri.Foreground = clRed + StringAttri.Foreground = clBlue + SymbolAttri.Foreground = clGreen + SymbolAttri.Style = [fsBold] + Left = 304 + Top = 64 + end + object SynCompletionProposal1: TSynCompletionProposal + NbLinesInWindow = 6 + ClSelect = clInactiveCaption + Width = 262 + EndOfTokenChr = '()[].' + TriggerChars = '.' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clBtnText + TitleFont.Height = -11 + TitleFont.Name = 'MS Sans Serif' + TitleFont.Style = [fsBold] + Columns = <> + ShortCut = 16416 + Editor = SynEdit1 + Left = 208 + Top = 96 + end + object SynAutoComplete1: TSynAutoComplete + EndOfTokenChr = '()[].' + Editor = SynEdit1 + ShortCut = 8224 + Options = [] + Left = 240 + Top = 96 + end + object MainMenu1: TMainMenu + Left = 208 + Top = 32 + object File1: TMenuItem + Caption = 'File' + object New1: TMenuItem + Caption = 'New' + OnClick = New1Click + end + object Open1: TMenuItem + Caption = 'Open' + OnClick = Open1Click + end + object Save1: TMenuItem + Caption = 'Save' + OnClick = Save1Click + end + object N1: TMenuItem + Caption = '-' + end + object About1: TMenuItem + Caption = 'About' + OnClick = About1Click + end + object N2: TMenuItem + Caption = '-' + end + object Exit1: TMenuItem + Caption = 'Exit' + OnClick = Exit1Click + end + end + end + object OpenDialog1: TOpenDialog + Left = 240 + Top = 32 + end + object SaveDialog1: TSaveDialog + Left = 272 + Top = 32 + end +end diff --git a/Source/VCL/SynEdit/Demos/MultiSynDemo/uMain.pas b/Source/VCL/SynEdit/Demos/MultiSynDemo/uMain.pas new file mode 100644 index 00000000..dc93bd4b --- /dev/null +++ b/Source/VCL/SynEdit/Demos/MultiSynDemo/uMain.pas @@ -0,0 +1,199 @@ +{------------------------------------------------------------------------------- +The purpose of this demo is to show how to implement the TSynMultiSyn control +allowing you to syntax highlight documents with many highlighters based on +schemes that you define. + +I thought it would be a great help by setting up the AutoComplete and +Completion proposal. When running the demo use them to correctly insert the tags +that I setup the SynMultiSyn1.Schemes to look for as Start / End Expression. +-------------------------------------------------------------------------------- +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. + +The Original Code is: uMain.pas, released 2001-03-31. + +The Original Code is part of the MultiSynDemo project, written by Leon Brown +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: uMain.pas,v 1.3 2004/01/22 03:37:47 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit uMain; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynCompletionProposal, SynHighlighterJScript, SynHighlighterHTML, + SynHighlighterMulti, SynEditHighlighter, SynHighlighterCss, SynEdit, + Menus, StdCtrls, ComCtrls, ExtCtrls; + +type + TfrmMain = class(TForm) + About1: TMenuItem; + Exit1: TMenuItem; + File1: TMenuItem; + MainMenu1: TMainMenu; + N1: TMenuItem; + N2: TMenuItem; + New1: TMenuItem; + Open1: TMenuItem; + OpenDialog1: TOpenDialog; + Save1: TMenuItem; + SaveDialog1: TSaveDialog; + StatusBar1: TStatusBar; + SynAutoComplete1: TSynAutoComplete; + SynCompletionProposal1: TSynCompletionProposal; + SynCssSyn1: TSynCssSyn; + SynEdit1: TSynEdit; + SynHTMLSyn1: TSynHTMLSyn; + SynJScriptSyn1: TSynJScriptSyn; + SynMultiSyn1: TSynMultiSyn; + Panel1: TPanel; + ListBox1: TListBox; + Label1: TLabel; + procedure About1Click(Sender: TObject); + procedure Exit1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ListBox1DblClick(Sender: TObject); + procedure New1Click(Sender: TObject); + procedure Open1Click(Sender: TObject); + procedure Save1Click(Sender: TObject); + procedure SynEdit1StatusChange(Sender: TObject; Changes: TSynStatusChanges); + end; + +var + frmMain: TfrmMain; + +implementation + +{$R *.DFM} + +procedure TfrmMain.FormCreate(Sender: TObject); +begin +{ The D4Demo uses this... + OpenDialog1.Filter := GetHighlightersFilter(fHighlighters) + + 'All files|*.*|'; + If you set SynMultiSyn1.DefalutFilter at Design time, you get a + repeat filter if it is the same as another highlighter. } + OpenDialog1.Filter := SynMultiSyn1.DefaultFilter; + SaveDialog1.Filter := SynMultiSyn1.DefaultFilter; +{ Set SynMultiSyn1 Filter to HTML because that is the example I'm + using. } + SynMultiSyn1.DefaultFilter := SynHTMLSyn1.DefaultFilter; + +{ Load Completion and Autocomplete from user maintained text files } + SynCompletionProposal1.ItemList.LoadFromFile( + ExtractFilePath(ParamStr(0)) + 'SynCP.txt'); + SynAutoComplete1.AutoCompleteList.LoadFromFile( + ExtractFilePath(ParamStr(0)) + 'SynAC.txt'); +end; + +procedure TfrmMain.New1Click(Sender: TObject); +begin + SynEdit1.Clear; +end; + +procedure TfrmMain.Open1Click(Sender: TObject); +begin + if OpenDialog1.Execute then begin + SynEdit1.Lines.LoadFromFile(OpenDialog1.FileName); + SynEdit1.SetFocus; + end; +end; + +procedure TfrmMain.Save1Click(Sender: TObject); +begin + if SaveDialog1.Execute then begin + SynEdit1.Lines.SaveToFile(SaveDialog1.FileName); + SynEdit1.SetFocus; + end; +end; + +procedure TfrmMain.Exit1Click(Sender: TObject); +begin + Close; +end; + +procedure TfrmMain.About1Click(Sender: TObject); +begin + MessageDlg('MultiHighlight HTML Demo'#13#10 + + 'by'#13#10 + + 'Leon Brown - LeonBrown77@hotmail.com', mtInformation, [mbOk], 0); + SynEdit1.SetFocus; +end; + + +procedure TfrmMain.ListBox1DblClick(Sender: TObject); +begin +{ Want to add text to SynEdit to be used with AutoComplete } + SynEdit1.SelText := ListBox1.Items.Strings[ListBox1.ItemIndex]; + SynEdit1.SetFocus; +end; + +procedure TfrmMain.SynEdit1StatusChange(Sender: TObject; + Changes: TSynStatusChanges); +begin + // caret position has changed + if Changes * [scAll, scCaretX, scCaretY] <> [] then begin + Statusbar1.SimpleText := Format('Ln:%6d, Col:%3d', + [SynEdit1.CaretY, SynEdit1.CaretX]); + end; +end; + +procedure TfrmMain.FormShow(Sender: TObject); +begin + SynEdit1.SetFocus; +end; + +end. + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/PaintTransientDemo.dpr b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/PaintTransientDemo.dpr new file mode 100644 index 00000000..07cebcf8 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/PaintTransientDemo.dpr @@ -0,0 +1,13 @@ +program PaintTransientDemo; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.dfm b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.dfm new file mode 100644 index 00000000..0c24fd10 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.dfm @@ -0,0 +1,75 @@ +object Form1: TForm1 + Left = 385 + Top = 196 + Width = 696 + Height = 480 + Caption = 'OnPaintTransient Demo' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Editor: TSynEdit + Left = 0 + Top = 41 + Width = 688 + Height = 405 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Terminal' + Gutter.Font.Style = [] + Highlighter = SynJavaSyn1 + OnPaintTransient = EditorPaintTransient + end + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 688 + Height = 41 + Align = alTop + BevelOuter = bvNone + TabOrder = 1 + object Button2: TButton + Left = 16 + Top = 8 + Width = 75 + Height = 25 + Caption = '&Open' + TabOrder = 0 + OnClick = Button2Click + end + object Button1: TButton + Left = 152 + Top = 8 + Width = 137 + Height = 25 + Caption = 'Toggle Enabled' + TabOrder = 1 + Visible = False + OnClick = Button1Click + end + end + object SynJavaSyn1: TSynJavaSyn + Enabled = False + Left = 192 + Top = 88 + end + object OpenDialog1: TOpenDialog + Filter = 'Java files|*.java' + Left = 104 + Top = 8 + end +end diff --git a/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.pas b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.pas new file mode 100644 index 00000000..352f0598 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/OnPaintTransientDemo/Unit1.pas @@ -0,0 +1,176 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEditHighlighter, SynHighlighterPython, SynEditPythonBehaviour, SynEdit, + SynHighlighterJava, StdCtrls, ExtCtrls, SynEditTypes; + +type + TForm1 = class(TForm) + Editor: TSynEdit; + SynJavaSyn1: TSynJavaSyn; + Panel1: TPanel; + Button2: TButton; + OpenDialog1: TOpenDialog; + Button1: TButton; + procedure EditorPaintTransient(Sender: TObject; Canvas: TCanvas; + TransientType: TTransientType); + procedure Button2Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + FBracketFG: TColor; + FBracketBG: TColor; + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +procedure TForm1.EditorPaintTransient(Sender: TObject; Canvas: TCanvas; + TransientType: TTransientType); + +var Editor : TSynEdit; + OpenChars: array of WideChar;//[0..2] of WideChar=(); + CloseChars: array of WideChar;//[0..2] of WideChar=(); + + function IsCharBracket(AChar: WideChar): Boolean; + begin + case AChar of + '{','[','(','<','}',']',')','>': + Result := True; + else + Result := False; + end; + end; + + function CharToPixels(P: TBufferCoord): TPoint; + begin + Result:=Editor.RowColumnToPixels(Editor.BufferToDisplayPos(P)); + end; + +var P: TBufferCoord; + Pix: TPoint; + D : TDisplayCoord; + S: UnicodeString; + I: Integer; + Attri: TSynHighlighterAttributes; + ArrayLength: Integer; + start: Integer; + TmpCharA, TmpCharB: WideChar; +begin + if TSynEdit(Sender).SelAvail then exit; + Editor := TSynEdit(Sender); + ArrayLength:= 3; +//if you had a highlighter that used a markup language, like html or xml, +//then you would want to highlight the greater and less than signs +//as illustrated below + +// if (Editor.Highlighter = shHTML) or (Editor.Highlighter = shXML) then +// inc(ArrayLength); + + SetLength(OpenChars, ArrayLength); + SetLength(CloseChars, ArrayLength); + for i := 0 to ArrayLength - 1 do + Case i of + 0: begin OpenChars[i] := '('; CloseChars[i] := ')'; end; + 1: begin OpenChars[i] := '{'; CloseChars[i] := '}'; end; + 2: begin OpenChars[i] := '['; CloseChars[i] := ']'; end; + 3: begin OpenChars[i] := '<'; CloseChars[i] := '>'; end; + end; + + P := Editor.CaretXY; + D := Editor.DisplayXY; + + Start := Editor.SelStart; + + if (Start > 0) and (Start <= length(Editor.Text)) then + TmpCharA := Editor.Text[Start] + else + TmpCharA := #0; + + if (Start < length(Editor.Text)) then + TmpCharB := Editor.Text[Start + 1] + else TmpCharB := #0; + + if not IsCharBracket(TmpCharA) and not IsCharBracket(TmpCharB) then exit; + S := TmpCharB; + if not IsCharBracket(TmpCharB) then + begin + P.Char := P.Char - 1; + S := TmpCharA; + end; + Editor.GetHighlighterAttriAtRowCol(P, S, Attri); + + if (Editor.Highlighter.SymbolAttribute = Attri) then + begin + for i := low(OpenChars) to High(OpenChars) do + begin + if (S = OpenChars[i]) or (S = CloseChars[i]) then + begin + Pix := CharToPixels(P); + + Editor.Canvas.Brush.Style := bsSolid;//Clear; + Editor.Canvas.Font.Assign(Editor.Font); + Editor.Canvas.Font.Style := Attri.Style; + + if (TransientType = ttAfter) then + begin + Editor.Canvas.Font.Color := FBracketFG; + Editor.Canvas.Brush.Color := FBracketBG; + end else begin + Editor.Canvas.Font.Color := Attri.Foreground; + Editor.Canvas.Brush.Color := Attri.Background; + end; + if Editor.Canvas.Font.Color = clNone then + Editor.Canvas.Font.Color := Editor.Font.Color; + if Editor.Canvas.Brush.Color = clNone then + Editor.Canvas.Brush.Color := Editor.Color; + + Editor.Canvas.TextOut(Pix.X, Pix.Y, S); + P := Editor.GetMatchingBracketEx(P); + + if (P.Char > 0) and (P.Line > 0) then + begin + Pix := CharToPixels(P); + if Pix.X > Editor.Gutter.Width then + begin + if S = OpenChars[i] then + Editor.Canvas.TextOut(Pix.X, Pix.Y, CloseChars[i]) + else Editor.Canvas.TextOut(Pix.X, Pix.Y, OpenChars[i]); + end; + end; + end; //if + end;//for i := + Editor.Canvas.Brush.Style := bsSolid; + end; +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + if OpenDialog1.Execute then + Editor.Lines.LoadFromFile(OpenDialog1.Filename); +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Editor.Text := SynJavaSyn1.SampleSource; + FBracketFG := clRed; + FBracketBG := clNone; +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + SynJavaSyn1.Enabled := not(SynJavaSyn1.Enabled); + Editor.Repaint; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/PrintDemo/PrintDemo1.dpr b/Source/VCL/SynEdit/Demos/PrintDemo/PrintDemo1.dpr new file mode 100644 index 00000000..d1ceaaf5 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemo/PrintDemo1.dpr @@ -0,0 +1,50 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: PrintDemo1.dpr, released 2000-06-23. + +The Original Code is part of the PrintDemo1 project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: PrintDemo1.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program PrintDemo1; + +uses + Forms, + frmMain in 'frmMain.pas' {PrintDemoForm}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TPrintDemoForm, PrintDemoForm); + Application.Run; +end. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/PrintDemo/ReadMe.txt new file mode 100644 index 00000000..2269fb99 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemo/ReadMe.txt @@ -0,0 +1,9 @@ +PrintDemo1.dpr +-------------- + +- Needs Delphi 2 or higher. +- Demonstrates printing with the TSynPrintout component from the + SynEditPrint_Old.pas unit. This is not registered on the component palette, + it is created at runtime. + + diff --git a/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.dfm b/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.dfm new file mode 100644 index 00000000..eb626d6d --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.dfm @@ -0,0 +1,218 @@ +object PrintDemoForm: TPrintDemoForm + Left = 291 + Top = 210 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'SynEdit printing demo' + ClientHeight = 312 + ClientWidth = 542 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 12 + Top = 16 + Width = 54 + Height = 13 + Caption = 'File to print:' + end + object SpeedButton1: TSpeedButton + Left = 516 + Top = 12 + Width = 21 + Height = 21 + Caption = '...' + OnClick = SpeedButton1Click + end + object Label2: TLabel + Left = 12 + Top = 48 + Width = 38 + Height = 13 + Caption = 'Header:' + end + object Label3: TLabel + Left = 12 + Top = 132 + Width = 33 + Height = 13 + Caption = 'Footer:' + end + object Label4: TLabel + Left = 12 + Top = 216 + Width = 23 + Height = 13 + Caption = 'Title:' + end + object Label5: TLabel + Left = 312 + Top = 208 + Width = 53 + Height = 29 + AutoSize = False + Caption = 'Print date and time:' + WordWrap = True + end + object eFileName: TEdit + Left = 88 + Top = 12 + Width = 429 + Height = 21 + TabOrder = 0 + OnChange = eFileNameChange + end + object memoHeader: TMemo + Left = 88 + Top = 44 + Width = 449 + Height = 73 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Lines.Strings = ( + '$TITLE$$RIGHT$Printed $DATETIME$' + '$LINE$') + ParentFont = False + TabOrder = 1 + end + object memoFooter: TMemo + Left = 88 + Top = 128 + Width = 449 + Height = 73 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + Lines.Strings = ( + '$LINE$' + '$CENTER$Page: $PAGENUM$/$PAGECOUNT$') + ParentFont = False + TabOrder = 2 + end + object btnPrint: TButton + Left = 462 + Top = 278 + Width = 75 + Height = 24 + Caption = 'Print' + Enabled = False + TabOrder = 10 + OnClick = btnPrintClick + end + object btnHeaderFont: TButton + Left = 9 + Top = 278 + Width = 120 + Height = 24 + Caption = 'Header font...' + TabOrder = 9 + OnClick = btnHeaderFontClick + end + object cbUseHighlighter: TCheckBox + Left = 180 + Top = 252 + Width = 129 + Height = 17 + Caption = 'Use syntax highlighter' + Checked = True + State = cbChecked + TabOrder = 6 + end + object cbPrintBlackAndWhite: TCheckBox + Left = 12 + Top = 252 + Width = 157 + Height = 17 + Caption = 'Print in black and white only' + TabOrder = 5 + end + object cbPrintLineNumbers: TCheckBox + Left = 320 + Top = 252 + Width = 109 + Height = 17 + Caption = 'Print line numbers' + TabOrder = 7 + end + object cbWordWrap: TCheckBox + Left = 440 + Top = 252 + Width = 97 + Height = 17 + Caption = 'Wrap long lines' + TabOrder = 8 + end + object eTitle: TEdit + Left = 88 + Top = 212 + Width = 201 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + TabOrder = 3 + Text = 'SynEdit print demo' + end + object ePrintDateTime: TEdit + Left = 368 + Top = 212 + Width = 169 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + TabOrder = 4 + end + object btnFooterFont: TButton + Left = 137 + Top = 278 + Width = 120 + Height = 24 + Caption = 'Footer font...' + TabOrder = 11 + OnClick = btnFooterFontClick + end + object dlgFileOpen: TOpenDialog + DefaultExt = 'pas' + Title = 'File to print' + Left = 388 + Top = 52 + end + object SynPasSyn1: TSynPasSyn + Left = 312 + Top = 76 + end + object dlgFilePrint: TPrintDialog + Options = [poPageNums] + Left = 424 + Top = 52 + end + object dlgSelectFont: TFontDialog + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Left = 460 + Top = 52 + end +end diff --git a/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.pas b/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.pas new file mode 100644 index 00000000..9d1be4b2 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemo/frmMain.pas @@ -0,0 +1,152 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: frmMain.pas, released 2000-06-23. + +The Original Code is part of the PrintDemo1 project, written by Michael Hieke +for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: frmMain.pas,v 1.3 2003/05/30 05:32:27 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit frmMain; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, SynEditHighlighter, SynHighlighterPas, SynEditPrint, Buttons; + +type + TPrintDemoForm = class(TForm) + Label1: TLabel; + eFileName: TEdit; + SpeedButton1: TSpeedButton; + dlgFileOpen: TOpenDialog; + SynPasSyn1: TSynPasSyn; + Label2: TLabel; + memoHeader: TMemo; + memoFooter: TMemo; + Label3: TLabel; + dlgFilePrint: TPrintDialog; + btnPrint: TButton; + btnHeaderFont: TButton; + cbUseHighlighter: TCheckBox; + dlgSelectFont: TFontDialog; + cbPrintBlackAndWhite: TCheckBox; + cbPrintLineNumbers: TCheckBox; + cbWordWrap: TCheckBox; + Label4: TLabel; + eTitle: TEdit; + Label5: TLabel; + ePrintDateTime: TEdit; + btnFooterFont: TButton; + procedure SpeedButton1Click(Sender: TObject); + procedure eFileNameChange(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure btnHeaderFontClick(Sender: TObject); + procedure btnPrintClick(Sender: TObject); + procedure btnFooterFontClick(Sender: TObject); + private + fPrintOut: TSynEditPrint; + end; + +var + PrintDemoForm: TPrintDemoForm; + +implementation + +{$R *.DFM} + +procedure TPrintDemoForm.SpeedButton1Click(Sender: TObject); +begin + dlgFileOpen.Filter := SynPasSyn1.DefaultFilter; + if dlgFileOpen.Execute then + eFileName.Text := dlgFileOpen.FileName; +end; + +procedure TPrintDemoForm.eFileNameChange(Sender: TObject); +begin + btnPrint.Enabled := FileExists(eFileName.Text); +end; + +procedure TPrintDemoForm.FormCreate(Sender: TObject); +begin + fPrintOut := TSynEditPrint.Create( Self ); +end; + +procedure TPrintDemoForm.btnHeaderFontClick(Sender: TObject); +begin + dlgSelectFont.Font.Assign(fPrintOut.Header.DefaultFont); + if dlgSelectFont.Execute then + fPrintOut.Header.DefaultFont.Assign(dlgSelectFont.Font); +end; + +procedure TPrintDemoForm.btnPrintClick(Sender: TObject); +begin + // set all properties because this can affect pagination + fPrintOut.Title := eTitle.Text; + fPrintOut.Lines.LoadFromFile(eFileName.Text); + if ePrintDateTime.Text <> '' then + fPrintOut.Header.Add( ePrintDateTime.Text, nil, taRightJustify, 1 ); + fPrintOut.Footer.Add( memoFooter.Lines.Text, nil, taCenter, 1 ); + fPrintOut.Header.Add( memoHeader.Lines.Text, nil, taCenter, 1 ); + fPrintOut.Colors := not cbPrintBlackAndWhite.Checked; + if cbUseHighlighter.Checked then + fPrintOut.Highlighter := SynPasSyn1 + else + fPrintOut.Highlighter := nil; + fPrintOut.LineNumbers := cbPrintLineNumbers.Checked; + fPrintOut.Wrap := cbWordWrap.Checked; + // show print setup dialog and print + with dlgFilePrint do begin + MinPage := 1; + FromPage := 1; + MaxPage := fPrintOut.PageCount; + ToPage := MaxPage; + if Execute then begin + fPrintOut.Copies := Copies; + case PrintRange of + prAllPages: fPrintOut.Print; + prPageNums: fPrintOut.PrintRange(FromPage, ToPage); + end; + end; + end; +end; + +procedure TPrintDemoForm.btnFooterFontClick(Sender: TObject); +begin + dlgSelectFont.Font.Assign(fPrintOut.Footer.DefaultFont); + if dlgSelectFont.Execute then + fPrintOut.Footer.DefaultFont.Assign(dlgSelectFont.Font); +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.dfm b/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.dfm new file mode 100644 index 00000000..e5f35e09 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.dfm @@ -0,0 +1,2151 @@ +object PageSetupDlg: TPageSetupDlg + Left = 196 + Top = 169 + BorderStyle = bsDialog + Caption = 'Page Setup' + ClientHeight = 397 + ClientWidth = 632 + Color = clBtnFace + ParentFont = True + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object PageControl: TPageControl + Left = 0 + Top = 0 + Width = 632 + Height = 397 + ActivePage = HeaderFooter + Align = alClient + TabOrder = 2 + OnChange = PageControlChange + object Margins: TTabSheet + Caption = 'Margins && Options' + object Image1: TImage + Left = 275 + Top = 10 + Width = 223 + Height = 292 + AutoSize = True + Picture.Data = { + 07544269746D617036800000424D36800000000000007600000028000000DF00 + 0000240100000100040000000000C07F0000C40E0000C40E0000100000000000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0F00FF0FF0FF0F + F0F0000F0FFFF00F000F0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF0FF000FF0F0FF0FF0FF0F0FF0F0FFFF0F0FFFFF00F0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF000FF0F0FF0FF0F + F0FF000F0FFFF0F0000FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF0F0F00FF0F0FF0FF0FF0FFFF0F0FFFF0F0FF0FF00F0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00FF0F00FF00000000 + 0FF0000F0FFF000F00FF0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF00FF0FFFFFFFFFFFFFFFFFFFFF0FFFF0FFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0FFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF00000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF00000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF0000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFF99FF9FF9FF99F99FF9F + F9FF99F99FF90F9FF99F99F99FF9FF99F99F99FF9FF900000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFF99F99FF9FF9FF99F99FF9FF9FF99F99099FF9FF99F99F99FF9F + F99F99F99FF9FF9FF99F99FF9FF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFF0FF + F0FF000F0000FF000FF000F0FFFF00FF000F0FF000FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FFF0F0FFFF0FF0F0FF0F0FFFF0FFFF0FF0 + FFFFF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF + F0F0000FF000F0FF0F0000F0FFFF0FF0000FF00F0FFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFF00000F0FF0FFFF0F0FF0F0FF0F0FFFF0FF0 + FF0FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FF + F0FF00FF0000FF000FF00FF000F000FF00FF0FF000FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9F0FFF0FFFFFFFFFFFFFF0FFFFFFFFFFF0FFF + FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00000 + 00FF000FF000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFF0000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF + F0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF0FFF0F0FFF0FF0F0FF0F0FFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0000F0 + 00F0FF0F0000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0FFFFFFFFFF000000 + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF00000F0FF0FFF0F0FF0F0FF0F0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFF0FFFFFFFFFF000000FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00F00 + 00FF000FF00FF000FFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFF0000000 + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFF + FFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFF00000FFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF00F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFF9FFFFFFFFFFFFFFF9FFFF + FFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F0000000FFFFFFFFFFFFFFFFFFF9FFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFF00000 + 000000F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F00000000FF9FFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFF9FFFFFFFFFFFFFFF9FFFF + F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000F000FF000FF0FFF0F0FFFFFF0F + FF000F0FF000FF0F0FF0FF000FF000F0FF0F00FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FF0FFF0FFFFF00FFF0FFF0F0FFFFFF0FF0FFFFF00F0FFF0F0FF0F0FF0F0FFFF0 + FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFF0FFF0000FF00FFF0FFF0F0FFFFFF0F + F0000FF00F0FFF0F0FF0F0FF0F0000F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FF0FFF0FF0FF00FFF00000F000FFFF0FF0FF0FF00F0FFF0F0FF0F0FF0F0FF0F0 + FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFF0FFFF00FF0000FF0FFF0F0FFFFFF0F + FF00FF0FF000FF0F000FFF000FF00FF000F000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FF0FFFFFFFFF00FFF0FFF0F0FFFFFF0FFFFFFFFFFF0FFF0FFFFFFFFF0FFFFFFF + FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0FFF0F0000F0000 + 0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF000F0FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF + 000F0FF000FF000FF000FFFF000FF0FF0F0FF0F000F0FF0FF000FFFFF0F0FF0F + 00F0FF0FFF0FF0FF0F0F0FF0FFF00FF0FFF000FF000FFFF0FF0FF00000F0FFF0 + 00F0F0FF0F000FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00F0FF0F0FFFF0FF0FFFF0FF0F0FF + 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 + FF0FFFF0FF0FFFF0FF0FF00FF0F0FF0FF0F0F0FF0FFFF0FFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00F + F00F0F0FF0F0000F0FF0FFFF0FF0F0FF0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F + 0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0FF0000F0FF0FFFF0FF0FF0F000F0FF0F + F0F0F0FF0FF00FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FFF0F0FF0F0FF0F0FF0FFFF0FF0F0FF + 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 + FF0FF0F0FF0FFFF0FF0FF0FFF0F0FF0FF0F0F0FF0F0FFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + F0000FF000FF00FFF000FFFF000FF0000F000F0000F000FFF000FFFF0F0F0F00 + 00F000FFFF000000FF0F000000F00FF000F00FFF000FFFF000000F0000F000F0 + 00F0F000FFF000FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFF + FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF + FFFF0FFFF0FFFFFFFFF0FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFF0F + FFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000090000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF000FFF00FF0000FF00FF0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0 + FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF000FFF00FF00F00F00FF0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0000F0FF0F0F0FF0FF0F0FF0 + FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF0FF0FF00F00000FF00FF000000FFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0000F0FF0F0FF0F0FF0F0FF0FF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0F0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF0FF0FF00F000000F00FF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0FF0FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 + 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 + 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF00000F + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0FF00FFFF00000FF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0 + FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FF0FF0FF0FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF0F000F + FF00FFF0FF0FF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFF0F000FF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF00FFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0000000FFF9FFFF0000F + FF00FFFFFFFFFFF9FFF0000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0FF00FFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFF00FF00FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0FF00FFFFF0000FF9FFFFFFFFF0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF00FF00FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0F00000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0 + FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0F00000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFF0FFF9FFFF00000FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000F0FFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF000FFFF9FFFF0FFFF + FF00FFFFF00000F9FFFFFF000FFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFF000F0FFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0F0F0FFF9FFF000000FF00FFFFF0FFFFF9FFFFF0F0F0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F0F0FFF9FFFF0FFF0 + FF00FFFF000000F9FFFFF0F0F0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF000000FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFF00F0FFF9FFF000000FF00FFFFF0FFF0F9FFFFFF00F0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFF0 + FF00FFFF000000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0FFFFFFF9FFFFFFFFFFF00FFFFF0FFF0F9FFFFF0FFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFFF000F + FF00FFFFFFFFFFF9FFFF000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFF0F0FFFFFFF9FFFF0F0F0FF00FFFFFF000FF9FFF0000000FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFF0F0F0 + FF00FFFFF0F0F0F9FFFFF0FFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFF0000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0FFF0FFF9FFFFF00F0FF00FFFFF0F0F0F9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFF00F0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFF000000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFF00000FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFF + FF00FFFFF00000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFFFF00FFFFF0FFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFF0FFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 + 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 + 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000900000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0000FF000FF00 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FFFF0000FF000FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF000F0FF0F000 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FFFFF000F0FF0F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0000FF000FF00 + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FF0F0000FF000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF + 0FF000F0FF0FFFF0FF0FF000F0FF0FF0000FFF000F0FFF000FF000FFFFFFFFFF + FFFFFFFFFFFF000FF0FF0FF000FFF0FF000F0FF0FFFF0FF0FF000F0FF0FF0F00 + 0FFF000F0FFF000F000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F00FFFF0FF0FFFF0FF0F0FF0F0FF0FF0 + 0FF0F0FFFF0FF0FFFF0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FFFFF0F00 + FFFF0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FFFF0FF0FFF0FF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0 + F00000F0FF0FFFF0FF0F0FF0F0FF0FF00FF0F0000F0FF0000F0FF0FFFFFFFFFF + FFFFFFFFFFF0FFF0F0FF0F0000FF0F00000F0FF0FFFF0FF0F0FF0F0FF0FF0F0F + F0F0000F0FF00000FF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF00000F0F00FF0F0FF0FFFF0FF0F0FF0F0FF0FF0 + 0FF0F0FF0F0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FF0FF0F00 + FF0F0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FF0F0FF0FF00FF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0F + FF000FF000FFFFF000FF0FF0F000000F000FFF00FF000F00FFF000FFFFFFFFFF + FFFFFFFFFFF0FFF0F000FFF00FF0FFF000FF000FFFFF000FF0FF0F000000FF00 + 0FFF00FF000F00FF000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF + FFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0} + end + object Label1: TLabel + Left = 10 + Top = 44 + Width = 21 + Height = 13 + Caption = 'Left:' + end + object Label2: TLabel + Left = 10 + Top = 69 + Width = 28 + Height = 13 + Caption = 'Right:' + end + object Label3: TLabel + Left = 10 + Top = 94 + Width = 22 + Height = 13 + Caption = 'Top:' + end + object Label4: TLabel + Left = 10 + Top = 119 + Width = 36 + Height = 13 + Caption = 'Bottom:' + end + object Label5: TLabel + Left = 10 + Top = 14 + Width = 27 + Height = 13 + Caption = 'Units:' + end + object Label6: TLabel + Left = 10 + Top = 174 + Width = 38 + Height = 13 + Caption = 'Header:' + end + object Label7: TLabel + Left = 10 + Top = 199 + Width = 33 + Height = 13 + Caption = 'Footer:' + end + object Label8: TLabel + Left = 10 + Top = 224 + Width = 84 + Height = 13 + Caption = 'HFInternalMargin:' + end + object Label9: TLabel + Left = 10 + Top = 249 + Width = 86 + Height = 13 + Caption = 'LeftHFTextIndent:' + end + object Label10: TLabel + Left = 10 + Top = 274 + Width = 93 + Height = 13 + Caption = 'RightHFTextIndent:' + end + object Label11: TLabel + Left = 10 + Top = 144 + Width = 29 + Height = 13 + Caption = 'Gutter' + end + object CBMirrorMargins: TCheckBox + Left = 10 + Top = 300 + Width = 97 + Height = 17 + Caption = 'Mirror margins' + TabOrder = 0 + end + object EditLeft: TEdit + Left = 110 + Top = 40 + Width = 151 + Height = 21 + TabOrder = 1 + end + object EditRight: TEdit + Left = 110 + Top = 65 + Width = 151 + Height = 21 + TabOrder = 2 + end + object EditTop: TEdit + Left = 110 + Top = 90 + Width = 151 + Height = 21 + TabOrder = 3 + end + object EditBottom: TEdit + Left = 110 + Top = 115 + Width = 151 + Height = 21 + TabOrder = 4 + end + object EditGutter: TEdit + Left = 110 + Top = 140 + Width = 151 + Height = 21 + TabOrder = 5 + end + object EditHeader: TEdit + Left = 110 + Top = 170 + Width = 151 + Height = 21 + TabOrder = 6 + end + object EditFooter: TEdit + Left = 110 + Top = 195 + Width = 151 + Height = 21 + TabOrder = 7 + end + object EditHFInternalMargin: TEdit + Left = 110 + Top = 220 + Width = 151 + Height = 21 + TabOrder = 8 + end + object EditLeftHFTextIndent: TEdit + Left = 110 + Top = 245 + Width = 151 + Height = 21 + TabOrder = 9 + end + object EditRightHFTextIndent: TEdit + Left = 110 + Top = 270 + Width = 151 + Height = 21 + TabOrder = 10 + end + object CBUnits: TComboBox + Left = 110 + Top = 10 + Width = 151 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 11 + OnChange = CBUnitsChange + Items.Strings = ( + 'mm' + 'cm' + 'Inches' + 'Thousandths Of Inches') + end + object CBLineNumbers: TCheckBox + Left = 10 + Top = 320 + Width = 97 + Height = 17 + Caption = 'Line numbers' + TabOrder = 12 + end + object CBLineNumbersInMargin: TCheckBox + Left = 10 + Top = 340 + Width = 156 + Height = 17 + Caption = 'Print line numbers in margin' + TabOrder = 13 + end + object CBHighlight: TCheckBox + Left = 185 + Top = 300 + Width = 81 + Height = 17 + Caption = 'Syntax print' + TabOrder = 14 + end + object CBColors: TCheckBox + Left = 185 + Top = 320 + Width = 76 + Height = 17 + Caption = 'Use colors' + TabOrder = 15 + end + object CBWrap: TCheckBox + Left = 185 + Top = 339 + Width = 76 + Height = 17 + Caption = 'Wrap lines' + TabOrder = 16 + end + end + object HeaderFooter: TTabSheet + Caption = 'Header && Footer' + ImageIndex = 1 + object GroupBox1: TGroupBox + Left = 5 + Top = 30 + Width = 611 + Height = 161 + Caption = 'Header' + TabOrder = 0 + object Label12: TLabel + Left = 10 + Top = 15 + Width = 18 + Height = 13 + Caption = 'Left' + end + object Label13: TLabel + Left = 210 + Top = 15 + Width = 31 + Height = 13 + Caption = 'Center' + end + object Label14: TLabel + Left = 410 + Top = 15 + Width = 25 + Height = 13 + Caption = 'Right' + end + object REHeaderLeft: TRichEdit + Left = 10 + Top = 30 + Width = 191 + Height = 56 + ScrollBars = ssBoth + TabOrder = 0 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object REHeaderCenter: TRichEdit + Left = 210 + Top = 30 + Width = 191 + Height = 56 + Alignment = taCenter + ScrollBars = ssBoth + TabOrder = 1 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object REHeaderRight: TRichEdit + Left = 410 + Top = 30 + Width = 191 + Height = 56 + Alignment = taRightJustify + ScrollBars = ssBoth + TabOrder = 2 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object CBHeaderMirror: TCheckBox + Left = 410 + Top = 95 + Width = 97 + Height = 17 + Caption = 'Mirror position' + TabOrder = 4 + OnEnter = CBFooterLineEnter + end + object GroupBox2: TGroupBox + Left = 10 + Top = 90 + Width = 391 + Height = 61 + Caption = 'Appearance' + TabOrder = 3 + object PBHeaderLine: TPaintBox + Left = 85 + Top = 20 + Width = 25 + Height = 25 + OnPaint = PBHeaderLinePaint + end + object PBHeaderShadow: TPaintBox + Left = 275 + Top = 20 + Width = 25 + Height = 25 + OnPaint = PBHeaderLinePaint + end + object CBHeaderLine: TCheckBox + Left = 8 + Top = 19 + Width = 73 + Height = 17 + Caption = 'Line under' + TabOrder = 0 + end + object CBHeaderBox: TCheckBox + Left = 8 + Top = 39 + Width = 48 + Height = 17 + Caption = 'Box' + TabOrder = 1 + end + object CBHeaderShadow: TCheckBox + Left = 209 + Top = 19 + Width = 62 + Height = 17 + Caption = 'Shadow' + TabOrder = 2 + end + object HeaderLineColorBtn: TButton + Left = 120 + Top = 20 + Width = 75 + Height = 25 + Caption = 'Line color' + TabOrder = 3 + OnClick = HeaderLineColorBtnClick + OnEnter = CBFooterLineEnter + end + object HeaderShadowColorBtn: TButton + Left = 310 + Top = 20 + Width = 75 + Height = 25 + Caption = 'Shadow color' + TabOrder = 4 + OnClick = HeaderShadowColorBtnClick + OnEnter = CBFooterLineEnter + end + end + end + object GroupBox3: TGroupBox + Left = 5 + Top = 200 + Width = 611 + Height = 161 + Caption = 'Footer' + TabOrder = 1 + object Label15: TLabel + Left = 10 + Top = 15 + Width = 18 + Height = 13 + Caption = 'Left' + end + object Label16: TLabel + Left = 210 + Top = 15 + Width = 31 + Height = 13 + Caption = 'Center' + end + object Label17: TLabel + Left = 410 + Top = 15 + Width = 25 + Height = 13 + Caption = 'Right' + end + object REFooterLeft: TRichEdit + Left = 10 + Top = 30 + Width = 191 + Height = 56 + ScrollBars = ssBoth + TabOrder = 0 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object REFooterCenter: TRichEdit + Left = 210 + Top = 30 + Width = 191 + Height = 56 + Alignment = taCenter + ScrollBars = ssBoth + TabOrder = 1 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object REFooterRight: TRichEdit + Left = 410 + Top = 30 + Width = 191 + Height = 56 + Alignment = taRightJustify + ScrollBars = ssBoth + TabOrder = 2 + WordWrap = False + OnEnter = REHeaderLeftEnter + OnSelectionChange = REHeaderLeftSelectionChange + end + object CBFooterMirror: TCheckBox + Left = 410 + Top = 95 + Width = 97 + Height = 17 + Caption = 'Mirror position' + TabOrder = 4 + OnEnter = CBFooterLineEnter + end + object GroupBox4: TGroupBox + Left = 10 + Top = 90 + Width = 391 + Height = 61 + Caption = 'Appearance' + TabOrder = 3 + object PBFooterLine: TPaintBox + Left = 85 + Top = 20 + Width = 25 + Height = 25 + OnPaint = PBHeaderLinePaint + end + object PBFooterShadow: TPaintBox + Left = 275 + Top = 20 + Width = 25 + Height = 25 + OnPaint = PBHeaderLinePaint + end + object CBFooterLine: TCheckBox + Left = 8 + Top = 19 + Width = 73 + Height = 17 + Caption = 'Line above' + TabOrder = 0 + OnEnter = CBFooterLineEnter + end + object CBFooterBox: TCheckBox + Left = 8 + Top = 39 + Width = 48 + Height = 17 + Caption = 'Box' + TabOrder = 1 + OnEnter = CBFooterLineEnter + end + object CBFooterShadow: TCheckBox + Left = 209 + Top = 24 + Width = 62 + Height = 17 + Caption = 'Shadow' + TabOrder = 2 + OnEnter = CBFooterLineEnter + end + object FooterLineColorBtn: TButton + Left = 120 + Top = 20 + Width = 75 + Height = 25 + Caption = 'Line color' + TabOrder = 3 + OnClick = FooterLineColorBtnClick + OnEnter = CBFooterLineEnter + end + object FooterShadowColorBtn: TButton + Left = 310 + Top = 20 + Width = 75 + Height = 25 + Caption = 'Shadow color' + TabOrder = 4 + OnClick = FooterShadowColorBtnClick + OnEnter = CBFooterLineEnter + end + end + end + object ToolBar1: TToolBar + Left = 0 + Top = 0 + Width = 624 + Height = 24 + AutoSize = True + Caption = 'ToolBar1' + EdgeBorders = [ebBottom] + Flat = True + Images = ImageList1 + Indent = 5 + TabOrder = 2 + object ToolButton1: TToolButton + Left = 5 + Top = 0 + Action = PageNumCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton2: TToolButton + Left = 28 + Top = 0 + Action = PagesCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton3: TToolButton + Left = 51 + Top = 0 + Action = TimeCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton4: TToolButton + Left = 74 + Top = 0 + Action = DateCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton11: TToolButton + Left = 97 + Top = 0 + Action = TitleCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton12: TToolButton + Left = 120 + Top = 0 + Width = 6 + Caption = 'ToolButton12' + ImageIndex = 9 + Style = tbsSeparator + end + object ToolButton6: TToolButton + Left = 126 + Top = 0 + Action = FontCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton10: TToolButton + Left = 149 + Top = 0 + Width = 8 + Caption = 'ToolButton10' + ImageIndex = 8 + Style = tbsSeparator + end + object ToolButton7: TToolButton + Left = 157 + Top = 0 + Action = BoldCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton8: TToolButton + Left = 180 + Top = 0 + Action = ItalicCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton9: TToolButton + Left = 203 + Top = 0 + Action = UnderlineCmd + ParentShowHint = False + ShowHint = True + end + end + end + end + object OKBtn: TButton + Left = 534 + Top = 320 + Width = 75 + Height = 25 + Caption = 'OK' + Default = True + ModalResult = 1 + TabOrder = 0 + end + object CancelBtn: TButton + Left = 534 + Top = 350 + Width = 75 + Height = 25 + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 1 + end + object ImageList1: TImageList + Left = 269 + Top = 4 + Bitmap = { + 494C010109000E00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000003000000001002000000000000030 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000C0C0C000C0C0C000C0C0C000C0C0C0000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000080000000800000008000 + 0000800000000000000000000000000000008000000080000000800000008000 + 0000800000008000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000808080008000 + 0000000000000000000000000000000000000000000080808000800000008000 + 0000808080000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000000000008000 + 0000800000000000000000000000000000000000000080808000800000008000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000000000008080 + 8000800000000000000000000000000000000000000080000000800000008080 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000800000008000000080000000800000008000000080000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000808080008000000000000000000000008000000080000000808080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000C0C0C000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008000000080000000000000008000000080000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000C0C0C00000000000000000000000000000000000C0C0C000000000000000 + 000000000000C0C0C00000000000000000000000000000000000000000000000 + 0000000000008080800080000000800000008000000080808000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000C0C0C000C0C0C000C0C0C0000000000000000000C0C0C000C0C0C000C0C0 + C00000000000C0C0C00000000000000000000000000000000000000000000000 + 0000000000000000000080000000800000008000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000080808000800000008080800000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000800000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 000000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF + FF0000FFFF000000000000000000000000000000000000000000000000000000 + 00000000000000000000C0C0C000FF000000FF000000FF000000FF000000FF00 + 0000FF000000FF000000C0C0C000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF0000000000000000000000000000000000000000000000000000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF0000000000000000000000000000000000FFFFFF00C0C0 + C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00800000008000000080000000800000008000 + 0000FFFFFF00000000000000000000000000000000000000000000000000FFFF + FF0000FFFF000000000000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000000000000000000000000000000000C0C0C000FF00 + 0000FF00000000000000C0C0C000FFFFFF00C0C0C0000000800000008000FFFF + FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000FFFFFF0000FF + FF00FFFFFF0000FFFF000000000000FFFF00FFFFFF0000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF00000000000000000000000000FFFFFF00C0C0 + C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF000000800000008000C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF008000000080000000800000008000000080000000800000008000 + 0000FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF0080000000FFFFFF00FFFF + FF00FFFFFF00000000000000000000000000000000000000000000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF000000000000FFFF00FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF00000000000000000000000000C0C0C0000000 + 80000000800000000000C0C0C000FFFFFF00C0C0C000FFFFFF00000080000000 + 8000C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF0080000000FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF000000000000000000000000000000 + 00000000000000000000FFFFFF00000000000000000000000000FFFFFF000000 + 8000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF000000 + 800000008000C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF0080000000FFFF + FF00FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF008000000080000000800000008000000080000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00000000000000000000000000000000000000000000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF00000000000000000000000000C0C0C0000000 + 80000000800000000000C0C0C000FFFFFF000000800000008000000080000000 + 800000008000FFFFFF00C0C0C000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0080000000800000008000000080000000800000008000 + 000080000000FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF00000000000000000000000000FFFFFF000000 + 8000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF008000 + 0000FFFFFF00FFFFFF000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF0080000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00000000000000000000000000000000000000000000000000FFFF + FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000000000000000000000000000000000C0C0C0000000 + 8000000080000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFF0080000000FFFFFF00FFFFFF008000 + 0000FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000000000000000000000000000000000000000000000000000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF0000000000000000000000000000000000FFFFFF00C0C0 + C000FFFFFF0000000000FF000000FF000000FF000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000000000000000000000000000000000000000 + 000000000000FFFFFF0000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000FFFFFF0000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 000000FFFF00FFFFFF0000FFFF00FFFFFF0000000000FFFFFF0000FFFF00FFFF + FF0000FFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF000000 + 0000000000000000000000000000000000000000000000000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF000000FF000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000300000000100010000000000800100000000000000000000 + 000000000000000000000000FFFFFF00FFFF000000000000FFFF000000000000 + E00F000000000000FFFF000000000000F83F000000000000F39F000000000000 + F39F000000000000F39F000000000000F39F000000000000F39F000000000000 + F39F000000000000F39F000000000000E10F000000000000FFFF000000000000 + FFFF000000000000FFFF000000000000FFFFFFFFFFFFFFFFFE1FFFFFFFFFFFFF + FC3FFFFFFFFFFFFFFE3F8703FFFFFFFFFE3FCF87E01F81FFFE3FE78FF18FE3FF + FE3FE78FF18FF1FFFE3FF01FF18FF8FFFE3FF31FF01FFC7FFE3FF93FF18FFE3F + F63BF83FF18FFF1FE003FC7FF18FFF8FE007FC7FE01FFF03FFFFFEFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC003FC1FF800E001C003F007F800 + E001C003E0038000E001C003C0018000E001C003C0018000E001C00380008000 + E001C00380008000E001C00380008000E001C00380008000E001C00380008000 + E001C003C0018000E001C003C0018000F001E003E0038000F801F003F007801F + FC01F803FC1F801FFFFFFFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} + end + object ActionList1: TActionList + Images = ImageList1 + Left = 299 + Top = 4 + object PageNumCmd: TAction + Caption = 'PageNumCmd' + Hint = 'Page number' + ImageIndex = 0 + OnExecute = PageNumCmdExecute + end + object PagesCmd: TAction + Caption = 'PagesCmd' + Hint = 'Num. pages' + ImageIndex = 1 + OnExecute = PagesCmdExecute + end + object TimeCmd: TAction + Caption = 'TimeCmd' + Hint = 'Time' + ImageIndex = 2 + OnExecute = TimeCmdExecute + end + object DateCmd: TAction + Caption = 'DateCmd' + Hint = 'Date' + ImageIndex = 3 + OnExecute = DateCmdExecute + end + object TitleCmd: TAction + Caption = 'TitleCmd' + Hint = 'Title' + ImageIndex = 4 + OnExecute = TitleCmdExecute + end + object FontCmd: TAction + Caption = 'FontCmd' + Hint = 'Font' + ImageIndex = 5 + OnExecute = FontCmdExecute + end + object BoldCmd: TAction + Caption = 'BoldCmd' + Hint = 'Bold' + ImageIndex = 6 + OnExecute = BoldCmdExecute + end + object ItalicCmd: TAction + Caption = 'ItalicCmd' + Hint = 'Italic' + ImageIndex = 7 + OnExecute = ItalicCmdExecute + end + object UnderlineCmd: TAction + Caption = 'UnderlineCmd' + Hint = 'Underline' + ImageIndex = 8 + OnExecute = UnderlineCmdExecute + end + end + object FontDialog: TFontDialog + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Left = 329 + Top = 4 + end + object ColorDialog: TColorDialog + Left = 359 + Top = 4 + end +end diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.pas b/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.pas new file mode 100644 index 00000000..851e92fe --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/DPageSetup.pas @@ -0,0 +1,563 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: DPageSetup.pas, released 2000-06-01. + +The Original Code is part of the TestPP project, written by +Morten J. Skovrup for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: DPageSetup.pas,v 1.2 2000/11/22 08:37:05 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit DPageSetup; + +{$I SynEdit.inc} + +interface + +uses + Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, + Buttons, ExtCtrls, ComCtrls, ToolWin, ImgList, ActnList, Dialogs, + SynEditPrintTypes, SynEditPrint, SynEditPrintMargins, + SynEditPrintHeaderFooter; + +type + TPageSetupDlg = class(TForm) + OKBtn: TButton; + CancelBtn: TButton; + PageControl: TPageControl; + Margins: TTabSheet; + HeaderFooter: TTabSheet; + Image1: TImage; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + CBMirrorMargins: TCheckBox; + EditLeft: TEdit; + EditRight: TEdit; + EditTop: TEdit; + EditBottom: TEdit; + EditGutter: TEdit; + EditHeader: TEdit; + EditFooter: TEdit; + EditHFInternalMargin: TEdit; + EditLeftHFTextIndent: TEdit; + EditRightHFTextIndent: TEdit; + CBUnits: TComboBox; + GroupBox1: TGroupBox; + REHeaderLeft: TRichEdit; + REHeaderCenter: TRichEdit; + REHeaderRight: TRichEdit; + CBHeaderMirror: TCheckBox; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + GroupBox2: TGroupBox; + CBHeaderLine: TCheckBox; + CBHeaderBox: TCheckBox; + CBHeaderShadow: TCheckBox; + HeaderLineColorBtn: TButton; + HeaderShadowColorBtn: TButton; + PBHeaderLine: TPaintBox; + PBHeaderShadow: TPaintBox; + GroupBox3: TGroupBox; + Label15: TLabel; + Label16: TLabel; + Label17: TLabel; + REFooterLeft: TRichEdit; + REFooterCenter: TRichEdit; + REFooterRight: TRichEdit; + CBFooterMirror: TCheckBox; + GroupBox4: TGroupBox; + PBFooterLine: TPaintBox; + PBFooterShadow: TPaintBox; + CBFooterLine: TCheckBox; + CBFooterBox: TCheckBox; + CBFooterShadow: TCheckBox; + FooterLineColorBtn: TButton; + FooterShadowColorBtn: TButton; + ImageList1: TImageList; + ActionList1: TActionList; + PageNumCmd: TAction; + PagesCmd: TAction; + TimeCmd: TAction; + DateCmd: TAction; + FontCmd: TAction; + BoldCmd: TAction; + ItalicCmd: TAction; + UnderlineCmd: TAction; + CBLineNumbers: TCheckBox; + CBLineNumbersInMargin: TCheckBox; + CBHighlight: TCheckBox; + CBColors: TCheckBox; + CBWrap: TCheckBox; + FontDialog: TFontDialog; + ColorDialog: TColorDialog; + TitleCmd: TAction; + ToolBar1: TToolBar; + ToolButton1: TToolButton; + ToolButton2: TToolButton; + ToolButton3: TToolButton; + ToolButton4: TToolButton; + ToolButton11: TToolButton; + ToolButton12: TToolButton; + ToolButton6: TToolButton; + ToolButton10: TToolButton; + ToolButton7: TToolButton; + ToolButton8: TToolButton; + ToolButton9: TToolButton; + procedure PageNumCmdExecute(Sender: TObject); + procedure PagesCmdExecute(Sender: TObject); + procedure TimeCmdExecute(Sender: TObject); + procedure DateCmdExecute(Sender: TObject); + procedure FontCmdExecute(Sender: TObject); + procedure BoldCmdExecute(Sender: TObject); + procedure ItalicCmdExecute(Sender: TObject); + procedure UnderlineCmdExecute(Sender: TObject); + procedure REHeaderLeftEnter(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure CBFooterLineEnter(Sender: TObject); + procedure PageControlChange(Sender: TObject); + procedure HeaderLineColorBtnClick(Sender: TObject); + procedure PBHeaderLinePaint(Sender: TObject); + procedure HeaderShadowColorBtnClick(Sender: TObject); + procedure FooterLineColorBtnClick(Sender: TObject); + procedure FooterShadowColorBtnClick(Sender: TObject); + procedure REHeaderLeftSelectionChange(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure CBUnitsChange(Sender: TObject); + procedure TitleCmdExecute(Sender: TObject); + private + { Private declarations } + Editor: TRichEdit; + CharPos: TPoint; + OldStart: Integer; + FMargins: TSynEditPrintMargins; + FInternalCall: Boolean; + procedure SetOptions; + procedure UpdateCursorPos; + procedure SelectLine(LineNum: Integer); + function CurrText: TTextAttributes; + procedure SetMargins(SynEditMargins: TSynEditPrintMargins); + procedure GetMargins(SynEditMargins: TSynEditPrintMargins); + procedure AddLines(HeadFoot: THeaderFooter; AEdit: TRichEdit; + Al: TALignment); + procedure SelectNone; + public + { Public declarations } + procedure SetValues(SynEditPrint: TSynEditPrint); + procedure GetValues(SynEditPrint: TSynEditPrint); + end; + +var + PageSetupDlg: TPageSetupDlg; + +implementation + +uses + RichEdit, ShellAPI, Messages; + +{$R *.DFM} + +procedure TPageSetupDlg.FormCreate(Sender: TObject); +begin + FMargins := TSynEditPrintMargins.Create; + FInternalCall := False; +end; + +procedure TPageSetupDlg.FormDestroy(Sender: TObject); +begin + FMargins.Free; +end; + +procedure TPageSetupDlg.FormShow(Sender: TObject); +begin + Editor := REHeaderLeft; + PageControl.ActivePage := Margins; + SetOptions; + UpdateCursorPos; +end; + +procedure TPageSetupDlg.SetOptions; +begin + PageNumCmd.Enabled := Editor.Focused; + PagesCmd.Enabled := Editor.Focused; + TimeCmd.Enabled := Editor.Focused; + DateCmd.Enabled := Editor.Focused; + TitleCmd.Enabled := Editor.Focused; + FontCmd.Enabled := Editor.Focused; + BoldCmd.Enabled := Editor.Focused; + ItalicCmd.Enabled := Editor.Focused; + UnderlineCmd.Enabled := Editor.Focused; +end; + +procedure TPageSetupDlg.REHeaderLeftEnter(Sender: TObject); +begin + Editor := Sender as TRichEdit; + SetOptions; +end; + +procedure TPageSetupDlg.CBFooterLineEnter(Sender: TObject); +begin + SetOptions; +end; + +procedure TPageSetupDlg.REHeaderLeftSelectionChange(Sender: TObject); +begin + UpdateCursorPos; +end; + +procedure TPageSetupDlg.UpdateCursorPos; +begin + CharPos.Y := SendMessage(Editor.Handle, EM_EXLINEFROMCHAR, 0, Editor.SelStart); + CharPos.X := (Editor.SelStart - SendMessage(Editor.Handle, EM_LINEINDEX, CharPos.Y, 0)); +end; + +procedure TPageSetupDlg.SelectLine(LineNum: Integer); +begin + OldStart := Editor.SelStart; + Editor.SelStart := SendMessage(Editor.Handle, EM_LINEINDEX, LineNum, 0); + Editor.SelLength := Length(Editor.Lines[LineNum]); +end; + +procedure TPageSetupDlg.SelectNone; +begin + Editor.SelStart := OldStart; + Editor.SelLength := 0; +end; + +function TPageSetupDlg.CurrText: TTextAttributes; +begin + Result := Editor.SelAttributes; +end; + +procedure TPageSetupDlg.PageNumCmdExecute(Sender: TObject); +begin + Editor.SelText := '$PAGENUM$'; +end; + +procedure TPageSetupDlg.PagesCmdExecute(Sender: TObject); +begin + Editor.SelText := '$PAGECOUNT$'; +end; + +procedure TPageSetupDlg.TimeCmdExecute(Sender: TObject); +begin + Editor.SelText := '$TIME$'; +end; + +procedure TPageSetupDlg.DateCmdExecute(Sender: TObject); +begin + Editor.SelText := '$DATE$'; +end; + +procedure TPageSetupDlg.TitleCmdExecute(Sender: TObject); +begin + Editor.SelText := '$TITLE$'; +end; + +procedure TPageSetupDlg.FontCmdExecute(Sender: TObject); +begin + SelectLine(CharPos.y); + FontDialog.Font.Assign(CurrText); + if FontDialog.Execute then + CurrText.Assign(FontDialog.Font); + SelectNone; +end; + +procedure TPageSetupDlg.BoldCmdExecute(Sender: TObject); +begin + SelectLine(CharPos.y); + if fsBold in CurrText.Style then + CurrText.Style := CurrText.Style - [fsBold] + else + CurrText.Style := CurrText.Style + [fsBold]; + SelectNone; +end; + +procedure TPageSetupDlg.ItalicCmdExecute(Sender: TObject); +begin + SelectLine(CharPos.y); + if fsItalic in CurrText.Style then + CurrText.Style := CurrText.Style - [fsItalic] + else + CurrText.Style := CurrText.Style + [fsItalic]; + SelectNone; +end; + +procedure TPageSetupDlg.UnderlineCmdExecute(Sender: TObject); +begin + SelectLine(CharPos.y); + if fsUnderLine in CurrText.Style then + CurrText.Style := CurrText.Style - [fsUnderLine] + else + CurrText.Style := CurrText.Style + [fsUnderLine]; + SelectNone; +end; + +procedure TPageSetupDlg.PageControlChange(Sender: TObject); +begin + if PageControl.ActivePage = HeaderFooter then + SetOptions; +end; + +procedure TPageSetupDlg.PBHeaderLinePaint(Sender: TObject); +begin + with (Sender as TPaintBox).Canvas do begin + Brush.Color := (Sender as TPaintBox).Color; + FillRect((Sender as TPaintBox).ClientRect); + Pen.Style := psDot; + Brush.Style := bsClear; + Rectangle(0, 0, (Sender as TPaintBox).Width, (Sender as TPaintBox).Height); + end; +end; + +procedure TPageSetupDlg.HeaderLineColorBtnClick(Sender: TObject); +begin + ColorDialog.Color := PBHeaderLine.Color; + if ColorDialog.Execute then + PBHeaderLine.Color := ColorDialog.Color; +end; + +procedure TPageSetupDlg.HeaderShadowColorBtnClick(Sender: TObject); +begin + ColorDialog.Color := PBHeaderShadow.Color; + if ColorDialog.Execute then + PBHeaderShadow.Color := ColorDialog.Color; +end; + +procedure TPageSetupDlg.FooterLineColorBtnClick(Sender: TObject); +begin + ColorDialog.Color := PBFooterLine.Color; + if ColorDialog.Execute then + PBFooterLine.Color := ColorDialog.Color; +end; + +procedure TPageSetupDlg.FooterShadowColorBtnClick(Sender: TObject); +begin + ColorDialog.Color := PBFooterShadow.Color; + if ColorDialog.Execute then + PBFooterShadow.Color := ColorDialog.Color; +end; + +procedure TPageSetupDlg.GetMargins(SynEditMargins: TSynEditPrintMargins); +var + CurEdit: TEdit; + function StringToFloat(Edit: TEdit): Double; + begin + CurEdit := Edit; + Result := StrToFloat(Edit.Text); + end; +begin + with SynEditMargins do begin + if not FInternalCall then + UnitSystem := TUnitSystem(CBUnits.ItemIndex); + try + Left := StringToFloat(EditLeft); + Right := StringToFloat(EditRight); + Top := StringToFloat(EditTop); + Bottom := StringToFloat(EditBottom); + Gutter := StringToFloat(EditGutter); + Header := StringToFloat(EditHeader); + Footer := StringToFloat(EditFooter); + LeftHFTextIndent := StringToFloat(EditLeftHFTextIndent); + RightHFTextIndent := StringToFloat(EditRightHFTextIndent); + HFInternalMargin := StringToFloat(EditHFInternalMargin); + except + MessageDlg('Invalid number!', mtError, [mbOk], 0); + CurEdit.SetFocus; + end; + MirrorMargins := CBMirrorMargins.Checked; + end; +end; + +procedure TPageSetupDlg.SetMargins(SynEditMargins: TSynEditPrintMargins); +begin + with SynEditMargins do begin + CBUnits.ItemIndex := Ord(UnitSystem); + EditLeft.Text := FloatToStr(Left); + EditRight.Text := FloatToStr(Right); + EditTop.Text := FloatToStr(Top); + EditBottom.Text := FloatToStr(Bottom); + EditGutter.Text := FloatToStr(Gutter); + EditHeader.Text := FloatToStr(Header); + EditFooter.Text := FloatToStr(Footer); + EditLeftHFTextIndent.Text := FloatToStr(LeftHFTextIndent); + EditRightHFTextIndent.Text := FloatToStr(RightHFTextIndent); + EditHFInternalMargin.Text := FloatToStr(HFInternalMargin); + CBMirrorMargins.Checked := MirrorMargins; + end; +end; + +procedure TPageSetupDlg.CBUnitsChange(Sender: TObject); +begin + FInternalCall := True; + GetMargins(FMargins); + FInternalCall := False; + FMargins.UnitSystem := TUnitSystem(CBUnits.ItemIndex); + SetMargins(FMargins); +end; + +procedure TPageSetupDlg.AddLines(HeadFoot: THeaderFooter; AEdit: TRichEdit; + Al: TALignment); +var + i: Integer; + AFont: TFont; +begin + Editor := AEdit; + AFont := TFont.Create; + for i := 0 to Editor.Lines.Count - 1 do begin + SelectLine(i); + AFont.Assign(CurrText); + HeadFoot.Add(Editor.Lines[i], AFont, Al, i + 1); + end; + AFont.Free; +end; + +procedure TPageSetupDlg.GetValues(SynEditPrint: TSynEditPrint); +begin + GetMargins(SynEditPrint.Margins); + SynEditPrint.LineNumbers := CBLineNumbers.Checked; + SynEditPrint.LineNumbersInMargin := CBLineNumbersInMargin.Checked; + SynEditPrint.Highlight := CBHighlight.Checked; + SynEditPrint.Colors := CBColors.Checked; + SynEditPrint.Wrap := CBWrap.Checked; + + SynEditPrint.Header.FrameTypes := []; + if CBHeaderLine.Checked then + SynEditPrint.Header.FrameTypes := SynEditPrint.Header.FrameTypes + [ftLine]; + if CBHeaderBox.Checked then + SynEditPrint.Header.FrameTypes := SynEditPrint.Header.FrameTypes + [ftBox]; + if CBHeaderShadow.Checked then + SynEditPrint.Header.FrameTypes := SynEditPrint.Header.FrameTypes + [ftShaded]; + SynEditPrint.Header.LineColor := PBHeaderLine.Color; + SynEditPrint.Header.ShadedColor := PBHeaderShadow.Color; + SynEditPrint.Header.MirrorPosition := CBHeaderMirror.Checked; + + SynEditPrint.Footer.FrameTypes := []; + if CBFooterLine.Checked then + SynEditPrint.Footer.FrameTypes := SynEditPrint.Footer.FrameTypes + [ftLine]; + if CBFooterBox.Checked then + SynEditPrint.Footer.FrameTypes := SynEditPrint.Footer.FrameTypes + [ftBox]; + if CBFooterShadow.Checked then + SynEditPrint.Footer.FrameTypes := SynEditPrint.Footer.FrameTypes + [ftShaded]; + SynEditPrint.Footer.LineColor := PBFooterLine.Color; + SynEditPrint.Footer.ShadedColor := PBFooterShadow.Color; + SynEditPrint.Footer.MirrorPosition := CBFooterMirror.Checked; + + SynEditPrint.Header.Clear; + AddLines(SynEditPrint.Header, REHeaderLeft, taLeftJustify); + AddLines(SynEditPrint.Header, REHeaderCenter, taCenter); + AddLines(SynEditPrint.Header, REHeaderRight, taRightJustify); + + SynEditPrint.Footer.Clear; + AddLines(SynEditPrint.Footer, REFooterLeft, taLeftJustify); + AddLines(SynEditPrint.Footer, REFooterCenter, taCenter); + AddLines(SynEditPrint.Footer, REFooterRight, taRightJustify); +end; + +procedure TPageSetupDlg.SetValues(SynEditPrint: TSynEditPrint); +var + i: Integer; + AItem: THeaderFooterItem; + LNum: Integer; +begin + REHeaderLeft.Lines.Clear; + REHeaderCenter.Lines.Clear; + REHeaderRight.Lines.Clear; + REFooterLeft.Lines.Clear; + REFooterCenter.Lines.Clear; + REFooterRight.Lines.Clear; + SetMargins(SynEditPrint.Margins); + CBLineNumbers.Checked := SynEditPrint.LineNumbers; + CBLineNumbersInMargin.Checked := SynEditPrint.LineNumbersInMargin; + CBHighlight.Checked := SynEditPrint.Highlight; + CBColors.Checked := SynEditPrint.Colors; + CBWrap.Checked := SynEditPrint.Wrap; + + REHeaderLeft.Font := SynEditPrint.Header.DefaultFont; + REHeaderCenter.Font := SynEditPrint.Header.DefaultFont; + REHeaderRight.Font := SynEditPrint.Header.DefaultFont; + REFooterLeft.Font := SynEditPrint.Footer.DefaultFont; + REFooterCenter.Font := SynEditPrint.Footer.DefaultFont; + REFooterRight.Font := SynEditPrint.Footer.DefaultFont; + + CBHeaderLine.Checked := ftLine in SynEditPrint.Header.FrameTypes; + CBHeaderBox.Checked := ftBox in SynEditPrint.Header.FrameTypes; + CBHeaderShadow.Checked := ftShaded in SynEditPrint.Header.FrameTypes; + PBHeaderLine.Color := SynEditPrint.Header.LineColor; + PBHeaderShadow.Color := SynEditPrint.Header.ShadedColor; + CBHeaderMirror.Checked := SynEditPrint.Header.MirrorPosition; + + CBFooterLine.Checked := ftLine in SynEditPrint.Footer.FrameTypes; + CBFooterBox.Checked := ftBox in SynEditPrint.Footer.FrameTypes; + CBFooterShadow.Checked := ftShaded in SynEditPrint.Footer.FrameTypes; + PBFooterLine.Color := SynEditPrint.Footer.LineColor; + PBFooterShadow.Color := SynEditPrint.Footer.ShadedColor; + CBFooterMirror.Checked := SynEditPrint.Footer.MirrorPosition; + + SynEditPrint.Header.FixLines; + for i := 0 to SynEditPrint.Header.Count - 1 do begin + AItem := SynEditPrint.Header.Get(i); + case AItem.Alignment of + taLeftJustify: Editor := REHeaderLeft; + taCenter: Editor := REHeaderCenter; + taRightJustify: Editor := REHeaderRight; + end; + LNum := Editor.Lines.Add(AItem.Text); + SelectLine(LNum); + CurrText.Assign(AItem.Font); + SelectNone; + end; + + SynEditPrint.Footer.FixLines; + for i := 0 to SynEditPrint.Footer.Count - 1 do begin + AItem := SynEditPrint.Footer.Get(i); + case AItem.Alignment of + taLeftJustify: Editor := REFooterLeft; + taCenter: Editor := REFooterCenter; + taRightJustify: Editor := REFooterRight; + end; + LNum := Editor.Lines.Add(AItem.Text); + SelectLine(LNum); + CurrText.Assign(AItem.Font); + SelectNone; + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.dfm b/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.dfm new file mode 100644 index 00000000..916ce45f --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.dfm @@ -0,0 +1,543 @@ +object TestPrintPreviewDlg: TTestPrintPreviewDlg + Left = 192 + Top = 148 + Width = 516 + Height = 420 + Caption = 'Print Preview' + Color = clBtnFace + ParentFont = True + OldCreateOrder = True + Position = poScreenCenter + WindowState = wsMaximized + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object ToolBar1: TToolBar + Left = 0 + Top = 0 + Width = 508 + Height = 23 + AutoSize = True + ButtonHeight = 23 + ButtonWidth = 24 + Caption = 'ToolBar1' + EdgeBorders = [] + Flat = True + Images = ImageList + Indent = 5 + TabOrder = 0 + object FirstBtn: TToolButton + Left = 5 + Top = 0 + Action = FirstCmd + ParentShowHint = False + ShowHint = True + end + object PrevBtn: TToolButton + Left = 29 + Top = 0 + Action = PrevCmd + ParentShowHint = False + ShowHint = True + end + object NextBtn: TToolButton + Left = 53 + Top = 0 + Action = NextCmd + ParentShowHint = False + ShowHint = True + end + object LastBtn: TToolButton + Left = 77 + Top = 0 + Action = LastCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton1: TToolButton + Left = 101 + Top = 0 + Width = 8 + Caption = 'ToolButton1' + ImageIndex = 2 + Style = tbsSeparator + end + object ToolButton3: TToolButton + Left = 109 + Top = 0 + Action = ZoomCmd + DropdownMenu = PopupMenu1 + ParentShowHint = False + ShowHint = True + Style = tbsDropDown + end + object ToolButton5: TToolButton + Left = 146 + Top = 0 + Width = 8 + Caption = 'ToolButton5' + ImageIndex = 4 + Style = tbsSeparator + end + object PrintBtn: TToolButton + Left = 154 + Top = 0 + Action = PrintCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton4: TToolButton + Left = 178 + Top = 0 + Width = 8 + Caption = 'ToolButton4' + ImageIndex = 4 + Style = tbsSeparator + end + object CloseBtn: TToolButton + Left = 186 + Top = 0 + Action = CloseCmd + ParentShowHint = False + ShowHint = True + end + end + object StatusBar: TStatusBar + Left = 0 + Top = 367 + Width = 508 + Height = 19 + Panels = < + item + Width = 400 + end + item + Width = 100 + end> + end + object SynEditPrintPreview: TSynEditPrintPreview + Left = 0 + Top = 23 + Width = 508 + Height = 344 + ScaleMode = pscWholePage + OnMouseDown = SynEditPrintPreviewMouseDown + OnPreviewPage = SynEditPrintPreviewPreviewPage + end + object ImageList: TImageList + Height = 17 + Width = 17 + Left = 242 + Top = 174 + Bitmap = { + 494C010107000900040011001100FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000440000002200000001002000000000002024 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000080 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000080000000800000008000000080000000800000008000 + 0000000000000000000000000000000000000000000000000000800000008000 + 0000800000008000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000080000000008080008000000000000000000000000000 + 0000000000000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000FFFF0000FFFF0000FFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000000080 + 8000008080008000000000000000000000000000000000000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008080 + 8000000000000000000000000000808080000000000080808000808080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008080800080808000808080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000080000000008080000080800000808000800000000000 + 0000000000000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000808080008080800080808000808080008080 + 8000000000000000000080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000000080 + 8000008080000080800080000000FFFFFF000000000000000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000080808000FFFF + FF0000000000FFFFFF0000000000FFFFFF008080800000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000008000000000808000008080000080800080000000FFFF + FF00FFFFFF000000000080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00008080800080808000FFFFFF0000000000FFFFFF0080000000FFFFFF000000 + 0000FFFFFF008080800080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000000080 + 8000008080000080800080000000FFFFFF00FFFFFF00FFFFFF00800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000008080800000000000FFFF + FF00000000008000000000000000FFFFFF000000000080808000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 000000000000000000008000000000808000008080000080800080000000FFFF + FF00FFFFFF00FFFFFF0080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000080808000FFFFFF00800000008000000080000000800000008000 + 0000FFFFFF008080800000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000000080 + 8000008080000080800080000000FFFFFF00FFFFFF00FFFFFF00800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000008080800000000000FFFF + FF00000000008000000000000000FFFFFF000000000080808000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 000000000000000000008000000000808000008080000080800080000000FFFF + FF00FFFFFF00FFFFFF0080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00008080800080808000FFFFFF0000000000FFFFFF0080000000FFFFFF000000 + 0000FFFFFF008080800080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000FFFFFF000000 + 000000000000000000000000000000000000FFFFFF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000000080 + 8000008080000080800080000000FFFFFF00FFFFFF00FFFFFF00800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000080808000FFFF + FF0000000000FFFFFF0000000000FFFFFF008080800000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 000000000000000000008000000000808000008080000080800080000000FFFF + FF00FFFFFF00FFFFFF0080000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000808080008080800080808000808080008080 + 8000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000800000008000 + 0000800000008000000080000000800000008000000080000000800000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008080 + 8000000000000000000000000000808080000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000000000000000000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000000000000000000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000840000008400000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000840000008400000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000008400 + 0000840000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000008400 + 0000840000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000840000008400 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840000008400 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000840000008400000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000840000008400000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000008400 + 0000840000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000008400 + 0000840000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000840000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000840000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000084000000840000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000000000000000000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000000000000000000000000000000000000840000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400000000000000000000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000044000000220000000100010000000000980100000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFFFFFFE00000000000FFFCFFFF + FFFFE00000000000FFF8E003FFFFE00000000000FFF1DFF5C0FC000000000000 + FFE38002FC7DE00000000000FFC7BF18FC3DE00000000000E08FBF1AFC1DE000 + 00000000C01F80037C0DE000000000008A3FBFF57C05E00000000000111FC00A + 7C01E000000000002A9FE0057C01E00000000000001FF000FC01E00000000000 + 2A9FF003FC01E00000000000111FF803FC01E000000000008A3FF801FC01E000 + 00000000C07FFC01FC01E00000000000E0FFFFFFFFFFE00000000000FFFFFFFF + FFFFFFFFF0000000FFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF0000000 + FBEFFFEFFF7FFF7DF0000000FBCFFFCFFF3FFF3DF0000000FB8FFF8FFF1FFF1D + F0000000FB0FFF0FFF0FFF0DF0000000FA0FFE0FFF07FF05F0000000F80FFC0F + FF03FF01F0000000FA0FFE0FFF07FF05F0000000FB0FFF0FFF0FFF0DF0000000 + FB8FFF8FFF1FFF1DF0000000FBCFFFCFFF3FFF3DF0000000FBEFFFEFFF7FFF7D + F0000000FFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF0000000FFFFFFFF + FFFFFFFFF000000000000000000000000000000000000000000000000000} + end + object ActionList: TActionList + Images = ImageList + Left = 272 + Top = 175 + object FirstCmd: TAction + Caption = 'FirstCmd' + Hint = 'First|Go to first page' + ImageIndex = 0 + ShortCut = 32838 + OnExecute = FirstCmdExecute + end + object PrevCmd: TAction + Caption = 'PrevCmd' + Hint = 'Previous|Go to previous page' + ImageIndex = 1 + ShortCut = 32848 + OnExecute = PrevCmdExecute + end + object NextCmd: TAction + Caption = 'NextCmd' + Hint = 'Next|Go to next page' + ImageIndex = 2 + ShortCut = 32846 + OnExecute = NextCmdExecute + end + object LastCmd: TAction + Caption = 'LastCmd' + Hint = 'Last|Go to last page' + ImageIndex = 3 + ShortCut = 32844 + OnExecute = LastCmdExecute + end + object ZoomCmd: TAction + Caption = 'FitCmd' + Hint = 'Zoom|Zoom In/Out' + ImageIndex = 4 + ShortCut = 32858 + OnExecute = ZoomCmdExecute + end + object PrintCmd: TAction + Caption = 'PrintCmd' + Hint = 'Print|Print the document' + ImageIndex = 5 + ShortCut = 16464 + OnExecute = PrintCmdExecute + end + object CloseCmd: TAction + Caption = 'CloseCmd' + Hint = 'Close|Close Print Preview' + ImageIndex = 6 + ShortCut = 32835 + OnExecute = CloseCmdExecute + end + end + object PopupMenu1: TPopupMenu + Left = 180 + Top = 65 + object Fitto1: TMenuItem + Tag = -1 + Caption = 'Whole page' + OnClick = Fitto1Click + end + object Pagewidth1: TMenuItem + Tag = -2 + Caption = 'Page width' + OnClick = Fitto1Click + end + object N1: TMenuItem + Caption = '-' + OnClick = Fitto1Click + end + object N251: TMenuItem + Tag = 25 + Caption = '25%' + OnClick = Fitto1Click + end + object N501: TMenuItem + Tag = 50 + Caption = '50%' + OnClick = Fitto1Click + end + object N1001: TMenuItem + Tag = 100 + Caption = '100%' + OnClick = Fitto1Click + end + object N2001: TMenuItem + Tag = 200 + Caption = '200%' + OnClick = Fitto1Click + end + object N4001: TMenuItem + Tag = 400 + Caption = '400%' + OnClick = Fitto1Click + end + end + object ApplicationEvents1: TApplicationEvents + OnHint = ApplicationEvents1Hint + Left = 345 + Top = 65 + end +end diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.pas b/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.pas new file mode 100644 index 00000000..ebd71894 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/DTestPrintPreview.pas @@ -0,0 +1,201 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: DTestPrintPreview.pas, released 2000-06-01. + +The Original Code is part of the TestPP project, written by +Morten J. Skovrup for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: DTestPrintPreview.pas,v 1.2 2000/11/22 08:37:05 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit DTestPrintPreview; + +{$I SynEdit.inc} + +interface + +uses + Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, + Buttons, ExtCtrls, ComCtrls, ToolWin, ActnList, ImgList, Dialogs, + SynEditPrintPreview, Menus, AppEvnts, Printers; + +type + TTestPrintPreviewDlg = class(TForm) + ImageList: TImageList; + ActionList: TActionList; + FirstCmd: TAction; + PrevCmd: TAction; + NextCmd: TAction; + LastCmd: TAction; + ZoomCmd: TAction; + PrintCmd: TAction; + CloseCmd: TAction; + ToolBar1: TToolBar; + FirstBtn: TToolButton; + PrevBtn: TToolButton; + NextBtn: TToolButton; + LastBtn: TToolButton; + ToolButton1: TToolButton; + ToolButton3: TToolButton; + ToolButton5: TToolButton; + PrintBtn: TToolButton; + ToolButton4: TToolButton; + CloseBtn: TToolButton; + StatusBar: TStatusBar; + PopupMenu1: TPopupMenu; + Fitto1: TMenuItem; + Pagewidth1: TMenuItem; + N1: TMenuItem; + N251: TMenuItem; + N501: TMenuItem; + N1001: TMenuItem; + N2001: TMenuItem; + N4001: TMenuItem; + ApplicationEvents1: TApplicationEvents; + SynEditPrintPreview: TSynEditPrintPreview; + + procedure FirstCmdExecute(Sender: TObject); + procedure PrevCmdExecute(Sender: TObject); + procedure NextCmdExecute(Sender: TObject); + procedure LastCmdExecute(Sender: TObject); + procedure ZoomCmdExecute(Sender: TObject); + procedure PrintCmdExecute(Sender: TObject); + procedure CloseCmdExecute(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Fitto1Click(Sender: TObject); + procedure ApplicationEvents1Hint(Sender: TObject); + procedure SynEditPrintPreviewMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure SynEditPrintPreviewPreviewPage(Sender: TObject; + PageNumber: Integer); + private + { Private declarations } + public + { Public declarations } + end; + +var + TestPrintPreviewDlg: TTestPrintPreviewDlg; + +implementation + +{$R *.DFM} + +procedure TTestPrintPreviewDlg.FormShow(Sender: TObject); +begin + SynEditPrintPreview.UpdatePreview; + SynEditPrintPreview.FirstPage; + if Printer.PrinterIndex >= 0 then + PrintCmd.Hint := 'Print (' + Printer.Printers[Printer.PrinterIndex] + + ')|Print the document on ' + Printer.Printers[Printer.PrinterIndex]; +end; + +procedure TTestPrintPreviewDlg.FirstCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.FirstPage; +end; + +procedure TTestPrintPreviewDlg.PrevCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.PreviousPage; +end; + +procedure TTestPrintPreviewDlg.NextCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.NextPage; +end; + +procedure TTestPrintPreviewDlg.LastCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.LastPage; +end; + +procedure TTestPrintPreviewDlg.ZoomCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.ScaleMode := pscWholePage; +end; + +procedure TTestPrintPreviewDlg.PrintCmdExecute(Sender: TObject); +begin + SynEditPrintPreview.Print; +end; + +procedure TTestPrintPreviewDlg.CloseCmdExecute(Sender: TObject); +begin + Close; +end; + +procedure TTestPrintPreviewDlg.Fitto1Click(Sender: TObject); +begin + case (Sender as TMenuItem).Tag of + -1: SynEditPrintPreview.ScaleMode := pscWholePage; + -2: SynEditPrintPreview.ScaleMode := pscPageWidth; + else + SynEditPrintPreview.ScalePercent := (Sender as TMenuItem).Tag; + end; +end; + +procedure TTestPrintPreviewDlg.ApplicationEvents1Hint(Sender: TObject); +begin + StatusBar.Panels[0].Text := ' ' + Application.Hint; +end; + +procedure TTestPrintPreviewDlg.SynEditPrintPreviewMouseDown( + Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, + Y: Integer); +var + FScale: Integer; +begin + FScale := SynEditPrintPreview.ScalePercent; + if Button = mbLeft then begin + if SynEditPrintPreview.ScaleMode = pscWholePage then + SynEditPrintPreview.ScalePercent := 100 + else begin + FScale := FScale * 2; + if FScale > 400 then + FScale := 400; + SynEditPrintPreview.ScalePercent := FScale; + end; + end + else begin + FScale := FScale div 2; + if FScale < 25 then + FScale := 25; + SynEditPrintPreview.ScalePercent := FScale; + end; +end; + +procedure TTestPrintPreviewDlg.SynEditPrintPreviewPreviewPage( + Sender: TObject; PageNumber: Integer); +begin + StatusBar.Panels[1].Text := ' Page: ' + IntToStr(SynEditPrintPreview.PageNumber); +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.dfm b/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.dfm new file mode 100644 index 00000000..7e5cf838 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.dfm @@ -0,0 +1,556 @@ +object Form1: TForm1 + Left = 142 + Top = 175 + Width = 728 + Height = 491 + Caption = 'Print example' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Menu = MainMenu1 + OldCreateOrder = False + WindowState = wsMaximized + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit: TSynEdit + Left = 0 + Top = 25 + Width = 720 + Height = 412 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Pitch = fpFixed + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Highlighter = SynPasSyn + end + object ToolBar1: TToolBar + Left = 0 + Top = 0 + Width = 720 + Height = 25 + AutoSize = True + ButtonHeight = 23 + ButtonWidth = 24 + Caption = 'ToolBar1' + Flat = True + Images = FileImages + Indent = 5 + TabOrder = 1 + object ToolButton1: TToolButton + Left = 5 + Top = 0 + Action = FileOpenCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton2: TToolButton + Left = 29 + Top = 0 + Width = 8 + Caption = 'ToolButton2' + ImageIndex = 1 + Style = tbsSeparator + end + object ToolButton8: TToolButton + Left = 37 + Top = 0 + Action = FilePageSetup + ParentShowHint = False + ShowHint = True + end + object ToolButton3: TToolButton + Left = 61 + Top = 0 + Action = FilePrinterSetupCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton4: TToolButton + Left = 85 + Top = 0 + Action = FilePrintPreviewCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton5: TToolButton + Left = 109 + Top = 0 + Action = FilePrintCmd + ParentShowHint = False + ShowHint = True + end + object ToolButton6: TToolButton + Left = 133 + Top = 0 + Width = 8 + Caption = 'ToolButton6' + ImageIndex = 4 + Style = tbsSeparator + end + object ToolButton7: TToolButton + Left = 141 + Top = 0 + Action = FileExitCmd + ParentShowHint = False + ShowHint = True + end + end + object SynPasSyn: TSynPasSyn + DefaultFilter = 'Pascal files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc' + CommentAttri.Foreground = clNavy + NumberAttri.Foreground = clBlue + StringAttri.Foreground = clMaroon + Left = 625 + Top = 355 + end + object OpenDialog: TOpenDialog + Left = 625 + Top = 385 + end + object PrintDialog: TPrintDialog + Left = 660 + Top = 385 + end + object SynEditPrint: TSynEditPrint + Copies = 1 + Header.FrameTypes = [ftBox, ftShaded] + Header.DefaultFont.Charset = DEFAULT_CHARSET + Header.DefaultFont.Color = clBlack + Header.DefaultFont.Height = -13 + Header.DefaultFont.Name = 'Arial' + Header.DefaultFont.Style = [] + Footer.DefaultFont.Charset = DEFAULT_CHARSET + Footer.DefaultFont.Color = clBlack + Footer.DefaultFont.Height = -13 + Footer.DefaultFont.Name = 'Arial' + Footer.DefaultFont.Style = [] + Margins.Left = 25.000000000000000000 + Margins.Right = 15.000000000000000000 + Margins.Top = 25.000000000000000000 + Margins.Bottom = 25.000000000000000000 + Margins.Header = 15.000000000000000000 + Margins.Footer = 15.000000000000000000 + Margins.LeftHFTextIndent = 2.000000000000000000 + Margins.RightHFTextIndent = 2.000000000000000000 + Margins.HFInternalMargin = 0.500000000000000000 + Margins.MirrorMargins = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Colors = True + Highlighter = SynPasSyn + TabWidth = 8 + Color = clWhite + Left = 660 + Top = 355 + end + object ActionList1: TActionList + Images = FileImages + Left = 660 + Top = 295 + object FileOpenCmd: TAction + Caption = '&Open' + Hint = 'Open' + ImageIndex = 0 + ShortCut = 16463 + OnExecute = FileOpenCmdExecute + end + object FilePageSetup: TAction + Caption = 'Page Setup' + Hint = 'Page setup' + ImageIndex = 1 + OnExecute = FilePageSetupExecute + end + object FilePrinterSetupCmd: TAction + Caption = 'Printer &Setup' + Hint = 'Printer setup' + ImageIndex = 2 + OnExecute = FilePrinterSetupCmdExecute + end + object FilePrintPreviewCmd: TAction + Caption = 'Print Preview' + Hint = 'Print preview' + ImageIndex = 3 + OnExecute = FilePrintPreviewCmdExecute + end + object FilePrintCmd: TAction + Caption = '&Print' + Hint = 'Print' + ImageIndex = 4 + ShortCut = 16464 + OnExecute = FilePrintCmdExecute + end + object FileExitCmd: TAction + Caption = '&Exit' + Hint = 'Exit' + ImageIndex = 5 + OnExecute = FileExitCmdExecute + end + end + object FileImages: TImageList + Height = 17 + Width = 17 + Left = 660 + Top = 325 + Bitmap = { + 494C010106000900040011001100FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000440000002200000001002000000000002024 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000084000000840000008400000084000000840000000000 + 0000000000000000000000000000000000000000000084000000840000008400 + 0000840000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000FFFF0000FFFF0000FFFF0000FFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000848400840000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008484 + 8400848484008484840084848400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000008484000084 + 8400840000000000000000000000000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000848400008484000084840084000000000000000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000008484000084 + 84000084840084000000FFFFFF00000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000848400008484000084840084000000FFFFFF00FFFF + FF00000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000008484000084 + 84000084840084000000FFFFFF00FFFFFF00FFFFFF0084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000848400008484000084840084000000FFFFFF00FFFF + FF00FFFFFF008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0000000000000000000000 + 0000000000000000000000000000FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000008484000084 + 84000084840084000000FFFFFF00FFFFFF00FFFFFF0084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000008400000000848400008484000084840084000000FFFFFF00FFFF + FF00FFFFFF008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00000000000000 + 000000000000000000000000000000000000FFFFFF0000000000000000000000 + 0000000000000000000000000000000000000000000084000000008484000084 + 84000084840084000000FFFFFF00FFFFFF00FFFFFF0084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000000000008400000000848400008484000084840084000000FFFFFF00FFFF + FF00FFFFFF008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084000000840000008400 + 0000840000008400000084000000840000008400000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000848400008484000084840000848400008484000084 + 8400008484000084840000848400008484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000FFFF00000000000084 + 8400008484000084840000848400008484000084840000848400008484000084 + 8400008484000000000000000000000000000000000000000000000000000000 + 0000840084008400840084008400840084008400840084008400840084008400 + 8400840084008400840084008400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000 + 0000000000000000000000000000848484000000000000000000000000000000 + 000000000000FFFFFF0000FFFF00000000000084840000848400008484000084 + 8400008484000084840000848400008484000084840000848400000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000FFFF0000FFFF0000FFFF000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000848484000000000000000000848484000000 + 0000848484000000000000000000000000000000000000FFFF00FFFFFF0000FF + FF00000000000084840000848400008484000084840000848400008484000084 + 8400008484000084840000848400000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000008400840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000084848400848484008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000848484000000 + 000000000000FFFF000084848400848484000000000000000000000000000000 + 000000000000FFFFFF0000FFFF00FFFFFF0000FFFF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000848484000000 + 0000000000000000000000000000000000000000000000FFFF00FFFFFF0000FF + FF00FFFFFF0000FFFF00FFFFFF0000FFFF0000FFFF00FFFFFF0000FFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000008400840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFF + 0000000000000000000084848400000000000000000000000000000000000000 + 00000000000000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF + FF0000FFFF00FFFFFF0000FFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000084 + 840000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000084848400FFFF0000FFFF000000000000848484008484 + 84000000000000000000000000000000000000000000FFFFFF0000FFFF00FFFF + FF0000FFFF00FFFFFF0000FFFF00FFFFFF00FFFFFF0000FFFF00FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000008400840000000000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00000000000000000000848400000000000000000000FFFF000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000008484 + 8400000000000000000084848400000000000000000000000000000000000000 + 00000000000000FFFF00FFFFFF0000FFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 0000000000000000000000000000000000000000000000000000FFFFFF000000 + 0000000000000000000000000000000000000084840000FFFF00000000000084 + 84000000000000FFFF000084840000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000008400840000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000084840000FFFF000084840000FFFF0000848400000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000840084000000 + 0000000000000000000000000000000000000000000084008400000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF000000000000000000000000000000000000000000000000000084840000FF + FF000084840000FFFF0000FFFF0000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000 + 000000FFFF0000FFFF000084840000FFFF000084840000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008400840084008400840084008400 + 8400840084008400840084008400840084000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FFFF0000848400000000000084 + 840000FFFF00008484000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084008400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000000000FF + FF00008484000000000000000000008484000000000000FFFF00008484000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000084 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000044000000220000000100010000000000980100000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFFC000000000000000C003FFFF + C000000000000000BFF5FFFFC000000000000000000281F80000000000000000 + 7E18F8FBC0000000000000007E1AF87BC0000000000000000003783BC0000000 + 000000007FF5781BC0000000000000007FF5780BC000000000000000800A7803 + C000000000000000C0057803C000000000000000E000F803C000000000000000 + E003F803C000000000000000F003F803C000000000000000F001F803C0000000 + 00000000F801F803C000000000000000FFFFFFFFC000000000000000FFFFFFFF + FFFFFFFFF0000000000FE000F001E001900000000007EDFAEFFAE00110000000 + 0003E000C0016000300000000001EDFADF8C600C700000000000EDFADF8D6018 + 7000000000006DFAC001A03D70000000000FEDFADFFAA02D70000000000FEDFA + E004600470000000000FEDFAF002C00CF0000000000FEDFAF8028001F0000000 + 8FF8EDFAF8002001F0000000FFFCEDFAFC040001F0000000FFBAEDF0FC10600B + F0000000FFC7E005FE322007F0000000FFFFEDF3FFE6800FF0000000FFFFE007 + FFFEFFFFF000000000000000000000000000000000000000000000000000} + end + object PrinterSetupDialog: TPrinterSetupDialog + Left = 625 + Top = 325 + end + object MainMenu1: TMainMenu + Images = FileImages + Left = 625 + Top = 295 + object File1: TMenuItem + Caption = '&File' + object FileOpenCmd1: TMenuItem + Action = FileOpenCmd + end + object N1: TMenuItem + Caption = '-' + end + object PageSetup1: TMenuItem + Action = FilePageSetup + end + object PrinterSetup1: TMenuItem + Action = FilePrinterSetupCmd + end + object PrintPreview1: TMenuItem + Action = FilePrintPreviewCmd + end + object Print1: TMenuItem + Action = FilePrintCmd + end + object N2: TMenuItem + Caption = '-' + end + object Exit1: TMenuItem + Action = FileExitCmd + end + end + end +end diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.pas b/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.pas new file mode 100644 index 00000000..527db97c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/MTestPP.pas @@ -0,0 +1,184 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: MTestPP.pas, released 2000-06-01. + +The Original Code is part of the TestPP project, written by +Morten J. Skovrup for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: MTestPP.pas,v 1.2 2000/11/22 08:37:05 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit MTestPP; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEditHighlighter, SynHighlighterPas, SynEdit, StdCtrls, SynEditPrint, + SynEditPrintTypes, ActnList, ToolWin, ComCtrls, ImgList, Menus; + +type + TForm1 = class(TForm) + SynEdit: TSynEdit; + SynPasSyn: TSynPasSyn; + OpenDialog: TOpenDialog; + PrintDialog: TPrintDialog; + SynEditPrint: TSynEditPrint; + ToolBar1: TToolBar; + ActionList1: TActionList; + FileOpenCmd: TAction; + FilePrinterSetupCmd: TAction; + FilePrintCmd: TAction; + FileExitCmd: TAction; + FileImages: TImageList; + FilePrintPreviewCmd: TAction; + ToolButton1: TToolButton; + ToolButton2: TToolButton; + ToolButton3: TToolButton; + ToolButton4: TToolButton; + ToolButton5: TToolButton; + ToolButton6: TToolButton; + ToolButton7: TToolButton; + PrinterSetupDialog: TPrinterSetupDialog; + MainMenu1: TMainMenu; + File1: TMenuItem; + FileOpenCmd1: TMenuItem; + N1: TMenuItem; + PrinterSetup1: TMenuItem; + PrintPreview1: TMenuItem; + Print1: TMenuItem; + N2: TMenuItem; + Exit1: TMenuItem; + FilePageSetup: TAction; + PageSetup1: TMenuItem; + ToolButton8: TToolButton; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FileOpenCmdExecute(Sender: TObject); + procedure FilePrinterSetupCmdExecute(Sender: TObject); + procedure FilePrintPreviewCmdExecute(Sender: TObject); + procedure FilePrintCmdExecute(Sender: TObject); + procedure FileExitCmdExecute(Sender: TObject); + procedure FilePageSetupExecute(Sender: TObject); + private + { Private declarations } + FCurFile: string; + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses DTestPrintPreview, DPageSetup; + +{$R *.DFM} + +procedure TForm1.FormCreate(Sender: TObject); +var + AFont: TFont; +begin + AFont := TFont.Create; + with SynEditPrint.Header do begin + {First line, default font, left aligned} + Add('This is the first line in the header', nil, taLeftJustify, 1); + {First line, default font, right aligned} + Add('Page: $PAGENUM$ of $PAGECOUNT$', nil, taRightJustify, 1); + {Second line, default font, left aligned} + Add('$TITLE$', nil, taLeftJustify, 2); + AFont.Assign(DefaultFont); + AFont.Size := 6; + {Second line, small font, right aligned - note that lines can have different fonts} + Add('Print Date: $DATE$. Time: $TIME$', AFont, taRightJustify, 2); + end; + with SynEditPrint.Footer do begin + AFont.Assign(DefaultFont); + Add('$PAGENUM$/$PAGECOUNT$', nil, taRightJustify, 1); + AFont.Size := 6; + Add('Printed by John Doe', AFont, taLeftJustify, 1); + end; + AFont.Free; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + SynEditPrint.Free; +end; + +procedure TForm1.FileOpenCmdExecute(Sender: TObject); +begin + OpenDialog.Filter := SynPasSyn.DefaultFilter; + if OpenDialog.Execute then begin + SynEdit.Lines.LoadFromFile(OpenDialog.FileName); + FCurFile := OpenDialog.FileName; + end; +end; + +procedure TForm1.FilePrinterSetupCmdExecute(Sender: TObject); +begin + PrinterSetupDialog.Execute; +end; + +procedure TForm1.FilePrintPreviewCmdExecute(Sender: TObject); +begin + SynEditPrint.SynEdit := SynEdit; + SynEditPrint.Title := FCurFile; + with TestPrintPreviewDlg do begin + SynEditPrintPreview.SynEditPrint := SynEditPrint; + ShowModal; + end; +end; + +procedure TForm1.FilePrintCmdExecute(Sender: TObject); +begin + if PrintDialog.Execute then begin + SynEditPrint.SynEdit := SynEdit; + SynEditPrint.Title := FCurFile; + SynEditPrint.Print; + end; +end; + +procedure TForm1.FileExitCmdExecute(Sender: TObject); +begin + Close; +end; + +procedure TForm1.FilePageSetupExecute(Sender: TObject); +begin + PageSetupDlg.SetValues(SynEditPrint); + if PageSetupDlg.ShowModal = mrOk then + PageSetupDlg.GetValues(SynEditPrint); +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/ReadMe.txt b/Source/VCL/SynEdit/Demos/PrintDemoNew/ReadMe.txt new file mode 100644 index 00000000..04f68206 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/ReadMe.txt @@ -0,0 +1,6 @@ +PrintDemoNew.dpr +---------------- + +- Needs Delphi 5 or higher. +- Demonstrates the new component for printing and print preview. + diff --git a/Source/VCL/SynEdit/Demos/PrintDemoNew/TestPP.dpr b/Source/VCL/SynEdit/Demos/PrintDemoNew/TestPP.dpr new file mode 100644 index 00000000..09f339ee --- /dev/null +++ b/Source/VCL/SynEdit/Demos/PrintDemoNew/TestPP.dpr @@ -0,0 +1,53 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: TestPP.dpr, released 2000-06-01. + +The Original Code is part of the TestPP project, written by +Morten J. Skovrup for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: TestPP.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program TestPP; + +uses + Forms, + MTestPP in 'MTestPP.pas' {Form1}, + DTestPrintPreview in 'DTestPrintPreview.pas' {TestPrintPreviewDlg}, + DPageSetup in 'DPageSetup.pas' {PageSetupDlg}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TTestPrintPreviewDlg, TestPrintPreviewDlg); + Application.CreateForm(TPageSetupDlg, PageSetupDlg); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/ReadMe.txt b/Source/VCL/SynEdit/Demos/ReadMe.txt new file mode 100644 index 00000000..7c3ad15e --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ReadMe.txt @@ -0,0 +1,8 @@ +SynEdit demo apps +----------------- + +There a some demo apps to show how to use different components of the SynEdit +component suite. Each folder has a ReadMe.txt file where the minimum version of +Delphi needed to compile the project can be found. Sorry, there are no BCB +projects, but it should be possible to create new projects with BCB, remove the +automatically created main form, and add the form from the sample folder. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Demos/ScanTokensDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/ScanTokensDemo/ReadMe.txt new file mode 100644 index 00000000..3aaa462c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ScanTokensDemo/ReadMe.txt @@ -0,0 +1,12 @@ +ScanTokensDemo.dpr +------------------ + +- Needs Delphi 4 or higher, but it can be compiled under Delphi 2 if all the + errors when opening the form are ignored. + +- Demonstrates how to scan a source text for various tokens. This is done in + a background thread, to keep the UI as responsive as possible. Changing the + editor text triggers the thread to process the new text. In an application + the OnChange event should only disable and re-enable a timer, with the + OnTimer event handler getting the background thread to start its work. + diff --git a/Source/VCL/SynEdit/Demos/ScanTokensDemo/ScanTokensDemo.dpr b/Source/VCL/SynEdit/Demos/ScanTokensDemo/ScanTokensDemo.dpr new file mode 100644 index 00000000..c4ff46aa --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ScanTokensDemo/ScanTokensDemo.dpr @@ -0,0 +1,50 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: ScanTokensDemo.dpr, released 2000-07-06. + +The Original Code is part of the ScanTokensDemo project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: ScanTokensDemo.dpr,v 1.1.1.1 2000/07/08 15:54:07 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program ScanTokensDemo; + +uses + Forms, + frmMain in 'frmMain.pas' {ScanThreadForm}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TScanThreadForm, ScanThreadForm); + Application.Run; +end. + diff --git a/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.dfm b/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.dfm new file mode 100644 index 00000000..ef12f05a --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.dfm @@ -0,0 +1,105 @@ +object ScanThreadForm: TScanThreadForm + Left = 262 + Top = 150 + Width = 696 + Height = 480 + Caption = 'Scan for Pascal keywords' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object Splitter1: TSplitter + Left = 0 + Top = 285 + Width = 688 + Height = 3 + Cursor = crVSplit + Align = alTop + end + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 688 + Height = 285 + Align = alTop + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Highlighter = SynPasSyn1 + OnChange = SynEdit1Change + RemovedKeystrokes = < + item + Command = ecDeleteLastChar + ShortCut = 8200 + end + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecContextHelp + ShortCut = 112 + end> + AddedKeystrokes = <> + end + object StatusBar1: TStatusBar + Left = 0 + Top = 427 + Width = 688 + Height = 19 + Panels = <> + SimplePanel = True + end + object SynEdit2: TSynEdit + Left = 0 + Top = 288 + Width = 688 + Height = 139 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 2 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Highlighter = SynPasSyn1 + RemovedKeystrokes = < + item + Command = ecDeleteLastChar + ShortCut = 8200 + end + item + Command = ecLineBreak + ShortCut = 8205 + end + item + Command = ecContextHelp + ShortCut = 112 + end> + AddedKeystrokes = <> + end + object SynPasSyn1: TSynPasSyn + Left = 72 + Top = 60 + end +end diff --git a/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.pas b/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.pas new file mode 100644 index 00000000..b1f99b75 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/ScanTokensDemo/frmMain.pas @@ -0,0 +1,241 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: frmMain.pas, released 2000-07-06. + +The Original Code is part of the ScanTokensDemo project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: frmMain.pas,v 1.2.2.1 2004/11/10 21:43:57 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit frmMain; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SynEditHighlighter, SynHighlighterPas, StdCtrls, ExtCtrls, SynEdit, + ComCtrls; + +type + TScanThreadForm = class(TForm) + SynEdit1: TSynEdit; + Splitter1: TSplitter; + SynPasSyn1: TSynPasSyn; + StatusBar1: TStatusBar; + SynEdit2: TSynEdit; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure SynEdit1Change(Sender: TObject); + private + fWorkerThread: TThread; + end; + +var + ScanThreadForm: TScanThreadForm; + +implementation + +{$R *.DFM} + +{ TScanKeywordThread } + +type + TScanKeywordThread = class(TThread) + private + fHighlighter: TSynCustomHighlighter; + fKeywords: TStringList; + fLastPercent: integer; + fScanEventHandle: THandle; + fSource: string; + fSourceChanged: boolean; + procedure GetSource; + procedure SetResults; + procedure ShowProgress; + protected + procedure Execute; override; + public + constructor Create; + destructor Destroy; override; + + procedure SetModified; + procedure Shutdown; + end; + +constructor TScanKeywordThread.Create; +begin + inherited Create(TRUE); + fHighlighter := TSynPasSyn.Create(nil); + fKeywords := TStringList.Create; + fScanEventHandle := CreateEvent(nil, FALSE, FALSE, nil); + if (fScanEventHandle = 0) or (fScanEventHandle = INVALID_HANDLE_VALUE) then + raise EOutOfResources.Create('Couldn''t create WIN32 event object'); + Resume; +end; + +destructor TScanKeywordThread.Destroy; +begin + fHighlighter.Free; + fKeywords.Free; + if (fScanEventHandle <> 0) and (fScanEventHandle <> INVALID_HANDLE_VALUE) then + CloseHandle(fScanEventHandle); + inherited Destroy; +end; + +procedure TScanKeywordThread.Execute; +var + i: integer; + s: string; + Percent: integer; +begin + while not Terminated do begin + WaitForSingleObject(fScanEventHandle, INFINITE); + repeat + if Terminated then + break; + // make sure the event is reset when we are still in the repeat loop + ResetEvent(fScanEventHandle); + // get the modified source and set fSourceChanged to 0 + Synchronize(GetSource); + if Terminated then + break; + // clear keyword list + fKeywords.Clear; + fLastPercent := 0; + // scan the source text for the keywords, cancel if the source in the + // editor has been changed again + fHighlighter.ResetRange; + fHighlighter.SetLine(fSource, 1); + while not fSourceChanged and not fHighlighter.GetEol do begin + if fHighlighter.GetTokenKind = Ord(SynHighlighterPas.tkKey) then begin + s := fHighlighter.GetToken; + with fKeywords do begin + i := IndexOf(s); + if i = -1 then + AddObject(s, pointer(1)) + else + Objects[i] := pointer(integer(Objects[i]) + 1); + end; + end; + // show progress (and burn some cycles ;-) + Percent := MulDiv(100, fHighlighter.GetTokenPos, Length(fSource)); + if fLastPercent <> Percent then begin + fLastPercent := Percent; + Sleep(10); + Synchronize(ShowProgress); + end; + fHighlighter.Next; + end; + until not fSourceChanged; + + if Terminated then + break; + // source was changed while scanning + if fSourceChanged then begin + Sleep(100); + continue; + end; + + fLastPercent := 100; + Synchronize(ShowProgress); + + fKeywords.Sort; + for i := 0 to fKeywords.Count - 1 do begin + fKeywords[i] := fKeywords[i] + ': ' + + IntToStr(integer(fKeywords.Objects[i])); + end; + Synchronize(SetResults); + // and go to sleep again + end; +end; + +procedure TScanKeywordThread.GetSource; +begin + if ScanThreadForm <> nil then + fSource := ScanThreadForm.SynEdit1.Text + else + fSource := ''; + fSourceChanged := FALSE; +end; + +procedure TScanKeywordThread.SetModified; +begin + fSourceChanged := TRUE; + if (fScanEventHandle <> 0) and (fScanEventHandle <> INVALID_HANDLE_VALUE) then + SetEvent(fScanEventHandle); +end; + +procedure TScanKeywordThread.SetResults; +begin + if ScanThreadForm <> nil then + ScanThreadForm.SynEdit2.Lines.Assign(fKeywords); +end; + +procedure TScanKeywordThread.ShowProgress; +begin + if ScanThreadForm <> nil then + ScanThreadForm.StatusBar1.SimpleText := Format('%d %% done', [fLastPercent]); +end; + +procedure TScanKeywordThread.Shutdown; +begin + Terminate; + if (fScanEventHandle <> 0) and (fScanEventHandle <> INVALID_HANDLE_VALUE) then + SetEvent(fScanEventHandle); +end; + +{ TScanThreadForm } + +procedure TScanThreadForm.FormCreate(Sender: TObject); +begin + fWorkerThread := TScanKeywordThread.Create; + if FileExists('Windows.pas') then + SynEdit1.Lines.LoadFromFile('Windows.pas'); + TScanKeywordThread(fWorkerThread).SetModified; +end; + +procedure TScanThreadForm.FormDestroy(Sender: TObject); +begin + ScanThreadForm := nil; + if fWorkerThread <> nil then + TScanKeywordThread(fWorkerThread).Shutdown; +end; + +procedure TScanThreadForm.SynEdit1Change(Sender: TObject); +begin + SynEdit2.ClearAll; + if fWorkerThread <> nil then + TScanKeywordThread(fWorkerThread).SetModified; +end; + +end. + + \ No newline at end of file diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ActionGlyphs.bmp b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ActionGlyphs.bmp new file mode 100644 index 00000000..ce8ef5a5 Binary files /dev/null and b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ActionGlyphs.bmp differ diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/GutterGlyphs.bmp b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/GutterGlyphs.bmp new file mode 100644 index 00000000..4d87f05a Binary files /dev/null and b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/GutterGlyphs.bmp differ diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ReadMe.txt new file mode 100644 index 00000000..e1ca81e9 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/ReadMe.txt @@ -0,0 +1,8 @@ +SimpleIDEDemo.dpr +----------------- + +- Needs Delphi 4 or higher. +- Demonstrates how to highlight breakpoint or current lines in different colors + (as seen in the Delphi IDE). Shows how to draw into the gutter without using + marker objects, using a SynEdit plugin. + diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/SimpleIDEDemo.dpr b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/SimpleIDEDemo.dpr new file mode 100644 index 00000000..2f82ba4a --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/SimpleIDEDemo.dpr @@ -0,0 +1,50 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: SimpleIDEDemo.dpr, released 2000-11-11. + +The Original Code is part of the SimpleIDEDemo project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: SimpleIDEDemo.dpr,v 1.2 2000/11/11 19:12:59 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +program SimpleIDEDemo; + +uses + Forms, + frmMain in 'frmMain.pas' {SimpleIDEMainForm}, + uSimpleIDEDebugger in 'uSimpleIDEDebugger.pas'; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TSimpleIDEMainForm, SimpleIDEMainForm); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.dfm b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.dfm new file mode 100644 index 00000000..5694e66a --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.dfm @@ -0,0 +1,661 @@ +object SimpleIDEMainForm: TSimpleIDEMainForm + Left = 108 + Top = 107 + Caption = 'Simple IDE Demo' + ClientHeight = 354 + ClientWidth = 490 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Menu = MainMenu + OldCreateOrder = False + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object ToolBarDebug: TToolBar + Left = 0 + Top = 0 + Width = 490 + Height = 30 + AutoSize = True + BorderWidth = 2 + Caption = 'Debug' + Images = ImageListActions + TabOrder = 0 + object ToolButtonRun: TToolButton + Left = 0 + Top = 0 + Action = ActionDebugRun + end + object ToolButtonStep: TToolButton + Left = 23 + Top = 0 + Action = ActionDebugStep + end + object ToolButtonGotoCursor: TToolButton + Left = 46 + Top = 0 + Action = ActionDebugGotoCursor + end + object ToolButtonPause: TToolButton + Left = 69 + Top = 0 + Action = ActionDebugPause + end + object ToolButtonStop: TToolButton + Left = 92 + Top = 0 + Action = ActionDebugStop + end + object ToolButtonSeparator: TToolButton + Left = 115 + Top = 0 + Width = 8 + Caption = 'ToolButtonSeparator' + ImageIndex = 5 + Style = tbsSeparator + end + object ToolButtonToggleBreakpoint: TToolButton + Left = 123 + Top = 0 + Action = ActionToggleBreakpoint + end + object ToolButtonClearAllBreakpoints: TToolButton + Left = 146 + Top = 0 + Action = ActionClearAllBreakpoints + end + end + object SynEditor: TSynEdit + Left = 0 + Top = 30 + Width = 490 + Height = 305 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 1 + CodeFolding.CollapsedLineColor = clGrayText + CodeFolding.FolderBarLinesColor = clGrayText + CodeFolding.ShowCollapsedLine = True + CodeFolding.IndentGuidesColor = clGray + CodeFolding.IndentGuides = True + UseCodeFolding = False + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Highlighter = SynPasSyn + Options = [eoAutoIndent, eoKeepCaretX, eoScrollByOneLess, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces] + ReadOnly = True + OnGutterClick = SynEditorGutterClick + OnSpecialLineColors = SynEditorSpecialLineColors + FontSmoothing = fsmNone + end + object Statusbar: TStatusBar + Left = 0 + Top = 335 + Width = 490 + Height = 19 + Panels = <> + SimplePanel = True + SimpleText = ' Ready' + end + object ImageListActions: TImageList + Left = 100 + Top = 156 + Bitmap = { + 494C010107000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000002000000001002000000000000020 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 8400848484000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000840000008400000084000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 8400000084000000000000000000FFFFFF00FFFFFF008484840000008400FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF00848484008400 + 0000840000008400000084000000840000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 84000000840084848400FFFFFF00FFFFFF00848484000000840084848400FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00000084008484840084848400FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00000000000000000000000000000000000000000000000000FFFF + FF00000084000000840084848400FFFFFF000000840000008400FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FF000000FF00000000008400000084008484840084848400848484000000 + 0000000000008400000000008400848484000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000FFFFFF00FFFF + FF008484840000008400000084000000840000008400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0084848400000084000000840084848400848484000000 + 000000000000840000000000840084848400000000000000000000000000FFFF + FF00FFFFFF0000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0000000000000000000000000000000000FFFFFF00FFFFFF00FFFF + FF000000000000008400000084000000840000000000FFFFFF0000000000FFFF + FF0000000000FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000000084000000840084848400848484000000 + 0000000084000000840084848400000000000000000000000000FFFFFF00FFFF + FF000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 0000FFFFFF0000000000000000000000000000000000FFFFFF00000000008484 + 84000000840000008400000084000000840084848400FFFFFF0000000000FFFF + FF0000000000FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00848484000000840000008400848484008484 + 8400000084000000840000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 0000FFFFFF0000000000000000000000000000000000FFFFFF00000084000000 + 840000008400848484000000000000008400000084008484840000000000FFFF + FF0000000000FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF0000000000840000008400000084000000 + 8400000084008400000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 0000FFFFFF00000000000000000000000000000000000000000000000000FFFF + FF0000000000FFFFFF0000000000FFFFFF00000084000000840084848400FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008484840000008400000084000000 + 8400848484008400000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 0000FFFFFF00000000000000000000000000000000000000000000000000FFFF + FF0000000000FFFFFF0000000000FFFFFF000000000000008400000084008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FF000000FF00 + 0000FF000000FFFFFF0084848400848484000000840000008400000084000000 + 8400848484008400000000000000000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF0000000000FFFFFF00000000000000000000000000FFFFFF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF000000840000008400FFFFFF00FFFFFF00848484000000 + 8400000084008484840084848400000000000000000000000000000000000000 + 00000000000000000000FFFFFF0000000000FFFFFF0000000000FFFFFF000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FF0000000000FFFFFF0000000000FFFFFF000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484008484 + 8400000084000000840084848400000000000000000000000000000000000000 + 000000000000000000000000000000000000FFFFFF0000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 0000000000000000840000008400848484000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000840000008400000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484008400 + 0000FF0000000000000084000000FF00000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF00848484008400 + 0000840000008400000084000000840000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF0084848400FF00 + 00008400000000000000FF0000008400000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484008400 + 0000FF0000000000000084000000FF00000084848400FFFFFF00FFFFFF00FFFF + FF00FF000000FF000000FF000000FF000000FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FF000000FF000000FF000000FF000000FFFFFF00FFFFFF0084848400FF00 + 00008400000000000000FF0000008400000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484008400 + 0000FF0000000000000084000000FF00000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008400000084000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF0084848400FF00 + 00008400000000000000FF0000008400000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000840000008400000084000000840000000000000000000000000000008400 + 0000840000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484008400 + 0000FF0000000000000084000000FF00000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000008400000084000000840000008400 + 0000840000008400000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FF00 + 0000FF000000FF000000FF000000FF000000FF000000FFFFFF00848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000008400 + 0000840000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FF000000FF00 + 0000FF000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FF000000FF00 + 0000FF000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000008400000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000000000000000000000000000000000000084000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000840000008484840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000084848400FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00848484000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 0000000000000000000000000000000000000000000084848400840000008400 + 0000840000008400000084000000840000008400000084000000840000008400 + 0000848484000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000008484840084848400848484008484 + 8400848484008484840084848400848484008484840084848400848484000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000200000000100010000000000000100000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFFFFFF0000001FFFFFEFFF0000 + 001BF807E40300000011F807E40300000000F003C0010000001BE003C0010000 + 0018E003800100000018C0030001000000118003000100000003880300010000 + 0003F803800300000003F803C00700000003F807C00F00000001F80FC03F0000 + 0001FC1FE0FF00000018FE7FF3FF0000FFFFFFFFFFFFFFFF001FFFFFFFFF001F + 001BF27FFE73001F0011E73FFCF900040000E73FFCF90004001BE73FFCF90004 + 001BE73FFCF90004001BCF9BF9FC0004001BE731ECF90004001BE720E4F90004 + 001BE73B00F9001F001BE73BE4F9001F001BF27BEE73001F001BFFFBFFFF001F + 001FBFF3FFFF001F001F8007FFFF001F00000000000000000000000000000000 + 000000000000} + end + object ActionListMain: TActionList + Images = ImageListActions + Left = 104 + Top = 100 + object ActionDebugRun: TAction + Category = 'Debug' + Caption = 'Run' + ImageIndex = 0 + ShortCut = 120 + OnExecute = ActionDebugRunExecute + OnUpdate = ActionDebugRunUpdate + end + object ActionDebugStep: TAction + Category = 'Debug' + Caption = 'Step' + ImageIndex = 1 + ShortCut = 119 + OnExecute = ActionDebugStepExecute + OnUpdate = ActionDebugStepUpdate + end + object ActionDebugGotoCursor: TAction + Category = 'Debug' + Caption = 'Goto Cursor' + ImageIndex = 2 + ShortCut = 115 + OnExecute = ActionDebugGotoCursorExecute + OnUpdate = ActionDebugGotoCursorUpdate + end + object ActionDebugPause: TAction + Category = 'Debug' + Caption = 'Pause' + ImageIndex = 3 + ShortCut = 27 + OnExecute = ActionDebugPauseExecute + OnUpdate = ActionDebugPauseUpdate + end + object ActionDebugStop: TAction + Category = 'Debug' + Caption = 'Stop' + ImageIndex = 4 + ShortCut = 16497 + OnExecute = ActionDebugStopExecute + OnUpdate = ActionDebugStopUpdate + end + object ActionToggleBreakpoint: TAction + Category = 'Debug' + Caption = 'Toggle Breakpoint' + ImageIndex = 5 + ShortCut = 16503 + OnExecute = ActionToggleBreakpointExecute + OnUpdate = ActionToggleBreakpointUpdate + end + object ActionClearAllBreakpoints: TAction + Category = 'Debug' + Caption = 'Clear All Breakpoints' + ImageIndex = 6 + ShortCut = 24695 + OnExecute = ActionClearAllBreakpointsExecute + OnUpdate = ActionClearAllBreakpointsUpdate + end + end + object SynPasSyn: TSynPasSyn + Options.AutoDetectEnabled = False + Options.AutoDetectLineLimit = 0 + Options.Visible = False + Left = 172 + Top = 100 + end + object ImageListGutterGlyphs: TImageList + Height = 14 + Width = 11 + Left = 224 + Top = 156 + Bitmap = { + 494C01010600090004000B000E00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 00000000000036000000280000002C0000001C00000001002000000000004013 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000FF000000FF000000FF000000FF000000 + FF0000000000000000000000000000000000000000000000000084848400C6C6 + C60084848400C6C6C60084848400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000FF0000FF + FF000000FF000000FF000000FF0000FFFF000000FF0000000000000000000000 + 00000000000084848400C6C6C60084848400C6C6C60084848400C6C6C6008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000FF0000FFFF0000FFFF000000FF0000FFFF0000FF + FF000000FF0000000000000000000000000000000000C6C6C60084848400C6C6 + C60084848400C6C6C60084848400C6C6C6000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000FF000000 + FF0000FFFF0000FFFF0000FFFF000000FF000000FF0000000000000000000000 + 00000000000084848400C6C6C60084848400C6C6C60084848400C6C6C6008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000FF0000FFFF0000FFFF000000FF0000FFFF0000FF + FF000000FF0000000000000000000000000000000000C6C6C60084848400C6C6 + C60084848400C6C6C60084848400C6C6C6000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000FF0000FF + FF000000FF000000FF000000FF0000FFFF000000FF0000000000000000000000 + 00000000000084848400C6C6C60084848400C6C6C60084848400C6C6C6008484 + 8400000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000FF000000FF000000FF000000FF000000 + FF0000000000000000000000000000000000000000000000000084848400C6C6 + C60084848400C6C6C60084848400000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000840000008400000000000000000000000000 + 0000000000000000000000000000000000000000000084848400840000008400 + 0000848484008484840000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000FF0000008400000000000000000000000000000000000000000000000000 + 0000848484000000FF0084000000FF000000840000000000FF00848484000000 + 0000000000000000000000000000000000000000FF0000FF00000000FF000000 + FF000000FF000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000084000000840000008400000084000000FF000000FF000000840000000000 + 000000000000000000000000000084000000840000008400000084000000FF00 + 0000FF000000840000000000FF00848484000000000000000000000000000000 + FF0000FF000000FF000000FF00000000FF000000FF000000FF00000000000000 + 0000000000000000000000000000000000000000000084000000840000000000 + 00000000000000000000000000000000000084000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000840000000000000000000000000000008400 + 0000FF000000FF000000FF000000FF000000FF000000FF000000840000008484 + 840000000000000000000000000000FF000000FF00000000FF0000FF00000000 + FF000000FF000000FF0000000000000000000000000000000000000000000000 + 000084000000FF000000FF000000840000000000000000000000000000000000 + 000084000000FF000000FF000000FF000000FF000000FF000000FF000000FF00 + 000084000000000000000000000084000000FF000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000840000000000000000000000000000000000 + FF000000FF000000FF0000FF000000FF00000000FF000000FF00000000000000 + 000000000000000000000000000000000000FFFF0000FF000000FF0000008400 + 0000000000000000000000000000000000008400000084840000FFFF00008484 + 0000FFFF0000FF000000FF000000840000000000000000000000000000008400 + 000084840000FFFF000084840000FFFF0000FF000000FF000000840000008484 + 84000000000000000000000000000000FF000000FF000000FF000000FF0000FF + 00000000FF000000FF0000000000000000000000000000000000000000000000 + 000000000000FFFF000084000000000000000000000000000000000000000000 + 00008400000084000000840000008400000084840000FFFF0000840000000000 + 0000000000000000000000000000840000008400000084000000840000008484 + 0000FFFF0000840000000000FF00848484000000000000000000000000000000 + FF000000FF000000FF000000FF0000FF000000FF00000000FF00000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000FFFF00008400000000000000000000000000000000000000000000000000 + 0000848484000000FF0084000000FFFF0000840000000000FF00848484000000 + 0000000000000000000000000000000000000000FF000000FF000000FF000000 + FF0000FF00000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000840000008400000000000000000000000000 + 0000000000000000000000000000000000000000000084848400840000008400 + 0000848484008484840000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000FF000000FF0000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000008400 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000084000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 280000002C0000001C0000000100010000000000E00000000000000000000000 + 000000000000000000000000FFFFFF00FFFFFC0000000000FFFFFC0000000000 + E0FC1C0000000000C0780C000000000080300400000000008030040000000000 + 803004000000000080300400000000008030040000000000C0780C0000000000 + E0FC1C0000000000FFFFFC0000000000FFFFFC0000000000FFFFFC0000000000 + FFFFFFFFFFF00000FFFEFFDFFFF00000FFFE7F83F0700000FFFE3F01E0300000 + FFF01E00C0100000F9F00E00C0100000F0F00600C0100000F0F00E00C0100000 + F9F01E00C0100000FFFE3F01E0300000FFFE7F83F0100000FFFEFFDFFF300000 + FFFFFFFFFFF00000FFFFFFFFFFF0000000000000000000000000000000000000 + 000000000000} + end + object MainMenu: TMainMenu + Left = 36 + Top = 100 + object MenuItemDebug: TMenuItem + Caption = '&Debug' + object miDebugRun: TMenuItem + Action = ActionDebugRun + end + object miDebugStep: TMenuItem + Action = ActionDebugStep + end + object miDebugGotoCursor: TMenuItem + Action = ActionDebugGotoCursor + end + object miDebugPause: TMenuItem + Action = ActionDebugPause + end + object miDebugStop: TMenuItem + Action = ActionDebugStop + end + object N1: TMenuItem + Caption = '-' + end + object miToggleBreakpoint: TMenuItem + Action = ActionToggleBreakpoint + end + object miClearBreakpoints: TMenuItem + Action = ActionClearAllBreakpoints + end + end + end +end diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.pas b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.pas new file mode 100644 index 00000000..65a0b2de --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/frmMain.pas @@ -0,0 +1,402 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: frmMain.pas, released 2000-11-11. + +The Original Code is part of the SimpleIDEDemo project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: frmMain.pas,v 1.7 2004/04/24 17:04:54 markonjezic Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit frmMain; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + ActnList, ImgList, ComCtrls, ToolWin, SynEdit, SynEditHighlighter, + SynHighlighterPas, uSimpleIDEDebugger, Menus, SynEditTypes, System.Actions; + +type + TSimpleIDEMainForm = class(TForm) + ActionClearAllBreakpoints: TAction; + ActionDebugGotoCursor: TAction; + ActionDebugPause: TAction; + ActionDebugRun: TAction; + ActionDebugStep: TAction; + ActionDebugStop: TAction; + ActionListMain: TActionList; + ActionToggleBreakpoint: TAction; + ImageListActions: TImageList; + ImageListGutterGlyphs: TImageList; + MainMenu: TMainMenu; + MenuItemDebug: TMenuItem; + miClearBreakpoints: TMenuItem; + miDebugGotoCursor: TMenuItem; + miDebugPause: TMenuItem; + miDebugRun: TMenuItem; + miDebugStep: TMenuItem; + miDebugStop: TMenuItem; + miToggleBreakpoint: TMenuItem; + N1: TMenuItem; + Statusbar: TStatusBar; + SynEditor: TSynEdit; + SynPasSyn: TSynPasSyn; + ToolBarDebug: TToolBar; + ToolButtonClearAllBreakpoints: TToolButton; + ToolButtonGotoCursor: TToolButton; + ToolButtonPause: TToolButton; + ToolButtonRun: TToolButton; + ToolButtonStep: TToolButton; + ToolButtonStop: TToolButton; + ToolButtonToggleBreakpoint: TToolButton; + ToolButtonSeparator: TToolButton; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure SynEditorSpecialLineColors(Sender: TObject; Line: Integer; + var Special: Boolean; var FG, BG: TColor); + procedure ActionDebugRunExecute(Sender: TObject); + procedure ActionDebugRunUpdate(Sender: TObject); + procedure ActionDebugStepExecute(Sender: TObject); + procedure ActionDebugStepUpdate(Sender: TObject); + procedure ActionDebugGotoCursorExecute(Sender: TObject); + procedure ActionDebugGotoCursorUpdate(Sender: TObject); + procedure ActionDebugPauseExecute(Sender: TObject); + procedure ActionDebugPauseUpdate(Sender: TObject); + procedure ActionDebugStopExecute(Sender: TObject); + procedure ActionDebugStopUpdate(Sender: TObject); + procedure ActionToggleBreakpointExecute(Sender: TObject); + procedure ActionToggleBreakpointUpdate(Sender: TObject); + procedure ActionClearAllBreakpointsExecute(Sender: TObject); + procedure ActionClearAllBreakpointsUpdate(Sender: TObject); + procedure SynEditorGutterClick(Sender: TObject; Button: TMouseButton; + X, Y, Line: Integer; Mark: TSynEditMark); + private + FCurrentLine: integer; + FDebugger: TSampleDebugger; + procedure DebuggerBreakpointChange(Sender: TObject; ALine: integer); + procedure DebuggerCurrentLineChange(Sender: TObject); + procedure DebuggerStateChange(Sender: TObject; OldState, + NewState: TDebuggerState); + procedure DebuggerYield(Sender: TObject); + procedure PaintGutterGlyphs(ACanvas: TCanvas; AClip: TRect; + FirstLine, LastLine: integer); + procedure SetCurrentLine(ALine: integer); + end; + +var + SimpleIDEMainForm: TSimpleIDEMainForm; + +implementation + +{$R *.DFM} + +{ TGutterMarkDrawPlugin } + +type + TDebugSupportPlugin = class(TSynEditPlugin) + protected + fForm: TSimpleIDEMainForm; + procedure AfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: integer); override; + procedure LinesInserted(FirstLine, Count: integer); override; + procedure LinesDeleted(FirstLine, Count: integer); override; + public + constructor Create(AForm: TSimpleIDEMainForm); + end; + +constructor TDebugSupportPlugin.Create(AForm: TSimpleIDEMainForm); +begin + inherited Create(AForm.SynEditor); + fForm := AForm; +end; + +procedure TDebugSupportPlugin.AfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: integer); +begin + fForm.PaintGutterGlyphs(ACanvas, AClip, FirstLine, LastLine); +end; + +procedure TDebugSupportPlugin.LinesInserted(FirstLine, Count: integer); +begin +// Note: You will need this event if you want to track the changes to +// breakpoints in "Real World" apps, where the editor is not read-only +end; + +procedure TDebugSupportPlugin.LinesDeleted(FirstLine, Count: integer); +begin +// Note: You will need this event if you want to track the changes to +// breakpoints in "Real World" apps, where the editor is not read-only +end; + +{ TSimpleIDEMainForm } + +procedure TSimpleIDEMainForm.FormCreate(Sender: TObject); +var + Settings: TStringList; +begin + FCurrentLine := -1; + FDebugger := TSampleDebugger.Create; + with FDebugger do begin + OnBreakpointChange := DebuggerBreakpointChange; + OnCurrentLineChange := DebuggerCurrentLineChange; + OnStateChange := DebuggerStateChange; + OnYield := DebuggerYield; + end; + + TDebugSupportPlugin.Create(Self); + + Settings := TStringList.Create; + try + SynPasSyn.EnumUserSettings(Settings); + if Settings.Count > 0 then + SynPasSyn.UseUserSettings(Settings.Count - 1); + finally + Settings.Free; + end; + SynEditor.Text := SampleSource; +end; + +procedure TSimpleIDEMainForm.FormDestroy(Sender: TObject); +begin + FDebugger.Free; +end; + +procedure TSimpleIDEMainForm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + if FDebugger.IsRunning then begin + FDebugger.Stop; + CanClose := FALSE; + end; +end; + +procedure TSimpleIDEMainForm.SynEditorSpecialLineColors(Sender: TObject; + Line: Integer; var Special: Boolean; var FG, BG: TColor); +var + LI: TDebuggerLineInfos; +begin + if FDebugger <> nil then begin + LI := FDebugger.GetLineInfos(Line); + if dlCurrentLine in LI then begin + Special := TRUE; + FG := clWhite; + BG := clBlue; + end else if dlBreakpointLine in LI then begin + Special := TRUE; + FG := clWhite; + if dlExecutableLine in LI then + BG := clRed + else + BG := clGray; + end; + end; +end; + +procedure TSimpleIDEMainForm.DebuggerBreakpointChange(Sender: TObject; + ALine: integer); +begin + if (ALine >= 1) and (ALine <= SynEditor.Lines.Count) then + begin + SynEditor.InvalidateGutterLine(ALine); + SynEditor.InvalidateLine(ALine); + end + else + SynEditor.Invalidate; +end; + +procedure TSimpleIDEMainForm.DebuggerCurrentLineChange(Sender: TObject); +begin + if (FDebugger <> nil) and not FDebugger.IsRunning then + SetCurrentLine(FDebugger.CurrentLine) + else + SetCurrentLine(-1); +end; + +procedure TSimpleIDEMainForm.DebuggerStateChange(Sender: TObject; OldState, + NewState: TDebuggerState); +var + s: string; +begin + case NewState of + dsRunning: s := 'Program is running'; + dsPaused: s := 'Program is paused'; + else + s := 'Ready'; + end; + Statusbar.SimpleText := ' ' + s; +end; + +procedure TSimpleIDEMainForm.DebuggerYield(Sender: TObject); +begin + UpdateActions; + Application.ProcessMessages; +end; + +procedure TSimpleIDEMainForm.PaintGutterGlyphs(ACanvas: TCanvas; AClip: TRect; + FirstLine, LastLine: integer); +var + LH, X, Y: integer; + LI: TDebuggerLineInfos; + ImgIndex: integer; +begin + if FDebugger <> nil then + begin + FirstLine := SynEditor.RowToLine(FirstLine); + LastLine := SynEditor.RowToLine(LastLine); + X := 14; + LH := SynEditor.LineHeight; + while FirstLine <= LastLine do + begin + Y := (LH - ImageListGutterGlyphs.Height) div 2 + + LH * (SynEditor.LineToRow(FirstLine) - SynEditor.TopLine); + LI := FDebugger.GetLineInfos(FirstLine); + if dlCurrentLine in LI then begin + if dlBreakpointLine in LI then + ImgIndex := 2 + else + ImgIndex := 1; + end else if dlExecutableLine in LI then begin + if dlBreakpointLine in LI then + ImgIndex := 3 + else + ImgIndex := 0; + end else begin + if dlBreakpointLine in LI then + ImgIndex := 4 + else + ImgIndex := -1; + end; + if ImgIndex >= 0 then + ImageListGutterGlyphs.Draw(ACanvas, X, Y, ImgIndex); + Inc(FirstLine); + end; + end; +end; + +procedure TSimpleIDEMainForm.SetCurrentLine(ALine: integer); +begin + if FCurrentLine <> ALine then + begin + SynEditor.InvalidateGutterLine(FCurrentLine); + SynEditor.InvalidateLine(FCurrentLine); + FCurrentLine := ALine; + if (FCurrentLine > 0) and (SynEditor.CaretY <> FCurrentLine) then + SynEditor.CaretXY := BufferCoord(1, FCurrentLine); + SynEditor.InvalidateGutterLine(FCurrentLine); + SynEditor.InvalidateLine(FCurrentLine); + end; +end; + +procedure TSimpleIDEMainForm.ActionDebugRunExecute(Sender: TObject); +begin + FDebugger.Run; +end; + +procedure TSimpleIDEMainForm.ActionDebugRunUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) and FDebugger.CanRun; +end; + +procedure TSimpleIDEMainForm.ActionDebugStepExecute(Sender: TObject); +begin + FDebugger.Step; +end; + +procedure TSimpleIDEMainForm.ActionDebugStepUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) and FDebugger.CanStep; +end; + +procedure TSimpleIDEMainForm.ActionDebugGotoCursorExecute(Sender: TObject); +begin + FDebugger.GotoCursor(SynEditor.CaretY); +end; + +procedure TSimpleIDEMainForm.ActionDebugGotoCursorUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) + and FDebugger.CanGotoCursor(SynEditor.CaretY); +end; + +procedure TSimpleIDEMainForm.ActionDebugPauseExecute(Sender: TObject); +begin + FDebugger.Pause; +end; + +procedure TSimpleIDEMainForm.ActionDebugPauseUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) and FDebugger.CanPause; +end; + +procedure TSimpleIDEMainForm.ActionDebugStopExecute(Sender: TObject); +begin + FDebugger.Stop; +end; + +procedure TSimpleIDEMainForm.ActionDebugStopUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) and FDebugger.CanStop; +end; + +procedure TSimpleIDEMainForm.ActionToggleBreakpointExecute(Sender: TObject); +begin + FDebugger.ToggleBreakpoint(SynEditor.CaretY); +end; + +procedure TSimpleIDEMainForm.ActionToggleBreakpointUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := FDebugger <> nil; +end; + +procedure TSimpleIDEMainForm.ActionClearAllBreakpointsExecute( + Sender: TObject); +begin + FDebugger.ClearAllBreakpoints; +end; + +procedure TSimpleIDEMainForm.ActionClearAllBreakpointsUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := (FDebugger <> nil) + and FDebugger.HasBreakpoints; +end; + +procedure TSimpleIDEMainForm.SynEditorGutterClick(Sender: TObject; + Button: TMouseButton; X, Y, Line: Integer; Mark: TSynEditMark); +begin + if FDebugger <> nil then + FDebugger.ToggleBreakpoint(SynEditor.RowToLine(Line)); +end; + +end. + + diff --git a/Source/VCL/SynEdit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas new file mode 100644 index 00000000..713b0dff --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas @@ -0,0 +1,368 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: uSimpleIDEDebugger.pas, released 2000-11-11. + +The Original Code is part of the SimpleIDEDemo project, written by +Michael Hieke for the SynEdit component suite. +All Rights Reserved. + +Contributors to the SynEdit project 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: uSimpleIDEDebugger.pas,v 1.2 2000/11/11 19:12:59 mghie Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit uSimpleIDEDebugger; + +{$I SynEdit.inc} + +interface + +uses + Windows, Classes; + +type + TDebuggerState = (dsStopped, dsRunning, dsPaused); + + TDebuggerLineInfo = (dlCurrentLine, dlBreakpointLine, dlExecutableLine); + TDebuggerLineInfos = set of TDebuggerLineInfo; + + TBreakpointChangeEvent = procedure(Sender: TObject; ALine: integer) of object; + TDebuggerStateChangeEvent = procedure(Sender: TObject; + OldState, NewState: TDebuggerState) of object; + + TSampleDebugger = class(TObject) + private + fBreakpoints: TList; + fCurrentLine: integer; + fDebuggerState: TDebuggerState; + fLineToStop: integer; + fNextInstruction: integer; + fWantedState: TDebuggerState; + fOnBreakpointChange: TBreakpointChangeEvent; + fOnCurrentLineChange: TNotifyEvent; + fOnStateChange: TDebuggerStateChangeEvent; + fOnYield: TNotifyEvent; + function CurrentLineIsBreakpoint: boolean; + procedure DoOnBreakpointChanged(ALine: integer); + procedure DoCurrentLineChanged; + procedure DoStateChange; + procedure DoYield; + public + constructor Create; + destructor Destroy; override; + + function CanGotoCursor(ALine: integer): boolean; + function CanPause: boolean; + function CanRun: boolean; + function CanStep: boolean; + function CanStop: boolean; + procedure ClearAllBreakpoints; + function GetLineInfos(ALine: integer): TDebuggerLineInfos; + procedure GotoCursor(ALine: integer); + function HasBreakpoints: boolean; + function IsBreakpointLine(ALine: integer): boolean; + function IsExecutableLine(ALine: integer): boolean; + function IsRunning: boolean; + procedure Pause; + procedure Run; + procedure Step; + procedure Stop; + procedure ToggleBreakpoint(ALine: integer); + public + property CurrentLine: integer read fCurrentLine; + property OnBreakpointChange: TBreakpointChangeEvent read fOnBreakpointChange + write fOnBreakpointChange; + property OnCurrentLineChange: TNotifyEvent read fOnCurrentLineChange + write fOnCurrentLineChange; + property OnStateChange: TDebuggerStateChangeEvent read fOnStateChange + write fOnStateChange; + property OnYield: TNotifyEvent read fOnYield write fOnYield; + end; + +const + SampleSource = +{ 1 } 'program Test;'#13#10 + +{ 2 } ''#13#10 + +{ 3 } 'procedure TestProc;'#13#10 + +{ 4 } 'begin'#13#10 + +{ 5 } ' DoNothing;'#13#10 + +{ 6 } 'end;'#13#10 + +{ 7 } ''#13#10 + +{ 8 } 'var'#13#10 + +{ 9 } ' i: integer;'#13#10 + +{ 10 } ''#13#10 + +{ 11 } 'begin'#13#10 + +{ 12 } ' while TRUE do'#13#10 + +{ 13 } ' TestProc;'#13#10 + +{ 14 } 'end.'; + +type + TSampleExecutableLine = record + Line: integer; + Delta: integer; // to change the array index + end; + +const + SampleCode: array[0..7] of TSampleExecutableLine = ( + (Line: 11; Delta: 1), (Line: 12; Delta: 1), + (Line: 13; Delta: 1), (Line: 4; Delta: 1), + (Line: 5; Delta: 1), (Line: 6; Delta: -4), + (Line: 14; Delta: 1), (Line: -1; Delta: 0)); + ExecutableLines: array[0..6] of integer = (4, 5, 6, 11, 12, 13, 14); + +implementation + +{ TSampleDebugger } + +constructor TSampleDebugger.Create; +begin + inherited Create; + fBreakpoints := TList.Create; + fCurrentLine := -1; + fDebuggerState := dsStopped; + fNextInstruction := Low(SampleCode); +end; + +destructor TSampleDebugger.Destroy; +begin + fBreakpoints.Free; + inherited Destroy; +end; + +function TSampleDebugger.CanGotoCursor(ALine: integer): boolean; +begin + Result := (fDebuggerState <> dsRunning) and IsExecutableLine(ALine); +end; + +function TSampleDebugger.CanPause: boolean; +begin + Result := fDebuggerState = dsRunning; +end; + +function TSampleDebugger.CanRun: boolean; +begin + Result := fDebuggerState <> dsRunning; +end; + +function TSampleDebugger.CanStep: boolean; +begin + Result := fDebuggerState <> dsRunning; +end; + +function TSampleDebugger.CanStop: boolean; +begin + Result := fDebuggerState <> dsStopped; +end; + +function TSampleDebugger.CurrentLineIsBreakpoint: boolean; +begin + Result := (fCurrentLine = fLineToStop) + or ((fBreakpoints.Count > 0) and IsBreakpointLine(fCurrentLine)); +end; + +procedure TSampleDebugger.DoOnBreakpointChanged(ALine: integer); +begin + if Assigned(fOnBreakpointChange) then + fOnBreakpointChange(Self, ALine); +end; + +procedure TSampleDebugger.DoCurrentLineChanged; +begin + if Assigned(fOnCurrentLineChange) then + fOnCurrentLineChange(Self); +end; + +procedure TSampleDebugger.DoStateChange; +begin + if fDebuggerState <> fWantedState then begin + if fWantedState = dsStopped then + fCurrentLine := -1; + if Assigned(fOnStateChange) then + fOnStateChange(Self, fDebuggerState, fWantedState); + fDebuggerState := fWantedState; + if fWantedState <> dsRunning then + fLineToStop := -1; + DoCurrentLineChanged; + end; +end; + +procedure TSampleDebugger.DoYield; +begin + if Assigned(fOnYield) then + fOnYield(Self); +end; + +procedure TSampleDebugger.ClearAllBreakpoints; +begin + if fBreakpoints.Count > 0 then begin + fBreakpoints.Clear; + DoOnBreakpointChanged(-1); + end; +end; + +function TSampleDebugger.GetLineInfos(ALine: integer): TDebuggerLineInfos; +begin + Result := []; + if ALine > 0 then begin + if ALine = fCurrentLine then + Include(Result, dlCurrentLine); + if IsExecutableLine(ALine) then + Include(Result, dlExecutableLine); + if IsBreakpointLine(ALine) then + Include(Result, dlBreakpointLine); + end; +end; + +procedure TSampleDebugger.GotoCursor(ALine: integer); +begin + fLineToStop := ALine; + Run; +end; + +function TSampleDebugger.HasBreakpoints: boolean; +begin + Result := fBreakpoints.Count > 0; +end; + +function TSampleDebugger.IsBreakpointLine(ALine: integer): boolean; +var + i: integer; +begin + Result := FALSE; + if ALine > 0 then begin + i := fBreakpoints.Count - 1; + while i >= 0 do begin + if integer(fBreakpoints[i]) = ALine then begin + Result := TRUE; + break; + end; + Dec(i); + end; + end; +end; + +function TSampleDebugger.IsExecutableLine(ALine: integer): boolean; +var + i: integer; +begin + Result := FALSE; + if ALine > 0 then begin + i := High(ExecutableLines); + while i >= Low(ExecutableLines) do begin + if ALine = ExecutableLines[i] then begin + Result := TRUE; + break; + end; + Dec(i); + end; + end; +end; + +function TSampleDebugger.IsRunning: boolean; +begin + Result := fDebuggerState = dsRunning; +end; + +procedure TSampleDebugger.Pause; +begin + if fDebuggerState = dsRunning then + fWantedState := dsPaused; +end; + +procedure TSampleDebugger.Run; +var + dwTime: DWORD; +begin + fWantedState := dsRunning; + DoStateChange; + dwTime := GetTickCount + 100; + repeat + if GetTickCount >= dwTime then begin + DoYield; + dwTime := GetTickCount + 100; + end; + Step; + if fWantedState <> fDebuggerState then + DoStateChange; + until fDebuggerState <> dsRunning; + fLineToStop := -1; +end; + +procedure TSampleDebugger.Step; +begin + if fDebuggerState = dsStopped then begin + fNextInstruction := Low(SampleCode); + fCurrentLine := SampleCode[fNextInstruction].Line; + fWantedState := dsPaused; + DoStateChange; + end else begin + Sleep(50); + fNextInstruction := fNextInstruction + SampleCode[fNextInstruction].Delta; + fCurrentLine := SampleCode[fNextInstruction].Line; + case fDebuggerState of + dsRunning: + begin + if CurrentLineIsBreakpoint then + fWantedState := dsPaused; + end; + else + DoCurrentLineChanged; + end; + end; +end; + +procedure TSampleDebugger.Stop; +begin + fWantedState := dsStopped; + DoStateChange; +end; + +procedure TSampleDebugger.ToggleBreakpoint(ALine: integer); +var + SetBP: boolean; + i: integer; +begin + if ALine > 0 then begin + SetBP := TRUE; + for i := 0 to fBreakpoints.Count - 1 do begin + if integer(fBreakpoints[i]) = ALine then begin + fBreakpoints.Delete(i); + SetBP := FALSE; + break; + end else if integer(fBreakpoints[i]) > ALine then begin + fBreakpoints.Insert(i, pointer(ALine)); + SetBP := FALSE; + break; + end; + end; + if SetBP then + fBreakpoints.Add(pointer(ALine)); + DoOnBreakpointChanged(ALine); + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/ReadMe.txt b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/ReadMe.txt new file mode 100644 index 00000000..7e68ea54 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/ReadMe.txt @@ -0,0 +1,5 @@ +SynAutoCorrectDemo.dpr +---------------------- + +- Needs Delphi 2 or higher +- Shows how to use the SynAutoCorrect component. diff --git a/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/SynAutoCorrectDemo.dpr b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/SynAutoCorrectDemo.dpr new file mode 100644 index 00000000..a4b78a8b --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/SynAutoCorrectDemo.dpr @@ -0,0 +1,14 @@ +program SynAutoCorrectDemo; + +uses + Forms, + uDemo in 'uDemo.pas' {frmDemo}; + +{$R *.RES} + +begin + Application.Initialize; + Application.Title := 'Aerodynamica TAsSynAutoCorrect Demo'; + Application.CreateForm(TfrmDemo, frmDemo); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.dfm b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.dfm new file mode 100644 index 00000000..3903b3aa --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.dfm @@ -0,0 +1,637 @@ +object frmDemo: TfrmDemo + Left = 193 + Top = 114 + Width = 561 + Height = 443 + Caption = 'Aerodynamica TSynAutoCorrect 2.0 Demo' + Color = clBtnFace + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + KeyPreview = True + OldCreateOrder = False + OnCreate = FormCreate + OnDestroy = FormDestroy + OnKeyUp = FormKeyUp + OnPaint = FormPaint + OnResize = FormResize + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object pclDemo: TPageControl + Left = 16 + Top = 16 + Width = 521 + Height = 351 + ActivePage = tshOptions + Anchors = [akLeft, akTop, akRight, akBottom] + Images = ilsPages + TabOrder = 0 + object tshOptions: TTabSheet + Caption = '&Options' + OnResize = tshOptionsResize + object pnlOptionsContainer: TPanel + Left = 0 + Top = 0 + Width = 481 + Height = 285 + AutoSize = True + BevelOuter = bvNone + TabOrder = 0 + object lblLabel2: TLabel + Left = 256 + Top = 0 + Width = 40 + Height = 13 + Caption = '&Original:' + end + object lblLabel3: TLabel + Left = 376 + Top = 0 + Width = 59 + Height = 13 + Caption = '&Corrections:' + end + object lblNote: TLabel + Left = 0 + Top = 272 + Width = 313 + Height = 13 + Caption = 'Press Ctrl+Q with the editor focused to auto-correct all.' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [fsBold] + ParentFont = False + end + object chkEnabled: TCheckBox + Left = 0 + Top = 0 + Width = 65 + Height = 17 + Hint = 'Toggles whether auto-correction is enabled.' + Caption = '&Enabled' + Checked = True + State = cbChecked + TabOrder = 0 + OnClick = chkEnabledClick + end + object chkIgnoreCase: TCheckBox + Left = 0 + Top = 16 + Width = 97 + Height = 17 + Hint = + 'Toggles whether the auto-corrections are done case insensitively' + + '.' + Caption = '&Ignore cAsE' + Checked = True + State = cbChecked + TabOrder = 1 + OnClick = chkIgnoreCaseClick + end + object chkMaintainCase: TCheckBox + Left = 0 + Top = 32 + Width = 105 + Height = 17 + Hint = + 'Toggles whether auto-corrections should maintain the case of the' + + ' original string.' + Caption = '&Maintain CASE' + Checked = True + State = cbChecked + TabOrder = 2 + OnClick = chkMaintainCaseClick + end + object chkCorrectOnMouseDown: TCheckBox + Left = 0 + Top = 48 + Width = 153 + Height = 17 + Hint = 'Toggles whether auto-corrections are done on MouseDown.' + Caption = 'Correct on Mo&useDown' + TabOrder = 3 + OnClick = chkCorrectOnMouseDownClick + end + object lbxItems: TListBox + Left = 257 + Top = 16 + Width = 224 + Height = 201 + ItemHeight = 13 + Style = lbOwnerDrawFixed + TabOrder = 4 + OnClick = lbxItemsClick + OnDrawItem = lbxItemsDrawItem + end + object btnAdd: TButton + Left = 256 + Top = 224 + Width = 65 + Height = 23 + Caption = '&Add' + TabOrder = 5 + OnClick = btnAddClick + end + object btnDelete: TButton + Left = 328 + Top = 224 + Width = 65 + Height = 23 + Caption = '&Delete' + Enabled = False + TabOrder = 6 + OnClick = btnDeleteClick + end + object btnEdit: TButton + Left = 400 + Top = 224 + Width = 65 + Height = 23 + Caption = '&Edit' + Enabled = False + TabOrder = 7 + OnClick = btnEditClick + end + object gbxSound: TGroupBox + Left = 0 + Top = 88 + Width = 233 + Height = 105 + Enabled = False + TabOrder = 8 + object lblType: TLabel + Left = 16 + Top = 24 + Width = 28 + Height = 13 + Caption = 'Type:' + Enabled = False + end + object lblFile: TLabel + Left = 16 + Top = 56 + Width = 46 + Height = 13 + Caption = 'Filename:' + Enabled = False + end + object rboFile: TRadioButton + Left = 72 + Top = 24 + Width = 49 + Height = 17 + Caption = '&File' + Enabled = False + TabOrder = 0 + OnClick = rboFileClick + end + object rboBeep: TRadioButton + Left = 136 + Top = 24 + Width = 49 + Height = 17 + Caption = '&Beep' + Checked = True + Enabled = False + TabOrder = 1 + TabStop = True + OnClick = rboBeepClick + end + object edtFile: TEdit + Left = 72 + Top = 56 + Width = 129 + Height = 21 + Enabled = False + TabOrder = 2 + Text = 'c:\windows\media\tada.wav' + end + object btnBrowse: TButton + Left = 204 + Top = 56 + Width = 19 + Height = 21 + Caption = '&...' + Enabled = False + TabOrder = 3 + OnClick = btnBrowseClick + end + end + object chkPlaySound: TCheckBox + Left = 8 + Top = 88 + Width = 145 + Height = 17 + Hint = 'Play sound on auto-correction.' + Caption = 'Play Sound on Correction' + TabOrder = 9 + OnClick = chkPlaySoundClick + end + end + end + object tshEditor: TTabSheet + Caption = '&Editor' + ImageIndex = 1 + object edtEditor: TSynEdit + Left = 0 + Top = 0 + Width = 513 + Height = 322 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + OnKeyDown = edtEditorKeyDown + OnMouseDown = edtEditorMouseDown + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Lines.Strings = ( + 'edtEditor') + RemovedKeystrokes = < + item + Command = ecLineBreak + ShortCut = 8205 + end> + AddedKeystrokes = <> + end + end + object tshAbout: TTabSheet + Caption = '&About' + ImageIndex = 2 + OnResize = tshAboutResize + object pnlAboutContainer: TPanel + Left = 0 + Top = 0 + Width = 417 + Height = 121 + BevelOuter = bvNone + TabOrder = 0 + object shpBorder: TShape + Left = 0 + Top = 0 + Width = 417 + Height = 121 + Align = alClient + Brush.Style = bsClear + Shape = stRoundRect + end + object imgIcon: TImage + Left = 8 + Top = 8 + Width = 32 + Height = 32 + AutoSize = True + Picture.Data = { + 07544269746D6170360C0000424D360C00000000000036000000280000002000 + 0000200000000100180000000000000C00000000000000000000000000000000 + 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFF800000FFFFFF8000 + 00FFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 800000FFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFF800000FFFFFF8000 + 00FFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 800000800000FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFF800000FFFFFF8000 + 00FFFFFF800000800000800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA19D9D800000800000 + 800000800000800000FFFFFFFFFFFF800000FFFFFFFFFFFF800000800000FFFF + FFFFFFFF800000FFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA19D9D800000FFFFFFFFFFFF + 800000800000FFFFFFFFFFFF800000800000800000FFFFFF800000FFFFFFFFFF + FFFFFFFFFFFFFF800000800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFF + 800000FFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFF800000FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFF800000FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFF000080 + 000080000080FFFFFF000080FFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFF000080FFFFFF + FFFFFFFFFFFFFFFFFF000080FFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFF000080000080 + 000080FFFFFFFFFFFF000080FFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFF000080FFFFFF + FFFFFF000080FFFFFF000080000080FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFF000080000080000080FFFFFFFFFFFF000080 + 000080FFFFFFFFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFF000080FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFF} + Transparent = True + end + object lblDescription: TLabel + Left = 48 + Top = 8 + Width = 359 + Height = 26 + Caption = + 'SynAutoCorrect 2.0 was created by Aaron Chan. Portions of the co' + + 'de are by Greg Nixon and Jan Fiala.' + WordWrap = True + end + object lblLabel4: TLabel + Left = 48 + Top = 75 + Width = 43 + Height = 13 + Caption = '&Website:' + end + object lblLabel5: TLabel + Left = 48 + Top = 91 + Width = 28 + Height = 13 + Caption = '&Email:' + end + object lblEmail: TLabel + Left = 96 + Top = 91 + Width = 138 + Height = 13 + Cursor = crHandPoint + Caption = 'mailto:aerodynamica@idz.net' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlue + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + OnClick = lblWebsiteClick + end + object lblWebsite: TLabel + Left = 96 + Top = 75 + Width = 131 + Height = 13 + Cursor = crHandPoint + Caption = 'http://aerodynamica.idz.net' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlue + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + OnClick = lblWebsiteClick + end + end + end + end + object pnlMessage: TPanel + Left = 224 + Top = 17 + Width = 313 + Height = 17 + Alignment = taLeftJustify + Anchors = [akLeft, akTop, akRight] + BevelOuter = bvNone + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 1 + end + object btnDone: TButton + Left = 16 + Top = 376 + Width = 75 + Height = 25 + Anchors = [akLeft, akBottom] + Caption = '&Done' + TabOrder = 2 + OnClick = btnDoneClick + end + object acrAutoCorrect: TSynAutoCorrect + Editor = edtEditor + OnCorrected = acrAutoCorrectCorrected + Left = 16 + Top = 16 + end + object diaOpen: TOpenDialog + DefaultExt = 'wav' + Filter = 'Sound Files (*.wav;*.wave)|*.wav;*.wave|All Files (*.*)|*.*' + Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing] + Title = 'Open Sound...' + Left = 48 + Top = 16 + end + object ilsPages: TImageList + Left = 80 + Top = 16 + Bitmap = { + 494C010103000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 0000000000003600000028000000400000001000000001002000000000000010 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000298C + BD00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE63000000000000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE6300000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000298CBD0084BD + D600000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + F700948C8C00948C8C00948C8C00948C8C00FFD6AD00FFD6AD00FFD6AD00FFD6 + AD00FFD6AD00FFD6AD00FFD6AD00CE63000000000000CE630000FFFFFF00FFFF + FF00FFFFF700FFF7E700FFEFD600FFE7C600FFD6AD00FFD6AD00F7D6AD00FFD6 + AD00FFD6AD00FFD6AD00FFD6AD00CE6300000000000000000000000000000000 + 000000000000000000000000000000000000000000000873B500E7FFFF0084BD + D600000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF00313129006B7394001029A50021213900FFE7C600FFDEB500FFD6AD00FFD6 + AD00FFD6AD00FFD6AD00FFD6AD00CE63000000000000CE630000FFFFFF00BDC6 + C600BDC6C600BDC6C600BDC6C600BDC6C600BDC6C600BDC6C600BDC6C600BDC6 + C600BDC6C600BDC6C600FFD6AD00CE6300000000000000000000298CBD0039A5 + D60039A5D60039A5D60039A5D60039A5D600298CBD00E7FFFF00E7FFFF00DEEF + FF0039A5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF0031313900637BE700FFFFF70010219C00FFEFD600FFE7C600FFDEB500FFD6 + AD00FFD6AD00FFD6AD00FFD6AD00CE63000000000000CE630000FFFFFF00FFFF + FF00292929005A524A00ADADAD00FFF7E700FFE7C600FFE7C600FFD6AD00FFD6 + AD00F7D6AD00FFD6AD00FFD6AD00CE63000000000000298CBD00E7FFFF00E7FF + FF00E7FFFF00E7FFFF00E7FFFF00E7FFFF00E7FFFF00E7FFFF00E7FFFF00E7FF + FF00E7FFFF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF0042424200524A4A005A524A00182994006373D600FFEFD600FFE7C600FFDE + B500FFD6AD00FFD6AD00FFD6AD00CE63000000000000CE630000FFFFFF00BDC6 + C6005A524A0042424200526363009C9C9C00BDC6C600BDC6C600BDC6C600BDC6 + C600BDC6C600BDC6C600FFD6AD00CE63000000000000298CBD00CEF7FF00E7FF + FF00CEF7FF00E7FFFF00CEF7FF002929290052525200CEF7FF00E7FFFF00CEF7 + FF00E7FFFF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00637BE700425AE700FFEFD600FFE7 + C600FFDEB500FFD6AD00FFD6AD00CE63000000000000CE630000FFFFFF00FFFF + FF00FFFFFF0052737B00427BAD0018526B008C5A5200ADADAD00FFE7C600FFE7 + C600FFD6AD00FFD6AD00FFD6AD00CE63000000000000298CBD00CEF7FF00CEF7 + FF00CEF7FF00CEF7FF00CEF7FF00CEF7FF00CEF7FF00CEF7FF00CEF7FF00CEF7 + FF00CEF7FF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF00948C8C00948C8C00948C8C00948C8C00FFFFFF00FFFFFF00FFF7E700FFEF + D600FFE7C600FFDEB500FFD6AD00CE63000000000000CE630000FFFFFF00BDC6 + C600BDC6C60052737B0042739400947B7300C67331008C5A52009C9C9C00BDC6 + C600BDC6C600ADB5BD00FFD6AD00CE630000000000004A9CC600CEF7FF00CEF7 + FF00CEF7FF00CEF7FF00CEF7FF002929290052525200CEF7FF00CEF7FF00CEF7 + FF00CEF7FF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF00313129006B7394001029A50021213900FFFFFF00FFFFFF00FFFFF700FFF7 + E700FFEFD600FFE7C600FFDEB500CE63000000000000CE630000FFFFFF00FFFF + FF00FFFFFF00FFFFFF007B737B00F7BD8400F7AD5A00C67339008C5A5200ADAD + AD00FFE7C600FFD6AD00FFD6AD00CE6300000000000039A5D600CEF7FF00CEF7 + FF00CEF7FF00CEF7FF00CEF7FF005252520029292900849CA500CEF7FF00CEF7 + FF00CEF7FF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF0031313900637BE700FFFFFF0010219C00FFFFFF00FFFFFF00FFFFFF00FFFF + F700FFF7E700FFEFD600FFE7C600CE63000000000000CE630000FFFFFF00BDC6 + C600BDC6C600BDC6C600AD7B7300FFD6AD00FFC68C00EFA55A00C67339008C5A + 52009C9C9C00BDC6C600FFD6AD00CE6300000000000039A5D600B5EFFF00B5EF + FF00B5EFFF00B5EFFF00B5EFFF00B5EFFF00525252002929290052525200B5EF + FF00B5EFFF0039A5D60000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF0042424200524A4A005A524A00182994006373D600FFFFFF00FFFFFF00FFFF + FF00FFFFF700FFF7E700FFEFD600CE63000000000000CE630000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00AD7B7300FFD6AD00FFC68C00F7AD5A00C673 + 31008C5A5200ADADAD00FFD6AD00CE6300000000000042B5F700B5EFFF00B5EF + FF00B5EFFF002929290052525200B5EFFF00B5EFFF002929290029292900B5EF + FF00B5EFFF0042B5F70000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00637BE700425AE700FFFFFF00FFFF + FF00FFFFFF00FFFFF700FFF7E700CE63000000000000CE630000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00AD7B7300FFD6AD00FFC68C00EFA5 + 5A00B56B39008C5A52009C9C9C00CE6300000000000042B5F700B5EFFF00B5EF + FF00B5EFFF002929290029292900B5EFFF00849CA5002929290029292900B5EF + FF00B5EFFF0042B5F70000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE63000000000000CE630000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000AD7B7300FFD6AD009C94 + A50031ADF7000010AD0000009C00CE630000000000005AC6F700B5EFFF00B5EF + FF00B5EFFF00849CA50029292900292929002929290029292900849CA500B5EF + FF00B5EFFF0042B5F70000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000CE630000CE630000CE63 + 0000CE630000CE630000CE630000000000000000000000000000CE630000CE63 + 0000CE630000CE630000CE630000CE630000CE630000CE630000AD7B73004A9C + EF001029D6001029D6000010AD0000009C00000000005AC6F70094F7FF0094F7 + FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7 + FF0094F7FF0042B5F70000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000018 + C6006B8CFF00106BFF001029D60000000000000000008CD6F70094F7FF0094F7 + FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7FF0094F7 + FF0094F7FF0042B5F70000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000018C6000018C600000000000000000000000000000000009CDEF70073E7 + FF0073E7FF0073E7FF0073E7FF0073E7FF0073E7FF0073E7FF0073E7FF0073E7 + FF0042B5F7000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000100000000100010000000000800000000000000000000000 + 000000000000000000000000FFFFFF00FFFFFFFFFFEF000080008000FFCF0000 + 80008000FF8F000080008000C007000080008000800300008000800080030000 + 8000800080030000800080008003000080008000800300008000800080030000 + 800080008003000080008000800300008000800080030000C001C00080030000 + FFFFFFE180030000FFFFFFF3C007000000000000000000000000000000000000 + 000000000000} + end +end diff --git a/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.pas b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.pas new file mode 100644 index 00000000..058d08bc --- /dev/null +++ b/Source/VCL/SynEdit/Demos/SynAutoCorrectDemo/uDemo.pas @@ -0,0 +1,432 @@ +unit uDemo; + +interface + +uses + MMSystem, + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, SynAutoCorrect, ExtCtrls, SynEdit, ShellApi, ComCtrls, ImgList; + +type + TAsSoundOption = (assoAsync, assoNoDefault, assoNoWait); + TAsSoundOptions = set of TAsSoundOption; + TAsSoundType = (asstAlias, asstFileName, asstBeep); + + TAsSoundInfo = class(TPersistent) + private + FFileName: TFileName; + FOptions: TAsSoundOptions; + FSoundType: TAsSoundType; + public + procedure Assign(Source: TPersistent); override; + constructor Create; + destructor Destroy; override; + function Play: Boolean; + published + property FileName: TFileName read FFileName write FFileName; + property Options: TAsSoundOptions read FOptions write FOptions; + property SoundType: TAsSoundType read FSoundType write FSoundType + default asstFileName; + end; + + TfrmDemo = class(TForm) + acrAutoCorrect: TSynAutoCorrect; + diaOpen: TOpenDialog; + pclDemo: TPageControl; + tshOptions: TTabSheet; + tshEditor: TTabSheet; + edtEditor: TSynEdit; + tshAbout: TTabSheet; + pnlAboutContainer: TPanel; + imgIcon: TImage; + lblDescription: TLabel; + lblLabel4: TLabel; + lblLabel5: TLabel; + lblEmail: TLabel; + lblWebsite: TLabel; + pnlMessage: TPanel; + ilsPages: TImageList; + btnDone: TButton; + pnlOptionsContainer: TPanel; + lblLabel2: TLabel; + lblLabel3: TLabel; + lblNote: TLabel; + chkEnabled: TCheckBox; + chkIgnoreCase: TCheckBox; + chkMaintainCase: TCheckBox; + chkCorrectOnMouseDown: TCheckBox; + lbxItems: TListBox; + btnAdd: TButton; + btnDelete: TButton; + btnEdit: TButton; + gbxSound: TGroupBox; + lblType: TLabel; + lblFile: TLabel; + rboFile: TRadioButton; + rboBeep: TRadioButton; + edtFile: TEdit; + btnBrowse: TButton; + chkPlaySound: TCheckBox; + shpBorder: TShape; + procedure FormCreate(Sender: TObject); + procedure btnAddClick(Sender: TObject); + procedure btnDeleteClick(Sender: TObject); + procedure btnEditClick(Sender: TObject); + procedure chkEnabledClick(Sender: TObject); + procedure chkIgnoreCaseClick(Sender: TObject); + procedure chkMaintainCaseClick(Sender: TObject); + procedure lblWebsiteClick(Sender: TObject); + procedure FormResize(Sender: TObject); + procedure lbxItemsDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + procedure lbxItemsClick(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure chkCorrectOnMouseDownClick(Sender: TObject); + procedure chkPlaySoundClick(Sender: TObject); + procedure btnBrowseClick(Sender: TObject); + procedure rboFileClick(Sender: TObject); + procedure rboBeepClick(Sender: TObject); + procedure edtEditorMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure edtEditorKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure FormPaint(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure btnDoneClick(Sender: TObject); + procedure tshOptionsResize(Sender: TObject); + procedure tshAboutResize(Sender: TObject); + procedure acrAutoCorrectCorrected(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + frmDemo: TfrmDemo; + +implementation + +{$R *.DFM} + +{ TAsSoundInfo } + +procedure TAsSoundInfo.Assign(Source: TPersistent); +begin + if Source is TAsSoundInfo then + with TAsSoundInfo(Source) do + begin + Self.FileName := FileName; + Self.Options := Options; + Self.SoundType := SoundType; + end + else + inherited; +end; + +constructor TAsSoundInfo.Create; +begin + inherited Create; + FFileName := ''; + FOptions := [assoAsync]; + FSoundType := asstBeep; +end; + +destructor TAsSoundInfo.Destroy; +begin + inherited; +end; + +function TAsSoundInfo.Play: Boolean; +var + o: Cardinal; + +begin + if FSoundType = asstBeep then + Result := MessageBeep(0) + else + begin + o := SND_SYNC; + case FSoundType of + asstAlias: o := o or SND_ALIAS; + asstFileName: o := o or SND_FILENAME; + end; + if assoAsync in FOptions then o := o or SND_ASYNC; + if assoNoDefault in FOptions then o := o or SND_NODEFAULT; + if assoNoWait in FOptions then o := o or SND_NOWAIT; + Result := PlaySound(PChar(FFileName), 0, o); + end; +end; + +{ TfrmDemo } +procedure TfrmDemo.FormCreate(Sender: TObject); +begin + { Load from registry. } + acrAutoCorrect.LoadFromRegistry(HKEY_CURRENT_USER, + 'Software\Aerodynamica\Components\SynAutoCorrect\Demo'); + lbxItems.Items.Assign(acrAutoCorrect.Items); +end; + +procedure TfrmDemo.btnAddClick(Sender: TObject); +var + Original, Correction: String; + +begin + if InputQuery('Add...', 'Original:', Original) then + InputQuery('Add...', 'Correction:', Correction) + else + Exit; + + with acrAutoCorrect do + begin + if (Original <> '') and (Correction <> '') then + begin + Add(Original, Correction); + lbxItems.Items.Assign(acrAutoCorrect.Items); + end; + end; + + { Update buttons. } + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmDemo.btnDeleteClick(Sender: TObject); +begin + { Error if nothing is selected. } + if lbxItems.ItemIndex < 0 then + begin + MessageBox(0, 'Please select an item before executing this command!', + 'Error', MB_OK or MB_ICONERROR); + Exit; + end; + + acrAutoCorrect.Delete(lbxItems.ItemIndex); + lbxItems.Items.Assign(acrAutoCorrect.Items); + + { Update buttons. } + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmDemo.btnEditClick(Sender: TObject); +var + Original, Correction, CurrText: string; + +begin + { Error if nothing is selected. } + if lbxItems.ItemIndex < 0 then + begin + MessageBox(0, 'Please select an item before executing this command!', + 'Error', MB_OK or MB_ICONERROR); + Exit; + end; + + { Get current item. } + CurrText := acrAutoCorrect.Items[lbxItems.ItemIndex]; + Original := acrAutoCorrect.HalfString(CurrText, True); + Correction := acrAutoCorrect.HalfString(CurrText, False); + + if InputQuery('Edit...', 'Original:', Original) then + InputQuery('Edit...', 'Correction:', Correction) + else + Exit; + + with acrAutoCorrect do + begin + Edit(lbxItems.ItemIndex, Original, Correction); + lbxItems.Items.Assign(acrAutoCorrect.Items); + end; + + { Update buttons. } + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmDemo.chkEnabledClick(Sender: TObject); +begin + acrAutoCorrect.Enabled := chkEnabled.Checked; +end; + +procedure TfrmDemo.chkIgnoreCaseClick(Sender: TObject); +begin + if chkIgnoreCase.Checked then + acrAutoCorrect.Options := acrAutoCorrect.Options + [ascoIgnoreCase] + else + acrAutoCorrect.Options := acrAutoCorrect.Options - [ascoIgnoreCase]; +end; + +procedure TfrmDemo.chkMaintainCaseClick(Sender: TObject); +begin + if chkMaintainCase.Checked then + acrAutoCorrect.Options := acrAutoCorrect.Options + [ascoMaintainCase] + else + acrAutoCorrect.Options := acrAutoCorrect.Options - [ascoMaintainCase]; +end; + +procedure TfrmDemo.lblWebsiteClick(Sender: TObject); +begin + ShellExecute(GetDesktopWindow(), 'Open', PChar(Trim(TLabel(Sender).Caption)), + nil, nil, SW_SHOWNORMAL); +end; + +procedure TfrmDemo.FormResize(Sender: TObject); +begin + if Height < 435 then Height := 435; + if Width < 568 then Width := 568; +end; + +procedure TfrmDemo.lbxItemsDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); +var + s: string; + +begin + { Owner-drawn stuff. } + s := lbxItems.Items[Index]; + with lbxItems do + begin + Canvas.FillRect(Rect); + Canvas.TextOut(Rect.Left + 2, Rect.Top, acrAutoCorrect.HalfString(s, True)); + Canvas.TextOut(Rect.Left + (lbxItems.ClientWidth div 2) + 2, Rect.Top, + acrAutoCorrect.HalfString(s, False)); + + { Repaint separator. } + FormPaint(nil); + end; +end; + +procedure TfrmDemo.lbxItemsClick(Sender: TObject); +begin + { Disable buttons. } + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmDemo.FormDestroy(Sender: TObject); +begin + { Save to registry. } + acrAutoCorrect.SaveToRegistry(HKEY_CURRENT_USER, + 'Software\Aerodynamica\Components\SynAutoCorrect\Demo'); +end; + +procedure TfrmDemo.FormKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + { Capture shortcut for AutoCorrectAll. } + if (ssCtrl in Shift) and (Key = Word('Q')) then acrAutoCorrect.AutoCorrectAll; +end; + +procedure TfrmDemo.chkCorrectOnMouseDownClick(Sender: TObject); +begin + if chkCorrectOnMouseDown.Checked then + acrAutoCorrect.Options := acrAutoCorrect.Options + [ascoCorrectOnMouseDown] + else + acrAutoCorrect.Options := acrAutoCorrect.Options - [ascoCorrectOnMouseDown]; +end; + +procedure TfrmDemo.chkPlaySoundClick(Sender: TObject); +var + i: Integer; + +begin + gbxSound.Enabled := chkPlaySound.Checked; + for i := 0 to Pred(gbxSound.ControlCount) do + TWinControl(gbxSound.Controls[i]).Enabled := chkPlaySound.Checked; + rboBeepClick(nil); +end; + +procedure TfrmDemo.btnBrowseClick(Sender: TObject); +begin + if diaOpen.Execute then edtFile.Text := diaOpen.FileName; +end; + +procedure TfrmDemo.rboFileClick(Sender: TObject); +begin + lblFile.Enabled := rboFile.Checked; + edtFile.Enabled := rboFile.Checked; + btnBrowse.Enabled := rboFile.Checked; +end; + +procedure TfrmDemo.rboBeepClick(Sender: TObject); +begin + lblFile.Enabled := rboFile.Checked; + edtFile.Enabled := rboFile.Checked; + btnBrowse.Enabled := rboFile.Checked; +end; + +{ Demonstration of user events (it was broken in previous releases). } +procedure TfrmDemo.edtEditorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + pnlMessage.Caption := 'User event handler: MouseDown'; +end; + +procedure TfrmDemo.edtEditorKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + pnlMessage.Caption := 'User event handler: KeyDown'; +end; + +procedure TfrmDemo.FormPaint(Sender: TObject); +begin + { Paints the line in the middle of the listbox. } + with lbxItems.Canvas do + begin + Pen.Color := clBlack; + PenPos := Point(lbxItems.Width div 2 - 8, 0); + LineTo(lbxItems.Width div 2 - 8, lbxItems.Height); + end; +end; + +procedure TfrmDemo.FormShow(Sender: TObject); +begin + Invalidate; +end; + +procedure TfrmDemo.btnDoneClick(Sender: TObject); +begin + Close; +end; + +procedure TfrmDemo.tshOptionsResize(Sender: TObject); +begin + { Center options panel. } + pnlOptionsContainer.Left := (tshOptions.ClientWidth div 2) - + (pnlOptionsContainer.Width div 2); + pnlOptionsContainer.Top := (tshOptions.ClientHeight div 2) - + (pnlOptionsContainer.Height div 2); +end; + +procedure TfrmDemo.tshAboutResize(Sender: TObject); +begin + { Center about panel. } + pnlAboutContainer.Left := (tshAbout.ClientWidth div 2) - + (pnlAboutContainer.Width div 2); + pnlAboutContainer.Top := (tshAbout.ClientHeight div 2) - + (pnlAboutContainer.Height div 2); +end; + +procedure TfrmDemo.acrAutoCorrectCorrected(Sender: TObject); +var + Player: TAsSoundInfo; +begin + if not chkPlaySound.Checked then + Exit; + Player := TAsSoundInfo.Create; + try + if rboBeep.Checked then + Player.SoundType := asstBeep + else begin + Player.SoundType := asstFileName; + Player.FileName := edtFile.Text; + end; + Player.Play; + finally + Player.Free; + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Linux/LibcExec.pas b/Source/VCL/SynEdit/Demos/URLDemo/Linux/LibcExec.pas new file mode 100644 index 00000000..7649418c --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Linux/LibcExec.pas @@ -0,0 +1,94 @@ +{******************************************************************** + * Workaround for the Integrated Debugger Libc.execve bug * + * * + * (C) 2003 Andreas Hausladen (Andreas.Hausladen@gmx.de) * + * * + * * + * This software is provided 'as-is', without any express or * + * implied warranty. In no event will the author be held liable * + * for any damages arising from the use of this software. * + * * + * Permission is granted to anyone to use this software for any * + * purpose, including commercial applications, and to alter it * + * and redistribute it freely, subject to the following * + * restrictions: * + * * + * 1. The origin of this software must not be misrepresented, * + * you must not claim that you wrote the original software. * + * If you use this software in a product, an acknowledgment * + * in the product documentation would be appreciated but is * + * not required. * + * * + * 2. Altered source versions must be plainly marked as such, and * + * must not be misrepresented as being the original software. * + * * + * 3. This notice may not be removed or altered from any source * + * distribution. * + * * + ********************************************************************} + +unit LibcExec; +{$ALIGN 8} +{$DEBUGINFO OFF} +{$RANGECHECKS OFF} +{$OVERFLOWCHECKS OFF} +{$STACKFRAMES OFF} +interface + +implementation +{$IFDEF LINUX} +uses + Libc; + +const + SYS_execve = 11; + +{$OPTIMIZATION OFF} +function __execve(PathName: PChar; const argv: PPChar; + const envp: PPChar): Integer; cdecl; +begin + { Do exactly the same things that the original execve@GLIBC_2.1 does. } + pthread_kill_other_threads_np; + Result := Libc.syscall(SYS_execve, PathName, argv, envp); +end; +{$OPTIMIZATION ON} + +procedure InitExecveRedirect; +type + PRedirectCodeRec = ^TRedirectCodeRec; + TRedirectCodeRec = packed record + Code: Byte; // $E9 jmp Distance + Distance: Integer; + end; +const + Prot = PROT_READ or PROT_WRITE or PROT_EXEC; + Size = SizeOf(TRedirectCodeRec); +var + Addr: PRedirectCodeRec; + AlignedAddr: Cardinal; + PageSize: Cardinal; +begin + PageSize := getpagesize; + Addr := dlsym(Pointer(-1), 'execve'); + { Obtain write access to the memory page. } + AlignedAddr := Cardinal(Addr) and not (PageSize - 1); + if Cardinal(Addr) + Size >= AlignedAddr + PageSize then + PageSize := PageSize * 2; + mprotect(Pointer(AlignedAddr), PageSize, Prot); + { Redirect Libc.execve } + Addr^.Code := $E9; + Addr^.Distance := Integer(@__execve) - Integer(Addr) - Size; +end; + + +initialization + + { Maybe someone has a better code to detect integrated debugging. This code + tests only for $DELPHI/$BCB environment variable. } + if (getenv('DELPHI') <> nil) or (getenv('BCB') <> nil) then + // started within Kylix IDE + InitExecveRedirect; + +{$ENDIF} +end. + diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.pas b/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.pas new file mode 100644 index 00000000..b114df06 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.pas @@ -0,0 +1,28 @@ +unit Main; + +interface + +uses + SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms, + QDialogs, QStdCtrls, QSynEdit, QSynEditHighlighter, QSynHighlighterURI, + QSynURIOpener; + +type + TForm1 = class(TForm) + SynURIOpener1: TSynURIOpener; + SynURISyn1: TSynURISyn; + SynEdit1: TSynEdit; + private + { Private-Deklarationen } + public + { Public-Deklarationen } + end; + +var + Form1: TForm1; + +implementation + +{$R *.xfm} + +end. diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.xfm b/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.xfm new file mode 100644 index 00000000..954c6fb3 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Linux/Main.xfm @@ -0,0 +1,72 @@ +object Form1: TForm1 + Left = 206 + Top = 196 + Width = 696 + Height = 491 + ActiveControl = SynEdit1 + Caption = 'URL Demo' + Color = clBackground + PixelsPerInch = 75 + TextHeight = 18 + TextWidth = 5 + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 696 + Height = 491 + Align = alClient + Font.Color = clBlack + Font.Height = 13 + Font.Name = 'adobe-courier' + Font.Pitch = fpVariable + Font.Style = [] + TabOrder = 0 + Gutter.Font.Color = clBlack + Gutter.Font.Height = 8 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Pitch = fpVariable + Gutter.Font.Style = [] + Highlighter = SynURISyn1 + Lines.WideStrings = + 'This project demonstrates how to use SynURIOpener to make links ' + + 'clickable.'#13#10#13#10'SynURIOpener has *Cmd properties that need only to' + + ' be set under Linux.'#13#10'The *Cmd-strings are executed when a link ' + + 'is clicked or Ctrl+clicked,'#13#10'depending on CtrlActivatesLinks-pro' + + 'perty.'#13#10#13#10'In this demo we focus on KDE, but in your program you ' + + 'should let the user '#13#10'choose what command to use as there is no ' + + 'environment variable '#13#10'valid/available on all UN*X-systems. '#13#10'As' + + ' well, Linux-users prefer to make their own decision.'#13#10#13#10'Example' + + 's how to set *Cmd-properties, where %s is the placeholder for th' + + 'e URI:'#13#10'--------------------------------------------------------' + + '---------------------'#13#10'''kfmclient openURL %s'''#13#10'''mozilla %s'''#13#10'''ne' + + 'tscape %s'''#13#10'''kfmclient exec %s'' similar to Windows ShellExecute'#13 + + #10#13#10'Kylix has a problem with executing Libc.system()-calls while ' + + 'in debugging-mode.'#13#10'Therefore this demo includes the unit LibExe' + + 'c.pas from Andreas Hausladen'#13#10'that fixes this issue.'#13#10'More unoff' + + 'icial Kylix patches can be found at http://www.kylix-patch.de.vu' + + '/'#13#10#13#10'Some test links:'#13#10'----------------'#13#10'(not all real ones, jus' + + 't to check if correct app starts)'#13#10#13#10'http://www.somewhere.org'#13#10'f' + + 'tp://superhost.org/downloads/gems.zip'#13#10'www.w3c.org'#13#10'mailto:big@l' + + 'ebowski.edu'#13#10'douglas@adams.lod'#13#10'news:comp.lang.pascal.borland' + end + object SynURIOpener1: TSynURIOpener + Editor = SynEdit1 + URIHighlighter = SynURISyn1 + FtpClientCmd = 'kfmclient exec %s' + GopherClientCmd = 'kfmclient exec %s' + MailClientCmd = 'kfmclient exec %s' + NewsClientCmd = 'kfmclient exec %s' + NntpClientCmd = 'kfmclient exec %s' + ProsperoClientCmd = 'kfmclient exec %s' + TelnetClientCmd = 'kfmclient exec %s' + WaisClientCmd = 'kfmclient exec %s' + WebBrowserCmd = 'kfmclient exec %s' + Left = 600 + Top = 40 + end + object SynURISyn1: TSynURISyn + DefaultFilter = 'All Files (*.*)|*.*' + Left = 600 + Top = 8 + end +end diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Linux/URLDemoLinux.dpr b/Source/VCL/SynEdit/Demos/URLDemo/Linux/URLDemoLinux.dpr new file mode 100644 index 00000000..3349571a --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Linux/URLDemoLinux.dpr @@ -0,0 +1,14 @@ +program URLDemoLinux; + +uses + QForms, + Main in 'Main.pas' {Form1}, + LibcExec in 'LibcExec.pas'; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.dfm b/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.dfm new file mode 100644 index 00000000..a90d2170 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.dfm @@ -0,0 +1,83 @@ +object Form1: TForm1 + Left = 206 + Top = 196 + Width = 696 + Height = 491 + ActiveControl = SynEdit1 + Caption = 'URL Demo' + Color = clBackground + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + PixelsPerInch = 96 + TextHeight = 13 + object SynEdit1: TSynEdit + Left = 0 + Top = 0 + Width = 688 + Height = 457 + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + TabOrder = 0 + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clBlack + Gutter.Font.Height = 8 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Pitch = fpVariable + Gutter.Font.Style = [] + Highlighter = SynURISyn1 + Lines.Strings = ( + + 'This project demonstrates how to use SynURIOpener to make links ' + + 'clickable.' + '' + 'Under Windows (also CLX when running Windows) this is very easy.' + 'For a Linux demo open URLDemoLinux.dpr.' + '' + 'Simply assign two properties of SynURIOpener:' + '- Editor-property must be set to your SynEdit/SynMemo.' + + '- URIHighlighter-property should be assigned an instance of a Sy' + + 'nURISyn.' + '' + + 'Don'#39't forget to set also SynEdit'#39's Highlighter-property to a Syn' + + 'URISyn.' + 'That'#39's all!' + '' + 'NOTE:' + 'By default you have to press CTRL to make the links clickable.' + + 'If you don'#39't like that, set CtrlActivatesLinks-property to false' + + '.' + '' + '' + 'Some test links:' + '----------------' + '(not all real ones, just to check if correct app starts)' + '' + 'http://www.somewhere.org' + 'ftp://superhost.org/downloads/gems.zip' + 'www.w3c.org' + 'mailto:big@lebowski.edu' + 'douglas@adams.lod' + 'news:comp.lang.pascal.borland') + end + object SynURIOpener1: TSynURIOpener + Editor = SynEdit1 + URIHighlighter = SynURISyn1 + Left = 632 + Top = 40 + end + object SynURISyn1: TSynURISyn + Left = 632 + Top = 8 + end +end diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.pas b/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.pas new file mode 100644 index 00000000..a63d4e0a --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Windows/Main.pas @@ -0,0 +1,31 @@ +unit Main; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, + Dialogs, SynEdit, SynEditHighlighter, SynHighlighterURI, SynURIOpener; + +type + TForm1 = class(TForm) + SynURIOpener1: TSynURIOpener; + SynURISyn1: TSynURISyn; + SynEdit1: TSynEdit; + private + { Private-Deklarationen } + public + { Public-Deklarationen } + end; + +var + Form1: TForm1; + +implementation + +{$R *.dfm} + + +end. + diff --git a/Source/VCL/SynEdit/Demos/URLDemo/Windows/URLDemoWindows.dpr b/Source/VCL/SynEdit/Demos/URLDemo/Windows/URLDemoWindows.dpr new file mode 100644 index 00000000..055e3fd3 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/URLDemo/Windows/URLDemoWindows.dpr @@ -0,0 +1,13 @@ +program URLDemoWindows; + +uses + Forms, + Main in 'Main.pas' {Form1}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Source/VCL/SynEdit/Demos/pas2html/ReadMe.txt b/Source/VCL/SynEdit/Demos/pas2html/ReadMe.txt new file mode 100644 index 00000000..efe5a250 --- /dev/null +++ b/Source/VCL/SynEdit/Demos/pas2html/ReadMe.txt @@ -0,0 +1,9 @@ +pas2html.dpr +------------ + +- Needs Delphi 2 or higher. +- This is a commandline app that reads Object Pascal source code from the + clipboard, exports it to HTML, and puts the result back to the clipboard. The + exported source code can then be pasted into a HTML editor. It uses the + syntax highlighting settings of the highest Delphi version installed. + diff --git a/Source/VCL/SynEdit/Demos/pas2html/pas2html.dpr b/Source/VCL/SynEdit/Demos/pas2html/pas2html.dpr new file mode 100644 index 00000000..715b29cf --- /dev/null +++ b/Source/VCL/SynEdit/Demos/pas2html/pas2html.dpr @@ -0,0 +1,97 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: pas2html.dpr, released 2000-06-23. + +The Original Code is the pas2html project of the mwEdit component suite +by Martin Waldenburg and other developers. +The Original Author of the pas2html project is Primoz Gabrijelcic. +Portions written by Primoz Gabrijelcic are copyright 1999 Primoz Gabrijelcic. +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: pas2html.dpr,v 1.2.2.2 2008/09/14 16:24:57 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$APPTYPE CONSOLE} + +program pas2html; + +{$I SynEdit.inc} + +uses + Windows, Classes, Clipbrd, SynHighlighterPas, SynExportHTML, + {$IFDEF SYN_CLX} + QSynUnicode; + {$ELSE} + SynUnicode; + {$ENDIF} + +var + SettingsLines: TStrings; + TextLines: TUnicodeStringList; + Syn: TSynPasSyn; + Exp: TSynExporterHTML; +begin + if ClipboardProvidesText then + begin + Syn := TSynPasSyn.Create(nil); + try + // get syntax highlighter settings + SettingsLines := TStringList.Create; + try + Syn.EnumUserSettings(SettingsLines); + if SettingsLines.Count > 0 then + Syn.UseUserSettings(SettingsLines.Count - 1); + finally + SettingsLines.Free; + end; + + TextLines := TUnicodeStringList.Create; + try + // load text from clipboard + TextLines.Text := GetClipboardText; + // export ALines to HTML, as HTML fragment in text format + Exp := TSynExporterHTML.Create(nil); + try + Exp.Highlighter := Syn; + Exp.ExportAsText := TRUE; + Exp.CreateHTMLFragment := TRUE; + Exp.ExportAll(TextLines); + Exp.CopyToClipboard; + finally + Exp.Free; + end; + finally + TextLines.Free; + end; + finally + Syn.Free; + end; + end; +end. + diff --git a/Source/VCL/SynEdit/Doc/SynEdit-1.3.png b/Source/VCL/SynEdit/Doc/SynEdit-1.3.png deleted file mode 100644 index c4ec5e8b..00000000 Binary files a/Source/VCL/SynEdit/Doc/SynEdit-1.3.png and /dev/null differ diff --git a/Source/VCL/SynEdit/Logo.png b/Source/VCL/SynEdit/Logo.png new file mode 100644 index 00000000..e10ad371 Binary files /dev/null and b/Source/VCL/SynEdit/Logo.png differ diff --git a/Source/VCL/SynEdit/Packages/101B/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/101B/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/101B/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dpk b/Source/VCL/SynEdit/Packages/101B/SynEdit_D.dpk similarity index 59% rename from Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dpk rename to Source/VCL/SynEdit/Packages/101B/SynEdit_D.dpk index 1b47b506..fcd6c619 100644 --- a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dpk +++ b/Source/VCL/SynEdit/Packages/101B/SynEdit_D.dpk @@ -1,12 +1,12 @@ -package SynEditDD; +package SynEdit_D; {$R *.res} -{$R '..\..\..\Source\SynEditReg.dcr'} +{$R '..\..\Source\SynEditReg.dcr'} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} -{$DEBUGINFO OFF} +{$DEBUGINFO ON} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} @@ -26,18 +26,18 @@ package SynEditDD; {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi designtime package'} -{$LIBSUFFIX '270'} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '101B'} {$DESIGNONLY} -{$IMPLICITBUILD OFF} +{$IMPLICITBUILD ON} requires designide, - SynEditDR; + SynEdit_R; contains - SynEditReg in '..\..\..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\..\..\Source\SynEditPropertyReg.pas', - SynHighlighterManager in '..\..\..\Source\SynHighlighterManager.pas'; + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; end. diff --git a/Source/VCL/SynEdit/Packages/101B/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/101B/SynEdit_R.dpk new file mode 100644 index 00000000..ded230d1 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/101B/SynEdit_R.dpk @@ -0,0 +1,147 @@ +package SynEdit_R; + +{$R *.res} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '101B'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/102T/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/102T/SynEdit.groupproj new file mode 100644 index 00000000..85a0b3f5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/102T/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dpk b/Source/VCL/SynEdit/Packages/102T/SynEdit_D.dpk similarity index 59% rename from Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dpk rename to Source/VCL/SynEdit/Packages/102T/SynEdit_D.dpk index 453002af..d64d83e7 100644 --- a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dpk +++ b/Source/VCL/SynEdit/Packages/102T/SynEdit_D.dpk @@ -1,12 +1,12 @@ -package SynEditDD; +package SynEdit_D; {$R *.res} -{$R '..\..\..\Source\SynEditReg.dcr'} +{$R '..\..\Source\SynEditReg.dcr'} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} -{$DEBUGINFO OFF} +{$DEBUGINFO ON} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} @@ -26,18 +26,18 @@ package SynEditDD; {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi designtime package'} -{$LIBSUFFIX '260'} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '102T'} {$DESIGNONLY} -{$IMPLICITBUILD OFF} +{$IMPLICITBUILD ON} requires designide, - SynEditDR; + SynEdit_R; contains - SynEditReg in '..\..\..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\..\..\Source\SynEditPropertyReg.pas', - SynHighlighterManager in '..\..\..\Source\SynHighlighterManager.pas'; + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; end. diff --git a/Source/VCL/SynEdit/Packages/102T/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/102T/SynEdit_R.dpk new file mode 100644 index 00000000..b23ce73a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/102T/SynEdit_R.dpk @@ -0,0 +1,149 @@ +package SynEdit_R; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '102T'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.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', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.pas', + SynHighlighterADSP21xx in '..\..\Source\SynHighlighterADSP21xx.pas', + SynHighlighterAsm in '..\..\Source\SynHighlighterAsm.pas', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterECMAScript in '..\..\Source\SynHighlighterECMAScript.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynHighlighterZPL in '..\..\Source\SynHighlighterZPL.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. diff --git a/Source/VCL/SynEdit/Packages/103R/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/103R/SynEdit.groupproj new file mode 100644 index 00000000..85a0b3f5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/103R/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dproj b/Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cbproj similarity index 55% rename from Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dproj rename to Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cbproj index e926a8e9..29037362 100644 --- a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.dproj +++ b/Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cbproj @@ -1,14 +1,15 @@  - True - Package + {6A19C132-8308-437E-BFF4-B2C9FF204C97} + CppPackage + SynEdit_BCB.cpp Debug - None - SynEditDD.dpk + 18.6 + VCL + True Win32 - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - 19.0 1 + Package true @@ -18,7 +19,12 @@ Base true - + + true + Base + true + + true Base true @@ -29,7 +35,13 @@ true true - + + true + Cfg_1 + true + true + + true Base true @@ -40,85 +52,163 @@ true true + + true + Cfg_2 + true + true + - SynEditDD - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi designtime package - 00400000 - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - true - true - true - 270 - true - true - false + SynEdit_BCB + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + 1033 CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) + ..\..\Source\;$(BDS)\include\vcl;$(IncludePath) + rtl.lib;vcldb.lib;adortl.lib;bdertl.lib;vcldbx.lib;ibxpress.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + true + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) + true + Windows + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BRCC_IncludePath) + -I..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware + true + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(TASM_IncludePath) + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BCC_IncludePath) + true + JPHNE + true + true + bpl + . + Package + /w2 + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;dsnapcon.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + SynEdit component suite + ..\..\Source\;$(BDS)\include\vcl;$(BDS)\lib\obj;$(BDS)\lib;$(BDS)\Source\Toolsapi;$(BDS)\lib\psdk;$(ILINK_LibraryPath) + true + -M -LUDesignIDE + true + true + false - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - SynEdit_RXE6;SynEditDR;$(DCC_UsePackage) - SynEditDD.ico + -Vx -r- -k -Ve + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) + $(BDSINCLUDE)\windows\vcl;$(IncludePath) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true 1033 + + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) + $(BDSINCLUDE)\windows\vcl;$(IncludePath) + - 0 - RELEASE;$(DCC_Define) - false - 0 + $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + Debug_Build + DEBUG;$(DCC_Define);$(DCC_Define) + true + Full + -M -V -LUDesignIDE + true + true + _DEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -k + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + ..\..\Source;$(DCC_UnitSearchPath) true - 1033 + RX2 + + + _DEBUG;$(BCC_Defines);$(BCC_Defines) - DEBUG;$(DCC_Define) - true - false + true + Release_Build + -M -$O+ -LUDesignIDE + None + $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + true - true - 1033 + NDEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -r + + + NDEBUG;$(BCC_Defines);$(BCC_Defines) - - MainSource + + 38 + 3 + + + 14 + 11 + + + 29 + 0 + + + 8 + 5 + + + 9 + 2 + + + 8 + 7 + + + 17 + 10 + + + 12 + 11 + + + 26 + 1 - - - - - - - + + -1 + 23 + + + 6 + 20 + + Cfg_2 Base Base - + Cfg_1 Base + - Delphi.Personality.12 - Package + CPlusPlusBuilder.Personality.12 + CppPackage - - - SynEditDD.dpk - - + - True + False False 1 0 @@ -129,7 +219,7 @@ False False False - 1031 + 1033 1252 @@ -144,26 +234,150 @@ 1.0.0.0 - + + 1 + ..\..\Source;$(BCB)\include;$(BCB)\include\vcl + + + 2 + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(BCB)\Source\Toolsapi + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib + + + 1 + $(BCB)\source\vcl + + + 1 + _DEBUG + + + 4 + C:\Arquivos de programas\Borland\CBuilder6\Lib\ + C:\Arquivos de programas\Borland\CBuilder6\Lib + $(BCB)\lib\ + $(BCB)\lib + + + $(BCB)\source\vcl + + + + + False + + + + + + + False + + False + + True + False + + + 0 + 0 + 0 + + + 1 + 1 + 1 + + + False + True + True + False + + + SynEdit_BCB.cpp + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + True + False + - + + + true + + + true - - + + true - + - SynEditDD.bpl true - - + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + SynEdit_BCB.bpl + true + + + + + true + + + + + true + + + + + SynEdit_BCB.tds + true + + + + true @@ -180,20 +394,12 @@ classes 1 - - classes - 1 - res\xml 1 - - res\xml - 1 - @@ -206,242 +412,96 @@ library\lib\armeabi 1 - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - library\lib\mips 1 - - library\lib\mips - 1 - library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - res\drawable 1 - - res\drawable - 1 - res\values 1 - - res\values - 1 - res\values-v21 1 - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - res\drawable 1 - - res\drawable - 1 - res\drawable-xxhdpi 1 - - res\drawable-xxhdpi - 1 - res\drawable-ldpi 1 - - res\drawable-ldpi - 1 - res\drawable-mdpi 1 - - res\drawable-mdpi - 1 - res\drawable-hdpi 1 - - res\drawable-hdpi - 1 - res\drawable-xhdpi 1 - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - res\drawable-small 1 - - res\drawable-small - 1 - res\drawable-normal 1 - - res\drawable-normal - 1 - res\drawable-large 1 - - res\drawable-large - 1 - res\drawable-xlarge 1 - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - @@ -511,9 +571,6 @@ 0 - - 0 - 0 @@ -533,71 +590,85 @@ 0 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + + 1 + - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - + + 1 - + + 1 + + + 1 + + + + 1 @@ -614,7 +685,6 @@ - 1 @@ -644,10 +714,6 @@ library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - 1 @@ -670,12 +736,6 @@ 0 - - - library\lib\armeabi-v7a - 1 - - 1 @@ -684,7 +744,7 @@ 1 - + Assets 1 @@ -694,7 +754,7 @@ 1 - + Assets 1 @@ -707,28 +767,16 @@ - + - - - False - False - False - False - False - False - True - False - 12 - - + diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cpp b/Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cpp similarity index 74% rename from Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cpp rename to Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cpp index f793908a..c3df9c90 100644 --- a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cpp +++ b/Source/VCL/SynEdit/Packages/103R/SynEdit_BCB.cpp @@ -1,17 +1,16 @@ //--------------------------------------------------------------------------- -#include +#include #pragma hdrstop #pragma package(smart_init) //--------------------------------------------------------------------------- -// Package-Quelltext. +// Package source. //--------------------------------------------------------------------------- - #pragma argsused -extern "C" int _libmain(unsigned long reason) +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { - return 1; + return 1; } //--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dpk b/Source/VCL/SynEdit/Packages/103R/SynEdit_D.dpk similarity index 59% rename from Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dpk rename to Source/VCL/SynEdit/Packages/103R/SynEdit_D.dpk index 46552d50..818f786a 100644 --- a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dpk +++ b/Source/VCL/SynEdit/Packages/103R/SynEdit_D.dpk @@ -1,12 +1,12 @@ -package SynEditDD; +package SynEdit_D; {$R *.res} -{$R '..\..\..\Source\SynEditReg.dcr'} +{$R '..\..\Source\SynEditReg.dcr'} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} -{$DEBUGINFO OFF} +{$DEBUGINFO ON} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} @@ -26,18 +26,18 @@ package SynEditDD; {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi designtime package'} -{$LIBSUFFIX '240'} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '103R'} {$DESIGNONLY} -{$IMPLICITBUILD OFF} +{$IMPLICITBUILD ON} requires designide, - SynEditDR; + SynEdit_R; contains - SynEditReg in '..\..\..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\..\..\Source\SynEditPropertyReg.pas', - SynHighlighterManager in '..\..\..\Source\SynHighlighterManager.pas'; + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; end. diff --git a/Source/VCL/SynEdit/Packages/103R/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/103R/SynEdit_R.dpk new file mode 100644 index 00000000..d482498f --- /dev/null +++ b/Source/VCL/SynEdit/Packages/103R/SynEdit_R.dpk @@ -0,0 +1,147 @@ +package SynEdit_R; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '103R'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/104S/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/104S/SynEdit.groupproj new file mode 100644 index 00000000..85a0b3f5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/104S/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cbproj b/Source/VCL/SynEdit/Packages/104S/SynEdit_BCB.cbproj similarity index 63% rename from Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cbproj rename to Source/VCL/SynEdit/Packages/104S/SynEdit_BCB.cbproj index 34bdb3d5..d78d5f25 100644 --- a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cbproj +++ b/Source/VCL/SynEdit/Packages/104S/SynEdit_BCB.cbproj @@ -1,11 +1,12 @@  - {88C414E8-F605-439F-BFE3-ED336BBE7E56} - 18.7 + {6A19C132-8308-437E-BFF4-B2C9FF204C97} + CppPackage + SynEdit_BCB.cpp + Debug + 19.0 VCL - SynEditCD.cpp True - Release Win32 1 Package @@ -34,6 +35,12 @@ true true + + true + Cfg_1 + true + true + true Base @@ -45,121 +52,135 @@ true true + + true + Cfg_2 + true + true + - 250 + SynEdit_BCB + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + ..\..\Source\;$(BDS)\include\vcl;$(IncludePath) + rtl.lib;vcldb.lib;adortl.lib;bdertl.lib;vcldbx.lib;ibxpress.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + true + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) + true + Windows + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BRCC_IncludePath) + -I..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware true - CppPackage - ..\..\..\Source;$(DCC_UnitSearchPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - ..\..\..\Source\;$(ILINK_LibraryPath) - true - -LUDesignIDE - ..\..\..\Source\;$(IncludePath) + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(TASM_IncludePath) + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BCC_IncludePath) true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - TurboPack SynEdit CBuilder designtime package + JPHNE + true + true + bpl + . + Package + /w2 + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;dsnapcon.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + SynEdit component suite + ..\..\Source\;$(BDS)\include\vcl;$(BDS)\lib\obj;$(BDS)\lib;$(BDS)\Source\Toolsapi;$(BDS)\lib\psdk;$(ILINK_LibraryPath) true - <_TCHARMapping>char - SynEditCD - 1031 - All + -M -LUDesignIDE true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + true + false - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) + -Vx -r- -k -Ve + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) $(BDSINCLUDE)\windows\vcl;$(IncludePath) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true + $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + Debug_Build + DEBUG;$(DCC_Define);$(DCC_Define) + true Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + -M -V -LUDesignIDE + true + true + _DEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -k + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + ..\..\Source;$(DCC_UnitSearchPath) true - 1033 - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 104S + + + _DEBUG;$(BCC_Defines);$(BCC_Defines) - NDEBUG;$(Defines) + true + Release_Build + -M -$O+ -LUDesignIDE None + $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 + NDEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -r + + + NDEBUG;$(BCC_Defines);$(BCC_Defines) + + 38 + 3 + + + 14 + 11 + - 7 + 29 + 0 - 1 + 8 + 5 - - 0 - - + + 9 2 - + - 9 - - - 11 - - 8 + 7 + + + 17 + 10 12 + 11 - - 10 - - - 3 - - - 5 + + -1 + 23 - - 4 - - - 6 - Cfg_2 Base @@ -172,11 +193,93 @@ Base + CPlusPlusBuilder.Personality.12 CppPackage + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + 1 + ..\..\Source;$(BCB)\include;$(BCB)\include\vcl + + + 2 + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(BCB)\Source\Toolsapi + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib + + + 1 + $(BCB)\source\vcl + + + 1 + _DEBUG + + + 4 + C:\Arquivos de programas\Borland\CBuilder6\Lib\ + C:\Arquivos de programas\Borland\CBuilder6\Lib + $(BCB)\lib\ + $(BCB)\lib + + + $(BCB)\source\vcl + + + + + False + + + + + + + False + + False + + True + False + + + 0 + 0 + 0 + + + 1 + 1 + 1 + False True @@ -184,176 +287,68 @@ False - SynEditCD.cpp + SynEdit_BCB.cpp - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + True + False + true - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - true - - - true - - true - - - true - - - - - true - - - + true - + - SynEditCD.bpl true - - - SynEditCD.bpl + + true - + true - + true - - - true - - - - - true - - - + true - - - true - - - + + SynEdit_BCB.bpl true @@ -362,18 +357,14 @@ true - + true - - - true - - - - + + + SynEdit_BCB.tds true @@ -387,7 +378,6 @@ 1 - Contents\MacOS 0 @@ -396,12 +386,20 @@ classes 1 + + classes + 1 + res\xml 1 + + res\xml + 1 + @@ -414,139 +412,242 @@ library\lib\armeabi 1 + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + library\lib\mips 1 + + library\lib\mips + 1 + - library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + res\drawable 1 + + res\drawable + 1 + res\values 1 + + res\values + 1 + res\values-v21 1 + + res\values-v21 + 1 + res\values 1 + + res\values + 1 + res\drawable 1 + + res\drawable + 1 + res\drawable-xxhdpi 1 + + res\drawable-xxhdpi + 1 + res\drawable-ldpi 1 + + res\drawable-ldpi + 1 + res\drawable-mdpi 1 + + res\drawable-mdpi + 1 + res\drawable-hdpi 1 + + res\drawable-hdpi + 1 + res\drawable-xhdpi 1 + + res\drawable-xhdpi + 1 + res\drawable-mdpi 1 + + res\drawable-mdpi + 1 + res\drawable-hdpi 1 + + res\drawable-hdpi + 1 + res\drawable-xhdpi 1 + + res\drawable-xhdpi + 1 + res\drawable-xxhdpi 1 + + res\drawable-xxhdpi + 1 + res\drawable-xxxhdpi 1 + + res\drawable-xxxhdpi + 1 + res\drawable-small 1 + + res\drawable-small + 1 + res\drawable-normal 1 + + res\drawable-normal + 1 + res\drawable-large 1 + + res\drawable-large + 1 + res\drawable-xlarge 1 + + res\drawable-xlarge + 1 + res\values 1 + + res\values + 1 + @@ -564,6 +665,10 @@ 1 .framework + + 1 + .framework + 0 @@ -573,6 +678,10 @@ 1 .dylib + + 1 + .dylib + 0 .dll;.bpl @@ -595,6 +704,10 @@ 1 .dylib + + 1 + .dylib + 0 .bpl @@ -604,6 +717,9 @@ 0 + + 0 + 0 @@ -616,6 +732,9 @@ 0 + + 0 + 0 @@ -631,17 +750,6 @@ 1 - - - 1 - - - 1 - - - 1 - - 1 @@ -653,39 +761,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - 1 @@ -697,58 +772,13 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -763,106 +793,27 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - + 1 @@ -873,14 +824,13 @@ 1 - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -906,25 +856,23 @@ 1 - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -932,6 +880,9 @@ 1 + + 1 + @@ -946,6 +897,7 @@ + 1 @@ -965,12 +917,20 @@ Contents\Resources 1 + + Contents\Resources + 1 + library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + 1 @@ -986,10 +946,19 @@ 1 + + 1 + 0 + + + library\lib\armeabi-v7a + 1 + + 1 @@ -1021,21 +990,17 @@ - + + - - True - False - 12 - diff --git a/Source/VCL/SynEdit/Packages/104S/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/104S/SynEdit_D.dpk new file mode 100644 index 00000000..a69a1881 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/104S/SynEdit_D.dpk @@ -0,0 +1,43 @@ +package SynEdit_D; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '104S'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/104S/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/104S/SynEdit_R.dpk new file mode 100644 index 00000000..a23c5975 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/104S/SynEdit_R.dpk @@ -0,0 +1,148 @@ +package SynEdit_R; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '104S'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterECMAScript in '..\..\Source\SynHighlighterECMAScript.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/10S/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/10S/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/10S/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/10S/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/10S/SynEdit_D.dpk new file mode 100644 index 00000000..76adef9a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/10S/SynEdit_D.dpk @@ -0,0 +1,43 @@ +package SynEdit_D; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '10S'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/10S/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/10S/SynEdit_R.dpk new file mode 100644 index 00000000..1d81aab1 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/10S/SynEdit_R.dpk @@ -0,0 +1,147 @@ +package SynEdit_R; + +{$R *.res} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '10S'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/110A/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/110A/SynEdit.groupproj new file mode 100644 index 00000000..85a0b3f5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/110A/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cbproj b/Source/VCL/SynEdit/Packages/110A/SynEdit_BCB.cbproj similarity index 62% rename from Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cbproj rename to Source/VCL/SynEdit/Packages/110A/SynEdit_BCB.cbproj index bb5c8490..2de3101d 100644 --- a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.cbproj +++ b/Source/VCL/SynEdit/Packages/110A/SynEdit_BCB.cbproj @@ -1,11 +1,12 @@  - {88C414E8-F605-439F-BFE3-ED336BBE7E56} - 18.7 + {6A19C132-8308-437E-BFF4-B2C9FF204C97} + CppPackage + SynEdit_BCB.cpp + Debug + 19.0 VCL - SynEditCD.cpp True - Release Win32 1 Package @@ -34,6 +35,12 @@ true true + + true + Cfg_1 + true + true + true Base @@ -45,121 +52,135 @@ true true + + true + Cfg_2 + true + true + - 240 + SynEdit_BCB + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + ..\..\Source\;$(BDS)\include\vcl;$(IncludePath) + rtl.lib;vcldb.lib;adortl.lib;bdertl.lib;vcldbx.lib;ibxpress.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + true + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) + true + Windows + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BRCC_IncludePath) + -I..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware true - CppPackage - ..\..\..\Source;$(DCC_UnitSearchPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - ..\..\..\Source\;$(ILINK_LibraryPath) - true - -LUDesignIDE - ..\..\..\Source\;$(IncludePath) + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(TASM_IncludePath) + true + ..\..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BCC_IncludePath) true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - TurboPack SynEdit CBuilder designtime package + JPHNE + true + true + bpl + . + Package + /w2 + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;dsnapcon.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + SynEdit component suite + ..\..\Source\;$(BDS)\include\vcl;$(BDS)\lib\obj;$(BDS)\lib;$(BDS)\Source\Toolsapi;$(BDS)\lib\psdk;$(ILINK_LibraryPath) true - <_TCHARMapping>char - SynEditCD - 1031 - All + -M -LUDesignIDE true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + true + false - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) + -Vx -r- -k -Ve + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) $(BDSINCLUDE)\windows\vcl;$(IncludePath) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true + $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + Debug_Build + DEBUG;$(DCC_Define);$(DCC_Define) + true Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + -M -V -LUDesignIDE + true + true + _DEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -k + rtl.lib;vcldb.lib;adortl.lib;vcldbx.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + ..\..\Source;$(DCC_UnitSearchPath) true - 1033 - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 110A + + + _DEBUG;$(BCC_Defines);$(BCC_Defines) - NDEBUG;$(Defines) + true + Release_Build + -M -$O+ -LUDesignIDE None + $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 + NDEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -r + + + NDEBUG;$(BCC_Defines);$(BCC_Defines) + + 38 + 3 + + + 14 + 11 + - 7 + 29 + 0 - 1 + 8 + 5 - - 0 - - + + 9 2 - + - 9 - - - 11 - - 8 + 7 + + + 17 + 10 12 + 11 - - 10 - - - 3 - - - 5 + + -1 + 23 - - 4 - - - 6 - Cfg_2 Base @@ -172,11 +193,93 @@ Base + CPlusPlusBuilder.Personality.12 CppPackage + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + 1 + ..\..\Source;$(BCB)\include;$(BCB)\include\vcl + + + 2 + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(BCB)\Source\Toolsapi + ..\..\Source;$(BCB)\lib\obj;$(BCB)\lib + + + 1 + $(BCB)\source\vcl + + + 1 + _DEBUG + + + 4 + C:\Arquivos de programas\Borland\CBuilder6\Lib\ + C:\Arquivos de programas\Borland\CBuilder6\Lib + $(BCB)\lib\ + $(BCB)\lib + + + $(BCB)\source\vcl + + + + + False + + + + + + + False + + False + + True + False + + + 0 + 0 + 0 + + + 1 + 1 + 1 + False True @@ -184,186 +287,68 @@ False - SynEditCD.cpp + SynEdit_BCB.cpp - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + True + False + true - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - true - - - true - - true - - - true - - - - - true - - - + true - + - SynEditCD.bpl true - - - SynEditCD.bpl + + true - + true - + true - - - true - - - - - true - - - + true - - - true - - - + + SynEdit_BCB.bpl true @@ -372,18 +357,14 @@ true - + true - - - true - - - - + + + SynEdit_BCB.tds true @@ -392,660 +373,634 @@ true - - - 0 - .dll;.bpl - + 1 - .dylib + + + 0 - classes 1 - - - - Contents\MacOS - 0 - - + + classes 1 - + - res\drawable-xxhdpi - 1 - - - - - 1 - - + res\xml 1 - + + res\xml 1 - - - Contents\Resources + + + library\lib\armeabi-v7a 1 - - + + + library\lib\armeabi 1 - + + library\lib\armeabi 1 - - 0 + + + + library\lib\armeabi-v7a + 1 - + + + + library\lib\mips 1 - + + library\lib\mips 1 + + library\lib\armeabi-v7a 1 - + + library\lib\arm64-v8a 1 - - + + + library\lib\armeabi-v7a 1 - + + + + res\drawable 1 - - - + + res\drawable 1 - + + + + res\values 1 - + + res\values 1 - - - 1 - - + + + res\values-v21 1 - + + res\values-v21 1 - - - 1 - - + + + res\values 1 - + + res\values 1 - - + + + res\drawable 1 - + + res\drawable 1 - + + + + res\drawable-xxhdpi 1 - - - + + res\drawable-xxhdpi 1 - + + + + res\drawable-ldpi 1 - + + res\drawable-ldpi 1 - + - res\values-v21 + res\drawable-mdpi 1 - - - + + res\drawable-mdpi 1 - + + + + res\drawable-hdpi 1 - + + res\drawable-hdpi 1 - + - library\lib\armeabi + res\drawable-xhdpi 1 - - - + res\drawable-xhdpi 1 - - - 0 - - + + + res\drawable-mdpi 1 - + + res\drawable-mdpi 1 - - - 1 - - + + + res\drawable-hdpi 1 - + + res\drawable-hdpi 1 - + - res\drawable-normal + res\drawable-xhdpi 1 - - - + + res\drawable-xhdpi 1 - + + + + res\drawable-xxhdpi 1 - + + res\drawable-xxhdpi 1 - - + - library\lib\armeabi-v7a - 1 - - - - - Assets + res\drawable-xxxhdpi 1 - - Assets + + res\drawable-xxxhdpi 1 - + - res\values + res\drawable-small 1 - - - - + + res\drawable-small 1 - + + + + res\drawable-normal 1 - + + res\drawable-normal 1 - - - 1 - - + + + res\drawable-large 1 - + + res\drawable-large 1 - + - res\drawable + res\drawable-xlarge 1 - - - - res\drawable-xxxhdpi + + res\drawable-xlarge 1 - - - 1 - - + + + res\values 1 - + + res\values 1 - - - 1 - + 1 - + 1 + + 0 + - - + + 1 + .framework - + 1 + .framework - - 1 + + 0 - - - res\drawable + + 1 + .dylib - - - - Assets + 1 + .dylib - - Assets - 1 + + 0 + .dll;.bpl - + + + 1 + .dylib + 1 + .dylib 1 + .dylib - + 1 + .dylib - - - - library\lib\armeabi-v7a + 1 + .dylib - - - - res\drawable-mdpi - 1 + + 0 + .bpl - + - res\drawable-xlarge - 1 + 0 + + + 0 + + + 0 - - - - 1 + 0 - 1 + 0 - - 1 + + 0 + + + 0 + + + 0 - - + + 1 1 - + 1 - - - library\lib\mips + + 1 - - 1 1 + + 1 - - - - 0 - - + 1 - .framework - - - 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - + - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - - res\xml + 1 - - 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 + + 1 - - - 1 1 - - 1 - - - - res\drawable-xhdpi + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - - res\drawable-large + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - res\drawable-hdpi + + 1 - - 1 1 + + 1 - - 1 1 - - 1 - - + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - 1 - - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - res\values + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - - - res\values + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + - res\drawable-small 1 - - - - 1 - - + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - - res\drawable-mdpi + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - res\drawable-xxhdpi + + + + + + 1 - - 1 1 - + + + + + + + Contents\Resources 1 - - - + + Contents\Resources 1 - - - 0 - - - 0 + + + library\lib\armeabi-v7a + 1 - - 0 + + library\lib\arm64-v8a + 1 - 0 + 1 - - 0 + + 1 - 0 - - - - - 0 - .bpl + 1 - + 1 - .dylib 1 - .dylib - + 1 - .dylib - - 1 - .dylib + + 0 - - + + + library\lib\armeabi-v7a 1 - + + + 1 - + 1 - - - 1 - - + + + Assets 1 - + + Assets 1 - - - res\drawable-hdpi + + + Assets 1 - - - - res\drawable-ldpi + + Assets 1 - + + - - True - False - 12 - diff --git a/Source/VCL/SynEdit/Packages/110A/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/110A/SynEdit_D.dpk new file mode 100644 index 00000000..cbbdd88b --- /dev/null +++ b/Source/VCL/SynEdit/Packages/110A/SynEdit_D.dpk @@ -0,0 +1,43 @@ +package SynEdit_D; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '110A'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/110A/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/110A/SynEdit_R.dpk new file mode 100644 index 00000000..68257803 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/110A/SynEdit_R.dpk @@ -0,0 +1,148 @@ +package SynEdit_R; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '110A'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterECMAScript in '..\..\Source\SynHighlighterECMAScript.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/2010/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/2010/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/2010/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/2010/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/2010/SynEdit_D.dpk new file mode 100644 index 00000000..1fecb648 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/2010/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX '2010'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/2010/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/2010/SynEdit_R.dpk new file mode 100644 index 00000000..42761eaf --- /dev/null +++ b/Source/VCL/SynEdit/Packages/2010/SynEdit_R.dpk @@ -0,0 +1,145 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX '2010'} +{$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', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.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. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCBuilder.groupproj b/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCBuilder.groupproj deleted file mode 100644 index 15034ac7..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCBuilder.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {F9BE6A59-BDDF-49EA-8DBD-FFCEA9630B0C} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.res b/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.res deleted file mode 100644 index ed24e620..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cbproj b/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cbproj deleted file mode 100644 index f2ec6f18..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cbproj +++ /dev/null @@ -1,1395 +0,0 @@ - - - {30340F4A-5FE6-4B66-ACCF-D1A8B0758ADE} - 18.7 - VCL - SynEditCR.cpp - True - Release - Win32 - 3 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 240 - true - ..\..\..\Source;$(DCC_UnitSearchPath) - true - CppPackage - ..\..\..\Source\;$(ILINK_LibraryPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - true - SynEditCR - TurboPack SynEdit CBuilder runtime package - ..\..\..\Source\;$(IncludePath) - <_TCHARMapping>char - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - true - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - 64 - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - true - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - 1033 - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - 1033 - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - - - true - 1033 - - - - 116 - - - 1 - - - 0 - - - 112 - - - 114 - - - 117 - - - 111 - - - 115 - - - 113 - - - 3 - - -
frmAutoCorrectEditor
- dfm - 4 -
- - 5 - - - 6 - - - 7 - - - 8 - - - 9 - - - 10 - - - 11 - - - 12 - - -
SynEditKeystrokeEditorForm
- dfm - 13 -
- - 14 - - -
SynEditKeystrokesEditorForm
- dfm - 15 -
- - 16 - - - 17 - - - 18 - - -
fmEditorOptionsDialog
- dfm - 19 -
- - 20 - - - 21 - - - 22 - - - 23 - - - 24 - - -
SynEditPrintMarginsDlg
- dfm - 25 -
- - 26 - - - 27 - - - 29 - - - 32 - - - 33 - - - 34 - - - 35 - - - 36 - - - 37 - - - 38 - - - 39 - - - 40 - - - 41 - - - 42 - - - 43 - - - 44 - - - 45 - - - 46 - - - 47 - - - 48 - - - 49 - - - 50 - - - 51 - - - 52 - - - 53 - - - 54 - - - 55 - - - 56 - - - 57 - - - 58 - - - 59 - - - 60 - - - 61 - - - 62 - - - 63 - - - 64 - - - 65 - - - 66 - - - 67 - - - 68 - - - 69 - - - 70 - - - 71 - - - 72 - - - 73 - - - 111 - - - 74 - - - 75 - - - 76 - - - 77 - - - 79 - - - 80 - - - 81 - - - 82 - - - 83 - - - 84 - - - 85 - - - 86 - - - 87 - - - 112 - - - 88 - - - 89 - - - 90 - - - 91 - - - 92 - - - 93 - - - 94 - - - 95 - - - 96 - - - 97 - - - 98 - - - 99 - - - 100 - - - 101 - - - 102 - - - 103 - - - 104 - - - 105 - - - 106 - - - 107 - - - 108 - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCR.cpp - - - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - - - SynEditCR.bpl - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - 0 - .dll;.bpl - - - 1 - .dylib - - - - - - classes - 1 - - - - - Contents\MacOS - 0 - - - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - Contents\Resources - 1 - - - - - 1 - - - 1 - - - 0 - - - 1 - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 1 - - - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\values-v21 - 1 - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi - 1 - - - - - res\drawable-xhdpi - 1 - - - - - 0 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-normal - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - res\values - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable - 1 - - - - - res\drawable-xxxhdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xlarge - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\mips - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 0 - - - 1 - .framework - - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - res\xml - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-large - 1 - - - - - res\drawable-hdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\values - 1 - - - - - - res\values - 1 - - - - - res\drawable-small - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-hdpi - 1 - - - - - res\drawable-ldpi - 1 - - - - - - - - - - - - - - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cpp b/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cpp deleted file mode 100644 index 64c8315c..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//--------------------------------------------------------------------------- - -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -USEFORMNS("..\..\..\Source\SynEditKeyCmdEditor.pas", Syneditkeycmdeditor, SynEditKeystrokeEditorForm); -USEFORMNS("..\..\..\Source\SynEditOptionsDialog.pas", Syneditoptionsdialog, fmEditorOptionsDialog); -USEFORMNS("..\..\..\Source\SynEditKeyCmdsEditor.pas", Syneditkeycmdseditor, SynEditKeystrokesEditorForm); -USEFORMNS("..\..\..\Source\SynAutoCorrectEditor.pas", Synautocorrecteditor, frmAutoCorrectEditor); -USEFORMNS("..\..\..\Source\SynEditPrintMarginsDialog.pas", Syneditprintmarginsdialog, SynEditPrintMarginsDlg); -//--------------------------------------------------------------------------- -#pragma package(smart_init) -//--------------------------------------------------------------------------- - -// Package-Quelltext. -//--------------------------------------------------------------------------- - - -#pragma argsused -extern "C" int _libmain(unsigned long reason) -{ - return 1; -} -//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.res b/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.res deleted file mode 100644 index 38aeb3a9..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/CBuilder/SynEditCR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dproj b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dproj deleted file mode 100644 index 8af240fa..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.dproj +++ /dev/null @@ -1,222 +0,0 @@ - - - True - Package - Release - None - SynEditDD.dpk - Win32 - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - 18.7 - 1 - - - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEditDD - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi designtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - true - 240 - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - SynEdit_RXE6;$(DCC_UsePackage) - SynEditDD.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - - MainSource - - - - - - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - - - - Delphi.Personality.12 - Package - - - - SynEditDD.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDD.bpl - true - - - - - Contents\MacOS - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - - - Assets - 1 - - - - - Assets - 1 - - - - - - True - False - - - 12 - - - - - diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.ico b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.res b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.res deleted file mode 100644 index 0a66bd55..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dpk b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dpk deleted file mode 100644 index 7329b4d9..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dpk +++ /dev/null @@ -1,144 +0,0 @@ -package SynEditDR; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$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} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi runtime package'} -{$LIBSUFFIX '240'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - 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', - SynEditCodeFolding in '..\..\..\Source\SynEditCodeFolding.pas', - SynEditDataObject in '..\..\..\Source\SynEditDataObject.pas', - SynEditDragDrop in '..\..\..\Source\SynEditDragDrop.pas', - SynEditExport in '..\..\..\Source\SynEditExport.pas', - SynEditHighlighter in '..\..\..\Source\SynEditHighlighter.pas', - SynEditHighlighterOptions in '..\..\..\Source\SynEditHighlighterOptions.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', - 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', - SynEditWordWrap in '..\..\..\Source\SynEditWordWrap.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', - SynHighlighterCss in '..\..\..\Source\SynHighlighterCss.pas', - SynHighlighterDfm in '..\..\..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\..\..\Source\SynHighlighterDml.pas', - SynHighlighterDOT in '..\..\..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\..\..\Source\SynHighlighterDWS.pas', - SynHighlighterEiffel in '..\..\..\Source\SynHighlighterEiffel.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', - SynHighlighterJSON in '..\..\..\Source\SynHighlighterJSON.pas', - SynHighlighterKix in '..\..\..\Source\SynHighlighterKix.pas', - SynHighlighterLDraw in '..\..\..\Source\SynHighlighterLDraw.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', - SynHighlighterRexx in '..\..\..\Source\SynHighlighterRexx.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', - SynHighlighterURI in '..\..\..\Source\SynHighlighterURI.pas', - SynHighlighterVB in '..\..\..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\..\..\Source\SynHighlighterVBScript.pas', - SynHighlighterVrml97 in '..\..\..\Source\SynHighlighterVrml97.pas', - SynHighlighterXML in '..\..\..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\..\..\Source\SynMacroRecorder.pas', - SynTextDrawer in '..\..\..\Source\SynTextDrawer.pas', - SynUnicode in '..\..\..\Source\SynUnicode.pas', - SynURIOpener in '..\..\..\Source\SynURIOpener.pas', - SynUsp10 in '..\..\..\Source\SynUsp10.pas'; - -end. diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dproj b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dproj deleted file mode 100644 index 18b16b27..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.dproj +++ /dev/null @@ -1,386 +0,0 @@ - - - True - Package - Release - VCL - SynEditDR.dpk - Win32 - {AC917C2B-5870-48AD-981D-668AD3E4A533} - 18.7 - 3 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - SynEditDR - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi runtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - 240 - true - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - true - 1033 - - - - MainSource - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- - -
$ENDIF
-
- - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEditDR.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDR.bpl - true - - - - - SynEditDR.bpl - true - - - - - Contents\MacOS - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - False - - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.ico b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.res b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.res deleted file mode 100644 index f896e26c..00000000 Binary files a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDelphi.groupproj b/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDelphi.groupproj deleted file mode 100644 index d44be246..00000000 --- a/Source/VCL/SynEdit/Packages/Berlin/Delphi/SynEditDelphi.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/D2007/SynEdit_D2007.dpk b/Source/VCL/SynEdit/Packages/D2007/SynEdit_D2007.dpk new file mode 100644 index 00000000..2df3e94f --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D2007/SynEdit_D2007.dpk @@ -0,0 +1,39 @@ +package SynEdit_D2007; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS OFF} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS OFF} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO OFF} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R2007; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D2007/SynEdit_R2007.dpk b/Source/VCL/SynEdit/Packages/D2007/SynEdit_R2007.dpk new file mode 100644 index 00000000..36bb2446 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D2007/SynEdit_R2007.dpk @@ -0,0 +1,140 @@ +package SynEdit_R2007; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS OFF} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS OFF} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO OFF} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$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', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterUnreal in '..\..\Source\SynHighlighterUnreal.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUnicode in '..\..\Source\SynUnicode.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D2009/SynEdit_D2009.dpk b/Source/VCL/SynEdit/Packages/D2009/SynEdit_D2009.dpk new file mode 100644 index 00000000..4247e1d5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D2009/SynEdit_D2009.dpk @@ -0,0 +1,39 @@ +package SynEdit_D2009; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R2009; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D2009/SynEdit_R2009.dpk b/Source/VCL/SynEdit/Packages/D2009/SynEdit_R2009.dpk new file mode 100644 index 00000000..8634ed6a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D2009/SynEdit_R2009.dpk @@ -0,0 +1,141 @@ +package SynEdit_R2009; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$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', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas', + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_D7.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7.dpk new file mode 100644 index 00000000..91220a08 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7.dpk @@ -0,0 +1,39 @@ +package SynEdit_D7; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + DesignIDE, + SynEdit_R7; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_CLX.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_CLX.dpk new file mode 100644 index 00000000..b03652a5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_CLX.dpk @@ -0,0 +1,40 @@ +package SynEdit_D7_CLX; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit CLX component suite'} +{$IMPLICITBUILD ON} +{$DEFINE SYN_CLX} + +requires + visualclx, + visualdbclx, + designide; + +contains + QSynEditReg in '..\Source\QSynEditReg.pas', + QSynEditPropertyReg in '..\Source\QSynEditPropertyReg.pas', + QSynUnicode in '..\Source\QSynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_PE.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_PE.dpk new file mode 100644 index 00000000..71c172fc --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_PE.dpk @@ -0,0 +1,39 @@ +package SynEdit_D7_PE; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$IMPLICITBUILD ON} +{$DEFINE SYN_DELPHI_PE} + +requires + vcl, + vclx, + designide; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_TNT.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_TNT.dpk new file mode 100644 index 00000000..04bd0ce5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_D7_TNT.dpk @@ -0,0 +1,42 @@ +package SynEdit_D7_TNT; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} +{$DEFINE USE_TNT_DESIGNTIME_SUPPORT} + +requires + TntUnicodeVcl_D70, + TntUnicodeVcl_R70, + designide, + SynEdit_R7_TNT; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_R7.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_R7.dpk new file mode 100644 index 00000000..aecc715f --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_R7.dpk @@ -0,0 +1,139 @@ +package SynEdit_R7; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +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', + SynUnicode in '..\..\Source\SynUnicode.pas', + SynEditAutoComplete in '..\..\Source\SynEditAutoComplete.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.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', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.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', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.pas', + SynHighlighterGo in '..\..\source\SynHighlighterGo.pas', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/D7/SynEdit_R7_TNT.dpk b/Source/VCL/SynEdit/Packages/D7/SynEdit_R7_TNT.dpk new file mode 100644 index 00000000..c392f233 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/D7/SynEdit_R7_TNT.dpk @@ -0,0 +1,137 @@ +package SynEdit_R7_TNT; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD ON} +{$DEFINE USE_TNT_RUNTIME_SUPPORT} + +requires + vcl, + vcldb, + vclx, + TntUnicodeVcl_R70, + 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', + SynUnicode in '..\Source\SynUnicode.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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynUsp10 in '..\Source\SynUsp10.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCBuilder.groupproj b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCBuilder.groupproj deleted file mode 100644 index 15034ac7..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCBuilder.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {F9BE6A59-BDDF-49EA-8DBD-FFCEA9630B0C} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cbproj b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cbproj deleted file mode 100644 index c0f4086d..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cbproj +++ /dev/null @@ -1,1278 +0,0 @@ - - - {88C414E8-F605-439F-BFE3-ED336BBE7E56} - 18.8 - VCL - SynEditCD.cpp - True - Release - Win32 - 1 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 260 - true - CppPackage - ..\..\..\Source;$(DCC_UnitSearchPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - ..\..\..\Source\;$(ILINK_LibraryPath) - true - -LUDesignIDE - ..\..\..\Source\;$(IncludePath) - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - TurboPack SynEdit CBuilder designtime package - true - <_TCHARMapping>char - SynEditCD - 1031 - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - - - true - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - true - - - true - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - 260 - - - - 7 - - - 1 - - - 0 - - - 2 - - - 9 - - - 11 - - - 8 - - - 12 - - - 10 - - - 3 - - - 5 - - - 4 - - - 6 - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCD.cpp - - - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - - - - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 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 - - - 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 - - - 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 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - False - False - False - False - True - False - - - 12 - - - - - diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cpp b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cpp deleted file mode 100644 index f793908a..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//--------------------------------------------------------------------------- - -#include -#pragma hdrstop -#pragma package(smart_init) -//--------------------------------------------------------------------------- - -// Package-Quelltext. -//--------------------------------------------------------------------------- - - -#pragma argsused -extern "C" int _libmain(unsigned long reason) -{ - return 1; -} -//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.res b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.res deleted file mode 100644 index ed24e620..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cbproj b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cbproj deleted file mode 100644 index 190a81df..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cbproj +++ /dev/null @@ -1,1612 +0,0 @@ - - - {30340F4A-5FE6-4B66-ACCF-D1A8B0758ADE} - 18.8 - VCL - SynEditCR.cpp - True - Release - Win32 - 3 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 260 - true - ..\..\..\Source;$(DCC_UnitSearchPath) - true - CppPackage - ..\..\..\Source\;$(ILINK_LibraryPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - true - SynEditCR - TurboPack SynEdit CBuilder runtime package - ..\..\..\Source\;$(IncludePath) - <_TCHARMapping>char - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - true - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - 64 - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - true - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - 1033 - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - - - true - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - true - - - true - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - 260 - - - - 116 - - - 1 - - - 0 - - - 112 - - - 114 - - - 117 - - - 111 - - - 115 - - - 113 - - - 3 - - -
frmAutoCorrectEditor
- dfm - 4 -
- - 5 - - - 6 - - - 7 - - - 8 - - - 9 - - - 10 - - - 11 - - - 12 - - -
SynEditKeystrokeEditorForm
- dfm - 13 -
- - 14 - - -
SynEditKeystrokesEditorForm
- dfm - 15 -
- - 16 - - - 17 - - - 18 - - -
fmEditorOptionsDialog
- dfm - 19 -
- - 20 - - - 21 - - - 22 - - - 23 - - - 24 - - -
SynEditPrintMarginsDlg
- dfm - 25 -
- - 26 - - - 27 - - - 29 - - - 32 - - - 33 - - - 34 - - - 35 - - - 36 - - - 37 - - - 38 - - - 39 - - - 40 - - - 41 - - - 42 - - - 43 - - - 44 - - - 45 - - - 46 - - - 47 - - - 48 - - - 49 - - - 50 - - - 51 - - - 52 - - - 53 - - - 54 - - - 55 - - - 56 - - - 57 - - - 58 - - - 59 - - - 60 - - - 61 - - - 62 - - - 63 - - - 64 - - - 65 - - - 66 - - - 67 - - - 68 - - - 69 - - - 70 - - - 71 - - - 72 - - - 73 - - - 111 - - - 74 - - - 75 - - - 76 - - - 77 - - - 79 - - - 80 - - - 81 - - - 82 - - - 83 - - - 84 - - - 85 - - - 86 - - - 87 - - - 112 - - - 88 - - - 89 - - - 90 - - - 91 - - - 92 - - - 93 - - - 94 - - - 95 - - - 96 - - - 97 - - - 98 - - - 99 - - - 100 - - - 101 - - - 102 - - - 103 - - - 104 - - - 105 - - - 106 - - - 107 - - - 108 - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCR.cpp - - - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - - - - - - SynEditCR.bpl - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 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 - - - 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 - - - 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 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - False - False - False - False - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cpp b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cpp deleted file mode 100644 index 64c8315c..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//--------------------------------------------------------------------------- - -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -USEFORMNS("..\..\..\Source\SynEditKeyCmdEditor.pas", Syneditkeycmdeditor, SynEditKeystrokeEditorForm); -USEFORMNS("..\..\..\Source\SynEditOptionsDialog.pas", Syneditoptionsdialog, fmEditorOptionsDialog); -USEFORMNS("..\..\..\Source\SynEditKeyCmdsEditor.pas", Syneditkeycmdseditor, SynEditKeystrokesEditorForm); -USEFORMNS("..\..\..\Source\SynAutoCorrectEditor.pas", Synautocorrecteditor, frmAutoCorrectEditor); -USEFORMNS("..\..\..\Source\SynEditPrintMarginsDialog.pas", Syneditprintmarginsdialog, SynEditPrintMarginsDlg); -//--------------------------------------------------------------------------- -#pragma package(smart_init) -//--------------------------------------------------------------------------- - -// Package-Quelltext. -//--------------------------------------------------------------------------- - - -#pragma argsused -extern "C" int _libmain(unsigned long reason) -{ - return 1; -} -//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.res b/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.res deleted file mode 100644 index 38aeb3a9..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/CBuilder/SynEditCR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dproj b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dproj deleted file mode 100644 index 63a6fd84..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.dproj +++ /dev/null @@ -1,221 +0,0 @@ - - - True - Package - Release - None - SynEditDD.dpk - Win32 - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - 18.8 - 1 - - - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEditDD - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi designtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - true - 260 - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - SynEdit_RXE6;$(DCC_UsePackage) - SynEditDD.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - - MainSource - - - - - - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - - - - Delphi.Personality.12 - Package - - - - SynEditDD.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDD.bpl - true - - - - - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - - - Assets - 1 - - - - - Assets - 1 - - - - - - True - False - - - 12 - - - - - diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.ico b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.res b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.res deleted file mode 100644 index 0a66bd55..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dpk b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dpk deleted file mode 100644 index 02a8fe31..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dpk +++ /dev/null @@ -1,144 +0,0 @@ -package SynEditDR; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$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} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi runtime package'} -{$LIBSUFFIX '260'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - 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', - SynEditCodeFolding in '..\..\..\Source\SynEditCodeFolding.pas', - SynEditDataObject in '..\..\..\Source\SynEditDataObject.pas', - SynEditDragDrop in '..\..\..\Source\SynEditDragDrop.pas', - SynEditExport in '..\..\..\Source\SynEditExport.pas', - SynEditHighlighter in '..\..\..\Source\SynEditHighlighter.pas', - SynEditHighlighterOptions in '..\..\..\Source\SynEditHighlighterOptions.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', - 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', - SynEditWordWrap in '..\..\..\Source\SynEditWordWrap.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', - SynHighlighterCss in '..\..\..\Source\SynHighlighterCss.pas', - SynHighlighterDfm in '..\..\..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\..\..\Source\SynHighlighterDml.pas', - SynHighlighterDOT in '..\..\..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\..\..\Source\SynHighlighterDWS.pas', - SynHighlighterEiffel in '..\..\..\Source\SynHighlighterEiffel.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', - SynHighlighterJSON in '..\..\..\Source\SynHighlighterJSON.pas', - SynHighlighterKix in '..\..\..\Source\SynHighlighterKix.pas', - SynHighlighterLDraw in '..\..\..\Source\SynHighlighterLDraw.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', - SynHighlighterRexx in '..\..\..\Source\SynHighlighterRexx.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', - SynHighlighterURI in '..\..\..\Source\SynHighlighterURI.pas', - SynHighlighterVB in '..\..\..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\..\..\Source\SynHighlighterVBScript.pas', - SynHighlighterVrml97 in '..\..\..\Source\SynHighlighterVrml97.pas', - SynHighlighterXML in '..\..\..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\..\..\Source\SynMacroRecorder.pas', - SynTextDrawer in '..\..\..\Source\SynTextDrawer.pas', - SynUnicode in '..\..\..\Source\SynUnicode.pas', - SynURIOpener in '..\..\..\Source\SynURIOpener.pas', - SynUsp10 in '..\..\..\Source\SynUsp10.pas'; - -end. diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dproj b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dproj deleted file mode 100644 index 2a1cac44..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.dproj +++ /dev/null @@ -1,385 +0,0 @@ - - - True - Package - Release - VCL - SynEditDR.dpk - Win32 - {AC917C2B-5870-48AD-981D-668AD3E4A533} - 18.8 - 3 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - SynEditDR - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi runtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - 260 - true - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - true - 1033 - - - - MainSource - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- - -
$ENDIF
-
- - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEditDR.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDR.bpl - true - - - - - SynEditDR.bpl - true - - - - - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - False - - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.ico b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.res b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.res deleted file mode 100644 index f896e26c..00000000 Binary files a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDelphi.groupproj b/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDelphi.groupproj deleted file mode 100644 index 80f7ed1f..00000000 --- a/Source/VCL/SynEdit/Packages/Rio/Delphi/SynEditDelphi.groupproj +++ /dev/null @@ -1,51 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCBuilder.groupproj b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCBuilder.groupproj deleted file mode 100644 index 15034ac7..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCBuilder.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {F9BE6A59-BDDF-49EA-8DBD-FFCEA9630B0C} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cbproj b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cbproj deleted file mode 100644 index a99b1de7..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cbproj +++ /dev/null @@ -1,1325 +0,0 @@ - - - {88C414E8-F605-439F-BFE3-ED336BBE7E56} - 19.0 - VCL - SynEditCD.cpp - True - Release - Win32 - 1 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 260 - true - CppPackage - ..\..\..\Source;$(DCC_UnitSearchPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - ..\..\..\Source\;$(ILINK_LibraryPath) - true - -LUDesignIDE - ..\..\..\Source\;$(IncludePath) - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - TurboPack SynEdit CBuilder designtime package - true - <_TCHARMapping>char - SynEditCD - 1031 - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - true - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - 270 - - - - 7 - - - 1 - - - 0 - - - 2 - - - 9 - - - 11 - - - 8 - - - 12 - - - 10 - - - 3 - - - 5 - - - 4 - - - 6 - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCD.cpp - - - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCD.bpl - true - - - - - SynEditCD.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 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 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 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 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - False - False - True - False - - - 12 - - - - - diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.res b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.res deleted file mode 100644 index ed24e620..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cbproj b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cbproj deleted file mode 100644 index 281a44ce..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cbproj +++ /dev/null @@ -1,1667 +0,0 @@ - - - {30340F4A-5FE6-4B66-ACCF-D1A8B0758ADE} - 19.0 - VCL - SynEditCR.cpp - True - Release - Win32 - 3 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 270 - true - ..\..\..\Source;$(DCC_UnitSearchPath) - true - CppPackage - ..\..\..\Source\;$(ILINK_LibraryPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - true - SynEditCR - TurboPack SynEdit CBuilder runtime package - ..\..\..\Source\;$(IncludePath) - <_TCHARMapping>char - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - true - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - 64 - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports) - - - Base - iPhoneAndiPad - $(MSBuildProjectName) - true - true - true - bindcomp;bindcompdbx;bindcompfmx;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapFireDAC;DataSnapNativeClient;DataSnapProviderClient;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXSqliteDriver;dsnap;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACCommon;FireDACCommonDriver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACSqliteDriver;fmx;fmxase;fmxFireDAC;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;xmlrtl;$(PackageImports);$(PackageImports) - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user - Debug - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - true - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - 1033 - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - true - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - - - - 116 - - - 1 - - - 0 - - - 112 - - - 114 - - - 117 - - - 111 - - - 115 - - - 113 - - - 110 - - -
frmAutoCorrectEditor
- dfm - 110 -
- - 110 - - - 110 - - - 110 - - - 110 - - - 111 - - - 112 - - - 113 - - - 113 - - - 113 - - - 113 - - - 113 - - -
SynEditKeystrokeEditorForm
- dfm - 113 -
- - 113 - - -
SynEditKeystrokesEditorForm
- dfm - 113 -
- - 113 - - - 113 - - - 113 - - -
fmEditorOptionsDialog
- dfm - 113 -
- - 113 - - - 113 - - - 113 - - - 113 - - - 113 - - -
SynEditPrintMarginsDlg
- dfm - 113 -
- - 113 - - - 113 - - - 114 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 115 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 116 - - - 117 - - - 118 - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCR.cpp - - - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 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 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 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 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - False - False - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cpp b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cpp deleted file mode 100644 index 64c8315c..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//--------------------------------------------------------------------------- - -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -USEFORMNS("..\..\..\Source\SynEditKeyCmdEditor.pas", Syneditkeycmdeditor, SynEditKeystrokeEditorForm); -USEFORMNS("..\..\..\Source\SynEditOptionsDialog.pas", Syneditoptionsdialog, fmEditorOptionsDialog); -USEFORMNS("..\..\..\Source\SynEditKeyCmdsEditor.pas", Syneditkeycmdseditor, SynEditKeystrokesEditorForm); -USEFORMNS("..\..\..\Source\SynAutoCorrectEditor.pas", Synautocorrecteditor, frmAutoCorrectEditor); -USEFORMNS("..\..\..\Source\SynEditPrintMarginsDialog.pas", Syneditprintmarginsdialog, SynEditPrintMarginsDlg); -//--------------------------------------------------------------------------- -#pragma package(smart_init) -//--------------------------------------------------------------------------- - -// Package-Quelltext. -//--------------------------------------------------------------------------- - - -#pragma argsused -extern "C" int _libmain(unsigned long reason) -{ - return 1; -} -//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.res b/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.res deleted file mode 100644 index 38aeb3a9..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.ico b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.res b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.res deleted file mode 100644 index 0a66bd55..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dpk b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dpk deleted file mode 100644 index a43bbf26..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dpk +++ /dev/null @@ -1,144 +0,0 @@ -package SynEditDR; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$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} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi runtime package'} -{$LIBSUFFIX '270'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - 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', - SynEditCodeFolding in '..\..\..\Source\SynEditCodeFolding.pas', - SynEditDataObject in '..\..\..\Source\SynEditDataObject.pas', - SynEditDragDrop in '..\..\..\Source\SynEditDragDrop.pas', - SynEditExport in '..\..\..\Source\SynEditExport.pas', - SynEditHighlighter in '..\..\..\Source\SynEditHighlighter.pas', - SynEditHighlighterOptions in '..\..\..\Source\SynEditHighlighterOptions.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', - 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', - SynEditWordWrap in '..\..\..\Source\SynEditWordWrap.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', - SynHighlighterCss in '..\..\..\Source\SynHighlighterCss.pas', - SynHighlighterDfm in '..\..\..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\..\..\Source\SynHighlighterDml.pas', - SynHighlighterDOT in '..\..\..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\..\..\Source\SynHighlighterDWS.pas', - SynHighlighterEiffel in '..\..\..\Source\SynHighlighterEiffel.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', - SynHighlighterJSON in '..\..\..\Source\SynHighlighterJSON.pas', - SynHighlighterKix in '..\..\..\Source\SynHighlighterKix.pas', - SynHighlighterLDraw in '..\..\..\Source\SynHighlighterLDraw.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', - SynHighlighterRexx in '..\..\..\Source\SynHighlighterRexx.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', - SynHighlighterURI in '..\..\..\Source\SynHighlighterURI.pas', - SynHighlighterVB in '..\..\..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\..\..\Source\SynHighlighterVBScript.pas', - SynHighlighterVrml97 in '..\..\..\Source\SynHighlighterVrml97.pas', - SynHighlighterXML in '..\..\..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\..\..\Source\SynMacroRecorder.pas', - SynTextDrawer in '..\..\..\Source\SynTextDrawer.pas', - SynUnicode in '..\..\..\Source\SynUnicode.pas', - SynURIOpener in '..\..\..\Source\SynURIOpener.pas', - SynUsp10 in '..\..\..\Source\SynUsp10.pas'; - -end. diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dproj b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dproj deleted file mode 100644 index 2b7a047c..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.dproj +++ /dev/null @@ -1,867 +0,0 @@ - - - True - Package - Release - VCL - SynEditDR.dpk - Win32 - {AC917C2B-5870-48AD-981D-668AD3E4A533} - 19.0 - 3 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - SynEditDR - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi runtime package - 00400000 - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - true - true - 270 - true - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - ..\cpp\$(Platform)\$(Config) - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - true - 1033 - - - - MainSource - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEditDR.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDR.bpl - true - - - - - SynEditDR.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - False - - False - False - False - False - False - False - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.ico b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.res b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.res deleted file mode 100644 index f896e26c..00000000 Binary files a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDelphi.groupproj b/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDelphi.groupproj deleted file mode 100644 index d44be246..00000000 --- a/Source/VCL/SynEdit/Packages/Sydney/Delphi/SynEditDelphi.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCB5.bpk b/Source/VCL/SynEdit/Packages/SynEdit_BCB5.bpk new file mode 100644 index 00000000..d901033f --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB5.bpk @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=1 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[CORBA] +AddServerUnit=1 +AddClientUnit=1 +PrecompiledHeaders=1 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCB5.cpp b/Source/VCL/SynEdit/Packages/SynEdit_BCB5.cpp new file mode 100644 index 00000000..c089940a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB5.cpp @@ -0,0 +1,25 @@ +//--------------------------------------------------------------------------- + +#include +#pragma hdrstop +USERES("SynEdit_BCB5.res"); +USEPACKAGE("vcl50.bpi"); +USEUNIT("..\Source\SynEditReg.pas"); +USERES("..\Source\SynEditReg.dcr"); +USEUNIT("..\Source\SynEditPropertyReg.pas"); +USEPACKAGE("vclx50.bpi"); +USEPACKAGE("vcldb50.bpi"); +USEPACKAGE("dsnide50.bpi"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- + +// Package source. +//--------------------------------------------------------------------------- + +#pragma argsused +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCB6.bpk b/Source/VCL/SynEdit/Packages/SynEdit_BCB6.bpk new file mode 100644 index 00000000..4d2d7537 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB6.bpk @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=1 +Item0=..\Source;$(BCB)\include;$(BCB)\include\vcl + +[HistoryLists\hlLibraryPath] +Count=2 +Item0=..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(BCB)\Source\Toolsapi +Item1=..\Source;$(BCB)\lib\obj;$(BCB)\lib + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=_DEBUG + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[CORBA] +AddServerUnit=1 +AddClientUnit=1 +PrecompiledHeaders=1 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + +[Linker] +LibPrefix= +LibSuffix= +LibVersion= + + \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cpp b/Source/VCL/SynEdit/Packages/SynEdit_BCB6.cpp similarity index 51% rename from Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cpp rename to Source/VCL/SynEdit/Packages/SynEdit_BCB6.cpp index f793908a..334f02c9 100644 --- a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.cpp +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB6.cpp @@ -1,17 +1,23 @@ //--------------------------------------------------------------------------- -#include +#include #pragma hdrstop +USERES("SynEdit_BCB6.res"); +USEPACKAGE("vcl60.bpi"); +USEUNIT("..\Source\SynEditReg.pas"); +USERES("..\Source\SynEditReg.dcr"); +USEUNIT("..\Source\SynEditPropertyReg.pas"); +USEPACKAGE("vclx60.bpi"); +USEPACKAGE("vcldb60.bpi"); #pragma package(smart_init) //--------------------------------------------------------------------------- -// Package-Quelltext. +// Package source. //--------------------------------------------------------------------------- - #pragma argsused -extern "C" int _libmain(unsigned long reason) +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { - return 1; + return 1; } //--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.bpk b/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.bpk new file mode 100644 index 00000000..12b08dc9 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.bpk @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=1 +Item0=..\Source;$(BCB)\include;$(BCB)\include\vcl + +[HistoryLists\hlLibraryPath] +Count=1 +Item0=..\Source;$(BCB)\lib\obj;$(BCB)\lib + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=2 +Item0=_DEBUG;SYN_DELPHI_PE +Item1=_DEBUG + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[CORBA] +AddServerUnit=1 +AddClientUnit=1 +PrecompiledHeaders=1 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + +[Linker] +LibPrefix= +LibSuffix= +LibVersion= + + diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.cpp b/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.cpp new file mode 100644 index 00000000..a4b66649 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCB6_PE.cpp @@ -0,0 +1,24 @@ +//--------------------------------------------------------------------------- + +#include +#pragma hdrstop +USERES("SynEdit_BCB6_PE.res"); +USEPACKAGE("vcl60.bpi"); +USEUNIT("..\Source\SynEditReg.pas"); +USERES("..\Source\SynEditReg.dcr"); +USEUNIT("..\Source\SynEditPropertyReg.pas"); +USEPACKAGE("vclx60.bpi"); +USEPACKAGE("designide.bpi"); +//--------------------------------------------------------------------------- +#pragma package(smart_init) +//--------------------------------------------------------------------------- + +// Package source. +//--------------------------------------------------------------------------- + +#pragma argsused +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) +{ + return 1; +} +//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cbproj b/Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cbproj new file mode 100644 index 00000000..63fb8730 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cbproj @@ -0,0 +1,308 @@ + + + {6A19C132-8308-437E-BFF4-B2C9FF204C97} + CppPackage + SynEdit_BCBXE6.cpp + Debug + 15.4 + VCL + True + Win32 + 1 + Package + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + SynEdit_BCBXE6 + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + false + ..\Source\;$(BDS)\include\vcl;..\Source;$(IncludePath) + rtl.lib;vcldb.lib;adortl.lib;bdertl.lib;vcldbx.lib;ibxpress.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + true + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) + true + Windows + .\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) + ..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BRCC_IncludePath) + -I..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware + true + true + ..\Source;$(BDS)\include;$(BDS)\include\vcl;$(TASM_IncludePath) + true + ..\Source;$(BDS)\include;$(BDS)\include\vcl;$(BCC_IncludePath) + true + JPHNE + true + true + bpl + . + Package + /w2 + rtl.lib;vcldb.lib;adortl.lib;bdertl.lib;vcldbx.lib;ibxpress.lib;dsnap.lib;dsnapcon.lib;teeui.lib;teedb.lib;tee.lib;dsnapcon.lib;bcbsmp.lib;inetdbbde.lib;inetdbxpress.lib;dbexpress.lib;bcbie.lib;soaprtl.lib;dbxcds.lib;indycore.lib;indysystem.lib;bcboffice2k.lib + SynEdit component suite + ..\Source\;$(BDS)\include\vcl;..\Source;$(BDS)\lib\obj;$(BDS)\lib;$(BDS)\Source\Toolsapi;$(BDS)\lib\psdk;$(ILINK_LibraryPath) + true + -M -LUDesignIDE + true + true + false + + + -Vx -r- -k -Ve + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) + $(BDSINCLUDE)\windows\vcl;$(IncludePath) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + 1033 + + + _DEBUG;$(TASM_Defines) + _DEBUG;$(BRCC_Defines) + $(BDSINCLUDE)\windows\vcl;$(IncludePath) + + + $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + Debug_Build + DEBUG;$(DCC_Define);$(DCC_Define) + true + Full + -M -V -LUDesignIDE + true + true + + + _DEBUG;$(BCC_Defines);$(BCC_Defines) + $(BDS)\lib\win32\release\;$(ILINK_LibraryPath) + -Vx -r- -k -Ve -k + + + _DEBUG;$(BCC_Defines);$(BCC_Defines) + + + true + Release_Build + -M -$O+ -LUDesignIDE + None + $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) + true + + + NDEBUG;$(BCC_Defines);$(BCC_Defines) + -Vx -r- -k -Ve -r + + + NDEBUG;$(BCC_Defines);$(BCC_Defines) + + + + 38 + 3 + + + 14 + 11 + + + 29 + 0 + + + 8 + 5 + + + 9 + 2 + + + 8 + 7 + + + 17 + 10 + + + 12 + 11 + + + 26 + 1 + + + -1 + 23 + + + 6 + 20 + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + + CPlusPlusBuilder.Personality.12 + CppPackage + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + 1 + ..\Source;$(BCB)\include;$(BCB)\include\vcl + + + 2 + ..\Source;$(BCB)\lib\obj;$(BCB)\lib;$(BCB)\Source\Toolsapi + ..\Source;$(BCB)\lib\obj;$(BCB)\lib + + + 1 + $(BCB)\source\vcl + + + 1 + _DEBUG + + + 4 + C:\Arquivos de programas\Borland\CBuilder6\Lib\ + C:\Arquivos de programas\Borland\CBuilder6\Lib + $(BCB)\lib\ + $(BCB)\lib + + + $(BCB)\source\vcl + + + + + False + + + + + + + False + + False + + True + False + + + 0 + 0 + 0 + + + 1 + 1 + 1 + + + False + True + True + False + + + SynEdit_BCBXE6.cpp + + + + False + True + False + + + 12 + + + diff --git a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cpp b/Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cpp similarity index 74% rename from Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cpp rename to Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cpp index f793908a..c3df9c90 100644 --- a/Source/VCL/SynEdit/Packages/Sydney/CBuilder/SynEditCD.cpp +++ b/Source/VCL/SynEdit/Packages/SynEdit_BCBXE6.cpp @@ -1,17 +1,16 @@ //--------------------------------------------------------------------------- -#include +#include #pragma hdrstop #pragma package(smart_init) //--------------------------------------------------------------------------- -// Package-Quelltext. +// Package source. //--------------------------------------------------------------------------- - #pragma argsused -extern "C" int _libmain(unsigned long reason) +int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { - return 1; + return 1; } //--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D2005.bdsproj b/Source/VCL/SynEdit/Packages/SynEdit_D2005.bdsproj new file mode 100644 index 00000000..a31d6314 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D2005.bdsproj @@ -0,0 +1,173 @@ + + + + + + + + + + + + SynEdit_D2005.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + + + 0 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + SynEdit component suite + + + + + + + + + + + False + + + + + + False + + + + + + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D2005.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D2005.dpk new file mode 100644 index 00000000..045e51f4 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D2005.dpk @@ -0,0 +1,39 @@ +package SynEdit_D2005; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R2005; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D2006.bdsproj b/Source/VCL/SynEdit/Packages/SynEdit_D2006.bdsproj new file mode 100644 index 00000000..8be0de79 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D2006.bdsproj @@ -0,0 +1,180 @@ + + + + + + + + + + + + SynEdit_D2006.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + + + + 0 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + SynEdit component suite + False + + + + + + + + + + + False + + + + + + False + + + + + + False + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D2006.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D2006.dpk new file mode 100644 index 00000000..e55bc29f --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D2006.dpk @@ -0,0 +1,39 @@ +package SynEdit_D2006; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R2006; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D5.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D5.dpk new file mode 100644 index 00000000..1f68748b --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D5.dpk @@ -0,0 +1,38 @@ +package SynEdit_D5; + +{$R *.RES} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$IMPLICITBUILD ON} + +requires + SynEdit_R5, + dsnide50; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D5_TNT.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D5_TNT.dpk new file mode 100644 index 00000000..258bca07 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D5_TNT.dpk @@ -0,0 +1,41 @@ +package SynEdit_D5_TNT; + +{$R *.RES} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$IMPLICITBUILD ON} +{$DEFINE USE_TNT_DESIGNTIME_SUPPORT} + +requires + TntUnicodeVcl_D50, + TntUnicodeVcl_R50, + SynEdit_R5, + dsnide50; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D6.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D6.dpk new file mode 100644 index 00000000..26a5eb77 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D6.dpk @@ -0,0 +1,39 @@ +package SynEdit_D6; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R6; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D6_CLX.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D6_CLX.dpk new file mode 100644 index 00000000..5d764b80 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D6_CLX.dpk @@ -0,0 +1,138 @@ +package SynEdit_D6_CLX; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit CLX component suite'} +{$IMPLICITBUILD ON} +{$DEFINE SYN_CLX} + +requires + visualclx, + visualdbclx, + designide, + SynEdit_R6; + +contains + QSynEditReg in '..\Source\QSynEditReg.pas', + QSynAutoCorrect in '..\Source\QSynAutoCorrect.pas', + QSynAutoCorrectEditor in '..\Source\QSynAutoCorrectEditor.pas', + QSynCompletionProposal in '..\Source\QSynCompletionProposal.pas', + QSynDBEdit in '..\Source\QSynDBEdit.pas', + QSynEdit in '..\Source\QSynEdit.pas', + QSynEditAutoComplete in '..\Source\QSynEditAutoComplete.pas', + QSynEditExport in '..\Source\QSynEditExport.pas', + QSynEditHighlighter in '..\Source\QSynEditHighlighter.pas', + QSynEditKbdHandler in '..\Source\QSynEditKbdHandler.pas', + QSynEditKeyCmdEditor in '..\Source\QSynEditKeyCmdEditor.pas', + QSynEditKeyCmds in '..\Source\QSynEditKeyCmds.pas', + QSynEditKeyCmdsEditor in '..\Source\QSynEditKeyCmdsEditor.pas', + QSynEditKeyConst in '..\Source\QSynEditKeyConst.pas', + QSynEditMiscClasses in '..\Source\QSynEditMiscClasses.pas', + QSynEditMiscProcs in '..\Source\QSynEditMiscProcs.pas', + QSynEditOptionsDialog in '..\Source\QSynEditOptionsDialog.pas', + QSynEditPlugins in '..\Source\QSynEditPlugins.pas', + QSynEditPrint in '..\Source\QSynEditPrint.pas', + QSynEditPrinterInfo in '..\Source\QSynEditPrinterInfo.pas', + QSynEditPrintHeaderFooter in '..\Source\QSynEditPrintHeaderFooter.pas', + QSynEditPrintMargins in '..\Source\QSynEditPrintMargins.pas', + QSynEditPrintMarginsDialog in '..\Source\QSynEditPrintMarginsDialog.pas', + QSynEditPrintPreview in '..\Source\QSynEditPrintPreview.pas', + QSynEditPrintTypes in '..\Source\QSynEditPrintTypes.pas', + QSynEditPythonBehaviour in '..\Source\QSynEditPythonBehaviour.pas', + QSynEditRegexSearch in '..\Source\QSynEditRegexSearch.pas', + QSynEditSearch in '..\Source\QSynEditSearch.pas', + QSynEditStrConst in '..\Source\QSynEditStrConst.pas', + QSynEditTextBuffer in '..\Source\QSynEditTextBuffer.pas', + QSynEditTypes in '..\Source\QSynEditTypes.pas', + QSynExportHTML in '..\Source\QSynExportHTML.pas', + QSynExportRTF in '..\Source\QSynExportRTF.pas', + QSynExportTeX in '..\Source\QSynExportTeX.pas', + QSynHighlighterADSP21xx in '..\Source\QSynHighlighterADSP21xx.pas', + QSynHighlighterAsm in '..\Source\QSynHighlighterAsm.pas', + QSynHighlighterAWK in '..\Source\QSynHighlighterAWK.pas', + QSynHighlighterBaan in '..\Source\QSynHighlighterBaan.pas', + QSynHighlighterBat in '..\Source\QSynHighlighterBat.pas', + QSynHighlighterCAC in '..\Source\QSynHighlighterCAC.pas', + QSynHighlighterCache in '..\Source\QSynHighlighterCache.pas', + QSynHighlighterCobol in '..\Source\QSynHighlighterCobol.pas', + QSynHighlighterCPM in '..\Source\QSynHighlighterCPM.pas', + QSynHighlighterCpp in '..\Source\QSynHighlighterCpp.pas', + QSynHighlighterCS in '..\Source\QSynHighlighterCS.pas', + QSynHighlighterCss in '..\Source\QSynHighlighterCss.pas', + QSynHighlighterDfm in '..\Source\QSynHighlighterDfm.pas', + QSynHighlighterDml in '..\Source\QSynHighlighterDml.pas', + QSynHighlighterFortran in '..\Source\QSynHighlighterFortran.pas', + QSynHighlighterFoxpro in '..\Source\QSynHighlighterFoxpro.pas', + QSynHighlighterGalaxy in '..\Source\QSynHighlighterGalaxy.pas', + QSynHighlighterGeneral in '..\Source\QSynHighlighterGeneral.pas', + QSynHighlighterGWS in '..\Source\QSynHighlighterGWS.pas', + QSynHighlighterHashEntries in '..\Source\QSynHighlighterHashEntries.pas', + QSynHighlighterHaskell in '..\Source\QSynHighlighterHaskell.pas', + QSynHighlighterHC11 in '..\Source\QSynHighlighterHC11.pas', + QSynHighlighterHP48 in '..\Source\QSynHighlighterHP48.pas', + QSynHighlighterHtml in '..\Source\QSynHighlighterHtml.pas', + QSynHighlighterIDL in '..\Source\QSynHighlighterIDL.pas', + QSynHighlighterIni in '..\Source\QSynHighlighterIni.pas', + QSynHighlighterInno in '..\Source\QSynHighlighterInno.pas', + QSynHighlighterJava in '..\Source\QSynHighlighterJava.pas', + QSynHighlighterJScript in '..\Source\QSynHighlighterJScript.pas', + QSynHighlighterKix in '..\Source\QSynHighlighterKix.pas', + QSynHighlighterLDraw in '..\Source\QSynHighlighterLDraw.pas', + QSynHighlighterM3 in '..\Source\QSynHighlighterM3.pas', + QSynHighlighterManager in '..\Source\QSynHighlighterManager.pas', + QSynHighlighterModelica in '..\Source\QSynHighlighterModelica.pas', + QSynHighlighterMsg in '..\Source\QSynHighlighterMsg.pas', + QSynHighlighterMulti in '..\Source\QSynHighlighterMulti.pas', + QSynHighlighterPas in '..\Source\QSynHighlighterPas.pas', + QSynHighlighterPerl in '..\Source\QSynHighlighterPerl.pas', + QSynHighlighterPHP in '..\Source\QSynHighlighterPHP.pas', + QSynHighlighterProgress in '..\Source\QSynHighlighterProgress.pas', + QSynHighlighterPython in '..\Source\QSynHighlighterPython.pas', + QSynHighlighterRuby in '..\Source\QSynHighlighterRuby.pas', + QSynHighlighterSDD in '..\Source\QSynHighlighterSDD.pas', + QSynHighlighterSml in '..\Source\QSynHighlighterSml.pas', + QSynHighlighterSQL in '..\Source\QSynHighlighterSQL.pas', + QSynHighlighterST in '..\Source\QSynHighlighterST.pas', + QSynHighlighterTclTk in '..\Source\QSynHighlighterTclTk.pas', + QSynHighlighterTeX in '..\Source\QSynHighlighterTeX.pas', + QSynHighlighterUNIXShellScript in '..\Source\QSynHighlighterUNIXShellScript.pas', + QSynHighlighterUnreal in '..\Source\QSynHighlighterUnreal.pas', + QSynHighlighterVB in '..\Source\QSynHighlighterVB.pas', + QSynHighlighterVBScript in '..\Source\QSynHighlighterVBScript.pas', + QSynHighlighterXML in '..\Source\QSynHighlighterXML.pas', + QSynHighlighterURI in '..\Source\QSynHighlighterURI.pas', + QSynHighlighterDOT in '..\Source\QSynHighlighterDOT.pas', + QSynHighlighterVrml97 in '..\Source\QSynHighlighterVrml97.pas', + QSynURIOpener in '..\Source\QSynURIOpener.pas', + QSynEditWordWrap in '..\Source\QSynEditWordWrap.pas', + QSynMacroRecorder in '..\Source\QSynMacroRecorder.pas', + QSynMemo in '..\Source\QSynMemo.pas', + QSynRegExpr in '..\Source\QSynRegExpr.pas', + kTextDrawer in '..\Source\kTextDrawer.pas', + QSynEditPropertyReg in '..\Source\QSynEditPropertyReg.pas', + QSynUnicode in '..\Source\QSynUnicode.pas', + QSynHighlighterEiffel in '..\Source\QSynHighlighterEiffel.pas', + QSynHighlighterRC in '..\Source\QSynHighlighterRC.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D6_PE.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D6_PE.dpk new file mode 100644 index 00000000..e64e6fbf --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D6_PE.dpk @@ -0,0 +1,39 @@ +package SynEdit_D6_PE; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$IMPLICITBUILD ON} +{$DEFINE SYN_DELPHI_PE} + +requires + designide, + SynEdit_R6_PE; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D6_TNT.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D6_TNT.dpk new file mode 100644 index 00000000..d5c255c6 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D6_TNT.dpk @@ -0,0 +1,42 @@ +package SynEdit_D6_TNT; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} +{$DEFINE USE_TNT_DESIGNTIME_SUPPORT} + +requires + TntUnicodeVcl_D60, + TntUnicodeVcl_R60, + designide, + SynEdit_R6; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_D7_TNT.dpk b/Source/VCL/SynEdit/Packages/SynEdit_D7_TNT.dpk new file mode 100644 index 00000000..04bd0ce5 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_D7_TNT.dpk @@ -0,0 +1,42 @@ +package SynEdit_D7_TNT; + +{$R *.res} +{$R '..\Source\SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} +{$DEFINE USE_TNT_DESIGNTIME_SUPPORT} + +requires + TntUnicodeVcl_D70, + TntUnicodeVcl_R70, + designide, + SynEdit_R7_TNT; + +contains + SynEditReg in '..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R2005.bdsproj b/Source/VCL/SynEdit/Packages/SynEdit_R2005.bdsproj new file mode 100644 index 00000000..74d503d7 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R2005.bdsproj @@ -0,0 +1,173 @@ + + + + + + + + + + + + SynEdit_R2005.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + + + 0 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + SynEdit component suite runtime + + + + + + + + + + + False + + + + + + False + + + + + + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R2005.dpk b/Source/VCL/SynEdit/Packages/SynEdit_R2005.dpk new file mode 100644 index 00000000..b5a01376 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R2005.dpk @@ -0,0 +1,134 @@ +package SynEdit_R2005; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynUnicode in '..\Source\SynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R2006.bdsproj b/Source/VCL/SynEdit/Packages/SynEdit_R2006.bdsproj new file mode 100644 index 00000000..9edf0c88 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R2006.bdsproj @@ -0,0 +1,180 @@ + + + + + + + + + + + + SynEdit_R2006.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + + + + 0 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + SynEdit component suite runtime + False + + + + + + + + + + + False + + + + + + False + + + + + + False + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R2006.dpk b/Source/VCL/SynEdit/Packages/SynEdit_R2006.dpk new file mode 100644 index 00000000..e4930a61 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R2006.dpk @@ -0,0 +1,136 @@ +package SynEdit_R2006; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$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', + SynEditDocumentManager in '..\Source\SynEditDocumentManager.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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynUnicode in '..\Source\SynUnicode.pas', + SynUsp10 in '..\Source\SynUsp10.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R5.dpk b/Source/VCL/SynEdit/Packages/SynEdit_R5.dpk new file mode 100644 index 00000000..678e0418 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R5.dpk @@ -0,0 +1,134 @@ +package SynEdit_R5; + +{$R *.RES} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl50, + Vclx50, + Vcldb50; + +contains + SynTextDrawer in '..\Source\SynTextDrawer.pas', + SynEditSearch in '..\Source\SynEditSearch.pas', + SynEditStrConst in '..\Source\SynEditStrConst.pas', + SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', + SynEditTypes in '..\Source\SynEditTypes.pas', + SynEditHighlighter in '..\Source\SynEditHighlighter.pas', + SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', + SynEditKeyConst in '..\Source\SynEditKeyConst.pas', + SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', + SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', + SynAutoCorrect in '..\Source\SynAutoCorrect.pas', + SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, + SynCompletionProposal in '..\Source\SynCompletionProposal.pas', + SynEdit in '..\Source\SynEdit.pas', + SynMemo in '..\Source\SynMemo.pas', + SynDBEdit in '..\Source\SynDBEdit.pas', + SynMacroRecorder in '..\Source\SynMacroRecorder.pas', + SynRegExpr in '..\Source\SynRegExpr.pas', + SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', + SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\Source\SynEditExport.pas', + SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, + SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', + SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, + 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', + SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', + SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', + SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', + SynURIOpener in '..\Source\SynURIOpener.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', + SynHighlighterCss in '..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGWS in '..\Source\SynHighlighterGWS.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', + 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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\Source\SynHighlighterXML.pas', + SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', + SynHighlighterURI in '..\Source\SynHighlighterURI.pas', + SynUnicode in '..\Source\SynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R6.dpk b/Source/VCL/SynEdit/Packages/SynEdit_R6.dpk new file mode 100644 index 00000000..ef3acb59 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R6.dpk @@ -0,0 +1,134 @@ +package SynEdit_R6; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + vcldb, + vclx; + +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', + SynEditDocumentManager in '..\Source\SynEditDocumentManager.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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynUnicode in '..\Source\SynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/SynEdit_R6_PE.dpk b/Source/VCL/SynEdit/Packages/SynEdit_R6_PE.dpk new file mode 100644 index 00000000..e2019505 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/SynEdit_R6_PE.dpk @@ -0,0 +1,131 @@ +package SynEdit_R6_PE; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + vcl, + vclx; + +contains + SynTextDrawer in '..\Source\SynTextDrawer.pas', + SynAutoCorrect in '..\Source\SynAutoCorrect.pas', + SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, + SynCompletionProposal in '..\Source\SynCompletionProposal.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', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', + SynUnicode in '..\Source\SynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCBuilder.groupproj b/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCBuilder.groupproj deleted file mode 100644 index 15034ac7..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCBuilder.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {F9BE6A59-BDDF-49EA-8DBD-FFCEA9630B0C} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.res b/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.res deleted file mode 100644 index ed24e620..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cbproj b/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cbproj deleted file mode 100644 index 83c6b7dd..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cbproj +++ /dev/null @@ -1,1395 +0,0 @@ - - - {30340F4A-5FE6-4B66-ACCF-D1A8B0758ADE} - 18.7 - VCL - SynEditCR.cpp - True - Release - Win32 - 3 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - 250 - true - ..\..\..\Source;$(DCC_UnitSearchPath) - true - CppPackage - ..\..\..\Source\;$(ILINK_LibraryPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - true - SynEditCR - TurboPack SynEdit CBuilder runtime package - ..\..\..\Source\;$(IncludePath) - <_TCHARMapping>char - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - true - All - true - true - .\$(Platform)\$(Config) - false - true - true - $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - 64 - - - adortl;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CodeSiteExpressPkg;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;frx21;frxDB21;frxe21;frxTee21;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;svn;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - true - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1033 - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - - - true - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - 1033 - $(BDSINCLUDE)\windows\vcl;$(IncludePath) - adortl;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindengine;CloudService;CustomIPTransport;DataSnapClient;DataSnapCommon;DataSnapConnectors;DatasnapConnectorsFreePascal;DataSnapFireDAC;DataSnapIndy10ServerTransport;DataSnapNativeClient;DataSnapProviderClient;DataSnapServer;DataSnapServerMidas;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXDb2Driver;DBXFirebirdDriver;DBXInformixDriver;DBXInterBaseDriver;DBXMSSQLDriver;DBXMySQLDriver;DBXOdbcDriver;DBXOracleDriver;DBXSqliteDriver;DBXSybaseASADriver;DBXSybaseASEDriver;dsnap;dsnapcon;dsnapxml;emsclient;emsclientfiredac;FireDAC;FireDACADSDriver;FireDACASADriver;FireDACCommon;FireDACCommonDriver;FireDACDb2Driver;FireDACDBXDriver;FireDACDSDriver;FireDACIBDriver;FireDACInfxDriver;FireDACMSAccDriver;FireDACMSSQLDriver;FireDACMySQLDriver;FireDACODBCDriver;FireDACOracleDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;FMXTee;FmxTeeUI;ibxpress;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;Intraweb;MetropolisUILiveTile;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;Tee;TeeDB;TeeUI;tethering;vcl;vclactnband;vcldb;vcldsnap;vclFireDAC;vclib;vclie;vclimg;VCLRESTComponents;vclribbon;VclSmp;vcltouch;vclx;xmlrtl;$(PackageImports) - - - false - true - false - true - _DEBUG;$(Defines) - false - None - DEBUG - true - true - true - true - Full - true - true - true - true - true - $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) - $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) - - - true - 1033 - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - - - true - 1033 - - - NDEBUG;$(Defines) - None - - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - true - 1033 - - - true - 1033 - - - - 116 - - - 1 - - - 0 - - - 112 - - - 114 - - - 117 - - - 111 - - - 115 - - - 113 - - - 3 - - -
frmAutoCorrectEditor
- dfm - 4 -
- - 5 - - - 6 - - - 7 - - - 8 - - - 9 - - - 10 - - - 11 - - - 12 - - -
SynEditKeystrokeEditorForm
- dfm - 13 -
- - 14 - - -
SynEditKeystrokesEditorForm
- dfm - 15 -
- - 16 - - - 17 - - - 18 - - -
fmEditorOptionsDialog
- dfm - 19 -
- - 20 - - - 21 - - - 22 - - - 23 - - - 24 - - -
SynEditPrintMarginsDlg
- dfm - 25 -
- - 26 - - - 27 - - - 29 - - - 32 - - - 33 - - - 34 - - - 35 - - - 36 - - - 37 - - - 38 - - - 39 - - - 40 - - - 41 - - - 42 - - - 43 - - - 44 - - - 45 - - - 46 - - - 47 - - - 48 - - - 49 - - - 50 - - - 51 - - - 52 - - - 53 - - - 54 - - - 55 - - - 56 - - - 57 - - - 58 - - - 59 - - - 60 - - - 61 - - - 62 - - - 63 - - - 64 - - - 65 - - - 66 - - - 67 - - - 68 - - - 69 - - - 70 - - - 71 - - - 72 - - - 73 - - - 111 - - - 74 - - - 75 - - - 76 - - - 77 - - - 79 - - - 80 - - - 81 - - - 82 - - - 83 - - - 84 - - - 85 - - - 86 - - - 87 - - - 112 - - - 88 - - - 89 - - - 90 - - - 91 - - - 92 - - - 93 - - - 94 - - - 95 - - - 96 - - - 97 - - - 98 - - - 99 - - - 100 - - - 101 - - - 102 - - - 103 - - - 104 - - - 105 - - - 106 - - - 107 - - - 108 - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - CPlusPlusBuilder.Personality.12 - CppPackage - - - - False - True - True - False - - - SynEditCR.cpp - - - Embarcadero C++Builder-Package für Office 2000-Server - Embarcadero C++Builder-Package für Office XP-Server - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEditCR.bpl - true - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - - - library\lib\mips - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - - - res\values - 1 - - - - - res\values-v21 - 1 - - - - - res\values - 1 - - - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 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 - - - 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 - - - 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 - - - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cpp b/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cpp deleted file mode 100644 index 64c8315c..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//--------------------------------------------------------------------------- - -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -USEFORMNS("..\..\..\Source\SynEditKeyCmdEditor.pas", Syneditkeycmdeditor, SynEditKeystrokeEditorForm); -USEFORMNS("..\..\..\Source\SynEditOptionsDialog.pas", Syneditoptionsdialog, fmEditorOptionsDialog); -USEFORMNS("..\..\..\Source\SynEditKeyCmdsEditor.pas", Syneditkeycmdseditor, SynEditKeystrokesEditorForm); -USEFORMNS("..\..\..\Source\SynAutoCorrectEditor.pas", Synautocorrecteditor, frmAutoCorrectEditor); -USEFORMNS("..\..\..\Source\SynEditPrintMarginsDialog.pas", Syneditprintmarginsdialog, SynEditPrintMarginsDlg); -//--------------------------------------------------------------------------- -#pragma package(smart_init) -//--------------------------------------------------------------------------- - -// Package-Quelltext. -//--------------------------------------------------------------------------- - - -#pragma argsused -extern "C" int _libmain(unsigned long reason) -{ - return 1; -} -//--------------------------------------------------------------------------- diff --git a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.res b/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.res deleted file mode 100644 index 38aeb3a9..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/CBuilder/SynEditCR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dpk b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dpk deleted file mode 100644 index 54265a8f..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dpk +++ /dev/null @@ -1,43 +0,0 @@ -package SynEditDD; - -{$R *.res} -{$R '..\..\..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi designtime package'} -{$LIBSUFFIX '250'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEditDR; - -contains - SynEditReg in '..\..\..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\..\..\Source\SynEditPropertyReg.pas', - SynHighlighterManager in '..\..\..\Source\SynHighlighterManager.pas'; - -end. diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dproj b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dproj deleted file mode 100644 index accf86eb..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.dproj +++ /dev/null @@ -1,222 +0,0 @@ - - - True - Package - Release - None - SynEditDD.dpk - Win32 - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - 18.7 - 1 - - - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEditDD - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi designtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - true - 250 - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - SynEdit_RXE6;$(DCC_UsePackage) - SynEditDD.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - - MainSource - - - - - - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - - - - Delphi.Personality.12 - Package - - - - SynEditDD.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDD.bpl - true - - - - - Contents\MacOS - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - - - Assets - 1 - - - - - Assets - 1 - - - - - - True - False - - - 12 - - - - - diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.ico b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.res b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.res deleted file mode 100644 index 0a66bd55..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDD.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dpk b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dpk deleted file mode 100644 index e648b298..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dpk +++ /dev/null @@ -1,144 +0,0 @@ -package SynEditDR; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'TurboPack SynEdit Delphi runtime package'} -{$LIBSUFFIX '250'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - 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', - SynEditCodeFolding in '..\..\..\Source\SynEditCodeFolding.pas', - SynEditDataObject in '..\..\..\Source\SynEditDataObject.pas', - SynEditDragDrop in '..\..\..\Source\SynEditDragDrop.pas', - SynEditExport in '..\..\..\Source\SynEditExport.pas', - SynEditHighlighter in '..\..\..\Source\SynEditHighlighter.pas', - SynEditHighlighterOptions in '..\..\..\Source\SynEditHighlighterOptions.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', - 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', - SynEditWordWrap in '..\..\..\Source\SynEditWordWrap.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', - SynHighlighterCss in '..\..\..\Source\SynHighlighterCss.pas', - SynHighlighterDfm in '..\..\..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\..\..\Source\SynHighlighterDml.pas', - SynHighlighterDOT in '..\..\..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\..\..\Source\SynHighlighterDWS.pas', - SynHighlighterEiffel in '..\..\..\Source\SynHighlighterEiffel.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', - SynHighlighterJSON in '..\..\..\Source\SynHighlighterJSON.pas', - SynHighlighterKix in '..\..\..\Source\SynHighlighterKix.pas', - SynHighlighterLDraw in '..\..\..\Source\SynHighlighterLDraw.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', - SynHighlighterRexx in '..\..\..\Source\SynHighlighterRexx.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', - SynHighlighterURI in '..\..\..\Source\SynHighlighterURI.pas', - SynHighlighterVB in '..\..\..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\..\..\Source\SynHighlighterVBScript.pas', - SynHighlighterVrml97 in '..\..\..\Source\SynHighlighterVrml97.pas', - SynHighlighterXML in '..\..\..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\..\..\Source\SynMacroRecorder.pas', - SynTextDrawer in '..\..\..\Source\SynTextDrawer.pas', - SynUnicode in '..\..\..\Source\SynUnicode.pas', - SynURIOpener in '..\..\..\Source\SynURIOpener.pas', - SynUsp10 in '..\..\..\Source\SynUsp10.pas'; - -end. diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dproj b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dproj deleted file mode 100644 index 45f222b7..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.dproj +++ /dev/null @@ -1,382 +0,0 @@ - - - True - Package - Release - VCL - SynEditDR.dpk - Win32 - {AC917C2B-5870-48AD-981D-668AD3E4A533} - 18.7 - 3 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - SynEditDR - ..\cpp\$(Platform)\$(Config) - All - .\$(Platform)\$(Config) - TurboPack SynEdit Delphi runtime package - ..\cpp\$(Platform)\$(Config) - 00400000 - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - ..\cpp\$(Platform)\$(Config) - true - true - 250 - true - true - true - false - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 1031 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEditDR.ico - true - 1033 - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - true - 1033 - - - true - 1033 - - - DEBUG;$(DCC_Define) - true - false - - - true - 1033 - - - true - 1033 - - - - MainSource - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEditDR.dpk - - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - SynEditDR.bpl - true - - - - - SynEditDR.bpl - true - - - - - Contents\MacOS - 0 - - - - - 0 - - - - - 0 - - - - - 0 - .dll;.bpl - - - - - 0 - .bpl - - - - - 0 - - - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - False - - True - True - - - 12 - - - - -
diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.ico b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.ico deleted file mode 100644 index 379ec80d..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.ico and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.res b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.res deleted file mode 100644 index f896e26c..00000000 Binary files a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDR.res and /dev/null differ diff --git a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDelphi.groupproj b/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDelphi.groupproj deleted file mode 100644 index d44be246..00000000 --- a/Source/VCL/SynEdit/Packages/Tokyo/Delphi/SynEditDelphi.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/VCL/SynEdit/Packages/XE/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE/SynEdit_D.dpk new file mode 100644 index 00000000..79e66a44 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/XE/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE/SynEdit_R.dpk new file mode 100644 index 00000000..d6e94395 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE2/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE2/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE2/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE2/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE2/SynEdit_D.dpk new file mode 100644 index 00000000..289bb300 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE2/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE2'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE2/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE2/SynEdit_R.dpk new file mode 100644 index 00000000..90fa31f8 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE2/SynEdit_R.dpk @@ -0,0 +1,170 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$R *.res} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE2'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. diff --git a/Source/VCL/SynEdit/Packages/XE3/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE3/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE3/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE3/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE3/SynEdit_D.dpk new file mode 100644 index 00000000..35e7a99a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE3/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE3'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE3/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE3/SynEdit_R.dpk new file mode 100644 index 00000000..43a08234 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE3/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE3'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE4/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE4/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE4/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE4/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE4/SynEdit_D.dpk new file mode 100644 index 00000000..f1c42d4c --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE4/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE4'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE4/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE4/SynEdit_R.dpk new file mode 100644 index 00000000..60b32303 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE4/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE4'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE5/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE5/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE5/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE5/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE5/SynEdit_D.dpk new file mode 100644 index 00000000..fd607a71 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE5/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE5'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE5/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE5/SynEdit_R.dpk new file mode 100644 index 00000000..a5913a49 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE5/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE5'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE6/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE6/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE6/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE6/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE6/SynEdit_D.dpk new file mode 100644 index 00000000..a0743c73 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE6/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE6'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE6/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE6/SynEdit_R.dpk new file mode 100644 index 00000000..1fd5ce88 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE6/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE6'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/XE7/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE7/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE7/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE7/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE7/SynEdit_D.dpk new file mode 100644 index 00000000..18978fba --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE7/SynEdit_D.dpk @@ -0,0 +1,42 @@ +package SynEdit_D; + +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE7'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/XE7/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE7/SynEdit_R.dpk new file mode 100644 index 00000000..b0d68f95 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE7/SynEdit_R.dpk @@ -0,0 +1,146 @@ +package SynEdit_R; + +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE7'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + 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', + SynEditWordWrap in '..\..\Source\SynEditWordWrap.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. diff --git a/Source/VCL/SynEdit/Packages/XE8/SynEdit.groupproj b/Source/VCL/SynEdit/Packages/XE8/SynEdit.groupproj new file mode 100644 index 00000000..edac8479 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE8/SynEdit.groupproj @@ -0,0 +1,48 @@ + + + {D7950D4A-962A-4E8F-982E-E7E052259FA8} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/VCL/SynEdit/Packages/XE8/SynEdit_D.dpk b/Source/VCL/SynEdit/Packages/XE8/SynEdit_D.dpk new file mode 100644 index 00000000..d4279212 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE8/SynEdit_D.dpk @@ -0,0 +1,43 @@ +package SynEdit_D; + +{$R *.res} +{$R '..\..\Source\SynEditReg.dcr'} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite'} +{$LIBSUFFIX 'XE8'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + designide, + SynEdit_R; + +contains + SynEditReg in '..\..\Source\SynEditReg.pas', + SynEditPropertyReg in '..\..\Source\SynEditPropertyReg.pas', + SynHighlighterManager in '..\..\Source\SynHighlighterManager.pas'; + +end. diff --git a/Source/VCL/SynEdit/Packages/XE8/SynEdit_R.dpk b/Source/VCL/SynEdit/Packages/XE8/SynEdit_R.dpk new file mode 100644 index 00000000..79b4ec04 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/XE8/SynEdit_R.dpk @@ -0,0 +1,147 @@ +package SynEdit_R; + +{$R *.res} +{$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} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'SynEdit component suite runtime'} +{$LIBSUFFIX 'XE8'} +{$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', + SynEditCodeFolding in '..\..\Source\SynEditCodeFolding.pas', + SynEditDocumentManager in '..\..\Source\SynEditDocumentManager.pas', + SynEditExport in '..\..\Source\SynEditExport.pas', + SynEditHighlighter in '..\..\Source\SynEditHighlighter.pas', + SynEditHighlighterOptions in '..\..\Source\SynEditHighlighterOptions.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', + SynHighlighterAsmMASM in '..\..\Source\SynHighlighterAsmMASM.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', + SynHighlighterCss in '..\..\Source\SynHighlighterCss.pas', + SynHighlighterDfm in '..\..\Source\SynHighlighterDfm.pas', + SynHighlighterDml in '..\..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\..\Source\SynHighlighterEiffel.pas', + SynHighlighterFortran in '..\..\Source\SynHighlighterFortran.pas', + SynHighlighterFoxpro in '..\..\Source\SynHighlighterFoxpro.pas', + SynHighlighterGalaxy in '..\..\Source\SynHighlighterGalaxy.pas', + SynHighlighterGeneral in '..\..\Source\SynHighlighterGeneral.pas', + SynHighlighterGLSL in '..\..\Source\SynHighlighterGLSL.pas', + SynHighlighterGo in '..\..\Source\SynHighlighterGo.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', + SynHighlighterJSON in '..\..\Source\SynHighlighterJSON.pas', + SynHighlighterKix in '..\..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\..\Source\SynHighlighterLDraw.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', + SynHighlighterURI in '..\..\Source\SynHighlighterURI.pas', + SynHighlighterVB in '..\..\Source\SynHighlighterVB.pas', + SynHighlighterVBScript in '..\..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\..\Source\SynHighlighterVrml97.pas', + SynHighlighterXML in '..\..\Source\SynHighlighterXML.pas', + SynMacroRecorder in '..\..\Source\SynMacroRecorder.pas', + SynMemo in '..\..\Source\SynMemo.pas', + SynRegExpr in '..\..\Source\SynRegExpr.pas', + SynUnicode in '..\..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, + SynURIOpener in '..\..\Source\SynURIOpener.pas', + SynUsp10 in '..\..\Source\SynUsp10.pas' {$ENDIF}; + +end. \ No newline at end of file diff --git a/Source/VCL/SynEdit/Packages/synedit_kylix.dpk b/Source/VCL/SynEdit/Packages/synedit_kylix.dpk new file mode 100644 index 00000000..9610081a --- /dev/null +++ b/Source/VCL/SynEdit/Packages/synedit_kylix.dpk @@ -0,0 +1,137 @@ +package synedit_kylix; + +{$R *.res} +{$R '../Source/SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit package for Kylix'} +{$IMPLICITBUILD ON} + +requires + rtl, + visualclx, + visualdbclx, + dataclx, + designide; + +contains + kTextDrawer in '../Source/kTextDrawer.pas', + QSynAutoCorrect in '../Source/QSynAutoCorrect.pas', + QSynAutoCorrectEditor in '../Source/QSynAutoCorrectEditor.pas', + QSynCompletionProposal in '../Source/QSynCompletionProposal.pas', + QSynDBEdit in '../Source/QSynDBEdit.pas', + QSynEdit in '../Source/QSynEdit.pas', + QSynEditAutoComplete in '../Source/QSynEditAutoComplete.pas', + QSynEditExport in '../Source/QSynEditExport.pas', + QSynEditHighlighter in '../Source/QSynEditHighlighter.pas', + QSynEditKbdHandler in '../Source/QSynEditKbdHandler.pas', + QSynEditKeyCmdEditor in '../Source/QSynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, + QSynEditKeyCmds in '../Source/QSynEditKeyCmds.pas', + QSynEditKeyCmdsEditor in '../Source/QSynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, + QSynEditKeyConst in '../Source/QSynEditKeyConst.pas', + QSynEditMiscClasses in '../Source/QSynEditMiscClasses.pas', + QSynEditMiscProcs in '../Source/QSynEditMiscProcs.pas', + QSynEditOptionsDialog in '../Source/QSynEditOptionsDialog.pas', + QSynEditPlugins in '../Source/QSynEditPlugins.pas', + QSynEditPrint in '../Source/QSynEditPrint.pas', + QSynEditPrinterInfo in '../Source/QSynEditPrinterInfo.pas', + QSynEditPrintHeaderFooter in '../Source/QSynEditPrintHeaderFooter.pas', + QSynEditPrintMargins in '../Source/QSynEditPrintMargins.pas', + QSynEditPrintMarginsDialog in '../Source/QSynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, + QSynEditPrintPreview in '../Source/QSynEditPrintPreview.pas', + QSynEditPrintTypes in '../Source/QSynEditPrintTypes.pas', + QSynEditPropertyReg in '../Source/QSynEditPropertyReg.pas', + QSynEditPythonBehaviour in '../Source/QSynEditPythonBehaviour.pas', + QSynEditReg in '../Source/QSynEditReg.pas', + QSynEditRegexSearch in '../Source/QSynEditRegexSearch.pas', + QSynEditSearch in '../Source/QSynEditSearch.pas', + QSynEditStrConst in '../Source/QSynEditStrConst.pas', + QSynEditTextBuffer in '../Source/QSynEditTextBuffer.pas', + QSynEditTypes in '../Source/QSynEditTypes.pas', + QSynEditWordWrap in '../Source/QSynEditWordWrap.pas', + QSynExportHTML in '../Source/QSynExportHTML.pas', + QSynExportRTF in '../Source/QSynExportRTF.pas', + QSynExportTeX in '../Source/QSynExportTeX.pas', + QSynHighlighterADSP21xx in '../Source/QSynHighlighterADSP21xx.pas', + QSynHighlighterAsm in '../Source/QSynHighlighterAsm.pas', + QSynHighlighterAWK in '../Source/QSynHighlighterAWK.pas', + QSynHighlighterBaan in '../Source/QSynHighlighterBaan.pas', + QSynHighlighterBat in '../Source/QSynHighlighterBat.pas', + QSynHighlighterCAC in '../Source/QSynHighlighterCAC.pas', + QSynHighlighterCache in '../Source/QSynHighlighterCache.pas', + QSynHighlighterCobol in '../Source/QSynHighlighterCobol.pas', + QSynHighlighterCPM in '../Source/QSynHighlighterCPM.pas', + QSynHighlighterCpp in '../Source/QSynHighlighterCpp.pas', + QSynHighlighterCS in '../Source/QSynHighlighterCS.pas', + QSynHighlighterCss in '../Source/QSynHighlighterCss.pas', + QSynHighlighterDfm in '../Source/QSynHighlighterDfm.pas', + QSynHighlighterDml in '../Source/QSynHighlighterDml.pas', + QSynHighlighterDOT in '../Source/QSynHighlighterDOT.pas', + QSynHighlighterEiffel in '../Source/QSynHighlighterEiffel.pas', + QSynHighlighterFortran in '../Source/QSynHighlighterFortran.pas', + QSynHighlighterFoxpro in '../Source/QSynHighlighterFoxpro.pas', + QSynHighlighterGalaxy in '../Source/QSynHighlighterGalaxy.pas', + QSynHighlighterGeneral in '../Source/QSynHighlighterGeneral.pas', + QSynHighlighterGWS in '../Source/QSynHighlighterGWS.pas', + QSynHighlighterHashEntries in '../Source/QSynHighlighterHashEntries.pas', + QSynHighlighterHaskell in '../Source/QSynHighlighterHaskell.pas', + QSynHighlighterHC11 in '../Source/QSynHighlighterHC11.pas', + QSynHighlighterHP48 in '../Source/QSynHighlighterHP48.pas', + QSynHighlighterHtml in '../Source/QSynHighlighterHtml.pas', + QSynHighlighterIDL in '../Source/QSynHighlighterIDL.pas', + QSynHighlighterIni in '../Source/QSynHighlighterIni.pas', + QSynHighlighterInno in '../Source/QSynHighlighterInno.pas', + QSynHighlighterJava in '../Source/QSynHighlighterJava.pas', + QSynHighlighterJScript in '../Source/QSynHighlighterJScript.pas', + QSynHighlighterKix in '../Source/QSynHighlighterKix.pas', + QSynHighlighterLDraw in '../Source/QSynHighlighterLDraw.pas', + QSynHighlighterM3 in '../Source/QSynHighlighterM3.pas', + QSynHighlighterManager in '../Source/QSynHighlighterManager.pas', + QSynHighlighterModelica in '../Source/QSynHighlighterModelica.pas', + QSynHighlighterMsg in '../Source/QSynHighlighterMsg.pas', + QSynHighlighterMulti in '../Source/QSynHighlighterMulti.pas', + QSynHighlighterPas in '../Source/QSynHighlighterPas.pas', + QSynHighlighterPerl in '../Source/QSynHighlighterPerl.pas', + QSynHighlighterPHP in '../Source/QSynHighlighterPHP.pas', + QSynHighlighterProgress in '../Source/QSynHighlighterProgress.pas', + QSynHighlighterPython in '../Source/QSynHighlighterPython.pas', + QSynHighlighterRC in '../Source/QSynHighlighterRC.pas', + QSynHighlighterRuby in '../Source/QSynHighlighterRuby.pas', + QSynHighlighterSDD in '../Source/QSynHighlighterSDD.pas', + QSynHighlighterSml in '../Source/QSynHighlighterSml.pas', + QSynHighlighterSQL in '../Source/QSynHighlighterSQL.pas', + QSynHighlighterST in '../Source/QSynHighlighterST.pas', + QSynHighlighterTclTk in '../Source/QSynHighlighterTclTk.pas', + QSynHighlighterTeX in '../Source/QSynHighlighterTeX.pas', + QSynHighlighterUNIXShellScript in '../Source/QSynHighlighterUNIXShellScript.pas', + QSynHighlighterUnreal in '../Source/QSynHighlighterUnreal.pas', + QSynHighlighterURI in '../Source/QSynHighlighterURI.pas', + QSynHighlighterVB in '../Source/QSynHighlighterVB.pas', + QSynHighlighterVBScript in '../Source/QSynHighlighterVBScript.pas', + QSynHighlighterVrml97 in '../Source/QSynHighlighterVrml97.pas', + QSynHighlighterXML in '../Source/QSynHighlighterXML.pas', + QSynMacroRecorder in '../Source/QSynMacroRecorder.pas', + QSynMemo in '../Source/QSynMemo.pas', + QSynRegExpr in '../Source/QSynRegExpr.pas', + QSynURIOpener in '../Source/QSynURIOpener.pas', + QSynUnicode in '../Source/QSynUnicode.pas'; +end. diff --git a/Source/VCL/SynEdit/Packages/synedit_kylix_OE.dpk b/Source/VCL/SynEdit/Packages/synedit_kylix_OE.dpk new file mode 100644 index 00000000..f753ae32 --- /dev/null +++ b/Source/VCL/SynEdit/Packages/synedit_kylix_OE.dpk @@ -0,0 +1,167 @@ +package synedit_kylix_OE; + +{$R *.res} +{$R '../Source/SynEditReg.dcr'} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'SynEdit package for Kylix OE'} +{$IMPLICITBUILD ON} +{$DEFINE SYN_DELPHI_PE} + +requires + rtl, + visualclx, + designide, + vcl; + +contains + kTextDrawer in '../Source/kTextDrawer.pas', + QSynAutoCorrect in '../Source/QSynAutoCorrect.pas', + QSynAutoCorrectEditor in '../Source/QSynAutoCorrectEditor.pas', + QSynCompletionProposal in '../Source/QSynCompletionProposal.pas', + QSynEdit in '../Source/QSynEdit.pas', + QSynEditAutoComplete in '../Source/QSynEditAutoComplete.pas', + QSynEditExport in '../Source/QSynEditExport.pas', + QSynEditHighlighter in '../Source/QSynEditHighlighter.pas', + QSynEditKbdHandler in '../Source/QSynEditKbdHandler.pas', + QSynEditKeyCmdEditor in '../Source/QSynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, + QSynEditKeyCmds in '../Source/QSynEditKeyCmds.pas', + QSynEditKeyCmdsEditor in '../Source/QSynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, + QSynEditKeyConst in '../Source/QSynEditKeyConst.pas', + QSynEditMiscClasses in '../Source/QSynEditMiscClasses.pas', + QSynEditMiscProcs in '../Source/QSynEditMiscProcs.pas', + QSynEditOptionsDialog in '../Source/QSynEditOptionsDialog.pas', + QSynEditPlugins in '../Source/QSynEditPlugins.pas', + QSynEditPrint in '../Source/QSynEditPrint.pas', + QSynEditPrinterInfo in '../Source/QSynEditPrinterInfo.pas', + QSynEditPrintHeaderFooter in '../Source/QSynEditPrintHeaderFooter.pas', + QSynEditPrintMargins in '../Source/QSynEditPrintMargins.pas', + QSynEditPrintMarginsDialog in '../Source/QSynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, + QSynEditPrintPreview in '../Source/QSynEditPrintPreview.pas', + QSynEditPrintTypes in '../Source/QSynEditPrintTypes.pas', + QSynEditPropertyReg in '../Source/QSynEditPropertyReg.pas', + QSynEditPythonBehaviour in '../Source/QSynEditPythonBehaviour.pas', + QSynEditReg in '../Source/QSynEditReg.pas', + QSynEditRegexSearch in '../Source/QSynEditRegexSearch.pas', + QSynEditSearch in '../Source/QSynEditSearch.pas', + QSynEditStrConst in '../Source/QSynEditStrConst.pas', + QSynEditTextBuffer in '../Source/QSynEditTextBuffer.pas', + QSynEditTypes in '../Source/QSynEditTypes.pas', + QSynEditWordWrap in '../Source/QSynEditWordWrap.pas', + QSynExportHTML in '../Source/QSynExportHTML.pas', + QSynExportRTF in '../Source/QSynExportRTF.pas', + QSynExportTeX in '../Source/QSynExportTeX.pas', + QSynHighlighterADSP21xx in '../Source/QSynHighlighterADSP21xx.pas', + QSynHighlighterAsm in '../Source/QSynHighlighterAsm.pas', + QSynHighlighterAWK in '../Source/QSynHighlighterAWK.pas', + QSynHighlighterBaan in '../Source/QSynHighlighterBaan.pas', + QSynHighlighterBat in '../Source/QSynHighlighterBat.pas', + QSynHighlighterCAC in '../Source/QSynHighlighterCAC.pas', + QSynHighlighterCache in '../Source/QSynHighlighterCache.pas', + QSynHighlighterCobol in '../Source/QSynHighlighterCobol.pas', + QSynHighlighterCPM in '../Source/QSynHighlighterCPM.pas', + QSynHighlighterCpp in '../Source/QSynHighlighterCpp.pas', + QSynHighlighterCS in '../Source/QSynHighlighterCS.pas', + QSynHighlighterCss in '../Source/QSynHighlighterCss.pas', + QSynHighlighterDfm in '../Source/QSynHighlighterDfm.pas', + QSynHighlighterDml in '../Source/QSynHighlighterDml.pas', + QSynHighlighterDOT in '../Source/QSynHighlighterDOT.pas', + QSynHighlighterEiffel in '../Source/QSynHighlighterEiffel.pas', + QSynHighlighterFortran in '../Source/QSynHighlighterFortran.pas', + QSynHighlighterFoxpro in '../Source/QSynHighlighterFoxpro.pas', + QSynHighlighterGalaxy in '../Source/QSynHighlighterGalaxy.pas', + QSynHighlighterGeneral in '../Source/QSynHighlighterGeneral.pas', + QSynHighlighterGWS in '../Source/QSynHighlighterGWS.pas', + QSynHighlighterHashEntries in '../Source/QSynHighlighterHashEntries.pas', + QSynHighlighterHaskell in '../Source/QSynHighlighterHaskell.pas', + QSynHighlighterHC11 in '../Source/QSynHighlighterHC11.pas', + QSynHighlighterHP48 in '../Source/QSynHighlighterHP48.pas', + QSynHighlighterHtml in '../Source/QSynHighlighterHtml.pas', + QSynHighlighterIDL in '../Source/QSynHighlighterIDL.pas', + QSynHighlighterIni in '../Source/QSynHighlighterIni.pas', + QSynHighlighterInno in '../Source/QSynHighlighterInno.pas', + QSynHighlighterJava in '../Source/QSynHighlighterJava.pas', + QSynHighlighterJScript in '../Source/QSynHighlighterJScript.pas', + QSynHighlighterKix in '../Source/QSynHighlighterKix.pas', + QSynHighlighterLDraw in '../Source/QSynHighlighterLDraw.pas', + QSynHighlighterM3 in '../Source/QSynHighlighterM3.pas', + QSynHighlighterManager in '../Source/QSynHighlighterManager.pas', + QSynHighlighterModelica in '../Source/QSynHighlighterModelica.pas', + QSynHighlighterMsg in '../Source/QSynHighlighterMsg.pas', + QSynHighlighterMulti in '../Source/QSynHighlighterMulti.pas', + QSynHighlighterPas in '../Source/QSynHighlighterPas.pas', + QSynHighlighterPerl in '../Source/QSynHighlighterPerl.pas', + QSynHighlighterPHP in '../Source/QSynHighlighterPHP.pas', + QSynHighlighterProgress in '../Source/QSynHighlighterProgress.pas', + QSynHighlighterPython in '../Source/QSynHighlighterPython.pas', + QSynHighlighterRC in '../Source/QSynHighlighterRC.pas', + QSynHighlighterRuby in '../Source/QSynHighlighterRuby.pas', + QSynHighlighterSDD in '../Source/QSynHighlighterSDD.pas', + QSynHighlighterSml in '../Source/QSynHighlighterSml.pas', + QSynHighlighterSQL in '../Source/QSynHighlighterSQL.pas', + QSynHighlighterST in '../Source/QSynHighlighterST.pas', + QSynHighlighterTclTk in '../Source/QSynHighlighterTclTk.pas', + QSynHighlighterTeX in '../Source/QSynHighlighterTeX.pas', + QSynHighlighterUNIXShellScript in '../Source/QSynHighlighterUNIXShellScript.pas', + QSynHighlighterUnreal in '../Source/QSynHighlighterUnreal.pas', + QSynHighlighterURI in '../Source/QSynHighlighterURI.pas', + QSynHighlighterVB in '../Source/QSynHighlighterVB.pas', + QSynHighlighterVBScript in '../Source/QSynHighlighterVBScript.pas', + QSynHighlighterVrml97 in '../Source/QSynHighlighterVrml97.pas', + QSynHighlighterXML in '../Source/QSynHighlighterXML.pas', + QSynMacroRecorder in '../Source/QSynMacroRecorder.pas', + QSynMemo in '../Source/QSynMemo.pas', + QSynRegExpr in '../Source/QSynRegExpr.pas', + kTextDrawer in '../Source/kTextDrawer.pas', + QSynEditKbdHandler in '../Source/QSynEditKbdHandler.pas', + QSynEditKeyCmdEditor in '../Source/QSynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, + QSynEditKeyConst in '../Source/QSynEditKeyConst.pas', + QSynEditPlugins in '../Source/QSynEditPlugins.pas', + QSynEditPrinterInfo in '../Source/QSynEditPrinterInfo.pas', + QSynEditPrintHeaderFooter in '../Source/QSynEditPrintHeaderFooter.pas', + QSynEditPrintMargins in '../Source/QSynEditPrintMargins.pas', + QSynEditPrintTypes in '../Source/QSynEditPrintTypes.pas', + QSynEditPrint in '../Source/QSynEditPrint.pas', + QSynEditPrintMarginsDialog in '../Source/QSynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, + QSynEditPrintPreview in '../Source/QSynEditPrintPreview.pas', + QSynEditRegexSearch in '../Source/QSynEditRegexSearch.pas', + QSynEditExport in '../Source/QSynEditExport.pas', + QSynHighlighterCobol in '../Source/QSynHighlighterCobol.pas', + QSynHighlighterTeX in '../Source/QSynHighlighterTeX.pas', + QSynHighlighterManager in '../Source/QSynHighlighterManager.pas', + QSynEditOptionsDialog in '../Source/QSynEditOptionsDialog.pas', + QSynHighlighterLDraw in '../Source/QSynHighlighterLDraw.pas', + QSynHighlighterCS in '../Source/QSynHighlighterCS.pas', + QSynHighlighterHaskell in '../Source/QSynHighlighterHaskell.pas', + QSynHighlighterUNIXShellScript in '../Source/QSynHighlighterUNIXShellScript.pas', + QSynHighlighterRC in '../Source/QSynHighlighterRC.pas', + QSynHighlighterRuby in '../Source/QSynHighlighterRuby.pas', + QSynExportTeX in '../Source/QSynExportTeX.pas', + QSynHighlighterURI in '../Source/QSynHighlighterURI.pas', + QSynEditWordWrap in '../Source/QSynEditWordWrap.pas', + QSynHighlighterDOT in '../Source/QSynHighlighterDOT.pas', + QSynHighlighterEiffel in '../Source/QSynHighlighterEiffel.pas', + QSynHighlighterVrml97 in '../Source/QSynHighlighterVrml97.pas', + QSynURIOpener in '../Source/QSynURIOpener.pas', + QSynUnicode in '../Source/QSynUnicode.pas'; + +end. diff --git a/Source/VCL/SynEdit/Source/SynAutoCorrect.pas b/Source/VCL/SynEdit/Source/SynAutoCorrect.pas index 27d76ef2..9e9ce278 100644 --- a/Source/VCL/SynEdit/Source/SynAutoCorrect.pas +++ b/Source/VCL/SynEdit/Source/SynAutoCorrect.pas @@ -1,741 +1,747 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynAutoCorrect.pas, released 2001-10-05. -Author of this file is Aaron Chan. -Unicode translation by Maël Hörz. -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: SynAutoCorrect.pas,v 1.13.2.7 2008/09/14 16:24:57 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -{*******************************************************} -{ } -{ Aerodynamica Components } -{ SynAutoCorrect 2.x } -{ } -{ Copyright (c) 1996-2003, Aerodynamica Software } -{ } -{ Author: Aaron Chan } -{ Portions by Greg Nixon and Jan Fiala } -{ } -{*******************************************************} - -{ - @author: Aaron Chan - @url: http://aerodynamica.idz.net - @comp-url: http://aerodynamica.idz.net/products.asp?id=SynAC_2 - @email: aerodynamica@idz.net - @last-updated: 12/04/03 - @history: - - ! comment * changed + added - - removed @ bug-fixed # todo - - 12/04/2003 - - removed integrated sound support. - * changed keyboard and mouse handling to use SynEdit plugin system. - - 11/04/04 - Release 2.21: - @ Fixed support for correction after delimiters. - * SOUND_SUPPORT undefined by default. - - 24/03/03 - Release 2.2: - @ Fixed "Stack Overflow" bug and memory leak (fixed by Danail Traichev). - - 30/09/02 - Release 2.1: - @ Fixed bug when user KeyDown and MouseDown events weren't fired. - + Added INI_FILES and REGISTRY compiler defines (to minimize code size - if you don't need these features). - * Further tidy-up of code. - * Quite a few minor bug-fixes and tweaks. - * Items editor enhanced. - * Improved demo. - * Registry and INI file entries are saved in a new and improved way, which - overcomes some limitations set by the old method. If you still want to - use the old method, define OLD_SAVE_METHOD. - - 31/07/02 - Revision 2.01: - @ Fixed bug which occured when undefining SOUND_SUPPORT (reported by - Stefan Ascher). - - 30/07/02 - First public release of version 2.0: - @ MANY bugs fixed and small tweaks everywhere in the code (some - courtesy of Jan Fiala). - + Ability to play an optional WAVE file (or beep) on correction. - + Options set. - * New demo. -} - -unit SynAutoCorrect; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Registry, - Messages, - Graphics, - Controls, - Forms, - Dialogs, - SynEditMiscProcs, - SynEditTypes, - SynEditKeyCmds, - SynEdit, - SynEditMiscClasses, - SynUnicode, - Classes, - SysUtils, - IniFiles; - -type - TAsSynAutoCorrectOption = (ascoCorrectOnMouseDown, ascoIgnoreCase, - ascoMaintainCase); - TAsSynAutoCorrectOptions = set of TAsSynAutoCorrectOption; - - TAutoCorrectAction = (aaCorrect, aaAbort); - TAutoCorrectEvent = procedure(Sender: TObject; - const AOriginal, ACorrection: string; Line, Column: Integer; - var Action: TAutoCorrectAction) of object; - - TCustomSynAutoCorrect = class(TComponent) - private - { Private declarations } - - { Published properties and events } - FEditor: TCustomSynEdit; - FEnabled: Boolean; - FItems: TStrings; - FItemSepChar: WideChar; - FOptions: TAsSynAutoCorrectOptions; - - FOnAutoCorrect: TAutoCorrectEvent; - FOnCorrected: TNotifyEvent; - - { Private variables and methods } - FPrevLine: Integer; - - function CorrectItemStart(EditLine, SearchString: string; StartPos: Integer; - MatchCase, WholeWord: Boolean): Integer; - function FindAndCorrect(var EditLine: string; Original, Correction: string; - var CurrentX: Integer): Boolean; - function PreviousToken: string; - - { Accessor methods } - function GetItems: TStrings; - procedure SetItems(const Value: TStrings); - protected - { Protected declarations } - procedure DefineProperties(Filer: TFiler); override; - procedure KeyboardHandler(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: Pointer; HandlerData: Pointer); virtual; - procedure MouseDownHandler(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); virtual; - procedure Notification(AComponent: TComponent; - Operation: TOperation); override; - procedure SetEditor(Value: TCustomSynEdit); - public - { Public declarations } - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - procedure Add(AOriginal, ACorrection: string); - function AutoCorrectAll: Boolean; - procedure Delete(AIndex: Integer); - procedure Edit(AIndex: Integer; ANewOriginal, ANewCorrection: string); - - procedure LoadFromINI(AFileName, ASection: string); - procedure SaveToINI(AFileName, ASection: string); - - procedure LoadFromRegistry(ARoot: DWORD; AKey: string); - procedure SaveToRegistry(ARoot: DWORD; AKey: string); - - function LoadFromList(AFileName: string): Boolean; - procedure SaveToList(AFileName: string); - - { Utility functions } - function HalfString(Str: string; GetFirstHalf: Boolean): string; - public - { Published declarations } - property Enabled: Boolean read FEnabled write FEnabled default True; - property Editor: TCustomSynEdit read FEditor write SetEditor; - property Items: TStrings read GetItems write SetItems; - property ItemSepChar: WideChar read FItemSepChar write FItemSepChar default #9; - property Options: TAsSynAutoCorrectOptions read FOptions write FOptions - default [ascoIgnoreCase, ascoMaintainCase]; - - property OnAutoCorrect: TAutoCorrectEvent read FOnAutoCorrect - write FOnAutoCorrect; - property OnCorrected: TNotifyEvent read FOnCorrected write FOnCorrected; - end; - - TSynAutoCorrect = class(TCustomSynAutoCorrect) - published - { Published declarations } - property Enabled; - property Editor; - property Items; - property ItemSepChar; - property Options; - - property OnAutoCorrect; - property OnCorrected; - end; - -implementation - - -{ TCustomSynAutoCorrect } - -constructor TCustomSynAutoCorrect.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - FEnabled := True; - FItems := TStringList.Create; - FItemSepChar := #9; - FOptions := [ascoIgnoreCase, ascoMaintainCase]; - FPrevLine := -1; -// FEditor := nil; initialized by Delphi -end; - -destructor TCustomSynAutoCorrect.Destroy; -begin - Editor := nil; - inherited; - FItems.Free; -end; - - -{ Utility functions } - -function TCustomSynAutoCorrect.HalfString(Str: string; - GetFirstHalf: Boolean): string; -var - i: Integer; -begin - i := LastDelimiter(FItemSepChar, Str); - if i = 0 then i := Pred(MaxInt); - - if GetFirstHalf then - Result := Copy(Str, 1, Pred(i)) - else - Result := Copy(Str, Succ(i), MaxInt); -end; - -procedure TCustomSynAutoCorrect.LoadFromIni(AFileName, ASection: string); -var - i: Integer; - Original, Correction: string; - Reg: TMemIniFile; -begin - Reg := TMemIniFile.Create(AFileName); - try - FItems.Clear; - with Reg do - for i := 0 to Pred(ReadInteger(ASection, 'Count', 0)) do - begin - Original := ReadString(ASection, 'Original' + IntToStr(i), ''); - Correction := ReadString(ASection, 'Correction' + IntToStr(i), ''); - if not ((Original = '') and (Correction = '')) then - FItems.Add(Original + FItemSepChar + Correction); - end; - finally - Reg.Free; - end; -end; - -procedure TCustomSynAutoCorrect.SaveToIni(AFileName, ASection: string); -var - i: Integer; - Reg: TMemIniFile; -begin - Reg := TMemIniFile.Create(AFileName); - try - with Reg do - begin - WriteInteger(ASection, 'Count', FItems.Count); - for i := 0 to Pred(FItems.Count) do - begin - WriteString(ASection, 'Original' + IntToStr(i), - HalfString(FItems[i], True)); - WriteString(ASection, 'Correction' + IntToStr(i), - HalfString(FItems[i], False)); - end; - end; - finally - Reg.UpdateFile; - Reg.Free; - end; -end; - -function TCustomSynAutoCorrect.LoadFromList(AFileName: string): Boolean; -begin - Result := False; - if FileExists(AFileName) then - begin - FItems.LoadFromFile(AFileName); - Result := True; - end; -end; - -procedure TCustomSynAutoCorrect.SaveToList(AFileName: string); -begin - FItems.SaveToFile(AFileName); -end; - -procedure TCustomSynAutoCorrect.LoadFromRegistry(ARoot: DWORD; AKey: string); -var - i: Integer; - Original, Correction: string; - Reg: TRegIniFile; -begin - Reg := TRegIniFile.Create(''); - try - with Reg do - begin - RootKey := ARoot; - TBetterRegistry(Reg).OpenKeyReadOnly(AKey); - FItems.Clear; - for i := 0 to Pred(ReadInteger('', 'Count', 0)) do - begin - Original := ReadString('', 'Original' + IntToStr(i), ''); - Correction := ReadString('', 'Correction' + IntToStr(i), ''); - if not ((Original = '') and (Correction = '')) then - FItems.Add(Original + FItemSepChar + Correction); - end; - end; - finally - Reg.Free; - end; -end; - -procedure TCustomSynAutoCorrect.SaveToRegistry(ARoot: DWORD; AKey: string); -var - i: Integer; - Reg: TRegIniFile; -begin - Reg := TRegIniFile.Create(''); - try - with Reg do - begin - RootKey := ARoot; - OpenKey(AKey, True); - WriteInteger('', 'Count', FItems.Count); - for i := 0 to Pred(FItems.Count) do - begin - WriteString('', 'Original' + IntToStr(i), HalfString(FItems[i], True)); - WriteString('', 'Correction' + IntToStr(i), - HalfString(FItems[i], False)); - end; - end; - finally - Reg.Free; - end; -end; - -procedure TCustomSynAutoCorrect.Add(AOriginal, ACorrection: string); -begin - FItems.Add(AOriginal + FItemSepChar + ACorrection); -end; - -function TCustomSynAutoCorrect.AutoCorrectAll: Boolean; -var - i, cx: Integer; - s, Original, Correction, CurrText: string; -begin - Result := False; - if Assigned(Editor) then - begin - s := Editor.Lines.Text; - cx := -1; - - for i := 0 to Pred(FItems.Count) do - begin - CurrText := FItems[i]; - Original := HalfString(CurrText, True); - Correction := HalfString(CurrText, False); - FindAndCorrect(s, Original, Correction, cx); - end; - Editor.Lines.Text := s; - end; -end; - -function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: string; - StartPos: Integer; MatchCase, WholeWord: Boolean): Integer; -var - SearchCount, I: Integer; - CurBuf, Buf: PWideChar; - BufLen: Integer; - - function FindNextWordStart(var BufPtr: PWideChar): Boolean; - begin - while (SearchCount > 0) and not Editor.IsWordBreakChar(BufPtr^) do - begin - Inc(BufPtr, 1); - Dec(SearchCount); - end; - - while (SearchCount > 0) and Editor.IsWordBreakChar(BufPtr^) do - begin - Inc(BufPtr, 1); - Dec(SearchCount); - end; - - Result := SearchCount >= 0; - end; - - function ScanText(var BufPtr: PWideChar): Boolean; - var - FirstWord: Boolean; - begin - Result := False; - - FirstWord := True; - - if WholeWord then - begin - while (SearchCount > 0) and Editor.IsWordBreakChar(BufPtr^) do - begin - Inc(BufPtr, 1); - Dec(SearchCount); - end; - end; - - while SearchCount >= 0 do - begin - if WholeWord and (FirstWord = False) then - if not FindNextWordStart(BufPtr) then Break; - I := 0; - while (BufPtr[I] = SearchString[I + 1]) do - begin - Inc(I); - if I >= Length(SearchString) then - begin - if not WholeWord or (SearchCount = 0) or - Editor.IsWordBreakChar(BufPtr[I]) then - begin - Result := True; - Exit; - end; - Break; - end; - end; - FirstWord := False; - Inc(BufPtr); - Dec(SearchCount); - end; - end; - -begin - Result := -1; - - if not MatchCase then - begin - EditLine := SysUtils.AnsiUpperCase(EditLine); - SearchString := SysUtils.AnsiUpperCase(SearchString); - end; - - BufLen := Length(EditLine); - Buf := PWideChar(EditLine); - - if BufLen > 0 then - begin - SearchCount := succ(BufLen - StartPos - Length(SearchString)); - - if (SearchCount >= 0) and (SearchCount <= BufLen) and - (StartPos + SearchCount <= BufLen) then - begin - CurBuf := PWideChar(@Buf[StartPos]); - if not ScanText(CurBuf) then - CurBuf := nil - else - begin - if CurBuf <> nil then - Result := CurBuf - Buf; - end; - end; - end; - - CurBuf := nil; -end; - -procedure TCustomSynAutoCorrect.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -procedure TCustomSynAutoCorrect.Delete(AIndex: Integer); -begin - FItems.Delete(AIndex); -end; - -procedure TCustomSynAutoCorrect.Edit(AIndex: Integer; - ANewOriginal, ANewCorrection: string); -begin - if AIndex > -1 then - FItems[AIndex] := ANewOriginal + FItemSepChar + ANewCorrection; -end; - -procedure TCustomSynAutoCorrect.KeyboardHandler(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: Pointer; HandlerData: Pointer); -var - b: Boolean; - i, cx: Integer; - s, Original, Correction, CurrText: string; -begin - if Enabled and not AfterProcessing and not Handled then - begin - FPrevLine := Editor.CaretY; - case Command of - ecLineBreak, ecTab, ecChar: - begin - if (Command = ecChar) and not Editor.IsWordBreakChar(AChar) then - Exit; - b := False; - s := PreviousToken; - if s <> '' then - begin - cx := Editor.CaretX; - for i := 0 to Pred(FItems.Count) do - begin - CurrText := FItems[i]; - Original := HalfString(CurrText, True); - Correction := HalfString(CurrText, False); - b := b or FindAndCorrect(s, Original, Correction, cx); - end; - - if Assigned(OnCorrected) then - OnCorrected(Self); - end; - end; - end; {endcase} - end; -end; - -procedure TCustomSynAutoCorrect.MouseDownHandler(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var - Action: TAutoCorrectAction; - b: Boolean; - i, cx: Integer; - s, Original, Correction, CurrText: string; -begin - if ascoCorrectOnMouseDown in FOptions then - begin - if Assigned(Editor) and Enabled and (FPrevLine <> -1) then - begin - b := False; - s := Editor.Lines[Pred(FPrevLine)]; - cx := -1; - - for i := 0 to Pred(FItems.Count) do - begin - CurrText := FItems[i]; - Original := HalfString(CurrText, True); - Correction := HalfString(CurrText, False); - b := b or FindAndCorrect(s, Original, Correction, cx); - end; - - if b then - begin - if Assigned(FOnAutoCorrect) then - begin - Action := aaCorrect; - FOnAutoCorrect(Self, Editor.Lines[Pred(FPrevLine)], s, Editor.CaretY, - 0, Action); - if Action = aaAbort then Exit; - end; - Editor.Lines[Pred(FPrevLine)] := s; - - if Assigned(OnCorrected) then - OnCorrected(Self); - end; - end; - end; -end; - -function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: string; - Original, Correction: string; var CurrentX: Integer): Boolean; -var - StartPos: Integer; - EndPos: Integer; - FoundText, ReplaceDefText: string; - p: TBufferCoord; - Action: TAutoCorrectAction; - - function FirstCapCase(s: string): string; - begin - if s <> '' then - begin - s := SysUtils.AnsiLowerCase(s); - s[1] := SysUtils.AnsiUpperCase(s[1])[1]; - end; - - Result := s; - end; - -begin - Result := False; - ReplaceDefText := Correction; - StartPos := 0; - EndPos := Length(Original); - - if (Editor <> nil) and not (Editor.ReadOnly) then - begin - StartPos := CorrectItemStart(EditLine, Original, StartPos, - not (ascoIgnoreCase in FOptions), True); - - while StartPos > -1 do - begin - if (ascoMaintainCase in FOptions) then - begin - Correction := ReplaceDefText; - FoundText := Copy(EditLine,StartPos+1,EndPos); - - if FoundText = SysUtils.AnsiUpperCase(FoundText) then - Correction := SysUtils.AnsiUpperCase(Correction) - else - begin - if FoundText = SysUtils.AnsiLowerCase(FoundText) then - Correction := SysUtils.AnsiLowerCase(Correction) - else - begin - if FoundText = FirstCapCase(FoundText) then - Correction := FirstCapCase(Correction); - end; - end; - end; - - if CurrentX > - 1 then - begin - p := Editor.CaretXY; - if Assigned(FOnAutoCorrect) then - begin - Action := aaCorrect; - FOnAutoCorrect(Self, Original, Correction, P.Line, P.Char, Action); - - if Action = aaAbort then Break; - end; - - Editor.BeginUpdate; - - try - if p.Char = 0 then - Editor.BlockBegin := BufferCoord(p.Char - 1 - EndPos, p.Line) - else - Editor.BlockBegin := BufferCoord(p.Char - EndPos, p.Line); - - Editor.BlockEnd := p; - p := Editor.BlockBegin; - Editor.SelText := Correction; - Result := True; - finally - Editor.EndUpdate; - end; - - Break; - end - else - begin - Result := True; - EditLine := Copy(EditLine, 1, StartPos) + Correction + - Copy(EditLine, StartPos + EndPos + 1, MaxInt); - Inc(StartPos, EndPos); - StartPos := CorrectItemStart(EditLine, Original, StartPos, - not (ascoIgnoreCase in FOptions), True); - end; - end; - end; -end; - -function TCustomSynAutoCorrect.GetItems: TStrings; -begin - Result := FItems; -end; - -procedure TCustomSynAutoCorrect.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited; - if (Operation = opRemove) and (AComponent = FEditor) then - begin - Editor := nil; - end; -end; - -function TCustomSynAutoCorrect.PreviousToken: string; -var - i, cx: Integer; -begin - Result := Editor.LineText; - cx := Editor.CaretX; - i := Pred(cx); - - if i <= Length(Result) then - begin - while (i > 0) and not Editor.IsWordBreakChar(Result[i]) do Dec(i); - Inc(i); - Result := Copy(Result, i, cx - i); - end - else - Result := ''; -end; - -procedure TCustomSynAutoCorrect.SetEditor(Value: TCustomSynEdit); -begin - if FEditor <> Value then - begin - if Assigned(FEditor) then - begin - Editor.RemoveMouseDownHandler(MouseDownHandler); - Editor.UnregisterCommandHandler(KeyboardHandler); - Editor.RemoveFreeNotification(Self); - end; - - FEditor := Value; - - if Assigned(FEditor) then - begin - Editor.FreeNotification(Self); - Editor.RegisterCommandHandler(KeyboardHandler, nil); - Editor.AddMouseDownHandler(MouseDownHandler); - end; - end; -end; - -procedure TCustomSynAutoCorrect.SetItems(const Value: TStrings); -begin - FItems.Assign(Value); -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynAutoCorrect.pas, released 2001-10-05. +Author of this file is Aaron Chan. +Unicode translation by Maël Hörz. +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: SynAutoCorrect.pas,v 1.13.2.7 2008/09/14 16:24:57 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +{*******************************************************} +{ } +{ Aerodynamica Components } +{ SynAutoCorrect 2.x } +{ } +{ Copyright (c) 1996-2003, Aerodynamica Software } +{ } +{ Author: Aaron Chan } +{ Portions by Greg Nixon and Jan Fiala } +{ } +{*******************************************************} + +{ + @author: Aaron Chan + @url: http://aerodynamica.idz.net + @comp-url: http://aerodynamica.idz.net/products.asp?id=SynAC_2 + @email: aerodynamica@idz.net + @last-updated: 12/04/03 + @history: + + ! comment * changed + added + - removed @ bug-fixed # todo + + 12/04/2003 + - removed integrated sound support. + * changed keyboard and mouse handling to use SynEdit plugin system. + + 11/04/04 - Release 2.21: + @ Fixed support for correction after delimiters. + * SOUND_SUPPORT undefined by default. + + 24/03/03 - Release 2.2: + @ Fixed "Stack Overflow" bug and memory leak (fixed by Danail Traichev). + + 30/09/02 - Release 2.1: + @ Fixed bug when user KeyDown and MouseDown events weren't fired. + + Added INI_FILES and REGISTRY compiler defines (to minimize code size + if you don't need these features). + * Further tidy-up of code. + * Quite a few minor bug-fixes and tweaks. + * Items editor enhanced. + * Improved demo. + * Registry and INI file entries are saved in a new and improved way, which + overcomes some limitations set by the old method. If you still want to + use the old method, define OLD_SAVE_METHOD. + + 31/07/02 - Revision 2.01: + @ Fixed bug which occured when undefining SOUND_SUPPORT (reported by + Stefan Ascher). + + 30/07/02 - First public release of version 2.0: + @ MANY bugs fixed and small tweaks everywhere in the code (some + courtesy of Jan Fiala). + + Ability to play an optional WAVE file (or beep) on correction. + + Options set. + * New demo. +} + +{$IFNDEF QSYNAUTOCORRECT} +unit SynAutoCorrect; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFDEF MSWINDOWS} //Borland translation of Qt doesn't include Char handling + Windows, +{$ELSE} + Libc, +{$ENDIF} + Registry, + Messages, + Graphics, + Controls, + Forms, + Dialogs, + SynEditMiscProcs, + SynEditTypes, + SynEditKeyCmds, + SynEdit, + SynEditMiscClasses, + SynUnicode, + Classes, + SysUtils, + IniFiles; + +type + TAsSynAutoCorrectOption = (ascoCorrectOnMouseDown, ascoIgnoreCase, + ascoMaintainCase); + TAsSynAutoCorrectOptions = set of TAsSynAutoCorrectOption; + + TAutoCorrectAction = (aaCorrect, aaAbort); + TAutoCorrectEvent = procedure(Sender: TObject; + const AOriginal, ACorrection: UnicodeString; Line, Column: Integer; + var Action: TAutoCorrectAction) of object; + + TCustomSynAutoCorrect = class(TComponent) + private + { Private declarations } + + { Published properties and events } + FEditor: TCustomSynEdit; + FEnabled: Boolean; + FItems: TUnicodeStrings; + FItemSepChar: WideChar; + FOptions: TAsSynAutoCorrectOptions; + + FOnAutoCorrect: TAutoCorrectEvent; + FOnCorrected: TNotifyEvent; + + { Private variables and methods } + FPrevLine: Integer; + + function CorrectItemStart(EditLine, SearchString: UnicodeString; StartPos: LongInt; + MatchCase, WholeWord: Boolean): LongInt; + function FindAndCorrect(var EditLine: UnicodeString; Original, Correction: UnicodeString; + var CurrentX: Integer): Boolean; + function PreviousToken: UnicodeString; + + { Accessor methods } + function GetItems: TUnicodeStrings; + procedure SetItems(const Value: TUnicodeStrings); + protected + procedure DefineProperties(Filer: TFiler); override; + procedure KeyboardHandler(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); virtual; + procedure MouseDownHandler(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); virtual; + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; + procedure SetEditor(Value: TCustomSynEdit); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure Add(AOriginal, ACorrection: UnicodeString); + function AutoCorrectAll: Boolean; + procedure Delete(AIndex: Integer); + procedure Edit(AIndex: Integer; ANewOriginal, ANewCorrection: UnicodeString); + + procedure LoadFromINI(AFileName, ASection: string); + procedure SaveToINI(AFileName, ASection: string); + + procedure LoadFromRegistry(ARoot: DWORD; AKey: string); + procedure SaveToRegistry(ARoot: DWORD; AKey: string); + + function LoadFromList(AFileName: string): Boolean; + procedure SaveToList(AFileName: string); + + { Utility functions } + function HalfString(Str: UnicodeString; GetFirstHalf: Boolean): UnicodeString; + public + property Enabled: Boolean read FEnabled write FEnabled default True; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property Items: TUnicodeStrings read GetItems write SetItems; + property ItemSepChar: WideChar read FItemSepChar write FItemSepChar default #9; + property Options: TAsSynAutoCorrectOptions read FOptions write FOptions + default [ascoIgnoreCase, ascoMaintainCase]; + + property OnAutoCorrect: TAutoCorrectEvent read FOnAutoCorrect + write FOnAutoCorrect; + property OnCorrected: TNotifyEvent read FOnCorrected write FOnCorrected; + end; + + TSynAutoCorrect = class(TCustomSynAutoCorrect) + published + property Enabled; + property Editor; + property Items; + property ItemSepChar; + property Options; + + property OnAutoCorrect; + property OnCorrected; + end; + +implementation + + +{ TCustomSynAutoCorrect } + +constructor TCustomSynAutoCorrect.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FEnabled := True; + FItems := TUnicodeStringList.Create; + FItemSepChar := #9; + FOptions := [ascoIgnoreCase, ascoMaintainCase]; + FPrevLine := -1; +// FEditor := nil; initialized by Delphi +end; + +destructor TCustomSynAutoCorrect.Destroy; +begin + Editor := nil; + inherited; + FItems.Free; +end; + + +{ Utility functions } + +function TCustomSynAutoCorrect.HalfString(Str: UnicodeString; + GetFirstHalf: Boolean): UnicodeString; +var + i: Integer; +begin + i := LastDelimiter(FItemSepChar, Str); + if i = 0 then i := Pred(MaxInt); + + if GetFirstHalf then + Result := Copy(Str, 1, Pred(i)) + else + Result := Copy(Str, Succ(i), MaxInt); +end; + +procedure TCustomSynAutoCorrect.LoadFromIni(AFileName, ASection: string); +var + i: Integer; + Original, Correction: UnicodeString; + Reg: TIniFile; +begin + Reg := TIniFile.Create(AFileName); + try + FItems.Clear; + with Reg do + for i := 0 to Pred(ReadInteger(ASection, 'Count', 0)) do + begin + Original := ReadString(ASection, 'Original' + IntToStr(i), ''); + Correction := ReadString(ASection, 'Correction' + IntToStr(i), ''); + if not ((Original = '') and (Correction = '')) then + FItems.Add(Original + FItemSepChar + Correction); + end; + finally + Reg.Free; + end; +end; + +procedure TCustomSynAutoCorrect.SaveToIni(AFileName, ASection: string); +var + i: Integer; + Reg: TIniFile; +begin + Reg := TIniFile.Create(AFileName); + try + with Reg do + begin + WriteInteger(ASection, 'Count', FItems.Count); + for i := 0 to Pred(FItems.Count) do + begin + WriteString(ASection, 'Original' + IntToStr(i), + HalfString(FItems[i], True)); + WriteString(ASection, 'Correction' + IntToStr(i), + HalfString(FItems[i], False)); + end; + end; + finally + Reg.Free; + end; +end; + +function TCustomSynAutoCorrect.LoadFromList(AFileName: string): Boolean; +begin + Result := False; + if FileExists(AFileName) then + begin + FItems.LoadFromFile(AFileName); + Result := True; + end; +end; + +procedure TCustomSynAutoCorrect.SaveToList(AFileName: string); +begin + FItems.SaveToFile(AFileName); +end; + +procedure TCustomSynAutoCorrect.LoadFromRegistry(ARoot: DWORD; AKey: string); +var + i: Integer; + Original, Correction: UnicodeString; + Reg: TRegIniFile; +begin + Reg := TRegIniFile.Create(''); + try + with Reg do + begin + RootKey := ARoot; + TBetterRegistry(Reg).OpenKeyReadOnly(AKey); + FItems.Clear; + for i := 0 to Pred(ReadInteger('', 'Count', 0)) do + begin + Original := ReadString('', 'Original' + IntToStr(i), ''); + Correction := ReadString('', 'Correction' + IntToStr(i), ''); + if not ((Original = '') and (Correction = '')) then + FItems.Add(Original + FItemSepChar + Correction); + end; + end; + finally + Reg.Free; + end; +end; + +procedure TCustomSynAutoCorrect.SaveToRegistry(ARoot: DWORD; AKey: string); +var + i: Integer; + Reg: TRegIniFile; +begin + Reg := TRegIniFile.Create(''); + try + with Reg do + begin + RootKey := ARoot; + OpenKey(AKey, True); + WriteInteger('', 'Count', FItems.Count); + for i := 0 to Pred(FItems.Count) do + begin + WriteString('', 'Original' + IntToStr(i), HalfString(FItems[i], True)); + WriteString('', 'Correction' + IntToStr(i), + HalfString(FItems[i], False)); + end; + end; + finally + Reg.Free; + end; +end; + +procedure TCustomSynAutoCorrect.Add(AOriginal, ACorrection: UnicodeString); +begin + FItems.Add(AOriginal + FItemSepChar + ACorrection); +end; + +function TCustomSynAutoCorrect.AutoCorrectAll: Boolean; +var + i, cx: Integer; + s, Original, Correction, CurrText: UnicodeString; +begin + Result := False; + if Assigned(Editor) then + begin + s := Editor.Lines.Text; + cx := -1; + + for i := 0 to Pred(FItems.Count) do + begin + CurrText := FItems[i]; + Original := HalfString(CurrText, True); + Correction := HalfString(CurrText, False); + FindAndCorrect(s, Original, Correction, cx); + end; + Editor.Lines.Text := s; + end; +end; + +function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: UnicodeString; + StartPos: LongInt; MatchCase, WholeWord: Boolean): LongInt; +var + SearchCount, I: Integer; + CurBuf, Buf: PWideChar; + BufLen: Integer; + + function FindNextWordStart(var BufPtr: PWideChar): Boolean; + begin + while (SearchCount > 0) and not Editor.IsWordBreakChar(BufPtr^) do + begin + Inc(BufPtr, 1); + Dec(SearchCount); + end; + + while (SearchCount > 0) and Editor.IsWordBreakChar(BufPtr^) do + begin + Inc(BufPtr, 1); + Dec(SearchCount); + end; + + Result := SearchCount >= 0; + end; + + function ScanText(var BufPtr: PWideChar): Boolean; + var + FirstWord: Boolean; + begin + Result := False; + + FirstWord := True; + + if WholeWord then + begin + while (SearchCount > 0) and Editor.IsWordBreakChar(BufPtr^) do + begin + Inc(BufPtr, 1); + Dec(SearchCount); + end; + end; + + while SearchCount >= 0 do + begin + if WholeWord and (FirstWord = False) then + if not FindNextWordStart(BufPtr) then Break; + I := 0; + while (BufPtr[I] = SearchString[I + 1]) do + begin + Inc(I); + if I >= Length(SearchString) then + begin + if not WholeWord or (SearchCount = 0) or + Editor.IsWordBreakChar(BufPtr[I]) then + begin + Result := True; + Exit; + end; + Break; + end; + end; + FirstWord := False; + Inc(BufPtr); + Dec(SearchCount); + end; + end; + +begin + Result := -1; + + if not MatchCase then + begin + EditLine := SynWideUpperCase(EditLine); + SearchString := SynWideUpperCase(SearchString); + end; + + BufLen := Length(EditLine); + Buf := PWideChar(EditLine); + + if BufLen > 0 then + begin + SearchCount := succ(BufLen - StartPos - Length(SearchString)); + + if (SearchCount >= 0) and (SearchCount <= BufLen) and + (StartPos + SearchCount <= BufLen) then + begin + CurBuf := PWideChar(@Buf[StartPos]); + if not ScanText(CurBuf) then + CurBuf := nil + else + begin + if CurBuf <> nil then + Result := CurBuf - Buf; + end; + end; + end; + + CurBuf := nil; +end; + +procedure TCustomSynAutoCorrect.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +procedure TCustomSynAutoCorrect.Delete(AIndex: Integer); +begin + FItems.Delete(AIndex); +end; + +procedure TCustomSynAutoCorrect.Edit(AIndex: Integer; + ANewOriginal, ANewCorrection: UnicodeString); +begin + if AIndex > -1 then + FItems[AIndex] := ANewOriginal + FItemSepChar + ANewCorrection; +end; + +procedure TCustomSynAutoCorrect.KeyboardHandler(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); +var + b: Boolean; + i, cx: Integer; + s, Original, Correction, CurrText: UnicodeString; +begin + if Enabled and not AfterProcessing and not Handled then + begin + FPrevLine := Editor.CaretY; + case Command of + ecLineBreak, ecTab, ecChar: + begin + if (Command = ecChar) and not Editor.IsWordBreakChar(AChar) then + Exit; + b := False; + s := PreviousToken; + if s <> '' then + begin + cx := Editor.CaretX; + for i := 0 to Pred(FItems.Count) do + begin + CurrText := FItems[i]; + Original := HalfString(CurrText, True); + Correction := HalfString(CurrText, False); + b := b or FindAndCorrect(s, Original, Correction, cx); + end; + + if Assigned(OnCorrected) then + OnCorrected(Self); + end; + end; + end; {endcase} + end; +end; + +procedure TCustomSynAutoCorrect.MouseDownHandler(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + Action: TAutoCorrectAction; + b: Boolean; + i, cx: Integer; + s, Original, Correction, CurrText: UnicodeString; +begin + if ascoCorrectOnMouseDown in FOptions then + begin + if Assigned(Editor) and Enabled and (FPrevLine <> -1) then + begin + b := False; + s := Editor.Lines[Pred(FPrevLine)]; + cx := -1; + + for i := 0 to Pred(FItems.Count) do + begin + CurrText := FItems[i]; + Original := HalfString(CurrText, True); + Correction := HalfString(CurrText, False); + b := b or FindAndCorrect(s, Original, Correction, cx); + end; + + if b then + begin + if Assigned(FOnAutoCorrect) then + begin + Action := aaCorrect; + FOnAutoCorrect(Self, Editor.Lines[Pred(FPrevLine)], s, Editor.CaretY, + 0, Action); + if Action = aaAbort then Exit; + end; + Editor.Lines[Pred(FPrevLine)] := s; + + if Assigned(OnCorrected) then + OnCorrected(Self); + end; + end; + end; +end; + +function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: UnicodeString; + Original, Correction: UnicodeString; var CurrentX: Integer): Boolean; +var + StartPos: LongInt; + EndPos: Integer; + FoundText, ReplaceDefText: UnicodeString; + p: TBufferCoord; + Action: TAutoCorrectAction; + + function FirstCapCase(s: UnicodeString): UnicodeString; + begin + if s <> '' then + begin + s := SynWideLowerCase(s); + s[1] := SynWideUpperCase(s[1])[1]; + end; + + Result := s; + end; + +begin + Result := False; + ReplaceDefText := Correction; + StartPos := 0; + EndPos := Length(Original); + + if (Editor <> nil) and not (Editor.ReadOnly) then + begin + StartPos := CorrectItemStart(EditLine, Original, StartPos, + not (ascoIgnoreCase in FOptions), True); + + while StartPos > -1 do + begin + if (ascoMaintainCase in FOptions) then + begin + Correction := ReplaceDefText; + FoundText := Copy(EditLine,StartPos+1,EndPos); + + if FoundText = SynWideUpperCase(FoundText) then + Correction := SynWideUpperCase(Correction) + else + begin + if FoundText = SynWideLowerCase(FoundText) then + Correction := SynWideLowerCase(Correction) + else + begin + if FoundText = FirstCapCase(FoundText) then + Correction := FirstCapCase(Correction); + end; + end; + end; + + if CurrentX > - 1 then + begin + p := Editor.CaretXY; + if Assigned(FOnAutoCorrect) then + begin + Action := aaCorrect; + FOnAutoCorrect(Self, Original, Correction, P.Line, P.Char, Action); + + if Action = aaAbort then Break; + end; + + Editor.BeginUpdate; + + try + if p.Char = 0 then + Editor.BlockBegin := BufferCoord(p.Char - 1 - EndPos, p.Line) + else + Editor.BlockBegin := BufferCoord(p.Char - EndPos, p.Line); + + Editor.BlockEnd := p; + p := Editor.BlockBegin; + Editor.SelText := Correction; + Result := True; + finally + Editor.EndUpdate; + end; + + Break; + end + else + begin + Result := True; + EditLine := Copy(EditLine, 1, StartPos) + Correction + + Copy(EditLine, StartPos + EndPos + 1, MaxInt); + Inc(StartPos, EndPos); + StartPos := CorrectItemStart(EditLine, Original, StartPos, + not (ascoIgnoreCase in FOptions), True); + end; + end; + end; +end; + +function TCustomSynAutoCorrect.GetItems: TUnicodeStrings; +begin + Result := FItems; +end; + +procedure TCustomSynAutoCorrect.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FEditor) then + begin + Editor := nil; + end; +end; + +function TCustomSynAutoCorrect.PreviousToken: UnicodeString; +var + i, cx: Integer; +begin + Result := Editor.LineText; + cx := Editor.CaretX; + i := Pred(cx); + + if i <= Length(Result) then + begin + while (i > 0) and not Editor.IsWordBreakChar(Result[i]) do Dec(i); + Inc(i); + Result := Copy(Result, i, cx - i); + end + else + Result := ''; +end; + +procedure TCustomSynAutoCorrect.SetEditor(Value: TCustomSynEdit); +begin + if FEditor <> Value then + begin + if Assigned(FEditor) then + begin + Editor.RemoveMouseDownHandler(MouseDownHandler); + Editor.UnregisterCommandHandler(KeyboardHandler); +{$IFDEF SYN_COMPILER_5_UP} + Editor.RemoveFreeNotification(Self); +{$ENDIF} + end; + + FEditor := Value; + + if Assigned(FEditor) then + begin + Editor.FreeNotification(Self); + Editor.RegisterCommandHandler(KeyboardHandler, nil); + Editor.AddMouseDownHandler(MouseDownHandler); + end; + end; +end; + +procedure TCustomSynAutoCorrect.SetItems(const Value: TUnicodeStrings); +begin + FItems.Assign(Value); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.dfm b/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.dfm index 0918547d..eca53488 100644 --- a/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.dfm +++ b/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.dfm @@ -1,165 +1,165 @@ -object frmAutoCorrectEditor: TfrmAutoCorrectEditor - Left = 210 - Top = 111 - BorderStyle = bsDialog - Caption = 'AutoCorrection Items...' - ClientHeight = 377 - ClientWidth = 521 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter - ShowHint = True - OnCreate = FormCreate - OnPaint = FormPaint - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object lblLabel1: TLabel - Left = 16 - Top = 56 - Width = 38 - Height = 13 - Caption = '&Original:' - FocusControl = lbxItems - end - object lblLabel2: TLabel - Left = 252 - Top = 56 - Width = 56 - Height = 13 - Caption = '&Corrections:' - FocusControl = lbxItems - end - object btnAdd: TSpeedButton - Left = 16 - Top = 16 - Width = 65 - Height = 23 - Hint = 'Adds a new item to the auto-correction list.' - Caption = ' &Add' - Glyph.Data = { - 36030000424D3603000000000000360000002800000010000000100000000100 - 1800000000000003000000000000000000000000000000000000008080008080 - 0080800080800080800080800080800080800080800080800080800080800080 - 8000808000808000808000808000808080808080808080808080808080808080 - 8080808080808080808080808080808080808080808080808080008080000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 - FFFFFFFFFF00FFFF000000000000FFFFFF00FFFF000000808080008080000000 - 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF000000C0C0C00000 - 00FFFFFF000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 - FFFFFFFFFF00FFFF00000000FFFFC0C0C0000000000000808080008080000000 - 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF0000000000000000 - 00000000000000808080FFFFFF000000FFFFFF80808000FFFFFFFFFF00FFFFFF - FFFF00FFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF00000080808080808000FFFF - 00FFFF808080FFFFFF00FFFF80808000FFFFFFFFFFFFFFFF00FFFFFFFFFF00FF - FFFFFFFF000000808080008080808080FFFFFF80808000FFFF80808000FFFFFF - FFFF00FFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080808080808080 - 808080FFFFFF808080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF - FFFFFFFF000000808080FFFFFF00FFFF80808000FFFFFFFFFF80808080808080 - 8080808080000000000000000000000000000000000000008080008080808080 - 00FFFF80808000FFFF80808000FFFF0080800080800080800080800080800080 - 8000808000808000808080808000FFFF008080808080FFFFFF00808080808000 - FFFF00808000808000808000808000808000808000808000808000FFFF008080 - 00808080808000FFFF0080800080808080800080800080800080800080800080 - 80008080008080008080008080008080008080808080FFFFFF00808000808000 - 8080008080008080008080008080008080008080008080008080} - OnClick = btnAddClick - end - object btnDelete: TSpeedButton - Left = 88 - Top = 16 - Width = 65 - Height = 23 - Hint = 'Removes the selected item from the auto-correction list.' - Caption = '&Delete' - Enabled = False - Glyph.Data = { - 36030000424D3603000000000000360000002800000010000000100000000100 - 1800000000000003000000000000000000000000000000000000008080008080 - 0080800080800080800080800080800080800080800080800080800080800080 - 8000808000808000808000808000808080808080808080808080808080808080 - 8080808080808080808080808080808080808080808080808080008080000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 - FFFFFFFFFF00FFFF000000000000FFFFFF00FFFF000000808080808080000000 - 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF000000C0C0C00000 - 00FFFFFF000000808080000080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 - FFFFFFFFFF00FFFF00000000FFFFC0C0C0000000000000808080000080000080 - 00FFFFFFFFFF00FFFFFFFFFF80808000008000FFFFFFFFFF0000000000000000 - 0000000000000080808080808000008080808000FFFFFFFFFF80808000008080 - 8080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080008080000080 - 00008080808000FFFF000080000080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF - FFFFFFFF000000808080008080808080000080000080000080000080FFFFFF00 - FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080008080808080 - 000080000080000080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF - FFFFFFFF00000080808080808000008000008000008000008080808000000000 - 0000000000000000000000000000000000000000000000008080000080000080 - 8080800080800000800000808080800080800080800080800080800080800080 - 8000808000808000808000808000808000808000808000808000008000008080 - 8080008080008080008080008080008080008080008080008080008080008080 - 0080800080800080800080800000800000808080800080800080800080800080 - 8000808000808000808000808000808000808000808000808000808000808000 - 8080008080008080008080008080008080008080008080008080} - OnClick = btnDeleteClick - end - object btnClear: TSpeedButton - Left = 160 - Top = 16 - Width = 65 - Height = 23 - Hint = 'Clears the entire list.' - Caption = '&Clear' - Glyph.Data = { - F6000000424DF600000000000000760000002800000010000000100000000100 - 0400000000008000000000000000000000001000000010000000000000000000 - 8000008000000080800080000000800080008080000080808000C0C0C0000000 - FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00888888888888 - 8888888888888888888888808888888888088800088888888888880000888888 - 8088888000888888088888880008888008888888800088008888888888000008 - 8888888888800088888888888800000888888888800088008888888000088880 - 0888880000888888008888000888888888088888888888888888} - OnClick = btnClearClick - end - object btnEdit: TSpeedButton - Left = 232 - Top = 16 - Width = 65 - Height = 23 - Hint = 'Edits the selected item on the auto-correction list.' - Caption = '&Edit' - Enabled = False - OnClick = btnEditClick - end - object btnDone: TSpeedButton - Left = 312 - Top = 16 - Width = 65 - Height = 23 - Hint = 'Closes the edit dialog and saves the list.' - Caption = '&Done' - OnClick = btnDoneClick - end - object bvlSeparator: TBevel - Left = 304 - Top = 16 - Width = 2 - Height = 23 - end - object lbxItems: TListBox - Left = 16 - Top = 72 - Width = 489 - Height = 289 - Style = lbOwnerDrawFixed - BorderStyle = bsNone - ItemHeight = 15 - TabOrder = 0 - OnClick = lbxItemsClick - end -end +object frmAutoCorrectEditor: TfrmAutoCorrectEditor + Left = 210 + Top = 111 + BorderStyle = bsDialog + Caption = 'AutoCorrection Items...' + ClientHeight = 377 + ClientWidth = 521 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + ShowHint = True + OnCreate = FormCreate + OnPaint = FormPaint + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object lblLabel1: TLabel + Left = 16 + Top = 56 + Width = 38 + Height = 13 + Caption = '&Original:' + FocusControl = lbxItems + end + object lblLabel2: TLabel + Left = 252 + Top = 56 + Width = 56 + Height = 13 + Caption = '&Corrections:' + FocusControl = lbxItems + end + object btnAdd: TSpeedButton + Left = 16 + Top = 16 + Width = 65 + Height = 23 + Hint = 'Adds a new item to the auto-correction list.' + Caption = ' &Add' + Glyph.Data = { + 36030000424D3603000000000000360000002800000010000000100000000100 + 1800000000000003000000000000000000000000000000000000008080008080 + 0080800080800080800080800080800080800080800080800080800080800080 + 8000808000808000808000808000808080808080808080808080808080808080 + 8080808080808080808080808080808080808080808080808080008080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 + FFFFFFFFFF00FFFF000000000000FFFFFF00FFFF000000808080008080000000 + 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF000000C0C0C00000 + 00FFFFFF000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 + FFFFFFFFFF00FFFF00000000FFFFC0C0C0000000000000808080008080000000 + 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF0000000000000000 + 00000000000000808080FFFFFF000000FFFFFF80808000FFFFFFFFFF00FFFFFF + FFFF00FFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF00000080808080808000FFFF + 00FFFF808080FFFFFF00FFFF80808000FFFFFFFFFFFFFFFF00FFFFFFFFFF00FF + FFFFFFFF000000808080008080808080FFFFFF80808000FFFF80808000FFFFFF + FFFF00FFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080808080808080 + 808080FFFFFF808080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF + FFFFFFFF000000808080FFFFFF00FFFF80808000FFFFFFFFFF80808080808080 + 8080808080000000000000000000000000000000000000008080008080808080 + 00FFFF80808000FFFF80808000FFFF0080800080800080800080800080800080 + 8000808000808000808080808000FFFF008080808080FFFFFF00808080808000 + FFFF00808000808000808000808000808000808000808000808000FFFF008080 + 00808080808000FFFF0080800080808080800080800080800080800080800080 + 80008080008080008080008080008080008080808080FFFFFF00808000808000 + 8080008080008080008080008080008080008080008080008080} + OnClick = btnAddClick + end + object btnDelete: TSpeedButton + Left = 88 + Top = 16 + Width = 65 + Height = 23 + Hint = 'Removes the selected item from the auto-correction list.' + Caption = '&Delete' + Enabled = False + Glyph.Data = { + 36030000424D3603000000000000360000002800000010000000100000000100 + 1800000000000003000000000000000000000000000000000000008080008080 + 0080800080800080800080800080800080800080800080800080800080800080 + 8000808000808000808000808000808080808080808080808080808080808080 + 8080808080808080808080808080808080808080808080808080008080000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000808080008080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 + FFFFFFFFFF00FFFF000000000000FFFFFF00FFFF000000808080808080000000 + 00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF000000C0C0C00000 + 00FFFFFF000000808080000080000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00 + FFFFFFFFFF00FFFF00000000FFFFC0C0C0000000000000808080000080000080 + 00FFFFFFFFFF00FFFFFFFFFF80808000008000FFFFFFFFFF0000000000000000 + 0000000000000080808080808000008080808000FFFFFFFFFF80808000008080 + 8080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080008080000080 + 00008080808000FFFF000080000080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF + FFFFFFFF000000808080008080808080000080000080000080000080FFFFFF00 + FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000808080008080808080 + 000080000080000080FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FF + FFFFFFFF00000080808080808000008000008000008000008080808000000000 + 0000000000000000000000000000000000000000000000008080000080000080 + 8080800080800000800000808080800080800080800080800080800080800080 + 8000808000808000808000808000808000808000808000808000008000008080 + 8080008080008080008080008080008080008080008080008080008080008080 + 0080800080800080800080800000800000808080800080800080800080800080 + 8000808000808000808000808000808000808000808000808000808000808000 + 8080008080008080008080008080008080008080008080008080} + OnClick = btnDeleteClick + end + object btnClear: TSpeedButton + Left = 160 + Top = 16 + Width = 65 + Height = 23 + Hint = 'Clears the entire list.' + Caption = '&Clear' + Glyph.Data = { + F6000000424DF600000000000000760000002800000010000000100000000100 + 0400000000008000000000000000000000001000000010000000000000000000 + 8000008000000080800080000000800080008080000080808000C0C0C0000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00888888888888 + 8888888888888888888888808888888888088800088888888888880000888888 + 8088888000888888088888880008888008888888800088008888888888000008 + 8888888888800088888888888800000888888888800088008888888000088880 + 0888880000888888008888000888888888088888888888888888} + OnClick = btnClearClick + end + object btnEdit: TSpeedButton + Left = 232 + Top = 16 + Width = 65 + Height = 23 + Hint = 'Edits the selected item on the auto-correction list.' + Caption = '&Edit' + Enabled = False + OnClick = btnEditClick + end + object btnDone: TSpeedButton + Left = 312 + Top = 16 + Width = 65 + Height = 23 + Hint = 'Closes the edit dialog and saves the list.' + Caption = '&Done' + OnClick = btnDoneClick + end + object bvlSeparator: TBevel + Left = 304 + Top = 16 + Width = 2 + Height = 23 + end + object lbxItems: TListBox + Left = 16 + Top = 72 + Width = 489 + Height = 289 + Style = lbOwnerDrawFixed + BorderStyle = bsNone + ItemHeight = 15 + TabOrder = 0 + OnClick = lbxItemsClick + end +end diff --git a/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.pas b/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.pas index 0ed7e5c2..286f96cb 100644 --- a/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.pas +++ b/Source/VCL/SynEdit/Source/SynAutoCorrectEditor.pas @@ -1,233 +1,229 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynAutoCorrectEditor.pas, released 2001-10-05. -Author of this file is Aaron Chan. -Unicode translation by Maël Hörz. -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: SynAutoCorrectEditor.pas,v 1.9.2.3 2008/09/14 16:24:57 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -// TODO: use TntUnicode to enable unicode input - - -unit SynAutoCorrectEditor; - -interface - -{$I SynEdit.inc} - -uses - Windows, Messages, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, - Buttons, Registry, SynAutoCorrect, SynUnicode, SysUtils, Classes; - -type - TfrmAutoCorrectEditor = class(TForm) - lblLabel1: TLabel; - lblLabel2: TLabel; - lbxItems: TListBox; - btnAdd: TSpeedButton; - btnDelete: TSpeedButton; - btnClear: TSpeedButton; - btnEdit: TSpeedButton; - btnDone: TSpeedButton; - bvlSeparator: TBevel; - procedure FormShow(Sender: TObject); - procedure btnAddClick(Sender: TObject); - procedure btnDeleteClick(Sender: TObject); - procedure btnEditClick(Sender: TObject); - procedure btnDoneClick(Sender: TObject); - procedure btnClearClick(Sender: TObject); - procedure lbxItemsClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure FormPaint(Sender: TObject); - private - procedure lbxItemsDrawItemCLX(Sender: TObject; Index: Integer; - Rect: TRect; State: TOwnerDrawState; var Handled: Boolean); - procedure lbxItemsDrawItem(Control: TWinControl; Index: Integer; - Rect: TRect; State: TOwnerDrawState); - public - SynAutoCorrect: TSynAutoCorrect; - end; - -resourcestring - SConfirmation = 'Confirmation'; - SError = 'Error'; - SOriginal = 'Original:'; - SCorrection = 'Correction:'; - SAdd = 'Add...'; - SEdit = 'Edit...'; - SPleaseSelectItem = 'Please select an item before executing this command!'; - SClearListConfirmation = 'Are you sure you want to clear the entire list?'; - -implementation - -{$R *.dfm} - -uses - Types; - -procedure TfrmAutoCorrectEditor.FormShow(Sender: TObject); -begin - lbxItems.Items.Assign(SynAutoCorrect.Items); - Invalidate; -end; - -procedure TfrmAutoCorrectEditor.lbxItemsDrawItemCLX(Sender: TObject; - Index: Integer; Rect: TRect; State: TOwnerDrawState; var Handled: Boolean); -var - s: string; -begin - with lbxItems do - begin - s := Items[Index]; - Canvas.FillRect(Rect); - Canvas.TextOut(Rect.Left + 2, Rect.Top, SynAutoCorrect.HalfString(s, True)); - Canvas.TextOut(Rect.Left + (lbxItems.ClientWidth div 2) + 2, Rect.Top, - SynAutoCorrect.HalfString(s, False)); - FormPaint(nil); - end; -end; - -procedure TfrmAutoCorrectEditor.lbxItemsDrawItem(Control: TWinControl; - Index: Integer; Rect: TRect; State: TOwnerDrawState); -var - Dummy: Boolean; -begin - Dummy := True; - lbxItemsDrawItemCLX(Control, Index, Rect, State, Dummy); -end; - -procedure TfrmAutoCorrectEditor.btnAddClick(Sender: TObject); -var - Original, Correction: string; -begin - if InputQuery(SAdd, SOriginal, Original) then - InputQuery(SAdd, SCorrection, Correction) - else - Exit; - - with SynAutoCorrect do - begin - if (Original <> '') and (Correction <> '') then - begin - Add(Original, Correction); - lbxItems.Items.Assign(SynAutoCorrect.Items); - end; - end; - - btnDelete.Enabled := lbxItems.ItemIndex > -1; - btnEdit.Enabled := lbxItems.ItemIndex > -1; -end; - -procedure TfrmAutoCorrectEditor.btnDeleteClick(Sender: TObject); -begin - if lbxItems.ItemIndex < 0 then - begin - MessageBox(0, PChar(SPleaseSelectItem), PChar(SError), MB_ICONERROR or MB_OK); - Exit; - end; - - SynAutoCorrect.Delete(lbxItems.ItemIndex); - lbxItems.Items.Assign(SynAutoCorrect.Items); - - btnDelete.Enabled := lbxItems.ItemIndex > -1; - btnEdit.Enabled := lbxItems.ItemIndex > -1; -end; - -procedure TfrmAutoCorrectEditor.btnEditClick(Sender: TObject); -var - Original, Correction, CurrText: string; // TODO: unicode adapt -begin - if lbxItems.ItemIndex < 0 then - begin - MessageBox(0, PChar(SPleaseSelectItem), PChar(SError), MB_ICONERROR or MB_OK); - Exit; - end; - - with SynAutoCorrect do - begin - CurrText := SynAutoCorrect.Items[lbxItems.ItemIndex]; - Original := SynAutoCorrect.HalfString(CurrText, True); - Correction := SynAutoCorrect.HalfString(CurrText, False); - - if InputQuery(SEdit, SOriginal, Original) then - InputQuery(SEdit, SCorrection, Correction) - else - Exit; - - Edit(lbxItems.ItemIndex, Original, Correction); - lbxItems.Items.Assign(SynAutoCorrect.Items); - end; - - btnDelete.Enabled := lbxItems.ItemIndex > -1; - btnEdit.Enabled := lbxItems.ItemIndex > -1; -end; - -procedure TfrmAutoCorrectEditor.btnDoneClick(Sender: TObject); -begin - Close; -end; - -procedure TfrmAutoCorrectEditor.btnClearClick(Sender: TObject); -begin - if MessageBox(0, PChar(SClearListConfirmation), PChar(SConfirmation), - MB_YESNO or MB_ICONQUESTION) <> IDYES then Exit; - SynAutoCorrect.Items.Clear; - lbxItems.Items.Clear; - - btnDelete.Enabled := lbxItems.ItemIndex > -1; - btnEdit.Enabled := lbxItems.ItemIndex > -1; -end; - -procedure TfrmAutoCorrectEditor.lbxItemsClick(Sender: TObject); -begin - btnDelete.Enabled := lbxItems.ItemIndex > -1; - btnEdit.Enabled := lbxItems.ItemIndex > -1; -end; - -procedure TfrmAutoCorrectEditor.FormCreate(Sender: TObject); -begin - ClientWidth := 521; - ClientHeight := 377; - lbxItems.OnDrawItem := lbxItemsDrawItem; - BorderStyle := bsSingle; -end; - -procedure TfrmAutoCorrectEditor.FormPaint(Sender: TObject); -begin - { Paints the line in the middle of the listbox. } - with lbxItems.Canvas do - begin - Pen.Color := clBlack; - PenPos := Point(lbxItems.Width div 2 - 8, 0); - LineTo(lbxItems.Width div 2 - 8, lbxItems.Height); - end; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynAutoCorrectEditor.pas, released 2001-10-05. +Author of this file is Aaron Chan. +Unicode translation by Maël Hörz. +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: SynAutoCorrectEditor.pas,v 1.9.2.3 2008/09/14 16:24:57 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +// TODO: use TntUnicode to enable unicode input + + +{$IFNDEF QSYNAUTOCORRECTEDITOR} +unit SynAutoCorrectEditor; +{$ENDIF} + +interface + +{$I SynEdit.inc} + +uses + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} + Windows, Messages, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, + Buttons, Registry, + SynAutoCorrect, + SynUnicode, + SysUtils, + Classes; + +type + TfrmAutoCorrectEditor = class(TForm) + lblLabel1: TLabel; + lblLabel2: TLabel; + lbxItems: TListBox; + btnAdd: TSpeedButton; + btnDelete: TSpeedButton; + btnClear: TSpeedButton; + btnEdit: TSpeedButton; + btnDone: TSpeedButton; + bvlSeparator: TBevel; + procedure FormShow(Sender: TObject); + procedure btnAddClick(Sender: TObject); + procedure btnDeleteClick(Sender: TObject); + procedure btnEditClick(Sender: TObject); + procedure btnDoneClick(Sender: TObject); + procedure btnClearClick(Sender: TObject); + procedure lbxItemsClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormPaint(Sender: TObject); + private + procedure lbxItemsDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + public + SynAutoCorrect: TSynAutoCorrect; + end; + +resourcestring + SConfirmation = 'Confirmation'; + SError = 'Error'; + SOriginal = 'Original:'; + SCorrection = 'Correction:'; + SAdd = 'Add...'; + SEdit = 'Edit...'; + SPleaseSelectItem = 'Please select an item before executing this command!'; + SClearListConfirmation = 'Are you sure you want to clear the entire list?'; + +implementation + +{$R *.dfm} + +procedure TfrmAutoCorrectEditor.FormShow(Sender: TObject); +begin + lbxItems.Items.Assign(SynAutoCorrect.Items); + Invalidate; +end; + +procedure TfrmAutoCorrectEditor.lbxItemsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + s: UnicodeString; +begin + with lbxItems do + begin + s := Items[Index]; + Canvas.FillRect(Rect); + TextOut(Canvas, Rect.Left + 2, Rect.Top, SynAutoCorrect.HalfString(s, True)); + TextOut(Canvas, Rect.Left + (lbxItems.ClientWidth div 2) + 2, Rect.Top, + SynAutoCorrect.HalfString(s, False)); + FormPaint(nil); + end; +end; + +procedure TfrmAutoCorrectEditor.btnAddClick(Sender: TObject); +var + Original, Correction: string; +begin + if InputQuery(SAdd, SOriginal, Original) then + InputQuery(SAdd, SCorrection, Correction) + else + Exit; + + with SynAutoCorrect do + begin + if (Original <> '') and (Correction <> '') then + begin + Add(Original, Correction); + lbxItems.Items.Assign(SynAutoCorrect.Items); + end; + end; + + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmAutoCorrectEditor.btnDeleteClick(Sender: TObject); +begin + if lbxItems.ItemIndex < 0 then + begin + MessageBox(0, PChar(SPleaseSelectItem), PChar(SError), MB_ICONERROR or MB_OK); + + Exit; + end; + + SynAutoCorrect.Delete(lbxItems.ItemIndex); + lbxItems.Items.Assign(SynAutoCorrect.Items); + + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmAutoCorrectEditor.btnEditClick(Sender: TObject); +var + Original, Correction, CurrText: string; // TODO: unicode adapt +begin + if lbxItems.ItemIndex < 0 then + begin + MessageBox(0, PChar(SPleaseSelectItem), PChar(SError), MB_ICONERROR or MB_OK); + Exit; + end; + + with SynAutoCorrect do + begin + CurrText := SynAutoCorrect.Items[lbxItems.ItemIndex]; + Original := SynAutoCorrect.HalfString(CurrText, True); + Correction := SynAutoCorrect.HalfString(CurrText, False); + + if InputQuery(SEdit, SOriginal, Original) then + InputQuery(SEdit, SCorrection, Correction) + else + Exit; + + Edit(lbxItems.ItemIndex, Original, Correction); + lbxItems.Items.Assign(SynAutoCorrect.Items); + end; + + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmAutoCorrectEditor.btnDoneClick(Sender: TObject); +begin + Close; +end; + +procedure TfrmAutoCorrectEditor.btnClearClick(Sender: TObject); +begin + if MessageBox(0, PChar(SClearListConfirmation), PChar(SConfirmation), + MB_YESNO or MB_ICONQUESTION) <> IDYES then Exit; + SynAutoCorrect.Items.Clear; + lbxItems.Items.Clear; + + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmAutoCorrectEditor.lbxItemsClick(Sender: TObject); +begin + btnDelete.Enabled := lbxItems.ItemIndex > -1; + btnEdit.Enabled := lbxItems.ItemIndex > -1; +end; + +procedure TfrmAutoCorrectEditor.FormCreate(Sender: TObject); +begin + ClientWidth := 521; + ClientHeight := 377; + lbxItems.OnDrawItem := lbxItemsDrawItem; + BorderStyle := bsSingle; +end; + +procedure TfrmAutoCorrectEditor.FormPaint(Sender: TObject); +begin + { Paints the line in the middle of the listbox. } + with lbxItems.Canvas do + begin + Pen.Color := clBlack; + PenPos := Point(lbxItems.Width div 2 - 8, 0); + LineTo(lbxItems.Width div 2 - 8, lbxItems.Height); + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynCompletionProposal.pas b/Source/VCL/SynEdit/Source/SynCompletionProposal.pas index 548380df..1fa39cd5 100644 --- a/Source/VCL/SynEdit/Source/SynCompletionProposal.pas +++ b/Source/VCL/SynEdit/Source/SynCompletionProposal.pas @@ -1,3599 +1,3704 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynCompletionProposal.pas, released 2000-04-11. -The Original Code is based on mwCompletionProposal.pas by Cyrille de Brebisson, -part of the mwEdit component suite. -Portions created by Cyrille de Brebisson are Copyright (C) 1999 -Cyrille de Brebisson. -Unicode translation by Ma�l H�rz. -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. --------------------------------------------------------------------------------} - -unit SynCompletionProposal; - -{$I SynEdit.inc} - -interface - -uses - Winapi.Windows, - Winapi.Messages, - System.SysUtils, - System.Classes, - Vcl.Graphics, - Vcl.Forms, - Vcl.Controls, - Vcl.StdCtrls, - Vcl.ExtCtrls, - Vcl.Menus, - Vcl.ImgList, - SynEditTypes, - SynEditKeyCmds, - SynEdit, - SynUnicode; - -type - SynCompletionType = (ctCode, ctHint, ctParams); - - TSynForm = TCustomForm; - - TSynBaseCompletionProposalPaintItem = procedure(Sender: TObject; - Index: Integer; TargetCanvas: TCanvas; ItemRect: TRect; - var CustomDraw: Boolean) of object; - - TSynBaseCompletionProposalMeasureItem = procedure(Sender: TObject; - Index: Integer; TargetCanvas: TCanvas; var ItemWidth: Integer) of object; - - TCodeCompletionEvent = procedure(Sender: TObject; var Value: string; - Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; - - TAfterCodeCompletionEvent = procedure(Sender: TObject; const Value: string; - Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; - - TValidateEvent = procedure(Sender: TObject; Shift: TShiftState; - EndToken: WideChar) of object; - - TCompletionParameter = procedure(Sender: TObject; CurrentIndex: Integer; - var Level, IndexToDisplay: Integer; var Key: WideChar; - var DisplayString: string) of object; - - TCompletionExecute = procedure(Kind: SynCompletionType; Sender: TObject; - var CurrentInput: string; var x, y: Integer; var CanExecute: Boolean) of object; - - TCompletionChange = procedure(Sender: TObject; AIndex: Integer) of object; - - TSynCompletionOption = (scoCaseSensitive, //Use case sensitivity to do matches - scoLimitToMatchedText, //Limit the matched text to only what they have typed in - scoTitleIsCentered, //Center the title in the box if you choose to use titles - scoUseInsertList, //Use the InsertList to insert text instead of the ItemList (which will be displayed) - scoUsePrettyText, //Use the PrettyText function to output the words - scoUseBuiltInTimer, //Use the built in timer and the trigger keys to execute the proposal as well as the shortcut - scoEndCharCompletion, //When an end char is pressed, it triggers completion to occur (like the Delphi IDE) - scoConsiderWordBreakChars,//Use word break characters as additional end characters - scoCompleteWithTab, //Use the tab character for completion - scoCompleteWithEnter); //Use the Enter character for completion - - TSynCompletionOptions = set of TSynCompletionOption; - - -const - DefaultProposalOptions = [scoLimitToMatchedText, scoEndCharCompletion, scoCompleteWithTab, scoCompleteWithEnter]; - DefaultEndOfTokenChr = '()[]. '; - -type - TProposalColumns = class; - - TSynBaseCompletionProposalForm = class(TSynForm) - private - FCurrentString: string; - FOnPaintItem: TSynBaseCompletionProposalPaintItem; - FOnMeasureItem: TSynBaseCompletionProposalMeasureItem; - FOnChangePosition: TCompletionChange; - FItemList: TStrings; - FInsertList: TStrings; - FAssignedList: TStrings; - FPosition: Integer; - FLinesInWindow: Integer; - FTitleFontHeight: Integer; - FFontHeight: integer; - FScrollbar: TScrollBar; - FOnValidate: TValidateEvent; - FOnCancel: TNotifyEvent; - FClSelect: TColor; - fClSelectText: TColor; - FClTitleBackground: TColor; - fClBackGround: TColor; - Bitmap: TBitmap; // used for drawing - TitleBitmap: TBitmap; // used for title-drawing - FCurrentEditor: TCustomSynEdit; - FTitle: string; - FTitleFont: TFont; - FFont: TFont; - FResizeable: Boolean; - FItemHeight: Integer; - FMargin: Integer; - FEffectiveItemHeight: Integer; - FImages: TCustomImageList; - -//These are the reflections of the Options property of the CompletionProposal - FCase: boolean; - FMatchText: Boolean; - FFormattedText: Boolean; - FCenterTitle: Boolean; - FUseInsertList: boolean; - FCompleteWithTab: Boolean; - FCompleteWithEnter: Boolean; - - FMouseWheelAccumulator: integer; - FDisplayKind: SynCompletionType; - FParameterToken: TCompletionParameter; - FCurrentIndex: Integer; - FCurrentLevel: Integer; - FDefaultKind: SynCompletionType; - FEndOfTokenChr: string; - FTriggerChars: string; - OldShowCaret: Boolean; - FHeightBuffer: Integer; - FColumns: TProposalColumns; - procedure SetCurrentString(const Value: string); - procedure MoveLine(cnt: Integer); - procedure ScrollbarOnChange(Sender: TObject); - procedure ScrollbarOnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); - procedure ScrollbarOnEnter(Sender: TObject); - - procedure SetItemList(const Value: TStrings); - procedure SetInsertList(const Value: TStrings); - procedure SetPosition(const Value: Integer); - procedure SetResizeable(const Value: Boolean); - procedure SetItemHeight(const Value: Integer); - procedure SetImages(const Value: TCustomImageList); - procedure StringListChange(Sender: TObject); - procedure DoDoubleClick(Sender : TObject); - procedure DoFormShow(Sender: TObject); - procedure DoFormHide(Sender: TObject); - procedure AdjustScrollBarPosition; - procedure AdjustMetrics; - procedure SetTitle(const Value: string); - procedure SetFont(const Value: TFont); - procedure SetTitleFont(const Value: TFont); - procedure SetColumns(Value: TProposalColumns); - procedure TitleFontChange(Sender: TObject); - procedure FontChange(Sender: TObject); - procedure RecalcItemHeight; - function IsWordBreakChar(AChar: WideChar): Boolean; - procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; - protected - procedure KeyDown(var Key: Word; Shift: TShiftState); override; - procedure KeyPress(var Key: Char); override; - procedure Paint; override; - procedure Activate; override; - procedure Deactivate; override; - procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; - procedure Resize; override; - procedure Notification(AComponent: TComponent; Operation: TOperation); override; - procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; - procedure WMActivate (var Message: TWMActivate); message WM_ACTIVATE; - procedure WMEraseBackgrnd(var Message: TMessage); message WM_ERASEBKGND; - procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE; - procedure CreateParams(var Params: TCreateParams); override; - function GetCurrentPPI: Integer; override; - public - constructor Create(AOwner: Tcomponent); override; - destructor Destroy; override; - - function LogicalToPhysicalIndex(Index: Integer): Integer; - function PhysicalToLogicalIndex(Index: Integer): Integer; - - property DisplayType: SynCompletionType read FDisplayKind write FDisplayKind; - property DefaultType: SynCompletionType read FDefaultKind write FDefaultKind default ctCode; - property CurrentString: string read FCurrentString write SetCurrentString; - property CurrentIndex: Integer read FCurrentIndex write FCurrentIndex; - property CurrentLevel: Integer read FCurrentLevel write FCurrentLevel; - property OnParameterToken: TCompletionParameter read FParameterToken write FParameterToken; - property OnKeyPress; - property OnPaintItem: TSynBaseCompletionProposalPaintItem read FOnPaintItem write FOnPaintItem; - property OnMeasureItem: TSynBaseCompletionProposalMeasureItem read FOnMeasureItem write FOnMeasureItem; - property OnValidate: TValidateEvent read FOnValidate write FOnValidate; - property OnCancel: TNotifyEvent read FOnCancel write FOnCancel; - property ItemList: TStrings read FItemList write SetItemList; - property InsertList: TStrings read FInsertList write SetInsertList; - property AssignedList: TStrings read FAssignedList write FAssignedList; - property Position: Integer read FPosition write SetPosition; - property Title: string read fTitle write SetTitle; - property ClSelect: TColor read FClSelect write FClSelect default clHighlight; - property ClSelectedText: TColor read FClSelectText write FClSelectText default clHighlightText; - property ClBackground: TColor read FClBackGround write FClBackGround default clWindow; - property ClTitleBackground: TColor read FClTitleBackground write FClTitleBackground default clBtnFace; - property ItemHeight: Integer read FItemHeight write SetItemHeight default 0; - property Margin: Integer read FMargin write FMargin default 2; - - property UsePrettyText: boolean read FFormattedText write FFormattedText default False; - property UseInsertList: boolean read FUseInsertList write FUseInsertList default False; - property CenterTitle: boolean read FCenterTitle write FCenterTitle default True; - property CaseSensitive: Boolean read fCase write fCase default False; - property CurrentEditor: TCustomSynEdit read fCurrentEditor write fCurrentEditor; - property MatchText: Boolean read fMatchText write fMatchText; - property EndOfTokenChr: string read FEndOfTokenChr write FEndOfTokenChr; - property TriggerChars: string read FTriggerChars write FTriggerChars; - property CompleteWithTab: Boolean read FCompleteWithTab write FCompleteWithTab; - property CompleteWithEnter: Boolean read FCompleteWithEnter write FCompleteWithEnter; - - property TitleFont: TFont read fTitleFont write SetTitleFont; - property Font: TFont read fFont write SetFont; - property Columns: TProposalColumns read FColumns write SetColumns; - property Resizeable: Boolean read FResizeable write SetResizeable; - property Images: TCustomImageList read FImages write SetImages; - end; - - TSynBaseCompletionProposal = class(TComponent) - private - FForm: TSynBaseCompletionProposalForm; - FOnExecute: TCompletionExecute; - FOnClose: TNotifyEvent; - FOnShow: TNotifyEvent; - FWidth: Integer; - FPreviousToken: string; - FDotOffset: Integer; - FOptions: TSynCompletionOptions; - FNbLinesInWindow: Integer; - FFontsAreScaled: Boolean; - - FCanExecute: Boolean; - function GetClSelect: TColor; - procedure SetClSelect(const Value: TColor); - function GetCurrentString: string; - function GetItemList: TStrings; - function GetInsertList: TStrings; - function GetOnCancel: TNotifyEvent; - function GetOnKeyPress: TKeyPressEvent; - function GetOnPaintItem: TSynBaseCompletionProposalPaintItem; - function GetOnMeasureItem: TSynBaseCompletionProposalMeasureItem; - function GetOnValidate: TValidateEvent; - function GetPosition: Integer; - procedure SetCurrentString(const Value: string); - procedure SetItemList(const Value: TStrings); - procedure SetInsertList(const Value: TStrings); - procedure SetNbLinesInWindow(const Value: Integer); - procedure SetOnCancel(const Value: TNotifyEvent); - procedure SetOnKeyPress(const Value: TKeyPressEvent); - procedure SetOnPaintItem(const Value: TSynBaseCompletionProposalPaintItem); - procedure SetOnMeasureItem(const Value: TSynBaseCompletionProposalMeasureItem); - procedure SetPosition(const Value: Integer); - procedure SetOnValidate(const Value: TValidateEvent); - procedure SetWidth(Value: Integer); - procedure SetImages(const Value: TCustomImageList); - function GetDisplayKind: SynCompletionType; - procedure SetDisplayKind(const Value: SynCompletionType); - function GetParameterToken: TCompletionParameter; - procedure SetParameterToken(const Value: TCompletionParameter); - function GetDefaultKind: SynCompletionType; - procedure SetDefaultKind(const Value: SynCompletionType); - function GetClBack: TColor; - procedure SetClBack(const Value: TColor); - function GetClSelectedText: TColor; - procedure SetClSelectedText(const Value: TColor); - function GetEndOfTokenChar: string; - procedure SetEndOfTokenChar(const Value: string); - function GetClTitleBackground: TColor; - procedure SetClTitleBackground(const Value: TColor); - procedure SetTitle(const Value: string); - function GetTitle: string; - function GetFont: TFont; - function GetTitleFont: TFont; - procedure SetFont(const Value: TFont); - procedure SetTitleFont(const Value: TFont); - function GetOptions: TSynCompletionOptions; - function GetTriggerChars: string; - procedure SetTriggerChars(const Value: string); - function GetOnChange: TCompletionChange; - procedure SetOnChange(const Value: TCompletionChange); - procedure SetColumns(const Value: TProposalColumns); - function GetColumns: TProposalColumns; - function GetResizeable: Boolean; - procedure SetResizeable(const Value: Boolean); - function GetItemHeight: Integer; - procedure SetItemHeight(const Value: Integer); - function GetMargin: Integer; - procedure SetMargin(const Value: Integer); - function GetImages: TCustomImageList; - function IsWordBreakChar(AChar: WideChar): Boolean; - protected - procedure DefineProperties(Filer: TFiler); override; - procedure SetOptions(const Value: TSynCompletionOptions); virtual; - procedure EditorCancelMode(Sender: TObject); virtual; - procedure HookedEditorCommand(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: Pointer; HandlerData: Pointer); virtual; - public - constructor Create(AOwner: TComponent); override; - procedure Execute(s: string; x, y: Integer); - procedure ExecuteEx(s: string; x, y: Integer; Kind: SynCompletionType = ctCode); virtual; - procedure Activate; - procedure Deactivate; - - procedure ClearList; - function DisplayItem(AIndex: Integer): string; - function InsertItem(AIndex: Integer): string; - procedure AddItemAt(Where: Integer; ADisplayText, AInsertText: string); - procedure AddItem(ADisplayText, AInsertText: string); - procedure ResetAssignedList; - - property OnKeyPress: TKeyPressEvent read GetOnKeyPress write SetOnKeyPress; - property OnValidate: TValidateEvent read GetOnValidate write SetOnValidate; - property OnCancel: TNotifyEvent read GetOnCancel write SetOnCancel; - property CurrentString: string read GetCurrentString write SetCurrentString; - property DotOffset: Integer read FDotOffset write FDotOffset; - property DisplayType: SynCompletionType read GetDisplayKind write SetDisplayKind; - property Form: TSynBaseCompletionProposalForm read FForm; - property PreviousToken: string read FPreviousToken; - property Position: Integer read GetPosition write SetPosition; - property FontsAreScaled: Boolean read fFontsAreScaled write fFontsAreScaled; - published - property DefaultType: SynCompletionType read GetDefaultKind write SetDefaultKind default ctCode; - property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; - - property ItemList: TStrings read GetItemList write SetItemList; - property InsertList: TStrings read GetInsertList write SetInsertList; - property NbLinesInWindow: Integer read FNbLinesInWindow write SetNbLinesInWindow default 8; - property ClSelect: TColor read GetClSelect write SetClSelect default clHighlight; - property ClSelectedText: TColor read GetClSelectedText write SetClSelectedText default clHighlightText; - property ClBackground: TColor read GetClBack write SetClBack default clWindow; - property ClTitleBackground: TColor read GetClTitleBackground write SetClTitleBackground default clBtnFace; - property Width: Integer read FWidth write SetWidth default 260; - property EndOfTokenChr: string read GetEndOfTokenChar write SetEndOfTokenChar; - property TriggerChars: string read GetTriggerChars write SetTriggerChars; - property Title: string read GetTitle write SetTitle; - property Font: TFont read GetFont write SetFont; - property TitleFont: TFont read GetTitleFont write SetTitleFont; - property Columns: TProposalColumns read GetColumns write SetColumns; - property Resizeable: Boolean read GetResizeable write SetResizeable default False; - property ItemHeight: Integer read GetItemHeight write SetItemHeight default 0; - property Images: TCustomImageList read GetImages write SetImages default nil; - property Margin: Integer read GetMargin write SetMargin default 2; - - property OnChange: TCompletionChange read GetOnChange write SetOnChange; - property OnClose: TNotifyEvent read FOnClose write FOnClose; - property OnExecute: TCompletionExecute read FOnExecute write FOnExecute; - property OnMeasureItem: TSynBaseCompletionProposalMeasureItem read GetOnMeasureItem write SetOnMeasureItem; - property OnPaintItem: TSynBaseCompletionProposalPaintItem read GetOnPaintItem write SetOnPaintItem; - property OnParameterToken: TCompletionParameter read GetParameterToken write SetParameterToken; - property OnShow: TNotifyEvent read FOnShow write FOnShow; - end; - - TSynCompletionProposal = class(TSynBaseCompletionProposal) - private - fEditors: TList; - FShortCut: TShortCut; - FNoNextKey: Boolean; - FCompletionStart: Integer; - FAdjustCompletionStart: Boolean; - FOnCodeCompletion: TCodeCompletionEvent; - FTimer: TTimer; - FTimerInterval: Integer; - FEditor: TCustomSynEdit; - FOnAfterCodeCompletion: TAfterCodeCompletionEvent; - FOnCancelled: TNotifyEvent; - procedure SetEditor(const Value: TCustomSynEdit); - procedure HandleOnCancel(Sender: TObject); - procedure HandleOnValidate(Sender: TObject; Shift: TShiftState; EndToken: WideChar); - procedure HandleOnKeyPress(Sender: TObject; var Key: WideChar); - procedure HandleDblClick(Sender: TObject); - procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure EditorKeyPress(Sender: TObject; var Key: WideChar); - procedure TimerExecute(Sender: TObject); - function GetPreviousToken(AEditor: TCustomSynEdit): string; - function GetCurrentInput(AEditor: TCustomSynEdit): string; - function GetTimerInterval: Integer; - procedure SetTimerInterval(const Value: Integer); - function GetEditor(i: Integer): TCustomSynEdit; - procedure InternalCancelCompletion; - protected - procedure DoExecute(AEditor: TCustomSynEdit); virtual; - procedure Notification(AComponent: TComponent; Operation: TOperation); override; - procedure SetShortCut(Value: TShortCut); - procedure SetOptions(const Value: TSynCompletionOptions); override; - procedure EditorCancelMode(Sender: TObject); override; - procedure HookedEditorCommand(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: Pointer; HandlerData: Pointer); override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure AddEditor(AEditor: TCustomSynEdit); - function RemoveEditor(AEditor: TCustomSynEdit): boolean; - function EditorsCount: integer; - procedure ExecuteEx(s: string; x, y: Integer; Kind : SynCompletionType = ctCode); override; - procedure ActivateCompletion; - procedure CancelCompletion; - procedure ActivateTimer(ACurrentEditor: TCustomSynEdit); - procedure DeactivateTimer; - property Editors[i: Integer]: TCustomSynEdit read GetEditor; - property CompletionStart: Integer read FCompletionStart write FCompletionStart; // ET 04/02/2003 - published - property ShortCut: TShortCut read FShortCut write SetShortCut; - property Editor: TCustomSynEdit read FEditor write SetEditor; - property TimerInterval: Integer read GetTimerInterval write SetTimerInterval default 1000; - - property OnAfterCodeCompletion: TAfterCodeCompletionEvent read FOnAfterCodeCompletion write FOnAfterCodeCompletion; - property OnCancelled: TNotifyEvent read FOnCancelled write FOnCancelled; - property OnCodeCompletion: TCodeCompletionEvent read FOnCodeCompletion write FOnCodeCompletion; - end; - - TSynAutoComplete = class(TComponent) - private - FShortCut: TShortCut; - fEditor: TCustomSynEdit; - fAutoCompleteList: TStrings; - fNoNextKey : Boolean; - FEndOfTokenChr: string; - FOnBeforeExecute: TNotifyEvent; - FOnAfterExecute: TNotifyEvent; - FInternalCompletion: TSynCompletionProposal; - FDoLookup: Boolean; - FOptions: TSynCompletionOptions; - procedure SetAutoCompleteList(List: TStrings); - procedure SetEditor(const Value: TCustomSynEdit); - procedure SetDoLookup(const Value: Boolean); - procedure CreateInternalCompletion; - function GetOptions: TSynCompletionOptions; - procedure SetOptions(const Value: TSynCompletionOptions); - procedure DoInternalAutoCompletion(Sender: TObject; - const Value: string; Shift: TShiftState; Index: Integer; - EndToken: WideChar); - function GetExecuting: Boolean; - protected - procedure SetShortCut(Value: TShortCut); - procedure Notification(AComponent: TComponent; Operation: TOperation); - override; - procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - virtual; - procedure EditorKeyPress(Sender: TObject; var Key: WideChar); virtual; - function GetPreviousToken(Editor: TCustomSynEdit): string; - public - function GetCompletionProposal : TSynCompletionProposal; - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Execute(Token: string; Editor: TCustomSynEdit); - procedure ExecuteEx(Token: string; Editor: TCustomSynEdit; LookupIfNotExact: Boolean); - function GetTokenList: string; - function GetTokenValue(Token: string): string; - procedure CancelCompletion; - property Executing: Boolean read GetExecuting; - published - property AutoCompleteList: TStrings read fAutoCompleteList - write SetAutoCompleteList; - property EndOfTokenChr: string read FEndOfTokenChr write FEndOfTokenChr; - property Editor: TCustomSynEdit read fEditor write SetEditor; - property ShortCut: TShortCut read FShortCut write SetShortCut; - property OnBeforeExecute: TNotifyEvent read FOnBeforeExecute write FOnBeforeExecute; - property OnAfterExecute: TNotifyEvent read FOnAfterExecute write FOnAfterExecute; - property DoLookupWhenNotExact: Boolean read FDoLookup write SetDoLookup default true; - property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; - end; - - TProposalColumn = class(TCollectionItem) - private - FColumnWidth: Integer; - FInternalWidth: Integer; - FFontStyle: TFontStyles; - protected - procedure DefineProperties(Filer: TFiler); override; - public - constructor Create(Collection: TCollection); override; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - published - property ColumnWidth: Integer read FColumnWidth write FColumnWidth; - property DefaultFontStyle: TFontStyles read FFontStyle write FFontStyle default []; - end; - - TProposalColumns = class(TCollection) - private - FOwner: TPersistent; - function GetItem(Index: Integer): TProposalColumn; - procedure SetItem(Index: Integer; Value: TProposalColumn); - protected - function GetOwner: TPersistent; override; - public - constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); - function Add: TProposalColumn; - function FindItemID(ID: Integer): TProposalColumn; - function Insert(Index: Integer): TProposalColumn; - property Items[Index: Integer]: TProposalColumn read GetItem write SetItem; default; - end; - - -procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; PPI: Integer; - const Text: string; Selected: Boolean; Columns: TProposalColumns; Images: TCustomImageList); -function FormattedTextWidth(TargetCanvas: TCanvas; const Text: string; PPI: Integer; - Columns: TProposalColumns; Images: TCustomImageList): Integer; -function PrettyTextToFormattedString(const APrettyText: string; - AlternateBoldStyle: Boolean = False): string; - -implementation - -uses - System.Math, - Vcl.Themes, - System.Types, - System.UITypes, - SynEditTextBuffer, - SynEditMiscProcs, - SynEditKeyConst; - -const - TextHeightString = 'CompletionProposal'; - -//------------------------- Formatted painting stuff --------------------------- - -type - TFormatCommand = (fcNoCommand, fcColor, fcStyle, fcColumn, fcHSpace, fcImage); - TFormatCommands = set of TFormatCommand; - - PFormatChunk = ^TFormatChunk; - TFormatChunk = record - Str: string; - Command: TFormatCommand; - Data: Pointer; - end; - - PFormatStyleData = ^TFormatStyleData; - TFormatStyleData = record - Style: WideChar; - Action: Integer; // -1 = Reset, +1 = Set, 0 = Toggle - end; - - TFormatChunkList = class - private - FChunks: TList; - function GetCount: Integer; - function GetChunk(Index: Integer): PFormatChunk; - public - constructor Create; - destructor Destroy; override; - procedure Clear; - procedure Add(AChunk: PFormatChunk); - property Count: Integer read GetCount; - property Chunks[Index: Integer]: PFormatChunk read GetChunk; default; - end; - - -const - AllCommands = [fcColor..High(TFormatCommand)]; - - -function TFormatChunkList.GetCount: Integer; -begin - Result := FChunks.Count; -end; - -function TFormatChunkList.GetChunk(Index: Integer): PFormatChunk; -begin - Result := FChunks[Index]; -end; - -procedure TFormatChunkList.Clear; -var - C: PFormatChunk; - StyleFormatData: PFormatStyleData; -begin - while FChunks.Count > 0 do - begin - C := FChunks.Last; - FChunks.Delete(FChunks.Count-1); - - case C^.Command of - fcStyle: - begin - StyleFormatData := C^.Data; - Dispose(StyleFormatData); - end; - end; - - Dispose(C); - end; -end; - -constructor TFormatChunkList.Create; -begin - inherited Create; - FChunks := TList.Create; -end; - -destructor TFormatChunkList.Destroy; -begin - Clear; - FChunks.Free; - inherited Destroy; -end; - -procedure TFormatChunkList.Add(AChunk: PFormatChunk); -begin - FChunks.Add(AChunk); -end; - - -function ParseFormatChunks(const FormattedString: string; ChunkList: TFormatChunkList; - const StripCommands: TFormatCommands): Boolean; -var - CurChar: WideChar; - CurPos: Integer; - CurrentChunk: string; - PossibleErrorPos: Integer; - ErrorFound: Boolean; - - procedure NextChar; - begin - inc(CurPos); - {$IFOPT R+} - // Work-around Delphi's annoying behaviour of failing the RangeCheck when - // reading the final #0 char - if CurPos = Length(FormattedString) +1 then - CurChar := #0 - else - {$ENDIF} - CurChar := FormattedString[CurPos]; - end; - - procedure AddStringChunk; - var - C: PFormatChunk; - begin - C := New(PFormatChunk); - C^.Str := CurrentChunk; - C^.Command := fcNoCommand; - C^.Data := nil; - ChunkList.Add(C); - - CurrentChunk := ''; - end; - - procedure AddCommandChunk(ACommand: TFormatCommand; Data: Pointer); - var - C: PFormatChunk; - begin - C := New(PFormatChunk); - C^.Str := ''; - C^.Command := ACommand; - C^.Data := Data; - ChunkList.Add(C); - end; - - procedure ParseEscapeSequence; - var - Command: string; - Parameter: string; - CommandType: TFormatCommand; - Data: Pointer; - begin - Assert(CurChar = '\'); - NextChar; - if CurChar = '\' then - begin - CurrentChunk := CurrentChunk + '\'; - NextChar; - exit; - end; - - if CurrentChunk <> '' then - AddStringChunk; - - Command := ''; - while (CurChar <> '{') and (CurPos <= Length(FormattedString)) do - begin - Command := Command +CurChar; - NextChar; - end; - - if CurChar = '{' then - begin - PossibleErrorPos := CurPos; - NextChar; - Parameter := ''; - while (CurChar <> '}') and (CurPos <= Length(FormattedString)) do - begin - Parameter := Parameter + CurChar; - NextChar; - end; - - if CurChar = '}' then - begin - Command := System.SysUtils.AnsiUpperCase(Command); - - Data := nil; - CommandType := fcNoCommand; - - if Command = 'COLOR' then - begin - try - Data := Pointer(StringToColor(Parameter)); - CommandType := fcColor; - except - CommandType := fcNoCommand; - ErrorFound := True; - end; - end else - if Command = 'COLUMN' then - begin - if Parameter <> '' then - begin - CommandType := fcNoCommand; - ErrorFound := True; - end else - CommandType := fcColumn; - end else - if Command = 'HSPACE' then - begin - try - Data := Pointer(StrToInt(Parameter)); - CommandType := fcHSpace; - except - CommandType := fcNoCommand; - ErrorFound := True; - end; - end else - if Command = 'IMAGE' then - begin - try - Data := Pointer(StrToInt(Parameter)); - CommandType := fcImage; - except - CommandType := fcNoCommand; - ErrorFound := True; - end; - end else - if Command = 'STYLE' then - begin - if (Length(Parameter) = 2) - and CharInSet(Parameter[1], ['+', '-', '~']) - and CharInSet(System.SysUtils.AnsiUpperCase(Parameter[2])[1], - ['B', 'I', 'U', 'S']) then - begin - CommandType := fcStyle; - if not (fcStyle in StripCommands) then - begin - Data := New(PFormatStyleData); - PFormatStyleData(Data)^.Style := System.SysUtils.AnsiUpperCase(Parameter[2])[1]; - case Parameter[1] of - '+': PFormatStyleData(Data)^.Action := 1; - '-': PFormatStyleData(Data)^.Action := -1; - '~': PFormatStyleData(Data)^.Action := 0; - end; - end; - end else - begin - CommandType := fcNoCommand; - ErrorFound := True; - end; - end else - ErrorFound := True; - - if (CommandType <> fcNoCommand) and (not (CommandType in StripCommands)) then - AddCommandChunk(CommandType, Data); - - NextChar; - end; - end; - Result := not ErrorFound; - end; - - procedure ParseString; - begin - Assert(CurChar <> '\'); - while (CurChar <> '\') and (CurPos <= Length(FormattedString)) do - begin - CurrentChunk := CurrentChunk +CurChar; - NextChar; - end; - end; - -begin - Assert(Assigned(ChunkList)); - - if FormattedString = '' then - exit; - - ErrorFound := False; - CurrentChunk := ''; - CurPos := 1; - CurChar := FormattedString[1]; - - while CurPos <= Length(FormattedString) do - begin - if CurChar = '\' then - ParseEscapeSequence - else - ParseString; - end; - - if CurrentChunk <> '' then - AddStringChunk; -end; - - -function StripFormatCommands(const FormattedString: string): string; -var - Chunks: TFormatChunkList; - i: Integer; -begin - Chunks := TFormatChunkList.Create; - try - ParseFormatChunks(FormattedString, Chunks, AllCommands); - - Result := ''; - for i := 0 to Chunks.Count -1 do - Result := Result + Chunks[i]^.Str; - - finally - Chunks.Free; - end; -end; - - -function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; PPI : integer; - ChunkList: TFormatChunkList; Columns: TProposalColumns; Images: TCustomImageList; - Invisible: Boolean): Integer; -var - i: Integer; - X: Integer; - C: PFormatChunk; - CurrentColumn: TProposalColumn; - CurrentColumnIndex: Integer; - LastColumnStart: Integer; - Style: TFontStyles; - OldFont: TFont; -begin - OldFont := TFont.Create; - try - OldFont.Assign(TargetCanvas.Font); - - if Assigned(Columns) and (Columns.Count > 0) then - begin - CurrentColumnIndex := 0; - CurrentColumn := TProposalColumn(Columns.Items[0]); - TargetCanvas.Font.Style := CurrentColumn.FFontStyle; - end else - begin - CurrentColumnIndex := -1; - CurrentColumn := nil; - end; - - LastColumnStart := Rect.Left; - X := Rect.Left; - - TargetCanvas.Brush.Style := bsClear; - - for i := 0 to ChunkList.Count -1 do - begin - C := ChunkList[i]; - - case C^.Command of - fcNoCommand: - begin - if not Invisible then - TargetCanvas.TextOut(X, Rect.Top, C^.Str); - - inc(X, TargetCanvas.TextWidth(C^.Str)); - if X > Rect.Right then - break; - end; - fcColor: - if not Invisible then - TargetCanvas.Font.Color := StyleServices.GetSystemColor(TColor(C^.Data)); - fcStyle: - begin - case PFormatStyleData(C^.Data)^.Style of - 'I': Style := [fsItalic]; - 'B': Style := [fsBold]; - 'U': Style := [fsUnderline]; - 'S': Style := [fsStrikeout]; - else Assert(False); - end; - - - case PFormatStyleData(C^.Data)^.Action of - -1: TargetCanvas.Font.Style := TargetCanvas.Font.Style - Style; - 0: if TargetCanvas.Font.Style * Style = [] then - TargetCanvas.Font.Style := TargetCanvas.Font.Style + Style - else - TargetCanvas.Font.Style := TargetCanvas.Font.Style - Style; - 1: TargetCanvas.Font.Style := TargetCanvas.Font.Style + Style; - else Assert(False); - end; - end; - fcColumn: - if Assigned(Columns) and (Columns.Count > 0) then - begin - if CurrentColumnIndex <= Columns.Count -1 then - begin - inc(LastColumnStart, MulDiv(CurrentColumn.FColumnWidth, PPI, 96)); - X := LastColumnStart; - - inc(CurrentColumnIndex); - if CurrentColumnIndex <= Columns.Count -1 then - begin - CurrentColumn := TProposalColumn(Columns.Items[CurrentColumnIndex]); - TargetCanvas.Font.Style := CurrentColumn.FFontStyle; - end else - CurrentColumn := nil; - end; - end; - fcHSpace: - begin - inc(X, Integer(C^.Data)); - if X > Rect.Right then - break; - end; - fcImage: - begin - Assert(Assigned(Images)); - - Images.Draw(TargetCanvas, X, Rect.Top, Integer(C^.Data)); - - inc(X, Images.Width); - if X > Rect.Right then - break; - end; - end; - end; - - Result := X; - TargetCanvas.Font.Assign(OldFont); - finally - OldFont.Free; - TargetCanvas.Brush.Style := bsSolid; - end; -end; - -procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; PPI: Integer; - const Text: string; Selected: Boolean; Columns: TProposalColumns; Images: TCustomImageList); -var - Chunks: TFormatChunkList; - StripCommands: TFormatCommands; -begin - Chunks := TFormatChunkList.Create; - try - if Selected then - StripCommands := [fcColor] - else - StripCommands := []; - - ParseFormatChunks(Text, Chunks, StripCommands); - PaintChunks(TargetCanvas, Rect, PPI, Chunks, Columns, Images, False); - finally - Chunks.Free; - end; -end; - -function FormattedTextWidth(TargetCanvas: TCanvas; const Text: string; PPI: Integer; - Columns: TProposalColumns; Images: TCustomImageList): Integer; -var - Chunks: TFormatChunkList; - TmpRect: TRect; -begin - Chunks := TFormatChunkList.Create; - try - TmpRect := Rect(0, 0, MaxInt, MaxInt); - - ParseFormatChunks(Text, Chunks, [fcColor]); - Result := PaintChunks(TargetCanvas, TmpRect, PPI, Chunks, Columns, Images, True); - finally - Chunks.Free; - end; -end; - -function PrettyTextToFormattedString(const APrettyText: string; - AlternateBoldStyle: Boolean = False): string; -var - i: Integer; - Color: TColor; -Begin - Result := ''; - i := 1; - while i <= Length(APrettyText) do - case APrettyText[i] of - #1, #2: - begin - Color := (Ord(APrettyText[i + 3]) shl 8 - +Ord(APrettyText[i + 2])) shl 8 - +Ord(APrettyText[i + 1]); - - Result := Result+'\color{'+ColorToString(Color)+'}'; - - inc(i, 4); - end; - #3: - begin - if CharInSet(System.SysUtils.AnsiUpperCase(APrettyText[i + 1])[1], ['B', 'I', 'U']) then - begin - Result := Result + '\style{'; - - case APrettyText[i + 1] of - 'B': Result := Result + '+B'; - 'b': Result := Result + '-B'; - 'I': Result := Result + '+I'; - 'i': Result := Result + '-I'; - 'U': Result := Result + '+U'; - 'u': Result := Result + '-U'; - end; - - Result := Result + '}'; - end; - inc(i, 2); - end; - #9: - begin - Result := Result + '\column{}'; - if AlternateBoldStyle then - Result := Result + '\style{~B}'; - inc(i); - end; - else - Result := Result + APrettyText[i]; - inc(i); - end; -end; - - -// TProposalColumn - -constructor TProposalColumn.Create(Collection: TCollection); -begin - inherited; - FColumnWidth := 100; - FInternalWidth := -1; - FFontStyle := []; -end; - -destructor TProposalColumn.Destroy; -begin - inherited; -end; - -procedure TProposalColumn.Assign(Source: TPersistent); -begin - if Source is TProposalColumn then - begin - FColumnWidth := TProposalColumn(Source).FColumnWidth; - FInternalWidth := TProposalColumn(Source).FInternalWidth; - FFontStyle := TProposalColumn(Source).FFontStyle; - end - else - inherited Assign(Source); -end; - -procedure TProposalColumn.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -constructor TProposalColumns.Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); -begin - inherited Create(ItemClass); - FOwner := AOwner; -end; - -function TProposalColumns.GetOwner: TPersistent; -begin - Result := FOwner; -end; - -function TProposalColumns.GetItem(Index: Integer): TProposalColumn; -begin - Result := inherited GetItem(Index) as TProposalColumn; -end; - -procedure TProposalColumns.SetItem(Index: Integer; Value: TProposalColumn); -begin - inherited SetItem(Index, Value); -end; - -function TProposalColumns.Add: TProposalColumn; -begin - Result := inherited Add as TProposalColumn; -end; - -function TProposalColumns.FindItemID(ID: Integer): TProposalColumn; -begin - Result := inherited FindItemID(ID) as TProposalColumn; -end; - -function TProposalColumns.Insert(Index: Integer): TProposalColumn; -begin - Result := inherited Insert(Index) as TProposalColumn; -end; - - - -//============================================================================ - - -function FormatParamList(const S: string; CurrentIndex: Integer): string; -var - i: Integer; - List: TStrings; -begin - Result := ''; - List := TStringList.Create; - try - List.CommaText := S; - for i := 0 to List.Count - 1 do - begin - if i = CurrentIndex then - Result := Result + '\style{~B}' + List[i] + '\style{~B}' - else - Result := Result + List[i]; - - if i < List.Count - 1 then -// Result := Result + ', '; - Result := Result + ' '; - end; - finally - List.Free; - end; -end; - -{ TSynBaseCompletionProposalForm } - -constructor TSynBaseCompletionProposalForm.Create(AOwner: TComponent); -begin - CreateNew(AOwner); - Bitmap := TBitmap.Create; - TitleBitmap := TBitmap.Create; - FItemList := TStringList.Create; - FInsertList := TStringList.Create; - FAssignedList := TStringList.Create; - FMatchText := False; - BorderStyle := bsNone; - FScrollbar := TScrollBar.Create(Self); - FScrollbar.Kind := sbVertical; - FScrollbar.ParentCtl3D := False; - FScrollbar.OnChange := ScrollbarOnChange; - FScrollbar.OnScroll := ScrollbarOnScroll; - FScrollbar.OnEnter := ScrollbarOnEnter; - FScrollbar.Parent := Self; - - FTitleFont := TFont.Create; - FTitleFont.Name := 'MS Shell Dlg 2'; - FTitleFont.Size := 8; - FTitleFont.Style := [fsBold]; - FTitleFont.Color := clBtnText; - - FFont := TFont.Create; - FFont.Name := 'MS Shell Dlg 2'; - FFont.Size := 8; - - ClSelect := clHighlight; - ClSelectedText := clHighlightText; - ClBackground := clWindow; - ClTitleBackground := clBtnFace; - - - (FItemList as TStringList).OnChange := StringListChange; // Really necessary? It seems to work - FTitle := ''; // fine without it - FUseInsertList := False; - FFormattedText := False; - FCenterTitle := True; - FCase := False; - - FColumns := TProposalColumns.Create(AOwner, TProposalColumn); - - FItemHeight := 0; - FMargin := 2; - FEffectiveItemHeight := 0; - RecalcItemHeight; - - Canvas.Font.Assign(FTitleFont); - FTitleFontHeight := Canvas.TextHeight(TextHeightString); - FHeightBuffer := 0; - - FTitleFont.OnChange := TitleFontChange; - FFont.OnChange := FontChange; - - OnDblClick := DoDoubleClick; - OnShow := DoFormShow; - OnHide := DoFormHide; - - StyleElements := [seClient]; - Resizeable := False; - Visible := False; -end; - -procedure TSynBaseCompletionProposalForm.CreateParams(var Params: TCreateParams); -begin - inherited; - with Params do - begin - Style := WS_POPUP; - ExStyle := WS_EX_TOOLWINDOW; - - Params.WindowClass.style := Params.WindowClass.style or CS_DROPSHADOW; - - { - WS_THICKFRAME causes Windows 10 to display a 6 pixel title bar - Also with VCL Styles the window is not resizable - So we use WS_DLGFRAME (could instead use WS_SBORDER) - and make the window sizeable by handling WM_NCHITTEST - } - if DisplayType = ctCode then - //if FResizeable then - // Style := Style or WS_THICKFRAME - //else - Style := Style or WS_DLGFRAME; - end; -end; - -procedure TSynBaseCompletionProposalForm.Activate; -begin - Visible := True; - if (DisplayType = ctCode) and Assigned(CurrentEditor) then //KV - (CurrentEditor as TCustomSynEdit).AddFocusControl(Self); -end; - -procedure TSynBaseCompletionProposalForm.Deactivate; -begin - if (DisplayType = ctCode) and Assigned(CurrentEditor) then begin //KV - (CurrentEditor as TCustomSynEdit).RemoveFocusControl(Self); - Visible := False; - end; -end; - -destructor TSynBaseCompletionProposalForm.Destroy; -begin - inherited Destroy; - FColumns.Free; - Bitmap.Free; - TitleBitmap.Free; - FItemList.Free; - FInsertList.Free; - FAssignedList.Free; - FTitleFont.Free; - FFont.Free; -end; - -procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftState); -var - C: WideChar; - Cmd: TSynEditorCommand; - i: integer; - - procedure ExecuteCmdAndCancel; - begin - if Cmd <> ecNone then begin - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(Cmd, #0, nil); - - if Assigned(OnCancel) then - OnCancel(Self); - end; - end; -begin - if DisplayType = ctCode then - begin - i := (CurrentEditor as TCustomSynEdit).Keystrokes.FindKeycode(Key, Shift); - if i >= 0 then - Cmd := TCustomSynEdit(CurrentEditor).Keystrokes[i].Command - else - Cmd := ecNone; - case Key of - SYNEDIT_RETURN: - if (FCompleteWithEnter) and Assigned(OnValidate) then - OnValidate(Self, Shift, #0); - SYNEDIT_TAB: - if (FCompleteWithTab) and Assigned(OnValidate) then - OnValidate(Self, Shift, #0); - SYNEDIT_ESCAPE: - begin - if Assigned(OnCancel) then - OnCancel(Self); - end; - SYNEDIT_LEFT: - if (Shift = []) then - begin - if Length(FCurrentString) > 0 then - begin - CurrentString := Copy(CurrentString, 1, Length(CurrentString) - 1); - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecLeft, #0, nil); - end - else - begin - //Since we have control, we need to re-send the key to - //the editor so that the cursor behaves properly - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecLeft, #0, nil); - - if Assigned(OnCancel) then - OnCancel(Self); - end; - end else - ExecuteCmdAndCancel; - SYNEDIT_RIGHT: - if (Shift = []) then - begin - if Assigned(CurrentEditor) then - with CurrentEditor as TCustomSynEdit do - begin - if CaretX <= Length(LineText) then - C := LineText[CaretX] - else - C := #32; - - if Self.IsWordBreakChar(C) then - if Assigned(OnCancel) then - OnCancel(Self) - else - else - CurrentString := CurrentString + C; - - CommandProcessor(ecRight, #0, nil); - end; - end else - ExecuteCmdAndCancel; - SYNEDIT_PRIOR: - MoveLine(-FLinesInWindow); - SYNEDIT_NEXT: - MoveLine(FLinesInWindow); - SYNEDIT_END: - Position := FAssignedList.Count - 1; - SYNEDIT_HOME: - Position := 0; - SYNEDIT_UP: - if ssCtrl in Shift then - Position := 0 - else - MoveLine(-1); - SYNEDIT_DOWN: - if ssCtrl in Shift then - Position := FAssignedList.Count - 1 - else - MoveLine(1); - SYNEDIT_BACK: - if (Shift = []) then - begin - if Length(FCurrentString) > 0 then - begin - CurrentString := Copy(CurrentString, 1, Length(CurrentString) - 1); - - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteLastChar, #0, nil); - end - else - begin - //Since we have control, we need to re-send the key to - //the editor so that the cursor behaves properly - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteLastChar, #0, nil); - - if Assigned(OnCancel) then - OnCancel(Self); - end; - end else - ExecuteCmdAndCancel; - SYNEDIT_DELETE: - if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteChar, #0, nil); - else - ExecuteCmdAndCancel; - end; - end; - Invalidate; -end; - -procedure TSynBaseCompletionProposalForm.KeyPress(var Key: Char); -begin - if Key = #0 then Exit; - - if DisplayType = ctCode then - begin - case Key of - #13, #27:; // These keys are already handled by KeyDown - #32..High(WideChar): - begin - if IsWordBreakChar(Key) and Assigned(OnValidate) then - begin - //if Key = #32 then - // OnValidate(Self, [], #0) - //else - OnValidate(Self, [], Key); - end; - - CurrentString := CurrentString + Key; - - if Assigned(OnKeyPress) then - OnKeyPress(Self, Key); - end; - #8: - if Assigned(OnKeyPress) then - OnKeyPress(Self, Key); - else - with CurrentEditor as TCustomSynEdit do - CommandProcessor(ecChar, Key, nil); - - if Assigned(OnCancel) then - OnCancel(Self); - end; - end; - Invalidate; -end; - -procedure TSynBaseCompletionProposalForm.MouseDown(Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - y := (y - fHeightBuffer) div FEffectiveItemHeight; - Position := FScrollbar.Position + y; -// (CurrentEditor as TCustomSynEdit).UpdateCaret; -end; - -procedure TSynBaseCompletionProposalForm.Resize; -begin - inherited; - - if FEffectiveItemHeight <> 0 then - FLinesInWindow := (ClientHeight - FHeightBuffer) div FEffectiveItemHeight; - - if not(csCreating in ControlState) then - AdjustMetrics; - - AdjustScrollBarPosition; - Invalidate; -end; - -procedure TSynBaseCompletionProposalForm.Paint; - - procedure ResetCanvas; - begin - with Bitmap.Canvas do - begin - Pen.Color := StyleServices.GetSystemColor(FClBackGround); - Brush.Color := StyleServices.GetSystemColor(FClBackGround); - Font.Assign(FFont); - Font.Color := StyleServices.GetSystemColor(clWindowText); - end; - end; - -var - TmpRect: TRect; - TmpX: Integer; - AlreadyDrawn: Boolean; - TmpString: string; - i: Integer; - ScaledMargin: Integer; -begin - ScaledMargin := MulDiv((Owner as TSynBaseCompletionProposal).Margin, CurrentPPI, 96); - if FDisplayKind = ctCode then - begin - with Bitmap do - begin - ResetCanvas; - Canvas.Pen.Color := StyleServices.GetSystemColor(clBtnFace); - Canvas.Rectangle(0, 0, ClientWidth - FScrollbar.Width, ClientHeight); - for i := 0 to Min(FLinesInWindow - 1, FAssignedList.Count - 1) do - begin - if i + FScrollbar.Position = Position then - begin - Canvas.Brush.Color := StyleServices.GetSystemColor(FClSelect); - Canvas.Pen.Color := StyleServices.GetSystemColor(FClSelect); - Canvas.Rectangle(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, - FEffectiveItemHeight * (i + 1)); - Canvas.Pen.Color := StyleServices.GetSystemColor(fClSelectText); - Canvas.Font.Assign(FFont); - Canvas.Font.Color := StyleServices.GetSystemColor(FClSelectText); - end; - - AlreadyDrawn := False; - - if Assigned(OnPaintItem) then - OnPaintItem(Self, LogicalToPhysicalIndex(FScrollBar.Position + i), - Canvas, Rect(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, - FEffectiveItemHeight * (i + 1)), AlreadyDrawn); - - if AlreadyDrawn then - ResetCanvas - else - begin - if FFormattedText then - begin - FormattedTextOut(Canvas, Rect(ScaledMargin, - FEffectiveItemHeight * i + ((FEffectiveItemHeight - FFontHeight) div 2), - Bitmap.Width, FEffectiveItemHeight * (i + 1)), - CurrentPPI, FAssignedList[FScrollbar.Position + i], - (i + FScrollbar.Position = Position), FColumns, FImages); - end - else - begin - Canvas.TextOut(ScaledMargin, FEffectiveItemHeight * i, - FAssignedList[FScrollbar.Position + i]); - end; - - if i + FScrollbar.Position = Position then - ResetCanvas; - end; - end; - if TStyleManager.IsCustomStyleActive then - begin - TmpRect := ClientRect; - DrawStyleEdge(Canvas, TmpRect, [eeRaisedOuter], [efRect, efFlat]); - end; - end; - Canvas.Draw(0, FHeightBuffer, Bitmap); - - if FTitle <> '' then - begin - with TitleBitmap do - begin - Canvas.Brush.Color := StyleServices.GetSystemColor(FClTitleBackground); - TmpRect := Rect(0, 0, ClientWidth + 1, FHeightBuffer); //GBN - Canvas.FillRect(TmpRect); - Canvas.Pen.Color := StyleServices.GetSystemColor(clBtnShadow); - dec(TmpRect.Bottom, 1); - Canvas.PenPos := TmpRect.BottomRight; - Canvas.LineTo(TmpRect.Left - 1,TmpRect.Bottom); - Canvas.Pen.Color := StyleServices.GetSystemColor(clBtnFace); - - Canvas.Font.Assign(FTitleFont); - Canvas.Font.Color := StyleServices.GetSystemColor(FTitleFont.Color); - - if CenterTitle then - begin - TmpX := (Width - Canvas.TextWidth(Title)) div 2; - if TmpX < ScaledMargin then - TmpX := ScaledMargin; //We still want to be able to read it, even if it does go over the edge - end else - begin - TmpX := ScaledMargin; - end; - Canvas.TextRect(TmpRect, TmpX, ScaledMargin - 1, FTitle); // -1 because TmpRect.Top is already 1 - end; - Canvas.Draw(0, 0, TitleBitmap); - end; - end else - if (FDisplayKind = ctHint) or (FDisplayKind = ctParams) then - begin - with Bitmap do - begin - ResetCanvas; - tmpRect := Rect(0, 0, ClientWidth, ClientHeight); - Canvas.FillRect(tmpRect); - if StyleServices.IsSystemStyle then - Frame3D(Canvas, tmpRect, cl3DLight, cl3DDkShadow, 1); - - for i := 0 to FAssignedList.Count - 1 do - begin - AlreadyDrawn := False; - if Assigned(OnPaintItem) then - OnPaintItem(Self, i, Canvas, Rect(0, FEffectiveItemHeight * i + ScaledMargin, - ClientWidth, FEffectiveItemHeight * (i + 1) + ScaledMargin), AlreadyDrawn); - - if AlreadyDrawn then - ResetCanvas - else - begin - if (FDisplayKind = ctParams) then - TmpString := FormatParamList(FAssignedList[i], CurrentIndex) - else - TmpString := FAssignedList[i]; - - FormattedTextOut(Canvas, Rect(ScaledMargin + 1, - FEffectiveItemHeight * i + ((FEffectiveItemHeight-FFontHeight) div 2) + ScaledMargin, - Bitmap.Width - 1, FEffectiveItemHeight * (i + 1) + ScaledMargin), CurrentPPI, TmpString, - False, nil, FImages); - end; - end; - end; - Canvas.Draw(0, 0, Bitmap); - end; -end; - -procedure TSynBaseCompletionProposalForm.ScrollbarOnChange(Sender: TObject); -begin - if Position < FScrollbar.Position then - Position := FScrollbar.Position - else - if Position > FScrollbar.Position + FLinesInWindow - 1 then - Position := FScrollbar.Position + FLinesInWindow - 1 - else - Repaint; -end; - -procedure TSynBaseCompletionProposalForm.ScrollbarOnScroll(Sender: TObject; - ScrollCode: TScrollCode; var ScrollPos: Integer); -begin - with CurrentEditor as TCustomSynEdit do - begin - SetFocus; - //This tricks the caret into showing itself again. - AlwaysShowCaret := False; - AlwaysShowCaret := True; -// UpdateCaret; - end; -end; - -procedure TSynBaseCompletionProposalForm.ScrollbarOnEnter(Sender: TObject); -begin - ActiveControl := nil; -end; - -procedure TSynBaseCompletionProposalForm.MoveLine(cnt: Integer); -begin - if (cnt > 0) then begin - if (Position < (FAssignedList.Count - cnt)) then - Position := Position + cnt - else - Position := FAssignedList.Count - 1; - end else begin - if (Position + cnt) > 0 then - Position := Position + cnt - else - Position := 0; - end; -end; - -function TSynBaseCompletionProposalForm.LogicalToPhysicalIndex(Index: Integer): Integer; -begin - if FMatchText and (Index >= 0) and (Index < FAssignedList.Count) then - Result := Integer(FAssignedList.Objects[Index]) - else - Result := -1; -end; - -function TSynBaseCompletionProposalForm.PhysicalToLogicalIndex(Index: Integer): Integer; -var i : Integer; -begin - if FMatchText then - begin - Result := -1; - for i := 0 to FAssignedList.Count - 1 do - if Integer(FAssignedList.Objects[i]) = Index then - begin - Result := i; - break; - end; - end else - Result := Index; -end; - -procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: string); - - function MatchItem(AIndex: Integer; UseItemList: Boolean): Boolean; - var - CompareString: string; - begin -{ if UseInsertList then - CompareString := FInsertList[AIndex] - else - begin - CompareString := FItemList[AIndex]; - - if UsePrettyText then - CompareString := StripFormatCommands(CompareString); - end;} - - if UseInsertList then - CompareString := FInsertList[aIndex] - else - begin - if (FMatchText) and (not UseItemList) then - CompareString := FAssignedList[aIndex] - else - CompareString := FItemList[aIndex]; //GBN 29/08/2002 Fix for when match text is not active - - if UsePrettyText then - CompareString := StripFormatCommands(CompareString); - end; - - - CompareString := Copy(CompareString, 1, Length(Value)); - - if FCase then - Result := AnsiCompareStr(CompareString, Value) = 0 - else - Result := AnsiCompareText(CompareString, Value) = 0; - end; - - procedure RecalcList; - var - i: Integer; - begin - FAssignedList.Clear; - for i := 0 to FItemList.Count -1 do - begin - if MatchItem(i, True) then - FAssignedList.AddObject(FItemList[i], TObject(i)); - end; - end; - -var - i: Integer; -begin - FCurrentString := Value; - if DisplayType <> ctCode then - exit; - if FMatchText then - begin - RecalcList; - AdjustScrollBarPosition; - Position := 0; - - if Visible and Assigned(FOnChangePosition) and (DisplayType = ctCode) then - FOnChangePosition(Owner as TSynBaseCompletionProposal, - LogicalToPhysicalIndex(FPosition)); - - Repaint; - end - else - begin - i := 0; - while (i < ItemList.Count) and (not MatchItem(i, True)) do - inc(i); - - if i < ItemList.Count then - Position := i - else - Position := 0; - end; -end; - -procedure TSynBaseCompletionProposalForm.SetItemList(const Value: TStrings); -begin - FItemList.Assign(Value); - FAssignedList.Assign(Value); - CurrentString := CurrentString; -end; - -procedure TSynBaseCompletionProposalForm.SetInsertList(const Value: TStrings); -begin - FInsertList.Assign(Value); -end; - -procedure TSynBaseCompletionProposalForm.DoDoubleClick(Sender: TObject); -begin -//we need to do the same as the enter key; - if DisplayType = ctCode then - if Assigned(OnValidate) then OnValidate(Self, [], #0); //GBN 15/11/2001 -end; - -procedure TSynBaseCompletionProposalForm.SetPosition(const Value: Integer); -begin - if ((Value <= 0) and (FPosition = 0)) or (FPosition = Value) then - exit; - - if Value <= FAssignedList.Count - 1 then - begin - FPosition := Value; - if Position < FScrollbar.Position then - FScrollbar.Position := Position else - if FScrollbar.Position < (Position - FLinesInWindow + 1) then - FScrollbar.Position := Position - FLinesInWindow + 1; - - if Visible and Assigned(FOnChangePosition) and (DisplayType = ctCode) then - FOnChangePosition(Owner as TSynBaseCompletionProposal, - LogicalToPhysicalIndex(FPosition)); - - Repaint; - end; -end; - -procedure TSynBaseCompletionProposalForm.SetResizeable(const Value: Boolean); -begin - FResizeable := Value; - RecreateWnd; -end; - -procedure TSynBaseCompletionProposalForm.SetItemHeight(const Value: Integer); -begin - if Value <> FItemHeight then - begin - FItemHeight := Value; - RecalcItemHeight; - end; -end; - -procedure TSynBaseCompletionProposalForm.SetImages(const Value: TCustomImageList); -begin - if FImages <> Value then - begin - if Assigned(FImages) then - FImages.RemoveFreeNotification(Self); - - FImages := Value; - if Assigned(FImages) then - FImages.FreeNotification(Self); - end; -end; - -procedure TSynBaseCompletionProposalForm.RecalcItemHeight; -begin - Canvas.Font.Assign(FFont); - FFontHeight := Canvas.TextHeight(TextHeightString); - if FItemHeight > 0 then - FEffectiveItemHeight := FItemHeight - else - begin - FEffectiveItemHeight := FFontHeight; - end; -end; - -procedure TSynBaseCompletionProposalForm.StringListChange(Sender: TObject); -begin - FScrollbar.Position := Position; -end; - -function TSynBaseCompletionProposalForm.IsWordBreakChar(AChar: WideChar): Boolean; -begin - Result := (Owner as TSynBaseCompletionProposal).IsWordBreakChar(AChar); -end; - -procedure TSynBaseCompletionProposalForm.WMMouseWheel(var Msg: TMessage); -var - nDelta: integer; - nWheelClicks: integer; -begin - if csDesigning in ComponentState then exit; - - if GetKeyState(VK_CONTROL) >= 0 then nDelta := Mouse.WheelScrollLines - else nDelta := FLinesInWindow; - - Inc(fMouseWheelAccumulator, SmallInt(Msg.wParamHi)); - nWheelClicks := fMouseWheelAccumulator div WHEEL_DELTA; - fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DELTA; - if (nDelta = integer(WHEEL_PAGESCROLL)) or (nDelta > FLinesInWindow) then - nDelta := FLinesInWindow; - - Position := Position - (nDelta * nWheelClicks); -// (CurrentEditor as TCustomSynEdit).UpdateCaret; -end; - -procedure TSynBaseCompletionProposalForm.WMNCHitTest(var Message: TWMNCHitTest); -var - D: Integer; - P: TPoint; -begin - if not (FResizeable and (DisplayType = ctCode)) then - begin - inherited; - Exit; - end; - - D := GetSystemMetrics(SM_CXSIZEFRAME); - - P := Self.ScreenToClient(Message.Pos); - - if P.Y < D then - begin - if P.X < D then - Message.Result := HTTOPLEFT - else if P.X > ClientWidth - D then - Message.Result := HTTOPRIGHT - else - Message.Result := HTTOP; - end - else if P.Y > ClientHeight - D then - begin - if P.X < D then - Message.Result := HTBOTTOMLEFT - else if P.X > ClientWidth - D then - Message.Result := HTBOTTOMRIGHT - else - Message.Result := HTBOTTOM; - end - else - begin - if P.X < D then - Message.Result := HTLEFT - else if P.X > ClientWidth - D then - Message.Result := HTRIGHT - end; - - if Message.Result = 0 then - inherited; -end; - -function GetMDIParent (const Form: TSynForm): TSynForm; -{ Returns the parent of the specified MDI child form. But, if Form isn't a - MDI child, it simply returns Form. } -var - I, J: Integer; -begin - Result := Form; - if Form = nil then - exit; - if (Form is TSynForm) and - ((Form as TForm).FormStyle = fsMDIChild) then - for I := 0 to Screen.FormCount-1 do - with Screen.Forms[I] do - begin - if FormStyle <> fsMDIForm then Continue; - for J := 0 to MDIChildCount-1 do - if MDIChildren[J] = Form then - begin - Result := Screen.Forms[I]; - exit; - end; - end; -end; - -procedure TSynBaseCompletionProposalForm.WMActivate(var Message: TWMActivate); -var - ParentForm: TSynForm; -begin - if csDesigning in ComponentState then begin - inherited; - Exit; - end; - {Owner of the component that created me} - if Owner.Owner is TSynForm then - ParentForm := GetMDIParent(Owner.Owner as TSynForm) - else - ParentForm := nil; - - if Assigned(ParentForm) and ParentForm.HandleAllocated then - SendMessage(ParentForm.Handle, WM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0); -end; - -procedure TSynBaseCompletionProposalForm.DoFormHide(Sender: TObject); -begin - if CurrentEditor <> nil then - begin - (CurrentEditor as TCustomSynEdit).AlwaysShowCaret := OldShowCaret; -// (CurrentEditor as TCustomSynEdit).UpdateCaret; - if (Owner as TSynBaseCompletionProposal).FontsAreScaled then - begin - TitleFont.Height := MulDiv(TitleFont.Height, 96, CurrentEditor.CurrentPPI); - Font.Height := MulDiv(Font.Height, 96, CurrentEditor.CurrentPPI); - TSynBaseCompletionProposal(Owner).FontsAreScaled := False; - end; - if DisplayType = ctCode then - begin - // Save after removing the PPI scaling - (Owner as TSynBaseCompletionProposal).FWidth := MulDiv(ClientWidth, 96, CurrentPPI); - (Owner as TSynBaseCompletionProposal).FNbLinesInWindow := FLinesInWindow; - end; - end; - //GBN 28/08/2002 - if Assigned((Owner as TSynBaseCompletionProposal).OnClose) then - TSynBaseCompletionProposal(Owner).OnClose(Self); -end; - -procedure TSynBaseCompletionProposalForm.DoFormShow(Sender: TObject); -begin - if Assigned(CurrentEditor) then - begin - with CurrentEditor as TCustomSynEdit do - begin - OldShowCaret := AlwaysShowCaret; - AlwaysShowCaret := Focused; -// UpdateCaret; - end; - end; - //GBN 28/08/2002 - if Assigned((Owner as TSynBaseCompletionProposal).OnShow) then - (Owner as TSynBaseCompletionProposal).OnShow(Self); -end; - -procedure TSynBaseCompletionProposalForm.WMEraseBackgrnd( - var Message: TMessage); -begin - Message.Result:=1; -end; - -//GBN 24/02/2002 -procedure TSynBaseCompletionProposalForm.WMGetDlgCode(var Message: TWMGetDlgCode); -begin - inherited; - Message.Result := Message.Result or DLGC_WANTTAB; -end; - -procedure TSynBaseCompletionProposalForm.AdjustMetrics; -begin - if DisplayType = ctCode then - begin - if FTitle <> '' then - FHeightBuffer := FTitleFontHeight + MulDiv(2 * FMargin, CurrentPPI, 96) - else - FHeightBuffer := 0; - - if (ClientWidth >= FScrollbar.Width) and (ClientHeight >= FHeightBuffer) then - Bitmap.SetSize(ClientWidth - FScrollbar.Width, ClientHeight - FHeightBuffer); - - if (ClientWidth > 0) and (FHeightBuffer > 0) then - TitleBitmap.SetSize(ClientWidth, FHeightBuffer); - end else - begin - if (ClientWidth > 0) and (ClientHeight > 0) then - Bitmap.SetSize(ClientWidth, ClientHeight); - end; -end; - -procedure TSynBaseCompletionProposalForm.AdjustScrollBarPosition; -begin - if FDisplayKind = ctCode then - begin - if Assigned(FScrollbar) then - begin - FScrollbar.Top := FHeightBuffer; - FScrollbar.Height := ClientHeight - FHeightBuffer; - FScrollbar.Left := ClientWidth - FScrollbar.Width; - - if FAssignedList.Count - FLinesInWindow < 0 then - begin - FScrollbar.PageSize := 0; - FScrollbar.Max := 0; - FScrollbar.Enabled := False; - end else - begin - FScrollbar.PageSize := 0; - FScrollbar.Max := FAssignedList.Count - FLinesInWindow; - if FScrollbar.Max <> 0 then - begin - FScrollbar.LargeChange := FLinesInWindow; - FScrollbar.PageSize := 1; - FScrollbar.Enabled := True; - end else - FScrollbar.Enabled := False; - end; - end; - end; -end; - -procedure TSynBaseCompletionProposalForm.SetTitle(const Value: string); -begin - FTitle := Value; - AdjustMetrics; -end; - -procedure TSynBaseCompletionProposalForm.SetFont(const Value: TFont); -begin - FFont.Assign(Value); - RecalcItemHeight; - AdjustMetrics; -end; - -procedure TSynBaseCompletionProposalForm.SetTitleFont(const Value: TFont); -begin - FTitleFont.Assign(Value); - FTitleFontHeight := Canvas.TextHeight(TextHeightString); - AdjustMetrics; -end; - -procedure TSynBaseCompletionProposalForm.SetColumns(Value: TProposalColumns); -begin - FColumns.Assign(Value); -end; - - -procedure TSynBaseCompletionProposalForm.TitleFontChange(Sender: TObject); -begin - Canvas.Font.Assign(FTitleFont); - FTitleFontHeight := Canvas.TextHeight(TextHeightString); - AdjustMetrics; -end; - -procedure TSynBaseCompletionProposalForm.FontChange(Sender: TObject); -begin - RecalcItemHeight; - AdjustMetrics; -end; - -function TSynBaseCompletionProposalForm.GetCurrentPPI: Integer; -begin - if Assigned(FCurrentEditor) then - Result := FCurrentEditor.CurrentPPI - else - Result := Screen.PixelsPerInch; -end; - -procedure TSynBaseCompletionProposalForm.Notification(AComponent: TComponent; - Operation: TOperation); -begin - if (Operation = opRemove) then - begin - if AComponent = FImages then - Images := nil; - end; - - inherited Notification(AComponent, Operation); -end; - - -{ TSynBaseCompletionProposal } - -constructor TSynBaseCompletionProposal.Create(AOwner: TComponent); -begin - FWidth := 260; - FNbLinesInWindow := 8; - inherited Create(AOwner); - FForm := TSynBaseCompletionProposalForm.Create(Self); - EndOfTokenChr := DefaultEndOfTokenChr; - FDotOffset := 0; - DefaultType := ctCode; -end; - -procedure TSynBaseCompletionProposal.Execute(s: string; x, y: integer); -begin - ExecuteEx(s, x, y, DefaultType); -end; - -procedure TSynBaseCompletionProposal.ExecuteEx(s: string; x, y: integer; Kind : SynCompletionType); -Var - WorkArea : TRect; - Monitor: TMonitor; - - function GetWorkAreaWidth: Integer; - begin - Result := WorkArea.Right; - end; - - function GetWorkAreaHeight: Integer; - begin - Result := WorkArea.Bottom; - end; - - function GetParamWidth(const S: string): Integer; - var - i: Integer; - List: TStringList; - NewWidth: Integer; - begin - List := TStringList.Create; - try - List.CommaText := S; - - Result := 0; - for i := -1 to List.Count -1 do - begin - NewWidth := FormattedTextWidth(Form.Canvas, - FormatParamList(S, i), Form.CurrentPPI, Columns, FForm.Images); - - if NewWidth > Result then - Result := NewWidth; - end; - finally - List.Free; - end; - end; - - procedure RecalcFormPlacement; - var - i: Integer; - tmpWidth: Integer; - tmpHeight: Integer; - tmpX: Integer; - tmpY: Integer; - tmpStr: string; - NewWidth: Integer; - ScaledMargin: Integer; - ActivePPI: integer; - begin - if Assigned(FForm.CurrentEditor) then - ActivePPI := FForm.CurrentEditor.CurrentPPI - else - ActivePPI := 96; - ScaledMargin := MulDiv(Form.Margin, ActivePPI, 96); - if not FFontsAreScaled then - begin - TitleFont.Height := MulDiv(TitleFont.Height, ActivePPI, 96); - Font.Height := MulDiv(Font.Height, ActivePPI, 96); - FFontsAreScaled := True; - end; - - tmpX := x; - tmpY := Y + 2; - tmpWidth := 0; - tmpHeight := 0; - case Kind of - ctCode: - begin - tmpWidth := MulDiv(FWidth, ActivePPI, 96); - tmpHeight := Form.FHeightBuffer + Form.FEffectiveItemHeight * FNbLinesInWindow; - end; - ctHint: - begin - tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + 2 * ScaledMargin; - - Form.Canvas.Font.Assign(Font); - for i := 0 to ItemList.Count -1 do - begin - tmpStr := ItemList[i]; - NewWidth := FormattedTextWidth(Form.Canvas, tmpStr, - Form.CurrentPPI, nil, FForm.Images); - if NewWidth > tmpWidth then - tmpWidth := NewWidth; - end; - - inc(tmpWidth, 2 * ScaledMargin); - end; - ctParams: - begin - tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + 2 * ScaledMargin; - - Form.Canvas.Font.Assign(Font); - for i := 0 to ItemList.Count -1 do - begin - NewWidth := GetParamWidth(StripFormatCommands(ItemList[i])); - - if Assigned(Form.OnMeasureItem) then - Form.OnMeasureItem(Self, i, Form.Canvas, NewWidth); - - if NewWidth > tmpWidth then - tmpWidth := NewWidth; - end; - - inc(tmpWidth, 2 * ScaledMargin); - end; - end; - - if tmpX + tmpWidth > GetWorkAreaWidth then - begin - tmpX := GetWorkAreaWidth - tmpWidth - MulDiv(5, FForm.CurrentPPI, 96); //small space buffer - if tmpX < 0 then - tmpX := 0; - end; - - if tmpY + tmpHeight > GetWorkAreaHeight then - begin - tmpY := tmpY - tmpHeight - (Form.CurrentEditor as TCustomSynEdit).LineHeight - - MulDiv(4, FForm.CurrentPPI, 96); - if tmpY < 0 then - tmpY := 0; - end; - - Form.ClientWidth := tmpWidth; - Form.ClientHeight := tmpHeight; - Form.SetBounds(tmpX, tmpY, Form.Width, Form.Height) - end; - -var - TmpOffset: Integer; -begin - Monitor := Screen.MonitorFromPoint(Point(x, y)); - WorkArea := Monitor.WorkareaRect; - - DisplayType := Kind; - - FCanExecute := True; - if Assigned(OnExecute) then - OnExecute(Kind, Self, s, x, y, FCanExecute); - - if (not FCanExecute) or (ItemList.Count = 0) then - begin - if Form.Visible and (Kind = ctParams) then - Form.Visible := False; - exit; - end; - - Form.PopupMode := pmExplicit; - if (Kind = ctCode) then Form.FormStyle := fsStayOnTop; - - if Assigned(Form.CurrentEditor) then - begin - TmpOffset := (Form.CurrentEditor as TCustomSynEdit).Canvas.TextWidth(Copy(s, 1, DotOffset)); - if DotOffset > 1 then - TmpOffset := TmpOffset + (3 * (DotOffset -1)); - Form.PopupParent := GetParentForm(Form.CurrentEditor); - end else - TmpOffset := 0; - x := x - tmpOffset; - - ResetAssignedList; - - case Kind of - ctCode: - if Form.AssignedList.Count > 0 then - begin - //This may seem redundant, but it fixes scrolling bugs for the first time - //That is the only time these occur - Position := 0; - Form.AdjustScrollBarPosition; - Form.FScrollbar.Position := Form.Position; - Form.FScrollbar.Visible := True; - - RecalcFormPlacement; - Form.Show; - - CurrentString := s; // bug id 1496148 - end; - ctParams, ctHint: - begin - Form.FScrollbar.Visible := False; - - RecalcFormPlacement; - - //ShowWindow(Form.Handle, SW_SHOWNOACTIVATE); - ShowWindow(Form.Handle, SW_SHOWNA); - Form.Visible := True; - Form.Repaint; - end; - end; -end; - -function TSynBaseCompletionProposal.GetCurrentString: string; -begin - Result := Form.CurrentString; -end; - -function TSynBaseCompletionProposal.GetItemList: TStrings; -begin - Result := Form.ItemList; -end; - -function TSynBaseCompletionProposal.GetInsertList: TStrings; -begin - Result := Form.InsertList; -end; - -function TSynBaseCompletionProposal.GetOnCancel: TNotifyEvent; -begin - Result := Form.OnCancel; -end; - -function TSynBaseCompletionProposal.GetOnKeyPress: TKeyPressEvent; -begin - Result := Form.OnKeyPress; -end; - -function TSynBaseCompletionProposal.GetOnPaintItem: TSynBaseCompletionProposalPaintItem; -begin - Result := Form.OnPaintItem; -end; - -function TSynBaseCompletionProposal.GetOnMeasureItem: TSynBaseCompletionProposalMeasureItem; -begin - Result := Form.OnMeasureItem; -end; - -function TSynBaseCompletionProposal.GetOnValidate: TValidateEvent; -begin - Result := Form.OnValidate; -end; - -function TSynBaseCompletionProposal.GetPosition: Integer; -begin - Result := Form.Position; -end; - -procedure TSynBaseCompletionProposal.SetCurrentString(const Value: string); -begin - Form.CurrentString := Value; -end; - -procedure TSynBaseCompletionProposal.SetItemList(const Value: TStrings); -begin - Form.ItemList := Value; -end; - -procedure TSynBaseCompletionProposal.SetInsertList(const Value: TStrings); -begin - Form.InsertList := Value; -end; - -procedure TSynBaseCompletionProposal.SetNbLinesInWindow(const Value: Integer); -begin - FNbLinesInWindow := Value; -end; - -procedure TSynBaseCompletionProposal.SetOnCancel(const Value: TNotifyEvent); -begin - Form.OnCancel := Value; -end; - -procedure TSynBaseCompletionProposal.SetOnKeyPress(const Value: TKeyPressEvent); -begin - Form.OnKeyPress := Value; -end; - -procedure TSynBaseCompletionProposal.SetOnPaintItem(const Value: - TSynBaseCompletionProposalPaintItem); -begin - Form.OnPaintItem := Value; -end; - -procedure TSynBaseCompletionProposal.SetOnMeasureItem(const Value: - TSynBaseCompletionProposalMeasureItem); -begin - Form.OnMeasureItem := Value; -end; - - -procedure TSynBaseCompletionProposal.SetPosition(const Value: Integer); -begin - form.Position := Value; -end; - -procedure TSynBaseCompletionProposal.SetOnValidate(const Value: TValidateEvent); -begin - form.OnValidate := Value; -end; - -function TSynBaseCompletionProposal.GetClSelect: TColor; -begin - Result := Form.ClSelect; -end; - -procedure TSynBaseCompletionProposal.SetClSelect(const Value: TColor); -begin - Form.ClSelect := Value; -end; - -procedure TSynBaseCompletionProposal.SetWidth(Value: Integer); -begin - FWidth := Value; -end; - -procedure TSynBaseCompletionProposal.Activate; -begin - if Assigned(Form) then - Form.Activate; -end; - -procedure TSynBaseCompletionProposal.Deactivate; -begin - if Assigned(Form) then - Form.Deactivate; -end; - -procedure TSynBaseCompletionProposal.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -function TSynBaseCompletionProposal.GetClBack: TColor; -begin - Result := Form.ClBackground; -end; - -procedure TSynBaseCompletionProposal.SetClBack(const Value: TColor); -begin - Form.ClBackground := Value -end; - -function TSynBaseCompletionProposal.GetClSelectedText: TColor; -begin - Result := Form.ClSelectedText; -end; - -procedure TSynBaseCompletionProposal.SetClSelectedText(const Value: TColor); -begin - Form.ClSelectedText := Value; -end; - -procedure TSynBaseCompletionProposal.AddItem(ADisplayText, AInsertText: string); -begin - GetInsertList.Add(AInsertText); - GetItemList.Add(ADisplayText); -end; - -procedure TSynBaseCompletionProposal.AddItemAt(Where: Integer; ADisplayText, AInsertText: string); -begin - try - GetInsertList.Insert(Where, AInsertText); - GetItemList.Insert(Where, ADisplayText); - except - raise Exception.Create('Cannot insert item at position ' + IntToStr(Where) + '.'); - end; -end; - -procedure TSynBaseCompletionProposal.ClearList; -begin - GetInsertList.Clear; - GetItemList.Clear; -end; - -function TSynBaseCompletionProposal.DisplayItem(AIndex : Integer): string; -begin - Result := GetItemList[AIndex]; -end; - -function TSynBaseCompletionProposal.InsertItem(AIndex : Integer): string; -begin - Result := GetInsertList[AIndex]; -end; - -function TSynBaseCompletionProposal.IsWordBreakChar(AChar: WideChar): Boolean; -begin - Result := False; - if (scoConsiderWordBreakChars in Options) and Assigned(Form) and - Assigned(Form.CurrentEditor) - then - Result := Form.CurrentEditor.IsWordBreakChar(AChar); - Result := Result or (Pos(AChar, EndOfTokenChr) > 0); -end; - -function TSynBaseCompletionProposal.GetDisplayKind: SynCompletionType; -begin - Result := Form.DisplayType; -end; - -procedure TSynBaseCompletionProposal.SetDisplayKind(const Value: SynCompletionType); -begin - Form.DisplayType := Value; -end; - -function TSynBaseCompletionProposal.GetParameterToken: TCompletionParameter; -begin - Result := Form.OnParameterToken; -end; - -procedure TSynBaseCompletionProposal.SetParameterToken( - const Value: TCompletionParameter); -begin - Form.OnParameterToken := Value; -end; - -procedure TSynBaseCompletionProposal.SetColumns(const Value: TProposalColumns); -begin - FForm.Columns := Value; -end; - -function TSynBaseCompletionProposal.GetColumns: TProposalColumns; -begin - Result := FForm.Columns; -end; - -function TSynBaseCompletionProposal.GetResizeable: Boolean; -begin - Result := FForm.Resizeable; -end; - -procedure TSynBaseCompletionProposal.SetResizeable(const Value: Boolean); -begin - if FForm.Resizeable <> Value then - FForm.Resizeable := Value; -end; - -function TSynBaseCompletionProposal.GetItemHeight: Integer; -begin - Result := FForm.ItemHeight; -end; - -procedure TSynBaseCompletionProposal.SetItemHeight(const Value: Integer); -begin - if FForm.ItemHeight <> Value then - FForm.ItemHeight := Value; -end; - -procedure TSynBaseCompletionProposal.SetImages(const Value: TCustomImageList); -begin - FForm.Images := Value; -end; - -function TSynBaseCompletionProposal.GetImages: TCustomImageList; -begin - Result := FForm.Images; -end; - -function TSynBaseCompletionProposal.GetMargin: Integer; -begin - Result := FForm.Margin; -end; - -procedure TSynBaseCompletionProposal.SetMargin(const Value: Integer); -begin - if Value <> FForm.Margin then - FForm.Margin := Value; -end; - -function TSynBaseCompletionProposal.GetDefaultKind: SynCompletionType; -begin - Result := Form.DefaultType; -end; - -procedure TSynBaseCompletionProposal.SetDefaultKind(const Value: SynCompletionType); -begin - Form.DefaultType := Value; - Form.DisplayType := Value; - Form.RecreateWnd; -end; - -procedure TSynBaseCompletionProposal.SetEndOfTokenChar( - const Value: string); -begin - if Form.FEndOfTokenChr <> Value then - begin - Form.FEndOfTokenChr := Value; - end; -end; - -function TSynBaseCompletionProposal.GetClTitleBackground: TColor; -begin - Result := Form.ClTitleBackground; -end; - -procedure TSynBaseCompletionProposal.SetClTitleBackground( - const Value: TColor); -begin - Form.ClTitleBackground := Value; -end; - -function TSynBaseCompletionProposal.GetTitle: string; -begin - Result := Form.Title; -end; - -procedure TSynBaseCompletionProposal.SetTitle(const Value: string); -begin - Form.Title := Value; -end; - -function TSynBaseCompletionProposal.GetFont: TFont; -begin - Result := Form.Font; -end; - -function TSynBaseCompletionProposal.GetTitleFont: TFont; -begin - Result := Form.TitleFont; -end; - -procedure TSynBaseCompletionProposal.SetFont(const Value: TFont); -begin - Form.Font := Value; -end; - -procedure TSynBaseCompletionProposal.SetTitleFont(const Value: TFont); -begin - Form.TitleFont := Value; -end; - -function TSynBaseCompletionProposal.GetEndOfTokenChar: string; -begin - Result := Form.EndOfTokenChr; -end; - -function TSynBaseCompletionProposal.GetOptions: TSynCompletionOptions; -begin - Result := fOptions; -end; - -procedure TSynBaseCompletionProposal.SetOptions( - const Value: TSynCompletionOptions); -begin - if fOptions <> Value then - begin - fOptions := Value; - Form.CenterTitle := scoTitleIsCentered in Value; - Form.CaseSensitive := scoCaseSensitive in Value; - Form.UsePrettyText := scoUsePrettyText in Value; - Form.UseInsertList := scoUseInsertList in Value; - Form.MatchText := scoLimitToMatchedText in Value; - Form.CompleteWithTab := scoCompleteWithTab in Value; - Form.CompleteWithEnter := scoCompleteWithEnter in Value; - end; -end; - -function TSynBaseCompletionProposal.GetTriggerChars: string; -begin - Result := Form.TriggerChars; -end; - -procedure TSynBaseCompletionProposal.SetTriggerChars(const Value: string); -begin - Form.TriggerChars := Value; -end; - -procedure TSynBaseCompletionProposal.EditorCancelMode(Sender: TObject); -begin - //Do nothing here, used in TSynCompletionProposal -end; - -procedure TSynBaseCompletionProposal.HookedEditorCommand(Sender: TObject; - AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; - var AChar: WideChar; Data, HandlerData: Pointer); -begin - // Do nothing here, used in TSynCompletionProposal -end; - -function TSynBaseCompletionProposal.GetOnChange: TCompletionChange; -begin - Result := Form.FOnChangePosition; -end; - -procedure TSynBaseCompletionProposal.SetOnChange( - const Value: TCompletionChange); -begin - Form.FOnChangePosition := Value; -end; - -procedure TSynBaseCompletionProposal.ResetAssignedList; -begin - Form.AssignedList.Assign(ItemList); -end; - -{ ---------------- TSynCompletionProposal -------------- } - -procedure TSynCompletionProposal.HandleOnCancel(Sender: TObject); -var - F: TSynBaseCompletionProposalForm; - CurrentEditor : TCustomSynedit; -begin - F := Sender as TSynBaseCompletionProposalForm; - FNoNextKey := False; - CurrentEditor := F.CurrentEditor; - if CurrentEditor <> nil then - begin - if Assigned(FTimer) then - FTimer.Enabled := False; - - F.Hide; - - if ((CurrentEditor as TCustomSynEdit).Owner is TWinControl) and - (((CurrentEditor as TCustomSynEdit).Owner as TWinControl).Visible) then - begin - ((CurrentEditor as TCustomSynEdit).Owner as TWinControl).SetFocus; - end; - - if (CurrentEditor as TCustomSynEdit).CanFocus then - (CurrentEditor as TCustomSynEdit).SetFocus; - - if Assigned(OnCancelled) then - OnCancelled(Self); - end; -end; - -procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; - Shift: TShiftState; EndToken: WideChar); -var - F: TSynBaseCompletionProposalForm; - Value: string; - Index: Integer; -begin - F := Sender as TSynBaseCompletionProposalForm; - if Assigned(F.CurrentEditor) then - with F.CurrentEditor as TCustomSynEdit do - begin - //Treat entire completion as a single undo operation - BeginUpdate; - BeginUndoBlock; - try - if FAdjustCompletionStart then - FCompletionStart := BufferCoord(FCompletionStart, CaretY).Char; - BlockBegin := BufferCoord(FCompletionStart, CaretY); - if (scoEndCharCompletion in fOptions) or (EndToken = #0) then - BlockEnd := BufferCoord(WordEnd.Char, CaretY) - else - BlockEnd := BufferCoord(CaretX, CaretY); - - if scoUseInsertList in FOptions then - begin - if scoLimitToMatchedText in FOptions then - begin - if (Form.FAssignedList.Count > Position) then - // Added check to make sure item is only used when no EndChar - if (InsertList.Count > Integer(Form.FAssignedList.Objects[position])) and - ((scoEndCharCompletion in fOptions) or (EndToken = #0)) then - Value := InsertList[Integer(Form.FAssignedList.Objects[position])] - else - Value := SelText - else - Value := SelText; - end else - begin - // Added check to make sure item is only used when no EndChar - if (InsertList.Count > Position) and - ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then - Value := InsertList[position] - else - Value := SelText; - end; - end else - begin - // Added check to make sure item is only used when no EndChar - if (Form.FAssignedList.Count > Position) and - ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then - Value := Form.FAssignedList[Position] - else - Value := SelText; - end; - Index := Position; // Need to assign position to temp var since it changes later - - if Assigned(FOnCodeCompletion) then - FOnCodeCompletion(Self, Value, Shift, - F.LogicalToPhysicalIndex(Index), EndToken); //GBN 15/11/2001 - - if SelText <> Value then - SelText := Value; - - with (F.CurrentEditor as TCustomSynEdit) do - begin - //This replaces the previous way of cancelling the completion by - //sending a WM_MOUSEDOWN message. The problem with the mouse down is - //that the editor would bounce back to the left margin, very irritating - InternalCancelCompletion; - if CanFocus then - SetFocus; - EnsureCursorPosVisible; - CaretXY := BlockEnd; - BlockBegin := CaretXY; - end; - if Assigned(FOnAfterCodeCompletion) then - FOnAfterCodeCompletion(Self, Value, Shift, - F.LogicalToPhysicalIndex(Index), EndToken); - - finally - EndUndoBlock; - EndUpdate; - end; - end; -end; - -procedure TSynCompletionProposal.HandleOnKeyPress(Sender: TObject; var Key: WideChar); -var - F: TSynBaseCompletionProposalForm; -begin - F := Sender as TSynBaseCompletionProposalForm; - if F.CurrentEditor <> nil then - begin - with F.CurrentEditor as TCustomSynEdit do - CommandProcessor(ecChar, Key, nil); - //Daisy chain completions - Application.ProcessMessages; - if (System.Pos(Key, TriggerChars) > 0) and not F.Visible then - begin - if (Sender is TCustomSynEdit) then - DoExecute(Sender as TCustomSynEdit) - else - if Assigned(Form.CurrentEditor) then - DoExecute(Form.CurrentEditor as TCustomSynEdit); - end; - end; -end; - -procedure TSynCompletionProposal.SetEditor(const Value: TCustomSynEdit); -begin - if Editor <> Value then - begin - if Assigned(Editor) then - RemoveEditor(Editor); - FEditor := Value; - if Assigned(Value) then - AddEditor(Value); - end; -end; - -procedure TSynCompletionProposal.Notification(AComponent: TComponent; - Operation: TOperation); -begin - if (Operation = opRemove) then - begin - if Editor = AComponent then - Editor := nil - else if AComponent is TCustomSynEdit then - RemoveEditor(TCustomSynEdit(AComponent)); - end; - - inherited Notification(AComponent, Operation); -end; - -constructor TSynCompletionProposal.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - Form.OnKeyPress := HandleOnKeyPress; - Form.OnValidate := HandleOnValidate; - Form.OnCancel := HandleOnCancel; - Form.OnDblClick := HandleDblClick; - EndOfTokenChr := DefaultEndOfTokenChr; - TriggerChars := '.'; - fTimerInterval:= 1000; - fNoNextKey := False; - - fShortCut := Vcl.Menus.ShortCut(Ord(' '), [ssCtrl]); - Options := DefaultProposalOptions; - fEditors := TList.Create; -end; - -procedure TSynCompletionProposal.SetShortCut(Value: TShortCut); -begin - FShortCut := Value; -end; - -procedure TSynCompletionProposal.EditorKeyDown(Sender: TObject; - var Key: Word; Shift: TShiftState); -var - ShortCutKey: Word; - ShortCutShift: TShiftState; -begin - ShortCutToKey (fShortCut,ShortCutKey,ShortCutShift); - with Sender as TCustomSynEdit do - begin - if ((DefaultType <> ctCode) or not(ReadOnly)) and (Shift = ShortCutShift) and (Key = ShortCutKey) then - begin - Form.CurrentEditor := Sender as TCustomSynEdit; - Key := 0; - DoExecute(Sender as TCustomSynEdit); - end; - end; -end; - -function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): string; -var - s: string; - i: integer; -begin - Result := ''; - if AEditor <> nil then - begin - s := AEditor.LineText; - i := AEditor.CaretX - 1; - if i <= Length(s) then - begin - FAdjustCompletionStart := False; - while (i > 0) and (s[i] > #32) and not Self.IsWordBreakChar(s[i]) do - dec(i); - - FCompletionStart := i + 1; - Result := Copy(s, i + 1, AEditor.CaretX - i - 1); - end - else - FAdjustCompletionStart := True; - - FCompletionStart := i + 1; - end; -end; - -function TSynCompletionProposal.GetPreviousToken(AEditor: TCustomSynEdit): string; -var - Line: string; - X: Integer; -begin - Result := ''; - if not Assigned(AEditor) then - exit; - - Line := AEditor.Lines[AEditor.CaretXY.Line - 1]; - X := AEditor.CaretXY.Char - 1; - if (X = 0) or (X > Length(Line)) or (Length(Line) = 0) then - exit; - - if Self.IsWordBreakChar(Line[X]) then - dec(X); - - while (X > 0) and not(Self.IsWordBreakChar(Line[X])) do - begin - Result := Line[X] + Result; - dec(x); - end; -end; - -procedure TSynCompletionProposal.EditorKeyPress(Sender: TObject; var Key: WideChar); -begin - if fNoNextKey then - begin - FNoNextKey := False; - Key := #0; - end - else - if Assigned(FTimer) then - begin - DeactivateTimer; - if Pos(Key, TriggerChars) <> 0 then - ActivateTimer(Sender as TCustomSynEdit); - - end; -end; - -procedure TSynCompletionProposal.ActivateTimer(ACurrentEditor: TCustomSynEdit); -begin - if Assigned(FTimer) then - begin - Form.CurrentEditor := ACurrentEditor; - FTimer.Enabled := True; - end; -end; - -procedure TSynCompletionProposal.DeactivateTimer; -begin - if Assigned(FTimer) then - begin - FTimer.Enabled := False; - end; -end; - - -procedure TSynCompletionProposal.HandleDblClick(Sender: TObject); -begin - HandleOnValidate(Sender, [], #0); -end; - -destructor TSynCompletionProposal.Destroy; -begin - if Form.Visible then - CancelCompletion; - Editor := nil; - while fEditors.Count <> 0 do - RemoveEditor(TCustomSynEdit(FEditors.Last)); - - inherited; - - fEditors.Free; -end; - -procedure TSynCompletionProposal.TimerExecute(Sender: TObject); -begin - if not Assigned(FTimer) then exit; - FTimer.Enabled := False; - if Application.Active then - begin - DoExecute(Form.CurrentEditor as TCustomSynEdit); - FNoNextKey := False; - end else if Form.Visible then begin - Form.Hide; - Form.PopupParent := nil; - end; -end; - -function TSynCompletionProposal.GetTimerInterval: Integer; -begin - Result := FTimerInterval; -end; - -procedure TSynCompletionProposal.SetTimerInterval(const Value: Integer); -begin - FTimerInterval := Value; - if Assigned(FTimer) then - FTimer.Interval := Value; -end; - -procedure TSynCompletionProposal.SetOptions(const Value: TSynCompletionOptions); -begin - inherited; - - if scoUseBuiltInTimer in Value then - begin - if not(Assigned(FTimer)) then - begin - FTimer := TTimer.Create(Self); - FTimer.Enabled := False; - FTimer.Interval := FTimerInterval; - FTimer.OnTimer := TimerExecute; - end; - end else begin - if Assigned(FTimer) then - begin - FreeAndNil(FTimer); - end; - end; - -end; - -procedure TSynCompletionProposal.ExecuteEx(s: string; x, y: integer; - Kind: SynCompletionType); -begin - inherited; - if Assigned(FTimer) then - FTimer.Enabled := False; -end; - -procedure TSynCompletionProposal.AddEditor(AEditor: TCustomSynEdit); -var - i : integer; -begin - i := fEditors.IndexOf(AEditor); - if i = -1 then begin - AEditor.FreeNotification(Self); - fEditors.Add(AEditor); - AEditor.AddKeyDownHandler(EditorKeyDown); - AEditor.AddKeyPressHandler(EditorKeyPress); - AEditor.RegisterCommandHandler(HookedEditorCommand, Self); - end; -end; - -function TSynCompletionProposal.EditorsCount: integer; -begin - result := fEditors.count; -end; - -function TSynCompletionProposal.GetEditor(i: integer): TCustomSynEdit; -begin - if (i < 0) or (i >= EditorsCount) then - Result := nil - else - Result := fEditors[i]; -end; - -function TSynCompletionProposal.RemoveEditor(AEditor: TCustomSynEdit): boolean; -var - i: integer; -begin - i := fEditors.Remove(AEditor); - result := i <> -1; - if result then begin - if Form.CurrentEditor = AEditor then - begin - if Form.Visible then - CancelCompletion; - Form.CurrentEditor := nil; - end; - AEditor.RemoveKeyDownHandler(EditorKeyDown); - AEditor.RemoveKeyPressHandler(EditorKeyPress); - AEditor.UnregisterCommandHandler(HookedEditorCommand); - RemoveFreeNotification( AEditor ); - if fEditor = AEditor then - fEditor := nil; - end; -end; - -procedure TSynCompletionProposal.DoExecute(AEditor: TCustomSynEdit); -var - p: TPoint; - i: integer; -begin - i := FEditors.IndexOf(AEditor); - if i <> -1 then - with AEditor do - begin - if (DefaultType <> ctCode) or not ReadOnly then - begin - if DefaultType = ctHint then - GetCursorPos(P) - else - begin - p := ClientToScreen(RowColumnToPixels(DisplayXY)); - Inc(p.y, LineHeight); - end; - - Form.CurrentEditor := AEditor; - - FPreviousToken := GetPreviousToken(Form.CurrentEditor as TCustomSynEdit); - ExecuteEx(GetCurrentInput(AEditor), p.x, p.y, DefaultType); - FNoNextKey := (DefaultType = ctCode) and FCanExecute and Form.Visible; - end; - end; -end; - -procedure TSynCompletionProposal.InternalCancelCompletion; -begin - if Assigned(FTimer) then FTimer.Enabled := False; - FNoNextKey := False; - if (Form.Visible) then - begin - Deactivate; - Form.Hide; - Form.PopupParent := nil; - end; -end; - -procedure TSynCompletionProposal.CancelCompletion; -begin - InternalCancelCompletion; - if Assigned(OnCancelled) then OnCancelled(Self); -end; - -procedure TSynCompletionProposal.EditorCancelMode(Sender: TObject); -begin - if (DisplayType = ctParams) then CancelCompletion; -end; - -procedure TSynCompletionProposal.HookedEditorCommand(Sender: TObject; - AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; - var AChar: WideChar; Data, HandlerData: Pointer); -begin - inherited; - - if AfterProcessing and Form.Visible then - begin - case DisplayType of - ctCode: - begin - - end; - ctHint: - begin - CancelCompletion - end; - ctParams: - begin - case Command of - // So that param completion is not hidden when you display code completion - //ecGotFocus, ecLostFocus: - // CancelCompletion; - ecLineBreak: - DoExecute(Sender as TCustomSynEdit); - ecChar: - begin - case AChar of - #27: - CancelCompletion; - #32..'z': - with Form do - begin -{ if Pos(AChar, FTriggerChars) > 0 then - begin - if Assigned(FParameterToken) then - begin - TmpIndex := CurrentIndex; - TmpLevel := CurrentLevel; - TmpStr := CurrentString; - OnParameterToken(Self, CurrentIndex, TmpLevel, TmpIndex, AChar, TmpStr); - CurrentIndex := TmpIndex; - CurrentLevel := TmpLevel; - CurrentString := TmpStr; - end; - end;} - DoExecute(Sender as TCustomSynEdit); - end; - else DoExecute(Sender as TCustomSynEdit); - end; - end; - else DoExecute(Sender as TCustomSynEdit); - end; - end; - end; - end else - if (not Form.Visible) and Assigned(FTimer) then - begin - if (Command = ecChar) then - if (Pos(AChar, TriggerChars) = 0) then - FTimer.Enabled := False - else - else - FTimer.Enabled := False; - end; - -end; - -procedure TSynCompletionProposal.ActivateCompletion; -begin - DoExecute(Editor); - fNoNextKey := False; // Synedit bug report 1496151 -end; - - - -{ TSynAutoComplete } - -constructor TSynAutoComplete.Create(AOwner: TComponent); -begin - inherited; - FDoLookup := True; - CreateInternalCompletion; - FEndOfTokenChr := DefaultEndOfTokenChr; - fAutoCompleteList := TStringList.Create; - fNoNextKey := false; - fShortCut := Vcl.Menus.ShortCut(Ord(' '), [ssShift]); -end; - -procedure TSynAutoComplete.SetShortCut(Value: TShortCut); -begin - FShortCut := Value; -end; - -destructor TSynAutoComplete.Destroy; -begin - Editor := nil; - if Assigned(FInternalCompletion) then - begin - FInternalCompletion.Free; - FInternalCompletion := nil; - end; - inherited; - fAutoCompleteList.free; -end; - -procedure TSynAutoComplete.EditorKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -var - ShortCutKey: Word; - ShortCutShift: TShiftState; -begin - ShortCutToKey (fShortCut,ShortCutKey,ShortCutShift); - if not (Sender as TCustomSynEdit).ReadOnly and - (Shift = ShortCutShift) and (Key = ShortCutKey) then - begin - Execute(GetPreviousToken(Sender as TCustomSynEdit), Sender as TCustomSynEdit); - fNoNextKey := True; - Key := 0; - end; -end; - -procedure TSynAutoComplete.EditorKeyPress(Sender: TObject; var Key: WideChar); -begin - if fNoNextKey then - begin - fNoNextKey := False; - Key := #0; - end; -end; - -procedure TSynAutoComplete.Execute(Token: string; Editor: TCustomSynEdit); -begin - ExecuteEx(Token, Editor, FDoLookup); -end; - -procedure TSynAutoComplete.ExecuteEx(Token: string; Editor: TCustomSynEdit; - LookupIfNotExact: Boolean); -var - Temp: string; - i, j: integer; - StartOfBlock: TBufferCoord; - ChangedIndent: Boolean; - ChangedTrailing: Boolean; - TmpOptions: TSynEditorOptions; - OrigOptions: TSynEditorOptions; - BeginningSpaceCount : Integer; - Spacing: string; -begin - if Assigned(OnBeforeExecute) then OnBeforeExecute(Self); - try - i := AutoCompleteList.IndexOf(Token); - if (Length(Token) > 0) and (i <> -1) then - begin - Editor.Lines.BeginUpdate; - try - TmpOptions := Editor.Options; - OrigOptions := Editor.Options; - ChangedIndent := eoAutoIndent in TmpOptions; - ChangedTrailing := eoTrimTrailingSpaces in TmpOptions; - - if ChangedIndent then Exclude(TmpOptions, eoAutoIndent); - if ChangedTrailing then Exclude(TmpOptions, eoTrimTrailingSpaces); - - if ChangedIndent or ChangedTrailing then - Editor.Options := TmpOptions; - - Editor.UndoList.AddChange(crAutoCompleteBegin, StartOfBlock, StartOfBlock, '', - smNormal); - - fNoNextKey := True; - for j := 1 to Length(Token) do - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); - BeginningSpaceCount := Editor.DisplayX - 1; - if not(eoTabsToSpaces in Editor.Options) and - (BeginningSpaceCount >= Editor.TabWidth) - then - Spacing := StringofChar(#9, BeginningSpaceCount div Editor.TabWidth) - + StringofChar(' ', BeginningSpaceCount mod Editor.TabWidth) - else - Spacing := StringofChar(' ', BeginningSpaceCount); - - inc(i); - if (i < AutoCompleteList.Count) and - (Length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '|') then - begin - inc(i); - end; - StartOfBlock.Char := -1; - StartOfBlock.Line := -1; - while (i < AutoCompleteList.Count) and - (length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '=') do - begin - { for j := 0 to PrevSpace - 1 do - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);} - Temp := AutoCompleteList[i]; - for j := 2 to Length(Temp) do begin - if (Temp[j] = #9) then - Editor.CommandProcessor(ecTab, Temp[j], nil) - else - Editor.CommandProcessor(ecChar, Temp[j], nil); - if (Temp[j] = '|') then - StartOfBlock := Editor.CaretXY - end; - inc(i); - if (i < AutoCompleteList.Count) and - (length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '=') then - begin - Editor.CommandProcessor (ecLineBreak,' ',nil); - for j := 1 to length(Spacing) do - if (Spacing[j] = #9) then - Editor.CommandProcessor(ecTab, #9, nil) - else - Editor.CommandProcessor (ecChar, ' ', nil); - end; - end; - if (StartOfBlock.Char <> -1) and (StartOfBlock.Line <> -1) then begin - Editor.CaretXY := StartOfBlock; - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); - end; - - if ChangedIndent or ChangedTrailing then Editor.Options := OrigOptions; - - Editor.UndoList.AddChange(crAutoCompleteEnd, StartOfBlock, StartOfBlock, - '', smNormal); - fNoNextKey := False; - finally - Editor.Lines.EndUpdate; - end; - end - else if LookupIfNotExact and Assigned(FInternalCompletion) then - begin - FInternalCompletion.AddEditor(Editor); - FInternalCompletion.ClearList; - for i := 0 to AutoCompleteList.Count - 1 do - if (Length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') and (AutoCompleteList[i][1] <> '|') then - begin - if (i + 1 < AutoCompleteList.Count) and (length(AutoCompleteList[i + 1]) > 0) and - (AutoCompleteList[i + 1][1] = '|') then - begin - Temp := AutoCompleteList[i + 1]; - Delete(Temp, 1, 1); - end - else - Temp := AutoCompleteList[i]; - Temp := '\style{+B}' + AutoCompleteList[i] + '\style{-B}\column{}' + Temp; - FInternalCompletion.ItemList.Add(Temp); - FInternalCompletion.InsertList.Add(AutoCompleteList[i]); - end; - FInternalCompletion.DoExecute(Editor); - end; - finally - if Assigned(OnAfterExecute) then OnAfterExecute(Self); - end; -end; - -procedure TSynAutoComplete.DoInternalAutoCompletion(Sender: TObject; - const Value: string; Shift: TShiftState; Index: Integer; EndToken: WideChar); -begin - ExecuteEx(GetPreviousToken(Editor), Editor, False); - FInternalCompletion.Editor := nil; -end; - -function TSynAutoComplete.GetPreviousToken(Editor: TCustomSynEdit): string; -var - s: string; - i: Integer; -begin - Result := ''; - if Editor <> nil then - begin - s := Editor.LineText; - i := Editor.CaretX - 1; - if i <= Length (s) then - begin - while (i > 0) and (s[i] > ' ') and (Pos(s[i], FEndOfTokenChr) = 0) do - Dec(i); - Result := copy(s, i + 1, Editor.CaretX - i - 1); - end; - end -end; - -procedure TSynAutoComplete.Notification(AComponent: TComponent; Operation: TOperation); -begin - if (Operation = opRemove) and (Editor = AComponent) then - Editor := nil; - inherited Notification(AComponent, Operation); -end; - -procedure TSynAutoComplete.SetAutoCompleteList(List: TStrings); -begin - fAutoCompleteList.Assign(List); -end; - -procedure TSynAutoComplete.SetEditor(const Value: TCustomSynEdit); -begin - if Editor <> Value then - begin - if Editor <> nil then - begin - Editor.RemoveKeyDownHandler( EditorKeyDown ); - Editor.RemoveKeyPressHandler( EditorKeyPress ); - RemoveFreeNotification( Editor ); - end; - fEditor := Value; - if Editor <> nil then - begin - Editor.AddKeyDownHandler( EditorKeyDown ); - Editor.AddKeyPressHandler( EditorKeyPress ); - FreeNotification( Editor ); - end; - end; -end; - -function TSynAutoComplete.GetTokenList: string; -var - List: TStringList; - i: integer; -begin - Result := ''; - if AutoCompleteList.Count < 1 then Exit; - List := TStringList.Create; - i := 0; - while (i < AutoCompleteList.Count) do begin - if (length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') then - List.Add(Trim(AutoCompleteList[i])); - inc(i); - end; - Result := List.Text; - List.Free; -end; - -function TSynAutoComplete.GetTokenValue(Token: string): string; -var - i: integer; - List: TStringList; -begin - Result := ''; - i := AutoCompleteList.IndexOf(Token); - if i <> -1 then - begin - List := TStringList.Create; - Inc(i); - while (i < AutoCompleteList.Count) and - (length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '=') do begin - if Length(AutoCompleteList[i]) = 1 then - List.Add('') - else - List.Add(Copy(AutoCompleteList[i], 2, Length(AutoCompleteList[i]))); - inc(i); - end; - Result := List.Text; - List.Free; - end; -end; - -procedure TSynAutoComplete.SetDoLookup(const Value: Boolean); -begin - FDoLookup := Value; - if FDoLookup and not Assigned(FInternalCompletion) then - CreateInternalCompletion - else if not FDoLookup and Assigned(FInternalCompletion) then begin - FInternalCompletion.Free; - FInternalCompletion := nil; - end; -end; - -procedure TSynAutoComplete.CreateInternalCompletion; -begin - FInternalCompletion := TSynCompletionProposal.Create(Self); - FInternalCompletion.Options := DefaultProposalOptions + [scoUsePrettyText] - [scoUseBuiltInTimer]; - FInternalCompletion.EndOfTokenChr := FEndOfTokenChr; - FInternalCompletion.ShortCut := 0; - FInternalCompletion.OnAfterCodeCompletion := DoInternalAutoCompletion; - FInternalCompletion.Columns.Add; - FInternalCompletion.Width := 350; -end; - -function TSynAutoComplete.GetOptions: TSynCompletionOptions; -begin - Result := FOptions; -end; - -procedure TSynAutoComplete.SetOptions(const Value: TSynCompletionOptions); -begin - FOptions := Value; - if Assigned(FInternalCompletion) then - FInternalCompletion.Options := FOptions + [scoUsePrettyText] - [scoUseBuiltInTimer]; -end; - -procedure TSynAutoComplete.CancelCompletion; -begin - if Assigned(FInternalCompletion) then - FInternalCompletion.CancelCompletion; -end; - -function TSynAutoComplete.GetCompletionProposal: TSynCompletionProposal; -begin - Result := FInternalCompletion; -end; - -function TSynAutoComplete.GetExecuting: Boolean; -begin - if Assigned(FInternalCompletion) then - Result := FInternalCompletion.Form.Visible - else Result := False; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynCompletionProposal.pas, released 2000-04-11. +The Original Code is based on mwCompletionProposal.pas by Cyrille de Brebisson, +part of the mwEdit component suite. +Portions created by Cyrille de Brebisson are Copyright (C) 1999 +Cyrille de Brebisson. +Unicode translation by Maël Hörz. +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: 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: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNCOMPLETIONPROPOSAL} +unit SynCompletionProposal; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + Types, UITypes, + {$ENDIF} + Windows, + Messages, + Graphics, + Forms, + Controls, + StdCtrls, + ExtCtrls, + Menus, + Dialogs, + SynEditTypes, + SynEditKeyCmds, + SynEditHighlighter, + SynEditKbdHandler, + SynEdit, + SynUnicode, + SysUtils, + Classes; + +type + SynCompletionType = (ctCode, ctHint, ctParams); + + TSynForm = {$IFDEF SYN_COMPILER_3_UP}TCustomForm{$ELSE}TForm{$ENDIF}; + + TSynBaseCompletionProposalPaintItem = procedure(Sender: TObject; + Index: Integer; TargetCanvas: TCanvas; ItemRect: TRect; + var CustomDraw: Boolean) of object; + + TSynBaseCompletionProposalMeasureItem = procedure(Sender: TObject; + Index: Integer; TargetCanvas: TCanvas; var ItemWidth: Integer) of object; + + TCodeCompletionEvent = procedure(Sender: TObject; var Value: UnicodeString; + Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; + + TAfterCodeCompletionEvent = procedure(Sender: TObject; const Value: UnicodeString; + Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; + + TValidateEvent = procedure(Sender: TObject; Shift: TShiftState; + EndToken: WideChar) of object; + + TCompletionParameter = procedure(Sender: TObject; CurrentIndex: Integer; + var Level, IndexToDisplay: Integer; var Key: WideChar; + var DisplayString: UnicodeString) of object; + + TCompletionExecute = procedure(Kind: SynCompletionType; Sender: TObject; + var CurrentInput: UnicodeString; var x, y: Integer; var CanExecute: Boolean) of object; + + TCompletionChange = procedure(Sender: TObject; AIndex: Integer) of object; + + TSynCompletionOption = (scoCaseSensitive, //Use case sensitivity to do matches + scoLimitToMatchedText, //Limit the matched text to only what they have typed in + scoTitleIsCentered, //Center the title in the box if you choose to use titles + scoUseInsertList, //Use the InsertList to insert text instead of the ItemList (which will be displayed) + scoUsePrettyText, //Use the PrettyText function to output the words + scoUseBuiltInTimer, //Use the built in timer and the trigger keys to execute the proposal as well as the shortcut + scoEndCharCompletion, //When an end char is pressed, it triggers completion to occur (like the Delphi IDE) + scoConsiderWordBreakChars, //Use word break characters as additional end characters + scoCompleteWithTab, //Use the tab character for completion + scoCompleteWithEnter, //Use the Enter character for completion + scoLimitToMatchedTextAnywhere //Filter the list to typed value matched anywhere in text + ); + + TSynCompletionOptions = set of TSynCompletionOption; + + +const + DefaultProposalOptions = [scoLimitToMatchedText, scoEndCharCompletion, scoCompleteWithTab, scoCompleteWithEnter]; + DefaultEndOfTokenChr = '()[]. '; + +type + TProposalColumns = class; + + TSynBaseCompletionProposalForm = class(TSynForm) + private + FCurrentString: UnicodeString; + FOnKeyPress: TKeyPressWEvent; + FOnPaintItem: TSynBaseCompletionProposalPaintItem; + FOnMeasureItem: TSynBaseCompletionProposalMeasureItem; + FOnChangePosition: TCompletionChange; + FItemList: TUnicodeStrings; + FInsertList: TUnicodeStrings; + FAssignedList: TUnicodeStrings; + FPosition: Integer; + FLinesInWindow: Integer; + FTitleFontHeight: Integer; + FFontHeight: Integer; + FScrollbar: TScrollBar; + FOnValidate: TValidateEvent; + FOnCancel: TNotifyEvent; + FClSelect: TColor; + FClSelectText: TColor; + FClTitleBackground: TColor; + FClBackGround: TColor; + FClBackgroundBorder: TColor; + FBitmap: TBitmap; // used for drawing + FTitleBitmap: TBitmap; // used for title-drawing + FCurrentEditor: TCustomSynEdit; + FTitle: UnicodeString; + FTitleFont: TFont; + FFont: TFont; + FResizeable: Boolean; + FItemHeight: Integer; + FMargin: Integer; + FEffectiveItemHeight: Integer; + FImages: TImageList; + + // These are the reflections of the Options property of the CompletionProposal + FCase: Boolean; + FMatchText: Boolean; + FMatchTextAnywhere: Boolean; + FFormattedText: Boolean; + FCenterTitle: Boolean; + FUseInsertList: Boolean; + FCompleteWithTab: Boolean; + FCompleteWithEnter: Boolean; + + FMouseWheelAccumulator: Integer; + FDisplayKind: SynCompletionType; + FParameterToken: TCompletionParameter; + FCurrentIndex: Integer; + FCurrentLevel: Integer; + FDefaultKind: SynCompletionType; + FEndOfTokenChr: UnicodeString; + FTriggerChars: UnicodeString; + FOldShowCaret: Boolean; + FHeightBuffer: Integer; + FColumns: TProposalColumns; + procedure SetCurrentString(const Value: UnicodeString); + procedure MoveLine(cnt: Integer; const WrapAround: Boolean = False); + procedure ScrollbarOnChange(Sender: TObject); + procedure ScrollbarOnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); + procedure ScrollbarOnEnter(Sender: TObject); + + procedure SetItemList(const Value: TUnicodeStrings); + procedure SetInsertList(const Value: TUnicodeStrings); + procedure SetPosition(const Value: Integer); + procedure SetResizeable(const Value: Boolean); + procedure SetItemHeight(const Value: Integer); + procedure SetImages(const Value: TImageList); + procedure StringListChange(Sender: TObject); + procedure DoDoubleClick(Sender : TObject); + procedure DoFormShow(Sender: TObject); + procedure DoFormHide(Sender: TObject); + procedure AdjustScrollBarPosition; + procedure AdjustMetrics; + procedure SetTitle(const Value: UnicodeString); + procedure SetFont(const Value: TFont); + procedure SetTitleFont(const Value: TFont); + procedure SetColumns(Value: TProposalColumns); + procedure TitleFontChange(Sender: TObject); + procedure FontChange(Sender: TObject); + procedure RecalcItemHeight; + function IsWordBreakChar(AChar: WideChar): Boolean; + protected + procedure DoKeyPressW(Key: WideChar); + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure KeyPress(var Key: Char); override; + procedure KeyPressW(var Key: WideChar); virtual; + procedure Paint; override; + procedure Activate; override; + procedure Deactivate; override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Resize; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure WMChar(var Msg: TWMChar); message WM_CHAR; + procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; + procedure WMActivate (var Message: TWMActivate); message WM_ACTIVATE; + procedure WMEraseBackgrnd(var Message: TMessage); message WM_ERASEBKGND; + procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE; + procedure CreateParams(var Params: TCreateParams); override; + procedure CreateWnd; override; + {$IFDEF SYN_DELPHI_4_UP} + function CanResize(var NewWidth, NewHeight: Integer): Boolean; override; + {$ENDIF} + public + constructor Create(AOwner: Tcomponent); override; + destructor Destroy; override; + + function LogicalToPhysicalIndex(Index: Integer): Integer; + function PhysicalToLogicalIndex(Index: Integer): Integer; + + property DisplayType: SynCompletionType read FDisplayKind write FDisplayKind; + property DefaultType: SynCompletionType read FDefaultKind write FDefaultKind default ctCode; + property CurrentString: UnicodeString read FCurrentString write SetCurrentString; + property CurrentIndex: Integer read FCurrentIndex write FCurrentIndex; + property CurrentLevel: Integer read FCurrentLevel write FCurrentLevel; + property OnParameterToken: TCompletionParameter read FParameterToken write FParameterToken; + property OnKeyPress: TKeyPressWEvent read FOnKeyPress write FOnKeyPress; + property OnPaintItem: TSynBaseCompletionProposalPaintItem read FOnPaintItem write FOnPaintItem; + property OnMeasureItem: TSynBaseCompletionProposalMeasureItem read FOnMeasureItem write FOnMeasureItem; + property OnValidate: TValidateEvent read FOnValidate write FOnValidate; + property OnCancel: TNotifyEvent read FOnCancel write FOnCancel; + property ItemList: TUnicodeStrings read FItemList write SetItemList; + property InsertList: TUnicodeStrings read FInsertList write SetInsertList; + property AssignedList: TUnicodeStrings read FAssignedList write FAssignedList; + property Position: Integer read FPosition write SetPosition; + property Title: UnicodeString read FTitle write SetTitle; + property ClSelect: TColor read FClSelect write FClSelect default clHighlight; + property ClSelectedText: TColor read FClSelectText write FClSelectText default clHighlightText; + property ClBackground: TColor read FClBackGround write FClBackGround default clWindow; + property ClBackgroundBorder: TColor read FClBackgroundBorder write FClBackgroundBorder default clBtnFace; + property ClTitleBackground: TColor read FClTitleBackground write FClTitleBackground default clBtnFace; + property ItemHeight: Integer read FItemHeight write SetItemHeight default 0; + property Margin: Integer read FMargin write FMargin default 2; + + property UsePrettyText: Boolean read FFormattedText write FFormattedText default False; + property UseInsertList: Boolean read FUseInsertList write FUseInsertList default False; + property CenterTitle: Boolean read FCenterTitle write FCenterTitle default True; + property CaseSensitive: Boolean read FCase write FCase default False; + property CurrentEditor: TCustomSynEdit read FCurrentEditor write FCurrentEditor; + property MatchText: Boolean read FMatchText write FMatchText; + property MatchTextAnywhere: Boolean read FMatchTextAnywhere write FMatchTextAnywhere; + property EndOfTokenChr: UnicodeString read FEndOfTokenChr write FEndOfTokenChr; + property TriggerChars: UnicodeString read FTriggerChars write FTriggerChars; + property CompleteWithTab: Boolean read FCompleteWithTab write FCompleteWithTab; + property CompleteWithEnter: Boolean read FCompleteWithEnter write FCompleteWithEnter; + + property TitleFont: TFont read FTitleFont write SetTitleFont; + property Font: TFont read FFont write SetFont; + property Columns: TProposalColumns read FColumns write SetColumns; + property Resizeable: Boolean read FResizeable write SetResizeable default True; + property Images: TImageList read FImages write SetImages; + end; + + TSynBaseCompletionProposal = class(TComponent) + private + FForm: TSynBaseCompletionProposalForm; + FOnExecute: TCompletionExecute; + FOnClose: TNotifyEvent; + FOnShow: TNotifyEvent; + FWidth: Integer; + FPreviousToken: UnicodeString; + FDotOffset: Integer; + FOptions: TSynCompletionOptions; + FNbLinesInWindow: Integer; + + FCanExecute: Boolean; + function GetClSelect: TColor; + procedure SetClSelect(const Value: TColor); + function GetCurrentString: UnicodeString; + function GetItemList: TUnicodeStrings; + function GetInsertList: TUnicodeStrings; + function GetOnCancel: TNotifyEvent; + function GetOnKeyPress: TKeyPressWEvent; + function GetOnPaintItem: TSynBaseCompletionProposalPaintItem; + function GetOnMeasureItem: TSynBaseCompletionProposalMeasureItem; + function GetOnValidate: TValidateEvent; + function GetPosition: Integer; + procedure SetCurrentString(const Value: UnicodeString); + procedure SetItemList(const Value: TUnicodeStrings); + procedure SetInsertList(const Value: TUnicodeStrings); + procedure SetNbLinesInWindow(const Value: Integer); + procedure SetOnCancel(const Value: TNotifyEvent); + procedure SetOnKeyPress(const Value: TKeyPressWEvent); + procedure SetOnPaintItem(const Value: TSynBaseCompletionProposalPaintItem); + procedure SetOnMeasureItem(const Value: TSynBaseCompletionProposalMeasureItem); + procedure SetPosition(const Value: Integer); + procedure SetOnValidate(const Value: TValidateEvent); + procedure SetWidth(Value: Integer); + procedure SetImages(const Value: TImageList); + function GetDisplayKind: SynCompletionType; + procedure SetDisplayKind(const Value: SynCompletionType); + function GetParameterToken: TCompletionParameter; + procedure SetParameterToken(const Value: TCompletionParameter); + function GetDefaultKind: SynCompletionType; + procedure SetDefaultKind(const Value: SynCompletionType); + function GetClBack(AIndex: Integer): TColor; + procedure SetClBack(AIndex: Integer; const Value: TColor); + function GetClSelectedText: TColor; + procedure SetClSelectedText(const Value: TColor); + function GetEndOfTokenChar: UnicodeString; + procedure SetEndOfTokenChar(const Value: UnicodeString); + function GetClTitleBackground: TColor; + procedure SetClTitleBackground(const Value: TColor); + procedure SetTitle(const Value: UnicodeString); + function GetTitle: UnicodeString; + function GetFont: TFont; + function GetTitleFont: TFont; + procedure SetFont(const Value: TFont); + procedure SetTitleFont(const Value: TFont); + function GetOptions: TSynCompletionOptions; + function GetTriggerChars: UnicodeString; + procedure SetTriggerChars(const Value: UnicodeString); + function GetOnChange: TCompletionChange; + procedure SetOnChange(const Value: TCompletionChange); + procedure SetColumns(const Value: TProposalColumns); + function GetColumns: TProposalColumns; + function GetResizeable: Boolean; + procedure SetResizeable(const Value: Boolean); + function GetItemHeight: Integer; + procedure SetItemHeight(const Value: Integer); + function GetMargin: Integer; + procedure SetMargin(const Value: Integer); + function GetImages: TImageList; + function IsWordBreakChar(AChar: WideChar): Boolean; + protected + procedure DefineProperties(Filer: TFiler); override; + procedure SetOptions(const Value: TSynCompletionOptions); virtual; + procedure EditorCancelMode(Sender: TObject); virtual; + procedure HookedEditorCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); virtual; + public + constructor Create(Aowner: TComponent); override; + procedure Execute(s: UnicodeString; x, y: Integer); + procedure ExecuteEx(s: UnicodeString; x, y: Integer; Kind: SynCompletionType + {$IFDEF SYN_COMPILER_4_UP} = ctCode {$ENDIF}); virtual; + procedure Activate; + procedure Deactivate; + + procedure ClearList; + function DisplayItem(AIndex: Integer): UnicodeString; + function InsertItem(AIndex: Integer): UnicodeString; + procedure AddItemAt(Where: Integer; ADisplayText, AInsertText: UnicodeString); + procedure AddItem(ADisplayText, AInsertText: UnicodeString); + procedure ResetAssignedList; + + property OnKeyPress: TKeyPressWEvent read GetOnKeyPress write SetOnKeyPress; + property OnValidate: TValidateEvent read GetOnValidate write SetOnValidate; + property OnCancel: TNotifyEvent read GetOnCancel write SetOnCancel; + property CurrentString: UnicodeString read GetCurrentString write SetCurrentString; + property DotOffset: Integer read FDotOffset write FDotOffset; + property DisplayType: SynCompletionType read GetDisplayKind write SetDisplayKind; + property Form: TSynBaseCompletionProposalForm read FForm; + property PreviousToken: UnicodeString read FPreviousToken; + property Position: Integer read GetPosition write SetPosition; + published + property DefaultType: SynCompletionType read GetDefaultKind write SetDefaultKind default ctCode; + property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; + + property ItemList: TUnicodeStrings read GetItemList write SetItemList; + property InsertList: TUnicodeStrings read GetInsertList write SetInsertList; + property NbLinesInWindow: Integer read FNbLinesInWindow write SetNbLinesInWindow default 8; + property ClSelect: TColor read GetClSelect write SetClSelect default clHighlight; + property ClSelectedText: TColor read GetClSelectedText write SetClSelectedText default clHighlightText; + property ClBackground: TColor index 1 read GetClBack write SetClBack default clWindow; + property ClBackgroundBorder: TColor index 2 read GetClBack write SetClBack default clBtnFace; + property ClTitleBackground: TColor read GetClTitleBackground write SetClTitleBackground default clBtnFace; + property Width: Integer read FWidth write SetWidth default 260; + property EndOfTokenChr: UnicodeString read GetEndOfTokenChar write SetEndOfTokenChar; + property TriggerChars: UnicodeString read GetTriggerChars write SetTriggerChars; + property Title: UnicodeString read GetTitle write SetTitle; + property Font: TFont read GetFont write SetFont; + property TitleFont: TFont read GetTitleFont write SetTitleFont; + property Columns: TProposalColumns read GetColumns write SetColumns; + property Resizeable: Boolean read GetResizeable write SetResizeable default True; + property ItemHeight: Integer read GetItemHeight write SetItemHeight default 0; + property Images: TImageList read GetImages write SetImages default nil; + property Margin: Integer read GetMargin write SetMargin default 2; + + property OnChange: TCompletionChange read GetOnChange write SetOnChange; + property OnClose: TNotifyEvent read FOnClose write FOnClose; + property OnExecute: TCompletionExecute read FOnExecute write FOnExecute; + property OnMeasureItem: TSynBaseCompletionProposalMeasureItem read GetOnMeasureItem write SetOnMeasureItem; + property OnPaintItem: TSynBaseCompletionProposalPaintItem read GetOnPaintItem write SetOnPaintItem; + property OnParameterToken: TCompletionParameter read GetParameterToken write SetParameterToken; + property OnShow: TNotifyEvent read FOnShow write FOnShow; + end; + + TSynCompletionProposal = class(TSynBaseCompletionProposal) + private + FEditors: TList; + FShortCut: TShortCut; + FNoNextKey: Boolean; + FCompletionStart: Integer; + FAdjustCompletionStart: Boolean; + FOnCodeCompletion: TCodeCompletionEvent; + FTimer: TTimer; + FTimerInterval: Integer; + FEditor: TCustomSynEdit; + FOnAfterCodeCompletion: TAfterCodeCompletionEvent; + FOnCancelled: TNotifyEvent; + procedure SetEditor(const Value: TCustomSynEdit); + procedure HandleOnCancel(Sender: TObject); + procedure HandleOnValidate(Sender: TObject; Shift: TShiftState; EndToken: WideChar); + procedure HandleOnKeyPress(Sender: TObject; var Key: WideChar); + procedure HandleDblClick(Sender: TObject); + procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure EditorKeyPress(Sender: TObject; var Key: WideChar); + procedure TimerExecute(Sender: TObject); + function GetPreviousToken(AEditor: TCustomSynEdit): UnicodeString; + function GetCurrentInput(AEditor: TCustomSynEdit): UnicodeString; + function GetTimerInterval: Integer; + procedure SetTimerInterval(const Value: Integer); + function GetEditor(i: Integer): TCustomSynEdit; + procedure InternalCancelCompletion; + protected + procedure DoExecute(AEditor: TCustomSynEdit); virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetShortCut(Value: TShortCut); + procedure SetOptions(const Value: TSynCompletionOptions); override; + procedure EditorCancelMode(Sender: TObject); override; + procedure HookedEditorCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure AddEditor(AEditor: TCustomSynEdit); + function RemoveEditor(AEditor: TCustomSynEdit): Boolean; + function EditorsCount: Integer; + procedure ExecuteEx(s: UnicodeString; x, y: Integer; Kind : SynCompletionType + {$IFDEF SYN_COMPILER_4_UP} = ctCode {$ENDIF}); override; + procedure ActivateCompletion; + procedure CancelCompletion; + procedure ActivateTimer(ACurrentEditor: TCustomSynEdit); + procedure DeactivateTimer; + property Editors[i: Integer]: TCustomSynEdit read GetEditor; + property CompletionStart: Integer read FCompletionStart write FCompletionStart; + published + property ShortCut: TShortCut read FShortCut write SetShortCut; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property TimerInterval: Integer read GetTimerInterval write SetTimerInterval default 1000; + + property OnAfterCodeCompletion: TAfterCodeCompletionEvent read FOnAfterCodeCompletion write FOnAfterCodeCompletion; + property OnCancelled: TNotifyEvent read FOnCancelled write FOnCancelled; + property OnCodeCompletion: TCodeCompletionEvent read FOnCodeCompletion write FOnCodeCompletion; + end; + + TSynAutoComplete = class(TComponent) + private + FShortCut: TShortCut; + FEditor: TCustomSynEdit; + fAutoCompleteList: TUnicodeStrings; + FNoNextKey : Boolean; + FEndOfTokenChr: UnicodeString; + FOnBeforeExecute: TNotifyEvent; + FOnAfterExecute: TNotifyEvent; + FInternalCompletion: TSynCompletionProposal; + FDoLookup: Boolean; + FOptions: TSynCompletionOptions; + procedure SetAutoCompleteList(List: TUnicodeStrings); + procedure SetEditor(const Value: TCustomSynEdit); + procedure SetDoLookup(const Value: Boolean); + procedure CreateInternalCompletion; + function GetOptions: TSynCompletionOptions; + procedure SetOptions(const Value: TSynCompletionOptions); + procedure DoInternalAutoCompletion(Sender: TObject; + const Value: UnicodeString; Shift: TShiftState; Index: Integer; + EndToken: WideChar); + function GetExecuting: Boolean; + protected + procedure SetShortCut(Value: TShortCut); + procedure Notification(AComponent: TComponent; Operation: TOperation); + override; + procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + virtual; + procedure EditorKeyPress(Sender: TObject; var Key: WideChar); virtual; + function GetPreviousToken(Editor: TCustomSynEdit): UnicodeString; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Execute(Token: UnicodeString; Editor: TCustomSynEdit); + procedure ExecuteEx(Token: UnicodeString; Editor: TCustomSynEdit; LookupIfNotExact: Boolean); + function GetTokenList: UnicodeString; + function GetTokenValue(Token: UnicodeString): UnicodeString; + procedure CancelCompletion; + property Executing: Boolean read GetExecuting; + published + property AutoCompleteList: TUnicodeStrings read fAutoCompleteList + write SetAutoCompleteList; + property EndOfTokenChr: UnicodeString read FEndOfTokenChr write FEndOfTokenChr; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property ShortCut: TShortCut read FShortCut write SetShortCut; + property OnBeforeExecute: TNotifyEvent read FOnBeforeExecute write FOnBeforeExecute; + property OnAfterExecute: TNotifyEvent read FOnAfterExecute write FOnAfterExecute; + property DoLookupWhenNotExact: Boolean read FDoLookup write SetDoLookup default True; + property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; + end; + + TProposalColumn = class(TCollectionItem) + private + FColumnWidth: Integer; + FInternalWidth: Integer; + FFontStyle: TFontStyles; + protected + procedure DefineProperties(Filer: TFiler); override; + public + constructor Create(Collection: TCollection); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + published + property ColumnWidth: Integer read FColumnWidth write FColumnWidth; + property DefaultFontStyle: TFontStyles read FFontStyle write FFontStyle default []; + end; + + TProposalColumns = class(TCollection) + private + FOwner: TPersistent; + function GetItem(Index: Integer): TProposalColumn; + procedure SetItem(Index: Integer; Value: TProposalColumn); + protected + function GetOwner: TPersistent; {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} + public + constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); + function Add: TProposalColumn; + {$IFDEF SYN_COMPILER_3_UP} + function FindItemID(ID: Integer): TProposalColumn; + {$ENDIF} + {$IFDEF SYN_COMPILER_4_UP} + function Insert(Index: Integer): TProposalColumn; + {$ENDIF} + property Items[Index: Integer]: TProposalColumn read GetItem write SetItem; default; + end; + + +procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; + const Text: UnicodeString; Selected: Boolean; Columns: TProposalColumns; Images: TImageList); +function FormattedTextWidth(TargetCanvas: TCanvas; const Text: UnicodeString; + Columns: TProposalColumns; Images: TImageList): Integer; +function PrettyTextToFormattedString(const APrettyText: UnicodeString; + AlternateBoldStyle: Boolean {$IFDEF SYN_COMPILER_4_UP} = False {$ENDIF}): UnicodeString; + +implementation + +uses +{$IFDEF SYN_COMPILER_4_UP} + Math, +{$ENDIF} + SynEditTextBuffer, + SynEditMiscProcs, + SynEditKeyConst; + +const + TextHeightString = 'CompletionProposal'; + +//------------------------- Formatted painting stuff --------------------------- + +type + TFormatCommand = (fcNoCommand, fcColor, fcStyle, fcColumn, fcHSpace, fcImage); + TFormatCommands = set of TFormatCommand; + + PFormatChunk = ^TFormatChunk; + TFormatChunk = record + Str: UnicodeString; + Command: TFormatCommand; + Data: Pointer; + end; + + PFormatStyleData = ^TFormatStyleData; + TFormatStyleData = record + Style: WideChar; + Action: Integer; // -1 = Reset, +1 = Set, 0 = Toggle + end; + + TFormatChunkList = class + private + FChunks: TList; + function GetCount: Integer; + function GetChunk(Index: Integer): PFormatChunk; + public + constructor Create; + destructor Destroy; override; + procedure Clear; + procedure Add(AChunk: PFormatChunk); + property Count: Integer read GetCount; + property Chunks[Index: Integer]: PFormatChunk read GetChunk; default; + end; + + +const + AllCommands = [fcColor..High(TFormatCommand)]; + + +function TFormatChunkList.GetCount: Integer; +begin + Result := FChunks.Count; +end; + +function TFormatChunkList.GetChunk(Index: Integer): PFormatChunk; +begin + Result := FChunks[Index]; +end; + +procedure TFormatChunkList.Clear; +var + C: PFormatChunk; + StyleFormatData: PFormatStyleData; +begin + while FChunks.Count > 0 do + begin + C := FChunks.Last; + FChunks.Delete(FChunks.Count-1); + + case C^.Command of + fcStyle: + begin + StyleFormatData := C^.Data; + Dispose(StyleFormatData); + end; + end; + + Dispose(C); + end; +end; + +constructor TFormatChunkList.Create; +begin + inherited Create; + FChunks := TList.Create; +end; + +destructor TFormatChunkList.Destroy; +begin + Clear; + FChunks.Free; + inherited Destroy; +end; + +procedure TFormatChunkList.Add(AChunk: PFormatChunk); +begin + FChunks.Add(AChunk); +end; + + +function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFormatChunkList; + const StripCommands: TFormatCommands): Boolean; +var + CurChar: WideChar; + CurPos: Integer; + CurrentChunk: UnicodeString; + PossibleErrorPos: Integer; + ErrorFound: Boolean; + + procedure NextChar; + begin + Inc(CurPos); + {$IFOPT R+} + // Work-around Delphi's annoying behaviour of failing the RangeCheck when + // reading the final #0 char + if CurPos = Length(FormattedString) +1 then + CurChar := #0 + else + {$ENDIF} + CurChar := FormattedString[CurPos]; + end; + + procedure AddStringChunk; + var + C: PFormatChunk; + begin + C := New(PFormatChunk); + C^.Str := CurrentChunk; + C^.Command := fcNoCommand; + C^.Data := nil; + ChunkList.Add(C); + + CurrentChunk := ''; + end; + + procedure AddCommandChunk(ACommand: TFormatCommand; Data: Pointer); + var + C: PFormatChunk; + begin + C := New(PFormatChunk); + C^.Str := ''; + C^.Command := ACommand; + C^.Data := Data; + ChunkList.Add(C); + end; + + procedure ParseEscapeSequence; + var + Command: UnicodeString; + Parameter: UnicodeString; + CommandType: TFormatCommand; + Data: Pointer; + begin + Assert(CurChar = '\'); + NextChar; + if CurChar = '\' then + begin + CurrentChunk := CurrentChunk + '\'; + NextChar; + Exit; + end; + + if CurrentChunk <> '' then + AddStringChunk; + + Command := ''; + while (CurChar <> '{') and (CurPos <= Length(FormattedString)) do + begin + Command := Command +CurChar; + NextChar; + end; + + if CurChar = '{' then + begin + PossibleErrorPos := CurPos; + NextChar; + Parameter := ''; + while (CurChar <> '}') and (CurPos <= Length(FormattedString)) do + begin + Parameter := Parameter + CurChar; + NextChar; + end; + + if CurChar = '}' then + begin + Command := SynWideUpperCase(Command); + + Data := nil; + CommandType := fcNoCommand; + + if Command = 'COLOR' then + begin + try + Data := Pointer(StringToColor(Parameter)); + CommandType := fcColor; + except + CommandType := fcNoCommand; + ErrorFound := True; + end; + end else + if Command = 'COLUMN' then + begin + if Parameter <> '' then + begin + CommandType := fcNoCommand; + ErrorFound := True; + end else + CommandType := fcColumn; + end else + if Command = 'HSPACE' then + begin + try + Data := Pointer(StrToInt(Parameter)); + CommandType := fcHSpace; + except + CommandType := fcNoCommand; + ErrorFound := True; + end; + end else + if Command = 'IMAGE' then + begin + try + Data := Pointer(StrToInt(Parameter)); + CommandType := fcImage; + except + CommandType := fcNoCommand; + ErrorFound := True; + end; + end else + if Command = 'STYLE' then + begin + if (Length(Parameter) = 2) + and CharInSet(Parameter[1], ['+', '-', '~']) + and CharInSet(SynWideUpperCase(Parameter[2])[1], + ['B', 'I', 'U', 'S']) then + begin + CommandType := fcStyle; + if not (fcStyle in StripCommands) then + begin + Data := New(PFormatStyleData); + PFormatStyleData(Data)^.Style := SynWideUpperCase(Parameter[2])[1]; + case Parameter[1] of + '+': PFormatStyleData(Data)^.Action := 1; + '-': PFormatStyleData(Data)^.Action := -1; + '~': PFormatStyleData(Data)^.Action := 0; + end; + end; + end else + begin + CommandType := fcNoCommand; + ErrorFound := True; + end; + end else + ErrorFound := True; + + if (CommandType <> fcNoCommand) and (not (CommandType in StripCommands)) then + AddCommandChunk(CommandType, Data); + + NextChar; + end; + end; + Result := not ErrorFound; + end; + + procedure ParseString; + begin + Assert(CurChar <> '\'); + while (CurChar <> '\') and (CurPos <= Length(FormattedString)) do + begin + CurrentChunk := CurrentChunk +CurChar; + NextChar; + end; + end; + +begin + Assert(Assigned(ChunkList)); + + if FormattedString = '' then + Exit; + + ErrorFound := False; + CurrentChunk := ''; + CurPos := 1; + CurChar := FormattedString[1]; + + while CurPos <= Length(FormattedString) do + begin + if CurChar = '\' then + ParseEscapeSequence + else + ParseString; + end; + + if CurrentChunk <> '' then + AddStringChunk; +end; + + +function StripFormatCommands(const FormattedString: UnicodeString): UnicodeString; +var + Chunks: TFormatChunkList; + i: Integer; +begin + Chunks := TFormatChunkList.Create; + try + ParseFormatChunks(FormattedString, Chunks, AllCommands); + + Result := ''; + for i := 0 to Chunks.Count -1 do + Result := Result + Chunks[i]^.Str; + + finally + Chunks.Free; + end; +end; + + +function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; + ChunkList: TFormatChunkList; Columns: TProposalColumns; Images: TImageList; + Invisible: Boolean): Integer; +var + i: Integer; + X: Integer; + C: PFormatChunk; + CurrentColumn: TProposalColumn; + CurrentColumnIndex: Integer; + LastColumnStart: Integer; + Style: TFontStyles; + OldFont: TFont; +begin + OldFont := TFont.Create; + try + OldFont.Assign(TargetCanvas.Font); + + if Assigned(Columns) and (Columns.Count > 0) then + begin + CurrentColumnIndex := 0; + CurrentColumn := TProposalColumn(Columns.Items[0]); + TargetCanvas.Font.Style := CurrentColumn.FFontStyle; + end else + begin + CurrentColumnIndex := -1; + CurrentColumn := nil; + end; + + LastColumnStart := Rect.Left; + X := Rect.Left; + + TargetCanvas.Brush.Style := bsClear; + + for i := 0 to ChunkList.Count -1 do + begin + C := ChunkList[i]; + + case C^.Command of + fcNoCommand: + begin + if not Invisible then + TextOut(TargetCanvas, X, Rect.Top, C^.Str); + + Inc(X, TextWidth(TargetCanvas, C^.Str)); + if X > Rect.Right then + Break; + end; + fcColor: + if not Invisible then + TargetCanvas.Font.Color := TColor(C^.Data); + fcStyle: + begin + case PFormatStyleData(C^.Data)^.Style of + 'I': Style := [fsItalic]; + 'B': Style := [fsBold]; + 'U': Style := [fsUnderline]; + 'S': Style := [fsStrikeout]; + else Assert(False); + end; + + + case PFormatStyleData(C^.Data)^.Action of + -1: TargetCanvas.Font.Style := TargetCanvas.Font.Style - Style; + 0: if TargetCanvas.Font.Style * Style = [] then + TargetCanvas.Font.Style := TargetCanvas.Font.Style + Style + else + TargetCanvas.Font.Style := TargetCanvas.Font.Style - Style; + 1: TargetCanvas.Font.Style := TargetCanvas.Font.Style + Style; + else Assert(False); + end; + end; + fcColumn: + if Assigned(Columns) and (Columns.Count > 0) then + begin + if CurrentColumnIndex <= Columns.Count -1 then + begin + Inc(LastColumnStart, CurrentColumn.FColumnWidth); + X := LastColumnStart; + + Inc(CurrentColumnIndex); + if CurrentColumnIndex <= Columns.Count -1 then + begin + CurrentColumn := TProposalColumn(Columns.Items[CurrentColumnIndex]); + TargetCanvas.Font.Style := CurrentColumn.FFontStyle; + end else + CurrentColumn := nil; + end; + end; + fcHSpace: + begin + Inc(X, Integer(C^.Data)); + if X > Rect.Right then + Break; + end; + fcImage: + begin + Assert(Assigned(Images)); + + Images.Draw(TargetCanvas, X, Rect.Top, Integer(C^.Data)); + + Inc(X, Images.Width); + if X > Rect.Right then + Break; + end; + end; + end; + + Result := X; + TargetCanvas.Font.Assign(OldFont); + finally + OldFont.Free; + TargetCanvas.Brush.Style := bsSolid; + end; +end; + +procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; + const Text: UnicodeString; Selected: Boolean; Columns: TProposalColumns; Images: TImageList); +var + Chunks: TFormatChunkList; + StripCommands: TFormatCommands; +begin + Chunks := TFormatChunkList.Create; + try + if Selected then + StripCommands := [fcColor] + else + StripCommands := []; + + ParseFormatChunks(Text, Chunks, StripCommands); + PaintChunks(TargetCanvas, Rect, Chunks, Columns, Images, False); + finally + Chunks.Free; + end; +end; + +function FormattedTextWidth(TargetCanvas: TCanvas; const Text: UnicodeString; + Columns: TProposalColumns; Images: TImageList): Integer; +var + Chunks: TFormatChunkList; + TmpRect: TRect; +begin + Chunks := TFormatChunkList.Create; + try + TmpRect := Rect(0, 0, MaxInt, MaxInt); + + ParseFormatChunks(Text, Chunks, [fcColor]); + Result := PaintChunks(TargetCanvas, TmpRect, Chunks, Columns, Images, True); + finally + Chunks.Free; + end; +end; + +function PrettyTextToFormattedString(const APrettyText: UnicodeString; + AlternateBoldStyle: Boolean {$IFDEF SYN_COMPILER_4_UP} = False {$ENDIF}): UnicodeString; +var + i: Integer; + Color: TColor; +Begin + Result := ''; + i := 1; + while i <= Length(APrettyText) do + case APrettyText[i] of + #1, #2: + begin + Color := (Ord(APrettyText[i + 3]) shl 8 + +Ord(APrettyText[i + 2])) shl 8 + +Ord(APrettyText[i + 1]); + + Result := Result+'\color{'+ColorToString(Color)+'}'; + + Inc(i, 4); + end; + #3: + begin + if CharInSet(SynWideUpperCase(APrettyText[i + 1])[1], ['B', 'I', 'U']) then + begin + Result := Result + '\style{'; + + case APrettyText[i + 1] of + 'B': Result := Result + '+B'; + 'b': Result := Result + '-B'; + 'I': Result := Result + '+I'; + 'i': Result := Result + '-I'; + 'U': Result := Result + '+U'; + 'u': Result := Result + '-U'; + end; + + Result := Result + '}'; + end; + Inc(i, 2); + end; + #9: + begin + Result := Result + '\column{}'; + if AlternateBoldStyle then + Result := Result + '\style{~B}'; + Inc(i); + end; + else + Result := Result + APrettyText[i]; + Inc(i); + end; +end; + + +// TProposalColumn + +constructor TProposalColumn.Create(Collection: TCollection); +begin + inherited; + FColumnWidth := 100; + FInternalWidth := -1; + FFontStyle := []; +end; + +destructor TProposalColumn.Destroy; +begin + inherited; +end; + +procedure TProposalColumn.Assign(Source: TPersistent); +begin + if Source is TProposalColumn then + begin + FColumnWidth := TProposalColumn(Source).FColumnWidth; + FInternalWidth := TProposalColumn(Source).FInternalWidth; + FFontStyle := TProposalColumn(Source).FFontStyle; + end + else + inherited Assign(Source); +end; + +procedure TProposalColumn.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +constructor TProposalColumns.Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); +begin + inherited Create(ItemClass); + FOwner := AOwner; +end; + +function TProposalColumns.GetOwner: TPersistent; +begin + Result := FOwner; +end; + +function TProposalColumns.GetItem(Index: Integer): TProposalColumn; +begin + Result := inherited GetItem(Index) as TProposalColumn; +end; + +procedure TProposalColumns.SetItem(Index: Integer; Value: TProposalColumn); +begin + inherited SetItem(Index, Value); +end; + +function TProposalColumns.Add: TProposalColumn; +begin + Result := inherited Add as TProposalColumn; +end; + + +{$IFDEF SYN_COMPILER_3_UP} +function TProposalColumns.FindItemID(ID: Integer): TProposalColumn; +begin + Result := inherited FindItemID(ID) as TProposalColumn; +end; +{$ENDIF} + +{$IFDEF SYN_COMPILER_4_UP} +function TProposalColumns.Insert(Index: Integer): TProposalColumn; +begin + Result := inherited Insert(Index) as TProposalColumn; +end; +{$ENDIF} + + + +//============================================================================ + + +//Moved from completion component +function FormatParamList(const S: UnicodeString; CurrentIndex: Integer): UnicodeString; +var + i: Integer; + List: TUnicodeStrings; +begin + Result := ''; + List := TUnicodeStringList.Create; + try + List.CommaText := S; + for i := 0 to List.Count - 1 do + begin + if i = CurrentIndex then + Result := Result + '\style{~B}' + List[i] + '\style{~B}' + else + Result := Result + List[i]; + + if i < List.Count - 1 then +// Result := Result + ', '; + Result := Result + ' '; + end; + finally + List.Free; + end; +end; +// End GBN 10/11/2001 + +{ TSynBaseCompletionProposalForm } + +constructor TSynBaseCompletionProposalForm.Create(AOwner: TComponent); +begin + FResizeable := True; +{$IFDEF SYN_CPPB_1} + CreateNew(AOwner, 0); +{$ELSE} + CreateNew(AOwner); +{$ENDIF} + FBitmap := TBitmap.Create; + FTitleBitmap := TBitmap.Create; + FItemList := TUnicodeStringList.Create; + FInsertList := TUnicodeStringList.Create; + FAssignedList := TUnicodeStringList.Create; + FMatchText := False; + FMatchTextAnywhere:= False; + BorderStyle := bsNone; + FScrollbar := TScrollBar.Create(Self); + FScrollbar.Kind := sbVertical; + FScrollbar.ParentCtl3D := False; + FScrollbar.OnChange := ScrollbarOnChange; + FScrollbar.OnScroll := ScrollbarOnScroll; + FScrollbar.OnEnter := ScrollbarOnEnter; + FScrollbar.Parent := Self; + Visible := False; + + FTitleFont := TFont.Create; + FTitleFont.Name := 'MS Sans Serif'; + FTitleFont.Size := 8; + FTitleFont.Style := [fsBold]; + FTitleFont.Color := clBtnText; + + FFont := TFont.Create; + FFont.Name := 'MS Sans Serif'; + FFont.Size := 8; + + ClSelect := clHighlight; + ClSelectedText := clHighlightText; + ClBackground := clWindow; + ClBackgroundBorder := clBtnFace; + ClTitleBackground := clBtnFace; + + + (FItemList as TUnicodeStringList).OnChange := StringListChange; // Really necessary? It seems to work + FTitle := ''; // fine without it + FUseInsertList := False; + FFormattedText := False; + FCenterTitle := True; + FCase := False; + + FColumns := TProposalColumns.Create(AOwner, TProposalColumn); + + FItemHeight := 0; + FMargin := 2; + FEffectiveItemHeight := 0; + RecalcItemHeight; + + Canvas.Font.Assign(FTitleFont); + FTitleFontHeight := TextHeight(Canvas, TextHeightString); + FHeightBuffer := 0; + + FTitleFont.OnChange := TitleFontChange; + FFont.OnChange := FontChange; + + OnDblClick := DoDoubleClick; + OnShow := DoFormShow; + OnHide := DoFormHide; +end; + +procedure TSynBaseCompletionProposalForm.CreateParams(var Params: TCreateParams); +const + CS_DROPSHADOW = $20000; +{$IFNDEF SYN_COMPILER_3_UP} +var + VersionInfo: TOSVersionInfo; +{$ENDIF} +begin + inherited; + with Params do + begin + Style := WS_POPUP; + ExStyle := WS_EX_TOOLWINDOW; + + {$IFDEF SYN_COMPILER_3_UP} + if ((Win32Platform and VER_PLATFORM_WIN32_NT) <> 0) + and (Win32MajorVersion > 4) + and (Win32MinorVersion > 0) {Windows XP} then + {$ELSE} + VersionInfo.dwOSVersionInfoSize := sizeof(TOSVersionInfo); + if GetVersionEx(VersionInfo) + and ((VersionInfo.dwPlatformId and VER_PLATFORM_WIN32_NT) <> 0) + and (VersionInfo.dwMajorVersion > 4) + and (VersionInfo.dwMinorVersion > 0) {Windows XP} then + {$ENDIF} + Params.WindowClass.style := Params.WindowClass.style or CS_DROPSHADOW; + + if DisplayType = ctCode then + if FResizeable then + Style := Style or WS_THICKFRAME + else + Style := Style or WS_DLGFRAME; + end; +end; + +procedure TSynBaseCompletionProposalForm.CreateWnd; +begin + inherited; + + if not (csDesigning in ComponentState) then + begin + // "redefine" window-procedure to get Unicode messages + if Win32Platform = VER_PLATFORM_WIN32_NT then + SetWindowLongW(Handle, GWL_WNDPROC, Integer(GetWindowLongA(Handle, GWL_WNDPROC))); + end; +end; + +procedure TSynBaseCompletionProposalForm.Activate; +begin + Visible := True; + if DisplayType = ctCode then + (CurrentEditor as TCustomSynEdit).AddFocusControl(Self); +end; + +procedure TSynBaseCompletionProposalForm.Deactivate; +begin + if (DisplayType = ctCode) then + (CurrentEditor as TCustomSynEdit).RemoveFocusControl(Self); + Visible := False; +end; + +destructor TSynBaseCompletionProposalForm.Destroy; +begin + inherited Destroy; + FColumns.Free; + FBitmap.Free; + FTitleBitmap.Free; + FItemList.Free; + FInsertList.Free; + FAssignedList.Free; + FTitleFont.Free; + FFont.Free; +end; + +procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftState); +var + C: WideChar; +begin + if DisplayType = ctCode then + begin + case Key of + SYNEDIT_RETURN: + if (FCompleteWithEnter) and Assigned(OnValidate) then + OnValidate(Self, Shift, #0); + SYNEDIT_TAB: + if (FCompleteWithTab) and Assigned(OnValidate) then + OnValidate(Self, Shift, #0); + SYNEDIT_ESCAPE: + begin + if Assigned(OnCancel) then + OnCancel(Self); + end; + SYNEDIT_LEFT: + begin + if Length(FCurrentString) > 0 then + begin + CurrentString := Copy(CurrentString, 1, Length(CurrentString) - 1); + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecLeft, #0, nil); + end + else + begin + //Since we have control, we need to re-send the key to + //the editor so that the cursor behaves properly + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecLeft, #0, nil); + + if Assigned(OnCancel) then + OnCancel(Self); + end; + end; + SYNEDIT_RIGHT: + begin + if Assigned(CurrentEditor) then + with CurrentEditor as TCustomSynEdit do + begin + if CaretX <= Length(LineText) then + C := LineText[CaretX] + else + C := #32; + + if Self.IsWordBreakChar(C) then + if Assigned(OnCancel) then + OnCancel(Self) + else + else + CurrentString := CurrentString + C; + + CommandProcessor(ecRight, #0, nil); + end; + end; + SYNEDIT_PRIOR: + MoveLine(-FLinesInWindow); + SYNEDIT_NEXT: + MoveLine(FLinesInWindow); + SYNEDIT_END: + Position := FAssignedList.Count - 1; + SYNEDIT_HOME: + Position := 0; + SYNEDIT_UP: + if ssCtrl in Shift then + Position := 0 + else + MoveLine(-1, True); + SYNEDIT_DOWN: + if ssCtrl in Shift then + Position := FAssignedList.Count - 1 + else + MoveLine(1, True); + SYNEDIT_BACK: + if (Shift = []) then + begin + if Length(FCurrentString) > 0 then + begin + CurrentString := Copy(CurrentString, 1, Length(CurrentString) - 1); + + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteLastChar, #0, nil); + end + else + begin + //Since we have control, we need to re-send the key to + //the editor so that the cursor behaves properly + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteLastChar, #0, nil); + + if Assigned(OnCancel) then + OnCancel(Self); + end; + end; + SYNEDIT_DELETE: if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteChar, #0, nil); + end; + end; + Invalidate; +end; + +procedure TSynBaseCompletionProposalForm.KeyPress(var Key: Char); +begin +end; + +{$MESSAGE 'Check what must be adapted in DoKeyPressW and related methods'} +procedure TSynBaseCompletionProposalForm.DoKeyPressW(Key: WideChar); +begin + if Key <> #0 then + KeyPressW(Key); +end; + +procedure TSynBaseCompletionProposalForm.KeyPressW(var Key: WideChar); +begin + if DisplayType = ctCode then + begin + case Key of + #13, #27:; // These keys are already handled by KeyDown + #32..High(WideChar): + begin + if IsWordBreakChar(Key) and Assigned(OnValidate) then + begin + if Key = #32 then + OnValidate(Self, [], #0) + else + OnValidate(Self, [], Key); + end; + + CurrentString := CurrentString + Key; + + if Assigned(OnKeyPress) then + OnKeyPress(Self, Key); + end; + #8: + if Assigned(OnKeyPress) then + OnKeyPress(Self, Key); + else + with CurrentEditor as TCustomSynEdit do + CommandProcessor(ecChar, Key, nil); + + if Assigned(OnCancel) then + OnCancel(Self); + end; + end; + Invalidate; +end; + +procedure TSynBaseCompletionProposalForm.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + y := (y - FHeightBuffer) div FEffectiveItemHeight; + Position := FScrollbar.Position + y; +// (CurrentEditor as TCustomSynEdit).UpdateCaret; +end; + +{$IFDEF SYN_DELPHI_4_UP} +function TSynBaseCompletionProposalForm.CanResize(var NewWidth, NewHeight: Integer): Boolean; +var + NewLinesInWindow: Integer; + BorderWidth: Integer; + tmpHeight : Integer; +begin + Result := True; + case FDisplayKind of + ctCode: + begin + BorderWidth := 2 * GetSystemMetrics(SM_CYSIZEFRAME); + + if FEffectiveItemHeight <> 0 then + begin + tmpHeight := NewHeight - BorderWidth; + NewLinesInWindow := (tmpHeight - FHeightBuffer) div FEffectiveItemHeight; + + if NewLinesInWindow < 1 then + NewLinesInWindow := 1; + end + else + NewLinesInWindow := 0; + + FLinesInWindow := NewLinesInWindow; + + NewHeight := FEffectiveItemHeight * FLinesInWindow + FHeightBuffer + BorderWidth; + + if (NewWidth-BorderWidth) < FScrollbar.Width then + NewWidth := FScrollbar.Width + BorderWidth; + end; + ctHint:; + ctParams:; + end; +end; +{$ENDIF} + +procedure TSynBaseCompletionProposalForm.Resize; +begin + inherited; + + if FEffectiveItemHeight <> 0 then + FLinesInWindow := (Height - FHeightBuffer) div FEffectiveItemHeight; + + if not(csCreating in ControlState) then + AdjustMetrics; + + AdjustScrollBarPosition; + Invalidate; +end; + + +procedure TSynBaseCompletionProposalForm.Paint; + + procedure ResetCanvas; + begin + with FBitmap.Canvas do + begin + Pen.Color := FClBackGround; + Brush.Color := FClBackGround; + Font.Assign(FFont); + end; + end; + +const + TitleMargin = 2; +var + TmpRect: TRect; + TmpX: Integer; + AlreadyDrawn: Boolean; + TmpString: UnicodeString; + i: Integer; +begin + if FDisplayKind = ctCode then + begin + with FBitmap do + begin + ResetCanvas; + Canvas.Pen.Color := FClBackgroundBorder; + Canvas.Rectangle(0, 0, ClientWidth - FScrollbar.Width, ClientHeight); + for i := 0 to Min(FLinesInWindow - 1, FAssignedList.Count - 1) do + begin + if i + FScrollbar.Position = Position then + begin + Canvas.Brush.Color := FClSelect; + Canvas.Pen.Color := FClSelect; + Canvas.Rectangle(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, + FEffectiveItemHeight * (i + 1)); + Canvas.Pen.Color := FClSelectText; + Canvas.Font.Assign(FFont); + Canvas.Font.Color := FClSelectText; + end; + + AlreadyDrawn := False; + + if Assigned(OnPaintItem) then + OnPaintItem(Self, LogicalToPhysicalIndex(FScrollbar.Position + i), + Canvas, Rect(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, + FEffectiveItemHeight * (i + 1)), AlreadyDrawn); + + if AlreadyDrawn then + ResetCanvas + else + begin + if FFormattedText then + begin + FormattedTextOut(Canvas, Rect(FMargin, + FEffectiveItemHeight * i + ((FEffectiveItemHeight - FFontHeight) div 2), + FBitmap.Width, FEffectiveItemHeight * (i + 1)), + FAssignedList[FScrollbar.Position + i], + (i + FScrollbar.Position = Position), FColumns, FImages); + end + else + begin + TextOut(Canvas, FMargin, FEffectiveItemHeight * i, + FAssignedList[FScrollbar.Position + i]); + end; + + if i + FScrollbar.Position = Position then + ResetCanvas; + end; + end; + end; + Canvas.Draw(0, FHeightBuffer, FBitmap); + + if FTitle <> '' then + begin + with FTitleBitmap do + begin + Canvas.Brush.Color := FClTitleBackground; + TmpRect := Rect(0, 0, ClientWidth + 1, FHeightBuffer); + Canvas.FillRect(TmpRect); + Canvas.Pen.Color := clBtnShadow; + Dec(TmpRect.Bottom, 1); + Canvas.PenPos := TmpRect.BottomRight; + Canvas.LineTo(TmpRect.Left - 1,TmpRect.Bottom); + Canvas.Pen.Color := clBtnFace; + + Canvas.Font.Assign(FTitleFont); + + if CenterTitle then + begin + TmpX := (Width - TextWidth(Canvas, Title)) div 2; + if TmpX < TitleMargin then + TmpX := TitleMargin; //We still want to be able to read it, even if it does go over the edge + end else + begin + TmpX := TitleMargin; + end; + TextRect(Canvas, TmpRect, TmpX, TitleMargin - 1, FTitle); // -1 because TmpRect.Top is already 1 + end; + Canvas.Draw(0, 0, FTitleBitmap); + end; + end else + if (FDisplayKind = ctHint) or (FDisplayKind = ctParams) then + begin + with FBitmap do + begin + ResetCanvas; + tmpRect := Rect(0, 0, ClientWidth, ClientHeight); + Canvas.FillRect(tmpRect); + Frame3D(Canvas, tmpRect, cl3DLight, cl3DDkShadow, 1); + + for i := 0 to FAssignedList.Count - 1 do + begin + AlreadyDrawn := False; + if Assigned(OnPaintItem) then + OnPaintItem(Self, i, Canvas, Rect(0, FEffectiveItemHeight * i + FMargin, + ClientWidth, FEffectiveItemHeight * (i + 1) + FMargin), AlreadyDrawn); + + if AlreadyDrawn then + ResetCanvas + else + begin + if FDisplayKind = ctParams then + TmpString := FormatParamList(FAssignedList[i], CurrentIndex) + else + TmpString := FAssignedList[i]; + + FormattedTextOut(Canvas, Rect(FMargin + 1, + FEffectiveItemHeight * i + ((FEffectiveItemHeight-FFontHeight) div 2) + FMargin, + FBitmap.Width - 1, FEffectiveItemHeight * (i + 1) + FMargin), TmpString, + False, nil, FImages); + end; + end; + end; + Canvas.Draw(0, 0, FBitmap); + end; +end; + +procedure TSynBaseCompletionProposalForm.ScrollbarOnChange(Sender: TObject); +begin + if Position < FScrollbar.Position then + Position := FScrollbar.Position + else + if Position > FScrollbar.Position + FLinesInWindow - 1 then + Position := FScrollbar.Position + FLinesInWindow - 1 + else + Repaint; +end; + +procedure TSynBaseCompletionProposalForm.ScrollbarOnScroll(Sender: TObject; + ScrollCode: TScrollCode; var ScrollPos: Integer); +begin + with CurrentEditor as TCustomSynEdit do + begin + SetFocus; + //This tricks the caret into showing itself again. + AlwaysShowCaret := False; + AlwaysShowCaret := True; +// UpdateCaret; + end; +end; + +procedure TSynBaseCompletionProposalForm.ScrollbarOnEnter(Sender: TObject); +begin + ActiveControl := nil; +end; + +procedure TSynBaseCompletionProposalForm.MoveLine(cnt: Integer; const WrapAround: Boolean = False); +var + NewPosition: Integer; +begin + NewPosition := Position + cnt; + if (NewPosition < 0) then + begin + if WrapAround then + NewPosition := FAssignedList.Count + NewPosition + else + NewPosition := 0; + end + else if (NewPosition >= FAssignedList.Count) then + begin + if WrapAround then + NewPosition := NewPosition - FAssignedList.Count + else + NewPosition := FAssignedList.Count - 1; + end; + + Position := NewPosition +end; + +function TSynBaseCompletionProposalForm.LogicalToPhysicalIndex(Index: Integer): Integer; +begin + if FMatchText and (Index >= 0) and (Index < FAssignedList.Count) then + Result := Integer(FAssignedList.Objects[Index]) + else + Result := Index; +end; + +function TSynBaseCompletionProposalForm.PhysicalToLogicalIndex(Index: Integer): Integer; +var i : Integer; +begin + if FMatchText then + begin + Result := -1; + for i := 0 to FAssignedList.Count - 1 do + if Integer(FAssignedList.Objects[i]) = Index then + begin + Result := i; + Break; + end; + end else + Result := Index; +end; + +procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: UnicodeString); +var + MinPosition, ValuePosition, MinIndex: Integer; + + function MatchItem(AIndex: Integer; UseItemList: Boolean): Boolean; + var + CompareString: UnicodeString; + begin +{ if UseInsertList then + CompareString := FInsertList[AIndex] + else + begin + CompareString := FItemList[AIndex]; + + if UsePrettyText then + CompareString := StripFormatCommands(CompareString); + end;} + + if UseInsertList then + CompareString := FInsertList[aIndex] + else + begin + if (FMatchText) and (not UseItemList) then + CompareString := FAssignedList[aIndex] + else + CompareString := FItemList[aIndex]; + + if UsePrettyText then + CompareString := StripFormatCommands(CompareString); + end; + + if FMatchTextAnywhere then + begin + if Value <> '' then + begin + if FCase then + begin + ValuePosition := Pos(Value, CompareString); + Result := ValuePosition > 0 + end else + begin + ValuePosition := Pos(AnsiUpperCase(Value), AnsiUpperCase(CompareString)); + Result := ValuePosition > 0; + end; + if (ValuePosition > 0) and (ValuePosition < MinPosition) then + begin + MinPosition := ValuePosition; + MinIndex := FAssignedList.Count; + end; + end else + Result := True; + end else + begin + CompareString := Copy(CompareString, 1, Length(Value)); + + if FCase then + Result := WideCompareStr(CompareString, Value) = 0 + else + Result := WideCompareText(CompareString, Value) = 0; + end; + end; + + procedure RecalcList; + var + i: Integer; + begin + FAssignedList.Clear; + MinPosition := MaxInt; + MinIndex := -1; + for i := 0 to FItemList.Count - 1 do + begin + if MatchItem(i, True) then + FAssignedList.AddObject(FItemList[i], TObject(i)); + + end; + if MinIndex <> -1 then + Position := MinIndex; + end; + +var + i: Integer; +begin + FCurrentString := Value; + if DisplayType <> ctCode then + Exit; + if FMatchText then + begin + if FMatchTextAnywhere then + Position := 0; + RecalcList; + AdjustScrollBarPosition; + if not FMatchTextAnywhere then + Position := 0; + + if Visible and Assigned(FOnChangePosition) and (DisplayType = ctCode) then + FOnChangePosition(Owner as TSynBaseCompletionProposal, + LogicalToPhysicalIndex(FPosition)); + + Repaint; + end + else + begin + i := 0; + while (i < ItemList.Count) and (not MatchItem(i, True)) do + Inc(i); + + if i < ItemList.Count then + Position := i + else + Position := 0; + end; +end; + +procedure TSynBaseCompletionProposalForm.SetItemList(const Value: TUnicodeStrings); +begin + FItemList.Assign(Value); + FAssignedList.Assign(Value); + CurrentString := CurrentString; +end; + +procedure TSynBaseCompletionProposalForm.SetInsertList(const Value: TUnicodeStrings); +begin + FInsertList.Assign(Value); +end; + +procedure TSynBaseCompletionProposalForm.DoDoubleClick(Sender: TObject); +begin + // we need to do the same as the enter key; + if DisplayType = ctCode then + if Assigned(OnValidate) then OnValidate(Self, [], #0); +end; + +procedure TSynBaseCompletionProposalForm.SetPosition(const Value: Integer); +begin + if ((Value <= 0) and (FPosition = 0)) or (FPosition = Value) then + Exit; + + if Value <= FAssignedList.Count - 1 then + begin + FPosition := Value; + if Position < FScrollbar.Position then + FScrollbar.Position := Position else + if FScrollbar.Position < (Position - FLinesInWindow + 1) then + FScrollbar.Position := Position - FLinesInWindow + 1; + + if Visible and Assigned(FOnChangePosition) and (DisplayType = ctCode) then + FOnChangePosition(Owner as TSynBaseCompletionProposal, + LogicalToPhysicalIndex(FPosition)); + + Repaint; + end; +end; + +procedure TSynBaseCompletionProposalForm.SetResizeable(const Value: Boolean); +begin + FResizeable := Value; + RecreateWnd; +end; + +procedure TSynBaseCompletionProposalForm.SetItemHeight(const Value: Integer); +begin + if Value <> FItemHeight then + begin + FItemHeight := Value; + RecalcItemHeight; + end; +end; + +procedure TSynBaseCompletionProposalForm.SetImages(const Value: TImageList); +begin + if FImages <> Value then + begin + {$IFDEF SYN_COMPILER_5_UP} + if Assigned(FImages) then + FImages.RemoveFreeNotification(Self); + {$ENDIF SYN_COMPILER_5_UP} + + FImages := Value; + if Assigned(FImages) then + FImages.FreeNotification(Self); + end; +end; + + +procedure TSynBaseCompletionProposalForm.RecalcItemHeight; +begin + Canvas.Font.Assign(FFont); + FFontHeight := TextHeight(Canvas, TextHeightString); + if FItemHeight > 0 then + FEffectiveItemHeight := FItemHeight + else + begin + FEffectiveItemHeight := FFontHeight; + end; +end; + +procedure TSynBaseCompletionProposalForm.StringListChange(Sender: TObject); +begin + FScrollbar.Position := Position; +end; + +function TSynBaseCompletionProposalForm.IsWordBreakChar(AChar: WideChar): Boolean; +begin + Result := (Owner as TSynBaseCompletionProposal).IsWordBreakChar(AChar); +end; + +procedure TSynBaseCompletionProposalForm.WMMouseWheel(var Msg: TMessage); +var + nDelta: Integer; + nWheelClicks: Integer; +{$IFNDEF SYN_COMPILER_4_UP} +const + LinesToScroll = 3; + WHEEL_DELTA = 120; + WHEEL_PAGESCROLL = MAXDWORD; + {$IFNDEF SYN_COMPILER_3_UP} + SPI_GETWHEELSCROLLLINES = 104; + {$ENDIF} +{$ENDIF} +begin + if csDesigning in ComponentState then Exit; + +{$IFDEF SYN_COMPILER_4_UP} + if GetKeyState(VK_CONTROL) >= 0 then nDelta := Mouse.WheelScrollLines +{$ELSE} + if GetKeyState(VK_CONTROL) >= 0 then + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @nDelta, 0) +{$ENDIF} + else nDelta := FLinesInWindow; + + Inc(FMouseWheelAccumulator, SmallInt(Msg.wParamHi)); + nWheelClicks := FMouseWheelAccumulator div WHEEL_DELTA; + FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DELTA; + if (nDelta = Integer(WHEEL_PAGESCROLL)) or (nDelta > FLinesInWindow) then + nDelta := FLinesInWindow; + + Position := Position - (nDelta * nWheelClicks); +// (CurrentEditor as TCustomSynEdit).UpdateCaret; +end; + +function GetMDIParent (const Form: TSynForm): TSynForm; +{ Returns the parent of the specified MDI child form. But, if Form isn't a + MDI child, it simply returns Form. } +var + I, J: Integer; +begin + Result := Form; + if Form = nil then + Exit; + if (Form is TSynForm) and + ((Form as TForm).FormStyle = fsMDIChild) then + for I := 0 to Screen.FormCount-1 do + with Screen.Forms[I] do + begin + if FormStyle <> fsMDIForm then Continue; + for J := 0 to MDIChildCount-1 do + if MDIChildren[J] = Form then + begin + Result := Screen.Forms[I]; + Exit; + end; + end; +end; + +procedure TSynBaseCompletionProposalForm.WMActivate(var Message: TWMActivate); +var + ParentForm: TSynForm; +begin + if csDesigning in ComponentState then begin + inherited; + Exit; + end; + {Owner of the component that created me} + if Owner.Owner is TSynForm then + ParentForm := GetMDIParent(Owner.Owner as TSynForm) + else + ParentForm := nil; + + if Assigned(ParentForm) and ParentForm.HandleAllocated then + SendMessage(ParentForm.Handle, WM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0); +end; + +procedure TSynBaseCompletionProposalForm.WMChar(var Msg: TWMChar); +begin + if Win32PlatformIsUnicode then + DoKeyPressW(WideChar(Msg.CharCode)) + else + DoKeyPressW(KeyUnicode(AnsiChar(Msg.CharCode))); +end; + +procedure TSynBaseCompletionProposalForm.DoFormHide(Sender: TObject); +begin + if CurrentEditor <> nil then + begin + (CurrentEditor as TCustomSynEdit).AlwaysShowCaret := FOldShowCaret; +// (CurrentEditor as TCustomSynEdit).UpdateCaret; + if DisplayType = ctCode then + begin + (Owner as TSynBaseCompletionProposal).FWidth := Width; + (Owner as TSynBaseCompletionProposal).FNbLinesInWindow := FLinesInWindow; + end; + end; + if Assigned((Owner as TSynBaseCompletionProposal).OnClose) then + TSynBaseCompletionProposal(Owner).OnClose(Self); +end; + +procedure TSynBaseCompletionProposalForm.DoFormShow(Sender: TObject); +begin + if Assigned(CurrentEditor) then + begin + with CurrentEditor as TCustomSynEdit do + begin + FOldShowCaret := AlwaysShowCaret; + AlwaysShowCaret := Focused; +// UpdateCaret; + end; + end; + if Assigned((Owner as TSynBaseCompletionProposal).OnShow) then + (Owner as TSynBaseCompletionProposal).OnShow(Self); +end; + +procedure TSynBaseCompletionProposalForm.WMEraseBackgrnd( + var Message: TMessage); +begin + Message.Result:=1; +end; + +procedure TSynBaseCompletionProposalForm.WMGetDlgCode(var Message: TWMGetDlgCode); +begin + inherited; + Message.Result := Message.Result or DLGC_WANTTAB; +end; + +procedure TSynBaseCompletionProposalForm.AdjustMetrics; +begin + if DisplayType = ctCode then + begin + if FTitle <> '' then + FHeightBuffer := FTitleFontHeight + 4 {Margin} + else + FHeightBuffer := 0; + + if (ClientWidth >= FScrollbar.Width) and (ClientHeight >= FHeightBuffer) then + begin + FBitmap.Width := ClientWidth - FScrollbar.Width; + FBitmap.Height := ClientHeight - FHeightBuffer; + end; + + if (ClientWidth > 0) and (FHeightBuffer > 0) then + begin + FTitleBitmap.Width := ClientWidth; + FTitleBitmap.Height := FHeightBuffer; + end; + end else + begin + if (ClientWidth > 0) and (ClientHeight > 0) then + begin + FBitmap.Width := ClientWidth; + FBitmap.Height := ClientHeight; + end; + end; +end; + + +procedure TSynBaseCompletionProposalForm.AdjustScrollBarPosition; +begin + if FDisplayKind = ctCode then + begin + if Assigned(FScrollbar) then + begin + FScrollbar.Top := FHeightBuffer; + FScrollbar.Height := ClientHeight - FHeightBuffer; + FScrollbar.Left := ClientWidth - FScrollbar.Width; + + if FAssignedList.Count - FLinesInWindow < 0 then + begin + {$IFDEF SYN_DELPHI_4_UP} + FScrollbar.PageSize := 0; + {$ENDIF} + FScrollbar.Max := 0; + FScrollbar.Enabled := False; + end else + begin + {$IFDEF SYN_DELPHI_4_UP} + FScrollbar.PageSize := 0; + {$ENDIF} + FScrollbar.Max := FAssignedList.Count - FLinesInWindow; + if FScrollbar.Max <> 0 then + begin + FScrollbar.LargeChange := FLinesInWindow; + {$IFDEF SYN_DELPHI_4_UP} + FScrollbar.PageSize := 1; + {$ENDIF} + FScrollbar.Enabled := True; + end else + FScrollbar.Enabled := False; + end; + end; + end; +end; + +procedure TSynBaseCompletionProposalForm.SetTitle(const Value: UnicodeString); +begin + FTitle := Value; + AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.SetFont(const Value: TFont); +begin + FFont.Assign(Value); + RecalcItemHeight; + AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.SetTitleFont(const Value: TFont); +begin + FTitleFont.Assign(Value); + FTitleFontHeight := TextHeight(Canvas, TextHeightString); + AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.SetColumns(Value: TProposalColumns); +begin + FColumns.Assign(Value); +end; + + +procedure TSynBaseCompletionProposalForm.TitleFontChange(Sender: TObject); +begin + Canvas.Font.Assign(FTitleFont); + FTitleFontHeight := TextHeight(Canvas, TextHeightString); + AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.FontChange(Sender: TObject); +begin + RecalcItemHeight; + AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.Notification(AComponent: TComponent; + Operation: TOperation); +begin + if (Operation = opRemove) then + begin + if AComponent = FImages then + Images := nil; + end; + + inherited Notification(AComponent, Operation); +end; + + +{ TSynBaseCompletionProposal } + +constructor TSynBaseCompletionProposal.Create(Aowner: TComponent); +begin + FWidth := 260; + FNbLinesInWindow := 8; + inherited Create(AOwner); + FForm := TSynBaseCompletionProposalForm.Create(Self); + EndOfTokenChr := DefaultEndOfTokenChr; + FDotOffset := 0; + DefaultType := ctCode; +end; + +procedure TSynBaseCompletionProposal.Execute(s: UnicodeString; x, y: Integer); +begin + ExecuteEx(s, x, y, DefaultType); +end; + +procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; Kind : SynCompletionType); + + function GetWorkAreaWidth: Integer; + begin + {$IFDEF SYN_COMPILER_5_UP} + Result := Screen.DesktopWidth; + {$ELSE} + Result := Screen.Width; + {$ENDIF} + end; + + function GetWorkAreaHeight: Integer; + begin + {$IFDEF SYN_COMPILER_5_UP} + Result := Screen.DesktopHeight; + {$ELSE} + Result := Screen.Height; + {$ENDIF} + end; + + function GetParamWidth(const S: UnicodeString): Integer; + var + i: Integer; + List: TUnicodeStringList; + NewWidth: Integer; + begin + List := TUnicodeStringList.Create; + try + List.CommaText := S; + + Result := 0; + for i := -1 to List.Count -1 do + begin + NewWidth := FormattedTextWidth(Form.Canvas, + FormatParamList(S, i), Columns, FForm.Images); + + if NewWidth > Result then + Result := NewWidth; + end; + finally + List.Free; + end; + end; + + procedure RecalcFormPlacement; + var + i: Integer; + tmpWidth: Integer; + tmpHeight: Integer; + tmpX: Integer; + tmpY: Integer; + tmpStr: UnicodeString; + BorderWidth: Integer; + NewWidth: Integer; + begin + + tmpX := x; + tmpY := y; + tmpWidth := 0; + tmpHeight := 0; + case Kind of + ctCode: + begin + BorderWidth := 2 * GetSystemMetrics(SM_CYSIZEFRAME); + + tmpWidth := FWidth; + tmpHeight := Form.FHeightBuffer + Form.FEffectiveItemHeight * FNbLinesInWindow + BorderWidth; + end; + ctHint: + begin + BorderWidth := 2; + tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + BorderWidth + + 2 * Form.Margin; + + Form.Canvas.Font.Assign(Font); + for i := 0 to ItemList.Count -1 do + begin + tmpStr := ItemList[i]; + NewWidth := FormattedTextWidth(Form.Canvas, tmpStr, nil, FForm.Images); + if NewWidth > tmpWidth then + tmpWidth := NewWidth; + end; + + Inc(tmpWidth, 2 * FForm.Margin +BorderWidth); + end; + ctParams: + begin + BorderWidth := 2; + tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + BorderWidth + + 2 * Form.Margin; + + Form.Canvas.Font.Assign(Font); + for i := 0 to ItemList.Count -1 do + begin + NewWidth := GetParamWidth(StripFormatCommands(ItemList[i])); + + if Assigned(Form.OnMeasureItem) then + Form.OnMeasureItem(Self, i, Form.Canvas, NewWidth); + + if NewWidth > tmpWidth then + tmpWidth := NewWidth; + end; + + Inc(tmpWidth, 2 * FForm.Margin +BorderWidth); + end; + end; + + + if tmpX + tmpWidth > GetWorkAreaWidth then + begin + tmpX := GetWorkAreaWidth - tmpWidth - 5; //small space buffer + if tmpX < 0 then + tmpX := 0; + end; + + if tmpY + tmpHeight > GetWorkAreaHeight then + begin + tmpY := tmpY - tmpHeight - (Form.CurrentEditor as TCustomSynEdit).LineHeight -2; + if tmpY < 0 then + tmpY := 0; + end; + + Form.Width := tmpWidth; + Form.Height := tmpHeight; + Form.Top := tmpY; + Form.Left := tmpX; + end; + +var + TmpOffset: Integer; + {$IFDEF SYN_DELPHI_XE_UP} + ParentForm: TCustomForm; + {$ENDIF} +begin + DisplayType := Kind; + + FCanExecute := True; + if Assigned(OnExecute) then + OnExecute(Kind, Self, s, x, y, FCanExecute); + + if (not FCanExecute) or (ItemList.Count = 0) then + begin + if Form.Visible and (Kind = ctParams) then + Form.Visible := False; + Exit; + end; + +{$IFDEF SYN_DELPHI_XE_UP} + ParentForm := GetParentForm(Form.CurrentEditor); + if Assigned(ParentForm) then + begin + Form.PopupMode := pmExplicit; + Form.PopupParent := ParentForm; + end + else + begin + Form.PopupMode := pmNone; + Form.FormStyle := fsStayOnTop; + end; +{$ELSE} + Form.FormStyle := fsStayOnTop; +{$ENDIF} + + if Assigned(Form.CurrentEditor) then + begin + TmpOffset := TextWidth((Form.CurrentEditor as TCustomSynEdit).Canvas, Copy(s, 1, DotOffset)); + if DotOffset > 1 then + TmpOffset := TmpOffset + (3 * (DotOffset -1)) + end else + TmpOffset := 0; + x := x - tmpOffset; + + ResetAssignedList; + + case Kind of + ctCode: + if Form.AssignedList.Count > 0 then + begin + //This may seem redundant, but it fixes scrolling bugs for the first time + //That is the only time these occur + Position := 0; + Form.AdjustScrollBarPosition; + Form.FScrollbar.Position := Form.Position; + Form.FScrollbar.Visible := True; + + RecalcFormPlacement; + Form.Show; + + CurrentString := s; // bug id 1496148 + end; + ctParams, ctHint: + begin + Form.FScrollbar.Visible := False; + + RecalcFormPlacement; + + ShowWindow(Form.Handle, SW_SHOWNA); + Form.Visible := True; + Form.Repaint; + end; + end; +end; + +function TSynBaseCompletionProposal.GetCurrentString: UnicodeString; +begin + Result := Form.CurrentString; +end; + +function TSynBaseCompletionProposal.GetItemList: TUnicodeStrings; +begin + Result := Form.ItemList; +end; + +function TSynBaseCompletionProposal.GetInsertList: TUnicodeStrings; +begin + Result := Form.InsertList; +end; + +function TSynBaseCompletionProposal.GetOnCancel: TNotifyEvent; +begin + Result := Form.OnCancel; +end; + +function TSynBaseCompletionProposal.GetOnKeyPress: TKeyPressWEvent; +begin + Result := Form.OnKeyPress; +end; + +function TSynBaseCompletionProposal.GetOnPaintItem: TSynBaseCompletionProposalPaintItem; +begin + Result := Form.OnPaintItem; +end; + +function TSynBaseCompletionProposal.GetOnMeasureItem: TSynBaseCompletionProposalMeasureItem; +begin + Result := Form.OnMeasureItem; +end; + +function TSynBaseCompletionProposal.GetOnValidate: TValidateEvent; +begin + Result := Form.OnValidate; +end; + +function TSynBaseCompletionProposal.GetPosition: Integer; +begin + Result := Form.Position; +end; + +procedure TSynBaseCompletionProposal.SetCurrentString(const Value: UnicodeString); +begin + Form.CurrentString := Value; +end; + +procedure TSynBaseCompletionProposal.SetItemList(const Value: TUnicodeStrings); +begin + Form.ItemList := Value; +end; + +procedure TSynBaseCompletionProposal.SetInsertList(const Value: TUnicodeStrings); +begin + Form.InsertList := Value; +end; + +procedure TSynBaseCompletionProposal.SetNbLinesInWindow(const Value: Integer); +begin + FNbLinesInWindow := Value; +end; + +procedure TSynBaseCompletionProposal.SetOnCancel(const Value: TNotifyEvent); +begin + Form.OnCancel := Value; +end; + +procedure TSynBaseCompletionProposal.SetOnKeyPress(const Value: TKeyPressWEvent); +begin + Form.OnKeyPress := Value; +end; + +procedure TSynBaseCompletionProposal.SetOnPaintItem(const Value: + TSynBaseCompletionProposalPaintItem); +begin + Form.OnPaintItem := Value; +end; + +procedure TSynBaseCompletionProposal.SetOnMeasureItem(const Value: + TSynBaseCompletionProposalMeasureItem); +begin + Form.OnMeasureItem := Value; +end; + + +procedure TSynBaseCompletionProposal.SetPosition(const Value: Integer); +begin + form.Position := Value; +end; + +procedure TSynBaseCompletionProposal.SetOnValidate(const Value: TValidateEvent); +begin + form.OnValidate := Value; +end; + +function TSynBaseCompletionProposal.GetClSelect: TColor; +begin + Result := Form.ClSelect; +end; + +procedure TSynBaseCompletionProposal.SetClSelect(const Value: TColor); +begin + Form.ClSelect := Value; +end; + +procedure TSynBaseCompletionProposal.SetWidth(Value: Integer); +begin + FWidth := Value; +end; + +procedure TSynBaseCompletionProposal.Activate; +begin + if Assigned(Form) then + Form.Activate; +end; + +procedure TSynBaseCompletionProposal.Deactivate; +begin + if Assigned(Form) then + Form.Deactivate; +end; + +procedure TSynBaseCompletionProposal.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +function TSynBaseCompletionProposal.GetClBack(AIndex: Integer): TColor; +begin + case AIndex of + 1: Result := Form.ClBackground; + 2: Result := Form.ClBackgroundBorder; + else + Result := clNone; + end; +end; + +procedure TSynBaseCompletionProposal.SetClBack(AIndex: Integer; const Value: TColor); +begin + case AIndex of + 1: Form.ClBackground := Value; + 2: Form.ClBackgroundBorder := Value; + end; +end; + +function TSynBaseCompletionProposal.GetClSelectedText: TColor; +begin + Result := Form.ClSelectedText; +end; + +procedure TSynBaseCompletionProposal.SetClSelectedText(const Value: TColor); +begin + Form.ClSelectedText := Value; +end; + +procedure TSynBaseCompletionProposal.AddItem(ADisplayText, AInsertText: UnicodeString); +begin + GetInsertList.Add(AInsertText); + GetItemList.Add(ADisplayText); +end; + +procedure TSynBaseCompletionProposal.AddItemAt(Where: Integer; ADisplayText, AInsertText: UnicodeString); +begin + try + GetInsertList.Insert(Where, AInsertText); + GetItemList.Insert(Where, ADisplayText); + except + raise Exception.Create('Cannot insert item at position ' + IntToStr(Where) + '.'); + end; +end; + +procedure TSynBaseCompletionProposal.ClearList; +begin + GetInsertList.Clear; + GetItemList.Clear; +end; + +function TSynBaseCompletionProposal.DisplayItem(AIndex : Integer): UnicodeString; +begin + Result := GetItemList[AIndex]; +end; + +function TSynBaseCompletionProposal.InsertItem(AIndex : Integer): UnicodeString; +begin + Result := GetInsertList[AIndex]; +end; + +function TSynBaseCompletionProposal.IsWordBreakChar(AChar: WideChar): Boolean; +begin + Result := False; + if (scoConsiderWordBreakChars in Options) and Assigned(Form) and + Assigned(Form.CurrentEditor) + then + Result := Form.CurrentEditor.IsWordBreakChar(AChar); + Result := Result or (Pos(AChar, EndOfTokenChr) > 0); +end; + +function TSynBaseCompletionProposal.GetDisplayKind: SynCompletionType; +begin + Result := Form.DisplayType; +end; + +procedure TSynBaseCompletionProposal.SetDisplayKind(const Value: SynCompletionType); +begin + Form.DisplayType := Value; +end; + +function TSynBaseCompletionProposal.GetParameterToken: TCompletionParameter; +begin + Result := Form.OnParameterToken; +end; + +procedure TSynBaseCompletionProposal.SetParameterToken( + const Value: TCompletionParameter); +begin + Form.OnParameterToken := Value; +end; + +procedure TSynBaseCompletionProposal.SetColumns(const Value: TProposalColumns); +begin + FForm.Columns := Value; +end; + +function TSynBaseCompletionProposal.GetColumns: TProposalColumns; +begin + Result := FForm.Columns; +end; + +function TSynBaseCompletionProposal.GetResizeable: Boolean; +begin + Result := FForm.Resizeable; +end; + +procedure TSynBaseCompletionProposal.SetResizeable(const Value: Boolean); +begin + if FForm.Resizeable <> Value then + FForm.Resizeable := Value; +end; + +function TSynBaseCompletionProposal.GetItemHeight: Integer; +begin + Result := FForm.ItemHeight; +end; + +procedure TSynBaseCompletionProposal.SetItemHeight(const Value: Integer); +begin + if FForm.ItemHeight <> Value then + FForm.ItemHeight := Value; +end; + +procedure TSynBaseCompletionProposal.SetImages(const Value: TImageList); +begin + FForm.Images := Value; +end; + +function TSynBaseCompletionProposal.GetImages: TImageList; +begin + Result := FForm.Images; +end; + +function TSynBaseCompletionProposal.GetMargin: Integer; +begin + Result := FForm.Margin; +end; + +procedure TSynBaseCompletionProposal.SetMargin(const Value: Integer); +begin + if Value <> FForm.Margin then + FForm.Margin := Value; +end; + +function TSynBaseCompletionProposal.GetDefaultKind: SynCompletionType; +begin + Result := Form.DefaultType; +end; + +procedure TSynBaseCompletionProposal.SetDefaultKind(const Value: SynCompletionType); +begin + Form.DefaultType := Value; + Form.DisplayType := Value; + Form.RecreateWnd; +end; + +procedure TSynBaseCompletionProposal.SetEndOfTokenChar( + const Value: UnicodeString); +begin + if Form.FEndOfTokenChr <> Value then + begin + Form.FEndOfTokenChr := Value; + end; +end; + +function TSynBaseCompletionProposal.GetClTitleBackground: TColor; +begin + Result := Form.ClTitleBackground; +end; + +procedure TSynBaseCompletionProposal.SetClTitleBackground( + const Value: TColor); +begin + Form.ClTitleBackground := Value; +end; + +function TSynBaseCompletionProposal.GetTitle: UnicodeString; +begin + Result := Form.Title; +end; + +procedure TSynBaseCompletionProposal.SetTitle(const Value: UnicodeString); +begin + Form.Title := Value; +end; + +function TSynBaseCompletionProposal.GetFont: TFont; +begin + Result := Form.Font; +end; + +function TSynBaseCompletionProposal.GetTitleFont: TFont; +begin + Result := Form.TitleFont; +end; + +procedure TSynBaseCompletionProposal.SetFont(const Value: TFont); +begin + Form.Font := Value; +end; + +procedure TSynBaseCompletionProposal.SetTitleFont(const Value: TFont); +begin + Form.TitleFont := Value; +end; + +function TSynBaseCompletionProposal.GetEndOfTokenChar: UnicodeString; +begin + Result := Form.EndOfTokenChr; +end; + +function TSynBaseCompletionProposal.GetOptions: TSynCompletionOptions; +begin + Result := FOptions; +end; + +procedure TSynBaseCompletionProposal.SetOptions( + const Value: TSynCompletionOptions); +begin + if FOptions <> Value then + begin + FOptions := Value; + Form.CenterTitle := scoTitleIsCentered in Value; + Form.CaseSensitive := scoCaseSensitive in Value; + Form.UsePrettyText := scoUsePrettyText in Value; + Form.UseInsertList := scoUseInsertList in Value; + Form.MatchText := scoLimitToMatchedText in Value; + Form.MatchTextAnywhere := scoLimitToMatchedTextAnywhere in Value; + Form.CompleteWithTab := scoCompleteWithTab in Value; + Form.CompleteWithEnter := scoCompleteWithEnter in Value; + end; +end; + +function TSynBaseCompletionProposal.GetTriggerChars: UnicodeString; +begin + Result := Form.TriggerChars; +end; + +procedure TSynBaseCompletionProposal.SetTriggerChars(const Value: UnicodeString); +begin + Form.TriggerChars := Value; +end; + +procedure TSynBaseCompletionProposal.EditorCancelMode(Sender: TObject); +begin + //Do nothing here, used in TSynCompletionProposal +end; + +procedure TSynBaseCompletionProposal.HookedEditorCommand(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; + var AChar: WideChar; Data, HandlerData: Pointer); +begin + // Do nothing here, used in TSynCompletionProposal +end; + +function TSynBaseCompletionProposal.GetOnChange: TCompletionChange; +begin + Result := Form.FOnChangePosition; +end; + +procedure TSynBaseCompletionProposal.SetOnChange( + const Value: TCompletionChange); +begin + Form.FOnChangePosition := Value; +end; + +procedure TSynBaseCompletionProposal.ResetAssignedList; +begin + Form.AssignedList.Assign(ItemList); +end; + +{ ---------------- TSynCompletionProposal -------------- } + +procedure TSynCompletionProposal.HandleOnCancel(Sender: TObject); +var + F: TSynBaseCompletionProposalForm; +begin + F := Sender as TSynBaseCompletionProposalForm; + FNoNextKey := False; + if F.CurrentEditor <> nil then + begin + if Assigned(FTimer) then + FTimer.Enabled := False; + + F.Hide; + + if ((F.CurrentEditor as TCustomSynEdit).Owner is TWinControl) and + (((F.CurrentEditor as TCustomSynEdit).Owner as TWinControl).Visible) then + begin + ((F.CurrentEditor as TCustomSynEdit).Owner as TWinControl).SetFocus; + end; + + (F.CurrentEditor as TCustomSynEdit).SetFocus; + + if Assigned(OnCancelled) then + OnCancelled(Self); + end; +end; + +procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; + Shift: TShiftState; EndToken: WideChar); +var + F: TSynBaseCompletionProposalForm; + Value: UnicodeString; + Index: Integer; +begin + F := Sender as TSynBaseCompletionProposalForm; + if Assigned(F.CurrentEditor) then + with F.CurrentEditor as TCustomSynEdit do + begin + //Treat entire completion as a single undo operation + BeginUpdate; + BeginUndoBlock; + try + if FAdjustCompletionStart then + FCompletionStart := BufferCoord(FCompletionStart, CaretY).Char; + BlockBegin := BufferCoord(FCompletionStart, CaretY); + if EndToken = #0 then + BlockEnd := BufferCoord(WordEnd.Char, CaretY) + else + BlockEnd := BufferCoord(CaretX, CaretY); + + if scoUseInsertList in FOptions then + begin + if scoLimitToMatchedText in FOptions then + begin + if (Form.FAssignedList.Count > Position) then + // Added check to make sure item is only used when no EndChar + if (InsertList.Count > Integer(Form.FAssignedList.Objects[position])) and + ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then + Value := InsertList[Integer(Form.FAssignedList.Objects[position])] + else + Value := SelText + else + Value := SelText; + end else + begin + // Added check to make sure item is only used when no EndChar + if (InsertList.Count > Position) and + ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then + Value := InsertList[position] + else + Value := SelText; + end; + end else + begin + // Added check to make sure item is only used when no EndChar + if (Form.FAssignedList.Count > Position) and + ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then + Value := Form.FAssignedList[Position] + else + Value := SelText; + end; + Index := Position; // need to assign position to temp var since it changes later + + if Assigned(FOnCodeCompletion) then + FOnCodeCompletion(Self, Value, Shift, + F.LogicalToPhysicalIndex(Index), EndToken); + + if SelText <> Value then + SelText := Value; + + with (F.CurrentEditor as TCustomSynEdit) do + begin + //This replaces the previous way of cancelling the completion by + //sending a WM_MOUSEDOWN message. The problem with the mouse down is + //that the editor would bounce back to the left margin, very irritating + InternalCancelCompletion; + SetFocus; + EnsureCursorPosVisible; + CaretXY := BlockEnd; + BlockBegin := CaretXY; + end; + if Assigned(FOnAfterCodeCompletion) then + FOnAfterCodeCompletion(Self, Value, Shift, + F.LogicalToPhysicalIndex(Index), EndToken); + + finally + EndUndoBlock; + EndUpdate; + end; + end; +end; + +procedure TSynCompletionProposal.HandleOnKeyPress(Sender: TObject; var Key: WideChar); +var + F: TSynBaseCompletionProposalForm; +begin + F := Sender as TSynBaseCompletionProposalForm; + if F.CurrentEditor <> nil then + begin + with F.CurrentEditor as TCustomSynEdit do + CommandProcessor(ecChar, Key, nil); + //Daisy chain completions + Application.ProcessMessages; + if (System.Pos(Key, TriggerChars) > 0) and not F.Visible then + begin + if (Sender is TCustomSynEdit) then + DoExecute(Sender as TCustomSynEdit) + else + if Assigned(Form.CurrentEditor) then + DoExecute(Form.CurrentEditor as TCustomSynEdit); + end; + end; +end; + +procedure TSynCompletionProposal.SetEditor(const Value: TCustomSynEdit); +begin + if Editor <> Value then + begin + if Assigned(Editor) then + RemoveEditor(Editor); + FEditor := Value; + if Assigned(Value) then + AddEditor(Value); + end; +end; + +procedure TSynCompletionProposal.Notification(AComponent: TComponent; + Operation: TOperation); +begin + if (Operation = opRemove) then + begin + if Editor = AComponent then + Editor := nil + else if AComponent is TCustomSynEdit then + RemoveEditor(TCustomSynEdit(AComponent)); + end; + + inherited Notification(AComponent, Operation); +end; + +constructor TSynCompletionProposal.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Form.OnKeyPress := HandleOnKeyPress; + Form.OnValidate := HandleOnValidate; + Form.OnCancel := HandleOnCancel; + Form.OnDblClick := HandleDblClick; + EndOfTokenChr := DefaultEndOfTokenChr; + TriggerChars := '.'; + FTimerInterval:= 1000; + FNoNextKey := False; + + FShortCut := Menus.ShortCut(Ord(' '), [ssCtrl]); + Options := DefaultProposalOptions; + FEditors := TList.Create; +end; + +procedure TSynCompletionProposal.SetShortCut(Value: TShortCut); +begin + FShortCut := Value; +end; + +procedure TSynCompletionProposal.EditorKeyDown(Sender: TObject; + var Key: Word; Shift: TShiftState); +var + ShortCutKey: Word; + ShortCutShift: TShiftState; +begin + ShortCutToKey (FShortCut,ShortCutKey,ShortCutShift); + with Sender as TCustomSynEdit do + begin + if ((DefaultType <> ctCode) or not(ReadOnly)) and (Shift = ShortCutShift) and (Key = ShortCutKey) then + begin + Form.CurrentEditor := Sender as TCustomSynEdit; + Key := 0; + DoExecute(Sender as TCustomSynEdit); + end; + end; +end; + +function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): UnicodeString; +var + s: UnicodeString; + i: Integer; +begin + Result := ''; + if AEditor <> nil then + begin + s := AEditor.LineText; + i := AEditor.CaretX - 1; + if i <= Length(s) then + begin + FAdjustCompletionStart := False; + while (i > 0) and (s[i] > #32) and not Self.IsWordBreakChar(s[i]) do + Dec(i); + + FCompletionStart := i + 1; + Result := Copy(s, i + 1, AEditor.CaretX - i - 1); + end + else + FAdjustCompletionStart := True; + + FCompletionStart := i + 1; + end; +end; + +function TSynCompletionProposal.GetPreviousToken(AEditor: TCustomSynEdit): UnicodeString; +var + Line: UnicodeString; + X: Integer; +begin + Result := ''; + if not Assigned(AEditor) then + Exit; + + Line := AEditor.Lines[AEditor.CaretXY.Line - 1]; + X := AEditor.CaretXY.Char - 1; + if (X = 0) or (X > Length(Line)) or (Length(Line) = 0) then + Exit; + + if Self.IsWordBreakChar(Line[X]) then + Dec(X); + + while (X > 0) and not(Self.IsWordBreakChar(Line[X])) do + begin + Result := Line[X] + Result; + Dec(x); + end; +end; + +procedure TSynCompletionProposal.EditorKeyPress(Sender: TObject; var Key: WideChar); +begin + if FNoNextKey then + begin + FNoNextKey := False; + Key := #0; + end + else + if Assigned(FTimer) then + begin + if Pos(Key, TriggerChars) <> 0 then + ActivateTimer(Sender as TCustomSynEdit) + else + DeactivateTimer; + end; +end; + +procedure TSynCompletionProposal.ActivateTimer(ACurrentEditor: TCustomSynEdit); +begin + if Assigned(FTimer) then + begin + Form.CurrentEditor := ACurrentEditor; + FTimer.Enabled := True; + end; +end; + +procedure TSynCompletionProposal.DeactivateTimer; +begin + if Assigned(FTimer) then + begin + FTimer.Enabled := False; + end; +end; + + +procedure TSynCompletionProposal.HandleDblClick(Sender: TObject); +begin + HandleOnValidate(Sender, [], #0); +end; + +destructor TSynCompletionProposal.Destroy; +begin + if Form.Visible then + CancelCompletion; + Editor := nil; + while FEditors.Count <> 0 do + RemoveEditor(TCustomSynEdit(FEditors.Last)); + + inherited; + + FEditors.Free; +end; + +procedure TSynCompletionProposal.TimerExecute(Sender: TObject); +begin + if not Assigned(FTimer) then Exit; + FTimer.Enabled := False; + if Application.Active then + begin + DoExecute(Form.CurrentEditor as TCustomSynEdit); + FNoNextKey := False; + end else if Form.Visible then Form.Hide; +end; + +function TSynCompletionProposal.GetTimerInterval: Integer; +begin + Result := FTimerInterval; +end; + +procedure TSynCompletionProposal.SetTimerInterval(const Value: Integer); +begin + FTimerInterval := Value; + if Assigned(FTimer) then + FTimer.Interval := Value; +end; + +procedure TSynCompletionProposal.SetOptions(const Value: TSynCompletionOptions); +begin + inherited; + + if scoUseBuiltInTimer in Value then + begin + if not(Assigned(FTimer)) then + begin + FTimer := TTimer.Create(Self); + FTimer.Enabled := False; + FTimer.Interval := FTimerInterval; + FTimer.OnTimer := TimerExecute; + end; + end else begin + if Assigned(FTimer) then + begin + FreeAndNil(FTimer); + end; + end; + +end; + +procedure TSynCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; + Kind: SynCompletionType); +begin + inherited; + if Assigned(FTimer) then + FTimer.Enabled := False; +end; + +procedure TSynCompletionProposal.AddEditor(AEditor: TCustomSynEdit); +var + i : Integer; +begin + i := FEditors.IndexOf(AEditor); + if i = -1 then begin + AEditor.FreeNotification(Self); + FEditors.Add(AEditor); + AEditor.AddKeyDownHandler(EditorKeyDown); + AEditor.AddKeyPressHandler(EditorKeyPress); + AEditor.RegisterCommandHandler(HookedEditorCommand, Self); + end; +end; + +function TSynCompletionProposal.EditorsCount: Integer; +begin + Result := FEditors.count; +end; + +function TSynCompletionProposal.GetEditor(i: Integer): TCustomSynEdit; +begin + if (i < 0) or (i >= EditorsCount) then + Result := nil + else + Result := FEditors[i]; +end; + +function TSynCompletionProposal.RemoveEditor(AEditor: TCustomSynEdit): Boolean; +var + i: Integer; +begin + i := FEditors.Remove(AEditor); + Result := i <> -1; + if Result then begin + if Form.CurrentEditor = AEditor then + begin + if Form.Visible then + CancelCompletion; + Form.CurrentEditor := nil; + end; + AEditor.RemoveKeyDownHandler(EditorKeyDown); + AEditor.RemoveKeyPressHandler(EditorKeyPress); + AEditor.UnregisterCommandHandler(HookedEditorCommand); + {$IFDEF SYN_COMPILER_5_UP} + RemoveFreeNotification( AEditor ); + {$ENDIF} + if FEditor = AEditor then + FEditor := nil; + end; +end; + +procedure TSynCompletionProposal.DoExecute(AEditor: TCustomSynEdit); +var + p: TPoint; + i: Integer; +begin + i := FEditors.IndexOf(AEditor); + if i <> -1 then + with AEditor do + begin + if (DefaultType <> ctCode) or not ReadOnly then + begin + if DefaultType = ctHint then + GetCursorPos(P) + else + begin + p := ClientToScreen(RowColumnToPixels(DisplayXY)); + Inc(p.y, LineHeight); + end; + + Form.CurrentEditor := AEditor; + + FPreviousToken := GetPreviousToken(Form.CurrentEditor as TCustomSynEdit); + ExecuteEx(GetCurrentInput(AEditor), p.x, p.y, DefaultType); + FNoNextKey := (DefaultType = ctCode) and FCanExecute and Form.Visible; + end; + end; +end; + +procedure TSynCompletionProposal.InternalCancelCompletion; +begin + if Assigned(FTimer) then FTimer.Enabled := False; + FNoNextKey := False; + if (Form.Visible) then + begin + Deactivate; + Form.Hide; + end; +end; + +procedure TSynCompletionProposal.CancelCompletion; +begin + InternalCancelCompletion; + if Assigned(OnCancelled) then OnCancelled(Self); +end; + +procedure TSynCompletionProposal.EditorCancelMode(Sender: TObject); +begin + if (DisplayType = ctParams) then CancelCompletion; +end; + +procedure TSynCompletionProposal.HookedEditorCommand(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; + var AChar: WideChar; Data, HandlerData: Pointer); +begin + inherited; + + if AfterProcessing and Form.Visible then + begin + case DisplayType of + ctCode: + begin + + end; + ctHint: + CancelCompletion; + ctParams: + begin + case Command of + ecGotFocus, ecLostFocus: + CancelCompletion; + ecLineBreak: + DoExecute(Sender as TCustomSynEdit); + ecChar: + begin + case AChar of + #27: + CancelCompletion; + #32..'z': + with Form do + begin +{ if Pos(AChar, FTriggerChars) > 0 then + begin + if Assigned(FParameterToken) then + begin + TmpIndex := CurrentIndex; + TmpLevel := CurrentLevel; + TmpStr := CurrentString; + OnParameterToken(Self, CurrentIndex, TmpLevel, TmpIndex, AChar, TmpStr); + CurrentIndex := TmpIndex; + CurrentLevel := TmpLevel; + CurrentString := TmpStr; + end; + end;} + DoExecute(Sender as TCustomSynEdit); + end; + else DoExecute(Sender as TCustomSynEdit); + end; + end; + else DoExecute(Sender as TCustomSynEdit); + end; + end; + end; + end else + if (not Form.Visible) and Assigned(FTimer) then + begin + if (Command = ecChar) then + if (Pos(AChar, TriggerChars) = 0) then + FTimer.Enabled := False + else + else + FTimer.Enabled := False; + end; + +end; + +procedure TSynCompletionProposal.ActivateCompletion; +begin + DoExecute(Editor); +end; + + + +{ TSynAutoComplete } + +constructor TSynAutoComplete.Create(AOwner: TComponent); +begin + inherited; + FDoLookup := True; + CreateInternalCompletion; + FEndOfTokenChr := DefaultEndOfTokenChr; + fAutoCompleteList := TUnicodeStringList.Create; + FNoNextKey := False; + FShortCut := Menus.ShortCut(Ord(' '), [ssShift]); +end; + +procedure TSynAutoComplete.SetShortCut(Value: TShortCut); +begin + FShortCut := Value; +end; + +destructor TSynAutoComplete.Destroy; +begin + Editor := nil; + if Assigned(FInternalCompletion) then + begin + FInternalCompletion.Free; + FInternalCompletion := nil; + end; + inherited; + fAutoCompleteList.free; +end; + +procedure TSynAutoComplete.EditorKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +var + ShortCutKey: Word; + ShortCutShift: TShiftState; +begin + ShortCutToKey (FShortCut,ShortCutKey,ShortCutShift); + if not (Sender as TCustomSynEdit).ReadOnly and + (Shift = ShortCutShift) and (Key = ShortCutKey) then + begin + Execute(GetPreviousToken(Sender as TCustomSynEdit), Sender as TCustomSynEdit); + FNoNextKey := True; + Key := 0; + end; +end; + +procedure TSynAutoComplete.EditorKeyPress(Sender: TObject; var Key: WideChar); +begin + if FNoNextKey then + begin + FNoNextKey := False; + Key := #0; + end; +end; + +procedure TSynAutoComplete.Execute(Token: UnicodeString; Editor: TCustomSynEdit); +begin + ExecuteEx(Token, Editor, FDoLookup); +end; + +procedure TSynAutoComplete.ExecuteEx(Token: UnicodeString; Editor: TCustomSynEdit; + LookupIfNotExact: Boolean); +var + Temp: UnicodeString; + i, j: Integer; + StartOfBlock: TBufferCoord; + ChangedIndent: Boolean; + ChangedTrailing: Boolean; + TmpOptions: TSynEditorOptions; + OrigOptions: TSynEditorOptions; + BeginningSpaceCount : Integer; + Spacing: UnicodeString; +begin + if Assigned(OnBeforeExecute) then OnBeforeExecute(Self); + try + i := AutoCompleteList.IndexOf(Token); + if (i <> -1) then + begin + TmpOptions := Editor.Options; + OrigOptions := Editor.Options; + ChangedIndent := eoAutoIndent in TmpOptions; + ChangedTrailing := eoTrimTrailingSpaces in TmpOptions; + + if ChangedIndent then Exclude(TmpOptions, eoAutoIndent); + if ChangedTrailing then Exclude(TmpOptions, eoTrimTrailingSpaces); + + if ChangedIndent or ChangedTrailing then + Editor.Options := TmpOptions; + + Editor.UndoList.AddChange(crAutoCompleteBegin, StartOfBlock, StartOfBlock, '', + smNormal); + + FNoNextKey := True; + for j := 1 to Length(Token) do + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); + BeginningSpaceCount := Editor.DisplayX - 1; + if not(eoTabsToSpaces in Editor.Options) and + (BeginningSpaceCount >= Editor.TabWidth) + then + Spacing := UnicodeStringOfChar(#9, BeginningSpaceCount div Editor.TabWidth) + + UnicodeStringOfChar(' ', BeginningSpaceCount mod Editor.TabWidth) + else + Spacing := UnicodeStringOfChar(' ', BeginningSpaceCount); + + Inc(i); + if (i < AutoCompleteList.Count) and + (Length(AutoCompleteList[i]) > 0) and + (AutoCompleteList[i][1] = '|') then + begin + Inc(i); + end; + StartOfBlock.Char := -1; + StartOfBlock.Line := -1; + while (i < AutoCompleteList.Count) and + (length(AutoCompleteList[i]) > 0) and + (AutoCompleteList[i][1] = '=') do + begin + { for j := 0 to PrevSpace - 1 do + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);} + Temp := AutoCompleteList[i]; + for j := 2 to Length(Temp) do begin + if (Temp[j] = #9) then + Editor.CommandProcessor(ecTab, Temp[j], nil) + else + Editor.CommandProcessor(ecChar, Temp[j], nil); + if (Temp[j] = '|') then + StartOfBlock := Editor.CaretXY + end; + Inc(i); + if (i < AutoCompleteList.Count) and + (length(AutoCompleteList[i]) > 0) and + (AutoCompleteList[i][1] = '=') then + begin + Editor.CommandProcessor (ecLineBreak,' ',nil); + for j := 1 to length(Spacing) do + if (Spacing[j] = #9) then + Editor.CommandProcessor(ecTab, #9, nil) + else + Editor.CommandProcessor (ecChar, ' ', nil); + end; + end; + if (StartOfBlock.Char <> -1) and (StartOfBlock.Line <> -1) then begin + Editor.CaretXY := StartOfBlock; + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); + end; + + if ChangedIndent or ChangedTrailing then Editor.Options := OrigOptions; + + Editor.UndoList.AddChange(crAutoCompleteEnd, StartOfBlock, StartOfBlock, + '', smNormal); + FNoNextKey := False; + end + else if LookupIfNotExact and Assigned(FInternalCompletion) then + begin + FInternalCompletion.AddEditor(Editor); + FInternalCompletion.ClearList; + for i := 0 to AutoCompleteList.Count - 1 do + if (Length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') and (AutoCompleteList[i][1] <> '|') then + begin + if (i + 1 < AutoCompleteList.Count) and (length(AutoCompleteList[i + 1]) > 0) and + (AutoCompleteList[i + 1][1] = '|') then + begin + Temp := AutoCompleteList[i + 1]; + Delete(Temp, 1, 1); + end + else + Temp := AutoCompleteList[i]; + Temp := '\style{+B}' + AutoCompleteList[i] + '\style{-B}\column{}' + Temp; + FInternalCompletion.ItemList.Add(Temp); + FInternalCompletion.InsertList.Add(AutoCompleteList[i]); + end; + FInternalCompletion.DoExecute(Editor); + end; + finally + if Assigned(OnAfterExecute) then OnAfterExecute(Self); + end; +end; + +procedure TSynAutoComplete.DoInternalAutoCompletion(Sender: TObject; + const Value: UnicodeString; Shift: TShiftState; Index: Integer; EndToken: WideChar); +begin + ExecuteEx(GetPreviousToken(Editor), Editor, False); + FInternalCompletion.Editor := nil; +end; + +function TSynAutoComplete.GetPreviousToken(Editor: TCustomSynEdit): UnicodeString; +var + s: UnicodeString; + i: Integer; +begin + Result := ''; + if Editor <> nil then + begin + s := Editor.LineText; + i := Editor.CaretX - 1; + if i <= Length (s) then + begin + while (i > 0) and (s[i] > ' ') and (Pos(s[i], FEndOfTokenChr) = 0) do + Dec(i); + Result := copy(s, i + 1, Editor.CaretX - i - 1); + end; + end +end; + +procedure TSynAutoComplete.Notification(AComponent: TComponent; Operation: TOperation); +begin + if (Operation = opRemove) and (Editor = AComponent) then + Editor := nil; + inherited Notification(AComponent, Operation); +end; + +procedure TSynAutoComplete.SetAutoCompleteList(List: TUnicodeStrings); +begin + fAutoCompleteList.Assign(List); +end; + +procedure TSynAutoComplete.SetEditor(const Value: TCustomSynEdit); +begin + if Editor <> Value then + begin + if Editor <> nil then + begin + Editor.RemoveKeyDownHandler( EditorKeyDown ); + Editor.RemoveKeyPressHandler( EditorKeyPress ); + {$IFDEF SYN_COMPILER_5_UP} + RemoveFreeNotification( Editor ); + {$ENDIF} + end; + FEditor := Value; + if Editor <> nil then + begin + Editor.AddKeyDownHandler( EditorKeyDown ); + Editor.AddKeyPressHandler( EditorKeyPress ); + FreeNotification( Editor ); + end; + end; +end; + +function TSynAutoComplete.GetTokenList: UnicodeString; +var + List: TUnicodeStringList; + i: Integer; +begin + Result := ''; + if AutoCompleteList.Count < 1 then Exit; + List := TUnicodeStringList.Create; + i := 0; + while (i < AutoCompleteList.Count) do begin + if (length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') then + List.Add(WideTrim(AutoCompleteList[i])); + Inc(i); + end; + Result := List.Text; + List.Free; +end; + +function TSynAutoComplete.GetTokenValue(Token: UnicodeString): UnicodeString; +var + i: Integer; + List: TUnicodeStringList; +begin + Result := ''; + i := AutoCompleteList.IndexOf(Token); + if i <> -1 then + begin + List := TUnicodeStringList.Create; + Inc(i); + while (i < AutoCompleteList.Count) and + (length(AutoCompleteList[i]) > 0) and + (AutoCompleteList[i][1] = '=') do begin + if Length(AutoCompleteList[i]) = 1 then + List.Add('') + else + List.Add(Copy(AutoCompleteList[i], 2, Length(AutoCompleteList[i]))); + Inc(i); + end; + Result := List.Text; + List.Free; + end; +end; + +procedure TSynAutoComplete.SetDoLookup(const Value: Boolean); +begin + FDoLookup := Value; + if FDoLookup and not(Assigned(FInternalCompletion)) then + CreateInternalCompletion + else begin + FInternalCompletion.Free; + FInternalCompletion := nil; + end; +end; + +procedure TSynAutoComplete.CreateInternalCompletion; +begin + FInternalCompletion := TSynCompletionProposal.Create(Self); + FInternalCompletion.Options := DefaultProposalOptions + [scoUsePrettyText] - [scoUseBuiltInTimer]; + FInternalCompletion.EndOfTokenChr := FEndOfTokenChr; + FInternalCompletion.ShortCut := 0; + FInternalCompletion.OnAfterCodeCompletion := DoInternalAutoCompletion; +// with FInternalCompletion.Columns.Add do +// //this is the trigger column +// BiggestWord := 'XXXXXXXX'; +end; + +function TSynAutoComplete.GetOptions: TSynCompletionOptions; +begin + Result := FOptions; +end; + +procedure TSynAutoComplete.SetOptions(const Value: TSynCompletionOptions); +begin + FOptions := Value; + if Assigned(FInternalCompletion) then + FInternalCompletion.Options := FOptions + [scoUsePrettyText] - [scoUseBuiltInTimer]; +end; + +procedure TSynAutoComplete.CancelCompletion; +begin + if Assigned(FInternalCompletion) then + FInternalCompletion.CancelCompletion; +end; + +function TSynAutoComplete.GetExecuting: Boolean; +begin + if Assigned(FInternalCompletion) then + Result := FInternalCompletion.Form.Visible + else Result := False; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynDBEdit.pas b/Source/VCL/SynEdit/Source/SynDBEdit.pas index 57de1708..cd78fb71 100644 --- a/Source/VCL/SynEdit/Source/SynDBEdit.pas +++ b/Source/VCL/SynEdit/Source/SynDBEdit.pas @@ -1,393 +1,430 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynDBEdit.pas, released 2000-05-05. -The Original Code is based on DBmwEdit.pas by Vladimir Kuznetsov, part of -the mwEdit component suite. -Portions created by Vladimir Kuznetsov are Copyright (C) 1999 Vladimir Kuznetsov. -Unicode translation by Maël Hörz. -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: SynDBEdit.pas,v 1.11.2.2 2009/06/14 13:33:38 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynDBEdit; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Controls, - DbCtrls, - SynEdit, - SynEditTypes, - SynEditKeyCmds, - SysUtils, - Classes, - DB; - -type - TCustomDBSynEdit = class(TCustomSynEdit) - private - FDataLink: TFieldDataLink; - fEditing: boolean; - FBeginEdit: boolean; - FLoadData: TNotifyEvent; - procedure DataChange(Sender: TObject); - procedure EditingChange(Sender: TObject); - function GetDataField: string; - function GetDataSource: TDataSource; - function GetField: TField; - procedure SetDataField(const Value: string); - procedure SetDataSource(Value: TDataSource); - procedure SetEditing(Value: Boolean); - procedure UpdateData(Sender: TObject); - private - procedure CMEnter(var Msg: TCMEnter); message CM_ENTER; - procedure CMExit(var Msg: TCMExit); message CM_EXIT; - procedure CMGetDataLink(var Msg: TMessage); message CM_GETDATALINK; - protected - function GetReadOnly: boolean; override; - procedure Loaded; override; - procedure DoChange; override; - procedure SetReadOnly(Value: boolean); override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure DragDrop(Source: TObject; X, Y: Integer); override; - procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; - Data: pointer); override; - procedure LoadMemo; - procedure Notification(AComponent: TComponent; Operation: TOperation); - override; - protected - property DataField: string read GetDataField write SetDataField; - property DataSource: TDataSource read GetDataSource write SetDataSource; - property Field: TField read GetField; - property OnLoadData: TNotifyEvent read fLoadData write fLoadData; - end; - - TDBSynEdit = class(TCustomDBSynEdit) - published - // TCustomDBSynEdit properties - property DataField; - property DataSource; - property Field; - // TCustomDBSynEdit events - property OnLoadData; - // inherited properties - property ActiveLineColor; - property Align; - property Anchors; - property Constraints; - property Color; - property Ctl3D; - property Enabled; - property Font; - property Height; - property Name; - property ParentColor; - property ParentCtl3D; - property ParentFont; - property ParentShowHint; - property PopupMenu; - property ShowHint; - property TabOrder; - property TabStop default True; - property Tag; - property Visible; - property Width; - // inherited events - property OnClick; - property OnDblClick; - property OnDragDrop; - property OnDragOver; - property OnEndDock; - property OnEndDrag; - property OnEnter; - property OnExit; - property OnKeyDown; - property OnKeyPress; - property OnKeyUp; - property OnMouseDown; - property OnMouseMove; - property OnMouseUp; - property OnStartDock; - property OnStartDrag; - // TCustomSynEdit properties - property BookMarkOptions; - property BorderStyle; - property ExtraLineSpacing; - property Gutter; - property HideSelection; - property Highlighter; - property ImeMode; - property ImeName; - property InsertCaret; - property InsertMode; - property Keystrokes; - property MaxUndo; - property Options; - property OverwriteCaret; - property ReadOnly; - property RightEdge; - property RightEdgeColor; - property ScrollBars; - property SearchEngine; - property SelectedColor; - property SelectionMode; - property TabWidth; - property WantTabs; - // TCustomSynEdit events - property OnChange; - property OnCommandProcessed; - property OnDropFiles; - property OnGutterClick; - property OnGutterGetText; - property OnGutterPaint; - property OnPaint; - property OnPlaceBookmark; - property OnProcessCommand; - property OnProcessUserCommand; - property OnReplaceText; - property OnSpecialLineColors; - property OnStatusChange; - property OnPaintTransient; - end; - -implementation - -constructor TCustomDBSynEdit.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FDataLink := TFieldDataLink.Create; - FDataLink.Control := Self; - FDataLink.OnDataChange := DataChange; - FDataLink.OnEditingChange := EditingChange; - FDataLink.OnUpdateData := UpdateData; -end; - -destructor TCustomDBSynEdit.Destroy; -begin - FDataLink.Free; - FDataLink := nil; - inherited Destroy; -end; - -procedure TCustomDBSynEdit.CMEnter(var Msg: TCMEnter); -begin - SetEditing(True); - inherited; -end; - -procedure TCustomDBSynEdit.CMExit(var Msg: TCMExit); -begin - try - FDataLink.UpdateRecord; - except - SetFocus; - raise; - end; - SetEditing(False); - inherited; -end; - -procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage); -begin - Msg.Result := Integer(FDataLink); -end; - -procedure TCustomDBSynEdit.DataChange(Sender: TObject); -begin - if FDataLink.Field <> nil then - begin - if FBeginEdit then - begin - FBeginEdit := False; - Exit; - end; - if FDataLink.Field.IsBlob then - LoadMemo - else - Text := FDataLink.Field.Text; - if Assigned(FLoadData) then - FLoadData(Self); - end - else - begin - if csDesigning in ComponentState then - Text := Name - else - Text := ''; - end; -end; - -procedure TCustomDBSynEdit.DragDrop(Source: TObject; X, Y: Integer); -begin - FDataLink.Edit; - inherited; -end; - -procedure TCustomDBSynEdit.EditingChange(Sender: TObject); -begin - if FDataLink.Editing then - begin - if Assigned(FDataLink.DataSource) - and (FDataLink.DataSource.State <> dsInsert) - then - FBeginEdit := True; - end; -end; - -procedure TCustomDBSynEdit.ExecuteCommand(Command: TSynEditorCommand; - AChar: WideChar; Data: pointer); -begin - // cancel on [ESC] - if (Command = ecChar) and (AChar = #27) then - FDataLink.Reset - // set editing state if editor command - else if (Command >= ecEditCommandFirst) and (Command <= ecEditCommandLast) then - if not FDataLink.Edit then Exit; - - inherited; -end; - -function TCustomDBSynEdit.GetDataField: string; -begin - Result := FDataLink.FieldName; -end; - -function TCustomDBSynEdit.GetDataSource: TDataSource; -begin - Result := FDataLink.DataSource; -end; - -function TCustomDBSynEdit.GetField: TField; -begin - Result := FDataLink.Field; -end; - -function TCustomDBSynEdit.GetReadOnly: Boolean; -begin - Result := FDataLink.ReadOnly; -end; - -procedure TCustomDBSynEdit.Loaded; -begin - inherited Loaded; - if csDesigning in ComponentState then - DataChange(Self); -end; - -procedure TCustomDBSynEdit.LoadMemo; -var - BlobStream: TStream; -begin - try - BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmRead); - Lines.BeginUpdate; - if ((FDataLink.Field is TBlobField) and - (TBlobField(FDataLink.Field).BlobType in [ftWideMemo,ftWideString])) - then - Lines.LoadFromStream(BlobStream, TEncoding.Unicode) - else - //For UTF8 use: System.SysUtils.TEncoding.UTF8 - Lines.LoadFromStream(BlobStream, TEncoding.Default); - Lines.EndUpdate; - BlobStream.Free; - Modified := False; - ClearUndo; - except - // Memo too large - on E: EInvalidOperation do - Lines.Text := Format('(%s)', [E.Message]); - end; - EditingChange(Self); -end; - -procedure TCustomDBSynEdit.DoChange; -begin - FDataLink.Modified; - inherited; -end; - -procedure TCustomDBSynEdit.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited Notification(AComponent, Operation); - if (Operation = opRemove) and (FDataLink <> nil) and (AComponent = DataSource) - then - DataSource := nil; -end; - -procedure TCustomDBSynEdit.SetDataField(const Value: string); -begin - FDataLink.FieldName := Value; -end; - -procedure TCustomDBSynEdit.SetDataSource(Value: TDataSource); -begin - if not (FDataLink.DataSourceFixed and (csLoading in ComponentState)) then - FDataLink.DataSource := Value; - if Value <> nil then - Value.FreeNotification(Self); -end; - -procedure TCustomDBSynEdit.SetEditing(Value: Boolean); -begin - if fEditing <> Value then - begin - fEditing := Value; - if not Assigned(FDataLink.Field) or not FDataLink.Field.IsBlob then - FDataLink.Reset; - end; -end; - -procedure TCustomDBSynEdit.SetReadOnly(Value: Boolean); -begin - FDataLink.ReadOnly := Value; -end; - -procedure TCustomDBSynEdit.UpdateData(Sender: TObject); -var - BlobStream: TStream; -begin - if FDataLink.Field.IsBlob then - begin - BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmWrite); - Lines.SaveToStream(BlobStream); - BlobStream.Free; - end else - FDataLink.Field.AsString := Text; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynDBEdit.pas, released 2000-05-05. +The Original Code is based on DBmwEdit.pas by Vladimir Kuznetsov, part of +the mwEdit component suite. +Portions created by Vladimir Kuznetsov are Copyright (C) 1999 Vladimir Kuznetsov. +Unicode translation by Maël Hörz. +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: SynDBEdit.pas,v 1.11.2.2 2009/06/14 13:33:38 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNDBEDIT} +unit SynDBEdit; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFNDEF SYN_COMPILER_3_UP} + DbTables, +{$ENDIF} + Windows, + Messages, + Controls, + DbCtrls, + SynEdit, + SynEditKeyCmds, + SysUtils, + Classes, + DB; + +type + TCustomDBSynEdit = class(TCustomSynEdit) + private + FDataLink: TFieldDataLink; + FEditing: Boolean; + FBeginEdit: Boolean; + FLoadData: TNotifyEvent; + procedure DataChange(Sender: TObject); + procedure EditingChange(Sender: TObject); + function GetDataField: string; + function GetDataSource: TDataSource; + function GetField: TField; + procedure SetDataField(const Value: string); + procedure SetDataSource(Value: TDataSource); + procedure SetEditing(Value: Boolean); + procedure UpdateData(Sender: TObject); + private + procedure CMEnter(var Msg: TCMEnter); message CM_ENTER; + procedure CMExit(var Msg: TCMExit); message CM_EXIT; + procedure CMGetDataLink(var Msg: TMessage); message CM_GETDATALINK; + protected + function GetReadOnly: Boolean; override; + procedure Loaded; override; + procedure DoChange; override; + procedure SetReadOnly(Value: Boolean); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure DragDrop(Source: TObject; X, Y: Integer); override; + procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer); override; + procedure LoadMemo; + procedure Notification(AComponent: TComponent; Operation: TOperation); + override; + protected + property DataField: string read GetDataField write SetDataField; + property DataSource: TDataSource read GetDataSource write SetDataSource; + property Field: TField read GetField; + property OnLoadData: TNotifyEvent read FLoadData write FLoadData; + end; + + TDBSynEdit = class(TCustomDBSynEdit) + published + // TCustomDBSynEdit properties + property DataField; + property DataSource; + property Field; + // TCustomDBSynEdit events + property OnLoadData; + // inherited properties + property Align; + {$IFDEF SYN_COMPILER_4_UP} + property Anchors; + property Constraints; + {$ENDIF} + property Color; + property Ctl3D; + property Enabled; + property Font; + property Height; + property Name; + property ParentColor; + property ParentCtl3D; + property ParentFont; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property TabOrder; + property TabStop default True; + property Tag; + property Visible; + property Width; + // inherited events + property OnClick; + property OnDblClick; + property OnDragDrop; + property OnDragOver; + {$IFDEF SYN_COMPILER_4_UP} + property OnEndDock; + {$ENDIF} + property OnEndDrag; + property OnEnter; + property OnExit; + property OnKeyDown; + property OnKeyPress; + property OnKeyUp; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + {$IFDEF SYN_COMPILER_4_UP} + property OnStartDock; + {$ENDIF} + property OnStartDrag; + // TCustomSynEdit properties + property BookMarkOptions; + property BorderStyle; + property ExtraLineSpacing; + property Gutter; + property HideSelection; + property Highlighter; + property ImeMode; + property ImeName; + property InsertCaret; + property InsertMode; + property Keystrokes; + property MaxScrollWidth; + property MaxUndo; + property Options; + property OverwriteCaret; + property ReadOnly; + property RightEdge; + property RightEdgeColor; + property ScrollBars; + property SearchEngine; + property SelectedColor; + property SelectionMode; + property TabWidth; + property WantTabs; + // TCustomSynEdit events + property OnChange; + property OnCommandProcessed; + property OnDropFiles; + property OnGutterClick; + property OnGutterGetText; + property OnGutterPaint; + property OnPaint; + property OnPlaceBookmark; + property OnProcessCommand; + property OnProcessUserCommand; + property OnReplaceText; + property OnSpecialLineColors; + property OnStatusChange; + property OnPaintTransient; + end; + +implementation + +constructor TCustomDBSynEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FDataLink := TFieldDataLink.Create; + FDataLink.Control := Self; + FDataLink.OnDataChange := DataChange; + FDataLink.OnEditingChange := EditingChange; + FDataLink.OnUpdateData := UpdateData; +end; + +destructor TCustomDBSynEdit.Destroy; +begin + FDataLink.Free; + FDataLink := nil; + inherited Destroy; +end; + +procedure TCustomDBSynEdit.CMEnter(var Msg: TCMEnter); +begin + SetEditing(True); + inherited; +end; + +procedure TCustomDBSynEdit.CMExit(var Msg: TCMExit); +begin + try + FDataLink.UpdateRecord; + except + SetFocus; + raise; + end; + SetEditing(False); + inherited; +end; + +procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage); +begin + Msg.Result := LRESULT(FDataLink); +end; + +procedure TCustomDBSynEdit.DataChange(Sender: TObject); +begin + if FDataLink.Field <> nil then + begin + if FBeginEdit then + begin + FBeginEdit := False; + Exit; + end; +{$IFDEF SYN_COMPILER_3_UP} + if FDataLink.Field.IsBlob then + LoadMemo + else +{$ENDIF} + Text := FDataLink.Field.Text; + if Assigned(FLoadData) then + FLoadData(Self); + end + else + begin + if csDesigning in ComponentState then + Text := Name + else + Text := ''; + end; +end; + +procedure TCustomDBSynEdit.DragDrop(Source: TObject; X, Y: Integer); +begin + FDataLink.Edit; + inherited; +end; + +procedure TCustomDBSynEdit.EditingChange(Sender: TObject); +begin + if FDataLink.Editing then + begin + if Assigned(FDataLink.DataSource) + and (FDataLink.DataSource.State <> dsInsert) + then + FBeginEdit := True; + end; +end; + +procedure TCustomDBSynEdit.ExecuteCommand(Command: TSynEditorCommand; + AChar: WideChar; Data: Pointer); +begin + // cancel on [ESC] + if (Command = ecChar) and (AChar = #27) then + FDataLink.Reset + // set editing state if editor command + else if (Command >= ecEditCommandFirst) and (Command <= ecEditCommandLast) then + if not FDataLink.Edit then Exit; + + inherited; +end; + +function TCustomDBSynEdit.GetDataField: string; +begin + Result := FDataLink.FieldName; +end; + +function TCustomDBSynEdit.GetDataSource: TDataSource; +begin + Result := FDataLink.DataSource; +end; + +function TCustomDBSynEdit.GetField: TField; +begin + Result := FDataLink.Field; +end; + +function TCustomDBSynEdit.GetReadOnly: Boolean; +begin + Result := FDataLink.ReadOnly; +end; + +procedure TCustomDBSynEdit.Loaded; +begin + inherited Loaded; + if csDesigning in ComponentState then + DataChange(Self); +end; + +procedure TCustomDBSynEdit.LoadMemo; +{$IFDEF UNICODE} +const + BlobFieldWideText = [ftWideMemo,ftWideString]; +{$ENDIF} +{$IFDEF SYN_COMPILER_3_UP} +var + BlobStream: TStream; +{$ELSE} +var + BlobStream: TBlobStream; + BlobField: TBlobField; +{$ENDIF} +begin + try +{$IFDEF SYN_COMPILER_3_UP} + BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmRead); +{$ELSE} + BlobField := FDataLink.Field as TBlobField; + BlobStream := TBlobStream.Create(BlobField, bmRead); +{$ENDIF} + Lines.BeginUpdate; +{$IFDEF UNICODE} +//03.12.2019 fix for unicode +//Tested on UTF8 TEXT Sqlite3 & Zeos Unicode (UTF16) v7.2.6 +//For UTF8 use: System.SysUtils.TEncoding.UTF8 + if ((FDataLink.Field is TBlobField) and + (TBlobField(FDataLink.Field).BlobType in BlobFieldWideText)) then + Lines.LoadFromStream(BlobStream, TEncoding.Unicode) + else Lines.LoadFromStream(BlobStream, TEncoding.Default); +{$ELSE} //Non Unicode + Lines.LoadFromStream(BlobStream); +{$ENDIF} + Lines.EndUpdate; + BlobStream.Free; + Modified := False; + ClearUndo; + except + // Memo too large + on E: EInvalidOperation do + Lines.Text := Format('(%s)', [E.Message]); + end; + EditingChange(Self); +end; + + +procedure TCustomDBSynEdit.DoChange; +begin + FDataLink.Modified; + inherited; +end; + +procedure TCustomDBSynEdit.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) and (FDataLink <> nil) and (AComponent = DataSource) + then + DataSource := nil; +end; + +procedure TCustomDBSynEdit.SetDataField(const Value: string); +begin + FDataLink.FieldName := Value; +end; + +procedure TCustomDBSynEdit.SetDataSource(Value: TDataSource); +begin + if not (FDataLink.DataSourceFixed and (csLoading in ComponentState)) then + FDataLink.DataSource := Value; + if Value <> nil then + Value.FreeNotification(Self); +end; + +procedure TCustomDBSynEdit.SetEditing(Value: Boolean); +begin + if FEditing <> Value then + begin + FEditing := Value; +{$IFDEF SYN_COMPILER_3_UP} + if not Assigned(FDataLink.Field) or not FDataLink.Field.IsBlob then +{$ENDIF} + FDataLink.Reset; + end; +end; + +procedure TCustomDBSynEdit.SetReadOnly(Value: Boolean); +begin + FDataLink.ReadOnly := Value; +end; + +procedure TCustomDBSynEdit.UpdateData(Sender: TObject); +{$IFDEF SYN_COMPILER_3_UP} +var + BlobStream: TStream; +{$ENDIF} +begin +{$IFDEF SYN_COMPILER_3_UP} + if FDataLink.Field.IsBlob then + begin + BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmWrite); + Lines.SaveToStream(BlobStream); + BlobStream.Free; + end else +{$ENDIF} + FDataLink.Field.AsString := Text; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEdit.inc b/Source/VCL/SynEdit/Source/SynEdit.inc index 4d7ef39b..1ae023ac 100644 --- a/Source/VCL/SynEdit/Source/SynEdit.inc +++ b/Source/VCL/SynEdit/Source/SynEdit.inc @@ -1,3 +1,130 @@ +(******************************************************************************) +(* SynEdit Include File. This file was adapted from Brad Stowers' DFS.INC *) +(* file and used with permission. This will help reduce headaches when new *) +(* versions of Delphi and C++Builder are released, among other things. *) +(******************************************************************************) +(* Brad Stowers: bstowers@pobox.com *) +(* Delphi Free Stuff: http://delphifreestuff.com/ *) +(* February 24, 1999 *) +(******************************************************************************) +(* *) +(* Complete Boolean Evaluation compiler directive is turned off by including *) +(* this file. *) +(* The $ObjExportAll directive is turned on if compiling with C++Builder 3 or *) +(* higher. This is required for Delphi components built in Builder with *) +(* run-time packages. *) +(* *) +(* Here is a brief explanation of what each of the defines mean: *) +(* SYN_WIN32 : Compilation target is 32-bit Windows *) +(* SYN_COMPILER_2 : Delphi 2 or C++Builder 1 is the compiler. *) +(* SYN_COMPILER_2_UP : Delphi 2 or higher, or C++Builder 1 or higher is *) +(* the compiler. *) +(* SYN_COMPILER_3 : Delphi 3 or C++Builder 3 is the compiler. *) +(* SYN_COMPILER_3_UP : Delphi 3 or higher, or C++Builder 3 or higher is *) +(* the compiler. *) +(* SYN_COMPILER_4 : Delphi 4 or C++Builder 4 is the compiler. *) +(* SYN_COMPILER_4_UP : Delphi 4 or higher, or C++Builder 4 or higher is *) +(* the compiler. *) +(* SYN_COMPILER_5 : Delphi 5 or C++Builder 5 is the compiler. *) +(* SYN_COMPILER_5_UP : Delphi 5 or higher, or C++Builder 5 or higher is *) +(* the compiler. *) +(* SYN_COMPILER_6 : Delphi 6, C++Builder 6, Kylix 1 or Kylix 2 is *) +(* the compiler. *) +(* SYN_COMPILER_6_UP : Delphi 6, C++Builder 6, Kylix 1, Kylix 2 or higher *) +(* is the compiler. *) +(* SYN_COMPILER_7 : Delphi 7 or Kylix 3 is the compiler. *) +(* SYN_COMPILER_7_UP : Delphi 7, Kylix 3 or higher is the compiler. *) +(* SYN_COMPILER_9 : Delphi 2005 is the compiler. *) +(* SYN_COMPILER_9_UP : Delphi 2005 or higher is the compiler. *) +(* SYN_COMPILER_10 : Delphi 2006 is the compiler. *) +(* SYN_COMPILER_10_UP : Delphi 2006 or higher is the compiler. *) +(* SYN_COMPILER_11 : Delphi 2007 is the compiler. *) +(* SYN_COMPILER_11_UP : Delphi 2007 or higher is the compiler. *) +(* SYN_COMPILER_12 : Delphi 2009 is the compiler. *) +(* SYN_COMPILER_12_UP : Delphi 2009 or higher is the compiler. *) +(* SYN_COMPILER_14 : Delphi 2010 is the compiler. *) +(* SYN_COMPILER_14_UP : Delphi 2010 or higher is the compiler. *) +(* SYN_COMPILER_15 : Delphi XE is the compiler. *) +(* 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_COMPILER_20 : Delphi XE6 is the compiler. *) +(* SYN_COMPILER_20_UP : Delphi XE6 or higher is the compiler. *) +(* SYN_COMPILER_21 : Delphi XE7 is the compiler. *) +(* SYN_COMPILER_21_UP : Delphi XE7 or higher is the compiler. *) +(* SYN_COMPILER_22 : Delphi XE8 is the compiler. *) +(* SYN_COMPILER_22_UP : Delphi XE8 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. *) +(* SYN_CPPB_3_UP : C++B v3.0x or higher is being used. *) +(* SYN_CPPB_4 : C++B v4.0x is being used. *) +(* SYN_CPPB_4_UP : C++B v4.0x or higher is being used. *) +(* SYN_CPPB_5 : C++B v5.0x is being used. *) +(* SYN_CPPB_5_UP : C++B v5.0x or higher is being used. *) +(* SYN_CPPB_6 : C++B v6.0x is being used. *) +(* SYN_CPPB_6_UP : C++B v6.0x or higher is being used. *) +(* SYN_DELPHI : Any version of Delphi is being used. *) +(* SYN_DELPHI_PE : The personal edition of Delphi is being used. *) +(* SYN_DELPHI_2 : Delphi 2 is being used. *) +(* SYN_DELPHI_2_UP : Delphi 2 or higher is being used. *) +(* SYN_DELPHI_3 : Delphi 3 is being used. *) +(* SYN_DELPHI_3_UP : Delphi 3 or higher is being used. *) +(* SYN_DELPHI_4 : Delphi 4 is being used. *) +(* SYN_DELPHI_4_UP : Delphi 4 or higher is being used. *) +(* SYN_DELPHI_5 : Delphi 5 is being used. *) +(* SYN_DELPHI_5_UP : Delphi 5 or higher is being used. *) +(* SYN_DELPHI_6 : Delphi 6 is being used. *) +(* SYN_DELPHI_6_UP : Delphi 6 or higher is being used. *) +(* SYN_DELPHI_7 : Delphi 7 is being used. *) +(* SYN_DELPHI_7_UP : Delphi 7 or higher is being used. *) +(* SYN_DELPHI_8 : Delphi 8 is being used. *) +(* SYN_DELPHI_8_UP : Delphi 8 or higher is being used. *) +(* SYN_DELPHI_2005 : Delphi 2005 is being used. *) +(* SYN_DELPHI_2005_UP : Delphi 2005 or higher is being used. *) +(* SYN_DELPHI_2006 : Delphi 2006 is being used. *) +(* SYN_DELPHI_2006_UP : Delphi 2006 or higher is being used. *) +(* SYN_DELPHI_2007 : Delphi 2007 is being used. *) +(* SYN_DELPHI_2007_UP : Delphi 2007 or higher is being used. *) +(* SYN_DELPHI_2009 : Delphi 2009 is being used. *) +(* SYN_DELPHI_2009_UP : Delphi 2009 or higher is being used. *) +(* SYN_DELPHI_2010 : Delphi 2010 is being used. *) +(* SYN_DELPHI_2010_UP : Delphi 2010 or higher is being used. *) +(* SYN_DELPHI_XE : Delphi XE is being used. *) +(* 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_DELPHI_XE6 : Delphi XE6 is being used. *) +(* SYN_DELPHI_XE6_UP : Delphi XE6 or higher is being used. *) +(* SYN_DELPHI_XE7 : Delphi XE7 is being used. *) +(* SYN_DELPHI_XE7_UP : Delphi XE7 or higher is being used. *) +(* SYN_DELPHI_XE8 : Delphi XE8 is being used. *) +(* SYN_DELPHI_XE8_UP : Delphi XE8 or higher is being used. *) +(* SYN_DELPHI_10 : Delphi RX 10 (Seattle) is being used. *) +(* SYN_DELPHI_10_UP : Delphi RX 10 or higher is being used. *) +(* SYN_DELPHI_10_1 : Delphi RX 10.1 (Berlin) is being used. *) +(* SYN_DELPHI_10_1_UP : Delphi RX 10.1 or higher is being used. *) +(* SYN_DELPHI_10_2 : Delphi RX 10.2 (Tokyo) is being used. *) +(* SYN_DELPHI_10_2_UP : Delphi RX 10.2 or higher is being used. *) +(* SYN_DELPHI_10_3 : Delphi RX 10.3 (Rio) is being used. *) +(* SYN_DELPHI_10_3_UP : Delphi RX 10.3 or higher is being used. *) +(* SYN_KYLIX : Kylix 1.0 is being using. *) +(******************************************************************************) + +{$DEFINE SYNEDIT_INCLUDE} + {------------------------------------------------------------------------------} { Common compiler defines } { (remove the dot in front of a define to enable it) } @@ -18,6 +145,1124 @@ {$I SynEditJedi.inc} +{------------------------------------------------------------------------------} +{ SYN_LINUX and SYN_KYLIX defines } +{------------------------------------------------------------------------------} + +{$IFDEF LINUX} + {$DEFINE SYN_LINUX} + {$DEFINE SYN_KYLIX} + {$DEFINE SYN_COMPILER_6} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_6} +{$ENDIF} + +{------------------------------------------------------------------------------} +{ VERXXX to SYN_COMPILERX, SYN_DELPHIX and SYN_CPPBX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF VER350} + {$DEFINE SYN_COMPILER_28} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_11_0} +{$ENDIF} + +{$IFDEF VER340} + {$DEFINE SYN_COMPILER_27} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_10_4} +{$ENDIF} + +{$IFDEF VER330} + {$DEFINE SYN_COMPILER_26} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_10_3} +{$ENDIF} + +{$IFDEF VER320} + {$DEFINE SYN_COMPILER_25} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_10_2} +{$ENDIF} + +{$IFDEF VER310} + {$DEFINE SYN_COMPILER_24} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_10_1} +{$ENDIF} + +{$IFDEF VER300} + {$DEFINE SYN_COMPILER_23} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_10} +{$ENDIF} + +{$IFDEF VER290} + {$DEFINE SYN_COMPILER_22} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE8} +{$ENDIF} + +{$IFDEF VER280} + {$DEFINE SYN_COMPILER_21} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE7} +{$ENDIF} + +{$IFDEF VER270} + {$DEFINE SYN_COMPILER_20} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE6} +{$ENDIF} + +{$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} + {$DEFINE SYN_DELPHI_XE2} +{$ENDIF} + +{$IFDEF VER220} + {$DEFINE SYN_COMPILER_15} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_XE} +{$ENDIF} + +{$IFDEF VER210} + {$DEFINE SYN_COMPILER_14} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2010} +{$ENDIF} + +{$IFDEF VER200} + {$DEFINE SYN_COMPILER_12} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2009} +{$ENDIF} + +{$IFDEF VER190} + {$DEFINE SYN_COMPILER_11} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2007} +{$ENDIF} + +{$IFDEF VER180} + {$DEFINE SYN_COMPILER_10} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2006} +{$ENDIF} + +{$IFDEF VER170} + {$DEFINE SYN_COMPILER_9} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2005} +{$ENDIF} + +{$IFDEF VER160} + {$DEFINE SYN_COMPILER_8} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_8} +{$ENDIF} + +{$IFDEF VER150} + {$DEFINE SYN_COMPILER_7} + {$IFNDEF BCB} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_7} + {$ELSE} + {.$DEFINE SYN_CPPB} + {.$DEFINE SYN_CPPB_7} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER140} + {$DEFINE SYN_COMPILER_6} + {$IFNDEF BCB} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_6} + {$ELSE} + {$DEFINE SYN_CPPB} + {$DEFINE SYN_CPPB_6} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER130} + {$DEFINE SYN_COMPILER_5} + {$IFNDEF BCB} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_5} + {$ELSE} + {$DEFINE SYN_CPPB} + {$DEFINE SYN_CPPB_5} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER125} + {$DEFINE SYN_COMPILER_4} + {$DEFINE SYN_CPPB} + {$DEFINE SYN_CPPB_4} +{$ENDIF} + +{$IFDEF VER120} + {$DEFINE SYN_COMPILER_4} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_4} +{$ENDIF} + +{$IFDEF VER110} + {$DEFINE SYN_COMPILER_3} + {$DEFINE SYN_CPPB} + {$DEFINE SYN_CPPB_3} +{$ENDIF} + +{$IFDEF VER100} + {$DEFINE SYN_COMPILER_3} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_3} +{$ENDIF} + +{$IFDEF VER93} + {$DEFINE SYN_COMPILER_2} { C++B v1 compiler is really v2 } + {$DEFINE SYN_CPPB} + {$DEFINE SYN_CPPB_1} +{$ENDIF} + +{$IFDEF VER90} + {$DEFINE SYN_COMPILER_2} + {$DEFINE SYN_DELPHI} + {$DEFINE SYN_DELPHI_2} +{$ENDIF} + +{$IFDEF SYN_COMPILER_2} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_3} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} + {$DEFINE SYN_COMPILER_3_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_4} + {$DEFINE SYN_COMPILER_1_UP} + {$DEFINE SYN_COMPILER_2_UP} + {$DEFINE SYN_COMPILER_3_UP} + {$DEFINE SYN_COMPILER_4_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_5} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_6} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_7} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_8} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_9} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_10} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_11} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_12} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_14} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_15} + {$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} +{$ENDIF} + +{$IFDEF SYN_COMPILER_16} + {$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} +{$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_COMPILER_20} + {$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} + {$DEFINE SYN_COMPILER_20_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_21} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_22} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_23} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_24} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} + {$DEFINE SYN_COMPILER_24_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_25} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} + {$DEFINE SYN_COMPILER_24_UP} + {$DEFINE SYN_COMPILER_25_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_26} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} + {$DEFINE SYN_COMPILER_24_UP} + {$DEFINE SYN_COMPILER_25_UP} + {$DEFINE SYN_COMPILER_26_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_27} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} + {$DEFINE SYN_COMPILER_24_UP} + {$DEFINE SYN_COMPILER_25_UP} + {$DEFINE SYN_COMPILER_26_UP} + {$DEFINE SYN_COMPILER_27_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_28} + {$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} + {$DEFINE SYN_COMPILER_20_UP} + {$DEFINE SYN_COMPILER_21_UP} + {$DEFINE SYN_COMPILER_22_UP} + {$DEFINE SYN_COMPILER_23_UP} + {$DEFINE SYN_COMPILER_24_UP} + {$DEFINE SYN_COMPILER_25_UP} + {$DEFINE SYN_COMPILER_26_UP} + {$DEFINE SYN_COMPILER_27_UP} + {$DEFINE SYN_COMPILER_28_UP} +{$ENDIF} + + +{$IFDEF SYN_DELPHI_2} + {$DEFINE SYN_DELPHI_2_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_3} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_4} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} + {$DEFINE SYN_DELPHI_4_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_5} + {$DEFINE SYN_DELPHI_2_UP} + {$DEFINE SYN_DELPHI_3_UP} + {$DEFINE SYN_DELPHI_4_UP} + {$DEFINE SYN_DELPHI_5_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_6} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_7} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_8} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_2005} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_2006} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_2007} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_2009} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_2010} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE} + {$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} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE2} + {$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} +{$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_DELPHI_XE6} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE7} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_XE8} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_10} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_10_1} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_1_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_10_2} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_1_UP} + {$DEFINE SYN_DELPHI_10_2_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_10_3} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_1_UP} + {$DEFINE SYN_DELPHI_10_2_UP} + {$DEFINE SYN_DELPHI_10_3_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_10_4} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_1_UP} + {$DEFINE SYN_DELPHI_10_2_UP} + {$DEFINE SYN_DELPHI_10_3_UP} + {$DEFINE SYN_DELPHI_10_4_UP} +{$ENDIF} + +{$IFDEF SYN_DELPHI_11_0} + {$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} + {$DEFINE SYN_DELPHI_XE6_UP} + {$DEFINE SYN_DELPHI_XE7_UP} + {$DEFINE SYN_DELPHI_XE8_UP} + {$DEFINE SYN_DELPHI_10_1_UP} + {$DEFINE SYN_DELPHI_10_2_UP} + {$DEFINE SYN_DELPHI_10_3_UP} + {$DEFINE SYN_DELPHI_10_4_UP} + {$DEFINE SYN_DELPHI_11_0_UP} +{$ENDIF} + +{$IFDEF SYN_CPPB_6} + {$DEFINE SYN_CPPB_3_UP} + {$DEFINE SYN_CPPB_4_UP} + {$DEFINE SYN_CPPB_5_UP} + {$DEFINE SYN_CPPB_6_UP} +{$ENDIF} + +{$IFDEF SYN_CPPB_3} + {$DEFINE SYN_CPPB_3_UP} +{$ENDIF} + +{$IFDEF SYN_COMPILER_3_UP} + {$DEFINE SYN_NO_COM_CLEANUP} +{$ENDIF} + +{$IFDEF SYN_CPPB_3_UP} + // C++Builder requires this if you use Delphi components in run-time packages. + {$ObjExportAll On} +{$ENDIF} + +{------------------------------------------------------------------------------} +{ MSWINDOWS and SYN_WIN32 } +{------------------------------------------------------------------------------} + +{$IFDEF SYN_KYLIX} + Kylix is no longer supported. Please refer to the branch 'Kylix' +{$ELSE} + {$IFNDEF SYN_COMPILER_16_UP} + {$DEFINE MSWINOWS} + {$ENDIF} + {$DEFINE SYN_WIN32} // deprecated, do not use +{$ENDIF} + {------------------------------------------------------------------------------} { Please change this to suit your needs (to activate an option remove the dot } { in front of a DEFINE) } @@ -30,7 +1275,17 @@ // properly store Range State information {.$DEFINE SYN_HEREDOC} +// Define OWN_UnicodeString_MEMMGR to speed up WideStrings-handling +{$IFDEF MSWINOWS} + {$IFNDEF UNICODE} + {$DEFINE OWN_UnicodeString_MEMMGR} + {$ENDIF} +{$ENDIF} + // Turn this off if you don't need complex script support, since it is slower -{.$DEFINE SYN_UNISCRIBE} +{-$DEFINE SYN_UNISCRIBE} -// $Id: SynEdit.inc,v 1.16.2.19 2009/06/14 13:41:44 maelh Exp $ +// Code Folding +{$IFDEF SYN_DELPHI_XE_UP} + {$DEFINE SYN_CodeFolding} +{$ENDIF} diff --git a/Source/VCL/SynEdit/Source/SynEdit.pas b/Source/VCL/SynEdit/Source/SynEdit.pas index 22c281f2..e4804bdf 100644 --- a/Source/VCL/SynEdit/Source/SynEdit.pas +++ b/Source/VCL/SynEdit/Source/SynEdit.pas @@ -1,10937 +1,11956 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of -the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -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. - -Known Issues: -- Undo is buggy when dealing with Hard Tabs (when inserting text after EOL and - when trimming). - --------------------------------------------------------------------------------} -//todo: in WordWrap mode, parse lines only once in PaintLines() -//todo: Remove checks for WordWrap. Must abstract the behaviour with the plugins instead. -//todo: Move WordWrap glyph to the WordWrap plugin. - -unit SynEdit; - -{$I SynEdit.inc} - -interface - -uses - ActiveX, - Controls, - Contnrs, - Graphics, - Forms, - StdCtrls, - ExtCtrls, - Windows, - Messages, - StdActns, - Dialogs, - Themes, - UITypes, - Imm, - Diagnostics, - SynUnicode, - SynTextDrawer, - SynEditTypes, - SynEditKeyConst, - SynEditMiscProcs, - SynEditMiscClasses, - SynEditTextBuffer, - SynEditKeyCmds, - SynEditHighlighter, - SynEditKbdHandler, - SynEditCodeFolding, - Math, - SysUtils, - Classes; - -const - // maximum scroll range - MAX_SCROLL = 32767; - - // Max number of book/gutter marks returned from GetEditMarksForLine - that - // really should be enough. - MAX_MARKS = 16; - -type - TBufferCoord = SynEditTypes.TBufferCoord; - TDisplayCoord = SynEditTypes.TDisplayCoord; - - TSynBorderStyle = TBorderStyle; - - TSynReplaceAction = (raCancel, raSkip, raReplace, raReplaceAll); - - ESynEditError = class(ESynError); - - TDropFilesEvent = procedure(Sender: TObject; X, Y: Integer; AFiles: TStrings) - of object; - - TPaintEvent = procedure(Sender: TObject; ACanvas: TCanvas) of object; - - TProcessCommandEvent = procedure(Sender: TObject; - var Command: TSynEditorCommand; var AChar: WideChar; Data: pointer) of object; - - TReplaceTextEvent = procedure(Sender: TObject; const ASearch, AReplace: - string; Line, Column: Integer; var Action: TSynReplaceAction) of object; - - TSpecialLineColorsEvent = procedure(Sender: TObject; Line: Integer; - var Special: Boolean; var FG, BG: TColor) of object; - - TTransientType = (ttBefore, ttAfter); - TPaintTransient = procedure(Sender: TObject; Canvas: TCanvas; - TransientType: TTransientType) of object; - - TScrollEvent = procedure(Sender: TObject; ScrollBar: TScrollBarKind) of object; - - TGutterGetTextEvent = procedure(Sender: TObject; aLine: Integer; - var aText: string) of object; - - TGutterPaintEvent = procedure(Sender: TObject; aLine: Integer; - X, Y: Integer) of object; - - TSynEditCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock); - - TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesChanging, - sfIgnoreNextChar, sfCaretVisible, sfPossibleGutterClick, - sfInsideRedo, sfOleDragSource, sfGutterDragging); - - TSynStateFlags = set of TSynStateFlag; - - TScrollHintFormat = (shfTopLineOnly, shfTopToBottom); - - TSynEditorOption = ( - eoAltSetsColumnMode, //Holding down the Alt Key will put the selection mode into columnar format - eoAutoIndent, //Will indent the caret on new lines with the same amount of leading white space as the preceding line - eoDisableScrollArrows, //Disables the scroll bar arrow buttons when you can't scroll in that direction any more - eoDragDropEditing, //Allows you to select a block of text and drag it within the document to another location - eoDropFiles, //Allows the editor accept OLE file drops - eoEnhanceHomeKey, //enhances home key positioning, similar to visual studio - eoEnhanceEndKey, //enhances End key positioning, similar to JDeveloper - eoGroupUndo, //When undoing/redoing actions, handle all continous changes of the same kind in one call instead undoing/redoing each command separately - eoHalfPageScroll, //When scrolling with page-up and page-down commands, only scroll a half page at a time - eoHideShowScrollbars, //if enabled, then the scrollbars will only show when necessary. If you have ScrollPastEOL, then it the horizontal bar will always be there (it uses MaxLength instead) - eoKeepCaretX, //When moving through lines w/o Cursor Past EOL, keeps the X position of the cursor - eoNoCaret, //Makes it so the caret is never visible - eoNoSelection, //Disables selecting text - eoRightMouseMovesCursor, //When clicking with the right mouse for a popup menu, move the cursor to that location - eoScrollByOneLess, //Forces scrolling to be one less - eoScrollHintFollows, //The scroll hint follows the mouse when scrolling vertically - eoScrollPastEof, //Allows the cursor to go past the end of file marker - eoScrollPastEol, //Allows the cursor to go past the last character into the white space at the end of a line - eoShowScrollHint, //Shows a hint of the visible line numbers when scrolling vertically - eoShowSpecialChars, //Shows the special Characters - eoSmartTabDelete, //similar to Smart Tabs, but when you delete characters - eoSmartTabs, //When tabbing, the cursor will go to the next non-white space character of the previous line - eoSpecialLineDefaultFg, //disables the foreground text color override when using the OnSpecialLineColor event - eoTabIndent, //When active and act as block indent, unindent when text is selected - eoTabsToSpaces, //Converts a tab character to a specified number of space characters - eoTrimTrailingSpaces, //Spaces at the end of lines will be trimmed and not saved - eoShowLigatures //Shows font ligatures, by default it is disabled - ); - - TSynEditorOptions = set of TSynEditorOption; - -const - SYNEDIT_DEFAULT_OPTIONS = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, - eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces, - eoSmartTabDelete, eoGroupUndo]; - -type - TCreateParamsW = record - Caption: PWideChar; - Style: DWORD; - ExStyle: DWORD; - X, Y: Integer; - Width, Height: Integer; - WndParent: HWnd; - Param: Pointer; - WindowClass: TWndClassW; - WinClassName: array[0..63] of WideChar; - InternalCaption: string; - end; - -type -// use scAll to update a statusbar when another TCustomSynEdit got the focus - TSynStatusChange = (scAll, scCaretX, scCaretY, scLeftChar, scTopLine, - scInsertMode, scModified, scSelection, scReadOnly); - TSynStatusChanges = set of TSynStatusChange; - - TContextHelpEvent = procedure(Sender: TObject; word: string) - of object; - - TStatusChangeEvent = procedure(Sender: TObject; Changes: TSynStatusChanges) - of object; - - TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; - var aCursor: TCursor) of object; - -//++ CodeFolding - TScanForFoldRangesEvent = procedure(Sender: TObject; - FoldRanges: TSynFoldRanges; LinesToScan: TStrings; - FromLine : Integer; ToLine : Integer) of object; -//-- CodeFolding - - - TCustomSynEdit = class; - - TSynEditMark = class - protected - fLine, fChar, fImage: Integer; - fEdit: TCustomSynEdit; - fVisible: Boolean; - fInternalImage: Boolean; - fBookmarkNum: Integer; - function GetEdit: TCustomSynEdit; virtual; - procedure SetChar(const Value: Integer); virtual; - procedure SetImage(const Value: Integer); virtual; - procedure SetLine(const Value: Integer); virtual; - procedure SetVisible(const Value: Boolean); - procedure SetInternalImage(const Value: Boolean); - function GetIsBookmark: Boolean; - public - constructor Create(AOwner: TCustomSynEdit); - property Line: Integer read fLine write SetLine; - property Char: Integer read fChar write SetChar; - property Edit: TCustomSynEdit read fEdit; - property ImageIndex: Integer read fImage write SetImage; - property BookmarkNumber: Integer read fBookmarkNum write fBookmarkNum; - property Visible: Boolean read fVisible write SetVisible; - property InternalImage: Boolean read fInternalImage write SetInternalImage; - property IsBookmark: Boolean read GetIsBookmark; - end; - - TPlaceMarkEvent = procedure(Sender: TObject; var Mark: TSynEditMark) - of object; - - TSynEditMarks = array[1..MAX_MARKS] of TSynEditMark; - - { A list of mark objects. Each object cause a litle picture to be drawn in the gutter. } - TSynEditMarkList = class(TObjectList) // It makes more sence to derive from TObjectList, - protected // as it automatically frees its members - fEdit: TCustomSynEdit; - fOnChange: TNotifyEvent; - procedure Notify(Ptr: Pointer; Action: TListNotification); override; - function GetItem(Index: Integer): TSynEditMark; - procedure SetItem(Index: Integer; Item: TSynEditMark); - property OwnsObjects; // This is to hide the inherited property, - public // because TSynEditMarkList always owns the marks - constructor Create(AOwner: TCustomSynEdit); - function First: TSynEditMark; - function Last: TSynEditMark; - function Extract(Item: TSynEditMark): TSynEditMark; - procedure ClearLine(line: Integer); - procedure GetMarksForLine(line: Integer; var Marks: TSynEditMarks); - procedure Place(mark: TSynEditMark); - public - property Items[Index: Integer]: TSynEditMark read GetItem write SetItem; default; - property Edit: TCustomSynEdit read fEdit; - property OnChange: TNotifyEvent read FOnChange write FOnChange; - end; - - TGutterClickEvent = procedure(Sender: TObject; Button: TMouseButton; - X, Y, Line: Integer; Mark: TSynEditMark) of object; - - // aIndex parameters of Line notifications are 0-based. - // aRow parameter of GetRowLength() is 1-based. - ISynEditBufferPlugin = interface - // conversion methods - function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; - function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; - function RowCount: Integer; - function GetRowLength(aRow: Integer): Integer; - // plugin notifications - function LinesInserted(aIndex: Integer; aCount: Integer): Integer; - function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; - function LinesPutted(aIndex: Integer; aCount: Integer): Integer; - // font or size change - procedure DisplayChanged; - // pretty clear, heh? - procedure Reset; - end; - - TSynEditPlugin = class(TObject) - private - fOwner: TCustomSynEdit; - protected - procedure AfterPaint(ACanvas: TCanvas; const AClip: TRect; - FirstLine, LastLine: Integer); virtual; - procedure PaintTransient(ACanvas: TCanvas; ATransientType: TTransientType); virtual; - procedure LinesInserted(FirstLine, Count: Integer); virtual; - procedure LinesDeleted(FirstLine, Count: Integer); virtual; - protected - property Editor: TCustomSynEdit read fOwner; - public - constructor Create(AOwner: TCustomSynEdit); - destructor Destroy; override; - end; - - TCustomSynEditSearchNotFoundEvent = procedure(Sender: TObject; - FindText: string) of object; - - TCustomSynEdit = class(TCustomControl) - private - procedure WMCancelMode(var Message: TMessage); message WM_CANCELMODE; - procedure WMCaptureChanged(var Msg: TMessage); message WM_CAPTURECHANGED; - procedure WMClear(var Msg: TMessage); message WM_CLEAR; - procedure WMCopy(var Message: TMessage); message WM_COPY; - procedure WMCut(var Message: TMessage); message WM_CUT; - procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES; - procedure WMDestroy(var Message: TWMDestroy); message WM_DESTROY; - procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND; - procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE; - procedure WMGetText(var Msg: TWMGetText); message WM_GETTEXT; - procedure WMGetTextLength(var Msg: TWMGetTextLength); message WM_GETTEXTLENGTH; - procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL; - procedure WMPaste(var Message: TMessage); message WM_PASTE; - procedure WMSetText(var Msg: TWMSetText); message WM_SETTEXT; - procedure WMImeChar(var Msg: TMessage); message WM_IME_CHAR; - procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION; - procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY; - procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; - procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR; - procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; - procedure WMSize(var Msg: TWMSize); message WM_SIZE; - procedure WMUndo(var Msg: TMessage); message WM_UNDO; - procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL; - private -//++ CodeFolding - fUseCodeFolding : Boolean; - fCodeFolding: TSynCodeFolding; - fAllFoldRanges: TSynFoldRanges; -//-- CodeFolding - fAlwaysShowCaret: Boolean; - fBlockBegin: TBufferCoord; - fBlockEnd: TBufferCoord; - fCaretX: Integer; - fLastCaretX: integer; - fCaretY: Integer; - fCharsInWindow: Integer; - fCharWidth: Integer; - fFontDummy: TFont; - fFontQuality: TFontQuality; - fInserting: Boolean; - fLines: TStrings; - fOrigLines: TStrings; - fOrigUndoList: TSynEditUndoList; - fOrigRedoList: TSynEditUndoList; - fLinesInWindow: Integer; - fLeftChar: Integer; - fPaintLock: Integer; - fReadOnly: Boolean; - fRightEdge: Integer; - fRightEdgeColor: TColor; - fScrollHintColor: TColor; - fScrollHintFormat: TScrollHintFormat; - FScrollBars: TScrollStyle; - fTextHeight: Integer; - fTextOffset: Integer; - fTopLine: Integer; - fHighlighter: TSynCustomHighlighter; - fSelectedColor: TSynSelectedColor; - fActiveLineColor: TColor; - fUndoList: TSynEditUndoList; - fRedoList: TSynEditUndoList; - fBookMarks: array[0..9] of TSynEditMark; // these are just references, fMarkList is the owner - fMouseDownX: Integer; - fMouseDownY: Integer; - fBookMarkOpt: TSynBookMarkOpt; - fBorderStyle: TSynBorderStyle; - fHideSelection: Boolean; - fMouseWheelAccumulator: Integer; - fOverwriteCaret: TSynEditCaretType; - fInsertCaret: TSynEditCaretType; - fCaretOffset: TPoint; - fKeyStrokes: TSynEditKeyStrokes; - fModified: Boolean; - fMarkList: TSynEditMarkList; - fExtraLineSpacing: Integer; - fSelectionMode: TSynSelectionMode; - fActiveSelectionMode: TSynSelectionMode; //mode of the active selection - fWantReturns: Boolean; - fWantTabs: Boolean; - fWordWrapPlugin: ISynEditBufferPlugin; - fWordWrapGlyph: TSynGlyph; - fCaretAtEOL: Boolean; // used by wordwrap - - fGutter: TSynGutter; - fTabWidth: Integer; - fTextDrawer: TheTextDrawer; - fInvalidateRect: TRect; - fStateFlags: TSynStateFlags; - fOptions: TSynEditorOptions; - fStatusChanges: TSynStatusChanges; - fLastKey: word; - fLastShiftState: TShiftState; - fSearchEngine: TSynEditSearchCustom; - fHookedCommandHandlers: TObjectList; - fKbdHandler: TSynEditKbdHandler; - fFocusList: TList; - fPlugins: TObjectList; - fScrollTimer: TTimer; - fScrollDeltaX, fScrollDeltaY: Integer; - fClickCountTimer: TStopWatch; - fClickCount: Integer; - FPaintTransientLock: Integer; - FIsScrolling: Boolean; - FAdditionalWordBreakChars: TSysCharSet; - FAdditionalIdentChars: TSysCharSet; - SelStartBeforeSearch: integer; - SelLengthBeforeSearch: integer; - - // event handlers - fOnChange: TNotifyEvent; - fOnClearMark: TPlaceMarkEvent; - fOnCommandProcessed: TProcessCommandEvent; - fOnDropFiles: TDropFilesEvent; - fOnGutterClick: TGutterClickEvent; - fOnMouseCursor: TMouseCursorEvent; - fOnPaint: TPaintEvent; - fOnPlaceMark: TPlaceMarkEvent; - fOnProcessCommand: TProcessCommandEvent; - fOnProcessUserCommand: TProcessCommandEvent; - fOnReplaceText: TReplaceTextEvent; - fOnSpecialLineColors: TSpecialLineColorsEvent; - fOnContextHelp: TContextHelpEvent; - fOnPaintTransient: TPaintTransient; - fOnScroll: TScrollEvent; - fOnGutterGetText: TGutterGetTextEvent; - fOnGutterPaint: TGutterPaintEvent; - fOnStatusChange: TStatusChangeEvent; - fOnTripleClick: TNotifyEvent; - fOnQudrupleClick: TNotifyEvent; - - fChainListCleared: TNotifyEvent; - fChainListDeleted: TStringListChangeEvent; - fChainListInserted: TStringListChangeEvent; - fChainListPutted: TStringListChangeEvent; - fChainLinesChanging: TNotifyEvent; - fChainLinesChanged: TNotifyEvent; - fChainedEditor: TCustomSynEdit; - fChainUndoAdded: TNotifyEvent; - fChainRedoAdded: TNotifyEvent; - fSearchNotFound: TCustomSynEditSearchNotFoundEvent; - OnFindBeforeSearch: TNotifyEvent; - OnReplaceBeforeSearch: TNotifyEvent; - OnCloseBeforeSearch: TNotifyEvent; -//++ CodeFolding - fOnScanForFoldRanges : TScanForFoldRangesEvent; - procedure ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); - procedure FullFoldScan; - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); -//-- CodeFolding - procedure BookMarkOptionsChanged(Sender: TObject); - procedure ComputeCaret(X, Y: Integer); - procedure ComputeScroll(X, Y: Integer); - procedure DoHomeKey(Selection:boolean); - procedure DoEndKey(Selection: Boolean); - procedure DoLinesDeleted(FirstLine, Count: integer); - procedure DoLinesInserted(FirstLine, Count: integer); - procedure DoShiftTabKey; - procedure DoTabKey; - function FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): integer; - procedure SynFontChanged(Sender: TObject); - procedure ForceCaretX(aCaretX: integer); - function GetBlockBegin: TBufferCoord; - function GetBlockEnd: TBufferCoord; - function GetCanPaste: Boolean; - function GetCanRedo: Boolean; - function GetCanUndo: Boolean; - function GetCaretXY: TBufferCoord; - function GetDisplayX: Integer; - function GetDisplayY: Integer; - function GetDisplayXY: TDisplayCoord; - function GetDisplayLineCount: Integer; - function GetFont: TFont; - function GetHookedCommandHandlersCount: Integer; - function GetLineText: string; - function GetMaxUndo: Integer; - function GetOptions: TSynEditorOptions; - function GetSelAvail: Boolean; - function GetSelTabBlock: Boolean; - function GetSelTabLine: Boolean; - function GetSelText: string; - function SynGetText: string; - function GetWordAtCursor: string; - function GetWordAtMouse: string; - function GetWordWrap: Boolean; - procedure GutterChanged(Sender: TObject); - function LeftSpaces(const Line: string): Integer; -//++ CodeFolding - function LeftSpacesEx(const Line: string; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; -//-- CodeFolding - function GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): string; - procedure LinesChanging(Sender: TObject); - procedure MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; - SelectionCommand: Boolean); - procedure MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); - procedure MoveCaretVert(DY: Integer; SelectionCommand: Boolean); - procedure PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; - FirstLine, LastLine: Integer); - procedure ReadAddedKeystrokes(Reader: TReader); - procedure ReadRemovedKeystrokes(Reader: TReader); - function ScanFrom(Index: Integer): Integer; - procedure ScrollTimerHandler(Sender: TObject); - procedure SelectedColorsChanged(Sender: TObject); - procedure SetBlockBegin(Value: TBufferCoord); - procedure SetBlockEnd(Value: TBufferCoord); - procedure SetBorderStyle(Value: TSynBorderStyle); - procedure SetCaretX(Value: Integer); - procedure SetCaretY(Value: Integer); - procedure InternalSetCaretX(Value: Integer); - procedure InternalSetCaretY(Value: Integer); - procedure SetInternalDisplayXY(const aPos: TDisplayCoord); - procedure SetActiveLineColor(Value: TColor); - procedure SetExtraLineSpacing(const Value: Integer); - procedure SetFont(const Value: TFont); - procedure SetGutter(const Value: TSynGutter); - procedure SetGutterWidth(Value: Integer); - procedure SetHideSelection(const Value: Boolean); - procedure SetHighlighter(const Value: TSynCustomHighlighter); - procedure SetInsertCaret(const Value: TSynEditCaretType); - procedure SetInsertMode(const Value: Boolean); - procedure SetKeystrokes(const Value: TSynEditKeyStrokes); - procedure SetLeftChar(Value: Integer); - procedure SetLines(Value: TStrings); - procedure SetLineText(Value: string); - procedure SetMaxUndo(const Value: Integer); - procedure SetModified(Value: Boolean); - procedure SetOptions(Value: TSynEditorOptions); - procedure SetOverwriteCaret(const Value: TSynEditCaretType); - procedure SetRightEdge(Value: Integer); - procedure SetRightEdgeColor(Value: TColor); - procedure SetScrollBars(const Value: TScrollStyle); - procedure SetSearchEngine(Value: TSynEditSearchCustom); - procedure SetSelectionMode(const Value: TSynSelectionMode); - procedure SetActiveSelectionMode(const Value: TSynSelectionMode); - procedure SetTabWidth(Value: Integer); - procedure SynSetText(const Value: string); - procedure SetTopLine(Value: Integer); - procedure SetWordWrap(const Value: Boolean); - procedure SetWordWrapGlyph(const Value: TSynGlyph); - procedure WordWrapGlyphChange(Sender: TObject); - procedure SizeOrFontChanged(bFont: boolean); - procedure ProperSetLine(ALine: Integer; const ALineText: string); - procedure UpdateModifiedStatus; - procedure UndoRedoAdded(Sender: TObject); - procedure UpdateLastCaretX; - procedure UpdateScrollBars; - procedure WriteAddedKeystrokes(Writer: TWriter); - procedure WriteRemovedKeystrokes(Writer: TWriter); - procedure SetAdditionalIdentChars(const Value: TSysCharSet); - procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); - - procedure DoSearchFindFirstExecute(Action: TSearchFindFirst); - procedure DoSearchFindExecute(Action: TSearchFind); - procedure DoSearchReplaceExecute(Action: TSearchReplace); - procedure DoSearchFindNextExecute(Action: TSearchFindNext); - procedure FindDialogFindFirst(Sender: TObject); - procedure FindDialogFind(Sender: TObject); - function SearchByFindDialog(FindDialog: TFindDialog) : bool; - procedure FindDialogClose(Sender: TObject); - procedure DoMouseSelectLineRange(NewPos: TBufferCoord); - procedure DoMouseSelectWordRange(NewPos: TBufferCoord); -//++ CodeFolding - procedure SetUseCodeFolding(const Value: Boolean); - procedure OnCodeFoldingChange(Sender: TObject); - function GetCollapseMarkRect(Row: Integer; Line: Integer = -1): TRect; - function GetFoldShapeRect(Row: Integer): TRect; -//-- CodeFolding - protected - FIgnoreNextChar: Boolean; - FCharCodeString: string; - function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; - MousePos: TPoint): Boolean; override; - procedure CreateParams(var Params: TCreateParams); override; - procedure CreateWnd; override; - procedure InvalidateRect(const aRect: TRect; aErase: Boolean); virtual; - procedure DblClick; override; - procedure TripleClick; virtual; - procedure QuadrupleClick; virtual; - procedure DecPaintLock; - procedure DefineProperties(Filer: TFiler); override; - procedure DoChange; virtual; - //++ Ole Drag & Drop - procedure OleDragEnter(Sender : TObject; DataObject : IDataObject; - State : TShiftState; MousePt : TPoint; var Effect: LongInt; - var Result: HResult); virtual; - procedure OleDragOver(Sender : TObject; DataObject : IDataObject; - State : TShiftState; MousePt : TPoint; var Effect: LongInt; - var Result: HResult); virtual; - procedure OleDrop(Sender : TObject; DataObject : IDataObject; - State : TShiftState; MousePt : TPoint; var Effect: LongInt; - var Result: HResult); virtual; - procedure OleDragLeave(Sender : TObject; var Result : HResult); virtual; - //-- Ole Drag & Drop - function GetReadOnly: boolean; virtual; - procedure HighlighterAttrChanged(Sender: TObject); - procedure IncPaintLock; - procedure InitializeCaret; - procedure KeyUp(var Key: Word; Shift: TShiftState); override; - procedure KeyDown(var Key: Word; Shift: TShiftState); override; - procedure KeyPress(var Key: Char); override; - procedure LinesChanged(Sender: TObject); virtual; - procedure ListCleared(Sender: TObject); - procedure ListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); - procedure ListInserted(Sender: TObject; Index: Integer; aCount: Integer); - procedure ListPutted(Sender: TObject; Index: Integer; aCount: Integer); - //helper procs to chain list commands - procedure ChainListCleared(Sender: TObject); - procedure ChainListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); - procedure ChainListInserted(Sender: TObject; aIndex: Integer; aCount: Integer); - procedure ChainListPutted(Sender: TObject; aIndex: Integer; aCount: Integer); - procedure ChainLinesChanging(Sender: TObject); - procedure ChainLinesChanged(Sender: TObject); - procedure ChainUndoRedoAdded(Sender: TObject); - procedure ScanRanges; - procedure Loaded; override; - procedure MarkListChange(Sender: TObject); - procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: - Integer); override; - procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; - procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - override; - procedure NotifyHookedCommandHandlers(AfterProcessing: Boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data: pointer); virtual; - procedure Paint; override; - procedure PaintGutter(const AClip: TRect; const aFirstRow, - aLastRow: Integer); virtual; - procedure PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, - FirstCol, LastCol: Integer); virtual; - procedure RecalcCharExtent; - procedure RedoItem; - procedure InternalSetCaretXY(const Value: TBufferCoord); virtual; - procedure SetCaretXY(const Value: TBufferCoord); virtual; - procedure SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); virtual; - procedure SetFontQuality(AValue: TFontQuality); - procedure SetName(const Value: TComponentName); override; - procedure SetReadOnly(Value: boolean); virtual; - procedure SetWantReturns(Value: Boolean); - procedure SetSelText(const Value: string); - procedure SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; Value: PWideChar; - AddToUndoList: Boolean = True; SilentDelete: Boolean = False); - procedure SetWantTabs(Value: Boolean); - procedure StatusChanged(AChanges: TSynStatusChanges); - // If the translations requires Data, memory will be allocated for it via a - // GetMem call. The client must call FreeMem on Data if it is not NIL. - function TranslateKeyCode(Code: word; Shift: TShiftState; - var Data: pointer): TSynEditorCommand; - procedure UndoItem; - procedure UpdateMouseCursor; virtual; - protected - fGutterWidth: Integer; - fInternalImage: TSynInternalImage; - procedure HideCaret; - procedure ShowCaret; - procedure DoOnClearBookmark(var Mark: TSynEditMark); virtual; - procedure DoOnCommandProcessed(Command: TSynEditorCommand; AChar: WideChar; - Data: pointer); virtual; - procedure DoOnGutterClick(Button: TMouseButton; X, Y: Integer); virtual; - procedure DoOnPaint; virtual; - procedure DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); virtual; - procedure DoOnPaintTransient(TransientType: TTransientType); virtual; - procedure DoOnPlaceMark(var Mark: TSynEditMark); virtual; - procedure DoOnProcessCommand(var Command: TSynEditorCommand; - var AChar: WideChar; Data: pointer); virtual; - function DoOnReplaceText(const ASearch, AReplace: string; - Line, Column: Integer): TSynReplaceAction; virtual; - function DoOnSpecialLineColors(Line: Integer; - var Foreground, Background: TColor): Boolean; virtual; - procedure DoOnStatusChange(Changes: TSynStatusChanges); virtual; - function GetSelEnd: integer; - function GetSelStart: integer; - function GetSelLength: integer; - procedure SetSelEnd(const Value: integer); - procedure SetSelStart(const Value: integer); - procedure SetSelLength(const Value: integer); - procedure SetAlwaysShowCaret(const Value: Boolean); - function ShrinkAtWideGlyphs(const S: string; First: Integer; - var CharCount: Integer): string; - procedure LinesHookChanged; - property InternalCaretX: Integer write InternalSetCaretX; - property InternalCaretY: Integer write InternalSetCaretY; - property InternalCaretXY: TBufferCoord write InternalSetCaretXY; - property FontQuality: TFontQuality read fFontQuality write SetFontQuality; -//++ DPI-Aware - procedure ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$endif}); override; -//-- DPI-Aware - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - property Canvas; - property SelStart: Integer read GetSelStart write SetSelStart; - property SelEnd: Integer read GetSelEnd write SetSelEnd; - property AlwaysShowCaret: Boolean read FAlwaysShowCaret - write SetAlwaysShowCaret; - procedure UpdateCaret; - procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1: TShiftState; - Key2: word = 0; SS2: TShiftState = []); - procedure BeginUndoBlock; - procedure BeginUpdate; - function CaretInView: Boolean; - function CharIndexToRowCol(Index: Integer): TBufferCoord; - procedure Clear; - procedure ClearAll; - procedure ClearBookMark(BookMark: Integer); - procedure ClearSelection; - procedure CommandProcessor(Command: TSynEditorCommand; AChar: WideChar; - Data: pointer); virtual; - procedure ClearUndo; - procedure CopyToClipboard; - procedure CutToClipboard; - procedure DoCopyToClipboard(const SText: string); - procedure EndUndoBlock; - procedure EndUpdate; - procedure EnsureCursorPosVisible; - procedure EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; - EvenIfVisible: Boolean = False); - procedure FindMatchingBracket; virtual; - function GetMatchingBracket: TBufferCoord; virtual; - function GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; virtual; - function ExecuteAction(Action: TBasicAction): Boolean; override; - procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; - Data: pointer); virtual; - function ExpandAtWideGlyphs(const S: string): string; - function GetBookMark(BookMark: Integer; var X, Y: Integer): Boolean; - function GetHighlighterAttriAtRowCol(const XY: TBufferCoord; var Token: string; - var Attri: TSynHighlighterAttributes): Boolean; - function GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; var Token: string; - var TokenType, Start: Integer; - var Attri: TSynHighlighterAttributes): boolean; - function GetPositionOfMouse(out aPos: TBufferCoord): Boolean; - function GetWordAtRowCol(XY: TBufferCoord): string; - procedure GotoBookMark(BookMark: Integer); virtual; - procedure GotoLineAndCenter(ALine: Integer); virtual; - function IsIdentChar(AChar: WideChar): Boolean; virtual; - function IsWhiteChar(AChar: WideChar): Boolean; virtual; - function IsWordBreakChar(AChar: WideChar): Boolean; virtual; - - procedure InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; AddToUndoList: Boolean); - procedure DoBlockIndent; - procedure DoBlockUnindent; - - procedure InvalidateGutter; - procedure InvalidateGutterLine(aLine: integer); - procedure InvalidateGutterLines(FirstLine, LastLine: integer); - procedure InvalidateLine(Line: integer); - procedure InvalidateLines(FirstLine, LastLine: integer); - procedure InvalidateSelection; - function IsBookmark(BookMark: Integer): Boolean; - function IsPointInSelection(const Value: TBufferCoord): Boolean; - procedure LockUndo; - function BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; - function DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; - function LineToRow(aLine: Integer): Integer; - function RowToLine(aRow: Integer): Integer; - procedure Notification(AComponent: TComponent; - Operation: TOperation); override; - procedure PasteFromClipboard; - - function NextWordPos: TBufferCoord; virtual; - function NextWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; - function WordStart: TBufferCoord; virtual; - function WordStartEx(const XY: TBufferCoord): TBufferCoord; virtual; - function WordEnd: TBufferCoord; virtual; - function WordEndEx(const XY: TBufferCoord): TBufferCoord; virtual; - function PrevWordPos: TBufferCoord; virtual; - function PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; - - function PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; - function PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; - procedure Redo; - procedure RegisterCommandHandler(const AHandlerProc: THookedCommandEvent; - AHandlerData: pointer); - function RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; - function RowColToCharIndex(RowCol: TBufferCoord): Integer; - function SearchReplace(const ASearch, AReplace: string; - AOptions: TSynSearchOptions): Integer; - procedure SelectAll; - procedure SetBookMark(BookMark: Integer; X: Integer; Y: Integer); - procedure SetCaretAndSelection(const ptCaret, ptBefore, ptAfter: TBufferCoord); - procedure SetDefaultKeystrokes; virtual; - procedure SetSelWord; - procedure SetWordBlock(Value: TBufferCoord); - procedure Undo; - procedure UnlockUndo; - procedure UnregisterCommandHandler(AHandlerProc: THookedCommandEvent); - function UpdateAction(Action: TBasicAction): Boolean; override; - procedure SetFocus; override; - - procedure AddKeyUpHandler(aHandler: TKeyEvent); - procedure RemoveKeyUpHandler(aHandler: TKeyEvent); - procedure AddKeyDownHandler(aHandler: TKeyEvent); - procedure RemoveKeyDownHandler(aHandler: TKeyEvent); - procedure AddKeyPressHandler(aHandler: TKeyPressEvent); - procedure RemoveKeyPressHandler(aHandler: TKeyPressEvent); - procedure AddFocusControl(aControl: TWinControl); - procedure RemoveFocusControl(aControl: TWinControl); - procedure AddMouseDownHandler(aHandler: TMouseEvent); - procedure RemoveMouseDownHandler(aHandler: TMouseEvent); - procedure AddMouseUpHandler(aHandler: TMouseEvent); - procedure RemoveMouseUpHandler(aHandler: TMouseEvent); - procedure AddMouseCursorHandler(aHandler: TMouseCursorEvent); - procedure RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); - - procedure WndProc(var Msg: TMessage); override; - procedure SetLinesPointer(ASynEdit: TCustomSynEdit); - procedure RemoveLinesPointer; - procedure HookTextBuffer(aBuffer: TSynEditStringList; - aUndo, aRedo: TSynEditUndoList); - procedure UnHookTextBuffer; - {Command implementations} - procedure ExecCmdDeleteLine; - procedure ExecCmdCopyOrMoveLine(const Command: TSynEditorCommand); - procedure ExecCmdCaseChange(const Cmd : TSynEditorCommand); -//++ CodeFolding - procedure CollapseAll; - procedure UncollapseAll; - procedure Collapse(FoldRangeIndex: Integer; Invalidate:Boolean = True); - procedure Uncollapse(FoldRangeIndex: Integer; Invalidate:Boolean = True); - procedure UncollapseAroundLine(Line: Integer); - procedure CollapseNearest; - procedure UncollapseNearest; - procedure CollapseLevel(Level : integer); - procedure UnCollapseLevel(Level : integer); - procedure CollapseFoldType(FoldType : Integer); - procedure UnCollapseFoldType(FoldType : Integer); -//-- CodeFolding - public - property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; - property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; - property BlockBegin: TBufferCoord read GetBlockBegin write SetBlockBegin; - property BlockEnd: TBufferCoord read GetBlockEnd write SetBlockEnd; - property CanPaste: Boolean read GetCanPaste; - property CanRedo: Boolean read GetCanRedo; - property CanUndo: Boolean read GetCanUndo; - property CaretX: Integer read fCaretX write SetCaretX; - property CaretY: Integer read fCaretY write SetCaretY; - property CaretXY: TBufferCoord read GetCaretXY write SetCaretXY; - property ActiveLineColor: TColor read fActiveLineColor - write SetActiveLineColor default clNone; - property DisplayX: Integer read GetDisplayX; - property DisplayY: Integer read GetDisplayY; - property DisplayXY: TDisplayCoord read GetDisplayXY; - property DisplayLineCount: Integer read GetDisplayLineCount; - property CharsInWindow: Integer read fCharsInWindow; - property CharWidth: Integer read fCharWidth; - property Color; - property Cursor default crIBeam; - property Font: TFont read GetFont write SetFont; - property Highlighter: TSynCustomHighlighter - read fHighlighter write SetHighlighter; - property LeftChar: Integer read fLeftChar write SetLeftChar; - property LineHeight: Integer read fTextHeight; - property LinesInWindow: Integer read fLinesInWindow; - property LineText: string read GetLineText write SetLineText; - property Lines: TStrings read fLines write SetLines; - property Marks: TSynEditMarkList read fMarkList; - property Modified: Boolean read fModified write SetModified; - property PaintLock: Integer read fPaintLock; - property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False; - property SearchEngine: TSynEditSearchCustom read fSearchEngine write SetSearchEngine; - property SelAvail: Boolean read GetSelAvail; - property SelLength: Integer read GetSelLength write SetSelLength; - property SelTabBlock: Boolean read GetSelTabBlock; - property SelTabLine: Boolean read GetSelTabLine; - property SelText: string read GetSelText write SetSelText; - property StateFlags: TSynStateFlags read fStateFlags; - property Text: string read SynGetText write SynSetText; - property TopLine: Integer read fTopLine write SetTopLine; - property WordAtCursor: string read GetWordAtCursor; - property WordAtMouse: string read GetWordAtMouse; - property UndoList: TSynEditUndoList read fUndoList; - property RedoList: TSynEditUndoList read fRedoList; - public - property OnProcessCommand: TProcessCommandEvent - read FOnProcessCommand write FOnProcessCommand; - -//++ CodeFolding - property CodeFolding: TSynCodeFolding read fCodeFolding write fCodeFolding; - property UseCodeFolding: Boolean read fUseCodeFolding write SetUseCodeFolding; - property AllFoldRanges: TSynFoldRanges read fAllFoldRanges; -//-- CodeFolding - property BookMarkOptions: TSynBookMarkOpt - read fBookMarkOpt write fBookMarkOpt; - property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle - default bsSingle; - property ExtraLineSpacing: Integer - read fExtraLineSpacing write SetExtraLineSpacing default 0; - property Gutter: TSynGutter read fGutter write SetGutter; - property HideSelection: Boolean read fHideSelection write SetHideSelection - default False; - property InsertCaret: TSynEditCaretType read FInsertCaret - write SetInsertCaret default ctVerticalLine; - property InsertMode: boolean read fInserting write SetInsertMode - default true; - property IsScrolling : Boolean read FIsScrolling; - property Keystrokes: TSynEditKeyStrokes - read FKeystrokes write SetKeystrokes stored False; - property MaxUndo: Integer read GetMaxUndo write SetMaxUndo default 1024; - property Options: TSynEditorOptions read GetOptions write SetOptions - default SYNEDIT_DEFAULT_OPTIONS; - property OverwriteCaret: TSynEditCaretType read FOverwriteCaret - write SetOverwriteCaret default ctBlock; - property RightEdge: Integer read fRightEdge write SetRightEdge default 80; - property RightEdgeColor: TColor - read fRightEdgeColor write SetRightEdgeColor default clSilver; - property ScrollHintColor: TColor read fScrollHintColor - write fScrollHintColor default clInfoBk; - property ScrollHintFormat: TScrollHintFormat read fScrollHintFormat - write fScrollHintFormat default shfTopLineOnly; - property ScrollBars: TScrollStyle - read FScrollBars write SetScrollBars default ssBoth; - property SelectedColor: TSynSelectedColor - read FSelectedColor write FSelectedColor; - property SelectionMode: TSynSelectionMode - read FSelectionMode write SetSelectionMode default smNormal; - property ActiveSelectionMode: TSynSelectionMode read fActiveSelectionMode - write SetActiveSelectionMode stored False; - property TabWidth: integer read fTabWidth write SetTabWidth default 8; - property WantReturns: boolean read fWantReturns write SetWantReturns default True; - property WantTabs: boolean read fWantTabs write SetWantTabs default False; - property WordWrap: boolean read GetWordWrap write SetWordWrap default False; - property WordWrapGlyph: TSynGlyph read fWordWrapGlyph write SetWordWrapGlyph; - property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnClearBookmark: TPlaceMarkEvent read fOnClearMark - write fOnClearMark; - property OnCommandProcessed: TProcessCommandEvent - read fOnCommandProcessed write fOnCommandProcessed; - property OnContextHelp: TContextHelpEvent - read fOnContextHelp write fOnContextHelp; - property OnDropFiles: TDropFilesEvent read fOnDropFiles write fOnDropFiles; - property OnGutterClick: TGutterClickEvent - read fOnGutterClick write fOnGutterClick; - property OnGutterGetText: TGutterGetTextEvent read fOnGutterGetText - write fOnGutterGetText; - property OnGutterPaint: TGutterPaintEvent read fOnGutterPaint - write fOnGutterPaint; - property OnMouseCursor: TMouseCursorEvent read fOnMouseCursor - write fOnMouseCursor; - property OnPaint: TPaintEvent read fOnPaint write fOnPaint; - property OnPlaceBookmark: TPlaceMarkEvent - read FOnPlaceMark write FOnPlaceMark; - property OnProcessUserCommand: TProcessCommandEvent - read FOnProcessUserCommand write FOnProcessUserCommand; - property OnReplaceText: TReplaceTextEvent read fOnReplaceText - write fOnReplaceText; - property OnSpecialLineColors: TSpecialLineColorsEvent - read fOnSpecialLineColors write fOnSpecialLineColors; - property OnStatusChange: TStatusChangeEvent - read fOnStatusChange write fOnStatusChange; - property OnPaintTransient: TPaintTransient - read fOnPaintTransient write fOnPaintTransient; - property OnScroll: TScrollEvent read fOnScroll write fOnScroll; - property OnTripleClick: TNotifyEvent - read fOnTripleClick write fOnTripleClick; - property OnQuadrupleClick: TNotifyEvent - read fOnQudrupleClick write fOnQudrupleClick; -//++ CodeFolding - property OnScanForFoldRanges: TScanForFoldRangesEvent - read fOnScanForFoldRanges write fOnScanForFoldRanges; -//-- CodeFolding - property OnSearchNotFound: TCustomSynEditSearchNotFoundEvent - read fSearchNotFound write fSearchNotFound; - end; - - TSynEdit = class(TCustomSynEdit) - published - // inherited properties - property Align; - property Anchors; - property Constraints; - property Color; - property ActiveLineColor; - property Ctl3D; - property Cursor; - property ParentCtl3D; - property Enabled; - property Font; - property Height; - property Name; - property ParentColor default False; - property ParentFont default False; - property ParentShowHint; - property PopupMenu; - property ShowHint; - property TabOrder; - property TabStop default True; - property Visible; - property Width; - // inherited events - property OnClick; - property OnDblClick; - property OnDragDrop; - property OnDragOver; - property OnEndDock; - property OnStartDock; - property OnEndDrag; - property OnEnter; - property OnExit; - property OnKeyDown; - property OnKeyPress; - property OnKeyUp; - property OnMouseDown; - property OnMouseMove; - property OnMouseUp; - property OnMouseWheel; - property OnMouseWheelDown; - property OnMouseWheelUp; - property OnStartDrag; - // TCustomSynEdit properties -//++ CodeFolding - property CodeFolding; - property UseCodeFolding; -//-- CodeFolding - property BookMarkOptions; - property BorderStyle; - property ExtraLineSpacing; - property FontQuality default fqClearTypeNatural; - property Gutter; - property HideSelection; - property Highlighter; - property ImeMode; - property ImeName; - property InsertCaret; - property InsertMode; - property Keystrokes; - property Lines; - property MaxUndo; - property Options; - property OverwriteCaret; - property ReadOnly; - property RightEdge; - property RightEdgeColor; - property ScrollHintColor; - property ScrollHintFormat; - property ScrollBars; - property SearchEngine; - property SelectedColor; - property SelectionMode; - property TabWidth; - property WantReturns; - property WantTabs; - property WordWrap; - property WordWrapGlyph; - // TCustomSynEdit events - property OnChange; - property OnClearBookmark; - property OnCommandProcessed; - property OnContextHelp; - property OnDropFiles; - property OnGutterClick; - property OnGutterGetText; - property OnGutterPaint; - property OnMouseCursor; - property OnPaint; - property OnPlaceBookmark; - property OnProcessCommand; - property OnProcessUserCommand; - property OnReplaceText; - property OnScroll; - property OnSpecialLineColors; - property OnStatusChange; - property OnPaintTransient; - property OnTripleClick; - property OnQuadrupleClick; - property OnSearchNotFound; -//++ CodeFolding - property OnScanForFoldRanges; -//-- CodeFolding - end; - -implementation - -{$R SynEdit.res} - -uses - Types, - Consts, - Character, - AnsiStrings, - Clipbrd, - ShellAPI, - SynEditWordWrap, - SynEditStrConst, - SynEditDataObject, - SynEditDragDrop; - -function CeilOfIntDiv(Dividend: Cardinal; Divisor: Word): Word; -Var - Remainder: Word; -begin - DivMod(Dividend, Divisor, Result, Remainder); - if Remainder > 0 then - Inc(Result); -end; - -function TrimTrailingSpaces(const S: string): string; -var - I: Integer; -begin - I := Length(S); - while (I > 0) and ((S[I] = #32) or (S[I] = #9)) do - Dec(I); - Result := Copy(S, 1, I); -end; - -{ THookedCommandHandlerEntry } - -type - THookedCommandHandlerEntry = class(TObject) - private - fEvent: THookedCommandEvent; - fData: pointer; - constructor Create(AEvent: THookedCommandEvent; AData: pointer); - function Equals(AEvent: THookedCommandEvent): Boolean; reintroduce; - end; - -constructor THookedCommandHandlerEntry.Create(AEvent: THookedCommandEvent; - AData: pointer); -begin - inherited Create; - fEvent := AEvent; - fData := AData; -end; - -function THookedCommandHandlerEntry.Equals(AEvent: THookedCommandEvent): Boolean; -begin - with TMethod(fEvent) do - Result := (Code = TMethod(AEvent).Code) and (Data = TMethod(AEvent).Data); -end; - -{ TCustomSynEdit } - -function TCustomSynEdit.PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; -// Result is in display coordinates -var - f: Single; -begin - f := (aX - fGutterWidth - 2) / fCharWidth; - // don't return a partially visible last line - if aY >= fLinesInWindow * fTextHeight then - begin - aY := fLinesInWindow * fTextHeight - 1; - if aY < 0 then - aY := 0; - end; - Result.Column := Max(1, LeftChar + Round(f)); - Result.Row := Max(1, TopLine + (aY div fTextHeight)); -end; - -function TCustomSynEdit.PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; -begin - Result.Column := Max(1, LeftChar + ((aX - fGutterWidth - 2) div fCharWidth)); - Result.Row := Max(1, TopLine + (aY div fTextHeight)); -end; - -function TCustomSynEdit.RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; -begin - Result.X := (RowCol.Column-1) * fCharWidth + fTextOffset; - Result.Y := (RowCol.Row - fTopLine) * fTextHeight; -end; - -procedure TCustomSynEdit.ComputeCaret(X, Y: Integer); -//X,Y are pixel coordinates -var - vCaretNearestPos : TDisplayCoord; -begin - vCaretNearestPos := PixelsToNearestRowColumn(X, Y); - vCaretNearestPos.Row := MinMax(vCaretNearestPos.Row, 1, DisplayLineCount); - SetInternalDisplayXY(vCaretNearestPos); -end; - -procedure TCustomSynEdit.ComputeScroll(X, Y: Integer); -//X,Y are pixel coordinates -var - iScrollBounds: TRect; { relative to the client area } - ScrollAreaSize : integer; -const - ScrollAreaDefaultSize = 4; -begin - iScrollBounds := Bounds(fGutterWidth, 0, fCharsInWindow * fCharWidth, - fLinesInWindow * fTextHeight); - - ScrollAreaSize := 0; - if sfOleDragSource in fStateFlags then - Inc(ScrollAreaSize, ScrollAreaDefaultSize); - if BorderStyle = bsNone then - Inc(ScrollAreaSize, 2); - - InflateRect(iScrollBounds, - -MulDiv(ScrollAreaSize, FCurrentPPI, 96), - -MulDiv(ScrollAreaSize, FCurrentPPI, 96)); - - if (X < iScrollBounds.Left) and (LeftChar > 1) then - fScrollDeltaX := (X - iScrollBounds.Left) div fCharWidth - 1 - else if X >= iScrollBounds.Right then - fScrollDeltaX := (X - iScrollBounds.Right) div fCharWidth + 1 - else - fScrollDeltaX := 0; - - if (Y < iScrollBounds.Top) and (TopLine > 1) then - fScrollDeltaY := (Y - iScrollBounds.Top) div fTextHeight - 1 - else if Y >= iScrollBounds.Bottom then - fScrollDeltaY := (Y - iScrollBounds.Bottom) div fTextHeight + 1 - else - fScrollDeltaY := 0; - - fScrollTimer.Enabled := (fScrollDeltaX <> 0) or (fScrollDeltaY <> 0); -end; - -procedure TCustomSynEdit.DoCopyToClipboard(const SText: string); -begin - OleSetClipboard(TSynEditDataObject.Create(Self)); -end; - -procedure TCustomSynEdit.CopyToClipboard; -var - SText: string; - ChangeTrim: Boolean; -begin - if SelAvail then - begin - ChangeTrim := (fActiveSelectionMode = smColumn) and (eoTrimTrailingSpaces in Options); - try - if ChangeTrim then - Exclude(fOptions, eoTrimTrailingSpaces); - SText := SelText; - finally - if ChangeTrim then - Include(fOptions, eoTrimTrailingSpaces); - end; - DoCopyToClipboard(SText); - end; -end; - -procedure TCustomSynEdit.CutToClipboard; -begin - if not ReadOnly and SelAvail then - begin - BeginUndoBlock; - try - DoCopyToClipboard(SelText); - SelText := ''; - finally - EndUndoBlock; - end; - end; -end; - -constructor TCustomSynEdit.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fLines := TSynEditStringList.Create(ExpandAtWideGlyphs); - fOrigLines := fLines; - with TSynEditStringList(fLines) do - begin - OnChange := LinesChanged; - OnChanging := LinesChanging; - OnCleared := ListCleared; - OnDeleted := ListDeleted; - OnInserted := ListInserted; - OnPutted := ListPutted; - end; - fFontDummy := TFont.Create; - fUndoList := TSynEditUndoList.Create; - fUndoList.OnAddedUndo := UndoRedoAdded; - fOrigUndoList := fUndoList; - fRedoList := TSynEditUndoList.Create; - fRedoList.OnAddedUndo := UndoRedoAdded; - fOrigRedoList := fRedoList; - - DoubleBuffered := False; - fActiveLineColor := clNone; - fSelectedColor := TSynSelectedColor.Create; - fSelectedColor.OnChange := SelectedColorsChanged; - fBookMarkOpt := TSynBookMarkOpt.Create(Self); - fBookMarkOpt.OnChange := BookMarkOptionsChanged; -// fRightEdge has to be set before FontChanged is called for the first time - fRightEdge := 80; - fGutter := TSynGutter.Create; - fGutter.OnChange := GutterChanged; - fGutterWidth := fGutter.Width; - fWordWrapGlyph := TSynGlyph.Create(HINSTANCE, 'SynEditWrapped', clLime); - fWordWrapGlyph.OnChange := WordWrapGlyphChange; - fTextOffset := fGutterWidth + 2; - ControlStyle := ControlStyle + [csOpaque, csSetCaption]; - ControlStyle := ControlStyle + [csNeedsBorderPaint]; - Height := 150; - Width := 200; - Cursor := crIBeam; - Color := clWindow; - fFontQuality := fqClearTypeNatural; - fFontDummy.Name := DefaultFontName; - fFontDummy.Size := 10; - fFontDummy.CharSet := DEFAULT_CHARSET; - fFontDummy.Quality := fFontQuality; - fTextDrawer := TheTextDrawer.Create([fsBold], fFontDummy); - Font.Assign(fFontDummy); - Font.OnChange := SynFontChanged; - ParentFont := False; - ParentColor := False; - TabStop := True; - fInserting := True; - fScrollBars := ssBoth; - fBorderStyle := bsSingle; - fInsertCaret := ctVerticalLine; - fOverwriteCaret := ctBlock; - FSelectionMode := smNormal; - fActiveSelectionMode := smNormal; - fFocusList := TList.Create; - fKbdHandler := TSynEditKbdHandler.Create; - fKeystrokes := TSynEditKeyStrokes.Create(Self); - fMarkList := TSynEditMarkList.Create(self); - fMarkList.OnChange := MarkListChange; - SetDefaultKeystrokes; - fRightEdgeColor := clSilver; - fWantReturns := True; - fWantTabs := False; - fTabWidth := 8; - fLeftChar := 1; - fTopLine := 1; - fCaretX := 1; - fLastCaretX := 1; - fCaretY := 1; - fBlockBegin.Char := 1; - fBlockBegin.Line := 1; - fBlockEnd := fBlockBegin; - fOptions := SYNEDIT_DEFAULT_OPTIONS; - fScrollTimer := TTimer.Create(Self); - fScrollTimer.Enabled := False; - fScrollTimer.Interval := 100; - fScrollTimer.OnTimer := ScrollTimerHandler; - - fScrollHintColor := clInfoBk; - fScrollHintFormat := shfTopLineOnly; -//++ CodeFolding - fCodeFolding := TSynCodeFolding.Create; - fCodeFolding.OnChange := OnCodeFoldingChange; - fAllFoldRanges := TSynFoldRanges.Create; -//-- CodeFolding - SynFontChanged(nil); -end; - -procedure TCustomSynEdit.CreateParams(var Params: TCreateParams); -const - BorderStyles: array[TBorderStyle] of DWORD = (0, WS_BORDER); - ClassStylesOff = CS_VREDRAW or CS_HREDRAW; -begin - // Clear WindowText to avoid it being used as Caption, or else window creation will - // fail if it's bigger than 64KB. It's useless to set the Caption anyway. - StrDispose(WindowText); - WindowText := nil; - inherited CreateParams(Params); - with Params do - begin - WindowClass.Style := WindowClass.Style and not ClassStylesOff; - Style := Style or BorderStyles[fBorderStyle] or WS_CLIPCHILDREN; - - if NewStyleControls and Ctl3D and (fBorderStyle = bsSingle) then - begin - Style := Style and not WS_BORDER; - ExStyle := ExStyle or WS_EX_CLIENTEDGE; - // avoid flicker while scrolling or resizing - if not (csDesigning in ComponentState) and CheckWin32Version(5, 1) then - ExStyle := ExStyle or WS_EX_COMPOSITED; - end; - - end; -end; - -procedure TCustomSynEdit.DecPaintLock; -var - vAuxPos: TDisplayCoord; -begin - Assert(fPaintLock > 0); - Dec(fPaintLock); - if (fPaintLock = 0) and HandleAllocated then - begin - if sfScrollbarChanged in fStateFlags then - UpdateScrollbars; - // Locks the caret inside the visible area - if WordWrap and ([scCaretX,scCaretY] * fStatusChanges <> []) then - begin - vAuxPos := DisplayXY; - // This may happen in the last row of a line or in rows which length is - // greater than CharsInWindow (Tabs and Spaces are allowed beyond - // CharsInWindow while wrapping the lines) - if (vAuxPos.Column > CharsInWindow +1) and (CharsInWindow > 0) then - begin - if fCaretAtEOL then - fCaretAtEOL := False - else - begin - if scCaretY in fStatusChanges then - begin - vAuxPos.Column := CharsInWindow + 1; - fCaretX := DisplayToBufferPos(vAuxPos).Char; - Include(fStatusChanges,scCaretX); - UpdateLastCaretX; - end; - end; - Include(fStateFlags, sfCaretChanged); - end; - end; - if sfCaretChanged in fStateFlags then - UpdateCaret; - if fStatusChanges <> [] then - DoOnStatusChange(fStatusChanges); - end; -end; - -destructor TCustomSynEdit.Destroy; -begin - Highlighter := nil; - if (fChainedEditor <> nil) or (fLines <> fOrigLines) then - RemoveLinesPointer; - - inherited Destroy; - - // free listeners while other fields are still valid - - // do not use FreeAndNil, it first nils and then freey causing problems with - // code accessing fHookedCommandHandlers while destruction - fHookedCommandHandlers.Free; - fHookedCommandHandlers := nil; - // do not use FreeAndNil, it first nils and then frees causing problems with - // code accessing fPlugins while destruction - fPlugins.Free; - fPlugins := nil; - - fMarkList.Free; - fBookMarkOpt.Free; - fKeyStrokes.Free; - fKbdHandler.Free; - fFocusList.Free; - fSelectedColor.Free; - fOrigUndoList.Free; - fOrigRedoList.Free; - fGutter.Free; - fWordWrapGlyph.Free; - fTextDrawer.Free; - fInternalImage.Free; - fFontDummy.Free; - fOrigLines.Free; -//++ CodeFolding - fCodeFolding.Free; - fAllFoldRanges.Free; -//-- CodeFolding -end; - -function TCustomSynEdit.GetBlockBegin: TBufferCoord; -begin - if (fBlockEnd.Line < fBlockBegin.Line) - or ((fBlockEnd.Line = fBlockBegin.Line) and (fBlockEnd.Char < fBlockBegin.Char)) - then - Result := fBlockEnd - else - Result := fBlockBegin; -end; - -function TCustomSynEdit.GetBlockEnd: TBufferCoord; -begin - if (fBlockEnd.Line < fBlockBegin.Line) - or ((fBlockEnd.Line = fBlockBegin.Line) and (fBlockEnd.Char < fBlockBegin.Char)) - then - Result := fBlockBegin - else - Result := fBlockEnd; -end; - -procedure TCustomSynEdit.SynFontChanged(Sender: TObject); -begin - RecalcCharExtent; - SizeOrFontChanged(True); -end; - -function TCustomSynEdit.GetFont: TFont; -begin - Result := inherited Font; -end; - -function TCustomSynEdit.GetLineText: string; -begin - if (CaretY >= 1) and (CaretY <= Lines.Count) then - Result := Lines[CaretY - 1] - else - Result := ''; -end; - -function TCustomSynEdit.GetSelAvail: Boolean; -begin - Result := (fBlockBegin.Char <> fBlockEnd.Char) or - ((fBlockBegin.Line <> fBlockEnd.Line) and (fActiveSelectionMode <> smColumn)); -end; - -function TCustomSynEdit.GetSelTabBlock: Boolean; -begin - Result := (fBlockBegin.Line <> fBlockEnd.Line) and (fActiveSelectionMode <> smColumn); -end; - -function TCustomSynEdit.GetSelTabLine: Boolean; -begin - Result := (BlockBegin.Char <= 1) and (BlockEnd.Char > length(Lines[CaretY - 1])) and SelAvail; -end; - -function TCustomSynEdit.GetSelText: string; - - function CopyPadded(const S: string; Index, Count: Integer): string; - var - SrcLen: Integer; - DstLen: Integer; - i: Integer; - P: PWideChar; - begin - SrcLen := Length(S); - DstLen := Index + Count; - if SrcLen >= DstLen then - Result := Copy(S, Index, Count) - else begin - SetLength(Result, DstLen); - P := PWideChar(Result); - StrCopy(P, PWideChar(Copy(S, Index, Count))); - Inc(P, Length(S)); - for i := 0 to DstLen - Srclen - 1 do - P[i] := #32; - end; - end; - - procedure CopyAndForward(const S: string; Index, Count: Integer; var P: - PWideChar); - var - pSrc: PWideChar; - SrcLen: Integer; - DstLen: Integer; - begin - SrcLen := Length(S); - if (Index <= SrcLen) and (Count > 0) then - begin - Dec(Index); - pSrc := PWideChar(S) + Index; - DstLen := Min(SrcLen - Index, Count); - Move(pSrc^, P^, DstLen * sizeof(WideChar)); - Inc(P, DstLen); - P^ := #0; - end; - end; - - function CopyPaddedAndForward(const S: string; Index, Count: Integer; - var P: PWideChar): Integer; - var - OldP: PWideChar; - Len, i: Integer; - begin - Result := 0; - OldP := P; - CopyAndForward(S, Index, Count, P); - Len := Count - (P - OldP); - if not (eoTrimTrailingSpaces in Options) then - begin - for i := 0 to Len - 1 do - P[i] := #32; - Inc(P, Len); - end - else - Result:= Len; - end; - -var - First, Last, TotalLen: Integer; - ColFrom, ColTo: Integer; - I: Integer; - l, r: Integer; - s: string; - P: PWideChar; - cRow: Integer; - vAuxLineChar: TBufferCoord; - vAuxRowCol: TDisplayCoord; - vTrimCount: Integer; -begin - if not SelAvail then - Result := '' - else begin - ColFrom := BlockBegin.Char; - First := BlockBegin.Line - 1; - // - ColTo := BlockEnd.Char; - Last := BlockEnd.Line - 1; - // - TotalLen := 0; - case fActiveSelectionMode of - smNormal: - if (First = Last) then - Result := Copy(Lines[First], ColFrom, ColTo - ColFrom) - else begin - // step1: calculate total length of result string - TotalLen := Max(0, Length(Lines[First]) - ColFrom + 1); - for i := First + 1 to Last - 1 do - Inc(TotalLen, Length(Lines[i])); - Inc(TotalLen, ColTo - 1); - Inc(TotalLen, Length(SLineBreak) * (Last - First)); - // step2: build up result string - SetLength(Result, TotalLen); - P := PWideChar(Result); - CopyAndForward(Lines[First], ColFrom, MaxInt, P); - - CopyAndForward(SLineBreak, 1, MaxInt, P); - - for i := First + 1 to Last - 1 do - begin - CopyAndForward(Lines[i], 1, MaxInt, P); - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; - CopyAndForward(Lines[Last], 1, ColTo - 1, P); - end; - smColumn: - begin - with BufferToDisplayPos(BlockBegin) do - begin - First := Row; - ColFrom := Column; - end; - with BufferToDisplayPos(BlockEnd) do - begin - Last := Row; - ColTo := Column; - end; - if ColFrom > ColTo then - SwapInt(ColFrom, ColTo); - // step1: pre-allocate string large enough for worst case - TotalLen := ((ColTo - ColFrom) + Length(sLineBreak)) * - (Last - First +1); - SetLength(Result, TotalLen); - P := PWideChar(Result); - - // step2: copy chunks to the pre-allocated string - TotalLen := 0; - for cRow := First to Last do - begin - vAuxRowCol.Row := cRow; - vAuxRowCol.Column := ColFrom; - vAuxLineChar := DisplayToBufferPos(vAuxRowCol); - l := vAuxLineChar.Char; - s := Lines[vAuxLineChar.Line - 1]; - vAuxRowCol.Column := ColTo; - r := DisplayToBufferPos(vAuxRowCol).Char; - - vTrimCount := CopyPaddedAndForward(s, l, r - l, P); - TotalLen := TotalLen + (r - l) - vTrimCount + Length(sLineBreak); - CopyAndForward(sLineBreak, 1, MaxInt, P); - end; - SetLength(Result, TotalLen - Length(sLineBreak)); - end; - smLine: - begin - // If block selection includes LastLine, - // line break code(s) of the last line will not be added. - // step1: calculate total length of result string - for i := First to Last do - Inc(TotalLen, Length(Lines[i]) + Length(SLineBreak)); - if Last = Lines.Count then - Dec(TotalLen, Length(SLineBreak)); - // step2: build up result string - SetLength(Result, TotalLen); - P := PWideChar(Result); - for i := First to Last - 1 do - begin - CopyAndForward(Lines[i], 1, MaxInt, P); - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; - CopyAndForward(Lines[Last], 1, MaxInt, P); - if (Last + 1) < Lines.Count then - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; - end; - end; -end; - -function TCustomSynEdit.SynGetText: string; -begin - Result := Lines.Text; -end; - -procedure TCustomSynEdit.ForceCaretX(aCaretX: integer); -{ Can place CaretX beyond the end of line } -var - vRestoreScroll: boolean; -begin - vRestoreScroll := not (eoScrollPastEol in fOptions); - Include(fOptions, eoScrollPastEol); - try - InternalCaretX := aCaretX; - finally - if vRestoreScroll then - Exclude(fOptions, eoScrollPastEol); - end; -end; - -function TCustomSynEdit.GetWordAtCursor: string; -begin - Result:=GetWordAtRowCol(CaretXY); -end; - -procedure TCustomSynEdit.HideCaret; -begin - if sfCaretVisible in fStateFlags then - if Windows.HideCaret(Handle) then - Exclude(fStateFlags, sfCaretVisible); -end; - -procedure TCustomSynEdit.IncPaintLock; -begin - inc(fPaintLock); -end; - -procedure TCustomSynEdit.InvalidateGutter; -begin - InvalidateGutterLines(-1, -1); -end; - -procedure TCustomSynEdit.InvalidateGutterLine(aLine: Integer); -begin - if (aLine < 1) or (aLine > Lines.Count) then - Exit; - - InvalidateGutterLines(aLine, aLine); -end; - -procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLine: integer); -// note: FirstLine and LastLine don't need to be in correct order -var - rcInval: TRect; -begin - if Visible and HandleAllocated then - if (FirstLine = -1) and (LastLine = -1) then - begin - rcInval := Rect(0, 0, fGutterWidth, ClientHeight); - if sfLinesChanging in fStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//-- Flicker Reduction - else - InvalidateRect(rcInval, False); - end - else begin - { find the visible lines first } - if (LastLine < FirstLine) then - SwapInt(LastLine, FirstLine); -//++ CodeFolding - if UseCodeFolding or WordWrap then -//-- CodeFolding - begin - FirstLine := LineToRow(FirstLine); - if LastLine <= Lines.Count then - LastLine := LineToRow(LastLine) - else - LastLine := MaxInt; - end; - FirstLine := Max(FirstLine, TopLine); - LastLine := Min(LastLine, TopLine + LinesInWindow); - { any line visible? } - if (LastLine >= FirstLine) then - begin - rcInval := Rect(0, fTextHeight * (FirstLine - TopLine), - fGutterWidth, fTextHeight * (LastLine - TopLine + 1)); - if sfLinesChanging in fStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//-- Flicker Reduction - else - InvalidateRect(rcInval, False); - end; - end; -end; - -procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: integer); -// note: FirstLine and LastLine don't need to be in correct order -var - rcInval: TRect; -begin - if Visible and HandleAllocated then - if (FirstLine = -1) and (LastLine = -1) then - begin - rcInval := ClientRect; - Inc(rcInval.Left, fGutterWidth); - if sfLinesChanging in fStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//-- Flicker Reduction - else - InvalidateRect(rcInval, False); - end - else begin - FirstLine := Max(FirstLine,1); - LastLine := Max(LastLine,1); - { find the visible lines first } - if (LastLine < FirstLine) then - SwapInt(LastLine, FirstLine); - - if LastLine >= Lines.Count then - LastLine := MaxInt; // paint empty space beyond last line - -//++ CodeFolding - if UseCodeFolding or WordWrap then - begin - FirstLine := LineToRow(FirstLine); - // Could avoid this conversion if (First = Last) and - // (Length < CharsInWindow) but the dependency isn't worth IMO. - if LastLine < Lines.Count then begin - if UseCodeFolding then - LastLine := LineToRow(LastLine) - else - LastLine := LineToRow(LastLine + 1) - 1; - end; - end; -//-- CodeFolding - - // TopLine is in display coordinates, so FirstLine and LastLine must be - // converted previously. - FirstLine := Max(FirstLine, TopLine); - LastLine := Min(LastLine, TopLine + LinesInWindow); - - { any line visible? } - if (LastLine >= FirstLine) then - begin - rcInval := Rect(fGutterWidth, fTextHeight * (FirstLine - TopLine), - ClientWidth, fTextHeight * (LastLine - TopLine + 1)); - if sfLinesChanging in fStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//++ Flicker Reduction - else - InvalidateRect(rcInval, False); - end; - end; -end; - -procedure TCustomSynEdit.InvalidateSelection; -begin - InvalidateLines(BlockBegin.Line, BlockEnd.Line); -end; - -procedure TCustomSynEdit.KeyUp(var Key: Word; Shift: TShiftState); -var - CharCode: Integer; -begin - { The following allows the entering of Unicode character codes using the - Alt + Numpad numbers combination. When the charcode is less than 256 - this is handled by Windows. - } - if (ssAlt in Shift) and (Key >= VK_NUMPAD0) and (Key <= VK_NUMPAD9) then - FCharCodeString := FCharCodeString + IntToStr(Key - VK_NUMPAD0); - - if Key = VK_MENU then - begin - if (FCharCodeString <> '') and TryStrToInt(FCharCodeString, CharCode) and - (CharCode >= 256) and (CharCode <= 65535) then - begin - SendMessage(Handle, WM_CHAR, CharCode, 0); - FIgnoreNextChar := True; - end; - FCharCodeString := ''; - end; - - inherited; - fKbdHandler.ExecuteKeyUp(Self, Key, Shift); -end; - -procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); -var - Data: pointer; - C: WideChar; - Cmd: TSynEditorCommand; -begin - inherited; - fKbdHandler.ExecuteKeyDown(Self, Key, Shift); - - Data := nil; - C := #0; - try - Cmd := TranslateKeyCode(Key, Shift, Data); - if Cmd <> ecNone then begin - Key := 0; // eat it. - Include(fStateFlags, sfIgnoreNextChar); - CommandProcessor(Cmd, C, Data); - end - else - Exclude(fStateFlags, sfIgnoreNextChar); - finally - if Data <> nil then - FreeMem(Data); - end; -end; - -procedure TCustomSynEdit.Loaded; -begin - inherited Loaded; - GutterChanged(Self); - UpdateScrollBars; -end; - -procedure TCustomSynEdit.KeyPress(var Key: Char); -begin - if FIgnoreNextChar then - begin - FIgnoreNextChar := False; - Exit; - end; - - inherited; // Calls the OnKeyPress event handler if present - if Key = #0 then Exit; - - // don't fire the event if key is to be ignored - if not (sfIgnoreNextChar in fStateFlags) then - begin - fKbdHandler.ExecuteKeyPress(Self, Key); - CommandProcessor(ecChar, Key, nil); - end - else - // don't ignore further keys - Exclude(fStateFlags, sfIgnoreNextChar); -end; - -function TCustomSynEdit.LeftSpaces(const Line: string): Integer; -begin - Result := LeftSpacesEx(Line, False); -end; - -//-- CodeFolding -function TCustomSynEdit.LeftSpacesEx(const Line: string; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; -//-- CodeFolding -var - p: PWideChar; -begin - p := PWideChar(Line); - if Assigned(p) and ((eoAutoIndent in fOptions) or CalcAlways) then - begin - Result := 0; - while (p^ >= #1) and (p^ <= #32) do - begin - if (p^ = #9) and WantTabs then - Inc(Result, TabWidth) - else - Inc(Result); - Inc(p); - end; - end - else - Result := 0; -end; - -function TCustomSynEdit.GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): string; -begin - if WantTabs and not(eoTabsToSpaces in Options) and (CharCount >= TabWidth) then - Result := StringofChar(#9, CharCount div TabWidth) + - StringofChar(#32, CharCount mod TabWidth) - else - Result := StringofChar(#32, CharCount); -end; - -procedure TCustomSynEdit.LinesChanging(Sender: TObject); -begin - Include(fStateFlags, sfLinesChanging); -end; - -procedure TCustomSynEdit.LinesChanged(Sender: TObject); -var - vOldMode: TSynSelectionMode; -begin -//++ CodeFolding - if (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then - begin - if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then - TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, - fLines); - InvalidateGutter; - Include(fStateFlags, sfScrollbarChanged); - end; -//-- CodeFolding - - Exclude(fStateFlags, sfLinesChanging); - if HandleAllocated then - begin -//++ Flicker Reduction -// UpdateScrollBars; -//-- Flicker Reduction - vOldMode := fActiveSelectionMode; - SetBlockBegin(CaretXY); - fActiveSelectionMode := vOldMode; - InvalidateRect(fInvalidateRect, False); - FillChar(fInvalidateRect, SizeOf(TRect), 0); - if fGutter.ShowLineNumbers and fGutter.AutoSize then - fGutter.AutoSizeDigitCount(Lines.Count); - if not (eoScrollPastEof in Options) then - TopLine := TopLine; - end; -end; - -procedure TCustomSynEdit.MouseDown(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); -var - bWasSel: Boolean; - TmpBegin, TmpEnd: TBufferCoord; - P : TPoint; - // Ole drag drop - DragSource : IDropSource; - DataObject : IDataObject; - dwEffect : integer; -begin - inherited MouseDown(Button, Shift, X, Y); - - TmpBegin := FBlockBegin; - TmpEnd := FBlockEnd; - - bWasSel := False; - if (Button = mbLeft) and ((Shift + [ssDouble]) = [ssLeft, ssDouble]) then - begin - if SelAvail then - //remember selection state, as it will be cleared later - bWasSel := True; - if (FClickCount > 0) - and (Abs(fMouseDownX - X) < GetSystemMetrics(SM_CXDRAG)) - and (Abs(fMouseDownY - Y) < GetSystemMetrics(SM_CYDRAG)) - and (fClickCountTimer.ElapsedMilliseconds < GetDoubleClickTime ) - then - Inc(fClickCount) - else - fClickCount:= 1; - fMouseDownX := X; - fMouseDownY := Y; - if fClickCount = 3 then TripleClick; - if fClickCount = 4 then QuadrupleClick; - fClickCountTimer := TStopWatch.StartNew; - end else - fClickCount := 0; - - if (Button = mbLeft) and (fClickCount > 1) then Exit; - - fKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y); - - if (Button in [mbLeft, mbRight]) then - begin - if Button = mbRight then - begin - if (eoRightMouseMovesCursor in Options) and - (SelAvail and not IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) - or not SelAvail) then - begin - InvalidateSelection; - FBlockEnd := FBlockBegin; - ComputeCaret(X, Y); - end - else - Exit; - end - else - ComputeCaret(X, Y); - end; - - if Button = mbLeft then - begin - //I couldn't track down why, but sometimes (and definately not all the time) - //the block positioning is lost. This makes sure that the block is - //maintained in case they started a drag operation on the block - FBlockBegin := TmpBegin; - FBlockEnd := TmpEnd; - - MouseCapture := True; - //if mousedown occurred in selected block begin drag operation - if SelAvail and (eoDragDropEditing in fOptions) and (X >= fGutterWidth + 2) - and (SelectionMode = smNormal) and not (ssAlt in Shift) - and IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) then - begin - if DragDetect(Handle, Point(X,Y)) then begin - DataObject := TSynEditDataObject.Create(Self); - DragSource := TSynDragSource.Create; - try - Include(fStateFlags, sfOleDragSource); - DoDragDrop(DataObject, DragSource, DROPEFFECT_COPY or DROPEFFECT_MOVE, dwEffect); - finally - Exclude(fStateFlags, sfOleDragSource); - if dwEffect = DROPEFFECT_MOVE then - ClearSelection; - end; - Exit; - end else begin - if csLButtonDown in ControlState then - begin - GetCursorPos(P); - PostMessage(Handle, WM_LBUTTONUP, 0, PointToLParam(ScreenToClient(P))); - end; - end; - end; - end; - - if not (ssDouble in Shift) then begin - if ssShift in Shift then - //BlockBegin and BlockEnd are restored to their original position in the - //code from above and SetBlockEnd will take care of proper invalidation - SetBlockEnd(CaretXY) - else - begin - if (eoAltSetsColumnMode in Options) and (fActiveSelectionMode <> smLine) then - begin - if ssAlt in Shift then - SelectionMode := smColumn - else - SelectionMode := smNormal; - end; - //Selection mode must be set before calling SetBlockBegin - SetBlockBegin(CaretXY); - end; - end; - - if (X < fGutterWidth) then - Include(fStateFlags, sfPossibleGutterClick); - if (sfPossibleGutterClick in fStateFlags) and (Button = mbRight) then - begin - DoOnGutterClick(Button, X, Y) - end; - - SetFocus; - Windows.SetFocus(Handle); -end; - -procedure TCustomSynEdit.MouseMove(Shift: TShiftState; X, Y: Integer); -var - P: TDisplayCoord; - BC: TBufferCoord; -begin - inherited MouseMove(Shift, x, y); - if (ssLeft in Shift) and MouseCapture and not IsScrolling then - begin - // should we begin scrolling? - ComputeScroll(X, Y); - { compute new caret } - P := PixelsToNearestRowColumn(X, Y); - P.Row := MinMax(P.Row, 1, DisplayLineCount); -// Not sure what was the purpose of these -// if fScrollDeltaX <> 0 then -// P.Column := DisplayX; -// if fScrollDeltaY <> 0 then -// P.Row := DisplayY; - BC := DisplayToBufferPos(P); - - if BC = CaretXY then Exit; // no movement - - if (ActiveSelectionMode = smNormal) and (fClickCount = 2) then - DoMouseSelectWordRange(BC) - else if (ActiveSelectionMode = smNormal) and (fClickCount = 3) then - DoMouseSelectLineRange(BC) - else begin - InternalCaretXY := BC; - BlockEnd := BC; - end; - - if (sfPossibleGutterClick in fStateFlags) and (FBlockBegin.Line <> CaretXY.Line) then - Include(fStateFlags, sfGutterDragging); - end; -end; - -procedure TCustomSynEdit.ScrollTimerHandler(Sender: TObject); -var - iMousePos: TPoint; - C: TDisplayCoord; - X, Y: Integer; - vCaret: TBufferCoord; -begin - GetCursorPos( iMousePos ); - iMousePos := ScreenToClient( iMousePos ); - C := PixelsToRowColumn( iMousePos.X, iMousePos.Y ); - C.Row := MinMax(C.Row, 1, DisplayLineCount); - - if fScrollDeltaX <> 0 then - begin - LeftChar := LeftChar + fScrollDeltaX; - X := LeftChar; - if fScrollDeltaX > 0 then // scrolling right? - Inc(X, CharsInWindow); - C.Column := X; - end; - if fScrollDeltaY <> 0 then - begin - if GetKeyState(SYNEDIT_SHIFT) < 0 then - TopLine := TopLine + fScrollDeltaY * LinesInWindow - else - TopLine := TopLine + fScrollDeltaY; - Y := TopLine; - if fScrollDeltaY > 0 then // scrolling down? - Inc(Y, LinesInWindow - 1); - C.Row := MinMax(Y, 1, DisplayLineCount); - end; - - vCaret := DisplayToBufferPos(C); - if ((CaretX <> vCaret.Char) or (CaretY <> vCaret.Line)) then - begin - // changes to line / column in one go - IncPaintLock; - try - if MouseCapture and (fClickCount = 2) and (ActiveSelectionMode = smNormal) then - // Line selection - DoMouseSelectWordRange(vCaret) - else if MouseCapture and (fClickCount = 3) and (ActiveSelectionMode = smNormal) then - // Line selection - DoMouseSelectLineRange(vCaret) - else begin - InternalCaretXY := vCaret; - // if MouseCapture is True we're changing selection. otherwise we're dragging - if MouseCapture then - SetBlockEnd(CaretXY); - end; - finally - DecPaintLock; - end; - end; - ComputeScroll(iMousePos.x, iMousePos.y); -end; - -procedure TCustomSynEdit.MouseUp(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); -Var -//++ Code Folding - ptLineCol: TBufferCoord; - ptRowCol: TDisplayCoord; - Index: Integer; - Rect: TRect; -//-- Code Folding -begin - inherited MouseUp(Button, Shift, X, Y); - fKbdHandler.ExecuteMouseUp(Self, Button, Shift, X, Y); - - fScrollTimer.Enabled := False; - if (Button = mbRight) and (Shift = [ssRight]) and Assigned(PopupMenu) then - exit; - MouseCapture := False; - if (fStateFlags * [sfPossibleGutterClick, sfGutterDragging] = [sfPossibleGutterClick]) - and (X < fGutterWidth) and (Button <> mbRight) then - begin - DoOnGutterClick(Button, X, Y) - end; - Exclude(fStateFlags, sfPossibleGutterClick); - Exclude(fStateFlags, sfGutterDragging); -//++ Code Folding - ptRowCol := PixelsToRowColumn(X, Y); - ptLineCol := DisplayToBufferPos(ptRowCol); - - if UseCodeFolding and CodeFolding.ShowHintMark and - fAllFoldRanges.CollapsedFoldStartAtLine(ptLineCol.Line, Index) then - begin - Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); - if PtInRect(Rect, Point(X,Y)) then - Uncollapse(Index); - end; -end; - -procedure TCustomSynEdit.DoOnGutterClick(Button: TMouseButton; X, Y: Integer); -var - i : Integer; - offs : Integer; - line : Integer; - allmrk: TSynEditMarks; - mark : TSynEditMark; -//++ CodeFolding - Index : integer; - RowColumn: TDisplayCoord; -begin - RowColumn := PixelsToRowColumn(X, Y); - Line := RowToLine(RowColumn.Row); - - // Check if we clicked on a folding thing - if UseCodeFolding then begin - if AllFoldRanges.FoldStartAtLine(Line, Index) then - begin - // See if we actually clicked on the rectangle... - if PtInRect(GetFoldShapeRect(RowColumn.Row), Point(X, Y)) then begin - if AllFoldRanges.Ranges[Index].Collapsed then - Uncollapse(Index) - else - Collapse(Index); - Exit; - end; - end; - end; -//-- CodeFolding - - // If not, check gutter marks - if Assigned(fOnGutterClick) then - begin - line := DisplayToBufferPos(PixelsToRowColumn(X,Y)).Line; - if line <= Lines.Count then - begin - Marks.GetMarksForLine(line, allmrk); - offs := 0; - mark := nil; - for i := 1 to MAX_MARKS do - begin - if assigned(allmrk[i]) then - begin - Inc(offs, BookMarkOptions.XOffset); - if X < offs then - begin - mark := allmrk[i]; - break; - end; - end; - end; //for - fOnGutterClick(Self, Button, X, Y, line, mark); - end; - end; -end; - -procedure TCustomSynEdit.Paint; -var - rcClip, rcDraw: TRect; - nL1, nL2, nC1, nC2: Integer; -begin - // Get the invalidated rect. Compute the invalid area in lines / columns. - rcClip := Canvas.ClipRect; - // columns - nC1 := LeftChar; - if (rcClip.Left > fGutterWidth + 2) then - Inc(nC1, (rcClip.Left - fGutterWidth - 2) div CharWidth); - nC2 := LeftChar + - (rcClip.Right - fGutterWidth - 2 + CharWidth - 1) div CharWidth; - // lines - nL1 := Max(TopLine + rcClip.Top div fTextHeight, TopLine); - nL2 := MinMax(TopLine + (rcClip.Bottom + fTextHeight - 1) div fTextHeight, - 1, DisplayLineCount); - // Now paint everything while the caret is hidden. - HideCaret; - try - // First paint the gutter area if it was (partly) invalidated. - if (rcClip.Left < fGutterWidth) then - begin - rcDraw := rcClip; - rcDraw.Right := fGutterWidth; - PaintGutter(rcDraw, nL1, nL2); - end; - // Then paint the text area if it was (partly) invalidated. - if (rcClip.Right > fGutterWidth) then - begin - rcDraw := rcClip; - rcDraw.Left := Max(rcDraw.Left, fGutterWidth); - PaintTextLines(rcDraw, nL1, nL2, nC1, nC2); - end; - PluginsAfterPaint(Canvas, rcClip, nL1, nL2); - // If there is a custom paint handler call it. - DoOnPaint; - DoOnPaintTransient(ttAfter); - finally - UpdateCaret; - end; -end; - -procedure TCustomSynEdit.PaintGutter(const AClip: TRect; - const aFirstRow, aLastRow: Integer); - - procedure DrawMark(aMark: TSynEditMark; var aGutterOff: Integer; - aMarkRow: Integer); - begin - if (not aMark.InternalImage) and Assigned(fBookMarkOpt.BookmarkImages) then - begin - if aMark.ImageIndex <= fBookMarkOpt.BookmarkImages.Count then - begin - if aMark.IsBookmark = BookMarkOptions.DrawBookmarksFirst then - aGutterOff := 0 - else if aGutterOff = 0 then - aGutterOff := fBookMarkOpt.XOffset; - with fBookMarkOpt do - BookmarkImages.Draw(Canvas, LeftMargin + aGutterOff, - (aMarkRow - TopLine) * fTextHeight, aMark.ImageIndex); - Inc(aGutterOff, fBookMarkOpt.XOffset); - end; - end - else begin - if aMark.ImageIndex in [0..9] then - begin - if not Assigned(fInternalImage) then - begin - fInternalImage := TSynInternalImage.Create(HINSTANCE, - 'SynEditInternalImages', 10); -//++ DPI-Aware - fInternalImage.ChangeScale(FCurrentPPI, 96); -//-- DPI-Aware - end; - if aGutterOff = 0 then - begin - fInternalImage.Draw(Canvas, aMark.ImageIndex, - fBookMarkOpt.LeftMargin + aGutterOff, - (aMarkRow - TopLine) * fTextHeight, fTextHeight); - end; - Inc(aGutterOff, fBookMarkOpt.XOffset); - end; - end; - end; - -var - cLine: Integer; - cMark: Integer; - rcLine: TRect; - aGutterOffs: PIntArray; - bHasOtherMarks: Boolean; - s: string; - vFirstLine: Integer; - vLastLine: Integer; - vMarkRow: Integer; - vGutterRow: Integer; - vLineTop: Integer; - dc: HDC; - TextSize: TSize; -//++ CodeFolding - vLine: Integer; - cRow : Integer; - rcFold: TRect; - x: Integer; - FoldRange: TSynFoldRange; - Index : Integer; - PlusMinusMargin : integer; -//-- CodeFolding -begin - vFirstLine := RowToLine(aFirstRow); - vLastLine := RowToLine(aLastRow); - //todo: Does the following comment still apply? - // Changed to use fTextDrawer.BeginDrawing and fTextDrawer.EndDrawing only - // when absolutely necessary. Note: Never change brush / pen / font of the - // canvas inside of this block (only through methods of fTextDrawer)! - // If we have to draw the line numbers then we don't want to erase - // the background first. Do it line by line with TextRect instead - // and fill only the area after the last visible line. - dc := Canvas.Handle; - - if fGutter.Gradient then - SynDrawGradient(Canvas, fGutter.GradientStartColor, fGutter.GradientEndColor, - fGutter.GradientSteps, Rect(0, 0, fGutterWidth, ClientHeight), True); - - Canvas.Brush.Color := fGutter.Color; - - if fGutter.ShowLineNumbers then - begin - if fGutter.UseFontStyle then - fTextDrawer.SetBaseFont(fGutter.Font) - else - fTextDrawer.Style := []; - fTextDrawer.BeginDrawing(dc); - try - if fGutter.UseFontStyle then - fTextDrawer.SetForeColor(fGutter.Font.Color) - else - fTextDrawer.SetForeColor(Self.Font.Color); - fTextDrawer.SetBackColor(fGutter.Color); - - // prepare the rect initially - rcLine := AClip; - rcLine.Right := Max(rcLine.Right, fGutterWidth - 2); - rcLine.Bottom := rcLine.Top; - - for cLine := vFirstLine to vLastLine do - begin -//++ CodeFolding - if UseCodeFolding and AllFoldRanges.FoldHidesLine(cLine, Index) then - continue; -//-- CodeFolding - vLineTop := (LineToRow(cLine) - TopLine) * fTextHeight; - if WordWrap and not fGutter.Gradient then - begin - // erase space between wrapped lines (from previous line to current one) - rcLine.Top := rcLine.Bottom; - rcLine.Bottom := vLineTop; - with rcLine do - fTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); - end; - // next line rect - rcLine.Top := vLineTop; - rcLine.Bottom := rcLine.Top + fTextHeight; - - s := fGutter.FormatLineNumber(cLine); - if Assigned(OnGutterGetText) then - OnGutterGetText(Self, cLine, s); - TextSize := GetTextSize(DC, PWideChar(s), Length(s)); - if fGutter.Gradient then - begin - SetBkMode(DC, TRANSPARENT); - Windows.ExtTextOutW(DC, (fGutterWidth - fGutter.RightOffset - fGutter.RightMargin) - TextSize.cx, - rcLine.Top + ((fTextHeight - Integer(TextSize.cy)) div 2), 0, - @rcLine, PWideChar(s), Length(s), nil); - SetBkMode(DC, OPAQUE); - end - else - Windows.ExtTextOutW(DC, (fGutterWidth - fGutter.RightOffset - fGutter.RightMargin) - TextSize.cx, - rcLine.Top + ((fTextHeight - Integer(TextSize.cy)) div 2), ETO_OPAQUE, - @rcLine, PWideChar(s), Length(s), nil); - end; - // now erase the remaining area if any - if (AClip.Bottom > rcLine.Bottom) and not fGutter.Gradient then - begin - rcLine.Top := rcLine.Bottom; - rcLine.Bottom := AClip.Bottom; - with rcLine do - fTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); - end; - finally - fTextDrawer.EndDrawing; - if fGutter.UseFontStyle then - fTextDrawer.SetBaseFont(Self.Font); - end; - end - else if not fGutter.Gradient then - Canvas.FillRect(AClip); - - // draw word wrap glyphs transparently over gradient - if fGutter.Gradient then - Canvas.Brush.Style := bsClear; - // paint wrapped line glyphs - if WordWrap and fWordWrapGlyph.Visible then - for cLine := aFirstRow to aLastRow do - if LineToRow(RowToLine(cLine)) <> cLine then - fWordWrapGlyph.Draw(Canvas, - (fGutterWidth - fGutter.RightOffset - 2) - fWordWrapGlyph.Width, - (cLine - TopLine) * fTextHeight, fTextHeight); - // restore brush - if fGutter.Gradient then - Canvas.Brush.Style := bsSolid; -//++ CodeFolding - // Draw the folding lines and squares - if UseCodeFolding then begin - PlusMinusMargin := MulDiv(2, FCurrentPPI, 96); - for cRow := aFirstRow to aLastRow do begin - vLine := RowToLine(cRow); - if (vLine > Lines.Count) and not (Lines.Count = 0) then - break; - - rcFold := GetFoldShapeRect(cRow); - - Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; - - // Any fold ranges beginning on this line? - if AllFoldRanges.FoldStartAtLine(vLine, Index) then begin - FoldRange := AllFoldRanges.Ranges[Index]; - Canvas.Brush.Color := fCodeFolding.FolderBarLinesColor; - Canvas.FrameRect(rcFold); - - // Paint minus sign - Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; - Canvas.MoveTo(rcFold.Left + PlusMinusMargin, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - Canvas.LineTo(rcFold.Right - PlusMinusMargin, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - - // Paint vertical line of plus sign - if FoldRange.Collapsed then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, rcFold.Top + PlusMinusMargin); - Canvas.LineTo(x, rcFold.Bottom - PlusMinusMargin); - end - else - // Draw the bottom part of a line - begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, rcFold.Bottom); - Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); - end; - end - else begin - // Need to paint a line end? - if AllFoldRanges.FoldEndAtLine(vLine, Index) then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); - Canvas.LineTo(x, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - Canvas.LineTo(rcFold.Right, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - end; - // Need to paint a line? - if AllFoldRanges.FoldAroundLine(vLine, Index) then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); - Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); - end; - end; - end; - end; -//-- CodeFolding - - // the gutter separator if visible - if (fGutter.BorderStyle <> gbsNone) and (AClip.Right >= fGutterWidth - 2) then - with Canvas do - begin - Pen.Color := fGutter.BorderColor; - Pen.Width := 1; - with AClip do - begin - if fGutter.BorderStyle = gbsMiddle then - begin - MoveTo(fGutterWidth - 2, Top); - LineTo(fGutterWidth - 2, Bottom); - Pen.Color := fGutter.Color; - end; - MoveTo(fGutterWidth - 1, Top); - LineTo(fGutterWidth - 1, Bottom); - end; - end; - - // now the gutter marks - if BookMarkOptions.GlyphsVisible and (Marks.Count > 0) - and (vLastLine >= vFirstLine) then - begin - aGutterOffs := AllocMem((aLastRow - aFirstRow + 1) * SizeOf(Integer)); - try - // Instead of making a two pass loop we look while drawing the bookmarks - // whether there is any other mark to be drawn - bHasOtherMarks := False; - for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do -//++ Codefolding - if Visible and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) - and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) -//-- Codefolding - then - begin - if IsBookmark <> BookMarkOptions.DrawBookmarksFirst then - bHasOtherMarks := True - else begin - vMarkRow := LineToRow(Line); - if vMarkRow >= aFirstRow then - DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); - end - end; - if bHasOtherMarks then - for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do - begin - if Visible and (IsBookmark <> BookMarkOptions.DrawBookmarksFirst) -//++ Codefolding - and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) - and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) then -//-- Codefolding - begin - vMarkRow := LineToRow(Line); - if vMarkRow >= aFirstRow then - DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); - end; - end; - if Assigned(OnGutterPaint) then - for cLine := vFirstLine to vLastLine do - begin - vGutterRow := LineToRow(cLine); - OnGutterPaint(Self, cLine, aGutterOffs[vGutterRow - aFirstRow], - (vGutterRow - TopLine) * LineHeight); - end; - finally - FreeMem(aGutterOffs); - end; - end - else if Assigned(OnGutterPaint) then - begin - for cLine := vFirstLine to vLastLine do - begin - vGutterRow := LineToRow(cLine); - OnGutterPaint(Self, cLine, 0, (vGutterRow - TopLine) * LineHeight); - end; - end; -end; - -// Inserts filling chars into a string containing chars that display as glyphs -// wider than an average glyph. (This is often the case with Asian glyphs, which -// are usually wider than latin glpyhs) -// This is only to simplify paint-operations and has nothing to do with -// multi-byte chars. -function TCustomSynEdit.ExpandAtWideGlyphs(const S: string): string; -var - i, j, CountOfAvgGlyphs: Integer; -begin - Result := S; - j := 0; - SetLength(Result, Length(S) * 2); // speed improvement - for i := 1 to Length(S) do - begin - inc(j); - if Ord(S[i]) <= $00FF then - CountOfAvgGlyphs := 1 - else - CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(S[i]), fCharWidth); - - if j + CountOfAvgGlyphs > Length(Result) then - SetLength(Result, Length(Result) + 128); - - // insert CountOfAvgGlyphs filling chars - while CountOfAvgGlyphs > 1 do - begin - Result[j] := FillerChar; - inc(j); - dec(CountOfAvgGlyphs); - end; - - Result[j] := S[i]; - end; - - SetLength(Result, j); -end; - -// does the opposite of ExpandAtWideGlyphs -function TCustomSynEdit.ShrinkAtWideGlyphs(const S: string; First: Integer; - var CharCount: Integer): string; -var - i, j: Integer; -begin - SetLength(Result, CharCount); - - i := First; - j := 0; - while i < First + CharCount do - begin - if S[i] <> FillerChar then - begin - inc(j); - Result[j] := S[i]; - end; - inc(i); - end; - - SetLength(Result, j); - CharCount := j; -end; - -procedure TCustomSynEdit.PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, - FirstCol, LastCol: Integer); -var - bDoRightEdge: Boolean; // right edge - nRightEdge: Integer; - // selection info - bAnySelection: Boolean; // any selection visible? - vSelStart: TDisplayCoord; // start of selected area - vSelEnd: TDisplayCoord; // end of selected area - // info about normal and selected text and background colors - bSpecialLine, bLineSelected, bCurrentLine: Boolean; - colFG, colBG: TColor; - colSelFG, colSelBG: TColor; - // info about selection of the current line - nLineSelStart, nLineSelEnd: Integer; - bComplexLine: Boolean; - // painting the background and the text - rcLine, rcToken: TRect; - TokenAccu: record - // Note: s is not managed as a string, it will only grow!!! - // Never use AppendStr or "+", use Len and MaxLen instead and - // copy the string chars directly. This is for efficiency. - Len, MaxLen, CharsBefore: Integer; - s: string; - TabString: string; - FG, BG: TColor; - Style: TFontStyles; - end; - dc: HDC; - SynTabGlyphString: string; - - vFirstLine: Integer; - vLastLine: Integer; - -{ local procedures } - - function colEditorBG: TColor; - var - iAttri: TSynHighlighterAttributes; - begin - if (ActiveLineColor <> clNone) and (bCurrentLine) then - Result := ActiveLineColor - else begin - Result := Color; - if Highlighter <> nil then - begin - iAttri := Highlighter.WhitespaceAttribute; - if (iAttri <> nil) and (iAttri.Background <> clNone) then - Result := iAttri.Background; - end; - end; - end; - - procedure ComputeSelectionInfo; - var - vStart: TBufferCoord; - vEnd: TBufferCoord; - begin - bAnySelection := False; - // Only if selection is visible anyway. - if not HideSelection or Self.Focused then - begin - bAnySelection := True; - // Get the *real* start of the selected area. - if fBlockBegin.Line < fBlockEnd.Line then - begin - vStart := fBlockBegin; - vEnd := fBlockEnd; - end - else if fBlockBegin.Line > fBlockEnd.Line then - begin - vEnd := fBlockBegin; - vStart := fBlockEnd; - end - else if fBlockBegin.Char <> fBlockEnd.Char then - begin - // No selection at all, or it is only on this line. - vStart.Line := fBlockBegin.Line; - vEnd.Line := vStart.Line; - if fBlockBegin.Char < fBlockEnd.Char then - begin - vStart.Char := fBlockBegin.Char; - vEnd.Char := fBlockEnd.Char; - end - else - begin - vStart.Char := fBlockEnd.Char; - vEnd.Char := fBlockBegin.Char; - end; - end - else - bAnySelection := False; - // If there is any visible selection so far, then test if there is an - // intersection with the area to be painted. - if bAnySelection then - begin - // Don't care if the selection is not visible. - bAnySelection := (vEnd.Line >= vFirstLine) and (vStart.Line <= vLastLine); - if bAnySelection then - begin - // Transform the selection from text space into screen space - vSelStart := BufferToDisplayPos(vStart); - vSelEnd := BufferToDisplayPos(vEnd); - // In the column selection mode sort the begin and end of the selection, - // this makes the painting code simpler. - if (fActiveSelectionMode = smColumn) and (vSelStart.Column > vSelEnd.Column) then - SwapInt(vSelStart.Column, vSelEnd.Column); - end; - end; - end; - end; - - procedure SetDrawingColors(Selected: Boolean); - begin - with fTextDrawer do - if Selected then - begin - SetBackColor(colSelBG); - SetForeColor(colSelFG); - Canvas.Brush.Color := colSelBG; - end - else begin - SetBackColor(colBG); - SetForeColor(colFG); - Canvas.Brush.Color := colBG; - end; - end; - - function ColumnToXValue(Col: Integer): Integer; - begin - Result := fTextOffset + Pred(Col) * fCharWidth; - end; - - //todo: Review SpecialChars and HardTabs painting. Token parameter of PaintToken procedure could very probably be passed by reference. - - // Note: The PaintToken procedure will take care of invalid parameters - // like empty token rect or invalid indices into TokenLen. - // CharsBefore tells if Token starts at column one or not - procedure PaintToken(Token: string; - TokenLen, CharsBefore, First, Last: Integer); - var - Text: string; - Counter, nX, nCharsToPaint: Integer; - sTabbedToken: string; - DoTabPainting: Boolean; - i, TabStart, TabLen, CountOfAvgGlyphs, VisibleGlyphPart, FillerCount, - NonFillerPos: Integer; - rcTab: TRect; - const - ETOOptions = [tooOpaque, tooClipped]; - begin - sTabbedToken := Token; - DoTabPainting := False; - - Counter := Last - CharsBefore; - while Counter > First - CharsBefore - 1 do - begin - if Length(Token) >= Counter then - begin - if (eoShowSpecialChars in fOptions) and (Token[Counter] = #32) then - Token[Counter] := SynSpaceGlyph - else if Token[Counter] = #9 then - begin - Token[Counter] := #32; //Tabs painted differently if necessary - DoTabPainting := eoShowSpecialChars in fOptions; - end; - end; - Dec(Counter); - end; - - if (Last >= First) and (rcToken.Right > rcToken.Left) then - begin - nX := ColumnToXValue(First); - - Dec(First, CharsBefore); - Dec(Last, CharsBefore); - - if (First > TokenLen) then - begin - nCharsToPaint := 0; - Text := ''; - end - else - begin - FillerCount := 0; - NonFillerPos := First; - while Token[NonFillerPos] = FillerChar do - begin - inc(FillerCount); - inc(NonFillerPos); - end; - - CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(Token[NonFillerPos]) , fCharWidth); - - // first visible part of the glyph (1-based) - // (the glyph is visually sectioned in parts of size fCharWidth) - VisibleGlyphPart := CountOfAvgGlyphs - FillerCount; - - // clip off invisible parts - nX := nX - fCharWidth * (VisibleGlyphPart - 1); - - nCharsToPaint := Min(Last - First + 1, TokenLen - First + 1); - - // clip off partially visible glyphs at line end - if WordWrap then - while nX + fCharWidth * nCharsToPaint > ClientWidth do - begin - dec(nCharsToPaint); - while (nCharsToPaint > 0) and (Token[First + nCharsToPaint - 1] = FillerChar) do - dec(nCharsToPaint); - end; - - // same as copy(Token, First, nCharsToPaint) and remove filler chars - Text := ShrinkAtWideGlyphs(Token, First, nCharsToPaint); - end; - - fTextDrawer.ExtTextOut(nX, rcToken.Top, ETOOptions, rcToken, - PWideChar(Text), nCharsToPaint, (eoShowLigatures in fOptions) and not bCurrentLine); - - if DoTabPainting then - begin - // fix everything before the FirstChar - for i := 1 to First - 1 do // wipe the text out so we don't - if sTabbedToken[i] = #9 then // count it out of the range - sTabbedToken[i] := #32; // we're looking for - - TabStart := pos(#9, sTabbedToken); - rcTab.Top := rcToken.Top; - rcTab.Bottom := rcToken.Bottom; - while (TabStart > 0) and (TabStart >= First) and (TabStart <= Last) do - begin - TabLen := 1; - while (TabStart + CharsBefore + TabLen - 1) mod FTabWidth <> 0 do inc(TabLen); - Text := SynTabGlyphString; - - nX := ColumnToXValue(CharsBefore + TabStart + (TabLen div 2) - 1); - if TabLen mod 2 = 0 then - nX := nX + (fCharWidth div 2) - else nX := nX + fCharWidth; - - rcTab.Left := nX; - rcTab.Right := nX + fTextDrawer.GetCharWidth; - - fTextDrawer.ExtTextOut(nX, rcTab.Top, ETOOptions, rcTab, - PWideChar(Text), 1); - - //wipe the text out so we don't count it again - for i := TabStart to min(TabStart + TabLen - 1, Length(sTabbedToken)) do - sTabbedToken[i] := #32; - - TabStart := pos(#9, sTabbedToken); - end; - end; - rcToken.Left := rcToken.Right; - end; - end; - - procedure AdjustEndRect; - // trick to avoid clipping the last pixels of text in italic, - // see also AdjustLastCharWidth() in TheTextDrawer.ExtTextOut() - var - LastChar: Cardinal; - NormalCharWidth, RealCharWidth: Integer; - CharInfo: TABC; - tm: TTextMetricA; - begin - LastChar := Ord(TokenAccu.s[TokenAccu.Len]); - NormalCharWidth := fTextDrawer.TextWidth(WideChar(LastChar)); - RealCharWidth := NormalCharWidth; - - if GetCharABCWidthsW(Canvas.Handle, LastChar, LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(Canvas.Handle, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; - - if RealCharWidth > NormalCharWidth then - Inc(rcToken.Left, RealCharWidth - NormalCharWidth); - end; - - procedure PaintHighlightToken(bFillToEOL: Boolean); - var - bComplexToken: Boolean; - nC1, nC2, nC1Sel, nC2Sel: Integer; - bU1, bSel, bU2: Boolean; - nX1, nX2: Integer; - begin - // Compute some helper variables. - nC1 := Max(FirstCol, TokenAccu.CharsBefore + 1); - nC2 := Min(LastCol, TokenAccu.CharsBefore + TokenAccu.Len + 1); - if bComplexLine then - begin - bU1 := (nC1 < nLineSelStart); - bSel := (nC1 < nLineSelEnd) and (nC2 >= nLineSelStart); - bU2 := (nC2 >= nLineSelEnd); - bComplexToken := bSel and (bU1 or bU2); - end - else - begin - bU1 := False; // to shut up Compiler warning Delphi 2 - bSel := bLineSelected; - bU2 := False; // to shut up Compiler warning Delphi 2 - bComplexToken := False; - end; - // Any token chars accumulated? - if (TokenAccu.Len > 0) then - begin - // Initialize the colors and the font style. - if not bSpecialLine then - begin - colBG := TokenAccu.BG; - colFG := TokenAccu.FG; - end; - - if bSpecialLine and (eoSpecialLineDefaultFg in fOptions) then - colFG := TokenAccu.FG; - - fTextDrawer.SetStyle(TokenAccu.Style); - // Paint the chars - if bComplexToken then - begin - // first unselected part of the token - if bU1 then - begin - SetDrawingColors(False); - rcToken.Right := ColumnToXValue(nLineSelStart); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1, nLineSelStart); - end; - // selected part of the token - SetDrawingColors(True); - nC1Sel := Max(nLineSelStart, nC1); - nC2Sel := Min(nLineSelEnd, nC2); - rcToken.Right := ColumnToXValue(nC2Sel); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1Sel, nC2Sel); - // second unselected part of the token - if bU2 then - begin - SetDrawingColors(False); - rcToken.Right := ColumnToXValue(nC2); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nLineSelEnd, nC2); - end; - end - else - begin - SetDrawingColors(bSel); - rcToken.Right := ColumnToXValue(nC2); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1, nC2); - end; - end; - - // Fill the background to the end of this line if necessary. - if bFillToEOL and (rcToken.Left < rcLine.Right) then - begin - if not bSpecialLine then colBG := colEditorBG; - if bComplexLine then - begin - nX1 := ColumnToXValue(nLineSelStart); - nX2 := ColumnToXValue(nLineSelEnd); - if (rcToken.Left < nX1) then - begin - SetDrawingColors(False); - rcToken.Right := nX1; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - rcToken.Left := nX1; - end; - if (rcToken.Left < nX2) then - begin - SetDrawingColors(True); - rcToken.Right := nX2; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - rcToken.Left := nX2; - end; - if (rcToken.Left < rcLine.Right) then - begin - SetDrawingColors(False); - rcToken.Right := rcLine.Right; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - end; - end - else - begin - SetDrawingColors(bLineSelected); - rcToken.Right := rcLine.Right; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - end; - end; - end; - - // Store the token chars with the attributes in the TokenAccu - // record. This will paint any chars already stored if there is - // a (visible) change in the attributes. - procedure AddHighlightToken(const Token: string; - CharsBefore, TokenLen: Integer; - Foreground, Background: TColor; - Style: TFontStyles); - var - bCanAppend: Boolean; - bSpacesTest, bIsSpaces: Boolean; - i: Integer; - - function TokenIsSpaces: Boolean; - var - pTok: PWideChar; - begin - if not bSpacesTest then - begin - bSpacesTest := True; - pTok := PWideChar(Token); - while pTok^ <> #0 do - begin - if pTok^ <> #32 then - break; - Inc(pTok); - end; - bIsSpaces := pTok^ = #0; - end; - Result := bIsSpaces; - end; - - begin - if (Background = clNone) or - ((ActiveLineColor <> clNone) and (bCurrentLine)) then - begin - Background := colEditorBG; - end; - if Foreground = clNone then Foreground := Font.Color; - // Do we have to paint the old chars first, or can we just append? - bCanAppend := False; - bSpacesTest := False; - if (TokenAccu.Len > 0) then - begin - // font style must be the same or token is only spaces - if (TokenAccu.Style = Style) - or (not (fsUnderline in Style) and not (fsUnderline in TokenAccu.Style) - and TokenIsSpaces) then - begin - // either special colors or same colors - if (bSpecialLine and not (eoSpecialLineDefaultFg in fOptions)) or bLineSelected or - // background color must be the same and - ((TokenAccu.BG = Background) and - // foreground color must be the same or token is only spaces - ((TokenAccu.FG = Foreground) or TokenIsSpaces)) then - begin - bCanAppend := True; - end; - end; - // If we can't append it, then we have to paint the old token chars first. - if not bCanAppend then - PaintHighlightToken(False); - end; - // Don't use AppendStr because it's more expensive. - if bCanAppend then - begin - if (TokenAccu.Len + TokenLen > TokenAccu.MaxLen) then - begin - TokenAccu.MaxLen := TokenAccu.Len + TokenLen + 32; - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - for i := 1 to TokenLen do - TokenAccu.s[TokenAccu.Len + i] := Token[i]; - Inc(TokenAccu.Len, TokenLen); - end - else - begin - TokenAccu.Len := TokenLen; - if (TokenAccu.Len > TokenAccu.MaxLen) then - begin - TokenAccu.MaxLen := TokenAccu.Len + 32; - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - for i := 1 to TokenLen do - TokenAccu.s[i] := Token[i]; - TokenAccu.CharsBefore := CharsBefore; - TokenAccu.FG := Foreground; - TokenAccu.BG := Background; - TokenAccu.Style := Style; - end; - end; - -//++ CodeFolding - procedure PaintFoldAttributes; - var - i, TabSteps, LineIndent, LastNonBlank, X, Y, cRow, vLine: Integer; - DottedPen, OldPen: HPEN; - DottedPenDesc: LOGBRUSH; - CollapsedTo : integer; - HintRect : TRect; - begin - // Paint indent guides. Use folds to determine indent value of these - // Use a separate loop so we can use a custom pen - if not UseCodeFolding then - Exit; - - // Paint indent guides using custom pen - if fCodeFolding.IndentGuides then begin - DottedPenDesc.lbStyle := BS_SOLID; - DottedPenDesc.lbColor := fCodeFolding.IndentGuidesColor; - DottedPen := ExtCreatePen(PS_COSMETIC or PS_ALTERNATE, 1, DottedPenDesc, 0, nil); - try - OldPen := SelectObject(Canvas.Handle, DottedPen); - - // Now loop through all the lines. The indices are valid for Lines. - for cRow := aFirstRow to aLastRow do begin - vLine := RowToLine(cRow); - if (vLine > Lines.Count) and not (Lines.Count = 0) then - break; - - // Set vertical coord - Y := (LineToRow(vLine) - TopLine) * fTextHeight; // limit inside clip rect - if (fTextHeight mod 2 = 1) and (vLine mod 2 = 0) then // even - Inc(Y); - - // Get next nonblank line - LastNonBlank := cRow; - while (RowToLine(LastNonBlank) <= fLines.Count) - and (TrimLeft(fLines[RowToLine(LastNonBlank)-1]) = '') do - Inc(LastNonBlank); - LineIndent := LeftSpacesEx(fLines[RowToLine(LastNonBlank)-1], True, True); - - // Step horizontal coord - TabSteps := TabWidth; - while TabSteps < LineIndent do begin - X := TabSteps * CharWidth + fTextOffset - 2; - if TabSteps >= fLeftChar then begin - // Move to top of vertical line - Canvas.MoveTo(X, Y); - Inc(Y, fTextHeight); - - // Draw down and move back up - Canvas.LineTo(X, Y); - Dec(Y, fTextHeight); - end; - Inc(TabSteps, TabWidth); - end; - end; - - // Reset pen - SelectObject(Canvas.Handle, OldPen); - finally - DeleteObject(DottedPen); - end; - end; - - // Paint collapsed lines using changed pen - if fCodeFolding.ShowCollapsedLine or fCodeFolding.ShowHintMark then begin - Canvas.Pen.Color := fCodeFolding.CollapsedLineColor; - - CollapsedTo := 0; - for i := 0 to fAllFoldRanges.Count - 1 do begin - with fAllFoldRanges.Ranges[i] do begin - if FromLine > vLastLine then - break; - if Collapsed and (FromLine > CollapsedTo) and (FromLine >= vFirstLine) then - begin - if fCodeFolding.ShowCollapsedLine then - begin - // Get starting and end points - Y := (LineToRow(FromLine) - TopLine + 1) * fTextHeight - 1; - Canvas.MoveTo(AClip.Left, Y); - Canvas.LineTo(AClip.Right, Y); - end; - if fCodeFolding.ShowHintMark then - begin - HintRect := GetCollapseMarkRect(LineToRow(FromLine), FromLine); - if InRange(HintRect.Left, 1, ClientWidth-1) then - begin - fTextDrawer.BeginDrawing(Canvas.Handle); - SetBkMode(Canvas.Handle, TRANSPARENT); - fTextDrawer.SetForeColor(fCodeFolding.CollapsedLineColor); - with HintRect do - ftextDrawer.ExtTextOut(Left + 2 * CharWidth div 7, - Top - LineHeight div 5, [], HintRect, '...', 3); - SetBkMode(Canvas.Handle, OPAQUE); - Canvas.Pen.Width := IfThen(LineHeight > 30, 2, 1); - Canvas.Brush.Style := bsClear; - Inc(HintRect.Top, LineHeight div 7); - Canvas.Rectangle(HintRect); - Canvas.Brush.Style := bsSolid; - Canvas.Pen.Width := 1; - fTextDrawer.EndDrawing; - end; - end; - end; - if Collapsed then - CollapsedTo := Max(CollapsedTo, ToLine); - end; - end; - end; - end; -//-- CodeFolding - - procedure PaintLines; - var - nLine: Integer; // line index for the loop - cRow: Integer; - sLine: string; // the current line (tab expanded) - sLineExpandedAtWideGlyphs: string; - sToken: string; // highlighter token info - nTokenPos, nTokenLen: Integer; - attr: TSynHighlighterAttributes; - vAuxPos: TDisplayCoord; - vFirstChar: Integer; - vLastChar: Integer; - vStartRow: Integer; - vEndRow: Integer; - begin - // Initialize rcLine for drawing. Note that Top and Bottom are updated - // inside the loop. Get only the starting point for this. - rcLine := AClip; - rcLine.Left := fGutterWidth + 2; - rcLine.Bottom := (aFirstRow - TopLine) * fTextHeight; - // Make sure the token accumulator string doesn't get reassigned to often. - if Assigned(fHighlighter) then - begin - TokenAccu.MaxLen := Max(128, fCharsInWindow); - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - // Now loop through all the lines. The indices are valid for Lines. - for nLine := vFirstLine to vLastLine do - begin -//++ CodeFolding - if UseCodeFolding and AllFoldRanges.FoldHidesLine(nLine) then - continue; -//-- CodeFolding - sLine := TSynEditStringList(Lines).ExpandedStrings[nLine - 1]; - sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); - // determine whether will be painted with ActiveLineColor - bCurrentLine := CaretY = nLine; - // Initialize the text and background colors, maybe the line should - // use special values for them. - colFG := Font.Color; - colBG := colEditorBG; - bSpecialLine := DoOnSpecialLineColors(nLine, colFG, colBG); - if bSpecialLine then - begin - // The selection colors are just swapped, like seen in Delphi. - colSelFG := colBG; - colSelBG := colFG; - end - else - begin - colSelFG := fSelectedColor.Foreground; - colSelBG := fSelectedColor.Background; - end; - - vStartRow := Max(LineToRow(nLine), aFirstRow); - vEndRow := Min(LineToRow(nLine + 1) - 1, aLastRow); -//++ CodeFolding - vEndRow := Max(vEndRow, vStartRow); -//-- CodeFolding - for cRow := vStartRow to vEndRow do - begin - if WordWrap then - begin - vAuxPos.Row := cRow; - if Assigned(fHighlighter) then - vAuxPos.Column := FirstCol - else - // When no highlighter is assigned, we must always start from the - // first char in a row and PaintToken will do the actual clipping - vAuxPos.Column := 1; - vFirstChar := fWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; - vAuxPos.Column := LastCol; - vLastChar := fWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; - end - else - begin - vFirstChar := FirstCol; - vLastChar := LastCol; - end; - // Get the information about the line selection. Three different parts - // are possible (unselected before, selected, unselected after), only - // unselected or only selected means bComplexLine will be False. Start - // with no selection, compute based on the visible columns. - bComplexLine := False; - nLineSelStart := 0; - nLineSelEnd := 0; - // Does the selection intersect the visible area? - if bAnySelection and (cRow >= vSelStart.Row) and (cRow <= vSelEnd.Row) then - begin - // Default to a fully selected line. This is correct for the smLine - // selection mode and a good start for the smNormal mode. - nLineSelStart := FirstCol; - nLineSelEnd := LastCol + 1; - if (fActiveSelectionMode = smColumn) or - ((fActiveSelectionMode = smNormal) and (cRow = vSelStart.Row)) then - begin - if (vSelStart.Column > LastCol) then - begin - nLineSelStart := 0; - nLineSelEnd := 0; - end - else if (vSelStart.Column > FirstCol) then - begin - nLineSelStart := vSelStart.Column; - bComplexLine := True; - end; - end; - if (fActiveSelectionMode = smColumn) or - ((fActiveSelectionMode = smNormal) and (cRow = vSelEnd.Row)) then - begin - if (vSelEnd.Column < FirstCol) then - begin - nLineSelStart := 0; - nLineSelEnd := 0; - end - else if (vSelEnd.Column < LastCol) then - begin - nLineSelEnd := vSelEnd.Column; - bComplexLine := True; - end; - end; - end; //endif bAnySelection - - // Update the rcLine rect to this line. - rcLine.Top := rcLine.Bottom; - Inc(rcLine.Bottom, fTextHeight); - - bLineSelected := not bComplexLine and (nLineSelStart > 0); - rcToken := rcLine; - - if not Assigned(fHighlighter) or not fHighlighter.Enabled then - begin - // Remove text already displayed (in previous rows) - if (vFirstChar <> FirstCol) or (vLastChar <> LastCol) then - sToken := Copy(sLineExpandedAtWideGlyphs, vFirstChar, vLastChar - vFirstChar) - else - sToken := Copy(sLineExpandedAtWideGlyphs, 1, vLastChar); - if (eoShowSpecialChars in fOptions) and - (Length(sLineExpandedAtWideGlyphs) < vLastChar) - then - sToken := sToken + SynLineBreakGlyph; - nTokenLen := Length(sToken); - if bComplexLine then - begin - SetDrawingColors(False); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(FirstCol)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelStart)); - PaintToken(sToken, nTokenLen, 0, FirstCol, nLineSelStart); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelEnd)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(LastCol)); - PaintToken(sToken, nTokenLen, 0, nLineSelEnd, LastCol); - SetDrawingColors(True); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelStart)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelEnd)); - PaintToken(sToken, nTokenLen, 0, nLineSelStart, nLineSelEnd - 1); - end - else - begin - SetDrawingColors(bLineSelected); - PaintToken(sToken, nTokenLen, 0, FirstCol, LastCol); - end; - end - else - begin - // Initialize highlighter with line text and range info. It is - // necessary because we probably did not scan to the end of the last - // line - the internal highlighter range might be wrong. - if nLine = 1 then - fHighlighter.ResetRange - else - fHighlighter.SetRange(TSynEditStringList(Lines).Ranges[nLine - 2]); - fHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, - nLine - 1); - // Try to concatenate as many tokens as possible to minimize the count - // of ExtTextOutW calls necessary. This depends on the selection state - // or the line having special colors. For spaces the foreground color - // is ignored as well. - TokenAccu.Len := 0; - nTokenPos := 0; - nTokenLen := 0; - attr := nil; - // Test first whether anything of this token is visible. - while not fHighlighter.GetEol do - begin - nTokenPos := fHighlighter.GetExpandedTokenPos; - sToken := fHighlighter.GetExpandedToken; - nTokenLen := Length(sToken); - if nTokenPos + nTokenLen >= vFirstChar then - begin - if nTokenPos + nTokenLen > vLastChar then - begin - if nTokenPos > vLastChar then - break; - if WordWrap then - nTokenLen := vLastChar - nTokenPos - 1 - else - nTokenLen := vLastChar - nTokenPos; - end; - // Remove offset generated by tokens already displayed (in previous rows) - Dec(nTokenPos, vFirstChar - FirstCol); - // It's at least partially visible. Get the token attributes now. - attr := fHighlighter.GetTokenAttribute; - if Assigned(attr) then - AddHighlightToken(sToken, nTokenPos, nTokenLen, attr.Foreground, - attr.Background, attr.Style) - else - AddHighlightToken(sToken, nTokenPos, nTokenLen, colFG, colBG, - Font.Style); - end; - // Let the highlighter scan the next token. - fHighlighter.Next; - end; - // Draw anything that's left in the TokenAccu record. Fill to the end - // of the invalid area with the correct colors. - if (eoShowSpecialChars in fOptions) and fHighlighter.GetEol then - begin - if (attr = nil) or (attr <> fHighlighter.CommentAttribute) then - attr := fHighlighter.WhitespaceAttribute; - AddHighlightToken(SynLineBreakGlyph, nTokenPos + nTokenLen, 1, - attr.Foreground, attr.Background, []); - end; - PaintHighlightToken(True); - end; - // Now paint the right edge if necessary. We do it line by line to reduce - // the flicker. Should not cost very much anyway, compared to the many - // calls to ExtTextOutW. - if bDoRightEdge then - begin - Canvas.MoveTo(nRightEdge, rcLine.Top); - Canvas.LineTo(nRightEdge, rcLine.Bottom + 1); - end; - end; //endfor cRow - bCurrentLine := False; - end; //endfor cLine - end; - -{ end local procedures } - -begin - vFirstLine := RowToLine(aFirstRow); - vLastLine := RowToLine(aLastRow); - - bCurrentLine := False; - // If the right edge is visible and in the invalid area, prepare to paint it. - // Do this first to realize the pen when getting the dc variable. - SynTabGlyphString := SynTabGlyph; - bDoRightEdge := False; - if (fRightEdge > 0) then - begin // column value - nRightEdge := fTextOffset + fRightEdge * fCharWidth; // pixel value - if (nRightEdge >= AClip.Left) and (nRightEdge <= AClip.Right) then - begin - bDoRightEdge := True; - Canvas.Pen.Color := fRightEdgeColor; - Canvas.Pen.Width := 1; - end; - end; - // Do everything else with API calls. This (maybe) realizes the new pen color. - dc := Canvas.Handle; - // If anything of the two pixel space before the text area is visible, then - // fill it with the component background color. - if (AClip.Left < fGutterWidth + 2) then - begin - rcToken := AClip; - rcToken.Left := Max(AClip.Left, fGutterWidth); - rcToken.Right := fGutterWidth + 2; - // Paint whole left edge of the text with same color. - // (value of WhiteAttribute can vary in e.g. MultiSyn) - if Highlighter <> nil then - Highlighter.ResetRange; - Canvas.Brush.Color := colEditorBG; - Canvas.FillRect(rcToken); - // Adjust the invalid area to not include this area. - AClip.Left := rcToken.Right; - end; - // Paint the visible text lines. To make this easier, compute first the - // necessary information about the selected area: is there any visible - // selected area, and what are its lines / columns? - if (vLastLine >= vFirstLine) then - begin - ComputeSelectionInfo; - fTextDrawer.Style := Font.Style; - fTextDrawer.BeginDrawing(dc); - try - PaintLines; - finally - fTextDrawer.EndDrawing; - end; - end; - // If there is anything visible below the last line, then fill this as well. - rcToken := AClip; - rcToken.Top := (aLastRow - TopLine + 1) * fTextHeight; - if (rcToken.Top < rcToken.Bottom) then - begin - if Highlighter <> nil then - Highlighter.ResetRange; - Canvas.Brush.Color := colEditorBG; - Canvas.FillRect(rcToken); - // Draw the right edge if necessary. - if bDoRightEdge then - begin - Canvas.MoveTo(nRightEdge, rcToken.Top); - Canvas.LineTo(nRightEdge, rcToken.Bottom + 1); - end; - end; - -//++ CodeFolding - // This messes with pen colors, so draw after right margin has been drawn - PaintFoldAttributes; -//-- CodeFolding -end; - -procedure TCustomSynEdit.PasteFromClipboard; -var - AddPasteEndMarker: boolean; - StoredPaintLock: Integer; - PasteMode: TSynSelectionMode; - Mem: HGLOBAL; - P: PByte; -begin - if not CanPaste then - exit; - DoOnPaintTransient(ttBefore); - AddPasteEndMarker := False; - PasteMode := SelectionMode; - try - // Check for our special format and read PasteMode. - // The text is ignored as it is ANSI-only to stay compatible with programs - // using the ANSI version of SynEdit. - // - // Instead we take the text stored in CF_UNICODETEXT or CF_TEXT. - if Clipboard.HasFormat(SynEditClipboardFormat) then - begin - Clipboard.Open; - try - Mem := Clipboard.GetAsHandle(SynEditClipboardFormat); - P := GlobalLock(Mem); - try - if P <> nil then - PasteMode := PSynSelectionMode(P)^; - finally - GlobalUnlock(Mem); - end - finally - Clipboard.Close; - end; - end; - fUndoList.AddChange(crPasteBegin, BlockBegin, BlockEnd, '', smNormal); - AddPasteEndMarker := True; - - SetSelTextPrimitiveEx(PasteMode, PWideChar(GetClipboardText), True); - finally - if AddPasteEndMarker then - fUndoList.AddChange(crPasteEnd, BlockBegin, BlockEnd, '', smNormal); - end; - - // ClientRect can be changed by UpdateScrollBars if eoHideShowScrollBars - // is enabled - if eoHideShowScrollBars in Options then - begin - StoredPaintLock := fPaintLock; - try - fPaintLock := 0; - UpdateScrollBars; - finally - fPaintLock := StoredPaintLock; - end; - end; - - EnsureCursorPosVisible; - // Selection should have changed... - StatusChanged([scSelection]); - DoOnPaintTransient(ttAfter); -end; - -procedure TCustomSynEdit.SelectAll; -var - LastPt: TBufferCoord; -begin - LastPt.Char := 1; - LastPt.Line := Lines.Count; - if LastPt.Line > 0 then - Inc(LastPt.Char, Length(Lines[LastPt.Line - 1])) - else - LastPt.Line := 1; - SetCaretAndSelection(LastPt, BufferCoord(1, 1), LastPt); - // Selection should have changed... - StatusChanged([scSelection]); -end; - -procedure TCustomSynEdit.SetBlockBegin(Value: TBufferCoord); -var - nInval1, nInval2: Integer; - SelChanged: Boolean; -begin - ActiveSelectionMode := SelectionMode; - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - if (fActiveSelectionMode = smNormal) then - if (Value.Line >= 1) and (Value.Line <= Lines.Count) then - Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) - else - Value.Char := 1; - if SelAvail then - begin - if fBlockBegin.Line < fBlockEnd.Line then - begin - nInval1 := Min(Value.Line, fBlockBegin.Line); - nInval2 := Max(Value.Line, fBlockEnd.Line); - end - else - begin - nInval1 := Min(Value.Line, fBlockEnd.Line); - nInval2 := Max(Value.Line, fBlockBegin.Line); - end; - fBlockBegin := Value; - fBlockEnd := Value; - InvalidateLines(nInval1, nInval2); - SelChanged := True; - end - else - begin - SelChanged := - (fBlockBegin.Char <> Value.Char) or (fBlockBegin.Line <> Value.Line) or - (fBlockEnd.Char <> Value.Char) or (fBlockEnd.Line <> Value.Line); - fBlockBegin := Value; - fBlockEnd := Value; - end; - if SelChanged then - StatusChanged([scSelection]); -end; - -procedure TCustomSynEdit.SetBlockEnd(Value: TBufferCoord); -var - nLine: Integer; -begin - ActiveSelectionMode := SelectionMode; - if not (eoNoSelection in Options) then - begin - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - if (fActiveSelectionMode = smNormal) then - if (Value.Line >= 1) and (Value.Line <= Lines.Count) then - Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) - else - Value.Char := 1; - if (Value.Char <> fBlockEnd.Char) or (Value.Line <> fBlockEnd.Line) then - begin - if (Value.Char <> fBlockEnd.Char) or (Value.Line <> fBlockEnd.Line) then - begin - if (fActiveSelectionMode = smColumn) and (Value.Char <> fBlockEnd.Char) then - begin - InvalidateLines( - Min(fBlockBegin.Line, Min(fBlockEnd.Line, Value.Line)), - Max(fBlockBegin.Line, Max(fBlockEnd.Line, Value.Line))); - fBlockEnd := Value; - end - else begin - nLine := fBlockEnd.Line; - fBlockEnd := Value; - if (fActiveSelectionMode <> smColumn) or (fBlockBegin.Char <> fBlockEnd.Char) then - InvalidateLines(nLine, fBlockEnd.Line); - end; - StatusChanged([scSelection]); - end; - end; - end; -end; - -procedure TCustomSynEdit.SetCaretX(Value: Integer); -var - vNewCaret: TBufferCoord; -begin - vNewCaret.Char := Value; - vNewCaret.Line := CaretY; - SetCaretXY(vNewCaret); -end; - -procedure TCustomSynEdit.SetCaretY(Value: Integer); -var - vNewCaret: TBufferCoord; -begin - vNewCaret.Line := Value; - vNewCaret.Char := CaretX; - SetCaretXY(vNewCaret); -end; - -procedure TCustomSynEdit.InternalSetCaretX(Value: Integer); -var - vNewCaret: TBufferCoord; -begin - vNewCaret.Char := Value; - vNewCaret.Line := CaretY; - InternalSetCaretXY(vNewCaret); -end; - -procedure TCustomSynEdit.InternalSetCaretY(Value: Integer); -var - vNewCaret: TBufferCoord; -begin - vNewCaret.Line := Value; - vNewCaret.Char := CaretX; - InternalSetCaretXY(vNewCaret); -end; - -function TCustomSynEdit.GetCaretXY: TBufferCoord; -begin - Result.Char := CaretX; - Result.Line := CaretY; -end; - -function TCustomSynEdit.GetDisplayX: Integer; -begin - Result := DisplayXY.Column; -end; - -function TCustomSynEdit.GetDisplayY: Integer; -begin -//++ CodeFolding - if not WordWrap and not UseCodeFolding then -//-- CodeFolding - Result := CaretY - else - Result := DisplayXY.Row; -end; - -Function TCustomSynEdit.GetDisplayXY: TDisplayCoord; -begin - Result := BufferToDisplayPos(CaretXY); - if WordWrap and fCaretAtEOL then - begin - if Result.Column = 1 then - begin - Dec(Result.Row); - Result.Column := fWordWrapPlugin.GetRowLength(Result.Row) +1; - end - else begin - // Work-around situations where fCaretAtEOL should have been updated because of - //text change (it's only valid when Column = 1). Updating it in ProperSetLine() - //would probably be the right thing, but... - fCaretAtEOL := False; - end; - end; -end; - -procedure TCustomSynEdit.SetCaretXY(const Value: TBufferCoord); -//there are two setCaretXY methods. One Internal, one External. The published -//property CaretXY (re)sets the block as well -begin - IncPaintLock; - try - Include(fStatusChanges, scSelection); - SetCaretXYEx(True, Value); - if SelAvail then - InvalidateSelection; - fBlockBegin.Char := fCaretX; - fBlockBegin.Line := fCaretY; - fBlockEnd := fBlockBegin; - finally - DecPaintLock; - end; -end; - -procedure TCustomSynEdit.InternalSetCaretXY(const Value: TBufferCoord); -begin - SetCaretXYEx(True, Value); -end; - -procedure TCustomSynEdit.UpdateLastCaretX; -begin - fLastCaretX := DisplayX; -end; - -procedure TCustomSynEdit.SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); -var - nMaxX: Integer; - vTriggerPaint: boolean; - S, TS : string; -begin - fCaretAtEOL := False; - vTriggerPaint := HandleAllocated; - if vTriggerPaint then - DoOnPaintTransient(ttBefore); - nMaxX := MaxInt; - if Value.Line > Lines.Count then - Value.Line := Lines.Count; - if Value.Line < 1 then - begin - // this is just to make sure if Lines stringlist should be empty - Value.Line := 1; - if not (eoScrollPastEol in fOptions) then - nMaxX := 1; - end - else - begin - if not (eoScrollPastEol in fOptions) then - nMaxX := Length(Lines[Value.Line - 1]) + 1; - end; - if (Value.Char > nMaxX) and (not(eoScrollPastEol in Options)) then - Value.Char := nMaxX; - if Value.Char < 1 then - Value.Char := 1; - - //Trim here - if (Value.Line <> fCaretY) and (eoTrimTrailingSpaces in fOptions) and - (fCaretY <= Lines.Count) and (fCaretY >= 1) then - begin - S := Lines[fCaretY-1]; - TS := TrimTrailingSpaces(S); - if S <> TS then - Lines[fCaretY-1] := TS; - end; - - if (Value.Char <> fCaretX) or (Value.Line <> fCaretY) then - begin - IncPaintLock; - try - // simply include the flags, fPaintLock is > 0 - if fCaretX <> Value.Char then - begin - fCaretX := Value.Char; - Include(fStatusChanges, scCaretX); - end; - if fCaretY <> Value.Line then - begin - if (ActiveLineColor <> clNone) or (eoShowLigatures in fOptions) then - begin - InvalidateLine(Value.Line); - InvalidateLine(fCaretY); - end; - fCaretY := Value.Line; - Include(fStatusChanges, scCaretY); -//++ CodeFolding - UncollapseAroundLine(fCaretY); -//-- CodeFolding - end; - // Call UpdateLastCaretX before DecPaintLock because the event handler it - // calls could raise an exception, and we don't want fLastCaretX to be - // left in an undefined state if that happens. - UpdateLastCaretX; - if CallEnsureCursorPos then - EnsureCursorPosVisible; - Include(fStateFlags, sfCaretChanged); -//++ Flicker Reduction -// Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction - finally - DecPaintLock; - end; - end - else begin - // Also call UpdateLastCaretX if the caret didn't move. Apps don't know - // anything about fLastCaretX and they shouldn't need to. So, to avoid any - // unwanted surprises, always update fLastCaretX whenever CaretXY is - // assigned to. - // Note to SynEdit developers: If this is undesirable in some obscure - // case, just save the value of fLastCaretX before assigning to CaretXY and - // restore it afterward as appropriate. - UpdateLastCaretX; - end; - if vTriggerPaint then - DoOnPaintTransient(ttAfter); -end; - -function TCustomSynEdit.CaretInView: Boolean; -var - vCaretRowCol: TDisplayCoord; -begin - vCaretRowCol := DisplayXY; - Result := (vCaretRowCol.Column >= LeftChar) - and (vCaretRowCol.Column <= LeftChar + CharsInWindow) - and (vCaretRowCol.Row >= TopLine) - and (vCaretRowCol.Row <= TopLine + LinesInWindow); -end; - -procedure TCustomSynEdit.SetActiveLineColor(Value: TColor); -begin - if (fActiveLineColor<>Value) then - begin - fActiveLineColor:=Value; - InvalidateLine(CaretY); - end; -end; - -procedure TCustomSynEdit.SetFont(const Value: TFont); -var - DC: HDC; - Save: THandle; - Metrics: TTextMetric; - AveCW, MaxCW: Integer; -begin - Value.Quality := FontQuality; - DC := GetDC(0); - Save := SelectObject(DC, Value.Handle); - GetTextMetrics(DC, Metrics); - SelectObject(DC, Save); - ReleaseDC(0, DC); - with Metrics do - begin - AveCW := tmAveCharWidth; - MaxCW := tmMaxCharWidth; - end; - case AveCW = MaxCW of - True: inherited Font := Value; - False: - begin - with fFontDummy do - begin - Color := Value.Color; - Pitch := fpFixed; - Size := Value.Size; - Style := Value.Style; - Name := Value.Name; - Quality := Value.Quality; - end; - inherited Font := fFontDummy; - end; - end; - TSynEditStringList(fLines).FontChanged; - if fGutter.ShowLineNumbers then - GutterChanged(Self); -end; - -procedure TCustomSynEdit.SetGutterWidth(Value: Integer); -begin - Value := Max(Value, 0); - if fGutterWidth <> Value then - begin - fGutterWidth := Value; - fTextOffset := fGutterWidth + 2 - (LeftChar - 1) * fCharWidth; - if HandleAllocated then - begin - fCharsInWindow := Max(ClientWidth - fGutterWidth - 2, 0) div fCharWidth; - if WordWrap then - fWordWrapPlugin.DisplayChanged; - UpdateScrollBars; - Invalidate; - end; - end; -end; - -procedure TCustomSynEdit.SetLeftChar(Value: Integer); -var - MaxVal: Integer; - iDelta: Integer; - iTextArea: TRect; -begin - if WordWrap then - Value := 1; - - if eoScrollPastEol in Options then - MaxVal := MaxInt - CharsInWindow - else - begin - MaxVal := TSynEditStringList(Lines).LengthOfLongestLine; - if MaxVal > CharsInWindow then - MaxVal := MaxVal - CharsInWindow + 1 - else - MaxVal := 1; - end; - Value := MinMax(Value, 1, MaxVal); - if Value <> fLeftChar then - begin - iDelta := fLeftChar - Value; - fLeftChar := Value; - fTextOffset := fGutterWidth + 2 - (LeftChar - 1) * fCharWidth; - if Abs(iDelta) < CharsInWindow then - begin - iTextArea := ClientRect; - Inc(iTextArea.Left, fGutterWidth + 2); - ScrollWindow(Handle, iDelta * CharWidth, 0, @iTextArea, @iTextArea); - end - else - InvalidateLines(-1, -1); - UpdateScrollBars; - StatusChanged([scLeftChar]); - end; -end; - -procedure TCustomSynEdit.SetLines(Value: TStrings); -begin - Lines.Assign(Value); -end; - -procedure TCustomSynEdit.SetLineText(Value: string); -begin - if (CaretY >= 1) and (CaretY <= Max(1, Lines.Count)) then - Lines[CaretY - 1] := Value; -end; - -procedure TCustomSynEdit.SetFontQuality(AValue: TFontQuality); -begin - Font.Quality := AValue; -end; - -procedure TCustomSynEdit.SetName(const Value: TComponentName); -var - TextToName: Boolean; -begin - TextToName := (ComponentState * [csDesigning, csLoading] = [csDesigning]) - and (TrimRight(Text) = Name); - inherited SetName(Value); - if TextToName then - Text := Value; -end; - -procedure TCustomSynEdit.SetScrollBars(const Value: TScrollStyle); -begin - if (FScrollBars <> Value) then - begin - FScrollBars := Value; - UpdateScrollBars; - Invalidate; - end; -end; - -procedure TCustomSynEdit.SetSelText(const Value: string); -begin - SetSelTextPrimitiveEx(fActiveSelectionMode, PWideChar(Value), True); -end; - -// This is really a last minute change and I hope I did it right. -// Reason for this modification: next two lines will loose the CaretX position -// if eoScrollPastEol is not set in Options. That is not really a good idea -// as we would typically want the cursor to stay where it is. -// To fix this (in the absence of a better idea), I changed the code in -// DeleteSelection not to trim the string if eoScrollPastEol is not set. -procedure TCustomSynEdit.SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; Value: PWideChar; - AddToUndoList: Boolean = True; SilentDelete: Boolean = False); -{ - Works in two stages: - - First deletes selection. - - Second inserts text taking into account PasteMode. - - SilentDelete does not restore selection on undo - - The routine takes full care of undo/redo -} -var - BB, BE: TBufferCoord; - TempString, SelectedText: string; - - procedure DeleteSelection; - var - x: Integer; - begin - case fActiveSelectionMode of - smNormal: - begin - if Lines.Count > 0 then - begin - // Create a string that contains everything on the first line up - // to the selection mark, and everything on the last line after - // the selection mark. - TempString := Copy(Lines[BB.Line - 1], 1, BB.Char - 1) + - Copy(Lines[BE.Line - 1], BE.Char, MaxInt); - // Delete all lines in the selection range. - TSynEditStringList(Lines).DeleteLines(BB.Line, BE.Line - BB.Line); - // Put the stuff that was outside of selection back in. - if Options >= [eoScrollPastEol, eoTrimTrailingSpaces] then - TempString := TrimTrailingSpaces(TempString); - Lines[BB.Line - 1] := TempString; - end; - InternalCaretXY := BB; - end; - smColumn: - begin - // swap X if needed - if BB.Char > BE.Char then - SwapInt(Integer(BB.Char), Integer(BE.Char)); - - for x := BB.Line - 1 to BE.Line - 1 do - begin - TempString := Lines[x]; - Delete(TempString, BB.Char, BE.Char - BB.Char); - ProperSetLine(x, TempString); - end; - // Lines never get deleted completely, so keep caret at end. - InternalCaretXY := BufferCoord(BB.Char, fBlockEnd.Line); - // Column deletion never removes a line entirely, so no mark - // updating is needed here. - end; - smLine: - begin - if BE.Line = Lines.Count then - begin - Lines[BE.Line - 1] := ''; - for x := BE.Line - 2 downto BB.Line - 1 do - Lines.Delete(x); - end - else begin - for x := BE.Line - 1 downto BB.Line - 1 do - Lines.Delete(x); - end; - // smLine deletion always resets to first column. - InternalCaretXY := BufferCoord(1, BB.Line); - end; - end; - end; - - procedure InsertText; - - function CountLines(p: PWideChar): Integer; - begin - Result := 0; - while p^ <> #0 do - begin - if p^ = #13 then - Inc(p); - if p^ = #10 then - Inc(p); - Inc(Result); - p := GetEOL(p); - end; - end; - - function InsertNormal: Integer; - var - sLeftSide: string; - sRightSide: string; - Str: string; - Start: PWideChar; - P: PWideChar; - begin - Result := 0; - sLeftSide := Copy(LineText, 1, CaretX - 1); - if CaretX - 1 > Length(sLeftSide) then - begin - sLeftSide := sLeftSide + StringofChar(#32, - CaretX - 1 - Length(sLeftSide)); - end; - sRightSide := Copy(LineText, CaretX, Length(LineText) - (CaretX - 1)); - // step1: insert the first line of Value into current line - Start := PWideChar(Value); - P := GetEOL(Start); - if P^ <> #0 then - begin - Str := sLeftSide + Copy(Value, 1, P - Start); - ProperSetLine(CaretY - 1, Str); - TSynEditStringList(Lines).InsertLines(CaretY, CountLines(P)); - end - else begin - Str := sLeftSide + Value + sRightSide; - ProperSetLine(CaretY -1, Str); - end; - // step2: insert left lines of Value - while P^ <> #0 do - begin - if P^ = #13 then - Inc(P); - if P^ = #10 then - Inc(P); - Inc(fCaretY); - Include(fStatusChanges, scCaretY); - Start := P; - P := GetEOL(Start); - if P = Start then - begin - if p^ <> #0 then - Str := '' - else - Str := sRightSide; - end - else begin - SetString(Str, Start, P - Start); - if p^ = #0 then - Str := Str + sRightSide - end; - ProperSetLine(CaretY -1, Str); - Inc(Result); - end; - if eoTrimTrailingSpaces in Options then - if sRightSide = '' then - fCaretX := GetExpandedLength(Str, TabWidth) + 1 - else - fCaretX := 1 + Length(Lines[CaretY - 1]) - Length(TrimTrailingSpaces(sRightSide)) - else fCaretX := 1 + Length(Lines[CaretY - 1]) - Length(sRightSide); - StatusChanged([scCaretX]); - end; - - function InsertColumn: Integer; - var - Str: string; - Start: PWideChar; - P: PWideChar; - Len: Integer; - InsertPos: Integer; - LineBreakPos: TBufferCoord; - begin - Result := 0; - // Insert string at current position - InsertPos := CaretX; - Start := PWideChar(Value); - repeat - P := GetEOL(Start); - if P <> Start then - begin - SetLength(Str, P - Start); - Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); - if CaretY > Lines.Count then - begin - Inc(Result); - TempString := StringofChar(#32, InsertPos - 1) + Str; - Lines.Add(''); - if AddToUndoList then - begin - LineBreakPos.Line := CaretY -1; - LineBreakPos.Char := Length(Lines[CaretY - 2]) + 1; - fUndoList.AddChange(crLineBreak, LineBreakPos, LineBreakPos, '', smNormal); - end; - end - else begin - TempString := Lines[CaretY - 1]; - Len := Length(TempString); - if Len < InsertPos then - begin - TempString := - TempString + StringofChar(#32, InsertPos - Len - 1) + Str - end - else - Insert(Str, TempString, InsertPos); - end; - ProperSetLine(CaretY - 1, TempString); - // Add undo change here from PasteFromClipboard - if AddToUndoList then - begin - fUndoList.AddChange(crInsert, BufferCoord(InsertPos, CaretY), - BufferCoord(InsertPos + (P - Start), CaretY), '', fActiveSelectionMode); - end; - end; - if P^ = #13 then - begin - Inc(P); - if P^ = #10 then - Inc(P); - Inc(fCaretY); - Include(fStatusChanges, scCaretY); - end; - Start := P; - until P^ = #0; - Inc(fCaretX, Length(Str)); - Include(fStatusChanges, scCaretX); - end; - - function InsertLine: Integer; - var - Start: PWideChar; - P: PWideChar; - Str: string; - n: Integer; - begin - Result := 0; - fCaretX := 1; - // Insert string before current line - Start := PWideChar(Value); - repeat - P := GetEOL(Start); - if P <> Start then - begin - SetLength(Str, P - Start); - Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); - end - else - Str := ''; - if (P^ = #0) then - begin - n := Lines.Count; - if (n >= CaretY) then - Lines[CaretY - 1] := Str + Lines[CaretY - 1] - else - Lines.Add(Str); - if eoTrimTrailingSpaces in Options then - Lines[CaretY - 1] := TrimTrailingSpaces(Lines[CaretY - 1]); - fCaretX := 1 + Length(Str); - end - else begin - //--------- KV from SynEditStudio - if (CaretY = Lines.Count) or InsertMode then - begin - Lines.Insert(CaretY -1, ''); - Inc(Result); - end; - //--------- - ProperSetLine(CaretY - 1, Str); - Inc(fCaretY); - Include(fStatusChanges, scCaretY); - Inc(Result); - if P^ = #13 then - Inc(P); - if P^ = #10 then - Inc(P); - Start := P; - end; - until P^ = #0; - StatusChanged([scCaretX]); - end; - - begin - if Value = '' then - Exit; - - case PasteMode of - smNormal: - InsertNormal; - smColumn: - InsertColumn; - smLine: - InsertLine; - end; - // Force caret reset - InternalCaretXY := CaretXY; - end; - -begin - Lines.BeginUpdate; - IncPaintLock; - try - BB := BlockBegin; - BE := BlockEnd; - - SelectedText := SelText; - - if AddToUndoList and (Length(Value) > 0) then - BeginUndoBlock; - try - if SelectedText <> '' then - begin - if AddToUndoList then - begin - if SilentDelete then - fUndoList.AddChange(crSilentDelete, fBlockBegin, fBlockEnd, - SelectedText, fActiveSelectionMode) - else - fUndoList.AddChange(crDelete, fBlockBegin, fBlockEnd, - SelectedText, fActiveSelectionMode); - end; - DeleteSelection; - InternalCaretXY := BB; - end; - - if Length(Value) > 0 then - begin - InsertText; - // In scColumn mode undo is added inside InsertColumn - if AddToUndoList and (PasteMode <> smColumn) then - begin - BE := CaretXY; - if PasteMode = smLine then - begin - BB.Char := 1; - BE.Char := MaxInt; - BE.Line := BE.Line - 1; - end; - fUndoList.AddChange(crInsert, BB, BE, '', PasteMode) - end; - end; - - if CaretY < 1 then - InternalCaretY := 1; - finally - DecPaintLock; - Lines.EndUpdate; - end; - finally - if AddToUndoList and (Length(Value) > 0) then - EndUndoBlock; - end; -end; - -procedure TCustomSynEdit.SynSetText(const Value: string); -begin - Lines.Text := Value; -end; - -procedure TCustomSynEdit.SetTopLine(Value: Integer); -var - Delta: Integer; -begin - if (eoScrollPastEof in Options) then - Value := Min(Value, DisplayLineCount) - else - Value := Min(Value, DisplayLineCount - fLinesInWindow + 1); - Value := Max(Value, 1); - if Value <> TopLine then - begin - Delta := TopLine - Value; - fTopLine := Value; - if Abs(Delta) < fLinesInWindow then - ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil) - else - Invalidate; - - UpdateScrollBars; - StatusChanged([scTopLine]); - end; -end; - -//++ CodeFolding -procedure TCustomSynEdit.SetUseCodeFolding(const Value: Boolean); -Var - ValidValue : Boolean; -begin - ValidValue := Value and ((Assigned(fHighlighter) and - (fHighlighter is TSynCustomCodeFoldingHighlighter)) - or Assigned(fOnScanForFoldRanges)); - - if fUseCodeFolding <> ValidValue then - begin - AllFoldRanges.Reset; - fUseCodeFolding := ValidValue; - Invalidate; // better Invalidate before changing LeftChar and TopLine - if ValidValue then - begin - // !!Mutually exclusive with WordWrap to reduce complexity - WordWrap := False; - FullFoldScan; - end; - OnCodeFoldingChange(Self); - InvalidateGutter; - end; -end; - -procedure TCustomSynEdit.OleDragEnter(Sender: TObject; DataObject: IDataObject; - State: TShiftState; MousePt: TPoint; var Effect: LongInt; - var Result: HResult); -begin - if ReadOnly or not HasFormat(DataObject, CF_UNICODETEXT) then - Effect := DROPEFFECT_NONE; -end; - -procedure TCustomSynEdit.OleDragLeave(Sender: TObject; var Result: HResult); -begin - fScrollTimer.Enabled := False; - if sfOleDragSource in fStateFlags then //internal dragging - ComputeCaret(FMouseDownX, FMouseDownY); -end; - -procedure TCustomSynEdit.OleDragOver(Sender: TObject; DataObject: IDataObject; - State: TShiftState; MousePt: TPoint; var Effect: LongInt; - var Result: HResult); -var - vNewPos: TDisplayCoord; - Pt : TPoint; -begin - Pt := ScreenToClient(MousePt); - vNewPos := PixelsToNearestRowColumn(Pt.X, Pt.Y); - vNewPos.Column := MinMax(vNewPos.Column, LeftChar, LeftChar + CharsInWindow - 1); - vNewPos.Row := MinMax(vNewPos.Row, TopLine, TopLine + LinesInWindow - 1); - InternalCaretXY := DisplayToBufferPos(vNewPos); - ComputeScroll(Pt.X, Pt.Y); -end; - -procedure TCustomSynEdit.OleDrop(Sender: TObject; DataObject: IDataObject; - State: TShiftState; MousePt: TPoint; var Effect: LongInt; - var Result: HResult); -var - vNewCaret: TBufferCoord; - DoDrop, DropAfter, DropMove: Boolean; - vBB, vBE: TBufferCoord; - DragDropText: string; - ChangeScrollPastEOL: Boolean; - FormatEtc : TFormatEtc; - Medium : TStgMedium; - Pt : TPoint; -begin - Pt := ScreenToClient(MousePt); - DropMove := Effect = DROPEFFECT_MOVE; - - IncPaintLock; - try - ComputeCaret(Pt.X, Pt.Y); - vNewCaret := CaretXY; - if not (sfOleDragSource in fStateFlags) then - begin - DoDrop := True; - DropAfter := False; - end - else - begin - // Internal dragging - vBB := BlockBegin; - vBE := BlockEnd; - DropAfter := (vNewCaret.Line > vBE.Line) - or ((vNewCaret.Line = vBE.Line) and ((vNewCaret.Char > vBE.Char) or - ((not DropMove) and (vNewCaret.Char = vBE.Char)))); - DoDrop := DropAfter or (vNewCaret.Line < vBB.Line) - or ((vNewCaret.Line = vBB.Line) and ((vNewCaret.Char < vBB.Char) or - ((not DropMove) and (vNewCaret.Char = vBB.Char)))); - end; - - if DoDrop then begin - with FormatEtc do begin - cfFormat := CF_UNICODETEXT; - dwAspect := DVASPECT_CONTENT; - ptd := nil; - tymed := TYMED_HGLOBAL; - lindex := -1; - end; - if DataObject.GetData(FormatEtc, Medium) = S_OK then begin - if Medium.hGlobal <> 0 then begin - DragDropText := PChar(GlobalLock(Medium.hGlobal)); - GlobalUnLock(Medium.hGlobal); - DoDrop := DragDropText <> ''; - end else - DoDrop := False; - ReleaseStgMedium(Medium); - end else - DoDrop := False; - end; - - if DoDrop then begin - BeginUndoBlock; - try - // delete the selected text if necessary - if DropMove then - begin - if sfOleDragSource in fStateFlags then begin - // Internal dragging - Effect := DROPEFFECT_NONE; // do not clear selection after drop - SelText := ''; - // adjust horizontal drop position - if DropAfter and (vNewCaret.Line = vBE.Line) then - Dec(vNewCaret.Char, vBE.Char - vBB.Char); - // adjust vertical drop position - if DropAfter and (vBE.Line > vBB.Line) then - Dec(vNewCaret.Line, vBE.Line - vBB.Line); - end; - end; - // insert the selected text - ChangeScrollPastEOL := not (eoScrollPastEol in fOptions); - try - if ChangeScrollPastEOL then - Include(fOptions, eoScrollPastEol); - InternalCaretXY := vNewCaret; - BlockBegin := vNewCaret; - SelText := DragDropText; // creates undo action - finally - if ChangeScrollPastEOL then - Exclude(fOptions, eoScrollPastEol); - end; - SetCaretAndSelection(CaretXY, vNewCaret, CaretXY); - fUndoList.AddChange(crSelection, fBlockBegin, fBlockEnd, '', ActiveSelectionMode); - finally - EndUndoBlock; - end; - end else - Effect := DROPEFFECT_NONE; - finally - DecPaintLock; - end; -end; - -procedure TCustomSynEdit.OnCodeFoldingChange(Sender: TObject); -begin - if fUseCodeFolding then - // The fold shape is drawn in a square 2 * Gutter.RightMargin - // to the right of RightOffset and 2 * Gutter.RightMagin to the left of - // fGuttterWidth. It is centered vertically. - // Gutter.RightMargin is 2 at 96 DPI - Gutter.RightOffset := CodeFolding.GutterShapeSize + 2 * Gutter.RightMargin - else - Gutter.RightOffset := Gutter.RightMargin; - Invalidate; -end; - -function TCustomSynEdit.GetCollapseMarkRect(Row, Line: Integer): TRect; -begin - Result := Rect(0, 0, 0, 0); - - if not UseCodeFolding then - Exit; - - if Line < 0 then - Line := RowToLine(Row); - - if not AllFoldRanges.CollapsedFoldStartAtLine(Line) then - Exit; - - { Prepare rect } - with Result do - begin - Top := (Row - fTopLine) * fTextHeight + 1; - Bottom := Top + fTextHeight - 2; - end; - - Result.Left := fTextOffset + - (TSynEditStringList(fLines).ExpandedStringLengths[Line-1] + 1) * fCharWidth; - - { Fix rect } - if eoShowSpecialChars in fOptions then - Inc(Result.Left, fCharWidth); - - // Deal wwth horizontal Scroll - Result.Left := Max(Result.Left, fGutterWidth + fCharWidth); - - Result.Right := Result.Left + fCharWidth * 3 + 4 * (fCharWidth div 7); -end; - -function TCustomSynEdit.GetFoldShapeRect(Row: Integer): TRect; -begin - // Form a square rect for the square the user can click on - // The fold shape is drawn in a square 4 pixels to the right of RightOffset - // 4 pixels from the fGuttterWidth. It is vertically centered within a line. - Result.Left := fGutterWidth - CodeFolding.GutterShapeSize - 2 * Gutter.RightMargin; - Result.Right := Result.Left + CodeFolding.GutterShapeSize; - Result.Top := (Row - fTopLine) * LineHeight; - // make a square rect - Result.Top := Result.Top + ((LineHeight - (Result.Right - Result.Left)) div 2); - Result.Bottom := Result.Top + (Result.Right - Result.Left); -end; -//-- CodeFolding - -procedure TCustomSynEdit.ShowCaret; -begin - if not (eoNoCaret in Options) and not (sfCaretVisible in fStateFlags) then - begin - if Windows.ShowCaret(Handle) then - Include(fStateFlags, sfCaretVisible); - end; -end; - -procedure TCustomSynEdit.UpdateCaret; -var - CX, CY: Integer; - iClientRect: TRect; - vCaretDisplay: TDisplayCoord; - vCaretPix: TPoint; - cf: TCompositionForm; -begin - if (PaintLock <> 0) or not (Focused or FAlwaysShowCaret) then - Include(fStateFlags, sfCaretChanged) - else - begin - Exclude(fStateFlags, sfCaretChanged); - vCaretDisplay := DisplayXY; - if WordWrap and (vCaretDisplay.Column > CharsInWindow + 1) then - vCaretDisplay.Column := CharsInWindow + 1; - vCaretPix := RowColumnToPixels(vCaretDisplay); - CX := vCaretPix.X + FCaretOffset.X; - CY := vCaretPix.Y + FCaretOffset.Y; - iClientRect := GetClientRect; - Inc(iClientRect.Left, fGutterWidth); - if (CX >= iClientRect.Left) and (CX < iClientRect.Right) - and (CY >= iClientRect.Top) and (CY < iClientRect.Bottom) then - begin - SetCaretPos(CX, CY); - ShowCaret; - end - else - begin - SetCaretPos(CX, CY); - HideCaret; - end; - cf.dwStyle := CFS_POINT; - cf.ptCurrentPos := Point(CX, CY); - ImmSetCompositionWindow(ImmGetContext(Handle), @cf); - end; -end; - -procedure TCustomSynEdit.UpdateScrollBars; -var - nMaxScroll: Integer; - ScrollInfo: TScrollInfo; - iRightChar: Integer; -begin - if not HandleAllocated or (PaintLock <> 0) then - Include(fStateFlags, sfScrollbarChanged) - else begin - Exclude(fStateFlags, sfScrollbarChanged); - if fScrollBars <> ssNone then - begin - ScrollInfo.cbSize := SizeOf(ScrollInfo); - ScrollInfo.fMask := SIF_ALL; - if not(eoHideShowScrollbars in Options) then - begin - ScrollInfo.fMask := ScrollInfo.fMask or SIF_DISABLENOSCROLL; - end; - -// if Visible then SendMessage(Handle, WM_SETREDRAW, 0, 0); - - if (fScrollBars in [TScrollStyle.ssBoth, TScrollStyle.ssHorizontal]) and not WordWrap then - begin - nMaxScroll := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); - if nMaxScroll <= MAX_SCROLL then - begin - ScrollInfo.nMin := 1; - ScrollInfo.nMax := nMaxScroll; - ScrollInfo.nPage := CharsInWindow; - ScrollInfo.nPos := LeftChar; - end - else begin - ScrollInfo.nMin := 0; - ScrollInfo.nMax := MAX_SCROLL; - ScrollInfo.nPage := MulDiv(MAX_SCROLL, CharsInWindow, nMaxScroll); - ScrollInfo.nPos := MulDiv(MAX_SCROLL, LeftChar, nMaxScroll); - end; - - ShowScrollBar(Handle, SB_HORZ, not(eoHideShowScrollbars in Options) or - (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > CharsInWindow)); - SetScrollInfo(Handle, SB_HORZ, ScrollInfo, True); - - //Now for the arrows - if (eoDisableScrollArrows in Options) or (nMaxScroll <= CharsInWindow) then - begin - iRightChar := LeftChar + CharsInWindow -1; - if (LeftChar <= 1) and (iRightChar >= nMaxScroll) then - begin - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_BOTH); - end - else begin - EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); - if (LeftChar <= 1) then - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_LEFT) - else if iRightChar >= nMaxScroll then - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_RIGHT) - end; - end - else - EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); - end - else - ShowScrollBar(Handle, SB_HORZ, False); - - if fScrollBars in [ssBoth, ssVertical] then - begin - nMaxScroll := DisplayLineCount; - if (eoScrollPastEof in Options) then - Inc(nMaxScroll, LinesInWindow - 1); - if nMaxScroll <= MAX_SCROLL then - begin - ScrollInfo.nMin := 1; - ScrollInfo.nMax := Max(1, nMaxScroll); - ScrollInfo.nPage := LinesInWindow; - ScrollInfo.nPos := TopLine; - end - else begin - ScrollInfo.nMin := 0; - ScrollInfo.nMax := MAX_SCROLL; - ScrollInfo.nPage := MulDiv(MAX_SCROLL, LinesInWindow, nMaxScroll); - ScrollInfo.nPos := MulDiv(MAX_SCROLL, TopLine, nMaxScroll); - end; - - ShowScrollBar(Handle, SB_VERT, not(eoHideShowScrollbars in Options) or - (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > LinesInWindow)); - SetScrollInfo(Handle, SB_VERT, ScrollInfo, True); - - if (eoDisableScrollArrows in Options) or (nMaxScroll <= LinesInWindow) then - begin - if (TopLine <= 1) and (nMaxScroll <= LinesInWindow) then - begin - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_BOTH); - end - else begin - EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); - if (TopLine <= 1) then - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_UP) - else if ((DisplayLineCount - TopLine - LinesInWindow + 1) = 0) then - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_DOWN); - end; - end - else - EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); - -// if Visible then SendMessage(Handle, WM_SETREDRAW, -1, 0); -// if fPaintLock=0 then -// Invalidate; - Update; - - end - else - ShowScrollBar(Handle, SB_VERT, False); - - end {endif fScrollBars <> ssNone} - else - ShowScrollBar(Handle, SB_BOTH, False); - end; -end; - -function TCustomSynEdit.DoMouseWheel(Shift: TShiftState; - WheelDelta: Integer; MousePos: TPoint): Boolean; -const - WHEEL_DIVISOR = 120; // Mouse Wheel standard -var - iWheelClicks: Integer; - iLinesToScroll: Integer; -begin - Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos); - if Result then - Exit; - if GetKeyState(SYNEDIT_CONTROL) < 0 then - iLinesToScroll := LinesInWindow shr Ord(eoHalfPageScroll in fOptions) - else - iLinesToScroll := 3; - Inc(fMouseWheelAccumulator, WheelDelta); - iWheelClicks := fMouseWheelAccumulator div WHEEL_DIVISOR; - fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DIVISOR; - TopLine := TopLine - iWheelClicks * iLinesToScroll; - Update; - if Assigned(OnScroll) then OnScroll(Self,sbVertical); - Result := True; -end; - -procedure TCustomSynEdit.WMCaptureChanged(var Msg: TMessage); -begin - fScrollTimer.Enabled := False; - inherited; -end; - -procedure TCustomSynEdit.WMClear(var Msg: TMessage); -begin - if not ReadOnly then - SelText := ''; -end; - -procedure TCustomSynEdit.WMCopy(var Message: TMessage); -begin - CopyToClipboard; - Message.Result := ord(True); -end; - -procedure TCustomSynEdit.WMCut(var Message: TMessage); -begin - if not ReadOnly then - CutToClipboard; - Message.Result := ord(True); -end; - -procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage); -var - i, iNumberDropped: Integer; - FileNameW: array[0..MAX_PATH - 1] of WideChar; - Point: TPoint; - FilesList: TStringList; -begin - try - if Assigned(fOnDropFiles) then - begin - FilesList := TStringList.Create; - try - iNumberDropped := DragQueryFile(THandle(Msg.wParam), Cardinal(-1), - nil, 0); - DragQueryPoint(THandle(Msg.wParam), Point); - - for i := 0 to iNumberDropped - 1 do - begin - DragQueryFileW(THandle(Msg.wParam), i, FileNameW, - sizeof(FileNameW) div 2); - FilesList.Add(FileNameW) - end; - fOnDropFiles(Self, Point.X, Point.Y, FilesList); - finally - FilesList.Free; - end; - end; - finally - Msg.Result := 0; - DragFinish(THandle(Msg.wParam)); - end; -end; - -procedure TCustomSynEdit.WMDestroy(var Message: TWMDestroy); -begin - // See https://en.delphipraxis.net/topic/456-destroywnd-not-called-at-destruction-of-wincontrols/ - if (eoDropFiles in fOptions) and not (csDesigning in ComponentState) then - DragAcceptFiles(Handle, False); - - RevokeDragDrop(Handle); - - inherited; -end; - -procedure TCustomSynEdit.WMEraseBkgnd(var Msg: TMessage); -begin - Msg.Result := 1; -end; - -procedure TCustomSynEdit.WMGetDlgCode(var Msg: TWMGetDlgCode); -begin - inherited; - Msg.Result := Msg.Result or DLGC_WANTARROWS or DLGC_WANTCHARS; - if fWantTabs then - Msg.Result := Msg.Result or DLGC_WANTTAB; - if fWantReturns then - Msg.Result := Msg.Result or DLGC_WANTALLKEYS; -end; - -procedure TCustomSynEdit.WMGetText(var Msg: TWMGetText); -begin - Msg.Result := StrLen(StrLCopy(PChar(Msg.Text), PChar(Text), Msg.TextMax - 1)); -end; - -procedure TCustomSynEdit.WMGetTextLength(var Msg: TWMGetTextLength); -begin - // Avoid (useless) temporary copy of WindowText while window is recreated - // because of docking. - if csDocking in ControlState then - Msg.Result := 0 - else - Msg.Result := Length(Text); -end; - -procedure TCustomSynEdit.WMHScroll(var Msg: TWMScroll); -var - iMaxWidth: integer; -begin - Msg.Result := 0; - case Msg.ScrollCode of - // Scrolls to start / end of the line - SB_LEFT: LeftChar := 1; - SB_RIGHT: - // Simply set LeftChar property to the LengthOfLongestLine, - // it would do the range checking and constrain the value if necessary - LeftChar := TSynEditStringList(Lines).LengthOfLongestLine; - // Scrolls one char left / right - SB_LINERIGHT: LeftChar := LeftChar + 1; - SB_LINELEFT: LeftChar := LeftChar - 1; - // Scrolls one page of chars left / right - SB_PAGERIGHT: LeftChar := LeftChar - + (fCharsInWindow - Ord(eoScrollByOneLess in fOptions)); - SB_PAGELEFT: LeftChar := LeftChar - - (fCharsInWindow - Ord(eoScrollByOneLess in fOptions)); - // Scrolls to the current scroll bar position - SB_THUMBPOSITION, - SB_THUMBTRACK: - begin - FIsScrolling := True; - iMaxWidth := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); - if iMaxWidth > MAX_SCROLL then - LeftChar := MulDiv(iMaxWidth, Msg.Pos, MAX_SCROLL) - else - LeftChar := Msg.Pos; - end; - SB_ENDSCROLL: FIsScrolling := False; - end; - if Assigned(OnScroll) then OnScroll(Self,sbHorizontal); -end; - -procedure TCustomSynEdit.WMImeChar(var Msg: TMessage); -begin - // do nothing here, the IME string is retrieved in WMImeComposition - - // Handling the WM_IME_CHAR message stops Windows from sending WM_CHAR - // messages while using the IME -end; - -procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage); -var - imc: HIMC; - PW: PWideChar; - ImeCount: Integer; -begin - if (Msg.LParam and GCS_RESULTSTR) <> 0 then - begin - imc := ImmGetContext(Handle); - try - ImeCount := ImmGetCompositionStringW(imc, GCS_RESULTSTR, nil, 0); - // ImeCount is always the size in bytes, also for Unicode - GetMem(PW, ImeCount + sizeof(WideChar)); - try - ImmGetCompositionStringW(imc, GCS_RESULTSTR, PW, ImeCount); - PW[ImeCount div sizeof(WideChar)] := #0; - CommandProcessor(ecImeStr, #0, PW); - finally - FreeMem(PW); - end; - finally - ImmReleaseContext(Handle, imc); - end; - end; - inherited; -end; - -procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage); -var - imc: HIMC; - LogFontW: TLogFontW; -begin - with Msg do - begin - case WParam of - IMN_SETOPENSTATUS: - begin - imc := ImmGetContext(Handle); - if imc <> 0 then - begin - GetObjectW(Font.Handle, SizeOf(TLogFontW), @LogFontW); - ImmSetCompositionFontW(imc, @LogFontW); - ImmReleaseContext(Handle, imc); - end; - end; - end; - end; - inherited; -end; - -procedure TCustomSynEdit.WMKillFocus(var Msg: TWMKillFocus); -begin - inherited; - CommandProcessor(ecLostFocus, #0, nil); - //Added check for focused to prevent caret disappearing problem - if Focused or FAlwaysShowCaret then - exit; - HideCaret; - Windows.DestroyCaret; - if FHideSelection and SelAvail then - InvalidateSelection; -end; - -procedure TCustomSynEdit.WMPaste(var Message: TMessage); -begin - if not ReadOnly then - PasteFromClipboard; - Message.Result := ord(True); -end; - -procedure TCustomSynEdit.WMCancelMode(var Message:TMessage); -begin - -end; - -procedure TCustomSynEdit.WMSetFocus(var Msg: TWMSetFocus); -begin - CommandProcessor(ecGotFocus, #0, nil); - - InitializeCaret; - if FHideSelection and SelAvail then - InvalidateSelection; -end; - -procedure TCustomSynEdit.WMSetText(var Msg: TWMSetText); -begin - Msg.Result := 1; - Text := PWideChar(Msg.Text) -end; - -procedure TCustomSynEdit.WMSize(var Msg: TWMSize); -begin - inherited; - SizeOrFontChanged(False); -end; - -procedure TCustomSynEdit.WMUndo(var Msg: TMessage); -begin - Undo; -end; - -var - ScrollHintWnd: THintWindow; - -function GetScrollHint: THintWindow; -begin - if ScrollHintWnd = nil then - ScrollHintWnd := HintWindowClass.Create(Application); - Result := ScrollHintWnd; -end; - -procedure TCustomSynEdit.WMVScroll(var Msg: TWMScroll); -var - s: string; - rc: TRect; - pt: TPoint; - ScrollHint: THintWindow; - ButtonH: Integer; - ScrollInfo: TScrollInfo; -begin - Msg.Result := 0; - case Msg.ScrollCode of - // Scrolls to start / end of the text - SB_TOP: TopLine := 1; - SB_BOTTOM: TopLine := DisplayLineCount; - // Scrolls one line up / down - SB_LINEDOWN: TopLine := TopLine + 1; - SB_LINEUP: TopLine := TopLine - 1; - // Scrolls one page of lines up / down - SB_PAGEDOWN: TopLine := TopLine - + (fLinesInWindow - Ord(eoScrollByOneLess in fOptions)); - SB_PAGEUP: TopLine := TopLine - - (fLinesInWindow - Ord(eoScrollByOneLess in fOptions)); - // Scrolls to the current scroll bar position - SB_THUMBPOSITION, - SB_THUMBTRACK: - begin - FIsScrolling := True; - if DisplayLineCount > MAX_SCROLL then - TopLine := MulDiv(LinesInWindow + DisplayLineCount - 1, Msg.Pos, - MAX_SCROLL) - else - TopLine := Msg.Pos; - - if eoShowScrollHint in fOptions then - begin - ScrollHint := GetScrollHint; - ScrollHint.Color := fScrollHintColor; - case FScrollHintFormat of - shfTopLineOnly: - s := Format(SYNS_ScrollInfoFmtTop, [RowToLine(TopLine)]); - else - s := Format(SYNS_ScrollInfoFmt, [RowToLine(TopLine), - RowToLine(TopLine + Min(LinesInWindow, DisplayLineCount-TopLine))]); - end; - - rc := ScrollHint.CalcHintRect(200, s, nil); - if eoScrollHintFollows in fOptions then - begin - ButtonH := GetSystemMetrics(SM_CYVSCROLL); - - FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); - ScrollInfo.cbSize := SizeOf(ScrollInfo); - ScrollInfo.fMask := SIF_ALL; - GetScrollInfo(Handle, SB_VERT, ScrollInfo); - - pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, - ((rc.Bottom - rc.Top) shr 1) + //half the size of the hint window - Round((ScrollInfo.nTrackPos / ScrollInfo.nMax) * //The percentage of the page that has been scrolled - (ClientHeight - (ButtonH * 2))) //The height minus the arrow buttons - + ButtonH)); //The height of the top button - end - else - pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); - - OffsetRect(rc, pt.x, pt.y); - ScrollHint.ActivateHint(rc, s); - ScrollHint.Update; - end; - end; - // Ends scrolling - SB_ENDSCROLL: - begin - FIsScrolling := False; - if eoShowScrollHint in fOptions then - ShowWindow(GetScrollHint.Handle, SW_HIDE); - end; - end; - Update; - if Assigned(OnScroll) then OnScroll(Self,sbVertical); -end; - -function TCustomSynEdit.ScanFrom(Index: Integer): Integer; -var - iRange: TSynEditRange; -begin - Result := Index; - if Result >= Lines.Count then Exit; - - if Result = 0 then - fHighlighter.ResetRange - else - fHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Result - 1]); - - repeat - fHighlighter.SetLine(Lines[Result], Result); - fHighlighter.NextToEol; - iRange := fHighlighter.GetRange; - if TSynEditStringList(Lines).Ranges[Result] = iRange then - Exit; // avoid the final Decrement - TSynEditStringList(Lines).Ranges[Result] := iRange; - Inc(Result); - until (Result = Lines.Count); - Dec(Result); -end; - -procedure TCustomSynEdit.ListCleared(Sender: TObject); -begin - if WordWrap then - fWordWrapPlugin.Reset; - -//++ CodeFolding - if UseCodeFolding then - AllFoldRanges.Reset; -//-- CodeFolding - - ClearUndo; - // invalidate the *whole* client area - FillChar(fInvalidateRect, SizeOf(TRect), 0); - Invalidate; - // set caret and selected block to start of text - CaretXY := BufferCoord(1, 1); - // scroll to start of text - TopLine := 1; - LeftChar := 1; - Include(fStatusChanges, scAll); -end; - -procedure TCustomSynEdit.ListDeleted(Sender: TObject; aIndex: Integer; - aCount: Integer); -//++ CodeFolding -Var - vLastScan: Integer; -begin - DoLinesDeleted(aIndex, aCount); - - vLastScan := aIndex; - if Assigned(fHighlighter) and (Lines.Count > 0) then - vLastScan := ScanFrom(aIndex); - - if UseCodeFolding then begin - AllFoldRanges.LinesDeleted(aIndex, aCount); - // Scan the same lines the highlighter has scanned - ReScanForFoldRanges(aIndex, vLastScan); - InvalidateGutter; - end; -//-- CodeFolding - - if WordWrap then - fWordWrapPlugin.LinesDeleted(aIndex, aCount); - - InvalidateLines(aIndex + 1, MaxInt); - InvalidateGutterLines(aIndex + 1, MaxInt); -//++ Flicker Reduction - Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction -end; - -procedure TCustomSynEdit.ListInserted(Sender: TObject; Index: Integer; - aCount: Integer); -var - vLastScan: Integer; -//++ CodeFolding - FoldIndex: Integer; -begin - DoLinesInserted(Index, aCount); - - vLastScan := Index; -//-- CodeFolding - if Assigned(fHighlighter) and (Lines.Count > 0) then - begin - repeat - vLastScan := ScanFrom(vLastScan); - Inc(vLastScan); - until vLastScan >= Index + aCount; - end; - -//++ CodeFolding - if UseCodeFolding then begin - if fAllFoldRanges.CollapsedFoldStartAtLine(Index, FoldIndex) then - // insertion starts at collapsed fold - Uncollapse(FoldIndex); - AllFoldRanges.LinesInserted(Index, aCount); - // Scan the same lines the highlighter has scanned - ReScanForFoldRanges(Index, vLastScan-1); - end; -//-- CodeFolding - - if WordWrap then - fWordWrapPlugin.LinesInserted(Index, aCount); - - InvalidateLines(Index + 1, MaxInt); - InvalidateGutterLines(Index + 1, MaxInt); -//++ Flicker Reduction - Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction -end; - -procedure TCustomSynEdit.ListPutted(Sender: TObject; Index: Integer; - aCount: Integer); -var - vEndLine: Integer; -//++ CodeFolding - vLastScan: Integer; - FoldIndex: Integer; -//-- CodeFolding -begin - vEndLine := Index +1; - if WordWrap then - begin - if fWordWrapPlugin.LinesPutted(Index, aCount) <> 0 then - vEndLine := MaxInt; - InvalidateGutterLines(Index + 1, vEndLine); - end; -//++ CodeFolding - vLastScan := Index; - if Assigned(fHighlighter) then - begin - vLastScan := ScanFrom(Index); - vEndLine := Max(vEndLine, vLastScan + 1); -//-- CodeFolding - // If this editor is chained then the real owner of text buffer will probably - // have already parsed the changes, so ScanFrom will return immediately. - if fLines <> fOrigLines then - vEndLine := MaxInt; - end; - -//++ CodeFolding - if fUseCodeFolding then begin - if fAllFoldRanges.CollapsedFoldStartAtLine(Index + 1, FoldIndex) then - // modification happens at collapsed fold - Uncollapse(FoldIndex); - AllFoldRanges.LinesPutted(Index, aCount); - // Scan the same lines the highlighter has scanned - ReScanForFoldRanges(Index, vLastScan); - end; -//-- CodeFolding - - InvalidateLines(Index + 1, vEndLine); - InvalidateGutterLines(Index + 1, vEndLine); -//++ Flicker Reduction - Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction -end; - -procedure TCustomSynEdit.ScanRanges; -var - i: Integer; -begin - if Assigned(fHighlighter) and (Lines.Count > 0) then begin - fHighlighter.ResetRange; - i := 0; - repeat - fHighlighter.SetLine(Lines[i], i); - fHighlighter.NextToEol; - TSynEditStringList(Lines).Ranges[i] := fHighlighter.GetRange; - Inc(i); - until i >= Lines.Count; - end; -end; - -procedure TCustomSynEdit.SetWordBlock(Value: TBufferCoord); -var - vBlockBegin: TBufferCoord; - vBlockEnd: TBufferCoord; - TempString: string; - - procedure CharScan; - var - cRun: Integer; - begin - { search BlockEnd } - vBlockEnd.Char := Length(TempString); - for cRun := Value.Char to Length(TempString) do - if not IsIdentChar(TempString[cRun]) then - begin - vBlockEnd.Char := cRun; - Break; - end; - { search BlockBegin } - vBlockBegin.Char := 1; - for cRun := Value.Char - 1 downto 1 do - if not IsIdentChar(TempString[cRun]) then - begin - vBlockBegin.Char := cRun + 1; - Break; - end; - end; - -begin - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - TempString := Lines[Value.Line - 1] + #0; //needed for CaretX = LineLength + 1 - if Value.Char > Length(TempString) then - begin - InternalCaretXY := BufferCoord(Length(TempString), Value.Line); - exit; - end; - - CharScan; - - vBlockBegin.Line := Value.Line; - vBlockEnd.Line := Value.Line; - SetCaretAndSelection(vBlockEnd, vBlockBegin, vBlockEnd); - InvalidateLine(Value.Line); - StatusChanged([scSelection]); -end; - -procedure TCustomSynEdit.DblClick; -var - ptMouse: TPoint; -begin - GetCursorPos(ptMouse); - ptMouse := ScreenToClient(ptMouse); - if ptMouse.X >= fGutterWidth + 2 then - begin - if not (eoNoSelection in fOptions) then - SetWordBlock(CaretXY); - inherited; - end - else - inherited; -end; - -function TCustomSynEdit.GetCanUndo: Boolean; -begin - result := not ReadOnly and fUndoList.CanUndo; -end; - -function TCustomSynEdit.GetCanRedo: Boolean; -begin - result := not ReadOnly and fRedoList.CanUndo; -end; - -function TCustomSynEdit.GetCanPaste; -begin - Result := not ReadOnly and ClipboardProvidesText; -end; - -procedure TCustomSynEdit.InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; - AddToUndoList: Boolean); -// used by BlockIndent and Redo -Var - OldSelectinonMode : TSynSelectionMode; -begin - SetCaretAndSelection(BB, BB, BE); - OldSelectinonMode := ActiveSelectionMode; - ActiveSelectionMode := smColumn; - SetSelTextPrimitiveEx(smColumn, ChangeStr, AddToUndoList); - StatusChanged([scSelection]); - ActiveSelectionMode := OldSelectinonMode; -end; - -procedure TCustomSynEdit.Redo; - - procedure RemoveGroupBreak; - var - Item: TSynEditUndoItem; - OldBlockNumber: Integer; - begin - if fRedoList.LastChangeReason = crGroupBreak then - begin - OldBlockNumber := UndoList.BlockChangeNumber; - Item := fRedoList.PopItem; - try - UndoList.BlockChangeNumber := Item.ChangeNumber; - fUndoList.AddGroupBreak; - finally - UndoList.BlockChangeNumber := OldBlockNumber; - Item.Free; - end; - UpdateModifiedStatus; - end; - end; - -var - Item: TSynEditUndoItem; - OldChangeNumber: integer; - SaveChangeNumber: integer; - FLastChange : TSynChangeReason; - FAutoComplete: Boolean; - FPasteAction: Boolean; - FSpecial: Boolean; - FKeepGoing: Boolean; -begin - if ReadOnly then - exit; - - FLastChange := FRedoList.LastChangeReason; - FAutoComplete := FLastChange = crAutoCompleteBegin; - FPasteAction := FLastChange = crPasteBegin; - FSpecial := FLastChange = crSpecialBegin; - - Item := fRedoList.PeekItem; - if Item <> nil then - begin - OldChangeNumber := Item.ChangeNumber; - SaveChangeNumber := fUndoList.BlockChangeNumber; - fUndoList.BlockChangeNumber := Item.ChangeNumber; - try - repeat - RedoItem; - Item := fRedoList.PeekItem; - if Item = nil then - FKeepGoing := False - else begin - if FAutoComplete then - FKeepGoing:= (FRedoList.LastChangeReason <> crAutoCompleteEnd) - else if FPasteAction then - FKeepGoing:= (FRedoList.LastChangeReason <> crPasteEnd) - else if FSpecial then - FKeepGoing := (FRedoList.LastChangeReason <> crSpecialEnd) - else if Item.ChangeNumber = OldChangeNumber then - FKeepGoing := True - else begin - FKeepGoing := ((eoGroupUndo in FOptions) and - (FLastChange = Item.ChangeReason) and - not(FLastChange in [crIndent, crUnindent])); - end; - FLastChange := Item.ChangeReason; - end; - until not(FKeepGoing); - - //we need to eat the last command since it does nothing and also update modified status... - if (FAutoComplete and (FRedoList.LastChangeReason = crAutoCompleteEnd)) or - (FPasteAction and (FRedoList.LastChangeReason = crPasteEnd)) or - (FSpecial and (FRedoList.LastChangeReason = crSpecialEnd)) then - begin - RedoItem; - UpdateModifiedStatus; - end; - - finally - fUndoList.BlockChangeNumber := SaveChangeNumber; - end; - RemoveGroupBreak; - end; -end; - -procedure TCustomSynEdit.RedoItem; -var - Item: TSynEditUndoItem; - Run, StrToDelete: PWideChar; - Len: Integer; - TempString: string; - CaretPt: TBufferCoord; - ChangeScrollPastEol: boolean; - BeginX: integer; - OldSelectionMode : TSynSelectionMode; -begin - ChangeScrollPastEol := not (eoScrollPastEol in Options); - Item := fRedoList.PopItem; - OldSelectionMode := ActiveSelectionMode; - if Assigned(Item) then - try - ActiveSelectionMode := Item.ChangeSelMode; - DoOnPaintTransientEx(ttBefore,true); - IncPaintLock; - Include(fOptions, eoScrollPastEol); - fUndoList.InsideRedo := True; - case Item.ChangeReason of - crCaret: - begin - fUndoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', fActiveSelectionMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crSelection: - begin - fUndoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', fActiveSelectionMode); - SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); - end; - crInsert: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeStartPos); - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - InternalCaretXY := Item.ChangeEndPos; - fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, SelText, Item.ChangeSelMode); - end; - crDelete, crSilentDelete: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TempString := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TempString, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crLineBreak: - begin - CaretPt := Item.ChangeStartPos; - SetCaretAndSelection(CaretPt, CaretPt, CaretPt); - CommandProcessor(ecLineBreak, #13, nil); - end; - crIndent: - begin - SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, - Item.ChangeEndPos); - fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crUnindent : - begin // re-delete the (raggered) column - // Delete string - StrToDelete := PWideChar(Item.ChangeStr); - InternalCaretY := Item.ChangeStartPos.Line; - if Item.ChangeSelMode = smColumn then - BeginX := Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char) - else - BeginX := 1; - repeat - Run := GetEOL(StrToDelete); - if Run <> StrToDelete then - begin - Len := Run - StrToDelete; - if Len > 0 then - begin - TempString := Lines[CaretY - 1]; - Delete(TempString, BeginX, Len); - Lines[CaretY - 1] := TempString; - end; - end - else - Len := 0; - if Run^ = #13 then - begin - Inc(Run); - if Run^ = #10 then - Inc(Run); - Inc(fCaretY); - end; - StrToDelete := Run; - until Run^ = #0; - if Item.ChangeSelMode = smColumn then - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos) - else begin - // restore selection - CaretPt.Char := Item.ChangeStartPos.Char - fTabWidth; - CaretPt.Line := Item.ChangeStartPos.Line; - SetCaretAndSelection( CaretPt, CaretPt, - BufferCoord(Item.ChangeEndPos.Char - Len, Item.ChangeEndPos.Line) ); - end; - // add to undo list - fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crNothing, crPasteBegin, crPasteEnd: - fUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - finally - ActiveSelectionMode := OldSelectionMode; - fUndoList.InsideRedo := False; - if ChangeScrollPastEol then - Exclude(fOptions, eoScrollPastEol); - Item.Free; - DecPaintLock; - DoOnPaintTransientEx(ttAfter,true); - end; -end; - -//++ CodeFolding -procedure TCustomSynEdit.Collapse(FoldRangeIndex: Integer; Invalidate:Boolean); -begin - AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := True; - - with AllFoldRanges.Ranges[FoldRangeIndex] do - begin - // Extract caret from fold - if (fCaretY > FromLine) and (fCaretY <= ToLine) then - CaretXY := BufferCoord(Length(Lines[FromLine - 1]) + 1, FromLine); - - if Invalidate then begin - // Redraw the collapsed line and below - InvalidateLines(FromLine, MaxInt); - - // Redraw fold mark - InvalidateGutterLines(FromLine, MaxInt); - - UpdateScrollBars; - end else - // Update Scrollbars - Include(fStateFlags, sfScrollbarChanged); - end; -end; - -procedure TCustomSynEdit.CollapseAll; -var - i: Integer; -begin - if not fUseCodeFolding then Exit; - for i := fAllFoldRanges.Count - 1 downto 0 do - Collapse(i, False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - - -procedure TCustomSynEdit.CollapseLevel(Level: integer); -Var - i : integer; - RangeIndices : TArray; -begin - if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsAtLevel(Level); - for i := Low(RangeIndices) to High(RangeIndices) do - Collapse(RangeIndices[i], False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.CollapseNearest; -Var - Index : integer; -begin - if not fUseCodeFolding then Exit; - if AllFoldRanges.FoldAroundLineEx(CaretY, False, True, True, Index) then - Collapse(Index); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.CollapseFoldType(FoldType : Integer); -Var - i : integer; - RangeIndices : TArray; -begin - if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsOfType(FoldType); - for i := Low(RangeIndices) to High(RangeIndices) do - Collapse(RangeIndices[i],False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.Uncollapse(FoldRangeIndex: Integer; Invalidate:Boolean); -begin - AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := False; - - if Invalidate then with AllFoldRanges.Ranges[FoldRangeIndex] do - begin - // Redraw the uncollapsed line and below - InvalidateLines(FromLine, MaxInt); - - // Redraw fold marks - InvalidateGutterLines(FromLine, MaxInt); - - // Make sure we can see the cursor - // EnsureCursorPosVisible; - - UpdateScrollBars; - end else - // Update Scrollbars - Include(fStateFlags, sfScrollbarChanged); -end; - -procedure TCustomSynEdit.UncollapseAroundLine(Line: Integer); -var - Index: Integer; -begin - if not fUseCodeFolding then Exit; - // Open up the closed folds around the focused line until we can see the line we're looking for - while AllFoldRanges.FoldHidesLine(line, Index) do - Uncollapse(Index); -end; - -procedure TCustomSynEdit.UnCollapseLevel(Level: integer); -Var - i : integer; - RangeIndices : TArray; -begin - if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsAtLevel(Level); - for i := Low(RangeIndices) to High(RangeIndices) do - Uncollapse(RangeIndices[i], False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.UncollapseNearest; -Var - Index : integer; -begin - if not fUseCodeFolding then Exit; - if AllFoldRanges.CollapsedFoldStartAtLine(CaretY, Index) then - Uncollapse(Index); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.UnCollapseFoldType(FoldType : Integer); -Var - i : integer; - RangeIndices : TArray; -begin - if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsOfType(FoldType); - for i := Low(RangeIndices) to High(RangeIndices) do - Uncollapse(RangeIndices[i], False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.DoMouseSelectLineRange(NewPos: TBufferCoord); -{ Select whole lines } -var - BB, BE: TBufferCoord; -begin - BB := BlockBegin; - BE := BlockEnd; - // Set AnchorLine - if CaretXY >= BE then - begin - if BB.Line < Lines.Count then - BE := BufferCoord(1, BB.Line + 1) - else - BE := BufferCoord(Length(Lines[BB.Line - 1]), BB.Line); - end - else - begin - BB := BufferCoord(1, Max(1, IfThen(BE.Line < Lines.Count, BE.Line - 1, BE.Line))); - end; - if NewPos.Line < BB.Line then - begin - BB := BufferCoord(1, NewPos.Line); - NewPos := BB; - end - else if NewPos.Line >= BE.Line then - begin - if NewPos.Line < Lines.Count then - BE := BufferCoord(1, NewPos.Line + 1) - else - BE := BufferCoord(Length(Lines[NewPos.Line - 1]), NewPos.Line); - NewPos := BE; - end - else - NewPos := BE; - InternalCaretXY := NewPos; - if BB <> fBlockBegin then - BlockBegin := BB; - if BE <> fBlockEnd then - BlockEnd := BE; -end; - -procedure TCustomSynEdit.DoMouseSelectWordRange(NewPos: TBufferCoord); -{ Select whole words } -var - BB, BE: TBufferCoord; -begin - // Set Anchor Selection (Word) - BB := BlockBegin; - BE := BlockEnd; - if CaretXY > BB then - BE := WordEndEx(BB) - else - BB := WordStartEx(BE); - - NewPos.Char := Min(NewPos.Char, Lines[NewPos.Line-1].Length + 1); - if NewPos > BE then begin - BE := NewPos; - if (BE.Char > 1) and IsIdentChar(Lines[BE.Line-1][BE.Char - 1]) then - BE := WordEndEx(BE); - end else if NewPos < BB then begin - BB := BE; - BE := NewPos; - if (BE.Char < Lines[BE.Line-1].Length) and IsIdentChar(Lines[BE.Line-1][BE.Char]) then - BE := WordStartEx(BE); - end; - - if BB <> fBlockBegin then - BlockBegin := BB; - if BE <> fBlockEnd then - BlockEnd := BE; - InternalCaretXY := fBlockEnd; -end; - -procedure TCustomSynEdit.ExecCmdCopyOrMoveLine(const Command: TSynEditorCommand); -var - vCaretRow, SelShift: Integer; - Caret, BB, BE: TBufferCoord; - StartOfBlock, EndOfBlock: TBufferCoord; - Text: string; - OldSelectionMode: TSynSelectionMode; -begin - if not ReadOnly and - ((Command <> ecMoveLineUp) or (BlockBegin.Line > 1)) and - ((Command <> ecMoveLineDown) or (BlockEnd.Line < Lines.Count)) then - begin - // Get Caret and selection - Caret := CaretXY; - StartOfBlock := fBlockBegin; - EndOfBlock := fBlockEnd; - SelShift := Succ(Abs(fBlockEnd.Line - fBlockBegin.Line)); - - //BB and BE define where insertion of Text will take place - // SelShift is the number lines the Selection is shifted up or down - case Command of - ecCopyLineUp: - begin - BB := BufferCoord(1, BlockBegin.Line); - BE := BB; - SelShift := 0; - end; - ecMoveLineUp: - begin - BB := BufferCoord(1, Pred(BlockBegin.Line)); - if (fBlockBegin.Line <> fBlockEnd.Line) and (BlockEnd.Char = 1) then - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 2])), BlockEnd.Line - 1) - else - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line); - SelShift := -1; - end; - ecCopyLineDown: - begin - if (fBlockBegin.Line <> fBlockEnd.Line) and (BlockEnd.Char = 1) then begin - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 2])), BlockEnd.Line - 1); - Dec(SelShift); - end else - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line); - BB := BE; - end; - ecMoveLineDown: - begin - BB := BufferCoord(1, BlockBegin.Line); - if (fBlockBegin.Line <> fBlockEnd.Line) and (BlockEnd.Char = 1) then - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line) - else - BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line])), BlockEnd.Line + 1); - SelShift := 1; - end; - else - Exit; //should not happen - end; - // store the lines into Text - Text := ''; - for vCaretRow := BlockBegin.Line to BlockEnd.Line do - begin - if (vCaretRow = BlockEnd.Line) and - (fBlockBegin.Line <> fBlockEnd.Line) and (BlockEnd.Char = 1) - then - break; - if (Command = ecCopyLineDown) or (Command = ecMoveLineDown) then - Text := Text + SLineBreak + Lines[vCaretRow - 1] - else - Text := Text + Lines[vCaretRow - 1] + SLineBreak; - end; - // Add the line over which we move - if Command = ecMoveLineDown then - Text := Lines[BE.Line - 1] + Text - else if Command = ecMoveLineUp then - Text := Text + Lines[BB.Line-1]; - - // Deal with Selection modes - OldSelectionMode := ActiveSelectionMode; - ActiveSelectionMode := smNormal; - // group undo redo actions and reduce transient painting - DoOnPaintTransientEx(ttBefore, true); - BeginUndoBlock; - try - // Save caret and selection, so that they can be restored by undo - fUndoList.AddChange(crCaret, Caret, Caret, '', OldSelectionMode); - fUndoList.AddChange(crSelection, fBlockBegin, fBlockEnd, '', OldSelectionMode); - - // Insert/replace text at selection BB-BE - SetCaretAndSelection(BB, BB, BE); - SetSelText(Text); - - // Set as new selection the shifted old one - if SelShift <> 0 then - begin - Inc(Caret.Line, SelShift); - Inc(StartOfBlock.Line, SelShift); - Inc(EndOfBlock.Line, SelShift); - end; - SetCaretAndSelection(Caret, StartOfBlock, EndOfBlock); - // Save caret and selection, so that they can be restored by redo - fUndoList.AddChange(crSelection, fBlockBegin, fBlockEnd, '', OldSelectionMode); - fUndoList.AddChange(crCaret, Caret, Caret, '', OldSelectionMode); - // this does nothing but prevents undoing a subsequent Move Line down - // to be merged with this one - fUndoList.AddChange(crNothing, Caret, Caret, '', fActiveSelectionMode); - finally - EndUndoBlock; - DoOnPaintTransientEx(ttAfter, true); - end; - // Restore Selection mode - ActiveSelectionMode := OldSelectionMode; - end; -end; - -procedure TCustomSynEdit.ExecCmdDeleteLine; -var - OldSelectionMode: TSynSelectionMode; -begin - if not ReadOnly and (Lines.Count > 0) and not - ((BlockBegin.Line = Lines.Count) and (Length(Lines[BlockBegin.Line - 1]) = 0)) then - begin - DoOnPaintTransient(ttBefore); - // Deal with Selection modes - OldSelectionMode := ActiveSelectionMode; - ActiveSelectionMode := smNormal; - BeginUndoBlock; - try - // Save caret and selection, so that they can be restored by undo - fUndoList.AddChange(crCaret, CaretXY, CaretXY, '', OldSelectionMode); - fUndoList.AddChange(crSelection, fBlockBegin, fBlockEnd, '', OldSelectionMode); - // Nomalize selection - if fBlockBegin > fBlockEnd then - SetCaretAndSelection(BlockBegin, BlockBegin, BlockEnd); - fBlockBegin.Char := 1; - if (fBlockBegin.Line = fBlockEnd.Line) or (fBlockEnd.Char > 1) then - begin - if fBlockEnd.Line = Lines.Count then - fBlockEnd.Char := Length(Lines[fBlockEnd.Line - 1]) + 1 - else - fBlockEnd := BufferCoord(1, Succ(fBlockEnd.Line)); - end; - SetSelText(''); - SetCaretAndSelection(fBlockBegin, fBlockBegin, fBlockBegin); - // Save caret and selection, so that they can be restored by redo - fUndoList.AddChange(crSelection, fBlockBegin, fBlockEnd, '', OldSelectionMode); - fUndoList.AddChange(crCaret, fBlockBegin, fBlockBegin, '', OldSelectionMode); - fUndoList.AddChange(crNothing, fBlockBegin, fBlockBegin, '', fActiveSelectionMode); - finally - EndUndoBlock; - // Restore Selection mode - ActiveSelectionMode := OldSelectionMode; - end; - end; -end; - -procedure TCustomSynEdit.UncollapseAll; -var - i: Integer; -begin - if not fUseCodeFolding then Exit; - for i := fAllFoldRanges.Count - 1 downto 0 do - Uncollapse(i, False); - - InvalidateLines(-1, -1); - InvalidateGutterLines(-1, -1); - - EnsureCursorPosVisible; -end; - -//-- CodeFolding - -procedure TCustomSynEdit.Undo; - - procedure RemoveGroupBreak; - var - Item: TSynEditUndoItem; - OldBlockNumber: Integer; - begin - if fUndoList.LastChangeReason = crGroupBreak then - begin - OldBlockNumber := RedoList.BlockChangeNumber; - try - Item := fUndoList.PopItem; - RedoList.BlockChangeNumber := Item.ChangeNumber; - Item.Free; - fRedoList.AddGroupBreak; - finally - RedoList.BlockChangeNumber := OldBlockNumber; - end; - end; - end; - -var - Item: TSynEditUndoItem; - OldChangeNumber: integer; - SaveChangeNumber: integer; - FLastChange : TSynChangeReason; - FAutoComplete: Boolean; - FPasteAction: Boolean; - FSpecial: Boolean; - FKeepGoing: Boolean; -begin - if ReadOnly then - exit; - - RemoveGroupBreak; - - FLastChange := FUndoList.LastChangeReason; - FAutoComplete := FLastChange = crAutoCompleteEnd; - FPasteAction := FLastChange = crPasteEnd; - FSpecial := FLastChange = crSpecialEnd; - - Item := fUndoList.PeekItem; - if Item <> nil then - begin - OldChangeNumber := Item.ChangeNumber; - SaveChangeNumber := fRedoList.BlockChangeNumber; - fRedoList.BlockChangeNumber := Item.ChangeNumber; - - try - repeat - UndoItem; - Item := fUndoList.PeekItem; - if Item = nil then - FKeepGoing := False - else begin - if FAutoComplete then - FKeepGoing := (FUndoList.LastChangeReason <> crAutoCompleteBegin) - else if FPasteAction then - FKeepGoing := (FUndoList.LastChangeReason <> crPasteBegin) - else if FSpecial then - FKeepGoing := (FUndoList.LastChangeReason <> crSpecialBegin) - else if Item.ChangeNumber = OldChangeNumber then - FKeepGoing := True - else begin - FKeepGoing := ((eoGroupUndo in FOptions) and - (FLastChange = Item.ChangeReason) and - not(FLastChange in [crIndent, crUnindent])); - end; - FLastChange := Item.ChangeReason; - end; - until not(FKeepGoing); - - //we need to eat the last command since it does nothing and also update modified status... - if (FAutoComplete and (FUndoList.LastChangeReason = crAutoCompleteBegin)) or - (FPasteAction and (FUndoList.LastChangeReason = crPasteBegin)) or - (FSpecial and (FUndoList.LastChangeReason = crSpecialBegin)) then - begin - UndoItem; - UpdateModifiedStatus; - end; - - finally - fRedoList.BlockChangeNumber := SaveChangeNumber; - end; - end; -end; - -procedure TCustomSynEdit.UndoItem; -var - Item: TSynEditUndoItem; - TmpPos: TBufferCoord; - TmpStr: string; - ChangeScrollPastEol: Boolean; - BeginX: Integer; -begin - ChangeScrollPastEol := not (eoScrollPastEol in Options); - Item := fUndoList.PopItem; - if Assigned(Item) then - try - ActiveSelectionMode := Item.ChangeSelMode; - DoOnPaintTransientEx(ttBefore,true); - IncPaintLock; - Include(fOptions, eoScrollPastEol); - case Item.ChangeReason of - crCaret: - begin - fRedoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', fActiveSelectionMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crSelection: - begin - fRedoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', fActiveSelectionMode); - SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); - end; - crInsert: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TmpStr := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TmpStr, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crDelete, crSilentDelete, crDeleteAll: - begin - // If there's no selection, we have to set - // the Caret's position manualy. - if Item.ChangeSelMode = smColumn then - TmpPos := BufferCoord( - Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char), - Min(Item.ChangeStartPos.Line, Item.ChangeEndPos.Line)) - else - TmpPos := TBufferCoord(MinPoint( - TPoint(Item.ChangeStartPos), TPoint(Item.ChangeEndPos))); - if TmpPos.Line > Lines.Count then // not sure this could ever occur - begin - InternalCaretXY := BufferCoord(1, Lines.Count); - fLines.Add(''); - end; - CaretXY := TmpPos; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False ); - TmpPos := Item.ChangeEndPos; - if Item.ChangeReason = crSilentDelete then - SetCaretAndSelection(TmpPos, TmpPos, TmpPos) - else - SetCaretAndSelection(TmpPos, Item.ChangeStartPos, - Item.ChangeEndPos); - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, '', Item.ChangeSelMode); - if Item.ChangeReason = crDeleteAll then begin - InternalCaretXY := BufferCoord(1, 1); - fBlockEnd := BufferCoord(1, 1); - end; - EnsureCursorPosVisible; - end; - crLineBreak: - begin - // If there's no selection, we have to set - // the Caret's position manualy. - InternalCaretXY := Item.ChangeStartPos; - if CaretY > 0 then - begin - TmpStr := Lines.Strings[CaretY - 1]; - if (Length(TmpStr) < CaretX - 1) - and (LeftSpaces(Item.ChangeStr) = 0) - then - TmpStr := TmpStr + StringofChar(#32, CaretX - 1 - Length(TmpStr)); - ProperSetLine(CaretY - 1, TmpStr + Item.ChangeStr); - Lines.Delete(Item.ChangeEndPos.Line); - end - else - ProperSetLine(CaretY - 1, Item.ChangeStr); - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, '', Item.ChangeSelMode); - end; - crIndent: - begin - SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, - Item.ChangeEndPos); - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crUnindent: // reinsert the (raggered) column that was deleted - begin - // reinsert the string - if Item.ChangeSelMode <> smColumn then - InsertBlock(BufferCoord(1, Item.ChangeStartPos.Line), - BufferCoord(1, Item.ChangeEndPos.Line), - PWideChar(Item.ChangeStr), False) - else - begin - BeginX := Min( Item.ChangeStartPos.Char, Item.ChangeEndPos.Char ); - InsertBlock(BufferCoord(BeginX, Item.ChangeStartPos.Line), - BufferCoord(BeginX, Item.ChangeEndPos.Line), - PWideChar(Item.ChangeStr), False); - end; - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crWhiteSpaceAdd: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TmpStr := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), True); - InternalCaretXY := Item.ChangeStartPos; - end; - crNothing, crPasteBegin, crPasteEnd: - fRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - finally - if ChangeScrollPastEol then - Exclude(fOptions, eoScrollPastEol); - Item.Free; - DecPaintLock; - DoOnPaintTransientEx(ttAfter,true); - end; -end; - -procedure TCustomSynEdit.ClearBookMark(BookMark: Integer); -begin - if (BookMark in [0..9]) and assigned(fBookMarks[BookMark]) then - begin - DoOnClearBookmark(fBookMarks[BookMark]); - FMarkList.Remove(fBookMarks[Bookmark]); - fBookMarks[BookMark] := nil; - end -end; - -procedure TCustomSynEdit.GotoBookMark(BookMark: Integer); -var - iNewPos: TBufferCoord; -begin - if (BookMark in [0..9]) and - assigned(fBookMarks[BookMark]) and - (fBookMarks[BookMark].Line <= fLines.Count) - then - begin - iNewPos.Char := fBookMarks[BookMark].Char; - iNewPos.Line := fBookMarks[BookMark].Line; - //call it this way instead to make sure that the caret ends up in the middle - //if it is off screen (like Delphi does with bookmarks) - SetCaretXYEx(False, iNewPos); - EnsureCursorPosVisibleEx(True); - if SelAvail then - InvalidateSelection; - fBlockBegin.Char := fCaretX; - fBlockBegin.Line := fCaretY; - fBlockEnd := fBlockBegin; - end; -end; - -procedure TCustomSynEdit.GotoLineAndCenter(ALine: Integer); -begin - SetCaretXYEx( False, BufferCoord(1, ALine) ); - if SelAvail then - InvalidateSelection; - fBlockBegin.Char := fCaretX; - fBlockBegin.Line := fCaretY; - fBlockEnd := fBlockBegin; - EnsureCursorPosVisibleEx(True); -end; - -procedure TCustomSynEdit.SetBookMark(BookMark: Integer; X: Integer; Y: Integer); -var - mark: TSynEditMark; -begin - if (BookMark in [0..9]) and (Y >= 1) and (Y <= Max(1, fLines.Count)) then - begin - mark := TSynEditMark.Create(self); - with mark do - begin - Line := Y; - Char := X; - ImageIndex := Bookmark; - BookmarkNumber := Bookmark; - Visible := True; - InternalImage := (fBookMarkOpt.BookmarkImages = nil); - end; - DoOnPlaceMark(Mark); - if (mark <> nil) then - begin - if assigned(fBookMarks[BookMark]) then - ClearBookmark(BookMark); - fBookMarks[BookMark] := mark; - FMarkList.Add(fBookMarks[BookMark]); - end; - end; -end; - -procedure TCustomSynEdit.WndProc(var Msg: TMessage); -const - ALT_KEY_DOWN = $20000000; -begin - // Prevent Alt-Backspace from beeping - if (Msg.Msg = WM_SYSCHAR) and (Msg.wParam = VK_BACK) and - (Msg.lParam and ALT_KEY_DOWN <> 0) - then - Msg.Msg := 0; - - inherited; -end; - -procedure TCustomSynEdit.ChainListCleared(Sender: TObject); -begin - if Assigned(fChainListCleared) then - fChainListCleared(Sender); - TSynEditStringList(fOrigLines).OnCleared(Sender); -end; - -procedure TCustomSynEdit.ChainListDeleted(Sender: TObject; aIndex: Integer; - aCount: Integer); -begin - if Assigned(fChainListDeleted) then - fChainListDeleted(Sender, aIndex, aCount); - TSynEditStringList(fOrigLines).OnDeleted(Sender, aIndex, aCount); -end; - -procedure TCustomSynEdit.ChainListInserted(Sender: TObject; aIndex: Integer; - aCount: Integer); -begin - if Assigned(fChainListInserted) then - fChainListInserted(Sender, aIndex, aCount); - TSynEditStringList(fOrigLines).OnInserted(Sender, aIndex, aCount); -end; - -procedure TCustomSynEdit.ChainListPutted(Sender: TObject; aIndex: Integer; - aCount: Integer); -begin - if Assigned(fChainListPutted) then - fChainListPutted(Sender, aIndex, aCount); - TSynEditStringList(fOrigLines).OnPutted(Sender, aIndex, aCount); -end; - -procedure TCustomSynEdit.ChainLinesChanging(Sender: TObject); -begin - if Assigned(fChainLinesChanging) then - fChainLinesChanging(Sender); - TSynEditStringList(fOrigLines).OnChanging(Sender); -end; - -procedure TCustomSynEdit.ChainLinesChanged(Sender: TObject); -begin - if Assigned(fChainLinesChanged) then - fChainLinesChanged(Sender); - TSynEditStringList(fOrigLines).OnChange(Sender); -end; - -procedure TCustomSynEdit.ChainUndoRedoAdded(Sender: TObject); -var - iList: TSynEditUndoList; - iHandler: TNotifyEvent; -begin - if Sender = fUndoList then - begin - iList := fOrigUndoList; - iHandler := fChainUndoAdded; - end - else { if Sender = fRedoList then } - begin - iList := fOrigRedoList; - iHandler := fChainRedoAdded; - end; - if Assigned(iHandler) then - iHandler(Sender); - iList.OnAddedUndo(Sender); -end; - -//++ DPI-Aware -procedure TCustomSynEdit.ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$endif}); -begin - {$if CompilerVersion >= 31}if isDpiChange then begin{$endif} - fGutter.ChangeScale(M,D); - CodeFolding.ChangeScale(M, D); - fBookMarkOpt.ChangeScale(M, D); - fWordWrapGlyph.ChangeScale(M, D); - if Assigned(fInternalImage) then fInternalImage.ChangeScale(M, D); - {$if CompilerVersion >= 31}end;{$endif} - inherited ChangeScale(M, D{$if CompilerVersion >= 31}, isDpiChange{$endif}); - end; -//-- DPI-Aware - -procedure TCustomSynEdit.UnHookTextBuffer; -var - vOldWrap: Boolean; -begin - Assert(fChainedEditor = nil); - if fLines = fOrigLines then - Exit; - - vOldWrap := WordWrap; - WordWrap := False; - - //first put back the real methods - with TSynEditStringList(fLines) do - begin - OnCleared := fChainListCleared; - OnDeleted := fChainListDeleted; - OnInserted := fChainListInserted; - OnPutted := fChainListPutted; - OnChanging := fChainLinesChanging; - OnChange := fChainLinesChanged; - end; - fUndoList.OnAddedUndo := fChainUndoAdded; - fRedoList.OnAddedUndo := fChainRedoAdded; - - fChainListCleared := nil; - fChainListDeleted := nil; - fChainListInserted := nil; - fChainListPutted := nil; - fChainLinesChanging := nil; - fChainLinesChanged := nil; - fChainUndoAdded := nil; - - //make the switch - fLines := fOrigLines; - fUndoList := fOrigUndoList; - fRedoList := fOrigRedoList; - LinesHookChanged; - - WordWrap := vOldWrap; -end; - -procedure TCustomSynEdit.HookTextBuffer(aBuffer: TSynEditStringList; - aUndo, aRedo: TSynEditUndoList); -var - vOldWrap: Boolean; -begin - Assert(fChainedEditor = nil); - Assert(fLines = fOrigLines); - - vOldWrap := WordWrap; - WordWrap := False; - - if fChainedEditor <> nil then - RemoveLinesPointer - else if fLines <> fOrigLines then - UnHookTextBuffer; - - //store the current values and put in the chained methods - fChainListCleared := aBuffer.OnCleared; - aBuffer.OnCleared := ChainListCleared; - fChainListDeleted := aBuffer.OnDeleted; - aBuffer.OnDeleted := ChainListDeleted; - fChainListInserted := aBuffer.OnInserted; - aBuffer.OnInserted := ChainListInserted; - fChainListPutted := aBuffer.OnPutted; - aBuffer.OnPutted := ChainListPutted; - fChainLinesChanging := aBuffer.OnChanging; - aBuffer.OnChanging := ChainLinesChanging; - fChainLinesChanged := aBuffer.OnChange; - aBuffer.OnChange := ChainLinesChanged; - - fChainUndoAdded := aUndo.OnAddedUndo; - aUndo.OnAddedUndo := ChainUndoRedoAdded; - fChainRedoAdded := aRedo.OnAddedUndo; - aRedo.OnAddedUndo := ChainUndoRedoAdded; - - //make the switch - fLines := aBuffer; - fUndoList := aUndo; - fRedoList := aRedo; - LinesHookChanged; - - WordWrap := vOldWrap; -end; - -procedure TCustomSynEdit.LinesHookChanged; -begin - Invalidate; - UpdateScrollBars; -end; - -procedure TCustomSynEdit.SetLinesPointer(ASynEdit: TCustomSynEdit); -begin - HookTextBuffer(TSynEditStringList(ASynEdit.Lines), - ASynEdit.UndoList, ASynEdit.RedoList); - - fChainedEditor := ASynEdit; - ASynEdit.FreeNotification(Self); -end; - -procedure TCustomSynEdit.RemoveLinesPointer; -begin - if Assigned(fChainedEditor) then - RemoveFreeNotification(fChainedEditor); - fChainedEditor := nil; - - UnHookTextBuffer; -end; - -procedure TCustomSynEdit.SetRightEdge(Value: Integer); -begin - if fRightEdge <> Value then - begin - fRightEdge := Value; - Invalidate; - end; -end; - -procedure TCustomSynEdit.SetRightEdgeColor(Value: TColor); -var - nX: Integer; - rcInval: TRect; -begin - if fRightEdgeColor <> Value then - begin - fRightEdgeColor := Value; - if HandleAllocated then - begin - nX := fTextOffset + fRightEdge * fCharWidth; - rcInval := Rect(nX - 1, 0, nX + 1, Height); - InvalidateRect(rcInval, False); - end; - end; -end; - -function TCustomSynEdit.GetMaxUndo: Integer; -begin - result := fUndoList.MaxUndoActions; -end; - -procedure TCustomSynEdit.SetMaxUndo(const Value: Integer); -begin - if Value > -1 then - begin - fUndoList.MaxUndoActions := Value; - fRedoList.MaxUndoActions := Value; - end; -end; - -procedure TCustomSynEdit.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited Notification(AComponent, Operation); - if Operation = opRemove then - begin - if AComponent = fSearchEngine then - begin - SearchEngine := nil; - end; - - if AComponent = fHighlighter then - begin - Highlighter := nil; - end; - - if AComponent = fChainedEditor then - begin - RemoveLinesPointer; - end; - - if (fBookmarkOpt <> nil) then - if (AComponent = fBookmarkOpt.BookmarkImages) then - begin - fBookmarkOpt.BookmarkImages := nil; - InvalidateGutterLines(-1, -1); - end; - end; -end; - -procedure TCustomSynEdit.SetHighlighter(const Value: TSynCustomHighlighter); -//++ CodeFolding -Var - OldUseCodeFolding : Boolean; -//-- CodeFolding -begin - if Value <> fHighlighter then - begin - if Assigned(fHighlighter) then - begin - fHighlighter.UnhookAttrChangeEvent(HighlighterAttrChanged); - fHighlighter.RemoveFreeNotification(Self); - end; - if Assigned(Value) then - begin - Value.HookAttrChangeEvent(HighlighterAttrChanged); - Value.FreeNotification(Self); - end; - fHighlighter := Value; - if not(csDestroying in ComponentState) then - HighlighterAttrChanged(fHighlighter); - -//++ CodeFolding - // Disable Code Folding if not supported by highlighter - OldUseCodeFolding := fUseCodeFolding; - UseCodeFolding := False; - UseCodeFolding := OldUseCodeFolding; - if fHighlighter is TSynCustomCodeFoldingHighlighter then - TSynCustomCodeFoldingHighlighter(fHighlighter).InitFoldRanges(fAllFoldRanges); -//-- CodeFolding - end; -end; - -procedure TCustomSynEdit.SetBorderStyle(Value: TSynBorderStyle); -begin - if fBorderStyle <> Value then - begin - fBorderStyle := Value; - RecreateWnd; - end; -end; - -procedure TCustomSynEdit.SetHideSelection(const Value: Boolean); -begin - if fHideSelection <> Value then - begin - FHideSelection := Value; - InvalidateSelection; - end; -end; - -procedure TCustomSynEdit.SetInsertMode(const Value: Boolean); -begin - if fInserting <> Value then - begin - fInserting := Value; - if not (csDesigning in ComponentState) then - // Reset the caret. - InitializeCaret; - StatusChanged([scInsertMode]); - end; -end; - -procedure TCustomSynEdit.InitializeCaret; -var - ct: TSynEditCaretType; - cw, ch: Integer; -begin - // CreateCaret automatically destroys the previous one, so we don't have to - // worry about cleaning up the old one here with DestroyCaret. - // Ideally, we will have properties that control what these two carets look like. - if InsertMode then - ct := FInsertCaret - else - ct := FOverwriteCaret; - case ct of - ctHorizontalLine: - begin - cw := fCharWidth; - ch := 2; - FCaretOffset := Point(0, fTextHeight - 2); - end; - ctHalfBlock: - begin - cw := fCharWidth; - ch := (fTextHeight - 2) div 2; - FCaretOffset := Point(0, ch); - end; - ctBlock: - begin - cw := fCharWidth; - ch := fTextHeight - 2; - FCaretOffset := Point(0, 0); - end; - else - begin // ctVerticalLine - cw := 2; - ch := fTextHeight - 2; - FCaretOffset := Point(-1, 0); - end; - end; - Exclude(fStateFlags, sfCaretVisible); - - if Focused or FAlwaysShowCaret then - begin - CreateCaret(Handle, 0, cw, ch); - UpdateCaret; - end; -end; - -procedure TCustomSynEdit.SetInsertCaret(const Value: TSynEditCaretType); -begin - if FInsertCaret <> Value then - begin - FInsertCaret := Value; - InitializeCaret; - end; -end; - -procedure TCustomSynEdit.SetOverwriteCaret(const Value: TSynEditCaretType); -begin - if FOverwriteCaret <> Value then - begin - FOverwriteCaret := Value; - InitializeCaret; - end; -end; - -procedure TCustomSynEdit.EnsureCursorPosVisible; -begin - EnsureCursorPosVisibleEx(False); -end; - -procedure TCustomSynEdit.EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; - EvenIfVisible: Boolean = False); -var - TmpMiddle: Integer; - VisibleX: Integer; - vCaretRow: Integer; -begin - HandleNeeded; - IncPaintLock; - try - // Make sure X is visible - VisibleX := DisplayX; - if VisibleX < LeftChar then - LeftChar := VisibleX - else if VisibleX >= CharsInWindow + LeftChar then - LeftChar := VisibleX - CharsInWindow + 1 - else - LeftChar := LeftChar; - - // Make sure Y is visible - vCaretRow := DisplayY; - if ForceToMiddle then - begin - if vCaretRow < (TopLine - 1) then - begin - TmpMiddle := LinesInWindow div 2; - if vCaretRow - TmpMiddle < 0 then - TopLine := 1 - else - TopLine := vCaretRow - TmpMiddle + 1; - end - else if vCaretRow > (TopLine + (LinesInWindow - 2)) then - begin - TmpMiddle := LinesInWindow div 2; - TopLine := vCaretRow - (LinesInWindow - 1) + TmpMiddle; - end - { Forces to middle even if visible in viewport } - else if EvenIfVisible then - begin - TmpMiddle := fLinesInWindow div 2; - TopLine := vCaretRow - TmpMiddle + 1; - end; - end - else begin - if vCaretRow < TopLine then - TopLine := vCaretRow - else if vCaretRow > TopLine + Max(1, LinesInWindow) - 1 then - TopLine := vCaretRow - (LinesInWindow - 1) - else - TopLine := TopLine; - end; - finally - DecPaintLock; - end; -end; - -procedure TCustomSynEdit.SetKeystrokes(const Value: TSynEditKeyStrokes); -begin - if Value = nil then - FKeystrokes.Clear - else - FKeystrokes.Assign(Value); -end; - -procedure TCustomSynEdit.SetDefaultKeystrokes; -begin - FKeystrokes.ResetDefaults; -end; - -// If the translations requires Data, memory will be allocated for it via a -// GetMem call. The client must call FreeMem on Data if it is not NIL. - -function TCustomSynEdit.TranslateKeyCode(Code: word; Shift: TShiftState; - var Data: pointer): TSynEditorCommand; -var - i: Integer; -begin - i := KeyStrokes.FindKeycode2(fLastKey, fLastShiftState, Code, Shift); - if i >= 0 then - Result := KeyStrokes[i].Command - else begin - i := Keystrokes.FindKeycode(Code, Shift); - if i >= 0 then - Result := Keystrokes[i].Command - else - Result := ecNone; - end; - if (Result = ecNone) and (Code >= VK_ACCEPT) and (Code <= VK_SCROLL) then - begin - fLastKey := Code; - fLastShiftState := Shift; - end - else - begin - fLastKey := 0; - fLastShiftState := []; - end; -end; - -procedure TCustomSynEdit.TripleClick; -Var - BB, BE : TBufferCoord; -begin - if not (eoNoSelection in fOptions) then - begin - BB := BufferCoord(1, CaretY); - if CaretY < Lines.Count then - BE := BufferCoord(1, CaretY + 1) - else - BE := BufferCoord(Length(Lines[CaretY-1]) + 1, CaretY); - SetCaretAndSelection(BE, BB, BE); - end; - if Assigned(fOnTripleClick) then - fOnTripleClick(Self); -end; - -procedure TCustomSynEdit.CommandProcessor(Command: TSynEditorCommand; - AChar: WideChar; Data: pointer); -begin - // first the program event handler gets a chance to process the command - DoOnProcessCommand(Command, AChar, Data); - if Command <> ecNone then - begin - // notify hooked command handlers before the command is executed inside of - // the class - NotifyHookedCommandHandlers(False, Command, AChar, Data); - // internal command handler - if (Command <> ecNone) and (Command < ecUserFirst) then - ExecuteCommand(Command, AChar, Data); - // notify hooked command handlers after the command was executed inside of - // the class - if Command <> ecNone then - NotifyHookedCommandHandlers(True, Command, AChar, Data); - end; - DoOnCommandProcessed(Command, AChar, Data); -end; - -procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; - Data: pointer); -var - CX: Integer; - Len: Integer; - Temp: string; - Temp2: string; - Helper: string; - TabBuffer: string; - SpaceBuffer: string; - SpaceCount1: Integer; - SpaceCount2: Integer; - BackCounter: Integer; - StartOfBlock: TBufferCoord; - EndOfBlock: TBufferCoord; - bChangeScroll: Boolean; - moveBkm: Boolean; - WP: TBufferCoord; - Caret: TBufferCoord; - CaretNew: TBufferCoord; - counter: Integer; - vCaretRow: Integer; - s: string; - i: Integer; -begin - IncPaintLock; - try - case Command of -// horizontal caret movement or selection - ecLeft, ecSelLeft: - MoveCaretHorz(-1, Command = ecSelLeft); - ecRight, ecSelRight: - MoveCaretHorz(1, Command = ecSelRight); - ecPageLeft, ecSelPageLeft: - MoveCaretHorz(-CharsInWindow, Command = ecSelPageLeft); - ecPageRight, ecSelPageRight: - MoveCaretHorz(CharsInWindow, Command = ecSelPageRight); - ecLineStart, ecSelLineStart: - begin - DoHomeKey(Command = ecSelLineStart); - end; - ecLineEnd, ecSelLineEnd: - DoEndKey(Command = ecSelLineEnd); -// vertical caret movement or selection - ecUp, ecSelUp: - begin - MoveCaretVert(-1, Command = ecSelUp); - Update; - end; - ecDown, ecSelDown: - begin - MoveCaretVert(1, Command = ecSelDown); - Update; - end; - ecPageUp, ecSelPageUp, ecPageDown, ecSelPageDown: - begin - counter := fLinesInWindow shr Ord(eoHalfPageScroll in fOptions); - if eoScrollByOneLess in fOptions then - Dec(counter); - if (Command in [ecPageUp, ecSelPageUp]) then - counter := -counter; - TopLine := TopLine + counter; - MoveCaretVert(counter, Command in [ecSelPageUp, ecSelPageDown]); - Update; - end; - ecPageTop, ecSelPageTop: - begin - CaretNew := DisplayToBufferPos( - DisplayCoord(DisplayX, TopLine) ); - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageTop); - Update; - end; - ecPageBottom, ecSelPageBottom: - begin - CaretNew := DisplayToBufferPos( - DisplayCoord(DisplayX, TopLine + LinesInWindow -1) ); - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageBottom); - Update; - end; - ecEditorTop, ecSelEditorTop: - begin - CaretNew.Char := 1; - CaretNew.Line := 1; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorTop); - Update; - end; - ecEditorBottom, ecSelEditorBottom: - begin - CaretNew.Char := 1; - CaretNew.Line := Lines.Count; - if (CaretNew.Line > 0) then - CaretNew.Char := Length(Lines[CaretNew.Line - 1]) + 1; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorBottom); - Update; - end; -// goto special line / column position - ecGotoXY, ecSelGotoXY: - if Assigned(Data) then - begin - MoveCaretAndSelection(CaretXY, TBufferCoord(Data^), Command = ecSelGotoXY); - Update; - end; -// word selection - ecWordLeft, ecSelWordLeft: - begin - CaretNew := PrevWordPos; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordLeft); - end; - ecWordRight, ecSelWordRight: - begin - CaretNew := NextWordPos; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordRight); - end; - ecSelWord: - begin - SetSelWord; - end; - ecSelectAll: - begin - SelectAll; - end; - ecDeleteLastChar: - if not ReadOnly then begin - DoOnPaintTransientEx(ttBefore,true); - try - if SelAvail then - SetSelText('') - else begin - Temp := LineText; - TabBuffer := TSynEditStringList(Lines).ExpandedStrings[CaretY - 1]; - Len := Length(Temp); - Caret := CaretXY; - if CaretX > Len + 1 then - begin - Helper := ''; - if eoSmartTabDelete in fOptions then - begin - //It's at the end of the line, move it to the length - if Len > 0 then - InternalCaretX := Len + 1 - else begin - //move it as if there were normal spaces there - SpaceCount1 := CaretX - 1; - SpaceCount2 := 0; - // unindent - if SpaceCount1 > 0 then - begin - BackCounter := CaretY - 2; - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpaces(Lines[BackCounter]); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - break; - Dec(BackCounter); - end; - if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then - SpaceCount2 := 0; - end; - if SpaceCount2 = SpaceCount1 then - SpaceCount2 := 0; - fCaretX := fCaretX - (SpaceCount1 - SpaceCount2); - UpdateLastCaretX; - fStateFlags := fStateFlags + [sfCaretChanged]; - StatusChanged([scCaretX]); - end; - end - else begin - // only move caret one column - InternalCaretX := CaretX - 1; - end; - end else if CaretX = 1 then begin - // join this line with the last line if possible - if CaretY > 1 then - begin - InternalCaretY := CaretY - 1; - InternalCaretX := Length(Lines[CaretY - 1]) + 1; - Lines.Delete(CaretY); - - LineText := LineText + Temp; - Helper := #13#10; - end; - end - else begin - // delete text before the caret - SpaceCount1 := LeftSpaces(Temp); - SpaceCount2 := 0; - if (Temp[CaretX - 1] <= #32) and (SpaceCount1 = CaretX - 1) then - begin - if eoSmartTabDelete in fOptions then - begin - // unindent - if SpaceCount1 > 0 then - begin - BackCounter := CaretY - 2; - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpaces(Lines[BackCounter]); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - break; - Dec(BackCounter); - end; - if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then - SpaceCount2 := 0; - end; - if SpaceCount2 = SpaceCount1 then - SpaceCount2 := 0; - Helper := Copy(Temp, 1, SpaceCount1 - SpaceCount2); - Delete(Temp, 1, SpaceCount1 - SpaceCount2); - end - else begin - SpaceCount2 := SpaceCount1; - //how much till the next tab column - BackCounter := (DisplayX - 1) mod FTabWidth; - if BackCounter = 0 then BackCounter := FTabWidth; - - SpaceCount1 := 0; - CX := DisplayX - BackCounter; - while (SpaceCount1 < FTabWidth) and - (SpaceCount1 < BackCounter) and - (TabBuffer[CX] <> #9) do - begin - Inc(SpaceCount1); - Inc(CX); - end; - {$IFOPT R+} - // Avoids an exception when compiled with $R+. - // 'CX' can be 'Length(TabBuffer)+1', which isn't an AV and evaluates - //to #0. But when compiled with $R+, Delphi raises an Exception. - if CX <= Length(TabBuffer) then - {$ENDIF} - if TabBuffer[CX] = #9 then - SpaceCount1 := SpaceCount1 + 1; - - if SpaceCount2 = SpaceCount1 then - begin - Helper := Copy(Temp, 1, SpaceCount1); - Delete(Temp, 1, SpaceCount1); - end - else begin - Helper := Copy(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); - Delete(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); - end; - SpaceCount2 := 0; - end; - fCaretX := fCaretX - (SpaceCount1 - SpaceCount2); - UpdateLastCaretX; - // Stores the previous "expanded" CaretX if the line contains tabs. - Lines[CaretY - 1] := Temp; - fStateFlags := fStateFlags + [sfCaretChanged]; - StatusChanged([scCaretX]); - end - else begin - // delete char - counter := 1; - InternalCaretX := CaretX - counter; - // Stores the previous "expanded" CaretX if the line contains tabs. - Helper := Copy(Temp, CaretX, counter); - Delete(Temp, CaretX, counter); - Lines[CaretY - 1] := Temp; - end; - end; - if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then - begin - fUndoList.AddChange(crSilentDelete, CaretXY, Caret, Helper, - smNormal); - end; - end; - EnsureCursorPosVisible; - finally - DoOnPaintTransientEx(ttAfter,true); - end; - end; - ecDeleteChar: - if not ReadOnly then begin - DoOnPaintTransient(ttBefore); - - if SelAvail then - SetSelText('') - else begin - // Call UpdateLastCaretX. Even though the caret doesn't move, the - // current caret position should "stick" whenever text is modified. - UpdateLastCaretX; - Temp := LineText; - Len := Length(Temp); - if CaretX <= Len then - begin - // delete char - counter := 1; - Helper := Copy(Temp, CaretX, counter); - Caret.Char := CaretX + counter; - Caret.Line := CaretY; - Delete(Temp, CaretX, counter); - Lines[CaretY - 1] := Temp; - end - else begin - // join line with the line after - if CaretY < Lines.Count then - begin - Helper := StringofChar(#32, CaretX - 1 - Len); - Lines[CaretY - 1] := Temp + Helper + Lines[CaretY]; - Caret.Char := 1; - Caret.Line := CaretY + 1; - Helper := #13#10; - Lines.Delete(CaretY); - end; - end; - if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then - begin - fUndoList.AddChange(crSilentDelete, Caret, CaretXY, - Helper, smNormal); - end; - end; - DoOnPaintTransient(ttAfter); - end; - ecDeleteWord, ecDeleteEOL: - if not ReadOnly then begin - DoOnPaintTransient(ttBefore); - Len := Length(LineText); - if Command = ecDeleteWord then - begin - WP := WordEnd; - Temp := LineText; - if (WP.Char < CaretX) or ((WP.Char = CaretX) and (WP.Line < fLines.Count)) then - begin - if WP.Char > Len then - begin - Inc(WP.Line); - WP.Char := 1; - Temp := Lines[WP.Line - 1]; - end - else if Temp[WP.Char] <> #32 then - Inc(WP.Char); - end; - end - else begin - WP.Char := Len + 1; - WP.Line := CaretY; - end; - if (WP.Char <> CaretX) or (WP.Line <> CaretY) then - begin - SetBlockBegin(WP); - SetBlockEnd(CaretXY); - ActiveSelectionMode := smNormal; - SetSelTextPrimitiveEx(ActiveSelectionMode, '', True, True); - InternalCaretXY := CaretXY; - end; - end; - ecDeleteLastWord, ecDeleteBOL: - if not ReadOnly then begin - DoOnPaintTransient(ttBefore); - if Command = ecDeleteLastWord then - WP := PrevWordPos - else begin - WP.Char := 1; - WP.Line := CaretY; - end; - if (WP.Char <> CaretX) or (WP.Line <> CaretY) then - begin - SetBlockBegin(WP); - SetBlockEnd(CaretXY); - ActiveSelectionMode := smNormal; - SetSelTextPrimitiveEx(ActiveSelectionMode, '', True, True); - InternalCaretXY := WP; - end; - DoOnPaintTransient(ttAfter); - end; - ecDeleteLine: - ExecCmdDeleteLine; - ecClearAll: - begin - if not ReadOnly then ClearAll; - end; - ecInsertLine, - ecLineBreak: - if not ReadOnly then begin - UndoList.BeginBlock; - try - if SelAvail then - SetSelText(''); - Temp := LineText; - Temp2 := Temp; - // This is sloppy, but the Right Thing would be to track the column of markers - // too, so they could be moved depending on whether they are after the caret... - Len := Length(Temp); - if Len > 0 then - begin - if Len >= CaretX then - begin - if CaretX > 1 then - begin - Temp := Copy(LineText, 1, CaretX - 1); - SpaceCount1 := LeftSpacesEx(Temp,true); - Delete(Temp2, 1, CaretX - 1); - Lines.Insert(CaretY, GetLeftSpacing(SpaceCount1, True) + Temp2); - Lines[CaretY - 1] := Temp; - fUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, - smNormal); - if Command = ecLineBreak then - InternalCaretXY := BufferCoord( - Length(GetLeftSpacing(SpaceCount1,true)) + 1, - CaretY + 1); - end - else begin - Lines.Insert(CaretY - 1, ''); - fUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, - smNormal); - if Command = ecLineBreak then - InternalCaretY := CaretY + 1; - end; - end - else begin - SpaceCount2 := 0; - BackCounter := CaretY; - if eoAutoIndent in Options then - begin - repeat - Dec(BackCounter); - Temp := Lines[BackCounter]; - SpaceCount2 := LeftSpaces(Temp); - until (BackCounter = 0) or (Temp <> ''); - end; - Lines.Insert(CaretY, ''); - Caret := CaretXY; - - fUndoList.AddChange(crLineBreak, Caret, Caret, '', smNormal); //KV - if Command = ecLineBreak then - begin - if SpaceCount2 > 0 then - SpaceBuffer := Copy(Lines[BackCounter], 1, SpaceCount2); - InternalCaretXY := BufferCoord(1, CaretY +1); - if SpaceCount2 > 0 then - begin - for i := 1 to Length(SpaceBuffer) do - if SpaceBuffer[i] = #9 then - CommandProcessor(ecTab, #0, nil) - else - CommandProcessor(ecChar, SpaceBuffer[i], nil); - end; - end; - end; - end - else begin - if fLines.Count = 0 then - fLines.Add(''); - SpaceCount2 := 0; - if eoAutoIndent in Options then - begin - BackCounter := CaretY - 1; - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpacesEx(Lines[BackCounter],True); - if Length(Lines[BackCounter]) > 0 then break; - dec(BackCounter); - end; - end; - Lines.Insert(CaretY - 1, ''); - fUndoList.AddChange(crLineBreak, CaretXY, CaretXY, '', smNormal); - if Command = ecLineBreak then - InternalCaretX := SpaceCount2 + 1; - if Command = ecLineBreak then - InternalCaretY := CaretY + 1; - end; - BlockBegin := CaretXY; - BlockEnd := CaretXY; - EnsureCursorPosVisible; - UpdateLastCaretX; - finally - UndoList.EndBlock; - end; - end; - ecTab: - if not ReadOnly then DoTabKey; - ecShiftTab: - if not ReadOnly then DoShiftTabKey; - ecMatchBracket: - FindMatchingBracket; - ecChar: - // #127 is Ctrl + Backspace, #32 is space - if not ReadOnly and (AChar >= #32) and (AChar <> #127) then - begin - if SelAvail then - SetSelText(AChar) - else - begin - SpaceCount2 := 0; - Temp := LineText; - Len := Length(Temp); - if Len < CaretX then - begin - if (Len > 0) then - SpaceBuffer := StringofChar(#32, CaretX - Len - Ord(fInserting)) - else - SpaceBuffer := GetLeftSpacing(CaretX - Len - Ord(fInserting), True); - SpaceCount2 := Length(SpaceBuffer); - - Temp := Temp + SpaceBuffer; - end; - // Added the check for whether or not we're in insert mode. - // If we are, we append one less space than we would in overwrite mode. - // This is because in overwrite mode we have to put in a final space - // character which will be overwritten with the typed character. If we put the - // extra space in in insert mode, it would be left at the end of the line and - // cause problems unless eoTrimTrailingSpaces is set. - bChangeScroll := not (eoScrollPastEol in fOptions); - try - if bChangeScroll then Include(fOptions, eoScrollPastEol); - StartOfBlock := CaretXY; - - if fInserting then - begin - Insert(AChar, Temp, CaretX); - if Len = 0 then - InternalCaretX := Length(Temp) + 1 - else - InternalCaretX := CaretX + 1; - Lines[CaretY - 1] := Temp; - if SpaceCount2 > 0 then - begin - BeginUndoBlock; - try - //if we inserted spaces with this char, we need to account for those - //in the X Position - StartOfBlock.Char := StartOfBlock.Char - SpaceCount2; - EndOfBlock := CaretXY; - EndOfBlock.Char := EndOfBlock.Char - 1; - //The added whitespace - fUndoList.AddChange(crWhiteSpaceAdd, EndOfBlock, StartOfBlock, '', - smNormal); - StartOfBlock.Char := StartOfBlock.Char + SpaceCount2; - - fUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', - smNormal); - finally - EndUndoBlock; - end; - end - else begin - fUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', - smNormal); - end; - end - else begin - // Processing of case character covers on LeadByte. - counter := 1; - Helper := Copy(Temp, CaretX, counter); - Temp[CaretX] := AChar; - CaretNew.Char := CaretX + counter; - CaretNew.Line := CaretY; - Lines[CaretY - 1] := Temp; - fUndoList.AddChange(crInsert, StartOfBlock, CaretNew, Helper, - smNormal); - InternalCaretX := CaretX + 1; - end; - if CaretX >= LeftChar + fCharsInWindow then - LeftChar := LeftChar + Min(25, fCharsInWindow - 1); - finally - if bChangeScroll then Exclude(fOptions, eoScrollPastEol); - end; - end; - DoOnPaintTransient(ttAfter); - end; - ecUpperCase, - ecLowerCase, - ecToggleCase, - ecTitleCase: - ExecCmdCaseChange(Command); - ecUndo: - begin - if not ReadOnly then Undo; - end; - ecRedo: - begin - if not ReadOnly then Redo; - end; - ecGotoMarker0..ecGotoMarker9: - begin - if BookMarkOptions.EnableKeys then - GotoBookMark(Command - ecGotoMarker0); - end; - ecSetMarker0..ecSetMarker9: - begin - if BookMarkOptions.EnableKeys then - begin - CX := Command - ecSetMarker0; - if Assigned(Data) then - Caret := TBufferCoord(Data^) - else - Caret := CaretXY; - if assigned(fBookMarks[CX]) then - begin - moveBkm := (fBookMarks[CX].Line <> Caret.Line); - ClearBookMark(CX); - if moveBkm then - SetBookMark(CX, Caret.Char, Caret.Line); - end - else - SetBookMark(CX, Caret.Char, Caret.Line); - end; // if BookMarkOptions.EnableKeys - end; - ecCut: - begin - if (not ReadOnly) and SelAvail then - CutToClipboard; - end; - ecCopy: - begin - CopyToClipboard; - end; - ecPaste: - begin - if not ReadOnly then PasteFromClipboard; - end; - ecScrollUp, ecScrollDown: - begin - vCaretRow := DisplayY; - if (vCaretRow < TopLine) or (vCaretRow >= TopLine + LinesInWindow) then - // If the caret is not in view then, like the Delphi editor, move - // it in view and do nothing else - EnsureCursorPosVisible - else begin - if Command = ecScrollUp then - begin - TopLine := TopLine - 1; - if vCaretRow > TopLine + LinesInWindow - 1 then - MoveCaretVert((TopLine + LinesInWindow - 1) - vCaretRow, False); - end - else begin - TopLine := TopLine + 1; - if vCaretRow < TopLine then - MoveCaretVert(TopLine - vCaretRow, False); - end; - EnsureCursorPosVisible; - Update; - end; - end; - ecScrollLeft: - begin - LeftChar := LeftChar - 1; - // todo: The following code was commented out because it is not MBCS or hard-tab safe. - //if CaretX > LeftChar + CharsInWindow then - // InternalCaretX := LeftChar + CharsInWindow; - Update; - end; - ecScrollRight: - begin - LeftChar := LeftChar + 1; - // todo: The following code was commented out because it is not MBCS or hard-tab safe. - //if CaretX < LeftChar then - // InternalCaretX := LeftChar; - Update; - end; - ecInsertMode: - begin - InsertMode := True; - end; - ecOverwriteMode: - begin - InsertMode := False; - end; - ecToggleMode: - begin - InsertMode := not InsertMode; - end; - ecBlockIndent: - if not ReadOnly then DoBlockIndent; - ecBlockUnindent: - if not ReadOnly then DoBlockUnindent; - ecNormalSelect: - SelectionMode := smNormal; - ecColumnSelect: - SelectionMode := smColumn; - ecLineSelect: - SelectionMode := smLine; - ecContextHelp: - begin - if Assigned (fOnContextHelp) then - fOnContextHelp (self,WordAtCursor); - end; - ecImeStr: - if not ReadOnly then - begin - S := PWideChar(Data); - if SelAvail then - begin - SetSelText(s); - InvalidateGutterLines(-1, -1); - end - else - begin - Temp := LineText; - Len := Length(Temp); - if Len < CaretX then - Temp := Temp + StringofChar(#32, CaretX - Len - 1); - bChangeScroll := not (eoScrollPastEol in fOptions); - try - if bChangeScroll then Include(fOptions, eoScrollPastEol); - StartOfBlock := CaretXY; - Len := Length(s); - if not fInserting then - begin - Helper := Copy(Temp, CaretX, Len); - Delete(Temp, CaretX, Len); - end; - Insert(s, Temp, CaretX); - InternalCaretX := (CaretX + Len); - Lines[CaretY - 1] := Temp; - if fInserting then - Helper := ''; - fUndoList.AddChange(crInsert, StartOfBlock, CaretXY, Helper, - smNormal); - if CaretX >= LeftChar + fCharsInWindow then - LeftChar := LeftChar + min(25, fCharsInWindow - 1); - finally - if bChangeScroll then Exclude(fOptions, eoScrollPastEol); - end; - end; - end; - ecCopyLineUp, ecCopyLineDown, ecMoveLineUp, ecMoveLineDown: - ExecCmdCopyOrMoveLine(Command); -//++ CodeFolding - ecFoldAll: begin CollapseAll; end; - ecUnfoldAll: begin UncollapseAll; end; - ecFoldNearest: begin CollapseNearest; end; - ecUnfoldNearest: begin UncollapseNearest; end; - ecFoldLevel1: begin CollapseLevel(1); end; - ecFoldLevel2: begin CollapseLevel(2); end; - ecFoldLevel3: begin CollapseLevel(3); end; - ecUnfoldLevel1: begin UncollapseLevel(1); end; - ecUnfoldLevel2: begin UncollapseLevel(2); end; - ecUnfoldLevel3: begin UncollapseLevel(3); end; - ecFoldRegions: begin CollapseFoldType(FoldRegionType) end; - ecUnfoldRegions: begin UnCollapseFoldType(FoldRegionType) end; -//-- CodeFolding - end; - finally - DecPaintLock; - end; -end; - -procedure TCustomSynEdit.DoOnCommandProcessed(Command: TSynEditorCommand; - AChar: WideChar; Data: pointer); -begin - if Assigned(fOnCommandProcessed) then - fOnCommandProcessed(Self, Command, AChar, Data); -end; - -procedure TCustomSynEdit.DoOnProcessCommand(var Command: TSynEditorCommand; - var AChar: WideChar; Data: pointer); -begin - if Command < ecUserFirst then - begin - if Assigned(FOnProcessCommand) then - FOnProcessCommand(Self, Command, AChar, Data); - end - else begin - if Assigned(FOnProcessUserCommand) then - FOnProcessUserCommand(Self, Command, AChar, Data); - end; -end; - -procedure TCustomSynEdit.ClearAll; -begin - Lines.Clear; - fMarkList.Clear; // fMarkList.Clear also frees all bookmarks, - FillChar(fBookMarks, sizeof(fBookMarks), 0); // so fBookMarks should be cleared too - fUndoList.Clear; - fRedoList.Clear; - Modified := False; -end; - -procedure TCustomSynEdit.ClearSelection; -begin - if SelAvail then - SelText := ''; -end; - -function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): TBufferCoord; -var - CX, CY, LineLen: Integer; - Line: string; -begin - CX := XY.Char; - CY := XY.Line; - - // valid line? - if (CY >= 1) and (CY <= Lines.Count) then - begin - Line := Lines[CY - 1]; - - LineLen := Length(Line); - if CX >= LineLen then - begin - // find first IdentChar or multibyte char in the next line - if CY < Lines.Count then - begin - Line := Lines[CY]; - Inc(CY); - CX := StrScanForCharInCategory(Line, 1, IsIdentChar); - if CX = 0 then - Inc(CX); - end; - end - else - begin - // find next word-break-char if current char is an IdentChar - if IsIdentChar(Line[CX]) then - CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); - // if word-break-char found, find the next IdentChar - if CX > 0 then - CX := StrScanForCharInCategory(Line, CX, IsIdentChar); - // if one of those failed just position at the end of the line - if CX = 0 then - CX := LineLen + 1; - end; - end; - Result.Char := CX; - Result.Line := CY; -end; - -function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBufferCoord; -var - CX, CY: Integer; - Line: string; -begin - CX := XY.Char; - CY := XY.Line; - // valid line? - if (CY >= 1) and (CY <= Lines.Count) then - begin - Line := Lines[CY - 1]; - CX := Min(CX, Length(Line) + 1); - - if CX > 1 then - begin - // only find previous char, if not already on start of line - // if previous char isn't a word-break-char search for the last IdentChar - if not IsWordBreakChar(Line[CX - 1]) then - CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; - end; - end; - Result.Char := CX; - Result.Line := CY; -end; - -function TCustomSynEdit.WordEndEx(const XY: TBufferCoord): TBufferCoord; -var - CX, CY: Integer; - Line: string; -begin - CX := XY.Char; - CY := XY.Line; - // valid line? - if (CY >= 1) and (CY <= Lines.Count) then - begin - Line := Lines[CY - 1]; - - CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); - // if no word-break-char is found just position at the end of the line - if CX = 0 then - CX := Length(Line) + 1; - end; - Result.Char := CX; - Result.Line := CY; -end; - -function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; -var - CX, CY: Integer; - Line: string; -begin - CX := XY.Char; - CY := XY.Line; - // valid line? - if (CY >= 1) and (CY <= Lines.Count) then - begin - Line := Lines[CY - 1]; - CX := Min(CX, Length(Line) + 1); - - if CX <= 1 then - begin - // find last IdentChar in the previous line - if CY > 1 then - begin - Dec(CY); - Line := Lines[CY - 1]; - CX := Length(Line) + 1; - end; - end - else - begin - // if previous char is a word-break-char search for the last IdentChar - if IsWordBreakChar(Line[CX - 1]) then - CX := StrRScanForCharInCategory(Line, CX - 1, IsIdentChar); - if CX > 0 then - // search for the first IdentChar of this "word" - CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; - if CX = 0 then - begin - // else just position at the end of the previous line - if CY > 1 then - begin - Dec(CY); - Line := Lines[CY - 1]; - CX := Length(Line) + 1; - end - else - CX := 1; - end; - end; - end; - Result.Char := CX; - Result.Line := CY; -end; - -procedure TCustomSynEdit.SetSelectionMode(const Value: TSynSelectionMode); -begin - if FSelectionMode <> Value then - begin - fSelectionMode := Value; - ActiveSelectionMode := Value; - end; -end; - -procedure TCustomSynEdit.SetActiveSelectionMode(const Value: TSynSelectionMode); -begin - if fActiveSelectionMode <> Value then - begin - if SelAvail then - InvalidateSelection; - fActiveSelectionMode := Value; - if SelAvail then - InvalidateSelection; - StatusChanged([scSelection]); - end; -end; - -procedure TCustomSynEdit.SetAdditionalIdentChars(const Value: TSysCharSet); -begin - FAdditionalIdentChars := Value; -end; - -procedure TCustomSynEdit.SetAdditionalWordBreakChars(const Value: TSysCharSet); -begin - FAdditionalWordBreakChars := Value; -end; - -procedure TCustomSynEdit.BeginUndoBlock; -begin - fUndoList.BeginBlock; -end; - -procedure TCustomSynEdit.BeginUpdate; -begin - IncPaintLock; -end; - -procedure TCustomSynEdit.EndUndoBlock; -begin - fUndoList.EndBlock; -end; - -procedure TCustomSynEdit.EndUpdate; -begin - DecPaintLock; -end; - -procedure TCustomSynEdit.AddKey(Command: TSynEditorCommand; - Key1: word; SS1: TShiftState; Key2: word; SS2: TShiftState); -var - Key: TSynEditKeyStroke; -begin - Key := Keystrokes.Add; - Key.Command := Command; - Key.Key := Key1; - Key.Shift := SS1; - Key.Key2 := Key2; - Key.Shift2 := SS2; -end; - -{ Called by FMarkList if change } -procedure TCustomSynEdit.MarkListChange(Sender: TObject); -begin - InvalidateGutter; -end; - -function TCustomSynEdit.GetSelStart: integer; -begin - if GetSelAvail then - Result := RowColToCharIndex(BlockBegin) - else - Result := RowColToCharIndex(CaretXY); -end; - -procedure TCustomSynEdit.SetAlwaysShowCaret(const Value: Boolean); -begin - if FAlwaysShowCaret <> Value then - begin - FAlwaysShowCaret := Value; - if not(csDestroying in ComponentState) and not(focused) then - begin - if Value then - begin - InitializeCaret; - end - else - begin - HideCaret; - Windows.DestroyCaret; - end; - end; - end; -end; - -procedure TCustomSynEdit.SetSelStart(const Value: Integer); -begin - { if we don't call HandleNeeded, CharsInWindow may be 0 and LeftChar will - be set to CaretX } - HandleNeeded; - InternalCaretXY := CharIndexToRowCol(Value); - BlockBegin := CaretXY; -end; - -function TCustomSynEdit.GetSelEnd: Integer; -begin - if GetSelAvail then - Result := RowColToCharIndex(Blockend) - else - Result := RowColToCharIndex(CaretXY); -end; - -procedure TCustomSynEdit.SetSelEnd(const Value: Integer); -begin - HandleNeeded; - BlockEnd := CharIndexToRowCol( Value ); -end; - -procedure TCustomSynEdit.SetSelWord; -begin - SetWordBlock(CaretXY); -end; - -procedure TCustomSynEdit.SetExtraLineSpacing(const Value: Integer); -begin - fExtraLineSpacing := Value; - SynFontChanged(self); -end; - -function TCustomSynEdit.GetBookMark(BookMark: Integer; var X, Y: Integer): - Boolean; -var - i: Integer; -begin - Result := False; - if assigned(Marks) then - for i := 0 to Marks.Count - 1 do - if Marks[i].IsBookmark and (Marks[i].BookmarkNumber = BookMark) then - begin - X := Marks[i].Char; - Y := Marks[i].Line; - Result := True; - Exit; - end; -end; - -function TCustomSynEdit.IsBookmark(BookMark: Integer): Boolean; -var - x, y: Integer; -begin - Result := GetBookMark(BookMark, x, y); -end; - -procedure TCustomSynEdit.ClearUndo; -begin - fUndoList.Clear; - fRedoList.Clear; -end; - -procedure TCustomSynEdit.SetGutter(const Value: TSynGutter); -begin - fGutter.Assign(Value); -end; - -procedure TCustomSynEdit.GutterChanged(Sender: TObject); -var - nW: Integer; -begin - if not (csLoading in ComponentState) then - begin - if fGutter.ShowLineNumbers and fGutter.AutoSize then - fGutter.AutoSizeDigitCount(Lines.Count); - if fGutter.UseFontStyle then - begin - fTextDrawer.SetBaseFont(fGutter.Font); - nW := fGutter.RealGutterWidth(fTextDrawer.CharWidth); - fTextDrawer.SetBaseFont(Font); - end - else - nW := fGutter.RealGutterWidth(fCharWidth); - if nW = fGutterWidth then - InvalidateGutter - else - SetGutterWidth(nW); - end; -end; - -procedure TCustomSynEdit.LockUndo; -begin - fUndoList.Lock; - fRedoList.Lock; -end; - -procedure TCustomSynEdit.UnlockUndo; -begin - fUndoList.Unlock; - fRedoList.Unlock; -end; - -procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor); -begin - if (Msg.HitTest = HTCLIENT) and (Msg.CursorWnd = Handle) and - not(csDesigning in ComponentState) then - begin - UpdateMouseCursor; - end - else - inherited; -end; - -procedure TCustomSynEdit.SetTabWidth(Value: Integer); -begin - Value := MinMax(Value, 1, 256); - if (Value <> fTabWidth) then begin - fTabWidth := Value; - TSynEditStringList(Lines).TabWidth := Value; - Invalidate; // to redraw text containing tab chars - if WordWrap then - begin - fWordWrapPlugin.Reset; - InvalidateGutter; - end; - end; -end; - -procedure TCustomSynEdit.SelectedColorsChanged(Sender: TObject); -begin - InvalidateSelection; -end; - -// find / replace - -function TCustomSynEdit.SearchReplace(const ASearch, AReplace: string; - AOptions: TSynSearchOptions): Integer; -var - ptStart, ptEnd: TBufferCoord; // start and end of the search range - ptCurrent: TBufferCoord; // current search position - nSearchLen, nReplaceLen, n, nFound: integer; - nInLine: integer; - bBackward, bFromCursor: boolean; - bPrompt: boolean; - bReplace, bReplaceAll: boolean; - bEndUndoBlock: boolean; - nAction: TSynReplaceAction; - iResultOffset: Integer; - - function InValidSearchRange(First, Last: Integer): Boolean; - begin - Result := True; - if (fActiveSelectionMode = smNormal) or not (ssoSelectedOnly in AOptions) then - begin - if ((ptCurrent.Line = ptStart.Line) and (First < ptStart.Char)) or - ((ptCurrent.Line = ptEnd.Line) and (Last > ptEnd.Char)) - then - Result := False; - end - else - if (fActiveSelectionMode = smColumn) then - // solves bug in search/replace when smColumn mode active and no selection - Result := (First >= ptStart.Char) and (Last <= ptEnd.Char) or (ptEnd.Char - ptStart.Char < 1); - end; - -begin - if not Assigned(fSearchEngine) then - raise ESynEditError.Create('No search engine has been assigned'); - - Result := 0; - // can't search for or replace an empty string - if Length(ASearch) = 0 then exit; - // get the text range to search in, ignore the "Search in selection only" - // option if nothing is selected - bBackward := (ssoBackwards in AOptions); - bPrompt := (ssoPrompt in AOptions); - bReplace := (ssoReplace in AOptions); - bReplaceAll := (ssoReplaceAll in AOptions); - bFromCursor := not (ssoEntireScope in AOptions); - if not SelAvail then Exclude(AOptions, ssoSelectedOnly); - if (ssoSelectedOnly in AOptions) then begin - ptStart := BlockBegin; - ptEnd := BlockEnd; - // search the whole line in the line selection mode - if (fActiveSelectionMode = smLine) then - begin - ptStart.Char := 1; - ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; - end - else if (fActiveSelectionMode = smColumn) then - // make sure the start column is smaller than the end column - if (ptStart.Char > ptEnd.Char) then - SwapInt(Integer(ptStart.Char), Integer(ptEnd.Char)); - // ignore the cursor position when searching in the selection - if bBackward then - ptCurrent := ptEnd - else - ptCurrent := ptStart; - end - else - begin - ptStart.Char := 1; - ptStart.Line := 1; - ptEnd.Line := Lines.Count; - ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; - if bFromCursor then - if bBackward then ptEnd := CaretXY else ptStart := CaretXY; - if bBackward then ptCurrent := ptEnd else ptCurrent := ptStart; - end; - // initialize the search engine - fSearchEngine.Options := AOptions; - fSearchEngine.Pattern := ASearch; - // search while the current search position is inside of the search range - nReplaceLen := 0; - DoOnPaintTransient(ttBefore); - if bReplaceAll and not bPrompt then - begin - IncPaintLock; - BeginUndoBlock; - bEndUndoBlock := True; - end - else - bEndUndoBlock := False; - try - while (ptCurrent.Line >= ptStart.Line) and (ptCurrent.Line <= ptEnd.Line) do - begin - nInLine := fSearchEngine.FindAll(Lines[ptCurrent.Line - 1]); - iResultOffset := 0; - if bBackward then - n := Pred(fSearchEngine.ResultCount) - else - n := 0; - // Operate on all results in this line. - while nInLine > 0 do - begin - // An occurrence may have been replaced with a text of different length - nFound := fSearchEngine.Results[n] + iResultOffset; - nSearchLen := fSearchEngine.Lengths[n]; - if bBackward then Dec(n) else Inc(n); - Dec(nInLine); - // Is the search result entirely in the search range? - if not InValidSearchRange(nFound, nFound + nSearchLen) then continue; - Inc(Result); - // Select the text, so the user can see it in the OnReplaceText event - // handler or as the search result. - - ptCurrent.Char := nFound; - BlockBegin := ptCurrent; - // Be sure to use the Ex version of CursorPos so that it appears in the middle if necessary - SetCaretXYEx(False, BufferCoord(1, ptCurrent.Line)); - EnsureCursorPosVisibleEx(True); - Inc(ptCurrent.Char, nSearchLen); - BlockEnd := ptCurrent; - InternalCaretXY := ptCurrent; - if bBackward then InternalCaretXY := BlockBegin else InternalCaretXY := ptCurrent; - // If it's a search only we can leave the procedure now. - if not (bReplace or bReplaceAll) then exit; - // Prompt and replace or replace all. If user chooses to replace - // all after prompting, turn off prompting. - if bPrompt and Assigned(fOnReplaceText) then - begin - nAction := DoOnReplaceText(ASearch, AReplace, ptCurrent.Line, nFound); - if nAction = raCancel then - exit; - end - else - nAction := raReplace; - if nAction = raSkip then - Dec(Result) - else begin - // user has been prompted and has requested to silently replace all - // so turn off prompting - if nAction = raReplaceAll then begin - if not bReplaceAll or bPrompt then - begin - bReplaceAll := True; - IncPaintLock; - end; - bPrompt := False; - if bEndUndoBlock = false then - BeginUndoBlock; - bEndUndoBlock:= true; - end; - // Allow advanced substition in the search engine - SelText := fSearchEngine.Replace(SelText, AReplace); - nReplaceLen := CaretX - nFound; - end; - // fix the caret position and the remaining results - if not bBackward then begin - InternalCaretX := nFound + nReplaceLen; - if (nSearchLen <> nReplaceLen) and (nAction <> raSkip) then - begin - Inc(iResultOffset, nReplaceLen - nSearchLen); - if (fActiveSelectionMode <> smColumn) and (CaretY = ptEnd.Line) then - begin - Inc(ptEnd.Char, nReplaceLen - nSearchLen); - BlockEnd := ptEnd; - end; - end; - end; - if not bReplaceAll then - exit; - end; - // search next / previous line - if bBackward then - Dec(ptCurrent.Line) - else - Inc(ptCurrent.Line); - end; - finally - if bReplaceAll and not bPrompt then DecPaintLock; - if bEndUndoBlock then EndUndoBlock; - DoOnPaintTransient( ttAfter ); - end; -end; - -function TCustomSynEdit.IsPointInSelection(const Value: TBufferCoord): boolean; -var - ptBegin, ptEnd: TBufferCoord; -begin - ptBegin := BlockBegin; - ptEnd := BlockEnd; - if (Value.Line >= ptBegin.Line) and (Value.Line <= ptEnd.Line) and - ((ptBegin.Line <> ptEnd.Line) or (ptBegin.Char <> ptEnd.Char)) then - begin - if fActiveSelectionMode = smLine then - Result := True - else if (fActiveSelectionMode = smColumn) then - begin - if (ptBegin.Char > ptEnd.Char) then - Result := (Value.Char >= ptEnd.Char) and (Value.Char < ptBegin.Char) - else if (ptBegin.Char < ptEnd.Char) then - Result := (Value.Char >= ptBegin.Char) and (Value.Char < ptEnd.Char) - else - Result := False; - end - else - Result := ((Value.Line > ptBegin.Line) or (Value.Char >= ptBegin.Char)) and - ((Value.Line < ptEnd.Line) or (Value.Char < ptEnd.Char)); - end - else - Result := False; -end; - -procedure TCustomSynEdit.SetFocus; -begin - if (fFocusList.Count > 0) then - begin - if TWinControl (fFocusList.Last).CanFocus then - TWinControl (fFocusList.Last).SetFocus; - exit; - end; - inherited; -end; - -procedure TCustomSynEdit.UpdateMouseCursor; -var - ptCursor: TPoint; - ptLineCol: TBufferCoord; - iNewCursor: TCursor; -//++ Code Folding - ptRowCol: TDisplayCoord; - Rect: TRect; -//-- CodeFolding -begin - GetCursorPos(ptCursor); - ptCursor := ScreenToClient(ptCursor); - ptRowCol := PixelsToRowColumn(ptCursor.X, ptCursor.Y); - ptLineCol := DisplayToBufferPos(ptRowCol); - if (ptCursor.X < fGutterWidth) then begin - if UseCodeFolding and - fAllFoldRanges.FoldStartAtLine(ptLineCol.Line) then - begin - Rect := GetFoldShapeRect(ptRowCol.Row); - if PtInRect(Rect, ptCursor) then - SetCursor(Screen.Cursors[crHandPoint]) - else - SetCursor(Screen.Cursors[fGutter.Cursor]); - end else - SetCursor(Screen.Cursors[fGutter.Cursor]) - end else begin - if (eoDragDropEditing in fOptions) and (not MouseCapture) and IsPointInSelection(ptLineCol) then - iNewCursor := crArrow - else if UseCodeFolding and CodeFolding.ShowHintMark and - fAllFoldRanges.CollapsedFoldStartAtLine(ptLineCol.Line) then - begin - Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); - if PtInRect(Rect, ptCursor) then - iNewCursor := crHandPoint; - end else - iNewCursor := Cursor; - if Assigned(OnMouseCursor) then - OnMouseCursor(Self, ptLineCol, iNewCursor); - fKbdHandler.ExecuteMouseCursor(Self, ptLineCol, iNewCursor); - SetCursor(Screen.Cursors[iNewCursor]); - end; -end; - -procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject); -begin - InvalidateGutter; -end; - -function TCustomSynEdit.GetOptions: TSynEditorOptions; -begin - Result := fOptions; -end; - -procedure TCustomSynEdit.SetOptions(Value: TSynEditorOptions); -const - ScrollOptions = [eoDisableScrollArrows,eoHideShowScrollbars, - eoScrollPastEof,eoScrollPastEol]; -var - bSetDrag: Boolean; - bUpdateScroll: Boolean; - bInvalidate: Boolean; -begin - if (Value <> fOptions) then - begin - bSetDrag := (eoDropFiles in fOptions) <> (eoDropFiles in Value); - bInvalidate := (eoShowSpecialChars in fOptions) <> (eoShowSpecialChars in Value); - bUpdateScroll := (Options * ScrollOptions) <> (Value * ScrollOptions); - - if not (eoScrollPastEol in Options) then - LeftChar := LeftChar; - if not (eoScrollPastEof in Options) then - TopLine := TopLine; - fOptions := Value; - - // (un)register HWND as drop target - if bSetDrag and not (csDesigning in ComponentState) and HandleAllocated then - DragAcceptFiles(Handle, (eoDropFiles in fOptions)); - if bInvalidate then - Invalidate; - if bUpdateScroll then - UpdateScrollBars; - end; -end; - -procedure TCustomSynEdit.SizeOrFontChanged(bFont: boolean); -begin - if HandleAllocated and (fCharWidth <> 0) then - begin - fCharsInWindow := Max(ClientWidth - fGutterWidth - 2, 0) div fCharWidth; - fLinesInWindow := ClientHeight div fTextHeight; - if WordWrap then - begin - fWordWrapPlugin.DisplayChanged; - Invalidate; - end; - if bFont then - begin - if Gutter.ShowLineNumbers then - GutterChanged(Self) - else - UpdateScrollbars; - InitializeCaret; - Exclude(fStateFlags, sfCaretChanged); - Invalidate; - end - else - UpdateScrollbars; - if not (eoScrollPastEol in Options) then - LeftChar := LeftChar; - if not (eoScrollPastEof in Options) then - TopLine := TopLine; - end; -end; - -procedure TCustomSynEdit.MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); -var - ptO, ptDst: TBufferCoord; - s: string; - nLineLen: Integer; - bChangeY: Boolean; - vCaretRowCol: TDisplayCoord; -begin - if WordWrap then - begin - if DX > 0 then - begin - if fCaretAtEOL then - begin - fCaretAtEOL := False; - UpdateLastCaretX; - IncPaintLock; - Include(fStateFlags, sfCaretChanged); - DecPaintLock; - Exit; - end; - end - else - begin // DX < 0. Handle ecLeft/ecPageLeft at BOL. - if (not fCaretAtEOL) and (CaretX > 1) and (DisplayX = 1) then - begin - fCaretAtEOL := True; - UpdateLastCaretX; - if DisplayX > CharsInWindow +1 then - SetInternalDisplayXY( DisplayCoord(CharsInWindow +1, DisplayY) ) - else begin - IncPaintLock; - Include(fStateFlags, sfCaretChanged); - DecPaintLock; - end; - Exit; - end; - end; - end; - ptO := CaretXY; - ptDst := ptO; - s := LineText; - nLineLen := Length(s); - // only moving or selecting one char can change the line - bChangeY := not (eoScrollPastEol in fOptions); - if bChangeY and (DX = -1) and (ptO.Char = 1) and (ptO.Line > 1) then - begin - // end of previous line - Dec(ptDst.Line); - ptDst.Char := Length(Lines[ptDst.Line - 1]) + 1; - end - else if bChangeY and (DX = 1) and (ptO.Char > nLineLen) and (ptO.Line < Lines.Count) then - begin - // start of next line - Inc(ptDst.Line); - ptDst.Char := 1; - end - else begin - ptDst.Char := Max(1, ptDst.Char + DX); - // don't go past last char when ScrollPastEol option not set - if (DX > 0) and bChangeY then - ptDst.Char := Min(ptDst.Char, nLineLen + 1); - end; - // set caret and block begin / end - MoveCaretAndSelection(fBlockBegin, ptDst, SelectionCommand); - // if caret is beyond CharsInWindow move to next row (this means there are - // spaces/tabs at the end of the row) - if WordWrap and (DX > 0) and (CaretX < Length(LineText)) then - begin - vCaretRowCol := DisplayXY; - if (vCaretRowCol.Column = 1) and (LineToRow(CaretY) <> vCaretRowCol.Row) then - begin - fCaretAtEOL := True; - UpdateLastCaretX; - end - else if vCaretRowCol.Column > CharsInWindow +1 then - begin - Inc(vCaretRowCol.Row); - vCaretRowCol.Column := 1; - InternalCaretXY := DisplayToBufferPos(vCaretRowCol); - end; - end; -end; - -procedure TCustomSynEdit.MoveCaretVert(DY: Integer; SelectionCommand: Boolean); -var - ptO, ptDst, vEOLTestPos: TDisplayCoord; - vDstLineChar: TBufferCoord; - SaveLastCaretX: Integer; -begin - ptO := DisplayXY; - ptDst := ptO; - - Inc(ptDst.Row, DY); - if DY >= 0 then - begin - if RowToLine(ptDst.Row) > Lines.Count then - ptDst.Row := Max(1, DisplayLineCount); - end - else begin - if ptDst.Row < 1 then - ptDst.Row := 1; - end; - - if (ptO.Row <> ptDst.Row) then - begin - if eoKeepCaretX in Options then - ptDst.Column := fLastCaretX; - end; - vDstLineChar := DisplayToBufferPos(ptDst); - SaveLastCaretX := fLastCaretX; - - // set caret and block begin / end - IncPaintLock; - MoveCaretAndSelection(fBlockBegin, vDstLineChar, SelectionCommand); - if WordWrap then - begin - vEOLTestPos := BufferToDisplayPos(vDstLineChar); - fCaretAtEOL := (vEOLTestPos.Column = 1) and (vEOLTestPos.Row <> ptDst.Row); - end; - DecPaintLock; - - // Restore fLastCaretX after moving caret, since UpdateLastCaretX, called by - // SetCaretXYEx, changes them. This is the one case where we don't want that. - fLastCaretX := SaveLastCaretX; -end; - -procedure TCustomSynEdit.MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; - SelectionCommand: Boolean); -begin - if (eoGroupUndo in FOptions) and UndoList.CanUndo then - fUndoList.AddGroupBreak; - - IncPaintLock; - if SelectionCommand then - begin - if not SelAvail then - SetBlockBegin(ptBefore); - SetBlockEnd(ptAfter); - end - else - SetBlockBegin(ptAfter); - InternalCaretXY := ptAfter; - DecPaintLock; -end; - -procedure TCustomSynEdit.SetCaretAndSelection(const ptCaret, ptBefore, - ptAfter: TBufferCoord); -var - vOldMode: TSynSelectionMode; -begin - vOldMode := fActiveSelectionMode; - IncPaintLock; - try - InternalCaretXY := ptCaret; - SetBlockBegin(ptBefore); - SetBlockEnd(ptAfter); - finally - ActiveSelectionMode := vOldMode; - DecPaintLock; - end; -end; - -procedure TCustomSynEdit.RecalcCharExtent; -const - iFontStyles: array[0..3] of TFontStyles = ([], [fsItalic], [fsBold], - [fsItalic, fsBold]); -var - iHasStyle: array[0..3] of Boolean; - cAttr: Integer; - cStyle: Integer; - iCurr: TFontStyles; -begin - FillChar(iHasStyle, SizeOf(iHasStyle), 0); - if Assigned(fHighlighter) and (fHighlighter.AttrCount > 0) then begin - for cAttr := 0 to fHighlighter.AttrCount - 1 do - begin - iCurr := fHighlighter.Attribute[cAttr].Style * [fsItalic, fsBold]; - for cStyle := 0 to 3 do - if iCurr = iFontStyles[cStyle] then - begin - iHasStyle[cStyle] := True; - break; - end; - end; - end - else begin - iCurr := Font.Style * [fsItalic, fsBold]; - for cStyle := 0 to 3 do - if iCurr = iFontStyles[cStyle] then - begin - iHasStyle[cStyle] := True; - break; - end; - end; - - fTextHeight := 0; - fCharWidth := 0; - fTextDrawer.BaseFont := Self.Font; - for cStyle := 0 to 3 do - if iHasStyle[cStyle] then - begin - fTextDrawer.BaseStyle := iFontStyles[cStyle]; - fTextHeight := Max(fTextHeight, fTextDrawer.CharHeight); - fCharWidth := Max(fCharWidth, fTextDrawer.CharWidth); - end; - Inc(fTextHeight, fExtraLineSpacing); -end; - -procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject); -begin - RecalcCharExtent; - if Sender is TSynCustomHighlighter then - begin - Lines.BeginUpdate; - try - ScanRanges; - finally - Lines.EndUpdate; - end; - end - else - Invalidate; - SizeOrFontChanged(True); -end; - -procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChanges); -begin - fStatusChanges := fStatusChanges + AChanges; - if PaintLock = 0 then - DoOnStatusChange(fStatusChanges); -end; - -procedure TCustomSynEdit.ExecCmdCaseChange(const Cmd: TSynEditorCommand); - function ToggleCase(const aStr: string): string; - var - i: Integer; - sLower: string; - begin - Result := aStr.ToUpper; - sLower := aStr.ToLower; - for i := 1 to Length(aStr) do - begin - if Result[i] = aStr[i] then - Result[i] := sLower[i]; - end; - end; - - Function TitleCase(S:string) : string; - Var - i : Integer; - Begin - S[1] := S[1].ToUpper; - For i := 1 to Length(S)-1 Do - If IsWordBreakChar(S[i]) then - S[i+1] := S[i+1].ToUpper - else - S[i+1] := S[i+1].ToLower; - Result := S; - End; - -var - w: string; - oldCaret, oldBlockBegin, oldBlockEnd: TBufferCoord; - bHadSel : Boolean; -begin - Assert((Cmd >= ecUpperCase) and (Cmd <= ecTitleCase)); - if ReadOnly then Exit; - - if SelAvail then - begin - bHadSel := True; - oldBlockBegin := BlockBegin; - oldBlockEnd := BlockEnd; - end - else begin - bHadSel := False; - end; - oldCaret := CaretXY; - try - if not SelAvail then - SetSelWord; - - w := SelText; - if w <> '' then - begin - case Cmd of - ecUpperCase: - w := w.ToUpper; - ecLowerCase: - w := w.ToLower; - ecToggleCase: - w := ToggleCase(w); - ecTitleCase: - w := TitleCase(w); - end; - BeginUndoBlock; - try - if bHadSel then - fUndoList.AddChange(crSelection, oldBlockBegin, oldBlockEnd, '', fActiveSelectionMode) - else - fUndoList.AddChange(crSelection, oldCaret, oldCaret, '', fActiveSelectionMode); - fUndoList.AddChange(crCaret, oldCaret, oldCaret, '', fActiveSelectionMode); - SelText := w; - finally - EndUndoBlock; - end; - end; - finally - SetCaretAndSelection(oldCaret, oldBlockBegin, oldBlockEnd); - end; -end; - -procedure TCustomSynEdit.DoTabKey; -var - StartOfBlock: TBufferCoord; - i, MinLen, iLine: integer; - PrevLine, Spaces: string; - p: PWideChar; - NewCaretX: integer; - nPhysX, nDistanceToTab, nSpacesToNextTabStop : Integer; - OldSelTabLine, vIgnoreSmartTabs, TrimTrailingActive: Boolean; -begin - // Provide Visual Studio like block indenting - OldSelTabLine := SelTabLine; - if (eoTabIndent in Options) and ((SelTabBlock) or (OldSelTabLine)) then - begin - DoBlockIndent; - if OldSelTabLine then - begin - if fBlockBegin.Char < fBlockEnd.Char then - FBlockBegin.Char := 1 - else - fBlockEnd.Char := 1; - end; - exit; - end; - i := 0; - iLine := 0; - MinLen := 0; - vIgnoreSmartTabs := False; - if eoSmartTabs in fOptions then - begin - iLine := CaretY - 1; - if (iLine > 0) and (iLine < Lines.Count) then - begin - Dec(iLine); - repeat - //todo: rethink it - MinLen := DisplayToBufferPos(DisplayCoord( - BufferToDisplayPos(CaretXY).Column, LineToRow(iLine + 1))).Char; - PrevLine := Lines[iLine]; - if (Length(PrevLine) >= MinLen) then begin - p := @PrevLine[MinLen]; - // scan over non-whitespaces - repeat - if (p^ = #9) or (p^ = #32) then break; - Inc(i); - Inc(p); - until p^ = #0; - // scan over whitespaces - if p^ <> #0 then - repeat - if (p^ <> #9) and (p^ <> #32) then break; - Inc(i); - Inc(p); - until p^ = #0; - break; - end; - Dec(iLine); - until iLine < 0; - end - else - vIgnoreSmartTabs := True; - end; - fUndoList.BeginBlock; - try - if SelAvail then - SetSelText(''); - StartOfBlock := CaretXY; - - if i = 0 then - begin - if (eoTabsToSpaces in fOptions) then - begin - i := TabWidth - (StartOfBlock.Char - 1) mod TabWidth; - if i = 0 then - i := TabWidth; - end - else - i := TabWidth; - end; - - if eoTabsToSpaces in fOptions then - begin - Spaces := StringOfChar(#32, i); - NewCaretX := StartOfBlock.Char + i; - end - else begin - if (eoSmartTabs in fOptions) and not vIgnoreSmartTabs and (iLine > -1) then - begin - Spaces := Copy(fLines[CaretXY.Line - 1], 1, CaretXY.Char - 1); - while Pos(#9, Spaces) > 0 do - Delete(Spaces, Pos(#9, Spaces), 1); - Spaces := Trim(Spaces); - - //smart tabs are only in the front of the line *NOT IN THE MIDDLE* - if Spaces = '' then - begin - i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ).Column; - - nPhysX := DisplayX; - nDistanceToTab := i - nPhysX; - nSpacesToNextTabStop := TabWidth - ((nPhysX - 1) mod TabWidth); - if nSpacesToNextTabStop <= nDistanceToTab then begin - Spaces := #9; - Dec(nDistanceToTab, nSpacesToNextTabStop); - end; - while nDistanceToTab >= TabWidth do begin - Spaces := Spaces + #9; - Dec(nDistanceToTab, TabWidth); - end; - if nDistanceToTab > 0 then - Spaces := Spaces + StringofChar(#32, nDistanceToTab); - end else - Spaces := #9; - end - else begin - Spaces := #9; - end; - NewCaretX := StartOfBlock.Char + Length(Spaces); - end; - // Do not Trim - TrimTrailingActive := eoTrimTrailingSpaces in Options; - if TrimTrailingActive then Exclude(fOptions, eoTrimTrailingSpaces); - SetSelText(Spaces); - if TrimTrailingActive then Include(fOptions, eoTrimTrailingSpaces); - finally - fUndoList.EndBlock; - end; - ForceCaretX(NewCaretX); - - EnsureCursorPosVisible; -end; - -procedure TCustomSynEdit.DoShiftTabKey; -// shift-tab key handling -var - NewX: Integer; - Line: string; - LineLen: Integer; - DestX: Integer; - - MaxLen, iLine: Integer; - PrevLine, OldSelText: string; - p: PWideChar; - OldCaretXY: TBufferCoord; - TrimTrailingActive: Boolean; -begin - // Provide Visual Studio like block indenting - if (eoTabIndent in Options) and ((SelTabBlock) or (SelTabLine)) then - begin - DoBlockUnIndent; - exit; - end; - - NewX := CaretX; - - if (NewX <> 1) and (eoSmartTabs in fOptions) then - begin - iLine := CaretY - 1; - if (iLine > 0) and (iLine < Lines.Count) then - begin - Dec(iLine); - MaxLen := CaretX - 1; - repeat - PrevLine := Lines[iLine]; - if (Length(PrevLine) >= MaxLen) then - begin - p := @PrevLine[MaxLen]; - // scan over whitespaces - repeat - if p^ <> #32 then break; - Dec(NewX); - Dec(p); - until NewX = 1; - // scan over non-whitespaces - if NewX <> 1 then - repeat - if p^ = #32 then break; - Dec(NewX); - Dec(p); - until NewX = 1; - break; - end; - Dec(iLine); - until iLine < 0; - end; - end; - - if NewX = CaretX then - begin - Line := LineText; - LineLen := Length(Line); - - // find real un-tab position - - DestX := ((CaretX - 2) div TabWidth) * TabWidth + 1; - if NewX > LineLen then - NewX := DestX - else if (NewX > DestX) and (Line[NewX - 1] = #9) then - dec(NewX) - else begin - while (NewX > DestX) and ((NewX - 1 > LineLen) or (Line[NewX - 1] = #32)) do - dec(NewX); - end; - end; - - // perform un-tab - if (NewX <> CaretX) then - begin - SetBlockBegin(BufferCoord(NewX, CaretY)); - SetBlockEnd(CaretXY); - OldCaretXY := CaretXY; - - OldSelText := SelText; - - // Do not Trim - TrimTrailingActive := eoTrimTrailingSpaces in Options; - if TrimTrailingActive then Exclude(fOptions, eoTrimTrailingSpaces); - SetSelText(''); - if TrimTrailingActive then Include(fOptions, eoTrimTrailingSpaces); - - ForceCaretX(NewX); - end; -end; - -procedure TCustomSynEdit.DoHomeKey(Selection: Boolean); - - function LastCharInRow: Integer; - var - vPos: TDisplayCoord; - begin - if fLines.Count = 0 then - Result := 1 - else - begin - vPos := DisplayXY; - vPos.Column := Min(CharsInWindow, fWordWrapPlugin.GetRowLength(vPos.Row) + 1); - Result := DisplayToBufferPos(vPos).Char; - end; - end; - -var - newX: Integer; - first_nonblank: Integer; - s: string; - vNewPos: TDisplayCoord; - vMaxX: Integer; -begin - // home key enhancement - if (eoEnhanceHomeKey in fOptions) and (LineToRow(CaretY) = DisplayY) then - begin - s := fLines[CaretXY.Line - 1]; - - first_nonblank := 1; - if WordWrap then - vMaxX := LastCharInRow() -1 - else - vMaxX := Length(s); - while (first_nonblank <= vMaxX) and - CharInSet(s[first_nonblank], [#32, #9]) - do - inc(first_nonblank); - dec(first_nonblank); - - newX := CaretXY.Char - 1; - - if (newX > first_nonblank) or (newX = 0) then - newX := first_nonblank + 1 - else - newX := 1; - end - else - newX := 1; - - if WordWrap then - begin - vNewPos.Row := DisplayY; - vNewPos.Column := BufferToDisplayPos(BufferCoord(newX, CaretY)).Column; - MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewPos), Selection); - end - else - MoveCaretAndSelection(CaretXY, BufferCoord(newX, CaretY), Selection); -end; - -procedure TCustomSynEdit.DoEndKey(Selection: Boolean); - - function CaretInLastRow: Boolean; - var - vLastRow: Integer; - begin - if not WordWrap then - Result := True - else - begin - vLastRow := LineToRow(CaretY + 1) - 1; - // This check allows good behaviour with empty rows (this can be useful in a diff app ;-) - while (vLastRow > 1) - and (fWordWrapPlugin.GetRowLength(vLastRow) = 0) - and (RowToLine(vLastRow) = CaretY) do - begin - Dec(vLastRow); - end; - Result := DisplayY = vLastRow; - end; - end; - - function FirstCharInRow: Integer; - var - vPos: TDisplayCoord; - begin - vPos.Row := DisplayY; - vPos.Column := 1; - Result := DisplayToBufferPos(vPos).Char; - end; - -var - vText: string; - vLastNonBlank: Integer; - vNewX: Integer; - vNewCaret: TDisplayCoord; - vMinX: Integer; - vEnhance: Boolean; -begin - if (eoEnhanceEndKey in fOptions) and CaretInLastRow then - begin - vEnhance := True; - vText := LineText; - vLastNonBlank := Length(vText); - if WordWrap then - vMinX := FirstCharInRow() - 1 - else - vMinX := 0; - while (vLastNonBlank > vMinX) and CharInSet(vText[vLastNonBlank], [#32, #9]) do - Dec(vLastNonBlank); - - vNewX := CaretX - 1; - if vNewX = vLastNonBlank then - vNewX := Length(LineText) + 1 - else - vNewX := vLastNonBlank + 1; - end - else - begin - vNewX := Length(LineText) + 1; - vEnhance := False; - end; - - if WordWrap then - begin - vNewCaret.Row := DisplayY; - if vEnhance then - vNewCaret.Column := BufferToDisplayPos(BufferCoord(vNewX, CaretY)).Column - else - vNewCaret.Column := fWordWrapPlugin.GetRowLength(vNewCaret.Row) + 1; - vNewCaret.Column := Min(CharsInWindow + 1, vNewCaret.Column); - MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewCaret), Selection); - // Updates fCaretAtEOL flag. - SetInternalDisplayXY(vNewCaret); - end - else - MoveCaretAndSelection(CaretXY, - BufferCoord(vNewX, CaretY), Selection); -end; - -procedure TCustomSynEdit.CreateWnd; -Var - DropTarget : TSynDropTarget; -begin - inherited; - // This is to avoid getting the text of the control while recreating - WindowText := StrNew('SynEdit'); // dummy caption - - if (eoDropFiles in fOptions) and not (csDesigning in ComponentState) then - DragAcceptFiles(Handle, True); - - if not (csDesigning in ComponentState) then begin - DropTarget := TSynDropTarget.Create; - with DropTarget do begin - OnDragEnter := OleDragEnter; - OnDragOver := OleDragOver; - OnDragLeave := OleDragLeave; - OnDrop := OleDrop; - end; - RegisterDragDrop (Handle, DropTarget); - end; - - UpdateScrollBars; -end; - -procedure TCustomSynEdit.InvalidateRect(const aRect: TRect; aErase: Boolean); -begin - Windows.InvalidateRect(Handle, @aRect, aErase); -end; - -procedure TCustomSynEdit.DoBlockIndent; -var - OrgCaretPos: TBufferCoord; - BB, BE: TBufferCoord; - Run, StrToInsert: PWideChar; - e, x, i, InsertStrLen: Integer; - Spaces: string; - OrgSelectionMode: TSynSelectionMode; - InsertionPos: TBufferCoord; -begin - OrgSelectionMode := fActiveSelectionMode; - OrgCaretPos := CaretXY; - - StrToInsert := nil; - if SelAvail then - try - // keep current selection detail - BB := BlockBegin; - BE := BlockEnd; - - // build text to insert - if (BE.Char = 1) then - begin - e := BE.Line - 1; - x := 1; - end - else begin - e := BE.Line; - if eoTabsToSpaces in Options then - x := CaretX + FTabWidth - else x := CaretX + 1; - end; - if (eoTabsToSpaces in Options) then - begin - InsertStrLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; - // chars per line * lines-1 + last line + null char - StrToInsert := WideStrAlloc(InsertStrLen); - Run := StrToInsert; - Spaces := StringofChar(#32, FTabWidth); - end - else begin - InsertStrLen:= 3 * (e - BB.Line) + 2; - // #9#13#10 * lines-1 + (last line's #9 + null char) - StrToInsert := WideStrAlloc(InsertStrLen); - Run := StrToInsert; - Spaces := #9; - end; - for i := BB.Line to e-1 do - begin - StrCopy(Run, PWideChar(Spaces + #13#10)); - Inc(Run, Length(spaces) + 2); - end; - StrCopy(Run, PWideChar(Spaces)); - - fUndoList.BeginBlock; - try - InsertionPos.Line := BB.Line; - if fActiveSelectionMode = smColumn then - InsertionPos.Char := Min(BB.Char, BE.Char) - else - InsertionPos.Char := 1; - InsertBlock(InsertionPos, InsertionPos, StrToInsert, True); - fUndoList.AddChange(crIndent, BB, BE, '', smColumn); - //We need to save the position of the end block for redo - fUndoList.AddChange(crIndent, - BufferCoord(BB.Char + length(Spaces), BB.Line), - BufferCoord(BE.Char + length(Spaces), BE.Line), - '', smColumn); - finally - fUndoList.EndBlock; - end; - - //adjust the x position of orgcaretpos appropriately - OrgCaretPos.Char := X; - finally - if BE.Char > 1 then - Inc(BE.Char, Length(Spaces)); - StrDispose(StrToInsert); - SetCaretAndSelection(OrgCaretPos, - BufferCoord(BB.Char + Length(Spaces), BB.Line), BE); - ActiveSelectionMode := OrgSelectionMode; - end; -end; - -procedure TCustomSynEdit.DoBlockUnindent; -var - OrgCaretPos, - BB, BE: TBufferCoord; - Line, Run, - FullStrToDelete, - StrToDelete: PWideChar; - Len, x, StrToDeleteLen, i, TmpDelLen, FirstIndent, LastIndent, e: Integer; - TempString: string; - OrgSelectionMode: TSynSelectionMode; - SomethingToDelete: Boolean; - - function GetDelLen: Integer; - var - Run: PWideChar; - begin - Result := 0; - Run := Line; - //Take care of tab character - if Run[0] = #9 then - begin - Result := 1; - SomethingToDelete := True; - exit; - end; - //Deal with compound tabwidths Sometimes they have TabChars after a few - //spaces, yet we need to delete the whole tab width even though the char - //count might not be FTabWidth because of the TabChar - while (Run[0] = #32) and (Result < FTabWidth) do - begin - Inc(Result); - Inc(Run); - SomethingToDelete := True; - end; - if (Run[0] = #9) and (Result < FTabWidth) then - Inc(Result); - end; - -begin - OrgSelectionMode := fActiveSelectionMode; - Len := 0; - LastIndent := 0; - if SelAvail then - begin - // store current selection detail - BB := BlockBegin; - BE := BlockEnd; - OrgCaretPos := CaretXY; - x := fCaretX; - - // convert selection to complete lines - if BE.Char = 1 then - e := BE.Line - 1 - else - e := BE.Line; - - // build string to delete - StrToDeleteLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; - // chars per line * lines-1 + last line + null char - StrToDelete := WideStrAlloc(StrToDeleteLen); - StrToDelete[0] := #0; - SomethingToDelete := False; - for i := BB.Line to e-1 do - begin - Line := PWideChar(Lines[i - 1]); - //'Line' is 0-based, 'BB.x' is 1-based, so the '-1' - //And must not increment 'Line' pointer by more than its 'Length' - if fActiveSelectionMode = smColumn then - Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[i - 1])])); - //Instead of doing a StringofChar, we need to get *exactly* what was - //being deleted incase there is a TabChar - TmpDelLen := GetDelLen; - StrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); - StrCat(StrToDelete, PWideChar(string(#13#10))); - if (fCaretY = i) and (x <> 1) then - x := x - TmpDelLen; - end; - Line := PWideChar(Lines[e - 1]); - if fActiveSelectionMode = smColumn then - Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[e - 1])])); - TmpDelLen := GetDelLen; - StrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); - if (fCaretY = e) and (x <> 1) then - x := x - TmpDelLen; - - FirstIndent := -1; - FullStrToDelete := nil; - // Delete string - if SomethingToDelete then - begin - FullStrToDelete := StrToDelete; - InternalCaretY := BB.Line; - if fActiveSelectionMode <> smColumn then - i := 1 - else - i := Min(BB.Char, BE.Char); - repeat - Run := GetEOL(StrToDelete); - if Run <> StrToDelete then - begin - Len := Run - StrToDelete; - if FirstIndent = -1 then - FirstIndent := Len; - if Len > 0 then - begin - TempString := Lines[CaretY - 1]; - Delete(TempString, i, Len); - Lines[CaretY - 1] := TempString; - end; - end; - if Run^ = #13 then - begin - Inc(Run); - if Run^ = #10 then - Inc(Run); - Inc(fCaretY); - end; - StrToDelete := Run; - until Run^ = #0; - LastIndent := Len; - fUndoList.AddChange(crUnindent, BB, BE, FullStrToDelete, fActiveSelectionMode); - end; - // restore selection - if FirstIndent = -1 then - FirstIndent := 0; - //adjust the x position of orgcaretpos appropriately - if fActiveSelectionMode = smColumn then - SetCaretAndSelection(OrgCaretPos, BB, BE) - else - begin - OrgCaretPos.Char := X; - Dec(BB.Char, FirstIndent); - Dec(BE.Char, LastIndent); - SetCaretAndSelection(OrgCaretPos, BB, BE); - end; - ActiveSelectionMode := OrgSelectionMode; - if FullStrToDelete <> nil then - StrDispose(FullStrToDelete) - else - StrDispose(StrToDelete); - end; -end; - -function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boolean; -begin - if Action is TEditAction then - begin - Result := Focused; - if Result then - begin - if Action is TEditCut then - CommandProcessor(ecCut, ' ', nil) - else if Action is TEditCopy then - CommandProcessor(ecCopy, ' ', nil) - else if Action is TEditPaste then - CommandProcessor(ecPaste, ' ', nil) - else if Action is TEditDelete then - begin - if SelAvail then - ClearSelection - else - CommandProcessor(ecDeleteChar, ' ', nil) - end - else if Action is TEditUndo then - CommandProcessor(ecUndo, ' ', nil) - else if Action is TEditSelectAll then - CommandProcessor(ecSelectAll, ' ', nil); - end - end - else if Action is TSearchAction then - begin - Result := Focused; - if Action is TSearchFindFirst then - DoSearchFindFirstExecute(TSearchFindFirst(Action)) - else if Action is TSearchFind then - DoSearchFindExecute(TSearchFind(Action)) - else if Action is TSearchReplace then - DoSearchReplaceExecute(TSearchReplace(Action)); - end - else if Action is TSearchFindNext then - begin - Result := Focused; - DoSearchFindNextExecute(TSearchFindNext(Action)) - end - else - Result := inherited ExecuteAction(Action); -end; - -function TCustomSynEdit.UpdateAction(Action: TBasicAction): Boolean; -begin - if Action is TEditAction then - begin - Result := Focused; - if Result then - begin - if Action is TEditCut then - TEditAction(Action).Enabled := SelAvail and not ReadOnly - else if Action is TEditCopy then - TEditAction(Action).Enabled := SelAvail - else if Action is TEditPaste then - TEditAction(Action).Enabled := CanPaste - else if Action is TEditDelete then - TEditAction(Action).Enabled := not ReadOnly - else if Action is TEditUndo then - TEditAction(Action).Enabled := CanUndo - else if Action is TEditSelectAll then - TEditAction(Action).Enabled := True; - end; - end else if Action is TSearchAction then - begin - Result := Focused; - if Result then - begin - if Action is TSearchFindFirst then - TSearchAction(Action).Enabled := (Text<>'') and assigned(fSearchEngine) - else if Action is TSearchFind then - TSearchAction(Action).Enabled := (Text<>'') and assigned(fSearchEngine) - else if Action is TSearchReplace then - TSearchAction(Action).Enabled := (Text<>'') and assigned(fSearchEngine); - end; - end else if Action is TSearchFindNext then - begin - Result := Focused; - if Result then - TSearchAction(Action).Enabled := (Text<>'') - and (TSearchFindNext(Action).SearchFind <> nil) - and (TSearchFindNext(Action).SearchFind.Dialog.FindText <> ''); - end - else - Result := inherited UpdateAction(Action); -end; - -procedure TCustomSynEdit.SetModified(Value: Boolean); -begin - if Value <> fModified then begin - fModified := Value; - if (eoGroupUndo in Options) and (not Value) and UndoList.CanUndo then - UndoList.AddGroupBreak; - UndoList.InitialState := not Value; - StatusChanged([scModified]); - end; -end; - -function TCustomSynEdit.DoOnSpecialLineColors(Line: Integer; var Foreground, - Background: TColor): Boolean; -begin - Result := False; - if Assigned(fOnSpecialLineColors) then - fOnSpecialLineColors(Self, Line, Result, Foreground, Background); -end; - -procedure TCustomSynEdit.InvalidateLine(Line: Integer); -var - rcInval: TRect; -begin - if (not HandleAllocated) or (Line < 1) or (Line > Lines.Count) or (not Visible) then - Exit; - -//++ CodeFolding - if UseCodeFolding or WordWrap then -//-- CodeFolding - begin - InvalidateLines(Line, Line); - Exit; - end; - - if (Line >= TopLine) and (Line <= TopLine + LinesInWindow) then - begin - // invalidate text area of this line - rcInval := Rect(fGutterWidth, fTextHeight * (Line - TopLine), ClientWidth, 0); - rcInval.Bottom := rcInval.Top + fTextHeight; - if sfLinesChanging in fStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//-- Flicker Reduction - else - InvalidateRect(rcInval, False); - end; -end; - -function TCustomSynEdit.GetReadOnly: Boolean; -begin - Result := fReadOnly; -end; - -procedure TCustomSynEdit.SetReadOnly(Value: Boolean); -begin - if fReadOnly <> Value then - begin - fReadOnly := Value; - StatusChanged([scReadOnly]); - end; -end; - -procedure TCustomSynEdit.FindMatchingBracket; -begin - InternalCaretXY := GetMatchingBracket; -end; - -function TCustomSynEdit.GetMatchingBracket: TBufferCoord; -begin - Result := GetMatchingBracketEx(CaretXY); -end; - -function TCustomSynEdit.GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; -const - Brackets: array[0..7] of WideChar = ('(', ')', '[', ']', '{', '}', '<', '>'); -var - Line: string; - i, PosX, PosY, Len: Integer; - Test, BracketInc, BracketDec: WideChar; - NumBrackets: Integer; - vDummy: string; - attr: TSynHighlighterAttributes; - p: TBufferCoord; - isCommentOrString: Boolean; -begin - Result.Char := 0; - Result.Line := 0; - // get char at caret - PosX := APoint.Char; - PosY := APoint.Line; - Line := Lines[APoint.Line - 1]; - if Length(Line) >= PosX then - begin - Test := Line[PosX]; - // is it one of the recognized brackets? - for i := Low(Brackets) to High(Brackets) do - if Test = Brackets[i] then - begin - // this is the bracket, get the matching one and the direction - BracketInc := Brackets[i]; - BracketDec := Brackets[i xor 1]; // 0 -> 1, 1 -> 0, ... - // search for the matching bracket (that is until NumBrackets = 0) - NumBrackets := 1; - if Odd(i) then - begin - repeat - // search until start of line - while PosX > 1 do - begin - Dec(PosX); - Test := Line[PosX]; - p.Char := PosX; - p.Line := PosY; - if (Test = BracketInc) or (Test = BracketDec) then - begin - if GetHighlighterAttriAtRowCol(p, vDummy, attr) then - isCommentOrString := (attr = Highlighter.StringAttribute) or - (attr = Highlighter.CommentAttribute) - else - isCommentOrString := False; - if (Test = BracketInc) and (not isCommentOrString) then - Inc(NumBrackets) - else if (Test = BracketDec) and (not isCommentOrString) then - begin - Dec(NumBrackets); - if NumBrackets = 0 then - begin - // matching bracket found, set caret and bail out - Result := P; - exit; - end; - end; - end; - end; - // get previous line if possible - if PosY = 1 then break; - Dec(PosY); - Line := Lines[PosY - 1]; - PosX := Length(Line) + 1; - until False; - end - else begin - repeat - // search until end of line - Len := Length(Line); - while PosX < Len do - begin - Inc(PosX); - Test := Line[PosX]; - p.Char := PosX; - p.Line := PosY; - if (Test = BracketInc) or (Test = BracketDec) then - begin - if GetHighlighterAttriAtRowCol(p, vDummy, attr) then - isCommentOrString := (attr = Highlighter.StringAttribute) or - (attr = Highlighter.CommentAttribute) - else - isCommentOrString := False; - if (Test = BracketInc) and (not isCommentOrString) then - Inc(NumBrackets) - else if (Test = BracketDec)and (not isCommentOrString) then - begin - Dec(NumBrackets); - if NumBrackets = 0 then - begin - // matching bracket found, set caret and bail out - Result := P; - exit; - end; - end; - end; - end; - // get next line if possible - if PosY = Lines.Count then - Break; - Inc(PosY); - Line := Lines[PosY - 1]; - PosX := 0; - until False; - end; - // don't test the other brackets, we're done - break; - end; - end; -end; - -function TCustomSynEdit.GetHighlighterAttriAtRowCol(const XY: TBufferCoord; - var Token: string; var Attri: TSynHighlighterAttributes): Boolean; -var - TmpType, TmpStart: Integer; -begin - Result := GetHighlighterAttriAtRowColEx(XY, Token, TmpType, TmpStart, Attri); -end; - -function TCustomSynEdit.GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; - var Token: string; var TokenType, Start: Integer; - var Attri: TSynHighlighterAttributes): boolean; -var - PosX, PosY: Integer; - Line: string; -begin - PosY := XY.Line - 1; - if Assigned(Highlighter) and (PosY >= 0) and (PosY < Lines.Count) then - begin - Line := Lines[PosY]; - if PosY = 0 then - Highlighter.ResetRange - else - Highlighter.SetRange(TSynEditStringList(Lines).Ranges[PosY - 1]); - Highlighter.SetLine(Line, PosY); - PosX := XY.Char; - if (PosX > 0) and (PosX <= Length(Line)) then - while not Highlighter.GetEol do - begin - Start := Highlighter.GetTokenPos + 1; - Token := Highlighter.GetToken; - if (PosX >= Start) and (PosX < Start + Length(Token)) then - begin - Attri := Highlighter.GetTokenAttribute; - TokenType := Highlighter.GetTokenKind; - Result := True; - exit; - end; - Highlighter.Next; - end; - end; - Token := ''; - Attri := nil; - Result := False; -end; - -function TCustomSynEdit.FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): Integer; -var - Entry: THookedCommandHandlerEntry; -begin - Result := GetHookedCommandHandlersCount - 1; - while Result >= 0 do - begin - Entry := THookedCommandHandlerEntry(fHookedCommandHandlers[Result]); - if Entry.Equals(AHandlerProc) then - break; - Dec(Result); - end; -end; - -function TCustomSynEdit.GetHookedCommandHandlersCount: Integer; -begin - if Assigned(fHookedCommandHandlers) then - Result := fHookedCommandHandlers.Count - else - Result := 0; -end; - -procedure TCustomSynEdit.RegisterCommandHandler( - const AHandlerProc: THookedCommandEvent; AHandlerData: pointer); -begin - if not Assigned(AHandlerProc) then - begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.Create('Event handler is NIL in RegisterCommandHandler'); -{$ENDIF} - exit; - end; - if not Assigned(fHookedCommandHandlers) then - fHookedCommandHandlers := TObjectList.Create; - if FindHookedCmdEvent(AHandlerProc) = -1 then - fHookedCommandHandlers.Add(THookedCommandHandlerEntry.Create( - AHandlerProc, AHandlerData)) - else -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('Event handler (%p, %p) already registered', - [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); -{$ENDIF} -end; - -procedure TCustomSynEdit.UnregisterCommandHandler(AHandlerProc: - THookedCommandEvent); -var - i: Integer; -begin - if not Assigned(AHandlerProc) then - begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.Create('Event handler is NIL in UnregisterCommandHandler'); -{$ENDIF} - exit; - end; - i := FindHookedCmdEvent(AHandlerProc); - if i > -1 then - fHookedCommandHandlers.Delete(i) - else -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('Event handler (%p, %p) is not registered', - [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); -{$ENDIF} -end; - -procedure TCustomSynEdit.NotifyHookedCommandHandlers(AfterProcessing: Boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data: pointer); -var - Handled: Boolean; - i: Integer; - Entry: THookedCommandHandlerEntry; -begin - Handled := False; - for i := 0 to GetHookedCommandHandlersCount - 1 do - begin - Entry := THookedCommandHandlerEntry(fHookedCommandHandlers[i]); - // NOTE: Command should NOT be set to ecNone, because this might interfere - // with other handlers. Set Handled to False instead (and check its value - // to not process the command twice). - Entry.fEvent(Self, AfterProcessing, Handled, Command, AChar, Data, - Entry.fData); - end; - if Handled then - Command := ecNone; -end; - -procedure TCustomSynEdit.DoOnClearBookmark(var Mark: TSynEditMark); -begin - if Assigned(fOnClearMark) then - fOnClearMark(Self, Mark); -end; - -procedure TCustomSynEdit.DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); -var - DoTransient: Boolean; - i: Integer; -begin - DoTransient:=(FPaintTransientLock=0); - if Lock then - begin - if (TransientType=ttBefore) then inc(FPaintTransientLock) - else - begin - dec(FPaintTransientLock); - DoTransient:=(FPaintTransientLock=0); - end; - end; - - if DoTransient then - begin - // plugins - if fPlugins <> nil then - for i := 0 to fPlugins.Count - 1 do - TSynEditPlugin(fPlugins[i]).PaintTransient(Canvas, TransientType); - // event - if Assigned(fOnPaintTransient) then - begin - Canvas.Font.Assign(Font); - Canvas.Brush.Color := Color; - HideCaret; - try - fOnPaintTransient(Self, Canvas, TransientType); - finally - ShowCaret; - end; - end; - end; -end; - -procedure TCustomSynEdit.DoOnPaintTransient(TransientType: TTransientType); -begin - DoOnPaintTransientEx(TransientType, False); -end; - -procedure TCustomSynEdit.DoOnPaint; -begin - if Assigned(fOnPaint) then - begin - Canvas.Font.Assign(Font); - Canvas.Brush.Color := Color; - fOnPaint(Self, Canvas); - end; -end; - -procedure TCustomSynEdit.DoOnPlaceMark(var Mark: TSynEditMark); -begin - if Assigned(fOnPlaceMark) then - fOnPlaceMark(Self, Mark); -end; - -function TCustomSynEdit.DoOnReplaceText(const ASearch, AReplace: string; - Line, Column: Integer): TSynReplaceAction; -begin - Result := raCancel; - if Assigned(fOnReplaceText) then - fOnReplaceText(Self, ASearch, AReplace, Line, Column, Result); -end; - -procedure TCustomSynEdit.DoOnStatusChange(Changes: TSynStatusChanges); -begin - if Assigned(fOnStatusChange) then - begin - fOnStatusChange(Self, fStatusChanges); - fStatusChanges := []; - end; -end; - -procedure TCustomSynEdit.UpdateModifiedStatus; -begin - Modified := not UndoList.InitialState; -end; - -procedure TCustomSynEdit.UndoRedoAdded(Sender: TObject); -begin - UpdateModifiedStatus; - - // we have to clear the redo information, since adding undo info removes - // the necessary context to undo earlier edit actions - if (Sender = fUndoList) and not fUndoList.InsideRedo and - (fUndoList.PeekItem<>nil) and (fUndoList.PeekItem.ChangeReason<>crGroupBreak) then - fRedoList.Clear; - if TSynEditUndoList(Sender).BlockCount = 0 then - DoChange; -end; - -function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): string; -var - Line: string; - Len, Start, Stop: Integer; -begin - Result := ''; - if (XY.Line >= 1) and (XY.Line <= Lines.Count) then - begin - Line := Lines[XY.Line - 1]; - Len := Length(Line); - if (Len > 0) and - ((XY.Char >= 1) and (XY.Char <= Len)) and - IsIdentChar(Line[XY.Char]) then - begin - Start := XY.Char; - while (Start > 1) and IsIdentChar(Line[Start - 1]) do - Dec(Start); - - Stop := XY.Char + 1; - while (Stop <= Len) and IsIdentChar(Line[Stop]) do - Inc(Stop); - - Result := Copy(Line, Start, Stop - Start); - end; - end; -end; - -function TCustomSynEdit.BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; -// BufferToDisplayPos takes a position in the text and transforms it into -// the row and column it appears to be on the screen -var - s: string; - i, L: Integer; - x, CountOfAvgGlyphs: Integer; -begin - Canvas.Font := Font; - - Result := TDisplayCoord(p); - if p.Line - 1 < Lines.Count then - begin - s := Lines[p.Line - 1]; - l := Length(s); - x := 0; - for i := 1 to p.Char - 1 do begin - if (i <= l) and (s[i] = #9) then - inc(x, TabWidth - (x mod TabWidth)) - else if i <= l then - begin - if Ord(S[i]) <= $00FF then - CountOfAvgGlyphs := 1 - else - CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(s[i]) , fCharWidth); - inc(x, CountOfAvgGlyphs); - end - else - inc(x); - end; - Result.Column := x + 1; - end; - if WordWrap then - Result := fWordWrapPlugin.BufferToDisplayPos(TBufferCoord(Result)); -//++ CodeFolding - if UseCodeFolding then - Result.Row := fAllFoldRanges.FoldLineToRow(Result.Row) -//-- CodeFolding -end; - -function TCustomSynEdit.DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; -// DisplayToBufferPos takes a position on screen and transfrom it -// into position of text -var - s: string; - i, L: Integer; - x, CountOfAvgGlyphs: Integer; -begin - Canvas.Font := Font; - - if WordWrap then - Result := fWordWrapPlugin.DisplayToBufferPos(p) - else - Result := TBufferCoord(p); -//++ CodeFolding - if UseCodeFolding then - Result.Line := fAllFoldRanges.FoldRowToLine(p.Row); -//-- CodeFolding - - if Result.Line <= lines.Count then - begin - s := Lines[Result.Line -1]; - l := Length(s); - x := 0; - i := 0; - - while x < Result.Char do - begin - inc(i); - if (i <= l) and (s[i] = #9) then - inc(x, TabWidth - (x mod TabWidth)) - else if i <= l then - begin - if Ord(s[i]) <= $00FF then - CountOfAvgGlyphs := 1 - else - CountOfAvgGlyphs := CeilOfIntDiv(fTextDrawer.TextWidth(s[i]) , fCharWidth); - inc(x, CountOfAvgGlyphs); - end - else - inc(x); - end; - Result.Char := i; - end; -end; - -procedure TCustomSynEdit.DoLinesDeleted(FirstLine, Count: Integer); -var - i: Integer; -begin - // gutter marks - for i := 0 to Marks.Count - 1 do - if Marks[i].Line >= FirstLine + Count then - Marks[i].Line := Marks[i].Line - Count - else if Marks[i].Line > FirstLine then - Marks[i].Line := FirstLine; - - // plugins - if fPlugins <> nil then - for i := 0 to fPlugins.Count - 1 do - TSynEditPlugin(fPlugins[i]).LinesDeleted(FirstLine, Count); -end; - -procedure TCustomSynEdit.DoLinesInserted(FirstLine, Count: Integer); -var - i: Integer; -begin - // gutter marks - for i := 0 to Marks.Count - 1 do - if Marks[i].Line >= FirstLine then - Marks[i].Line := Marks[i].Line + Count; - - // plugins - if fPlugins <> nil then - for i := 0 to fPlugins.Count - 1 do - TSynEditPlugin(fPlugins[i]).LinesInserted(FirstLine, Count); -end; - -procedure TCustomSynEdit.PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; - FirstLine, LastLine: Integer); -var - i: Integer; -begin - if fPlugins <> nil then - for i := 0 to fPlugins.Count - 1 do - TSynEditPlugin(fPlugins[i]).AfterPaint(ACanvas, AClip, FirstLine, LastLine); -end; - -procedure TCustomSynEdit.ProperSetLine(ALine: Integer; const ALineText: string); -begin - if eoTrimTrailingSpaces in Options then - Lines[ALine] := TrimTrailingSpaces(ALineText) - else - Lines[ALine] := ALineText; -end; - -procedure TCustomSynEdit.QuadrupleClick; -begin - if not (eoNoSelection in fOptions) then - SelectAll; - if Assigned(fOnQudrupleClick) then - fOnQudrupleClick(Self); -end; - -procedure TCustomSynEdit.AddKeyUpHandler(aHandler: TKeyEvent); -begin - fKbdHandler.AddKeyUpHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveKeyUpHandler(aHandler: TKeyEvent); -begin - fKbdHandler.RemoveKeyUpHandler(aHandler); -end; - -procedure TCustomSynEdit.AddKeyDownHandler(aHandler: TKeyEvent); -begin - fKbdHandler.AddKeyDownHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveKeyDownHandler(aHandler: TKeyEvent); -begin - fKbdHandler.RemoveKeyDownHandler(aHandler); -end; - -procedure TCustomSynEdit.AddKeyPressHandler(aHandler: TKeyPressEvent); -begin - fKbdHandler.AddKeyPressHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveKeyPressHandler(aHandler: TKeyPressEvent); -begin - fKbdHandler.RemoveKeyPressHandler(aHandler); -end; - -procedure TCustomSynEdit.AddFocusControl(aControl: TWinControl); -begin - fFocusList.Add(aControl); -end; - -procedure TCustomSynEdit.RemoveFocusControl(aControl: TWinControl); -begin - fFocusList.Remove(aControl); -end; - -function TCustomSynEdit.IsIdentChar(AChar: WideChar): Boolean; -begin - if Assigned(Highlighter) then - Result := Highlighter.IsIdentChar(AChar) - else - Result := AChar >= #33; - - if Assigned(Highlighter) then - Result := Result or CharInSet(AChar, Highlighter.AdditionalIdentChars) - else - Result := Result or CharInSet(AChar, Self.AdditionalIdentChars); - - Result := Result and not IsWordBreakChar(AChar); -end; - -function TCustomSynEdit.IsWhiteChar(AChar: WideChar): Boolean; -begin - if Assigned(Highlighter) then - Result := Highlighter.IsWhiteChar(AChar) - else - case AChar of - #0..#32: - Result := True; - else - Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) - end -end; - -function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolean; -begin - if Assigned(Highlighter) then - Result := Highlighter.IsWordBreakChar(AChar) - else - case AChar of - #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), '`', - WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', - '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', - '/', '\', '|': - Result := True; - else - Result := False; - end; - - if Assigned(Highlighter) then - begin - Result := Result or CharInSet(AChar, Highlighter.AdditionalWordBreakChars); - Result := Result and not CharInSet(AChar, Highlighter.AdditionalIdentChars); - end - else - begin - Result := Result or CharInSet(AChar, Self.AdditionalWordBreakChars); - Result := Result and not CharInSet(AChar, Self.AdditionalIdentChars); - end; -end; - -procedure TCustomSynEdit.SetSearchEngine(Value: TSynEditSearchCustom); -begin - if (fSearchEngine <> Value) then - begin - fSearchEngine := Value; - if Assigned(fSearchEngine) then - fSearchEngine.FreeNotification(Self); - end; -end; - -function TCustomSynEdit.NextWordPos: TBufferCoord; -begin - Result := NextWordPosEx(CaretXY); -end; - -function TCustomSynEdit.WordStart: TBufferCoord; -begin - Result := WordStartEx(CaretXY); -end; - -function TCustomSynEdit.WordEnd: TBufferCoord; -begin - Result := WordEndEx(CaretXY); -end; - -function TCustomSynEdit.PrevWordPos: TBufferCoord; -begin - Result := PrevWordPosEx(CaretXY); -end; - -function TCustomSynEdit.GetPositionOfMouse(out aPos: TBufferCoord): Boolean; -// Get XY caret position of mouse. Returns False if point is outside the -// region of the SynEdit control. -var - Point: TPoint; -begin - GetCursorPos(Point); // mouse position (on screen) - Point := Self.ScreenToClient(Point); // convert to SynEdit coordinates - { Make sure it fits within the SynEdit bounds } - if (Point.X < 0) or (Point.Y < 0) or (Point.X > Self.Width) or (Point.Y> Self.Height) then - begin - Result := False; - Exit; - end; - - { inside the editor, get the word under the mouse pointer } - aPos := DisplayToBufferPos(PixelsToRowColumn(Point.X, Point.Y)); - Result := True; -end; - -function TCustomSynEdit.GetWordAtMouse: string; -var - Point: TBufferCoord; -begin - { Return the word under the mouse } - if GetPositionOfMouse(Point) then // if point is valid - Result := Self.GetWordAtRowCol(Point); // return the point at the mouse position -end; - -function TCustomSynEdit.CharIndexToRowCol(Index: Integer): TBufferCoord; -{ Index is 0-based; Result.x and Result.y are 1-based } -var - x, y, Chars: Integer; -begin - x := 0; - y := 0; - Chars := 0; - while y < Lines.Count do - begin - x := Length(Lines[y]); - if Chars + x + 2 > Index then - begin - x := Index - Chars; - break; - end; - Inc(Chars, x + 2); - x := 0; - Inc(y); - end; - Result.Char := x + 1; - Result.Line := y + 1; -end; - -function TCustomSynEdit.RowColToCharIndex(RowCol: TBufferCoord): Integer; -{ Row and Col are 1-based; Result is 0-based } -var - synEditStringList : TSynEditStringList; -begin - RowCol.Line := Max(0, Min(Lines.Count, RowCol.Line) - 1); - synEditStringList := (FLines as TSynEditStringList); - // CharIndexToRowCol assumes a line break size of two - Result := synEditStringList.LineCharIndex(RowCol.Line) - + RowCol.Line * 2 + (RowCol.Char -1); -end; - -procedure TCustomSynEdit.Clear; -{ just to attain interface compatibility with TMemo } -begin - ClearAll; -end; - -function TCustomSynEdit.GetSelLength: Integer; -begin - if SelAvail then - Result := RowColToCharIndex(BlockEnd) - RowColToCharIndex(BlockBegin) - else - Result := 0; -end; - -procedure TCustomSynEdit.SetSelLength(const Value: Integer); -var - iNewCharIndex: Integer; - iNewBegin: TBufferCoord; - iNewEnd: TBufferCoord; -begin - iNewCharIndex := RowColToCharIndex(BlockBegin) + Value; - if (Value >= 0) or (iNewCharIndex < 0) then - begin - if iNewCharIndex < 0 then - begin - iNewEnd.Char := Length(Lines[Lines.Count - 1]) + 1; - iNewEnd.Line := Lines.Count; - end - else - iNewEnd := CharIndexToRowCol(iNewCharIndex); - SetCaretAndSelection(iNewEnd, BlockBegin, iNewEnd); - end - else begin - iNewBegin := CharIndexToRowCol(iNewCharIndex); - SetCaretAndSelection(iNewBegin, iNewBegin, BlockBegin); - end; -end; - -procedure TCustomSynEdit.DefineProperties(Filer: TFiler); - - function CollectionsEqual(C1, C2: TCollection): Boolean; - begin - Result := Classes.CollectionsEqual(C1, C2, nil, nil); - end; - - function HasKeyData: Boolean; - var - iDefKeys: TSynEditKeyStrokes; - begin - if Filer.Ancestor <> nil then - begin - Result := not CollectionsEqual(Keystrokes, - TCustomSynEdit(Filer.Ancestor).Keystrokes); - end - else begin - iDefKeys := TSynEditKeyStrokes.Create(nil); - try - iDefKeys.ResetDefaults; - Result := not CollectionsEqual(Keystrokes, iDefKeys); - finally - iDefKeys.Free; - end; - end; - end; - -var - iSaveKeyData: Boolean; -begin - inherited; - iSaveKeyData := HasKeyData; - Filer.DefineProperty('RemovedKeystrokes', ReadRemovedKeystrokes, - WriteRemovedKeystrokes, iSaveKeyData); - Filer.DefineProperty('AddedKeystrokes', ReadAddedKeystrokes, WriteAddedKeystrokes, - iSaveKeyData); -end; - -procedure TCustomSynEdit.DoChange; -begin - if Assigned(fOnChange) then - fOnChange(Self); -end; - -procedure TCustomSynEdit.ReadAddedKeystrokes(Reader: TReader); -var - iAddKeys: TSynEditKeyStrokes; - cKey: Integer; -begin - if Reader.NextValue = vaCollection then - Reader.ReadValue - else - Exit; - iAddKeys := TSynEditKeyStrokes.Create(Self); - try - Reader.ReadCollection(iAddKeys); - for cKey := 0 to iAddKeys.Count -1 do - Keystrokes.Add.Assign(iAddKeys[cKey]); - finally - iAddKeys.Free; - end; -end; - -procedure TCustomSynEdit.ReadRemovedKeystrokes(Reader: TReader); -var - iDelKeys: TSynEditKeyStrokes; - cKey: Integer; - iKey: TSynEditKeyStroke; - iToDelete: Integer; -begin - if Reader.NextValue = vaCollection then - Reader.ReadValue - else - Exit; - iDelKeys := TSynEditKeyStrokes.Create(nil); - try - Reader.ReadCollection(iDelKeys); - for cKey := 0 to iDelKeys.Count -1 do - begin - iKey := iDelKeys[cKey]; - iToDelete := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); - if (iToDelete >= 0) and (Keystrokes[iToDelete].Command = iKey.Command) then - Keystrokes[iToDelete].Free; - end; - finally - iDelKeys.Free; - end; -end; - -procedure TCustomSynEdit.WriteAddedKeystrokes(Writer: TWriter); -var - iDefaultKeys: TSynEditKeyStrokes; - iAddedKeys: TSynEditKeyStrokes; - cKey: Integer; - iKey: TSynEditKeyStroke; - iDelIndex: Integer; -begin - iDefaultKeys := TSynEditKeyStrokes.Create(nil); - try - if Writer.Ancestor <> nil then - iDefaultKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes) - else - iDefaultKeys.ResetDefaults; - iAddedKeys := TSynEditKeyStrokes.Create(nil); - try - for cKey := 0 to Keystrokes.Count -1 do - begin - iKey := Keystrokes[cKey]; - iDelIndex := iDefaultKeys.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); - //if it's not a default keystroke, add it - if (iDelIndex < 0) or (iDefaultKeys[iDelIndex].Command <> iKey.Command) then - iAddedKeys.Add.Assign(iKey); - end; - Writer.WriteCollection(iAddedKeys); - finally - iAddedKeys.Free; - end; - finally - iDefaultKeys.Free; - end; -end; - -procedure TCustomSynEdit.WriteRemovedKeystrokes(Writer: TWriter); -var - iRemovedKeys: TSynEditKeyStrokes; - cKey: Integer; - iKey: TSynEditKeyStroke; - iFoundAt: Integer; -begin - iRemovedKeys := TSynEditKeyStrokes.Create(nil); - try - if Writer.Ancestor <> nil then - iRemovedKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes) - else - iRemovedKeys.ResetDefaults; - cKey := 0; - while cKey < iRemovedKeys.Count do - begin - iKey := iRemovedKeys[cKey]; - iFoundAt := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); - if (iFoundAt >= 0) and (Keystrokes[iFoundAt].Command = iKey.Command) then - iKey.Free //if exists in Keystrokes, then shouldn't be in "removed" list - else - Inc(cKey); - end; - Writer.WriteCollection(iRemovedKeys); - finally - iRemovedKeys.Free; - end; -end; - -procedure TCustomSynEdit.AddMouseDownHandler(aHandler: TMouseEvent); -begin - fKbdHandler.AddMouseDownHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveMouseDownHandler(aHandler: TMouseEvent); -begin - fKbdHandler.RemoveMouseDownHandler(aHandler); -end; - -procedure TCustomSynEdit.AddMouseUpHandler(aHandler: TMouseEvent); -begin - fKbdHandler.AddMouseUpHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveMouseUpHandler(aHandler: TMouseEvent); -begin - fKbdHandler.RemoveMouseUpHandler(aHandler); -end; - -//++ CodeFolding - -procedure TCustomSynEdit.FullFoldScan; -begin - if UseCodeFolding then - begin - ReScanForFoldRanges(0, fLines.Count -1); - end; -end; - -procedure TCustomSynEdit.ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); -Var - AdjustedToLine: Integer; -begin - AdjustedToLine := Max(Min(ToLine, Lines.Count - 1), FromLine); - fAllFoldRanges.StartScanning; - ScanForFoldRanges(fAllFoldRanges, fLines, FromLine, AdjustedToLine); - { StopScanning recreates AllFoldRanges. - Normally at this point (sfLinesChanging in fStateFlags) = True - and StopScanning will be called when LinesChanged is executed } - if not (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then - begin - if fHighlighter is TSynCustomCodeFoldingHighlighter then - TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, - fLines); - InvalidateGutter; - Include(fStateFlags, sfScrollbarChanged); - end; -end; - -procedure TCustomSynEdit.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); -begin - if fHighlighter is TSynCustomCodeFoldingHighlighter then - TSynCustomCodeFoldingHighlighter(fHighlighter).ScanForFoldRanges(FoldRanges, - LinesToScan, FromLine, ToLine); - - if Assigned(fOnScanForFoldRanges) then - fOnScanForFoldRanges(Self, FoldRanges, LinesToScan, FromLine, ToLine); -end; -//-- CodeFolding - -procedure TCustomSynEdit.AddMouseCursorHandler(aHandler: TMouseCursorEvent); -begin - fKbdHandler.AddMouseCursorHandler(aHandler); -end; - -procedure TCustomSynEdit.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); -begin - fKbdHandler.RemoveMouseCursorHandler(aHandler); -end; - -procedure TCustomSynEdit.DoSearchFindFirstExecute(Action: TSearchFindFirst); -begin - OnFindBeforeSearch := Action.Dialog.OnFind; - OnCloseBeforeSearch := Action.Dialog.OnClose; - SelStartBeforeSearch := SelStart; SelLengthBeforeSearch := SelLength; - - Action.Dialog.OnFind := FindDialogFindFirst; - Action.Dialog.OnClose := FindDialogClose; - Action.Dialog.Execute(); -end; - -procedure TCustomSynEdit.DoSearchFindExecute(Action: TSearchFind); -begin - OnFindBeforeSearch := Action.Dialog.OnFind; - OnCloseBeforeSearch := Action.Dialog.OnClose; - - Action.Dialog.OnFind := FindDialogFind; - Action.Dialog.OnClose := FindDialogClose; - Action.Dialog.Execute(); -end; - -procedure TCustomSynEdit.DoSearchReplaceExecute(Action: TSearchReplace); -begin - OnFindBeforeSearch := Action.Dialog.OnFind; - OnReplaceBeforeSearch := Action.Dialog.OnReplace; - OnCloseBeforeSearch := Action.Dialog.OnClose; - - Action.Dialog.OnFind := FindDialogFind; - Action.Dialog.OnReplace := FindDialogFind; - Action.Dialog.OnClose := FindDialogClose; - Action.Dialog.Execute(); -end; - -procedure TCustomSynEdit.DoSearchFindNextExecute(Action: TSearchFindNext); -begin - SearchByFindDialog(Action.SearchFind.Dialog); -end; - -procedure TCustomSynEdit.FindDialogFindFirst(Sender: TObject); -begin - TFindDialog(Sender).CloseDialog; - - if (SelStart = SelStartBeforeSearch) and (SelLength = SelLengthBeforeSearch) then - begin - SelStart := 0; - SelLength := 0; - end; - - if Sender is TFindDialog then - if not SearchByFindDialog(TFindDialog(Sender)) and (SelStart = 0) and (SelLength = 0) then - begin - SelStart := SelStartBeforeSearch; - SelLength := SelLengthBeforeSearch; - end; -end; - -procedure TCustomSynEdit.FindDialogFind(Sender: TObject); -begin - if Sender is TFindDialog then - SearchByFindDialog(TFindDialog(Sender)); -end; - -function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDialog) : bool; -var - Options :TSynSearchOptions; - ReplaceText, MessageText :String; - OldSelStart, OldSelLength: integer; -begin - if (frReplaceAll in FindDialog.Options) then Options := [ssoReplaceAll] - else if (frReplace in FindDialog.Options) then Options := [ssoReplace] - else Options := [ssoSelectedOnly]; - - if (frMatchCase in FindDialog.Options) then Options := Options + [ssoMatchCase]; - if (frWholeWord in FindDialog.Options) then Options := Options + [ssoWholeWord]; - if (not (frDown in FindDialog.Options)) then Options := Options + [ssoBackwards]; - - if (ssoSelectedOnly in Options) - then ReplaceText := '' - else ReplaceText := TReplaceDialog(FindDialog).ReplaceText; - - OldSelStart := SelStart; OldSelLength := SelLength; - if (UpperCase(SelText) = UpperCase(FindDialog.FindText)) and not (frReplace in FindDialog.Options) then - SelStart := SelStart + SelLength - else - SelLength := 0; - - Result := SearchReplace(FindDialog.FindText, ReplaceText, Options) > 0; - if not Result then - begin - SelStart := OldSelStart; SelLength := OldSelLength; - if Assigned(OnSearchNotFound) then - OnSearchNotFound(self, FindDialog.FindText) - else - begin - MessageText := Format(STextNotFound, [FindDialog.FindText]); - ShowMessage(MessageText); - end; - end - else if (frReplace in FindDialog.Options) then - begin - SelStart := SelStart - Length(FindDialog.FindText) - 1; - SelLength := Length(FindDialog.FindText) + 1; - end; -end; - -procedure TCustomSynEdit.FindDialogClose(Sender: TObject); -begin - TFindDialog(Sender).OnFind := OnFindBeforeSearch; - if Sender is TReplaceDialog then - TReplaceDialog(Sender).OnReplace := OnReplaceBeforeSearch; - TFindDialog(Sender).OnClose := OnCloseBeforeSearch; -end; - -function TCustomSynEdit.GetWordWrap: Boolean; -begin - Result := fWordWrapPlugin <> nil; -end; - -procedure TCustomSynEdit.SetWordWrap(const Value: Boolean); -var - vOldTopLine: Integer; - vShowCaret: Boolean; -begin - if WordWrap <> Value then - begin - Invalidate; // better Invalidate before changing LeftChar and TopLine - vShowCaret := CaretInView; - vOldTopLine := RowToLine(TopLine); -//++ CodeFolding - // !!Mutually exclusive with CodeFolding to reduce complexity - if Value and not UseCodeFolding then -//-- CodeFolding - begin - fWordWrapPlugin := TSynWordWrapPlugin.Create(Self); - LeftChar := 1; - end - else - fWordWrapPlugin := nil; - TopLine := LineToRow(vOldTopLine); - UpdateScrollBars; - - if vShowCaret then - EnsureCursorPosVisible; - end; -end; - -function TCustomSynEdit.GetDisplayLineCount: Integer; -begin -//++ CodeFolding - if fWordWrapPlugin = nil then begin - if fUseCodeFolding then - Result := LineToRow(Lines.Count) - else - Result := Lines.Count - end else if Lines.Count = 0 then -//++ CodeFolding - Result := 0 - else begin - Result := fWordWrapPlugin.RowCount; - end; -end; - -function TCustomSynEdit.LineToRow(aLine: Integer): Integer; -var - vBufferPos: TBufferCoord; -begin -//++ CodeFolding - if not UseCodeFolding and not WordWrap then -//-- CodeFolding - Result := aLine - else begin - vBufferPos.Char := 1; - vBufferPos.Line := aLine; - Result := BufferToDisplayPos(vBufferPos).Row; - end; -end; - -function TCustomSynEdit.RowToLine(aRow: Integer): Integer; -var - vDisplayPos: TDisplayCoord; -begin -//++ CodeFolding - if not UseCodeFolding and not WordWrap then -//-- CodeFolding - Result := aRow - else begin - vDisplayPos.Column := 1; - vDisplayPos.Row := aRow; - Result := DisplayToBufferPos(vDisplayPos).Line; - end; -end; - -procedure TCustomSynEdit.SetInternalDisplayXY(const aPos: TDisplayCoord); -begin - IncPaintLock; - InternalCaretXY := DisplayToBufferPos(aPos); - fCaretAtEOL := WordWrap and (aPos.Row <= fWordWrapPlugin.RowCount) and - (aPos.Column > fWordWrapPlugin.GetRowLength(aPos.Row)) and - (DisplayY <> aPos.Row); - DecPaintLock; - UpdateLastCaretX; -end; - -procedure TCustomSynEdit.SetWantReturns(Value: Boolean); -begin - fWantReturns := Value; -end; - -procedure TCustomSynEdit.SetWantTabs(Value: Boolean); -begin - fWantTabs := Value; -end; - -procedure TCustomSynEdit.SetWordWrapGlyph(const Value: TSynGlyph); -begin - fWordWrapGlyph.Assign(Value); -end; - -procedure TCustomSynEdit.WordWrapGlyphChange(Sender: TObject); -begin - if not (csLoading in ComponentState) then - InvalidateGutter; -end; - -{ TSynEditMark } - -function TSynEditMark.GetEdit: TCustomSynEdit; -begin - if FEdit <> nil then try - if FEdit.Marks.IndexOf(self) = -1 then - FEdit := nil; - except - FEdit := nil; - end; - Result := FEdit; -end; - -function TSynEditMark.GetIsBookmark: Boolean; -begin - Result := (fBookmarkNum >= 0); -end; - -procedure TSynEditMark.SetChar(const Value: Integer); -begin - FChar := Value; -end; - -procedure TSynEditMark.SetImage(const Value: Integer); -begin - FImage := Value; - if fVisible and Assigned(fEdit) then - fEdit.InvalidateGutterLines(fLine, fLine); -end; - -procedure TSynEditMark.SetInternalImage(const Value: Boolean); -begin - fInternalImage := Value; - if fVisible and Assigned(fEdit) then - fEdit.InvalidateGutterLines(fLine, fLine); -end; - -procedure TSynEditMark.SetLine(const Value: Integer); -begin - if fVisible and Assigned(fEdit) then - begin - if fLine > 0 then - fEdit.InvalidateGutterLines(fLine, fLine); - fLine := Value; - fEdit.InvalidateGutterLines(fLine, fLine); - end - else - fLine := Value; -end; - -procedure TSynEditMark.SetVisible(const Value: Boolean); -begin - if fVisible <> Value then - begin - fVisible := Value; - if Assigned(fEdit) then - fEdit.InvalidateGutterLines(fLine, fLine); - end; -end; - -constructor TSynEditMark.Create(AOwner: TCustomSynEdit); -begin - inherited Create; - fBookmarkNum := -1; - fEdit := AOwner; -end; - -{ TSynEditMarkList } - -procedure TSynEditMarkList.Notify(Ptr: Pointer; Action: TListNotification); -begin - inherited; - if Assigned(FOnChange) then - FOnChange(Self); -end; - -function TSynEditMarkList.GetItem(Index: Integer): TSynEditMark; -begin - Result := TSynEditMark(inherited GetItem(Index)); -end; - -procedure TSynEditMarkList.SetItem(Index: Integer; Item: TSynEditMark); -begin - inherited SetItem(Index, Item); -end; - -constructor TSynEditMarkList.Create(AOwner: TCustomSynEdit); -begin - inherited Create; - fEdit := AOwner; -end; - -function TSynEditMarkList.First: TSynEditMark; -begin - Result := TSynEditMark(inherited First); -end; - -function TSynEditMarkList.Last: TSynEditMark; -begin - result := TSynEditMark(inherited Last); -end; - -function TSynEditMarkList.Extract(Item: TSynEditMark): TSynEditMark; -begin - Result := TSynEditMark(inherited Extract(Item)); -end; - -procedure TSynEditMarkList.ClearLine(Line: Integer); -var - i: Integer; -begin - for i := Count - 1 downto 0 do - if not Items[i].IsBookmark and (Items[i].Line = Line) then - Delete(i); -end; - -procedure TSynEditMarkList.GetMarksForLine(line: Integer; var marks: TSynEditMarks); -//Returns up to maxMarks book/gutter marks for a chosen line. -var - cnt: Integer; - i: Integer; -begin - FillChar(marks, SizeOf(marks), 0); - cnt := 0; - for i := 0 to Count - 1 do - begin - if Items[i].Line = line then - begin - Inc(cnt); - marks[cnt] := Items[i]; - if cnt = MAX_MARKS then break; - end; - end; -end; - -procedure TSynEditMarkList.Place(mark: TSynEditMark); -begin - if assigned(fEdit) then - if Assigned(fEdit.OnPlaceBookmark) then - fEdit.OnPlaceBookmark(fEdit, mark); - if assigned(mark) then - Add(mark); -end; - -{ TSynEditPlugin } - -constructor TSynEditPlugin.Create(AOwner: TCustomSynEdit); -begin - inherited Create; - if AOwner <> nil then - begin - fOwner := AOwner; - if fOwner.fPlugins = nil then - fOwner.fPlugins := TObjectList.Create; - fOwner.fPlugins.Add(Self); - end; -end; - -destructor TSynEditPlugin.Destroy; -begin - if fOwner <> nil then - fOwner.fPlugins.Extract(Self); // we are being destroyed, fOwner should not free us - inherited Destroy; -end; - -procedure TSynEditPlugin.AfterPaint(ACanvas: TCanvas; const AClip: TRect; - FirstLine, LastLine: Integer); -begin - // nothing -end; - -procedure TSynEditPlugin.PaintTransient(ACanvas: TCanvas; ATransientType: TTransientType); -begin - // nothing -end; - -procedure TSynEditPlugin.LinesInserted(FirstLine, Count: Integer); -begin - // nothing -end; - -procedure TSynEditPlugin.LinesDeleted(FirstLine, Count: Integer); -begin - // nothing -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEdit.pas, released 2000-04-07. +The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of +the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +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: SynEdit.pas,v 1.32.1 2012/19/09 10:50:00 CodehunterWorks Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +- Undo is buggy when dealing with Hard Tabs (when inserting text after EOL and + when trimming). + +-------------------------------------------------------------------------------} +//todo: remove SynEdit Clipboard Format? +//todo: in WordWrap mode, parse lines only once in PaintLines() +//todo: Remove checks for WordWrap. Must abstract the behaviour with the plugins instead. +//todo: Move WordWrap glyph to the WordWrap plugin. +//todo: remove FShowSpecChar variable +//todo: remove the several Undo block types? + +unit SynEdit; + +{$I SynEdit.inc} + +interface + +uses + Controls, + Contnrs, + Graphics, + Forms, + StdCtrls, + ExtCtrls, + Windows, + Messages, + {$IFDEF SYN_COMPILER_4_UP} + StdActns, + Dialogs, + {$ENDIF} + {$IFDEF SYN_COMPILER_7} + Themes, + {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + Types, UITypes, + {$ENDIF} + Imm, + SynUnicode, + SynTextDrawer, + SynEditTypes, + SynEditKeyConst, + SynEditMiscProcs, + SynEditMiscClasses, + SynEditTextBuffer, + SynEditKeyCmds, + SynEditHighlighter, + SynEditKbdHandler, +{$IFDEF SYN_CodeFolding} + SynEditCodeFolding, +{$ENDIF} +{$IFDEF UNICODE} + WideStrUtils, +{$ENDIF} + Math, + SysUtils, + Classes; + +const +{$IFNDEF SYN_COMPILER_3_UP} + // not defined in all Delphi versions + WM_MOUSEWHEEL = $020A; +{$ENDIF} +{$IFNDEF SYN_COMPILER_7_UP} + // not defined in all Delphi versions + WS_EX_COMPOSITED = $02000000; +{$ENDIF} + + // maximum scroll range + MAX_SCROLL = 32767; + + // Max number of book/gutter marks returned from GetEditMarksForLine - that + // really should be enough. + MAX_MARKS = 16; + + SYNEDIT_CLIPBOARD_FORMAT = 'SynEdit Control Block Type'; + + // Reconversion string. + IMR_COMPOSITIONWINDOW = $0001; + IMR_CANDIDATEWINDOW = $0002; + IMR_COMPOSITIONFONT = $0003; + IMR_RECONVERTSTRING = $0004; + IMR_CONFIRMRECONVERTSTRING = $0005; + IMR_QUERYCHARPOSITION = $0006; + IMR_DOCUMENTFEED = $0007; + + SCS_SETSTR = GCS_COMPREADSTR or GCS_COMPSTR; + SCS_CHANGEATTR = GCS_COMPREADATTR or GCS_COMPATTR; + SCS_CHANGECLAUSE = GCS_COMPREADCLAUSE or GCS_COMPCLAUSE; + SCS_SETRECONVERTSTRING = $00010000; + SCS_QUERYRECONVERTSTRING = $00020000; + +var + SynEditClipboardFormat: UINT; + +type + TBufferCoord = SynEditTypes.TBufferCoord; + TDisplayCoord = SynEditTypes.TDisplayCoord; + + TSynBorderStyle = TBorderStyle; + + TSynReplaceAction = (raCancel, raSkip, raReplace, raReplaceAll); + + ESynEditError = class(ESynError); + + TDropFilesEvent = procedure(Sender: TObject; X, Y: Integer; AFiles: TUnicodeStrings) + of object; + + THookedCommandEvent = procedure(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data, HandlerData: Pointer) of object; + + TPaintEvent = procedure(Sender: TObject; ACanvas: TCanvas) of object; + + TProcessCommandEvent = procedure(Sender: TObject; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer) of object; + + TReplaceTextEvent = procedure(Sender: TObject; const ASearch, AReplace: + UnicodeString; Line, Column: Integer; var Action: TSynReplaceAction) of object; + + TSpecialLineColorsEvent = procedure(Sender: TObject; Line: Integer; + var Special: Boolean; var FG, BG: TColor) of object; + TSpecialTokenAttributesEvent = procedure(Sender: TObject; ALine, APos: Integer; const AToken: string; + var ASpecial: Boolean; var FG, BG: TColor; var AStyle: TFontStyles) of object; + + TTransientType = (ttBefore, ttAfter); + TPaintTransient = procedure(Sender: TObject; Canvas: TCanvas; + TransientType: TTransientType) of object; + + TScrollEvent = procedure(Sender: TObject; ScrollBar: TScrollBarKind) of object; + + TGutterGetTextEvent = procedure(Sender: TObject; aLine: Integer; + var aText: UnicodeString) of object; + + TGutterPaintEvent = procedure(Sender: TObject; aLine: Integer; + X, Y: Integer) of object; + + TSynEditCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock, ctVerticalLine2); + + TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesChanging, + sfIgnoreNextChar, sfCaretVisible, sfDblClicked, sfPossibleGutterClick, + sfWaitForDragging, sfInsideRedo, sfGutterDragging, sfMouseCaptured); + + TSynStateFlags = set of TSynStateFlag; + + TScrollHintFormat = (shfTopLineOnly, shfTopToBottom); + + TSynHintMode = (shmDefault, shmToken); + + TGetTokenHintEvent = procedure(Sender: TObject; Coords: TBufferCoord; const Token: string; + TokenType: Integer; Attri: TSynHighlighterAttributes; var HintText: string) of object; + + TSynEditorOption = ( + eoAltSetsColumnMode, //Holding down the Alt Key will put the selection mode into columnar format + eoAutoIndent, //Will indent the caret on new lines with the same amount of leading white space as the preceding line + eoAutoSizeMaxScrollWidth, //Automatically resizes the MaxScrollWidth property when inserting text + eoDisableScrollArrows, //Disables the scroll bar arrow buttons when you can't scroll in that direction any more + eoDragDropEditing, //Allows you to select a block of text and drag it within the document to another location + eoDropFiles, //Allows the editor accept OLE file drops + eoEnhanceHomeKey, //enhances home key positioning, similar to visual studio + eoEnhanceEndKey, //enhances End key positioning, similar to JDeveloper + eoGroupUndo, //When undoing/redoing actions, handle all continous changes of the same kind in one call instead undoing/redoing each command separately + eoHalfPageScroll, //When scrolling with page-up and page-down commands, only scroll a half page at a time + eoHideShowScrollbars, //if enabled, then the scrollbars will only show when necessary. If you have ScrollPastEOL, then it the horizontal bar will always be there (it uses MaxLength instead) + eoKeepCaretX, //When moving through lines w/o Cursor Past EOL, keeps the X position of the cursor + eoNoCaret, //Makes it so the caret is never visible + eoNoSelection, //Disables selecting text + eoRightMouseMovesCursor, //When clicking with the right mouse for a popup menu, move the cursor to that location + eoScrollByOneLess, //Forces scrolling to be one less + eoScrollHintFollows, //The scroll hint follows the mouse when scrolling vertically + eoScrollPastEof, //Allows the cursor to go past the end of file marker + eoScrollPastEol, //Allows the cursor to go past the last character into the white space at the end of a line + eoShowScrollHint, //Shows a hint of the visible line numbers when scrolling vertically + eoShowSpecialChars, //Shows the special Characters + eoSmartTabDelete, //similar to Smart Tabs, but when you delete characters + eoSmartTabs, //When tabbing, the cursor will go to the next non-white space character of the previous line + eoSpecialLineDefaultFg, //disables the foreground text color override when using the OnSpecialLineColor event + eoTabIndent, //When active and act as block indent, unindent when text is selected + eoTabsToSpaces, //Converts a tab character to a specified number of space characters + eoTrimTrailingSpaces //Spaces at the end of lines will be trimmed and not saved + ); + + TSynEditorOptions = set of TSynEditorOption; + + TSynFontSmoothMethod = (fsmNone, fsmAntiAlias, fsmClearType); + +const + SYNEDIT_DEFAULT_OPTIONS = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, + eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces, + eoSmartTabDelete, eoGroupUndo]; + +type + TCreateParamsW = record + Caption: PWideChar; + Style: DWORD; + ExStyle: DWORD; + X, Y: Integer; + Width, Height: Integer; + WndParent: HWnd; + Param: Pointer; + WindowClass: TWndClassW; + WinClassName: array[0..63] of WideChar; + InternalCaption: UnicodeString; + end; + +type +// use scAll to update a statusbar when another TCustomSynEdit got the focus + TSynStatusChange = (scAll, scCaretX, scCaretY, scLeftChar, scTopLine, + scInsertMode, scModified, scSelection, scReadOnly); + TSynStatusChanges = set of TSynStatusChange; + + TContextHelpEvent = procedure(Sender: TObject; Word: UnicodeString) + of object; + + TStatusChangeEvent = procedure(Sender: TObject; Changes: TSynStatusChanges) + of object; + + TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; + var aCursor: TCursor) of object; + +{$IFDEF SYN_CodeFolding} + TScanForFoldRangesEvent = procedure(Sender: TObject; + FoldRanges: TSynFoldRanges; LinesToScan: TStrings; + FromLine : Integer; ToLine : Integer) of object; +{$ENDIF} + + TCustomSynEdit = class; + + TSynEditMark = class + protected + FLine, FChar, FImage: Integer; + FEdit: TCustomSynEdit; + FVisible: Boolean; + FInternalImage: Boolean; + FBookmarkNum: Integer; + function GetEdit: TCustomSynEdit; virtual; + procedure SetChar(const Value: Integer); virtual; + procedure SetImage(const Value: Integer); virtual; + procedure SetLine(const Value: Integer); virtual; + procedure SetVisible(const Value: Boolean); + procedure SetInternalImage(const Value: Boolean); + function GetIsBookmark: Boolean; + public + constructor Create(AOwner: TCustomSynEdit); + property Line: Integer read FLine write SetLine; + property Char: Integer read FChar write SetChar; + property Edit: TCustomSynEdit read FEdit; + property ImageIndex: Integer read FImage write SetImage; + property BookmarkNumber: Integer read FBookmarkNum write FBookmarkNum; + property Visible: Boolean read FVisible write SetVisible; + property InternalImage: Boolean read FInternalImage write SetInternalImage; + property IsBookmark: Boolean read GetIsBookmark; + end; + + TPlaceMarkEvent = procedure(Sender: TObject; var Mark: TSynEditMark) + of object; + + TSynEditMarks = array[1..MAX_MARKS] of TSynEditMark; + + { A list of mark objects. Each object cause a litle picture to be drawn in the gutter. } + TSynEditMarkList = class(TObjectList) // It makes more sence to derive from TObjectList, + protected // as it automatically frees its members + FEdit: TCustomSynEdit; + FOnChange: TNotifyEvent; + procedure Notify(Ptr: Pointer; Action: TListNotification); override; + function GetItem(Index: Integer): TSynEditMark; + procedure SetItem(Index: Integer; Item: TSynEditMark); + property OwnsObjects; // This is to hide the inherited property, + public // because TSynEditMarkList always owns the marks + constructor Create(AOwner: TCustomSynEdit); + function First: TSynEditMark; + function Last: TSynEditMark; + function Extract(Item: TSynEditMark): TSynEditMark; + procedure ClearLine(line: Integer); + procedure GetMarksForLine(line: Integer; var Marks: TSynEditMarks); + procedure Place(mark: TSynEditMark); + public + property Items[Index: Integer]: TSynEditMark read GetItem write SetItem; default; + property Edit: TCustomSynEdit read FEdit; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + TGutterClickEvent = procedure(Sender: TObject; Button: TMouseButton; + X, Y, Line: Integer; Mark: TSynEditMark) of object; + + // aIndex parameters of Line notifications are 0-based. + // aRow parameter of GetRowLength() is 1-based. + ISynEditBufferPlugin = interface + // conversion methods + function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; + function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; + function RowCount: Integer; + function GetRowLength(aRow: Integer): Integer; + // plugin notifications + function LinesInserted(aIndex: Integer; aCount: Integer): Integer; + function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; + function LinesPutted(aIndex: Integer; aCount: Integer): Integer; + // font or size change + procedure DisplayChanged; + // pretty clear, heh? + procedure Reset; + end; + + TSynEditPlugin = class(TObject) + private + FOwner: TCustomSynEdit; + protected + procedure AfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: Integer); virtual; + procedure PaintTransient(ACanvas: TCanvas; ATransientType: TTransientType); virtual; + procedure LinesInserted(FirstLine, Count: Integer); virtual; + procedure LinesDeleted(FirstLine, Count: Integer); virtual; + protected + property Editor: TCustomSynEdit read FOwner; + public + constructor Create(AOwner: TCustomSynEdit); + destructor Destroy; override; + end; + +{$IFDEF SYN_COMPILER_6_UP} + TCustomSynEditSearchNotFoundEvent = procedure(Sender: TObject; + FindText: UnicodeString) of object; +{$ENDIF} + + // Reconversion string. + PReconvertString = ^TReconvertString; + TReconvertString = record + dwSize: DWord; + dwVersion: DWord; + dwStrLen: DWord; + dwStrOffset: DWord; + dwCompStrLen: DWord; + dwCompStrOffset: DWord; + dwTargetStrLen: DWord; + dwTargetStrOffset: DWord; + end; + + + TCustomSynEdit = class(TCustomControl) + private + procedure CMHintShow(var Msg: TMessage); message CM_HINTSHOW; + procedure WMCancelMode(var Message: TMessage); message WM_CANCELMODE; + procedure WMCaptureChanged(var Msg: TMessage); message WM_CAPTURECHANGED; + procedure WMChar(var Msg: TWMChar); message WM_CHAR; + procedure WMClear(var Msg: TMessage); message WM_CLEAR; + procedure WMCopy(var Message: TMessage); message WM_COPY; + procedure WMCut(var Message: TMessage); message WM_CUT; + procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES; + procedure WMDestroy(var Message: TWMDestroy); message WM_DESTROY; + procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND; + procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE; + procedure WMGetText(var Msg: TWMGetText); message WM_GETTEXT; + procedure WMGetTextLength(var Msg: TWMGetTextLength); message WM_GETTEXTLENGTH; + procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL; + procedure WMPaste(var Message: TMessage); message WM_PASTE; + procedure WMSetText(var Msg: TWMSetText); message WM_SETTEXT; + procedure WMImeChar(var Msg: TMessage); message WM_IME_CHAR; + procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION; + procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY; + procedure WMImeRequest(var Message: TMessage); message WM_IME_REQUEST; + procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; + procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR; + procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; + procedure WMSize(var Msg: TWMSize); message WM_SIZE; + procedure WMUndo(var Msg: TMessage); message WM_UNDO; + procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL; +{$IFNDEF SYN_COMPILER_6_UP} + procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; +{$ENDIF} + private +{$IFDEF SYN_CodeFolding} + fUseCodeFolding : Boolean; + fCodeFolding: TSynCodeFolding; + fAllFoldRanges: TSynFoldRanges; +{$ENDIF} + FAlwaysShowCaret: Boolean; + FBlockBegin: TBufferCoord; + FBlockEnd: TBufferCoord; + FCaretX: Integer; + FLastCaretX: Integer; + FCaretY: Integer; + FCharsInWindow: Integer; + FCharWidth: Integer; + FFontDummy: TFont; + FFontSmoothing: TSynFontSmoothMethod; + FHintMode: TSynHintMode; + FInserting: Boolean; + FLines: TUnicodeStrings; + FOrigLines: TUnicodeStrings; + FOrigUndoList: TSynEditUndoList; + FOrigRedoList: TSynEditUndoList; + FLinesInWindow: Integer; + FLeftChar: Integer; + FMaxScrollWidth: Integer; + FPaintLock: Integer; + FReadOnly: Boolean; + FRightEdge: Integer; + FRightEdgeColor: TColor; + FScrollHintColor: TColor; + FScrollHintFormat: TScrollHintFormat; + FScrollBars: TScrollStyle; + FTextHeight: Integer; + FTextOffset: Integer; + FTopLine: Integer; + FHighlighter: TSynCustomHighlighter; + FSelectedColor: TSynSelectedColor; + FActiveLineColor: TColor; + FUndoList: TSynEditUndoList; + FRedoList: TSynEditUndoList; + FBookMarks: array[0..9] of TSynEditMark; // these are just references, FMarkList is the owner + FMouseDownX: Integer; + FMouseDownY: Integer; + FBookMarkOpt: TSynBookMarkOpt; + FBorderStyle: TSynBorderStyle; + FHideSelection: Boolean; + FMouseWheelAccumulator: Integer; + FOverwriteCaret: TSynEditCaretType; + FInsertCaret: TSynEditCaretType; + FCaretOffset: TPoint; + FKeyStrokes: TSynEditKeyStrokes; + FModified: Boolean; + FMarkList: TSynEditMarkList; + FExtraLineSpacing: Integer; + FSelectionMode: TSynSelectionMode; + FActiveSelectionMode: TSynSelectionMode; //mode of the active selection + FWantReturns: Boolean; + FWantTabs: Boolean; + FWordWrapPlugin: ISynEditBufferPlugin; + FWordWrapGlyph: TSynGlyph; + FCaretAtEOL: Boolean; // used by wordwrap + + FGutter: TSynGutter; + FTabWidth: Integer; + FTextDrawer: TSynTextDrawer; + FInvalidateRect: TRect; + FStateFlags: TSynStateFlags; + FOptions: TSynEditorOptions; + FStatusChanges: TSynStatusChanges; + FLastKey: Word; + FLastShiftState: TShiftState; + FSearchEngine: TSynEditSearchCustom; + FHookedCommandHandlers: TObjectList; + FKbdHandler: TSynEditKbdHandler; + FFocusList: TList; + FPlugins: TObjectList; + FScrollTimer: TTimer; + FScrollDeltaX, fScrollDeltaY: Integer; + // event handlers + FOnChange: TNotifyEvent; + FOnClearMark: TPlaceMarkEvent; + FOnCommandProcessed: TProcessCommandEvent; + FOnDropFiles: TDropFilesEvent; + FOnGutterClick: TGutterClickEvent; + FOnKeyPressW: TKeyPressWEvent; + FOnMouseCursor: TMouseCursorEvent; + FOnPaint: TPaintEvent; + FOnPlaceMark: TPlaceMarkEvent; + FOnProcessCommand: TProcessCommandEvent; + FOnProcessUserCommand: TProcessCommandEvent; + FOnReplaceText: TReplaceTextEvent; + FOnSpecialLineColors: TSpecialLineColorsEvent; + FOnSpecialTokenAttributes: TSpecialTokenAttributesEvent; + FOnContextHelp: TContextHelpEvent; + FOnPaintTransient: TPaintTransient; + FOnScroll: TScrollEvent; + FOnTokenHint: TGetTokenHintEvent; + FOnGutterGetText: TGutterGetTextEvent; + FOnGutterPaint: TGutterPaintEvent; + FOnStatusChange: TStatusChangeEvent; +{$IFDEF SYN_CodeFolding} + fOnScanForFoldRanges : TScanForFoldRangesEvent; +{$ENDIF} + + FShowSpecChar: Boolean; + FPaintTransientLock: Integer; + FIsScrolling: Boolean; + + FChainListCleared: TNotifyEvent; + FChainListDeleted: TStringListChangeEvent; + FChainListInserted: TStringListChangeEvent; + FChainListPutted: TStringListChangeEvent; + FChainLinesChanging: TNotifyEvent; + FChainLinesChanged: TNotifyEvent; + FChainedEditor: TCustomSynEdit; + FChainUndoAdded: TNotifyEvent; + FChainRedoAdded: TNotifyEvent; + + FAdditionalWordBreakChars: TSysCharSet; + FAdditionalIdentChars: TSysCharSet; + +{$IFDEF SYN_COMPILER_6_UP} + FSearchNotFound: TCustomSynEditSearchNotFoundEvent; + FOnFindBeforeSearch: TNotifyEvent; + FOnReplaceBeforeSearch: TNotifyEvent; + FOnCloseBeforeSearch: TNotifyEvent; + FSelStartBeforeSearch: Integer; + FSelLengthBeforeSearch: Integer; +{$ENDIF} + + FWindowProducedMessage: Boolean; + +{$IFDEF SYN_LINUX} + FDeadKeysFixed: Boolean; +{$ENDIF} + +{$IFDEF SYN_CodeFolding} + procedure ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); + procedure FullFoldScan; + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); +{$ENDIF} + procedure BookMarkOptionsChanged(Sender: TObject); + procedure ComputeCaret(X, Y: Integer); + procedure ComputeScroll(X, Y: Integer); + procedure DoHomeKey(Selection: Boolean); + procedure DoEndKey(Selection: Boolean); + procedure DoLinesDeleted(FirstLine, Count: Integer); + procedure DoLinesInserted(FirstLine, Count: Integer); + procedure DoShiftTabKey; + procedure DoTabKey; + procedure DoCaseChange(const Cmd : TSynEditorCommand); + function FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): Integer; + procedure SynFontChanged(Sender: TObject); + function GetBlockBegin: TBufferCoord; + function GetBlockEnd: TBufferCoord; + function GetCanPaste: Boolean; + function GetCanRedo: Boolean; + function GetCanUndo: Boolean; + function GetCaretXY: TBufferCoord; + function GetDisplayX: Integer; + function GetDisplayY: Integer; + function GetDisplayXY: TDisplayCoord; + function GetDisplayLineCount: Integer; + function GetFont: TFont; + function GetHookedCommandHandlersCount: Integer; + function GetLineText: UnicodeString; + function GetMaxUndo: Integer; + function GetOptions: TSynEditorOptions; + function GetSelAvail: Boolean; + function GetSelTabBlock: Boolean; + function GetSelTabLine: Boolean; + function GetSelText: UnicodeString; + function SynGetText: UnicodeString; + function GetWordAtCursor: UnicodeString; + function GetWordAtMouse: UnicodeString; + function GetWordWrap: Boolean; + procedure GutterChanged(Sender: TObject); + function LeftSpaces(const Line: UnicodeString): Integer; + function LeftSpacesEx(const Line: UnicodeString; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; + function GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): UnicodeString; + procedure LinesChanging(Sender: TObject); + procedure MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; + SelectionCommand: Boolean); + procedure MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); + procedure MoveCaretVert(DY: Integer; SelectionCommand: Boolean); + procedure PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: Integer); + procedure ReadAddedKeystrokes(Reader: TReader); + procedure ReadRemovedKeystrokes(Reader: TReader); + function ScanFrom(Index: Integer): Integer; + procedure ScrollTimerHandler(Sender: TObject); + procedure SelectedColorsChanged(Sender: TObject); + procedure SetAdditionalIdentChars(const Value: TSysCharSet); + procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); + procedure SetBlockBegin(Value: TBufferCoord); + procedure SetBlockEnd(Value: TBufferCoord); + procedure SetBorderStyle(Value: TSynBorderStyle); + procedure SetCaretX(Value: Integer); + procedure SetCaretY(Value: Integer); + procedure InternalSetCaretX(Value: Integer); + procedure InternalSetCaretY(Value: Integer); + procedure SetInternalDisplayXY(const aPos: TDisplayCoord); + procedure SetActiveLineColor(Value: TColor); + procedure SetExtraLineSpacing(const Value: Integer); + procedure SetFont(const Value: TFont); + procedure SetGutter(const Value: TSynGutter); + procedure SetGutterWidth(Value: Integer); + procedure SetHideSelection(const Value: Boolean); + procedure SetHighlighter(const Value: TSynCustomHighlighter); + procedure SetInsertCaret(const Value: TSynEditCaretType); + procedure SetInsertMode(const Value: Boolean); + procedure SetKeystrokes(const Value: TSynEditKeyStrokes); + procedure SetLeftChar(Value: Integer); + procedure SetLines(Value: TUnicodeStrings); + procedure SetLineText(Value: UnicodeString); + procedure SetMaxScrollWidth(Value: Integer); + procedure SetMaxUndo(const Value: Integer); + procedure SetModified(Value: Boolean); + procedure SetOptions(Value: TSynEditorOptions); + procedure SetOverwriteCaret(const Value: TSynEditCaretType); + procedure SetRightEdge(Value: Integer); + procedure SetRightEdgeColor(Value: TColor); + procedure SetScrollBars(const Value: TScrollStyle); + procedure SetSearchEngine(Value: TSynEditSearchCustom); + procedure SetSelectionMode(const Value: TSynSelectionMode); + procedure SetActiveSelectionMode(const Value: TSynSelectionMode); + procedure SetSelTextExternal(const Value: UnicodeString); + procedure SetTabWidth(Value: Integer); + procedure SynSetText(const Value: UnicodeString); + procedure SetTopLine(Value: Integer); + procedure SetWordWrap(const Value: Boolean); + procedure SetWordWrapGlyph(const Value: TSynGlyph); + procedure WordWrapGlyphChange(Sender: TObject); + procedure SizeOrFontChanged(bFont: Boolean); + procedure ProperSetLine(ALine: Integer; const ALineText: UnicodeString); + procedure UpdateModifiedStatus; + procedure UndoRedoAdded(Sender: TObject); + procedure UpdateLastCaretX; + procedure UpdateScrollBars; + procedure WriteAddedKeystrokes(Writer: TWriter); + procedure WriteRemovedKeystrokes(Writer: TWriter); + +{$IFDEF SYN_COMPILER_6_UP} + procedure DoSearchFindFirstExecute(Action: TSearchFindFirst); + procedure DoSearchFindExecute(Action: TSearchFind); + procedure DoSearchReplaceExecute(Action: TSearchReplace); + procedure DoSearchFindNextExecute(Action: TSearchFindNext); + procedure FindDialogFindFirst(Sender: TObject); + procedure FindDialogFind(Sender: TObject); + function SearchByFindDialog(FindDialog: TFindDialog) : bool; + procedure FindDialogClose(Sender: TObject); +{$ENDIF} +{$IFDEF SYN_CodeFolding} + procedure SetUseCodeFolding(const Value: Boolean); + procedure OnCodeFoldingChange(Sender: TObject); + function GetCollapseMarkRect(Row: Integer; Line: Integer = -1): TRect; + function GetFoldShapeRect(Row: Integer): TRect; +{$ENDIF} + protected + FIgnoreNextChar: Boolean; + FCharCodeString: string; +{$IFDEF SYN_COMPILER_6_UP} + function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; + MousePos: TPoint): Boolean; override; +{$ENDIF} + procedure CreateParams(var Params: TCreateParams); override; + procedure CreateWnd; override; + procedure DestroyWnd; override; + procedure InvalidateRect(const aRect: TRect; aErase: Boolean); virtual; + procedure DblClick; override; + procedure DecPaintLock; + procedure DefineProperties(Filer: TFiler); override; + procedure DoChange; virtual; + procedure DoKeyPressW(var Message: TWMKey); + procedure DragCanceled; override; + procedure DragOver(Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); override; + function GetReadOnly: Boolean; virtual; + procedure HighlighterAttrChanged(Sender: TObject); + procedure IncPaintLock; + procedure InitializeCaret; + procedure KeyUp(var Key: Word; Shift: TShiftState); override; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure KeyPress(var Key: Char); override; + procedure KeyPressW(var Key: WideChar); virtual; + procedure LinesChanged(Sender: TObject); virtual; + procedure ListCleared(Sender: TObject); + procedure ListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); + procedure ListInserted(Sender: TObject; Index: Integer; aCount: Integer); + procedure ListPutted(Sender: TObject; Index: Integer; aCount: Integer); + //helper procs to chain list commands + procedure ChainListCleared(Sender: TObject); + procedure ChainListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); + procedure ChainListInserted(Sender: TObject; aIndex: Integer; aCount: Integer); + procedure ChainListPutted(Sender: TObject; aIndex: Integer; aCount: Integer); + procedure ChainLinesChanging(Sender: TObject); + procedure ChainLinesChanged(Sender: TObject); + procedure ChainUndoRedoAdded(Sender: TObject); + procedure ScanRanges; + procedure Loaded; override; + procedure MarkListChange(Sender: TObject); + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: + Integer); override; + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + override; + procedure NotifyHookedCommandHandlers(AfterProcessing: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); virtual; + procedure Paint; override; + procedure PaintGutter(const AClip: TRect; const aFirstRow, + aLastRow: Integer); virtual; + procedure PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, + FirstCol, LastCol: Integer); virtual; + procedure RecalcCharExtent; + procedure RedoItem; + procedure InternalSetCaretXY(const Value: TBufferCoord); virtual; + procedure SetCaretXY(const Value: TBufferCoord); virtual; + procedure SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); virtual; + procedure SetFontSmoothing(AValue: TSynFontSmoothMethod); + procedure SetName(const Value: TComponentName); override; + procedure SetReadOnly(Value: Boolean); virtual; + procedure SetWantReturns(Value: Boolean); + procedure SetSelTextPrimitive(const Value: UnicodeString); + procedure SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; Value: PWideChar; + AddToUndoList: Boolean); + procedure SetWantTabs(Value: Boolean); + procedure StatusChanged(AChanges: TSynStatusChanges); + // If the translations requires Data, memory will be allocated for it via a + // GetMem call. The client must call FreeMem on Data if it is not NIL. + function TranslateKeyCode(Code: Word; Shift: TShiftState; + var Data: Pointer): TSynEditorCommand; + procedure UndoItem; + procedure UpdateMouseCursor; virtual; + protected + FGutterWidth: Integer; + FInternalImage: TSynInternalImage; + procedure HideCaret; + procedure ShowCaret; + procedure DoOnClearBookmark(var Mark: TSynEditMark); virtual; + procedure DoOnCommandProcessed(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer); virtual; + // no method DoOnDropFiles, intercept the WM_DROPFILES instead + procedure DoOnGutterClick(Button: TMouseButton; X, Y: Integer); virtual; + procedure DoOnPaint; virtual; + procedure DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); virtual; + procedure DoOnPaintTransient(TransientType: TTransientType); virtual; + + procedure DoOnPlaceMark(var Mark: TSynEditMark); virtual; + procedure DoOnProcessCommand(var Command: TSynEditorCommand; + var AChar: WideChar; Data: Pointer); virtual; + function DoOnReplaceText(const ASearch, AReplace: UnicodeString; + Line, Column: Integer): TSynReplaceAction; virtual; + function DoOnSpecialLineColors(Line: Integer; + var Foreground, Background: TColor): Boolean; virtual; + procedure DoOnSpecialTokenAttributes(ALine, APos: Integer; const AToken: string; var FG, BG: TColor; + var AStyle: TFontStyles); + procedure DoOnStatusChange(Changes: TSynStatusChanges); virtual; + function GetSelEnd: Integer; + function GetSelStart: Integer; + function GetSelLength: Integer; + procedure SetSelEnd(const Value: Integer); + procedure SetSelStart(const Value: Integer); + procedure SetSelLength(const Value: Integer); + procedure SetAlwaysShowCaret(const Value: Boolean); + function ShrinkAtWideGlyphs(const S: UnicodeString; First: Integer; + var CharCount: Integer): UnicodeString; + procedure LinesHookChanged; + procedure FontSmoothingChanged; + property InternalCaretX: Integer write InternalSetCaretX; + property InternalCaretY: Integer write InternalSetCaretY; + property InternalCaretXY: TBufferCoord write InternalSetCaretXY; + property FontSmoothing: TSynFontSmoothMethod read FFontSmoothing write SetFontSmoothing; +//++ DPI-Aware + procedure ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$ifend}); override; +//-- DPI-Aware + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Canvas; + property SelStart: Integer read GetSelStart write SetSelStart; + property SelEnd: Integer read GetSelEnd write SetSelEnd; + property AlwaysShowCaret: Boolean read FAlwaysShowCaret + write SetAlwaysShowCaret; + procedure UpdateCaret; +{$IFDEF SYN_COMPILER_4_UP} + procedure AddKey(Command: TSynEditorCommand; Key1: Word; SS1: TShiftState; + Key2: Word = 0; SS2: TShiftState = []); +{$ELSE} + procedure AddKey(Command: TSynEditorCommand; Key1: Word; SS1: TShiftState; + Key2: Word; SS2: TShiftState); +{$ENDIF} + procedure BeginUndoBlock; + procedure BeginUpdate; + function CaretInView: Boolean; + function CharIndexToRowCol(Index: Integer): TBufferCoord; + procedure Clear; + procedure ClearAll; + procedure ClearBookMark(BookMark: Integer); + procedure ClearSelection; + procedure CommandProcessor(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer); virtual; + procedure ClearUndo; + procedure CopyToClipboard; + procedure CutToClipboard; + procedure DoCopyToClipboard(const SText: UnicodeString); + procedure DragDrop(Source: TObject; X, Y: Integer); override; + procedure EndUndoBlock; + procedure EndUpdate; + procedure EnsureCursorPosVisible; + procedure EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; + EvenIfVisible: Boolean = False); + procedure FindMatchingBracket; virtual; + function GetMatchingBracket: TBufferCoord; virtual; + function GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; virtual; +{$IFDEF SYN_COMPILER_4_UP} + function ExecuteAction(Action: TBasicAction): Boolean; override; +{$ENDIF} + procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer); virtual; + function ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; + function GetBookMark(BookMark: Integer; var X, Y: Integer): Boolean; + function GetHighlighterAttriAtRowCol(const XY: TBufferCoord; var Token: UnicodeString; + var Attri: TSynHighlighterAttributes): Boolean; + function GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; var Token: UnicodeString; + var TokenType, Start: Integer; + var Attri: TSynHighlighterAttributes): Boolean; + function GetPositionOfMouse(out aPos: TBufferCoord): Boolean; + function GetWordAtRowCol(XY: TBufferCoord): UnicodeString; + procedure GotoBookMark(BookMark: Integer); virtual; + procedure GotoLineAndCenter(ALine: Integer); virtual; + function IsIdentChar(AChar: WideChar): Boolean; virtual; + function IsWhiteChar(AChar: WideChar): Boolean; virtual; + function IsWordBreakChar(AChar: WideChar): Boolean; virtual; + + procedure InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; AddToUndoList: Boolean); + procedure InsertLine(const BB, BE: TBufferCoord; ChangeStr: PWideChar; AddToUndoList: Boolean); + function UnifiedSelection: TBufferBlock; + procedure DoBlockIndent; + procedure DoBlockUnindent; + + procedure InvalidateGutter; + procedure InvalidateGutterLine(aLine: Integer); + procedure InvalidateGutterLines(FirstLine, LastLine: Integer); + procedure InvalidateLine(Line: Integer); + procedure InvalidateLines(FirstLine, LastLine: Integer); + procedure InvalidateSelection; + procedure MarkModifiedLinesAsSaved; + procedure ResetModificationIndicator; + function IsBookmark(BookMark: Integer): Boolean; + function IsPointInSelection(const Value: TBufferCoord): Boolean; + procedure LockUndo; + function BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; + function DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; + function LineToRow(aLine: Integer): Integer; + function RowToLine(aRow: Integer): Integer; + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; + procedure PasteFromClipboard; + + function NextWordPos: TBufferCoord; virtual; + function NextWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; + function WordStart: TBufferCoord; virtual; + function WordStartEx(const XY: TBufferCoord): TBufferCoord; virtual; + function WordEnd: TBufferCoord; virtual; + function WordEndEx(const XY: TBufferCoord): TBufferCoord; virtual; + function PrevWordPos: TBufferCoord; virtual; + function PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; + + function PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; + function PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; + procedure Redo; + procedure RegisterCommandHandler(const AHandlerProc: THookedCommandEvent; + AHandlerData: Pointer); + function RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; + function RowColToCharIndex(RowCol: TBufferCoord): Integer; + function SearchReplace(const ASearch, AReplace: UnicodeString; + AOptions: TSynSearchOptions): Integer; + procedure SelectAll; + procedure SetBookMark(BookMark: Integer; X: Integer; Y: Integer); + procedure SetCaretAndSelection(const ptCaret, ptBefore, ptAfter: TBufferCoord); + procedure SetDefaultKeystrokes; virtual; + procedure SetSelWord; + procedure SetWordBlock(Value: TBufferCoord); + procedure Undo; + procedure UnlockUndo; + procedure UnregisterCommandHandler(AHandlerProc: THookedCommandEvent); +{$IFDEF SYN_COMPILER_4_UP} + function UpdateAction(Action: TBasicAction): Boolean; override; +{$ENDIF} + procedure SetFocus; override; + + procedure AddKeyUpHandler(aHandler: TKeyEvent); + procedure RemoveKeyUpHandler(aHandler: TKeyEvent); + procedure AddKeyDownHandler(aHandler: TKeyEvent); + procedure RemoveKeyDownHandler(aHandler: TKeyEvent); + procedure AddKeyPressHandler(aHandler: TKeyPressWEvent); + procedure RemoveKeyPressHandler(aHandler: TKeyPressWEvent); + procedure AddFocusControl(aControl: TWinControl); + procedure RemoveFocusControl(aControl: TWinControl); + procedure AddMouseDownHandler(aHandler: TMouseEvent); + procedure RemoveMouseDownHandler(aHandler: TMouseEvent); + procedure AddMouseUpHandler(aHandler: TMouseEvent); + procedure RemoveMouseUpHandler(aHandler: TMouseEvent); + procedure AddMouseCursorHandler(aHandler: TMouseCursorEvent); + procedure RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); + + procedure WndProc(var Msg: TMessage); override; + procedure SetLinesPointer(ASynEdit: TCustomSynEdit); + procedure RemoveLinesPointer; + procedure HookTextBuffer(aBuffer: TSynEditStringList; + aUndo, aRedo: TSynEditUndoList); + procedure UnHookTextBuffer; +{$IFDEF SYN_CodeFolding} + procedure CollapseAll; + procedure UncollapseAll; + procedure Collapse(FoldRangeIndex: Integer; Invalidate:Boolean = True); + procedure Uncollapse(FoldRangeIndex: Integer; Invalidate:Boolean = True); + procedure UncollapseAroundLine(Line: Integer); + procedure CollapseNearest; + procedure UncollapseNearest; + procedure CollapseLevel(Level : integer); + procedure UnCollapseLevel(Level : integer); + procedure CollapseFoldType(FoldType : Integer); + procedure UnCollapseFoldType(FoldType : Integer); +{$ENDIF} + public + property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; + property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; + property BlockBegin: TBufferCoord read GetBlockBegin write SetBlockBegin; + property BlockEnd: TBufferCoord read GetBlockEnd write SetBlockEnd; + property CanPaste: Boolean read GetCanPaste; + property CanRedo: Boolean read GetCanRedo; + property CanUndo: Boolean read GetCanUndo; + property CaretX: Integer read FCaretX write SetCaretX; + property CaretY: Integer read FCaretY write SetCaretY; + property CaretXY: TBufferCoord read GetCaretXY write SetCaretXY; + property ActiveLineColor: TColor read FActiveLineColor + write SetActiveLineColor default clNone; + property DisplayX: Integer read GetDisplayX; + property DisplayY: Integer read GetDisplayY; + property DisplayXY: TDisplayCoord read GetDisplayXY; + property DisplayLineCount: Integer read GetDisplayLineCount; + property CharsInWindow: Integer read FCharsInWindow; + property CharWidth: Integer read FCharWidth; + property Color; + property Font: TFont read GetFont write SetFont; + property Highlighter: TSynCustomHighlighter + read FHighlighter write SetHighlighter; + property HintMode: TSynHintMode read FHintMode write FHintMode default shmDefault; + property LeftChar: Integer read FLeftChar write SetLeftChar; + property LineHeight: Integer read FTextHeight; + property LinesInWindow: Integer read FLinesInWindow; + property LineText: UnicodeString read GetLineText write SetLineText; + property Lines: TUnicodeStrings read FLines write SetLines; + property Marks: TSynEditMarkList read FMarkList; + property MaxScrollWidth: Integer read FMaxScrollWidth write SetMaxScrollWidth + default 1024; + property Modified: Boolean read FModified write SetModified; + property PaintLock: Integer read FPaintLock; + property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False; + property SearchEngine: TSynEditSearchCustom read FSearchEngine write SetSearchEngine; + property SelAvail: Boolean read GetSelAvail; + property SelLength: Integer read GetSelLength write SetSelLength; + property SelTabBlock: Boolean read GetSelTabBlock; + property SelTabLine: Boolean read GetSelTabLine; + property SelText: UnicodeString read GetSelText write SetSelTextExternal; + property StateFlags: TSynStateFlags read FStateFlags; + property Text: UnicodeString read SynGetText write SynSetText; + property TopLine: Integer read FTopLine write SetTopLine; + property WordAtCursor: UnicodeString read GetWordAtCursor; + property WordAtMouse: UnicodeString read GetWordAtMouse; + property UndoList: TSynEditUndoList read FUndoList; + property RedoList: TSynEditUndoList read FRedoList; + public + property OnProcessCommand: TProcessCommandEvent + read FOnProcessCommand write FOnProcessCommand; + +{$IFDEF SYN_CodeFolding} + property CodeFolding: TSynCodeFolding read fCodeFolding write fCodeFolding; + property UseCodeFolding: Boolean read fUseCodeFolding write SetUseCodeFolding; + property AllFoldRanges: TSynFoldRanges read fAllFoldRanges; +{$ENDIF} + property BookMarkOptions: TSynBookMarkOpt + read FBookMarkOpt write FBookMarkOpt; + property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle + default bsSingle; + property ExtraLineSpacing: Integer + read FExtraLineSpacing write SetExtraLineSpacing default 0; + property Gutter: TSynGutter read FGutter write SetGutter; + property HideSelection: Boolean read FHideSelection write SetHideSelection + default False; + property InsertCaret: TSynEditCaretType read FInsertCaret + write SetInsertCaret default ctVerticalLine; + property InsertMode: Boolean read FInserting write SetInsertMode + default true; + property IsScrolling : Boolean read FIsScrolling; + property Keystrokes: TSynEditKeyStrokes + read FKeyStrokes write SetKeystrokes stored False; + property MaxUndo: Integer read GetMaxUndo write SetMaxUndo default 1024; + property Options: TSynEditorOptions read GetOptions write SetOptions + default SYNEDIT_DEFAULT_OPTIONS; + property OverwriteCaret: TSynEditCaretType read FOverwriteCaret + write SetOverwriteCaret default ctBlock; + property RightEdge: Integer read FRightEdge write SetRightEdge default 80; + property RightEdgeColor: TColor + read FRightEdgeColor write SetRightEdgeColor default clSilver; + property ScrollHintColor: TColor read FScrollHintColor + write FScrollHintColor default clInfoBk; + property ScrollHintFormat: TScrollHintFormat read FScrollHintFormat + write FScrollHintFormat default shfTopLineOnly; + property ScrollBars: TScrollStyle + read FScrollBars write SetScrollBars default ssBoth; + property SelectedColor: TSynSelectedColor + read FSelectedColor write FSelectedColor; + property SelectionMode: TSynSelectionMode + read FSelectionMode write SetSelectionMode default smNormal; + property ActiveSelectionMode: TSynSelectionMode read FActiveSelectionMode + write SetActiveSelectionMode stored False; + property TabWidth: Integer read FTabWidth write SetTabWidth default 8; + property WantReturns: Boolean read FWantReturns write SetWantReturns default True; + property WantTabs: Boolean read FWantTabs write SetWantTabs default False; + property WordWrap: Boolean read GetWordWrap write SetWordWrap default False; + property WordWrapGlyph: TSynGlyph read FWordWrapGlyph write SetWordWrapGlyph; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnClearBookmark: TPlaceMarkEvent read FOnClearMark + write FOnClearMark; + property OnCommandProcessed: TProcessCommandEvent + read FOnCommandProcessed write FOnCommandProcessed; + property OnContextHelp: TContextHelpEvent + read FOnContextHelp write FOnContextHelp; + property OnDropFiles: TDropFilesEvent read FOnDropFiles write FOnDropFiles; + property OnGutterClick: TGutterClickEvent + read FOnGutterClick write FOnGutterClick; + property OnGutterGetText: TGutterGetTextEvent read FOnGutterGetText + write FOnGutterGetText; + property OnGutterPaint: TGutterPaintEvent read FOnGutterPaint + write FOnGutterPaint; + property OnMouseCursor: TMouseCursorEvent read FOnMouseCursor + write FOnMouseCursor; + property OnKeyPress: TKeyPressWEvent read FOnKeyPressW write FOnKeyPressW; + property OnPaint: TPaintEvent read FOnPaint write FOnPaint; + property OnPlaceBookmark: TPlaceMarkEvent + read FOnPlaceMark write FOnPlaceMark; + property OnProcessUserCommand: TProcessCommandEvent + read FOnProcessUserCommand write FOnProcessUserCommand; + property OnReplaceText: TReplaceTextEvent read FOnReplaceText + write FOnReplaceText; + property OnSpecialLineColors: TSpecialLineColorsEvent + read FOnSpecialLineColors write FOnSpecialLineColors; + property OnSpecialTokenAttributes: TSpecialTokenAttributesEvent + read FOnSpecialTokenAttributes write FOnSpecialTokenAttributes; + property OnStatusChange: TStatusChangeEvent + read FOnStatusChange write FOnStatusChange; + property OnPaintTransient: TPaintTransient + read FOnPaintTransient write FOnPaintTransient; + property OnScroll: TScrollEvent + read FOnScroll write FOnScroll; + property OnTokenHint: TGetTokenHintEvent read FOnTokenHint write FOnTokenHint; +{$IFDEF SYN_CodeFolding} + property OnScanForFoldRanges: TScanForFoldRangesEvent + read fOnScanForFoldRanges write fOnScanForFoldRanges; +{$ENDIF} + published + property Cursor default crIBeam; +{$IFDEF SYN_COMPILER_6_UP} + property OnSearchNotFound: TCustomSynEditSearchNotFoundEvent + read FSearchNotFound write FSearchNotFound; +{$ENDIF} + end; + + TSynEdit = class(TCustomSynEdit) + published + // inherited properties + property Align; +{$IFDEF SYN_COMPILER_4_UP} + property Anchors; + property Constraints; +{$ENDIF} + property Color; + property ActiveLineColor; + property Ctl3D; + property ParentCtl3D; + property Enabled; + property Font; + property Height; + property Name; + property ParentColor default False; + property ParentFont default False; + property ParentShowHint; + property PopupMenu; + property ShowHint; + property TabOrder; + property TabStop default True; + property Visible; + property Width; + // inherited events + property OnClick; + property OnDblClick; + property OnDragDrop; + property OnDragOver; +{$IFDEF SYN_COMPILER_4_UP} + property OnEndDock; + property OnStartDock; +{$ENDIF} + property OnEndDrag; + property OnEnter; + property OnExit; + property OnKeyDown; + property OnKeyPress; + property OnKeyUp; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnMouseWheel; + property OnMouseWheelDown; + property OnMouseWheelUp; + property OnStartDrag; + // TCustomSynEdit properties +{$IFDEF SYN_CodeFolding} + property CodeFolding; + property UseCodeFolding; +{$ENDIF} + property BookMarkOptions; + property BorderStyle; + property ExtraLineSpacing; + property Gutter; + property HideSelection; + property Highlighter; + property HintMode; + property ImeMode; + property ImeName; + property InsertCaret; + property InsertMode; + property Keystrokes; + property Lines; + property MaxScrollWidth; + property MaxUndo; + property Options; + property OverwriteCaret; + property ReadOnly; + property RightEdge; + property RightEdgeColor; + property ScrollHintColor; + property ScrollHintFormat; + property ScrollBars; + property SearchEngine; + property SelectedColor; + property SelectionMode; + property TabWidth; + property WantReturns; + property WantTabs; + property WordWrap; + property WordWrapGlyph; + // TCustomSynEdit events + property OnChange; + property OnClearBookmark; + property OnCommandProcessed; + property OnContextHelp; + property OnDropFiles; + property OnGutterClick; + property OnGutterGetText; + property OnGutterPaint; + property OnMouseCursor; + property OnPaint; + property OnPlaceBookmark; + property OnProcessCommand; + property OnProcessUserCommand; + property OnReplaceText; + property OnScroll; + property OnSpecialLineColors; + property OnStatusChange; + property OnTokenHint; + property OnPaintTransient; +{$IFDEF SYN_CodeFolding} + property OnScanForFoldRanges; +{$ENDIF} + + property FontSmoothing; + end; + +implementation + +{$R SynEdit.res} + +uses +{$IFDEF SYN_COMPILER_6_UP} + Consts, +{$ENDIF} +{$IFDEF SYN_COMPILER_18_UP} + AnsiStrings, +{$ENDIF} + Clipbrd, + ShellAPI, + SynEditWordWrap, + SynEditStrConst; + +function CeilOfIntDiv(Dividend: Cardinal; Divisor: Word): Word; +Var + Remainder: Word; +begin + DivMod(Dividend, Divisor, Result, Remainder); + if Remainder > 0 then + Inc(Result); +end; + +function TrimTrailingSpaces(const S: UnicodeString): UnicodeString; +var + I: Integer; +begin + I := Length(S); + while (I > 0) and ((S[I] = #32) or (S[I] = #9)) do + Dec(I); + Result := Copy(S, 1, I); +end; + +{ THookedCommandHandlerEntry } + +type + THookedCommandHandlerEntry = class(TObject) + private + FEvent: THookedCommandEvent; + FData: Pointer; + constructor Create(AEvent: THookedCommandEvent; AData: Pointer); + function Equals(AEvent: THookedCommandEvent): Boolean; {$IFDEF UNICODE} reintroduce; {$ENDIF} + end; + +constructor THookedCommandHandlerEntry.Create(AEvent: THookedCommandEvent; + AData: Pointer); +begin + inherited Create; + FEvent := AEvent; + FData := AData; +end; + +function THookedCommandHandlerEntry.Equals(AEvent: THookedCommandEvent): Boolean; +begin + with TMethod(FEvent) do + Result := (Code = TMethod(AEvent).Code) and (Data = TMethod(AEvent).Data); +end; + +{ TCustomSynEdit } + +function TCustomSynEdit.PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; +// Result is in display coordinates +var + f: Single; +begin + f := (aX - FGutterWidth - 2) / FCharWidth; + // don't return a partially visible last line + if aY >= FLinesInWindow * FTextHeight then + begin + aY := FLinesInWindow * FTextHeight - 1; + if aY < 0 then + aY := 0; + end; + Result.Column := Max(1, LeftChar + Round(f)); + Result.Row := Max(1, TopLine + (aY div FTextHeight)); +end; + +function TCustomSynEdit.PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; +begin + Result.Column := Max(1, LeftChar + ((aX - FGutterWidth - 2) div FCharWidth)); + Result.Row := Max(1, TopLine + (aY div FTextHeight)); +end; + +function TCustomSynEdit.RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; +begin + Result.X := (RowCol.Column-1) * FCharWidth + FTextOffset; + Result.Y := (RowCol.Row - FTopLine) * FTextHeight; +end; + +procedure TCustomSynEdit.ComputeCaret(X, Y: Integer); +//X,Y are pixel coordinates +var + vCaretNearestPos : TDisplayCoord; +begin + vCaretNearestPos := PixelsToNearestRowColumn(X, Y); + vCaretNearestPos.Row := MinMax(vCaretNearestPos.Row, 1, DisplayLineCount); + SetInternalDisplayXY(vCaretNearestPos); +end; + +procedure TCustomSynEdit.ComputeScroll(X, Y: Integer); +//X,Y are pixel coordinates +var + iScrollBounds: TRect; { relative to the client area } +begin + { don't scroll if dragging text from other control } + if (not MouseCapture) and (not Dragging) then + begin + FScrollTimer.Enabled := False; + Exit; + end; + + iScrollBounds := Bounds(FGutterWidth, 0, FCharsInWindow * FCharWidth, + FLinesInWindow * FTextHeight); + if BorderStyle = bsNone then + InflateRect(iScrollBounds, -2, -2); + + if X < iScrollBounds.Left then + FScrollDeltaX := (X - iScrollBounds.Left) div FCharWidth - 1 + else if X >= iScrollBounds.Right then + FScrollDeltaX := (X - iScrollBounds.Right) div FCharWidth + 1 + else + FScrollDeltaX := 0; + + if Y < iScrollBounds.Top then + fScrollDeltaY := (Y - iScrollBounds.Top) div FTextHeight - 1 + else if Y >= iScrollBounds.Bottom then + fScrollDeltaY := (Y - iScrollBounds.Bottom) div FTextHeight + 1 + else + fScrollDeltaY := 0; + + FScrollTimer.Enabled := (FScrollDeltaX <> 0) or (fScrollDeltaY <> 0); +end; + +procedure TCustomSynEdit.DoCopyToClipboard(const SText: UnicodeString); +var + Mem: HGLOBAL; + P: PByte; + SLen: Integer; +begin + if SText = '' then Exit; + SetClipboardText(SText); + SLen := Length(SText); + // Open and Close are the only TClipboard methods we use because TClipboard + // is very hard (impossible) to work with if you want to put more than one + // format on it at a time. + Clipboard.Open; + try + // Copy it in our custom format so we know what kind of block it is. + // That effects how it is pasted in. + // This format is kept as ANSI to be compatible with programs using the + // ANSI version of Synedit. + Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, + sizeof(TSynSelectionMode) + SLen + 1); + if Mem <> 0 then + begin + P := GlobalLock(Mem); + try + if P <> nil then + begin + // Our format: TSynSelectionMode value followed by Ansi-text. + PSynSelectionMode(P)^ := FActiveSelectionMode; + Inc(P, SizeOf(TSynSelectionMode)); + Move(PAnsiChar(AnsiString(SText))^, P^, SLen + 1); + SetClipboardData(SynEditClipboardFormat, Mem); + end; + finally + GlobalUnlock(Mem); + end; + end; + // Don't free Mem! It belongs to the clipboard now, and it will free it + // when it is done with it. + finally + Clipboard.Close; + end; +end; + +procedure TCustomSynEdit.CopyToClipboard; +var + SText: UnicodeString; + ChangeTrim: Boolean; +begin + if SelAvail then + begin + ChangeTrim := (FActiveSelectionMode = smColumn) and (eoTrimTrailingSpaces in Options); + try + if ChangeTrim then + Exclude(FOptions, eoTrimTrailingSpaces); + SText := SelText; + finally + if ChangeTrim then + Include(FOptions, eoTrimTrailingSpaces); + end; + DoCopyToClipboard(SText); + end; +end; + +procedure TCustomSynEdit.CutToClipboard; +begin + if not ReadOnly and SelAvail then + begin + BeginUndoBlock; + try + DoCopyToClipboard(SelText); + SelText := ''; + finally + EndUndoBlock; + end; + end; +end; + +constructor TCustomSynEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FLines := TSynEditStringList.Create(ExpandAtWideGlyphs); + FOrigLines := FLines; + with TSynEditStringList(FLines) do + begin + OnChange := LinesChanged; + OnChanging := LinesChanging; + OnCleared := ListCleared; + OnDeleted := ListDeleted; + OnInserted := ListInserted; + OnPutted := ListPutted; + end; + FFontDummy := TFont.Create; + FUndoList := TSynEditUndoList.Create; + FUndoList.OnAddedUndo := UndoRedoAdded; + FOrigUndoList := FUndoList; + FRedoList := TSynEditUndoList.Create; + FRedoList.OnAddedUndo := UndoRedoAdded; + FOrigRedoList := FRedoList; + +{$IFDEF SYN_COMPILER_4_UP} + DoubleBuffered := False; +{$ENDIF} + FActiveLineColor := clNone; + FSelectedColor := TSynSelectedColor.Create; + FSelectedColor.OnChange := SelectedColorsChanged; + FBookMarkOpt := TSynBookMarkOpt.Create(Self); + FBookMarkOpt.OnChange := BookMarkOptionsChanged; +// FRightEdge has to be set before FontChanged is called for the first time + FRightEdge := 80; + FGutter := TSynGutter.Create; + FGutter.OnChange := GutterChanged; + FGutterWidth := FGutter.Width; + FWordWrapGlyph := TSynGlyph.Create(HINSTANCE, 'SynEditWrapped', clLime); + FWordWrapGlyph.OnChange := WordWrapGlyphChange; + FTextOffset := FGutterWidth + 2; + ControlStyle := ControlStyle + [csOpaque, csSetCaption]; +{$IFDEF SYN_COMPILER_7_UP} + ControlStyle := ControlStyle + [csNeedsBorderPaint]; +{$ENDIF} + Height := 150; + Width := 200; + Cursor := crIBeam; + Color := clWindow; +{$IFDEF MSWINDOWS} + FFontDummy.Name := 'Courier New'; + FFontDummy.Size := 10; +{$ENDIF} +{$IFDEF SYN_COMPILER_3_UP} + FFontDummy.CharSet := DEFAULT_CHARSET; +{$ENDIF} + FTextDrawer := TSynTextDrawer.Create([fsBold], FFontDummy); + Font.Assign(FFontDummy); + Font.OnChange := SynFontChanged; + ParentFont := False; + ParentColor := False; + TabStop := True; + FInserting := True; + FMaxScrollWidth := 1024; + FScrollBars := ssBoth; + FBorderStyle := bsSingle; + FHintMode := shmDefault; + FInsertCaret := ctVerticalLine; + FOverwriteCaret := ctBlock; + FSelectionMode := smNormal; + FActiveSelectionMode := smNormal; + FFocusList := TList.Create; + FKbdHandler := TSynEditKbdHandler.Create; + FKeyStrokes := TSynEditKeyStrokes.Create(Self); + FMarkList := TSynEditMarkList.Create(self); + FMarkList.OnChange := MarkListChange; + SetDefaultKeystrokes; + FRightEdgeColor := clSilver; + FWantReturns := True; + FWantTabs := False; + FTabWidth := 8; + FLeftChar := 1; + FTopLine := 1; + FCaretX := 1; + FLastCaretX := 1; + FCaretY := 1; + FBlockBegin.Char := 1; + FBlockBegin.Line := 1; + FBlockEnd := FBlockBegin; + FOptions := SYNEDIT_DEFAULT_OPTIONS; + FScrollTimer := TTimer.Create(Self); + FScrollTimer.Enabled := False; + FScrollTimer.Interval := 100; + FScrollTimer.OnTimer := ScrollTimerHandler; + + FScrollHintColor := clInfoBk; + FScrollHintFormat := shfTopLineOnly; +{$IFDEF SYN_CodeFolding} + FCodeFolding := TSynCodeFolding.Create; + FCodeFolding.OnChange := OnCodeFoldingChange; + FAllFoldRanges := TSynFoldRanges.Create; +{$ENDIF} + + SynFontChanged(nil); +end; + +procedure TCustomSynEdit.CreateParams(var Params: TCreateParams); +const + BorderStyles: array[TBorderStyle] of DWORD = (0, WS_BORDER); + ClassStylesOff = CS_VREDRAW or CS_HREDRAW; +begin + // Clear WindowText to avoid it being used as Caption, or else window creation will + // fail if it's bigger than 64KB. It's useless to set the Caption anyway. + StrDispose(WindowText); + WindowText := nil; + inherited CreateParams(Params); + with Params do + begin + WindowClass.Style := WindowClass.Style and not ClassStylesOff; + Style := Style or BorderStyles[FBorderStyle] or WS_CLIPCHILDREN; + + if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then + begin + Style := Style and not WS_BORDER; + ExStyle := ExStyle or WS_EX_CLIENTEDGE; + // avoid flicker while scrolling or resizing + if not (csDesigning in ComponentState) and CheckWin32Version(5, 1) then + ExStyle := ExStyle or WS_EX_COMPOSITED; + end; + +{$IFNDEF UNICODE} + if not (csDesigning in ComponentState) then + begin + // Necessary for unicode support, especially IME won't work else + if Win32PlatformIsUnicode then + WindowClass.lpfnWndProc := @DefWindowProcW; + end; +{$ENDIF} + end; +end; + +procedure TCustomSynEdit.DecPaintLock; +var + vAuxPos: TDisplayCoord; +begin + Assert(FPaintLock > 0); + Dec(FPaintLock); + if (FPaintLock = 0) and HandleAllocated then + begin + if sfScrollbarChanged in FStateFlags then + UpdateScrollbars; + // Locks the caret inside the visible area + if WordWrap and ([scCaretX,scCaretY] * FStatusChanges <> []) then + begin + vAuxPos := DisplayXY; + // This may happen in the last row of a line or in rows which length is + // greater than CharsInWindow (Tabs and Spaces are allowed beyond + // CharsInWindow while wrapping the lines) + if (vAuxPos.Column > CharsInWindow +1) and (CharsInWindow > 0) then + begin + if FCaretAtEOL then + FCaretAtEOL := False + else + begin + if scCaretY in FStatusChanges then + begin + vAuxPos.Column := CharsInWindow + 1; + FCaretX := DisplayToBufferPos(vAuxPos).Char; + Include(FStatusChanges,scCaretX); + UpdateLastCaretX; + end; + end; + Include(FStateFlags, sfCaretChanged); + end; + end; + if sfCaretChanged in FStateFlags then + UpdateCaret; + if FStatusChanges <> [] then + DoOnStatusChange(FStatusChanges); + end; +end; + +destructor TCustomSynEdit.Destroy; +begin + Highlighter := nil; + if (FChainedEditor <> nil) or (FLines <> FOrigLines) then + RemoveLinesPointer; + + inherited Destroy; + + // free listeners while other fields are still valid + + // do not use FreeAndNil, it first nils and then freey causing problems with + // code accessing FHookedCommandHandlers while destruction + FHookedCommandHandlers.Free; + FHookedCommandHandlers := nil; + // do not use FreeAndNil, it first nils and then frees causing problems with + // code accessing FPlugins while destruction + FPlugins.Free; + FPlugins := nil; + + FMarkList.Free; + FBookMarkOpt.Free; + FKeyStrokes.Free; + FKbdHandler.Free; + FFocusList.Free; + FSelectedColor.Free; + FOrigUndoList.Free; + FOrigRedoList.Free; + FGutter.Free; + FWordWrapGlyph.Free; + FTextDrawer.Free; + FInternalImage.Free; + FFontDummy.Free; + FOrigLines.Free; +{$IFDEF SYN_CodeFolding} + fCodeFolding.Free; + fAllFoldRanges.Free; +{$ENDIF} +end; + +function TCustomSynEdit.GetBlockBegin: TBufferCoord; +begin + if (FBlockEnd.Line < FBlockBegin.Line) + or ((FBlockEnd.Line = FBlockBegin.Line) and (FBlockEnd.Char < FBlockBegin.Char)) + then + Result := FBlockEnd + else + Result := FBlockBegin; +end; + +function TCustomSynEdit.GetBlockEnd: TBufferCoord; +begin + if (FBlockEnd.Line < FBlockBegin.Line) + or ((FBlockEnd.Line = FBlockBegin.Line) and (FBlockEnd.Char < FBlockBegin.Char)) + then + Result := FBlockBegin + else + Result := FBlockEnd; +end; + +procedure TCustomSynEdit.SynFontChanged(Sender: TObject); +begin + RecalcCharExtent; + SizeOrFontChanged(True); +end; + +function TCustomSynEdit.GetFont: TFont; +begin + Result := inherited Font; +end; + +function TCustomSynEdit.GetLineText: UnicodeString; +begin + if (CaretY >= 1) and (CaretY <= Lines.Count) then + Result := Lines[CaretY - 1] + else + Result := ''; +end; + +function TCustomSynEdit.GetSelAvail: Boolean; +begin + Result := (FBlockBegin.Char <> FBlockEnd.Char) or + ((FBlockBegin.Line <> FBlockEnd.Line) and (FActiveSelectionMode <> smColumn)); +end; + +function TCustomSynEdit.GetSelTabBlock: Boolean; +begin + Result := (FBlockBegin.Line <> FBlockEnd.Line) and (FActiveSelectionMode <> smColumn); +end; + +function TCustomSynEdit.GetSelTabLine: Boolean; +begin + Result := (BlockBegin.Char <= 1) and (BlockEnd.Char > length(Lines[CaretY - 1])) and SelAvail; +end; + +function TCustomSynEdit.GetSelText: UnicodeString; + + function CopyPadded(const S: UnicodeString; Index, Count: Integer): UnicodeString; + var + SrcLen: Integer; + DstLen: Integer; + i: Integer; + P: PWideChar; + begin + SrcLen := Length(S); + DstLen := Index + Count; + if SrcLen >= DstLen then + Result := Copy(S, Index, Count) + else begin + SetLength(Result, DstLen); + P := PWideChar(Result); + WStrCopy(P, PWideChar(Copy(S, Index, Count))); + Inc(P, Length(S)); + for i := 0 to DstLen - Srclen - 1 do + P[i] := #32; + end; + end; + + procedure CopyAndForward(const S: UnicodeString; Index, Count: Integer; var P: + PWideChar); + var + pSrc: PWideChar; + SrcLen: Integer; + DstLen: Integer; + begin + SrcLen := Length(S); + if (Index <= SrcLen) and (Count > 0) then + begin + Dec(Index); + pSrc := PWideChar(S) + Index; + DstLen := Min(SrcLen - Index, Count); + Move(pSrc^, P^, DstLen * sizeof(WideChar)); + Inc(P, DstLen); + P^ := #0; + end; + end; + + function CopyPaddedAndForward(const S: UnicodeString; Index, Count: Integer; + var P: PWideChar): Integer; + var + OldP: PWideChar; + Len, i: Integer; + begin + Result := 0; + OldP := P; + CopyAndForward(S, Index, Count, P); + Len := Count - (P - OldP); + if not (eoTrimTrailingSpaces in Options) then + begin + for i := 0 to Len - 1 do + P[i] := #32; + Inc(P, Len); + end + else + Result := Len; + end; + +var + First, Last, TotalLen: Integer; + ColFrom, ColTo: Integer; + I: Integer; + l, r: Integer; + s: UnicodeString; + P: PWideChar; + cRow: Integer; + vAuxLineChar: TBufferCoord; + vAuxRowCol: TDisplayCoord; + vTrimCount: Integer; +begin + if not SelAvail then + Result := '' + else begin + ColFrom := BlockBegin.Char; + First := BlockBegin.Line - 1; + // + ColTo := BlockEnd.Char; + Last := BlockEnd.Line - 1; + // + TotalLen := 0; + case FActiveSelectionMode of + smNormal: + if (First = Last) then + Result := Copy(Lines[First], ColFrom, ColTo - ColFrom) + else begin + // step1: calculate total length of result string + TotalLen := Max(0, Length(Lines[First]) - ColFrom + 1); + for i := First + 1 to Last - 1 do + Inc(TotalLen, Length(Lines[i])); + Inc(TotalLen, ColTo - 1); + Inc(TotalLen, Length(SLineBreak) * (Last - First)); + // step2: build up result string + SetLength(Result, TotalLen); + P := PWideChar(Result); + CopyAndForward(Lines[First], ColFrom, MaxInt, P); + + CopyAndForward(SLineBreak, 1, MaxInt, P); + + for i := First + 1 to Last - 1 do + begin + CopyAndForward(Lines[i], 1, MaxInt, P); + CopyAndForward(SLineBreak, 1, MaxInt, P); + end; + CopyAndForward(Lines[Last], 1, ColTo - 1, P); + end; + smColumn: + begin + with BufferToDisplayPos(BlockBegin) do + begin + First := Row; + ColFrom := Column; + end; + with BufferToDisplayPos(BlockEnd) do + begin + Last := Row; + ColTo := Column; + end; + if ColFrom > ColTo then + SwapInt(ColFrom, ColTo); + // step1: pre-allocate string large enough for worst case + TotalLen := ((ColTo - ColFrom) + Length(sLineBreak)) * + (Last - First +1); + SetLength(Result, TotalLen); + P := PWideChar(Result); + + // step2: copy chunks to the pre-allocated string + TotalLen := 0; + for cRow := First to Last do + begin + vAuxRowCol.Row := cRow; + vAuxRowCol.Column := ColFrom; + vAuxLineChar := DisplayToBufferPos(vAuxRowCol); + l := vAuxLineChar.Char; + s := Lines[vAuxLineChar.Line - 1]; + vAuxRowCol.Column := ColTo; + r := DisplayToBufferPos(vAuxRowCol).Char; + + vTrimCount := CopyPaddedAndForward(s, l, r - l, P); + TotalLen := TotalLen + (r - l) - vTrimCount + Length(sLineBreak); + CopyAndForward(sLineBreak, 1, MaxInt, P); + end; + SetLength(Result, TotalLen - Length(sLineBreak)); + end; + smLine: + begin + // If block selection includes LastLine, + // line break code(s) of the last line will not be added. + // step1: calculate total length of result string + for i := First to Last do + Inc(TotalLen, Length(Lines[i]) + Length(SLineBreak)); + if Last = Lines.Count then + Dec(TotalLen, Length(SLineBreak)); + // step2: build up result string + SetLength(Result, TotalLen); + P := PWideChar(Result); + for i := First to Last - 1 do + begin + CopyAndForward(Lines[i], 1, MaxInt, P); + CopyAndForward(SLineBreak, 1, MaxInt, P); + end; + CopyAndForward(Lines[Last], 1, MaxInt, P); + if (Last + 1) < Lines.Count then + CopyAndForward(SLineBreak, 1, MaxInt, P); + end; + end; + end; +end; + +function TCustomSynEdit.SynGetText: UnicodeString; +begin + Result := Lines.Text; +end; + +function TCustomSynEdit.GetWordAtCursor: UnicodeString; +begin + Result := GetWordAtRowCol(CaretXY); +end; + +procedure TCustomSynEdit.HideCaret; +begin + if sfCaretVisible in FStateFlags then + if Windows.HideCaret(Handle) then + Exclude(FStateFlags, sfCaretVisible); +end; + +procedure TCustomSynEdit.IncPaintLock; +begin + Inc(FPaintLock); +end; + +procedure TCustomSynEdit.InvalidateGutter; +begin + InvalidateGutterLines(-1, -1); +end; + +procedure TCustomSynEdit.InvalidateGutterLine(aLine: Integer); +begin + if (aLine < 1) or (aLine > Lines.Count) then + Exit; + + InvalidateGutterLines(aLine, aLine); +end; + +procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLine: Integer); +// note: FirstLine and LastLine don't need to be in correct order +var + rcInval: TRect; +begin + if Visible and HandleAllocated then + if (FirstLine = -1) and (LastLine = -1) then + begin + rcInval := Rect(0, 0, FGutterWidth, ClientHeight); + if sfLinesChanging in FStateFlags then + UnionRect(fInvalidateRect, rcInval, fInvalidateRect) + else + InvalidateRect(rcInval, False); + end + else begin + { find the visible lines first } + if (LastLine < FirstLine) then + SwapInt(LastLine, FirstLine); +{$IFDEF SYN_CodeFolding} + if UseCodeFolding or WordWrap then +{$ELSE} + if WordWrap then +{$ENDIF} + begin + FirstLine := LineToRow(FirstLine); + if LastLine <= Lines.Count then + LastLine := LineToRow(LastLine) + else + LastLine := MaxInt; + end; + FirstLine := Max(FirstLine, TopLine); + LastLine := Min(LastLine, TopLine + LinesInWindow); + { any line visible? } + if (LastLine >= FirstLine) then + begin + rcInval := Rect(0, FTextHeight * (FirstLine - TopLine), + FGutterWidth, FTextHeight * (LastLine - TopLine + 1)); + if sfLinesChanging in FStateFlags then + UnionRect(fInvalidateRect, rcInval, fInvalidateRect) + else + InvalidateRect(rcInval, False); + end; + end; +end; + +procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: Integer); +// note: FirstLine and LastLine don't need to be in correct order +var + rcInval: TRect; +begin + if Visible and HandleAllocated then + if (FirstLine = -1) and (LastLine = -1) then + begin + rcInval := ClientRect; + Inc(rcInval.Left, FGutterWidth); + if sfLinesChanging in FStateFlags then +//++ Flicker Reduction + UnionRect(fInvalidateRect, rcInval, fInvalidateRect) +//-- Flicker Reduction + else + InvalidateRect(rcInval, False); + end + else begin + FirstLine := Max(FirstLine,1); + LastLine := Max(LastLine,1); + { find the visible lines first } + if (LastLine < FirstLine) then + SwapInt(LastLine, FirstLine); + + if LastLine >= Lines.Count then + LastLine := MaxInt; // paint empty space beyond last line + +{$IFDEF SYN_CodeFolding} + if UseCodeFolding or WordWrap then + begin + FirstLine := LineToRow(FirstLine); + // Could avoid this conversion if (First = Last) and + // (Length < CharsInWindow) but the dependency isn't worth IMO. + if LastLine < Lines.Count then begin + if UseCodeFolding then + LastLine := LineToRow(LastLine) + else + LastLine := LineToRow(LastLine + 1) - 1; + end; + end; +{$ELSE} + if WordWrap then + begin + FirstLine := LineToRow(FirstLine); + // Could avoid this conversion if (First = Last) and + // (Length < CharsInWindow) but the dependency isn't worth IMO. + if LastLine < Lines.Count then + LastLine := LineToRow(LastLine + 1) - 1; + end; +{$ENDIF} + + // TopLine is in display coordinates, so FirstLine and LastLine must be + // converted previously. + FirstLine := Max(FirstLine, TopLine); + LastLine := Min(LastLine, TopLine + LinesInWindow); + + { any line visible? } + if (LastLine >= FirstLine) then + begin + rcInval := Rect(FGutterWidth, FTextHeight * (FirstLine - TopLine), + ClientWidth, FTextHeight * (LastLine - TopLine + 1)); + if sfLinesChanging in FStateFlags then + UnionRect(fInvalidateRect, rcInval, fInvalidateRect) + else + InvalidateRect(rcInval, False); + end; + end; +end; + +procedure TCustomSynEdit.InvalidateSelection; +begin + InvalidateLines(BlockBegin.Line, BlockEnd.Line); +end; + +{$IFDEF SYN_COMPILER_5} +function TryStrToInt(const S: string; out Value: Integer): Boolean; +var + E: Integer; +begin + Val(S, Value, E); + Result := E = 0; +end; +{$ENDIF} + +procedure TCustomSynEdit.KeyUp(var Key: Word; Shift: TShiftState); +{$IFDEF SYN_LINUX} +var + Code: Byte; +{$ENDIF} +var + CharCode: Integer; + KeyMsg: TWMKey; +begin + {$IFDEF SYN_LINUX} + // uniform Keycode: key has the same value wether Shift is pressed or not + if Key <= 255 then + begin + Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); + Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); + if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); + end; + {$ENDIF} + + if (ssAlt in Shift) and (Key >= VK_NUMPAD0) and (Key <= VK_NUMPAD9) then + FCharCodeString := FCharCodeString + IntToStr(Key - VK_NUMPAD0); + + if Key = VK_MENU then + begin + if (FCharCodeString <> '') and TryStrToInt(FCharCodeString, CharCode) and + (CharCode >= 256) and (CharCode <= 65535) then + begin + KeyMsg.Msg := WM_CHAR; + KeyMsg.CharCode := CharCode; + KeyMsg.Unused := 0; + KeyMsg.KeyData := 0; + DoKeyPressW(KeyMsg); + FIgnoreNextChar := True; + end; + FCharCodeString := ''; + end; + + inherited; + FKbdHandler.ExecuteKeyUp(Self, Key, Shift); +end; + +procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); +var + Data: Pointer; + C: WideChar; + Cmd: TSynEditorCommand; + {$IFDEF SYN_LINUX} + Code: Byte; + {$ENDIF} +begin + {$IFDEF SYN_LINUX} + // uniform Keycode: key has the same value wether Shift is pressed or not + if Key <= 255 then + begin + Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); + Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); + if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); + end; + {$ENDIF} + inherited; + FKbdHandler.ExecuteKeyDown(Self, Key, Shift); + + Data := nil; + C := #0; + try + Cmd := TranslateKeyCode(Key, Shift, Data); + if Cmd <> ecNone then begin + Key := 0; // eat it. + Include(FStateFlags, sfIgnoreNextChar); + CommandProcessor(Cmd, C, Data); + end + else + Exclude(FStateFlags, sfIgnoreNextChar); + finally + if Data <> nil then + FreeMem(Data); + end; +end; + +procedure TCustomSynEdit.Loaded; +begin + inherited Loaded; + GutterChanged(Self); + UpdateScrollBars; +end; + +procedure TCustomSynEdit.KeyPress(var Key: Char); +begin +end; + +type + TAccessWinControl = class(TWinControl); + +{.$MESSAGE 'Check what must be adapted in DoKeyPressW and related methods'} +procedure TCustomSynEdit.DoKeyPressW(var Message: TWMKey); +var + Form: TCustomForm; + Key: WideChar; +begin + if FIgnoreNextChar then + begin + FIgnoreNextChar := False; + Exit; + end; + + Key := WideChar(Message.CharCode); + + Form := GetParentForm(Self); + if (Form <> nil) and (Form <> TWinControl(Self)) and Form.KeyPreview and + (Key <= High(AnsiChar)) and TAccessWinControl(Form).DoKeyPress(Message) + then + Exit; + Key := WideChar(Message.CharCode); + + if (csNoStdEvents in ControlStyle) then Exit; + + if Assigned(FOnKeyPressW) then + FOnKeyPressW(Self, Key); + + if WideChar(Key) <> #0 then + KeyPressW(Key); +end; + +procedure TCustomSynEdit.KeyPressW(var Key: WideChar); +begin + // don't fire the event if key is to be ignored + if not (sfIgnoreNextChar in FStateFlags) then + begin + FKbdHandler.ExecuteKeyPress(Self, Key); + CommandProcessor(ecChar, Key, nil); + end + else + // don't ignore further keys + Exclude(FStateFlags, sfIgnoreNextChar); +end; + +function TCustomSynEdit.LeftSpaces(const Line: UnicodeString): Integer; +begin + Result := LeftSpacesEx(Line, False); +end; + +function TCustomSynEdit.LeftSpacesEx(const Line: UnicodeString; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; +var + p: PWideChar; +begin + p := PWideChar(UnicodeString(Line)); + if Assigned(p) and ((eoAutoIndent in fOptions) or CalcAlways) then + begin + Result := 0; + while (p^ >= #1) and (p^ <= #32) do + begin + if (p^ = #9) and WantTabs then + Inc(Result, TabWidth) + else + Inc(Result); + Inc(p); + end; + end + else + Result := 0; +end; + +function TCustomSynEdit.GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): UnicodeString; +begin + if WantTabs and not(eoTabsToSpaces in Options) and (CharCount >= TabWidth) then + Result := UnicodeStringOfChar(#9, CharCount div TabWidth) + + UnicodeStringOfChar(#32, CharCount mod TabWidth) + else + Result := UnicodeStringOfChar(#32, CharCount); +end; + +procedure TCustomSynEdit.LinesChanging(Sender: TObject); +begin + Include(FStateFlags, sfLinesChanging); +end; + +procedure TCustomSynEdit.LinesChanged(Sender: TObject); +var + vOldMode: TSynSelectionMode; +begin +{$IFDEF SYN_CodeFolding} + if (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then + begin + if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then + TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, + fLines); + InvalidateGutter; + Include(fStateFlags, sfScrollbarChanged); + end; +{$ENDIF} + Exclude(FStateFlags, sfLinesChanging); + if HandleAllocated then + begin +//++ Flicker Reduction +// UpdateScrollBars; +//-- Flicker Reduction + vOldMode := FActiveSelectionMode; + SetBlockBegin(CaretXY); + FActiveSelectionMode := vOldMode; + InvalidateRect(FInvalidateRect, False); + FillChar(FInvalidateRect, SizeOf(TRect), 0); + if FGutter.ShowLineNumbers and FGutter.AutoSize then + FGutter.AutoSizeDigitCount(Lines.Count); + if not (eoScrollPastEof in Options) then + TopLine := TopLine; + end; +end; + +procedure TCustomSynEdit.MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); +var + bWasSel: Boolean; + bStartDrag: Boolean; + TmpBegin, TmpEnd: TBufferCoord; +begin + TmpBegin := FBlockBegin; + TmpEnd := FBlockEnd; + + bWasSel := False; + bStartDrag := False; + if Button = mbLeft then + begin + if SelAvail then + begin + //remember selection state, as it will be cleared later + bWasSel := True; + FMouseDownX := X; + FMouseDownY := Y; + end; + end; + + inherited MouseDown(Button, Shift, X, Y); + + if (Button = mbLeft) and (ssDouble in Shift) then Exit; + + FKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y); + + if (Button in [mbLeft, mbRight]) then + begin + if Button = mbRight then + begin + if (eoRightMouseMovesCursor in Options) and + (SelAvail and not IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) + or not SelAvail) then + begin + InvalidateSelection; + FBlockEnd := FBlockBegin; + ComputeCaret(X, Y); + end + else + Exit; + end + else + ComputeCaret(X, Y); + end; + + if Button = mbLeft then + begin + //I couldn't track down why, but sometimes (and definately not all the time) + //the block positioning is lost. This makes sure that the block is + //maintained in case they started a drag operation on the block + FBlockBegin := TmpBegin; + FBlockEnd := TmpEnd; + + MouseCapture := True; + //For some reason SynEdit could get to a state where MouseCapture was True + //while just scrolling the window. That resulted in contents being painted + //while vertical scrollbar was moved. To make sure that we paint only when + //a MouseDown has happened inside the SynEdit Window, an extra flag is used. + Include(FStateFlags, sfMouseCaptured); + //if mousedown occurred in selected block begin drag operation + Exclude(FStateFlags, sfWaitForDragging); + if bWasSel and (eoDragDropEditing in FOptions) and (X >= FGutterWidth + 2) + and (SelectionMode = smNormal) and IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) then + begin + bStartDrag := True + end; + end; + + if (Button = mbLeft) and bStartDrag then + Include(FStateFlags, sfWaitForDragging) + else + begin + if not (sfDblClicked in FStateFlags) then + begin + if ssShift in Shift then + //BlockBegin and BlockEnd are restored to their original position in the + //code from above and SetBlockEnd will take care of proper invalidation + SetBlockEnd(CaretXY) + else + begin + if (eoAltSetsColumnMode in Options) and (FActiveSelectionMode <> smLine) then + begin + if ssAlt in Shift then + SelectionMode := smColumn + else + SelectionMode := smNormal; + end; + //Selection mode must be set before calling SetBlockBegin + SetBlockBegin(CaretXY); + end; + end; + end; + + if (X < FGutterWidth) then + Include(FStateFlags, sfPossibleGutterClick); + if (sfPossibleGutterClick in FStateFlags) and (Button = mbRight) then + begin + DoOnGutterClick(Button, X, Y) + end; + + SetFocus; + Windows.SetFocus(Handle); +end; + +procedure TCustomSynEdit.MouseMove(Shift: TShiftState; X, Y: Integer); +var + P: TDisplayCoord; +begin + inherited MouseMove(Shift, x, y); + if MouseCapture and (sfWaitForDragging in FStateFlags) then + begin + if (Abs(FMouseDownX - X) >= GetSystemMetrics(SM_CXDRAG)) + or (Abs(FMouseDownY - Y) >= GetSystemMetrics(SM_CYDRAG)) then + begin + Exclude(FStateFlags, sfWaitForDragging); + BeginDrag(False); + end; + end + else if (ssLeft in Shift) and MouseCapture and (sfMouseCaptured in FStateFlags) then + begin + // should we begin scrolling? + ComputeScroll(X, Y); + { compute new caret } + P := PixelsToNearestRowColumn(X, Y); + P.Row := MinMax(P.Row, 1, DisplayLineCount); + if FScrollDeltaX <> 0 then + P.Column := DisplayX; + if fScrollDeltaY <> 0 then + P.Row := DisplayY; + InternalCaretXY := DisplayToBufferPos(P); + BlockEnd := CaretXY; + if (sfPossibleGutterClick in FStateFlags) and (FBlockBegin.Line <> CaretXY.Line) then + Include(FStateFlags, sfGutterDragging); + end; +end; + +procedure TCustomSynEdit.ScrollTimerHandler(Sender: TObject); +var + iMousePos: TPoint; + C: TDisplayCoord; + X, Y: Integer; + vCaret: TBufferCoord; +begin + GetCursorPos( iMousePos ); + iMousePos := ScreenToClient( iMousePos ); + C := PixelsToRowColumn( iMousePos.X, iMousePos.Y ); + C.Row := MinMax(C.Row, 1, DisplayLineCount); + if FScrollDeltaX <> 0 then + begin + LeftChar := LeftChar + FScrollDeltaX; + X := LeftChar; + if FScrollDeltaX > 0 then // scrolling right? + Inc(X, CharsInWindow); + C.Column := X; + end; + if fScrollDeltaY <> 0 then + begin + if GetKeyState(SYNEDIT_SHIFT) < 0 then + TopLine := TopLine + fScrollDeltaY * LinesInWindow + else + TopLine := TopLine + fScrollDeltaY; + Y := TopLine; + if fScrollDeltaY > 0 then // scrolling down? + Inc(Y, LinesInWindow - 1); + C.Row := MinMax(Y, 1, DisplayLineCount); + end; + vCaret := DisplayToBufferPos(C); + if (CaretX <> vCaret.Char) or (CaretY <> vCaret.Line) then + begin + // changes to line / column in one go + IncPaintLock; + try + InternalCaretXY := vCaret; + // if MouseCapture is True we're changing selection. otherwise we're dragging + if MouseCapture and (sfMouseCaptured in FStateFlags) then + SetBlockEnd(CaretXY); + finally + DecPaintLock; + end; + end; + ComputeScroll(iMousePos.x, iMousePos.y); +end; + +procedure TCustomSynEdit.MouseUp(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); +{$IFDEF SYN_CodeFolding} +Var + ptLineCol: TBufferCoord; + ptRowCol: TDisplayCoord; + Index: Integer; + Rect: TRect; +{$ENDIF} +begin + inherited MouseUp(Button, Shift, X, Y); + FKbdHandler.ExecuteMouseUp(Self, Button, Shift, X, Y); + + FScrollTimer.Enabled := False; + if (Button = mbRight) and (Shift = [ssRight]) and Assigned(PopupMenu) then + Exit; + MouseCapture := False; + Exclude(FStateFlags, sfMouseCaptured); + if (sfPossibleGutterClick in FStateFlags) and (X < FGutterWidth) and (Button <> mbRight) then + DoOnGutterClick(Button, X, Y) + else + if FStateFlags * [sfDblClicked, sfWaitForDragging] = [sfWaitForDragging] then + begin + ComputeCaret(X, Y); + if not(ssShift in Shift) then + SetBlockBegin(CaretXY); + SetBlockEnd(CaretXY); + Exclude(FStateFlags, sfWaitForDragging); + end; + Exclude(FStateFlags, sfDblClicked); + Exclude(FStateFlags, sfPossibleGutterClick); + Exclude(FStateFlags, sfGutterDragging); +{$IFDEF SYN_CodeFolding} + ptRowCol := PixelsToRowColumn(X, Y); + ptLineCol := DisplayToBufferPos(ptRowCol); + + if UseCodeFolding and CodeFolding.ShowHintMark and + fAllFoldRanges.CollapsedFoldStartAtLine(ptLineCol.Line, Index) then + begin + Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); + if PtInRect(Rect, Point(X,Y)) then + Uncollapse(Index); + end; +{$ENDIF} +end; + +procedure TCustomSynEdit.DoOnGutterClick(Button: TMouseButton; X, Y: Integer); +var + i : Integer; + offs : Integer; + line : Integer; + allmrk: TSynEditMarks; + mark : TSynEditMark; +{$IFDEF SYN_CodeFolding} + Index : integer; + RowColumn: TDisplayCoord; +begin + RowColumn := PixelsToRowColumn(X, Y); + Line := RowToLine(RowColumn.Row); + + // Check if we clicked on a folding thing + if UseCodeFolding then begin + if AllFoldRanges.FoldStartAtLine(Line, Index) then + begin + // See if we actually clicked on the rectangle... + if PtInRect(GetFoldShapeRect(RowColumn.Row), Point(X, Y)) then begin + if AllFoldRanges.Ranges[Index].Collapsed then + Uncollapse(Index) + else + Collapse(Index); + Exit; + end; + end; + end; +{$ELSE} +begin +{$ENDIF} + if Assigned(FOnGutterClick) then + begin + line := DisplayToBufferPos(PixelsToRowColumn(X,Y)).Line; + if line <= Lines.Count then + begin + Marks.GetMarksForLine(line, allmrk); + offs := 0; + mark := nil; + for i := 1 to MAX_MARKS do + begin + if assigned(allmrk[i]) then + begin + Inc(offs, BookMarkOptions.XOffset); + if X < offs then + begin + mark := allmrk[i]; + Break; + end; + end; + end; //for + FOnGutterClick(Self, Button, X, Y, line, mark); + end; + end; +end; + +procedure TCustomSynEdit.Paint; +var + rcClip, rcDraw: TRect; + nL1, nL2, nC1, nC2: Integer; +begin + // Get the invalidated rect. Compute the invalid area in lines / columns. + rcClip := Canvas.ClipRect; + // columns + nC1 := LeftChar; + if (rcClip.Left > FGutterWidth + 2) then + Inc(nC1, (rcClip.Left - FGutterWidth - 2) div CharWidth); + nC2 := LeftChar + + (rcClip.Right - FGutterWidth - 2 + CharWidth - 1) div CharWidth; + // lines + nL1 := Max(TopLine + rcClip.Top div FTextHeight, TopLine); + nL2 := MinMax(TopLine + (rcClip.Bottom + FTextHeight - 1) div FTextHeight, + 1, DisplayLineCount); + + // Now paint everything while the caret is hidden. + HideCaret; + try + // First paint the gutter area if it was (partly) invalidated. + if (rcClip.Left < FGutterWidth) then + begin + rcDraw := rcClip; + rcDraw.Right := FGutterWidth; + PaintGutter(rcDraw, nL1, nL2); + end; + // Then paint the text area if it was (partly) invalidated. + if (rcClip.Right > FGutterWidth) then + begin + rcDraw := rcClip; + rcDraw.Left := Max(rcDraw.Left, FGutterWidth); + PaintTextLines(rcDraw, nL1, nL2, nC1, nC2); + end; + + // consider paint lock (inserted by CWBudde, 30th of July 2015) + if PaintLock = 0 then + PluginsAfterPaint(Canvas, rcClip, nL1, nL2); + // If there is a custom paint handler call it. + if PaintLock = 0 then + DoOnPaint; + if PaintLock = 0 then + DoOnPaintTransient(ttAfter); + finally + UpdateCaret; + end; +end; + +procedure TCustomSynEdit.PaintGutter(const AClip: TRect; + const aFirstRow, aLastRow: Integer); + + procedure DrawMark(aMark: TSynEditMark; var aGutterOff: Integer; + aMarkRow: Integer); + begin + if (not aMark.InternalImage) and Assigned(FBookMarkOpt.BookmarkImages) then + begin + if aMark.ImageIndex <= FBookMarkOpt.BookmarkImages.Count then + begin + if aMark.IsBookmark = BookMarkOptions.DrawBookmarksFirst then + aGutterOff := 0 + else if aGutterOff = 0 then + aGutterOff := FBookMarkOpt.XOffset; + with FBookMarkOpt do + BookmarkImages.Draw(Canvas, LeftMargin + aGutterOff, + (aMarkRow - TopLine) * FTextHeight, aMark.ImageIndex); + Inc(aGutterOff, FBookMarkOpt.XOffset); + end; + end + else begin + if aMark.ImageIndex in [0..9] then + begin + if not Assigned(FInternalImage) then + begin + FInternalImage := TSynInternalImage.Create(HINSTANCE, + 'SynEditInternalImages', 10); +//++ DPI-Aware + if Screen.PixelsPerInch >= 120 then + fInternalImage.ChangeScale(Screen.PixelsPerInch, 96); +//-- DPI-Aware + end; + if aGutterOff = 0 then + begin + FInternalImage.Draw(Canvas, aMark.ImageIndex, + FBookMarkOpt.LeftMargin + aGutterOff, + (aMarkRow - TopLine) * FTextHeight, FTextHeight); + end; + Inc(aGutterOff, FBookMarkOpt.XOffset); + end; + end; + end; + + procedure DrawModification(Color: TColor; Top, Bottom: Integer); + var + OldColor: TColor; + OldStyle: TBrushStyle; + begin + FTextDrawer.SetBackColor(Color); + + OldStyle := Canvas.Brush.Style; + OldColor := Canvas.Brush.Color; + + Canvas.Brush.Style := bsSolid; + Canvas.Brush.Color := Color; + + Canvas.FillRect(Rect(FGutterWidth - FGutter.RightOffset - FGutter.ModificationBarWidth, Top, + FGutterWidth - FGutter.RightOffset, Bottom)); + + Canvas.Brush.Style := OldStyle; + Canvas.Brush.Color := OldColor; + + FTextDrawer.SetBackColor(FGutter.Color); + end; + +var + cLine: Integer; + cMark: Integer; + rcLine: TRect; + aGutterOffs: PIntArray; + bHasOtherMarks: Boolean; + s: UnicodeString; + vFirstLine: Integer; + vLastLine: Integer; + vMarkRow: Integer; + vGutterRow: Integer; + vLineTop: Integer; + vTextOffset: Integer; + dc: HDC; + TextSize: TSize; +{$IFDEF SYN_CodeFolding} + vLine: Integer; + cRow : Integer; + rcFold: TRect; + x: Integer; + FoldRange: TSynFoldRange; + Index : Integer; +{$ENDIF} +begin + vFirstLine := RowToLine(aFirstRow); + vLastLine := RowToLine(aLastRow); + //todo: Does the following comment still apply? + // Changed to use FTextDrawer.BeginDrawing and FTextDrawer.EndDrawing only + // when absolutely necessary. Note: Never change brush / pen / font of the + // canvas inside of this block (only through methods of FTextDrawer)! + // If we have to draw the line numbers then we don't want to erase + // the background first. Do it line by line with TextRect instead + // and fill only the area after the last visible line. + dc := Canvas.Handle; + + if FGutter.Gradient then + SynDrawGradient(Canvas, FGutter.GradientStartColor, FGutter.GradientEndColor, + FGutter.GradientSteps, Rect(0, 0, FGutterWidth, ClientHeight), True); + + Canvas.Brush.Color := FGutter.Color; + + if FGutter.ShowLineNumbers then + begin + if FGutter.UseFontStyle then + FTextDrawer.SetBaseFont(FGutter.Font) + else + FTextDrawer.Style := []; + FTextDrawer.BeginDrawing(dc); + try + if FGutter.UseFontStyle then + FTextDrawer.SetForeColor(FGutter.Font.Color) + else + FTextDrawer.SetForeColor(Self.Font.Color); + FTextDrawer.SetBackColor(FGutter.Color); + + // prepare the rect initially + rcLine := AClip; + rcLine.Right := Max(rcLine.Right, FGutterWidth - 2); + rcLine.Bottom := rcLine.Top; + + for cLine := vFirstLine to vLastLine do + begin +{$IFDEF SYN_CodeFolding} + if UseCodeFolding and AllFoldRanges.FoldHidesLine(cLine, Index) then + continue; +{$ENDIF} + vLineTop := (LineToRow(cLine) - TopLine) * FTextHeight; + if WordWrap and not FGutter.Gradient then + begin + // erase space between wrapped lines (from previous line to current one) + rcLine.Top := rcLine.Bottom; + rcLine.Bottom := vLineTop; + with rcLine do + FTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); + end; + // next line rect + rcLine.Top := vLineTop; + rcLine.Bottom := rcLine.Top + FTextHeight; + + s := FGutter.FormatLineNumber(cLine); + if Assigned(OnGutterGetText) then + OnGutterGetText(Self, cLine, s); + TextSize := GetTextSize(DC, PWideChar(s), Length(s)); + vTextOffset := (FGutterWidth - FGutter.RightOffset - FGutter.RightMargin) - TextSize.cx; + if FGutter.ShowModification then + vTextOffset := vTextOffset - FGutter.ModificationBarWidth; + + if FGutter.Gradient then + begin + SetBkMode(DC, TRANSPARENT); + Windows.ExtTextOutW(DC, vTextOffset, + rcLine.Top + ((FTextHeight - Integer(TextSize.cy)) div 2), 0, + @rcLine, PWideChar(s), Length(s), nil); + SetBkMode(DC, OPAQUE); + end + else + Windows.ExtTextOutW(DC, vTextOffset, + rcLine.Top + ((FTextHeight - Integer(TextSize.cy)) div 2), ETO_OPAQUE, + @rcLine, PWideChar(s), Length(s), nil); + + // eventually draw modifications + if FGutter.ShowModification then + case TSynEditStringList(FLines).Modification[cLine - 1] of + smModified: + DrawModification(FGutter.ModificationColorModified, rcLine.Top, rcLine.Bottom); + smSaved: + DrawModification(FGutter.ModificationColorSaved, rcLine.Top, rcLine.Bottom); + end; + end; + // now erase the remaining area if any + if (AClip.Bottom > rcLine.Bottom) and not FGutter.Gradient then + begin + rcLine.Top := rcLine.Bottom; + rcLine.Bottom := AClip.Bottom; + with rcLine do + FTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); + end; + finally + FTextDrawer.EndDrawing; + if FGutter.UseFontStyle then + FTextDrawer.SetBaseFont(Self.Font); + end; + end + else + begin + if not FGutter.Gradient then + Canvas.FillRect(AClip); + + if FGutter.ShowModification then + for cLine := vFirstLine to vLastLine do + begin + vLineTop := (LineToRow(cLine) - TopLine) * FTextHeight; + case TSynEditStringList(FLines).Modification[cLine - 1] of + smModified: + DrawModification(FGutter.ModificationColorModified, vLineTop, vLineTop + fTextHeight); + smSaved: + DrawModification(FGutter.ModificationColorSaved, vLineTop, vLineTop + fTextHeight); + end; + end; + end; + +{$IFDEF MSWINDOWS} + // draw Word wrap glyphs transparently over gradient + if FGutter.Gradient then + Canvas.Brush.Style := bsClear; +{$ENDIF} + // paint wrapped line glyphs + if WordWrap and FWordWrapGlyph.Visible then + for cLine := aFirstRow to aLastRow do + if LineToRow(RowToLine(cLine)) <> cLine then + FWordWrapGlyph.Draw(Canvas, + (FGutterWidth - FGutter.RightOffset - 2) - FWordWrapGlyph.Width, + (cLine - TopLine) * FTextHeight, FTextHeight); +{$IFDEF MSWINDOWS} + // restore brush + if FGutter.Gradient then + Canvas.Brush.Style := bsSolid; +{$ENDIF} + +{$IFDEF SYN_CodeFolding} + // Draw the folding lines and squares + if UseCodeFolding then begin + for cRow := aFirstRow to aLastRow do begin + vLine := RowToLine(cRow); + if (vLine > Lines.Count) and not (Lines.Count = 0) then + break; + + rcFold := GetFoldShapeRect(cRow); + + Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; + + // Any fold ranges beginning on this line? + if AllFoldRanges.FoldStartAtLine(vLine, Index) then begin + FoldRange := AllFoldRanges.Ranges[Index]; + Canvas.Brush.Color := fCodeFolding.FolderBarLinesColor; + Canvas.FrameRect(rcFold); + + // Paint minus sign + Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; + Canvas.MoveTo(rcFold.Left + 2, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); + Canvas.LineTo(rcFold.Right - 2, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); + + // Paint vertical line of plus sign + if FoldRange.Collapsed then begin + x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); + Canvas.MoveTo(x, rcFold.Top + 2); + Canvas.LineTo(x, rcFold.Bottom - 2); + end + else + // Draw the bottom part of a line + begin + x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); + Canvas.MoveTo(x, rcFold.Bottom); + Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); + end; + end + else begin + // Need to paint a line end? + if AllFoldRanges.FoldEndAtLine(vLine, Index) then begin + x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); + Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); + Canvas.LineTo(x, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); + Canvas.LineTo(rcFold.Right, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); + end; + // Need to paint a line? + if AllFoldRanges.FoldAroundLine(vLine, Index) then begin + x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); + Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); + Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); + end; + end; + end; + end; +{$ENDIF} + + // the gutter separator if visible + if (FGutter.BorderStyle <> gbsNone) and (AClip.Right >= FGutterWidth - 2) then + with Canvas do + begin + Pen.Color := FGutter.BorderColor; + Pen.Width := 1; + with AClip do + begin + if FGutter.BorderStyle = gbsMiddle then + begin + MoveTo(FGutterWidth - 2, Top); + LineTo(FGutterWidth - 2, Bottom); + Pen.Color := FGutter.Color; + end; + MoveTo(FGutterWidth - 1, Top); + LineTo(FGutterWidth - 1, Bottom); + end; + end; + + // now the gutter marks + if BookMarkOptions.GlyphsVisible and (Marks.Count > 0) + and (vLastLine >= vFirstLine) then + begin + aGutterOffs := AllocMem((aLastRow - aFirstRow + 1) * SizeOf(Integer)); + try + // Instead of making a two pass loop we look while drawing the bookmarks + // whether there is any other mark to be drawn + bHasOtherMarks := False; + for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do +{$IFDEF SYN_CodeFolding} + if Visible and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) + and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) + then +{$ELSE} + if Visible and (Line >= vFirstLine) and (Line <= vLastLine) then +{$ENDIF} + begin + if IsBookmark <> BookMarkOptions.DrawBookmarksFirst then + bHasOtherMarks := True + else begin + vMarkRow := LineToRow(Line); + if vMarkRow >= aFirstRow then + DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); + end + end; + if bHasOtherMarks then + for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do + begin + if Visible and (IsBookmark <> BookMarkOptions.DrawBookmarksFirst) +{$IFDEF SYN_CodeFolding} + and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) + and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) then +{$ELSE} + and (Line >= vFirstLine) and (Line <= vLastLine) then +{$ENDIF} + begin + vMarkRow := LineToRow(Line); + if vMarkRow >= aFirstRow then + DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); + end; + end; + if Assigned(OnGutterPaint) then + for cLine := vFirstLine to vLastLine do + begin + vGutterRow := LineToRow(cLine); + OnGutterPaint(Self, cLine, aGutterOffs[vGutterRow - aFirstRow], + (vGutterRow - TopLine) * LineHeight); + end; + finally + FreeMem(aGutterOffs); + end; + end + else if Assigned(OnGutterPaint) then + begin + for cLine := vFirstLine to vLastLine do + begin + vGutterRow := LineToRow(cLine); + OnGutterPaint(Self, cLine, 0, (vGutterRow - TopLine) * LineHeight); + end; + end; +end; + +// Inserts filling chars into a string containing chars that display as glyphs +// wider than an average glyph. (This is often the case with Asian glyphs, which +// are usually wider than latin glpyhs) +// This is only to simplify paint-operations and has nothing to do with +// multi-byte chars. +function TCustomSynEdit.ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; +var + i, j, CountOfAvgGlyphs: Integer; +begin + Result := S; + j := 0; + SetLength(Result, Length(S) * 2); // speed improvement + + for i := 1 to Length(S) do + begin + Inc(j); + CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(S[i]), FCharWidth); + + if j + CountOfAvgGlyphs > Length(Result) then + SetLength(Result, Length(Result) + 128); + + // insert CountOfAvgGlyphs filling chars + while CountOfAvgGlyphs > 1 do + begin + Result[j] := FillerChar; + Inc(j); + Dec(CountOfAvgGlyphs); + end; + + Result[j] := S[i]; + end; + + SetLength(Result, j); +end; + +// does the opposite of ExpandAtWideGlyphs +function TCustomSynEdit.ShrinkAtWideGlyphs(const S: UnicodeString; First: Integer; + var CharCount: Integer): UnicodeString; +var + i, j: Integer; +begin + SetLength(Result, Length(S)); + + i := First; + j := 0; + while i < First + CharCount do + begin + Inc(j); + while S[i] = FillerChar do + Inc(i); + Result[j] := S[i]; + Inc(i); + end; + + SetLength(Result, j); + CharCount := j; +end; + +procedure TCustomSynEdit.PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, + FirstCol, LastCol: Integer); +var + bDoRightEdge: Boolean; // right edge + nRightEdge: Integer; + // selection info + bAnySelection: Boolean; // any selection visible? + vSelStart: TDisplayCoord; // start of selected area + vSelEnd: TDisplayCoord; // end of selected area + // info about normal and selected text and background colors + bSpecialLine, bLineSelected, bCurrentLine: Boolean; + colFG, colBG: TColor; + colSelFG, colSelBG: TColor; + // info about selection of the current line + nLineSelStart, nLineSelEnd: Integer; + bComplexLine: Boolean; + // painting the background and the text + rcLine, rcToken: TRect; + TokenAccu: record + // Note: s is not managed as a string, it will only grow!!! + // Never use AppendStr or "+", use Len and MaxLen instead and + // copy the string chars directly. This is for efficiency. + Len, MaxLen, CharsBefore: Integer; + s: UnicodeString; + TabString: UnicodeString; + FG, BG: TColor; + Style: TFontStyles; + end; + dc: HDC; + SynTabGlyphString: UnicodeString; + + vFirstLine: Integer; + vLastLine: Integer; + +{ local procedures } + + function colEditorBG: TColor; + var + iAttri: TSynHighlighterAttributes; + begin + if (ActiveLineColor <> clNone) and (bCurrentLine) then + Result := ActiveLineColor + else begin + Result := Color; + if Highlighter <> nil then + begin + iAttri := Highlighter.WhitespaceAttribute; + if (iAttri <> nil) and (iAttri.Background <> clNone) then + Result := iAttri.Background; + end; + end; + end; + + procedure ComputeSelectionInfo; + var + vStart: TBufferCoord; + vEnd: TBufferCoord; + begin + bAnySelection := False; + // Only if selection is visible anyway. + if not HideSelection or Self.Focused then + begin + bAnySelection := True; + // Get the *real* start of the selected area. + if FBlockBegin.Line < FBlockEnd.Line then + begin + vStart := FBlockBegin; + vEnd := FBlockEnd; + end + else if FBlockBegin.Line > FBlockEnd.Line then + begin + vEnd := FBlockBegin; + vStart := FBlockEnd; + end + else if FBlockBegin.Char <> FBlockEnd.Char then + begin + // No selection at all, or it is only on this line. + vStart.Line := FBlockBegin.Line; + vEnd.Line := vStart.Line; + if FBlockBegin.Char < FBlockEnd.Char then + begin + vStart.Char := FBlockBegin.Char; + vEnd.Char := FBlockEnd.Char; + end + else + begin + vStart.Char := FBlockEnd.Char; + vEnd.Char := FBlockBegin.Char; + end; + end + else + bAnySelection := False; + // If there is any visible selection so far, then test if there is an + // intersection with the area to be painted. + if bAnySelection then + begin + // Don't care if the selection is not visible. + bAnySelection := (vEnd.Line >= vFirstLine) and (vStart.Line <= vLastLine); + if bAnySelection then + begin + // Transform the selection from text space into screen space + vSelStart := BufferToDisplayPos(vStart); + vSelEnd := BufferToDisplayPos(vEnd); + // In the column selection mode sort the begin and end of the selection, + // this makes the painting code simpler. + if (FActiveSelectionMode = smColumn) and (vSelStart.Column > vSelEnd.Column) then + SwapInt(vSelStart.Column, vSelEnd.Column); + end; + end; + end; + end; + + procedure SetDrawingColors(Selected: Boolean); + begin + with FTextDrawer do + if Selected then + begin + SetBackColor(colSelBG); + SetForeColor(colSelFG); + Canvas.Brush.Color := colSelBG; + end + else begin + SetBackColor(colBG); + SetForeColor(colFG); + Canvas.Brush.Color := colBG; + end; + end; + + function ColumnToXValue(Col: Integer): Integer; + begin + Result := FTextOffset + Pred(Col) * FCharWidth; + end; + + //todo: Review SpecialChars and HardTabs painting. Token parameter of PaintToken procedure could very probably be passed by reference. + + // Note: The PaintToken procedure will take care of invalid parameters + // like empty token rect or invalid indices into TokenLen. + // CharsBefore tells if Token starts at column one or not + procedure PaintToken(Token: UnicodeString; + TokenLen, CharsBefore, First, Last: Integer); + var + Text: UnicodeString; + Counter, nX, nCharsToPaint: Integer; + sTabbedToken: UnicodeString; + DoTabPainting: Boolean; + i, TabStart, TabLen, CountOfAvgGlyphs, VisibleGlyphPart, FillerCount, + NonFillerPos: Integer; + rcTab: TRect; + const + ETOOptions = [tooOpaque, tooClipped]; + begin + sTabbedToken := Token; + DoTabPainting := False; + + Counter := Last - CharsBefore; + while Counter > First - CharsBefore - 1 do + begin + if Length(Token) >= Counter then + begin + if FShowSpecChar and (Token[Counter] = #32) then + Token[Counter] := SynSpaceGlyph + else if Token[Counter] = #9 then + begin + Token[Counter] := #32; //Tabs painted differently if necessary + DoTabPainting := FShowSpecChar; + end; + end; + Dec(Counter); + end; + + if (Last >= First) and (rcToken.Right > rcToken.Left) then + begin + nX := ColumnToXValue(First); + + Dec(First, CharsBefore); + Dec(Last, CharsBefore); + + if (First > TokenLen) then + begin + nCharsToPaint := 0; + Text := ''; + end + else + begin + FillerCount := 0; + NonFillerPos := First; + while Token[NonFillerPos] = FillerChar do + begin + Inc(FillerCount); + Inc(NonFillerPos); + end; + + CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(Token[NonFillerPos]) , FCharWidth); + + // first visible part of the glyph (1-based) + // (the glyph is visually sectioned in parts of size FCharWidth) + VisibleGlyphPart := CountOfAvgGlyphs - FillerCount; + + // clip off invisible parts + nX := nX - FCharWidth * (VisibleGlyphPart - 1); + + nCharsToPaint := Min(Last - First + 1, TokenLen - First + 1); + + // clip off partially visible glyphs at line end + if WordWrap then + while nX + FCharWidth * nCharsToPaint > ClientWidth do + begin + Dec(nCharsToPaint); + while (nCharsToPaint > 0) and (Token[First + nCharsToPaint - 1] = FillerChar) do + Dec(nCharsToPaint); + end; + + // same as copy(Token, First, nCharsToPaint) and remove filler chars + Text := ShrinkAtWideGlyphs(Token, First, nCharsToPaint); + end; + + FTextDrawer.ExtTextOut(nX, rcToken.Top, ETOOptions, rcToken, + PWideChar(Text), nCharsToPaint); + + if DoTabPainting then + begin + // fix everything before the FirstChar + for i := 1 to First - 1 do // wipe the text out so we don't + if sTabbedToken[i] = #9 then // count it out of the range + sTabbedToken[i] := #32; // we're looking for + + TabStart := pos(#9, sTabbedToken); + rcTab.Top := rcToken.Top; + rcTab.Bottom := rcToken.Bottom; + while (TabStart > 0) and (TabStart >= First) and (TabStart <= Last) do + begin + TabLen := 1; + while (TabStart + CharsBefore + TabLen - 1) mod FTabWidth <> 0 do Inc(TabLen); + Text := SynTabGlyphString; + + nX := ColumnToXValue(CharsBefore + TabStart + (TabLen div 2) - 1); + if TabLen mod 2 = 0 then + nX := nX + (FCharWidth div 2) + else nX := nX + FCharWidth; + + rcTab.Left := nX; + rcTab.Right := nX + FTextDrawer.GetCharWidth; + + FTextDrawer.ExtTextOut(nX, rcTab.Top, ETOOptions, rcTab, + PWideChar(Text), 1); + + for i := 0 to TabLen - 1 do //wipe the text out so we don't + sTabbedToken[TabStart + i] := #32; //count it again + + TabStart := pos(#9, sTabbedToken); + end; + end; + rcToken.Left := rcToken.Right; + end; + end; + + procedure AdjustEndRect; + // trick to avoid clipping the last pixels of text in italic, + // see also AdjustLastCharWidth() in TSynTextDrawer.ExtTextOut() + var + LastChar: Cardinal; + NormalCharWidth, RealCharWidth: Integer; + CharInfo: TABC; + tm: TTextMetricA; + begin + LastChar := Ord(TokenAccu.s[TokenAccu.Len]); + NormalCharWidth := FTextDrawer.TextWidth(WideChar(LastChar)); + RealCharWidth := NormalCharWidth; + if Win32PlatformIsUnicode then + begin + if GetCharABCWidthsW(Canvas.Handle, LastChar, LastChar, CharInfo) then + begin + RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); + if CharInfo.abcC >= 0 then + Inc(RealCharWidth, CharInfo.abcC); + end + else if LastChar < Ord(High(AnsiChar)) then + begin + GetTextMetricsA(Canvas.Handle, tm); + RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; + end; + end + else if WideChar(LastChar) <= High(AnsiChar) then + begin + if GetCharABCWidths(Canvas.Handle, LastChar, LastChar, CharInfo) then + begin + RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); + if CharInfo.abcC >= 0 then + Inc(RealCharWidth, CharInfo.abcC); + end + else if LastChar < Ord(High(AnsiChar)) then + begin + GetTextMetricsA(Canvas.Handle, tm); + RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; + end; + end; + + if RealCharWidth > NormalCharWidth then + Inc(rcToken.Left, RealCharWidth - NormalCharWidth); + end; + + procedure PaintHighlightToken(bFillToEOL: Boolean); + var + bComplexToken: Boolean; + nC1, nC2, nC1Sel, nC2Sel: Integer; + bU1, bSel, bU2: Boolean; + nX1, nX2: Integer; + begin + // Compute some helper variables. + nC1 := Max(FirstCol, TokenAccu.CharsBefore + 1); + nC2 := Min(LastCol, TokenAccu.CharsBefore + TokenAccu.Len + 1); + if bComplexLine then + begin + bU1 := (nC1 < nLineSelStart); + bSel := (nC1 < nLineSelEnd) and (nC2 >= nLineSelStart); + bU2 := (nC2 >= nLineSelEnd); + bComplexToken := bSel and (bU1 or bU2); + end + else + begin + bU1 := False; // to shut up Compiler warning Delphi 2 + bSel := bLineSelected; + bU2 := False; // to shut up Compiler warning Delphi 2 + bComplexToken := False; + end; + // Any token chars accumulated? + if (TokenAccu.Len > 0) then + begin + // Initialize the colors and the font style. + if not bSpecialLine then + begin + colBG := TokenAccu.BG; + colFG := TokenAccu.FG; + end; + + if bSpecialLine and (eoSpecialLineDefaultFg in FOptions) then + colFG := TokenAccu.FG; + + FTextDrawer.SetStyle(TokenAccu.Style); + // Paint the chars + if bComplexToken then + begin + // first unselected part of the token + if bU1 then + begin + SetDrawingColors(False); + rcToken.Right := ColumnToXValue(nLineSelStart); + with TokenAccu do + PaintToken(s, Len, CharsBefore, nC1, nLineSelStart); + end; + // selected part of the token + SetDrawingColors(True); + nC1Sel := Max(nLineSelStart, nC1); + nC2Sel := Min(nLineSelEnd, nC2); + rcToken.Right := ColumnToXValue(nC2Sel); + with TokenAccu do + PaintToken(s, Len, CharsBefore, nC1Sel, nC2Sel); + // second unselected part of the token + if bU2 then + begin + SetDrawingColors(False); + rcToken.Right := ColumnToXValue(nC2); + with TokenAccu do + PaintToken(s, Len, CharsBefore, nLineSelEnd, nC2); + end; + end + else + begin + SetDrawingColors(bSel); + rcToken.Right := ColumnToXValue(nC2); + with TokenAccu do + PaintToken(s, Len, CharsBefore, nC1, nC2); + end; + end; + + // Fill the background to the end of this line if necessary. + if bFillToEOL and (rcToken.Left < rcLine.Right) then + begin + if not bSpecialLine then colBG := colEditorBG; + if bComplexLine then + begin + nX1 := ColumnToXValue(nLineSelStart); + nX2 := ColumnToXValue(nLineSelEnd); + if (rcToken.Left < nX1) then + begin + SetDrawingColors(False); + rcToken.Right := nX1; + if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then + AdjustEndRect; + Canvas.FillRect(rcToken); + rcToken.Left := nX1; + end; + if (rcToken.Left < nX2) then + begin + SetDrawingColors(True); + rcToken.Right := nX2; + if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then + AdjustEndRect; + Canvas.FillRect(rcToken); + rcToken.Left := nX2; + end; + if (rcToken.Left < rcLine.Right) then + begin + SetDrawingColors(False); + rcToken.Right := rcLine.Right; + if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then + AdjustEndRect; + Canvas.FillRect(rcToken); + end; + end + else + begin + SetDrawingColors(bLineSelected); + rcToken.Right := rcLine.Right; + if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then + AdjustEndRect; + Canvas.FillRect(rcToken); + end; + end; + end; + + // Store the token chars with the attributes in the TokenAccu + // record. This will paint any chars already stored if there is + // a (visible) change in the attributes. + procedure AddHighlightToken(const Token: UnicodeString; + CharsBefore, TokenLen: Integer; + Foreground, Background: TColor; + Style: TFontStyles); + var + bCanAppend: Boolean; + bSpacesTest, bIsSpaces: Boolean; + i: Integer; + + function TokenIsSpaces: Boolean; + var + pTok: PWideChar; + begin + if not bSpacesTest then + begin + bSpacesTest := True; + pTok := PWideChar(Token); + while pTok^ <> #0 do + begin + if pTok^ <> #32 then + Break; + Inc(pTok); + end; + bIsSpaces := pTok^ = #0; + end; + Result := bIsSpaces; + end; + + begin + if (Background = clNone) or + ((ActiveLineColor <> clNone) and (bCurrentLine)) then + begin + Background := colEditorBG; + end; + if Foreground = clNone then Foreground := Font.Color; + // Do we have to paint the old chars first, or can we just append? + bCanAppend := False; + bSpacesTest := False; + if (TokenAccu.Len > 0) then + begin + // font style must be the same or token is only spaces + if (TokenAccu.Style = Style) + or (not (fsUnderline in Style) and not (fsUnderline in TokenAccu.Style) + and TokenIsSpaces) then + begin + // either special colors or same colors + if (bSpecialLine and not (eoSpecialLineDefaultFg in FOptions)) or bLineSelected or + // background color must be the same and + ((TokenAccu.BG = Background) and + // foreground color must be the same or token is only spaces + ((TokenAccu.FG = Foreground) or TokenIsSpaces)) then + begin + bCanAppend := True; + end; + end; + // If we can't append it, then we have to paint the old token chars first. + if not bCanAppend then + PaintHighlightToken(False); + end; + // Don't use AppendStr because it's more expensive. + if bCanAppend then + begin + if (TokenAccu.Len + TokenLen > TokenAccu.MaxLen) then + begin + TokenAccu.MaxLen := TokenAccu.Len + TokenLen + 32; + SetLength(TokenAccu.s, TokenAccu.MaxLen); + end; + for i := 1 to TokenLen do + TokenAccu.s[TokenAccu.Len + i] := Token[i]; + Inc(TokenAccu.Len, TokenLen); + end + else + begin + TokenAccu.Len := TokenLen; + if (TokenAccu.Len > TokenAccu.MaxLen) then + begin + TokenAccu.MaxLen := TokenAccu.Len + 32; + SetLength(TokenAccu.s, TokenAccu.MaxLen); + end; + for i := 1 to TokenLen do + TokenAccu.s[i] := Token[i]; + TokenAccu.CharsBefore := CharsBefore; + TokenAccu.FG := Foreground; + TokenAccu.BG := Background; + TokenAccu.Style := Style; + end; + end; + +{$IFDEF SYN_CodeFolding} + procedure PaintFoldAttributes; + var + i, TabSteps, LineIndent, LastNonBlank, X, Y, cRow, vLine: Integer; + DottedPen, OldPen: HPEN; + DottedPenDesc: LOGBRUSH; + CollapsedTo : integer; + HintRect : TRect; + begin + // Paint indent guides. Use folds to determine indent value of these + // Use a separate loop so we can use a custom pen + if not UseCodeFolding then + Exit; + + // Paint indent guides using custom pen + if fCodeFolding.IndentGuides then begin + DottedPenDesc.lbStyle := BS_SOLID; + DottedPenDesc.lbColor := fCodeFolding.IndentGuidesColor; + DottedPen := ExtCreatePen(PS_COSMETIC or PS_ALTERNATE, 1, DottedPenDesc, 0, nil); + try + OldPen := SelectObject(Canvas.Handle, DottedPen); + + // Now loop through all the lines. The indices are valid for Lines. + for cRow := aFirstRow to aLastRow do begin + vLine := RowToLine(cRow); + if (vLine > Lines.Count) and not (Lines.Count = 0) then + break; + + // Set vertical coord + Y := (LineToRow(vLine) - TopLine) * fTextHeight; // limit inside clip rect + if (fTextHeight mod 2 = 1) and (vLine mod 2 = 0) then // even + Inc(Y); + + // Get next nonblank line + LastNonBlank := cRow; + while (RowToLine(LastNonBlank) <= fLines.Count) + and (TrimLeft(fLines[RowToLine(LastNonBlank)-1]) = '') do + Inc(LastNonBlank); + LineIndent := LeftSpacesEx(fLines[RowToLine(LastNonBlank)-1], True, True); + + // Step horizontal coord + TabSteps := TabWidth; + while TabSteps < LineIndent do begin + X := TabSteps * CharWidth + fTextOffset - 2; + if TabSteps >= fLeftChar then begin + // Move to top of vertical line + Canvas.MoveTo(X, Y); + Inc(Y, fTextHeight); + + // Draw down and move back up + Canvas.LineTo(X, Y); + Dec(Y, fTextHeight); + end; + Inc(TabSteps, TabWidth); + end; + end; + + // Reset pen + SelectObject(Canvas.Handle, OldPen); + finally + DeleteObject(DottedPen); + end; + end; + + // Paint collapsed lines using changed pen + if fCodeFolding.ShowCollapsedLine or fCodeFolding.ShowHintMark then begin + Canvas.Pen.Color := fCodeFolding.CollapsedLineColor; + + CollapsedTo := 0; + for i := 0 to fAllFoldRanges.Count - 1 do begin + with fAllFoldRanges.Ranges[i] do begin + if FromLine > vLastLine then + break; + if Collapsed and (FromLine > CollapsedTo) and (FromLine >= vFirstLine) then + begin + if fCodeFolding.ShowCollapsedLine then + begin + // Get starting and end points + Y := (LineToRow(FromLine) - TopLine + 1) * fTextHeight - 1; + Canvas.MoveTo(AClip.Left, Y); + Canvas.LineTo(AClip.Right, Y); + end; + if fCodeFolding.ShowHintMark then + begin + HintRect := GetCollapseMarkRect(LineToRow(FromLine), FromLine); + if InRange(HintRect.Left, 1, ClientWidth-1) then + begin + fTextDrawer.BeginDrawing(Canvas.Handle); + SetBkMode(Canvas.Handle, TRANSPARENT); + fTextDrawer.SetForeColor(fCodeFolding.CollapsedLineColor); + with HintRect do + ftextDrawer.ExtTextOut(Left + 2 * CharWidth div 7, + Top - LineHeight div 5, [], HintRect, '...', 3); + SetBkMode(Canvas.Handle, OPAQUE); + Canvas.Pen.Width := IfThen(LineHeight > 30, 2, 1); + Canvas.Brush.Style := bsClear; + Inc(HintRect.Top, LineHeight div 7); + Canvas.Rectangle(HintRect); + Canvas.Brush.Style := bsSolid; + Canvas.Pen.Width := 1; + fTextDrawer.EndDrawing; + end; + end; + end; + if Collapsed then + CollapsedTo := Max(CollapsedTo, ToLine); + end; + end; + end; + end; +{$ENDIF} + + procedure PaintLines; + var + nLine: Integer; // line index for the loop + cRow: Integer; + sLine: UnicodeString; // the current line (tab expanded) + sLineExpandedAtWideGlyphs: UnicodeString; + sToken: UnicodeString; // highlighter token info + nTokenPos, nTokenLen: Integer; + attr: TSynHighlighterAttributes; + vAuxPos: TDisplayCoord; + vFirstChar: Integer; + vLastChar: Integer; + vStartRow: Integer; + vEndRow: Integer; + TokenFG, TokenBG: TColor; + TokenStyle: TFontStyles; + begin + // Initialize rcLine for drawing. Note that Top and Bottom are updated + // inside the loop. Get only the starting point for this. + rcLine := AClip; + rcLine.Left := FGutterWidth + 2; + rcLine.Bottom := (aFirstRow - TopLine) * FTextHeight; + // Make sure the token accumulator string doesn't get reassigned to often. + if Assigned(FHighlighter) then + begin + TokenAccu.MaxLen := Max(128, FCharsInWindow); + SetLength(TokenAccu.s, TokenAccu.MaxLen); + end; + // Now loop through all the lines. The indices are valid for Lines. + for nLine := vFirstLine to vLastLine do + begin +{$IFDEF SYN_CodeFolding} + if UseCodeFolding and AllFoldRanges.FoldHidesLine(nLine) then + continue; +{$ENDIF} + sLine := TSynEditStringList(Lines).ExpandedStrings[nLine - 1]; + sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); + // determine whether will be painted with ActiveLineColor + bCurrentLine := CaretY = nLine; + // Initialize the text and background colors, maybe the line should + // use special values for them. + colFG := Font.Color; + colBG := colEditorBG; + bSpecialLine := DoOnSpecialLineColors(nLine, colFG, colBG); + if bSpecialLine then + begin + // The selection colors are just swapped, like seen in Delphi. + colSelFG := colBG; + colSelBG := colFG; + end + else + begin + colSelFG := FSelectedColor.Foreground; + colSelBG := FSelectedColor.Background; + end; + + vStartRow := Max(LineToRow(nLine), aFirstRow); + vEndRow := Min(LineToRow(nLine + 1) - 1, aLastRow); +{$IFDEF SYN_CodeFolding} + vEndRow := Max(vEndRow, vStartRow); +{$ENDIF} + for cRow := vStartRow to vEndRow do + begin + if WordWrap then + begin + vAuxPos.Row := cRow; + if Assigned(FHighlighter) then + vAuxPos.Column := FirstCol + else + // When no highlighter is assigned, we must always start from the + // first char in a row and PaintToken will do the actual clipping + vAuxPos.Column := 1; + vFirstChar := FWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; + vAuxPos.Column := LastCol; + vLastChar := FWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; + end + else + begin + vFirstChar := FirstCol; + vLastChar := LastCol; + end; + // Get the information about the line selection. Three different parts + // are possible (unselected before, selected, unselected after), only + // unselected or only selected means bComplexLine will be False. Start + // with no selection, compute based on the visible columns. + bComplexLine := False; + nLineSelStart := 0; + nLineSelEnd := 0; + // Does the selection intersect the visible area? + if bAnySelection and (cRow >= vSelStart.Row) and (cRow <= vSelEnd.Row) then + begin + // Default to a fully selected line. This is correct for the smLine + // selection mode and a good start for the smNormal mode. + nLineSelStart := FirstCol; + nLineSelEnd := LastCol + 1; + if (FActiveSelectionMode = smColumn) or + ((FActiveSelectionMode = smNormal) and (cRow = vSelStart.Row)) then + begin + if (vSelStart.Column > LastCol) then + begin + nLineSelStart := 0; + nLineSelEnd := 0; + end + else if (vSelStart.Column > FirstCol) then + begin + nLineSelStart := vSelStart.Column; + bComplexLine := True; + end; + end; + if (FActiveSelectionMode = smColumn) or + ((FActiveSelectionMode = smNormal) and (cRow = vSelEnd.Row)) then + begin + if (vSelEnd.Column < FirstCol) then + begin + nLineSelStart := 0; + nLineSelEnd := 0; + end + else if (vSelEnd.Column < LastCol) then + begin + nLineSelEnd := vSelEnd.Column; + bComplexLine := True; + end; + end; + end; //endif bAnySelection + + // Update the rcLine rect to this line. + rcLine.Top := rcLine.Bottom; + Inc(rcLine.Bottom, FTextHeight); + + bLineSelected := not bComplexLine and (nLineSelStart > 0); + rcToken := rcLine; + + if not Assigned(FHighlighter) or not FHighlighter.Enabled then + begin + // Remove text already displayed (in previous rows) + if (vFirstChar <> FirstCol) or (vLastChar <> LastCol) then + sToken := Copy(sLineExpandedAtWideGlyphs, vFirstChar, vLastChar - vFirstChar) + else + sToken := Copy(sLineExpandedAtWideGlyphs, 1, vLastChar); + if FShowSpecChar and (Length(sLineExpandedAtWideGlyphs) < vLastChar) then + sToken := sToken + SynLineBreakGlyph; + nTokenLen := Length(sToken); + if bComplexLine then + begin + SetDrawingColors(False); + rcToken.Left := Max(rcLine.Left, ColumnToXValue(FirstCol)); + rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelStart)); + PaintToken(sToken, nTokenLen, 0, FirstCol, nLineSelStart); + rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelEnd)); + rcToken.Right := Min(rcLine.Right, ColumnToXValue(LastCol)); + PaintToken(sToken, nTokenLen, 0, nLineSelEnd, LastCol); + SetDrawingColors(True); + rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelStart)); + rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelEnd)); + PaintToken(sToken, nTokenLen, 0, nLineSelStart, nLineSelEnd - 1); + end + else + begin + SetDrawingColors(bLineSelected); + PaintToken(sToken, nTokenLen, 0, FirstCol, LastCol); + end; + end + else + begin + // Initialize highlighter with line text and range info. It is + // necessary because we probably did not scan to the end of the last + // line - the internal highlighter range might be wrong. + if nLine = 1 then + FHighlighter.ResetRange + else + FHighlighter.SetRange(TSynEditStringList(Lines).Ranges[nLine - 2]); + FHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, + nLine - 1); + // Try to concatenate as many tokens as possible to minimize the count + // of ExtTextOutW calls necessary. This depends on the selection state + // or the line having special colors. For spaces the foreground color + // is ignored as well. + TokenAccu.Len := 0; + nTokenPos := 0; + nTokenLen := 0; + attr := nil; + // Test first whether anything of this token is visible. + while not FHighlighter.GetEol do + begin + nTokenPos := FHighlighter.GetExpandedTokenPos; + sToken := FHighlighter.GetExpandedToken; + nTokenLen := Length(sToken); + if nTokenPos + nTokenLen >= vFirstChar then + begin + if nTokenPos + nTokenLen > vLastChar then + begin + if nTokenPos > vLastChar then + Break; + if WordWrap then + nTokenLen := vLastChar - nTokenPos - 1 + else + nTokenLen := vLastChar - nTokenPos; + end; + // Remove offset generated by tokens already displayed (in previous rows) + Dec(nTokenPos, vFirstChar - FirstCol); + // It's at least partially visible. Get the token attributes now. + attr := FHighlighter.GetTokenAttribute; + if Assigned(attr) then + begin + TokenFG := attr.Foreground; + TokenBG := attr.Background; + TokenStyle := attr.Style; + end + else + begin + TokenFG := colFG; + TokenBG := colBG; + TokenStyle := Font.Style; + end; + DoOnSpecialTokenAttributes(nLine, nTokenPos, sToken, TokenFG, TokenBG, TokenStyle); + AddHighlightToken(sToken, nTokenPos, nTokenLen, TokenFG, TokenBG, TokenStyle); + end; + // Let the highlighter scan the next token. + FHighlighter.Next; + end; + // Draw anything that's left in the TokenAccu record. Fill to the end + // of the invalid area with the correct colors. + if FShowSpecChar and FHighlighter.GetEol then + begin + if (attr = nil) or (attr <> FHighlighter.CommentAttribute) then + attr := FHighlighter.WhitespaceAttribute; + AddHighlightToken(SynLineBreakGlyph, nTokenPos + nTokenLen, 1, + attr.Foreground, attr.Background, []); + end; + PaintHighlightToken(True); + end; + // Now paint the right edge if necessary. We do it line by line to reduce + // the flicker. Should not cost very much anyway, compared to the many + // calls to ExtTextOutW. + if bDoRightEdge then + begin + Canvas.MoveTo(nRightEdge, rcLine.Top); + Canvas.LineTo(nRightEdge, rcLine.Bottom + 1); + end; + end; //endfor cRow + bCurrentLine := False; + end; //endfor cLine + end; + +{ end local procedures } + +begin + vFirstLine := RowToLine(aFirstRow); + vLastLine := RowToLine(aLastRow); + + bCurrentLine := False; + // If the right edge is visible and in the invalid area, prepare to paint it. + // Do this first to realize the pen when getting the dc variable. + SynTabGlyphString := SynTabGlyph; + bDoRightEdge := False; + if (FRightEdge > 0) then + begin // column value + nRightEdge := FTextOffset + FRightEdge * FCharWidth; // pixel value + if (nRightEdge >= AClip.Left) and (nRightEdge <= AClip.Right) then + begin + bDoRightEdge := True; + Canvas.Pen.Color := FRightEdgeColor; + Canvas.Pen.Width := 1; + end; + end; + // Do everything else with API calls. This (maybe) realizes the new pen color. + dc := Canvas.Handle; + + // If anything of the two pixel space before the text area is visible, then + // fill it with the component background color. + if (AClip.Left < FGutterWidth + 2) then + begin + rcToken := AClip; + rcToken.Left := Max(AClip.Left, FGutterWidth); + rcToken.Right := FGutterWidth + 2; + // Paint whole left edge of the text with same color. + // (value of WhiteAttribute can vary in e.g. MultiSyn) + if Highlighter <> nil then + Highlighter.ResetRange; + Canvas.Brush.Color := colEditorBG; + Canvas.FillRect(rcToken); + // Adjust the invalid area to not include this area. + AClip.Left := rcToken.Right; + end; + // Paint the visible text lines. To make this easier, compute first the + // necessary information about the selected area: is there any visible + // selected area, and what are its lines / columns? + if (vLastLine >= vFirstLine) then + begin + ComputeSelectionInfo; + FTextDrawer.Style := Font.Style; + FTextDrawer.BeginDrawing(dc); + try + PaintLines; + finally + FTextDrawer.EndDrawing; + end; + end; + // If there is anything visible below the last line, then fill this as well. + rcToken := AClip; + rcToken.Top := (aLastRow - TopLine + 1) * FTextHeight; + if (rcToken.Top < rcToken.Bottom) then + begin + if Highlighter <> nil then + Highlighter.ResetRange; + Canvas.Brush.Color := colEditorBG; + Canvas.FillRect(rcToken); + // Draw the right edge if necessary. + if bDoRightEdge then + begin + Canvas.MoveTo(nRightEdge, rcToken.Top); + Canvas.LineTo(nRightEdge, rcToken.Bottom + 1); + end; + end; + + {$IFDEF SYN_CodeFolding} + // This messes with pen colors, so draw after right margin has been drawn + PaintFoldAttributes; +{$ENDIF} +end; + +procedure TCustomSynEdit.PasteFromClipboard; +var + AddPasteEndMarker: Boolean; + vStartOfBlock: TBufferCoord; + vEndOfBlock: TBufferCoord; + StoredPaintLock: Integer; + PasteMode: TSynSelectionMode; + Mem: HGLOBAL; + P: PByte; +begin + if not CanPaste then + Exit; + DoOnPaintTransient(ttBefore); + BeginUndoBlock; + AddPasteEndMarker := False; + PasteMode := SelectionMode; + try + // Check for our special format and read PasteMode. + // The text is ignored as it is ANSI-only to stay compatible with programs + // using the ANSI version of SynEdit. + // + // Instead we take the text stored in CF_UNICODETEXT or CF_TEXT. + if Clipboard.HasFormat(SynEditClipboardFormat) then + begin + Clipboard.Open; + try + Mem := Clipboard.GetAsHandle(SynEditClipboardFormat); + P := GlobalLock(Mem); + try + if P <> nil then + PasteMode := PSynSelectionMode(P)^; + finally + GlobalUnlock(Mem); + end + finally + Clipboard.Close; + end; + end; + + FUndoList.AddChange(crPasteBegin, BlockBegin, BlockEnd, '', smNormal); + AddPasteEndMarker := True; + if SelAvail then + begin + FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, + FActiveSelectionMode); + end + else + ActiveSelectionMode := SelectionMode; + + if SelAvail then + begin + vStartOfBlock := BlockBegin; + vEndOfBlock := BlockEnd; + FBlockBegin := vStartOfBlock; + FBlockEnd := vEndOfBlock; + + // Pasting always occurs at column 0 when current selection is + // smLine type + if FActiveSelectionMode = smLine then + vStartOfBlock.Char := 1; + end + else + vStartOfBlock := CaretXY; + + Inc(FPaintTransientLock); + SetSelTextPrimitiveEx(PasteMode, PWideChar(GetClipboardText), True); + Dec(FPaintTransientLock); + vEndOfBlock := BlockEnd; + if PasteMode = smNormal then + FUndoList.AddChange(crPaste, vStartOfBlock, vEndOfBlock, SelText, + PasteMode) + else if PasteMode = smColumn then + // Do nothing. Moved to InsertColumn + else if PasteMode = smLine then + if CaretX = 1 then + FUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBlock.Line), + BufferCoord(CharsInWindow, vEndOfBlock.Line - 1), SelText, smLine) + else + FUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBlock.Line), + vEndOfBlock, SelText, smNormal); + finally + if AddPasteEndMarker then + FUndoList.AddChange(crPasteEnd, BlockBegin, BlockEnd, '', smNormal); + EndUndoBlock; + end; + + // ClientRect can be changed by UpdateScrollBars if eoHideShowScrollBars + // is enabled + if eoHideShowScrollBars in Options then + begin + StoredPaintLock := FPaintLock; + try + FPaintLock := 0; + UpdateScrollBars; + finally + FPaintLock := StoredPaintLock; + end; + end; + + EnsureCursorPosVisible; + // Selection should have changed... + StatusChanged([scSelection]); + DoOnPaintTransient(ttAfter); +end; + +procedure TCustomSynEdit.SelectAll; +var + LastPt: TBufferCoord; +begin + LastPt.Char := 1; + LastPt.Line := Lines.Count; + if LastPt.Line > 0 then + Inc(LastPt.Char, Length(Lines[LastPt.Line - 1])) + else + LastPt.Line := 1; + SetCaretAndSelection(LastPt, BufferCoord(1, 1), LastPt); + // Selection should have changed... + StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.SetBlockBegin(Value: TBufferCoord); +var + nInval1, nInval2: Integer; + SelChanged: Boolean; +begin + ActiveSelectionMode := SelectionMode; + if (eoScrollPastEol in Options) and not WordWrap then + Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) + else + Value.Char := Max(Value.Char, 1); + Value.Line := MinMax(Value.Line, 1, Lines.Count); + if (FActiveSelectionMode = smNormal) then + if (Value.Line >= 1) and (Value.Line <= Lines.Count) then + Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) + else + Value.Char := 1; + if SelAvail then + begin + if FBlockBegin.Line < FBlockEnd.Line then + begin + nInval1 := Min(Value.Line, FBlockBegin.Line); + nInval2 := Max(Value.Line, FBlockEnd.Line); + end + else + begin + nInval1 := Min(Value.Line, FBlockEnd.Line); + nInval2 := Max(Value.Line, FBlockBegin.Line); + end; + FBlockBegin := Value; + FBlockEnd := Value; + InvalidateLines(nInval1, nInval2); + SelChanged := True; + end + else + begin + SelChanged := + (FBlockBegin.Char <> Value.Char) or (FBlockBegin.Line <> Value.Line) or + (FBlockEnd.Char <> Value.Char) or (FBlockEnd.Line <> Value.Line); + FBlockBegin := Value; + FBlockEnd := Value; + end; + if SelChanged then + StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.SetBlockEnd(Value: TBufferCoord); +var + nLine: Integer; +begin + ActiveSelectionMode := SelectionMode; + if not (eoNoSelection in Options) then + begin + if (eoScrollPastEol in Options) and not WordWrap then + Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) + else + Value.Char := Max(Value.Char, 1); + Value.Line := MinMax(Value.Line, 1, Lines.Count); + if (FActiveSelectionMode = smNormal) then + if (Value.Line >= 1) and (Value.Line <= Lines.Count) then + Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) + else + Value.Char := 1; + if (Value.Char <> FBlockEnd.Char) or (Value.Line <> FBlockEnd.Line) then + begin + if (Value.Char <> FBlockEnd.Char) or (Value.Line <> FBlockEnd.Line) then + begin + if (FActiveSelectionMode = smColumn) and (Value.Char <> FBlockEnd.Char) then + begin + InvalidateLines( + Min(FBlockBegin.Line, Min(FBlockEnd.Line, Value.Line)), + Max(FBlockBegin.Line, Max(FBlockEnd.Line, Value.Line))); + FBlockEnd := Value; + end + else begin + nLine := FBlockEnd.Line; + FBlockEnd := Value; + if (FActiveSelectionMode <> smColumn) or (FBlockBegin.Char <> FBlockEnd.Char) then + InvalidateLines(nLine, FBlockEnd.Line); + end; + StatusChanged([scSelection]); + end; + end; + end; +end; + +procedure TCustomSynEdit.SetCaretX(Value: Integer); +var + vNewCaret: TBufferCoord; +begin + vNewCaret.Char := Value; + vNewCaret.Line := CaretY; + SetCaretXY(vNewCaret); +end; + +procedure TCustomSynEdit.SetCaretY(Value: Integer); +var + vNewCaret: TBufferCoord; +begin + vNewCaret.Line := Value; + vNewCaret.Char := CaretX; + SetCaretXY(vNewCaret); +end; + +procedure TCustomSynEdit.InternalSetCaretX(Value: Integer); +var + vNewCaret: TBufferCoord; +begin + vNewCaret.Char := Value; + vNewCaret.Line := CaretY; + InternalSetCaretXY(vNewCaret); +end; + +procedure TCustomSynEdit.InternalSetCaretY(Value: Integer); +var + vNewCaret: TBufferCoord; +begin + vNewCaret.Line := Value; + vNewCaret.Char := CaretX; + InternalSetCaretXY(vNewCaret); +end; + +function TCustomSynEdit.GetCaretXY: TBufferCoord; +begin + Result.Char := CaretX; + Result.Line := CaretY; +end; + +function TCustomSynEdit.GetDisplayX: Integer; +begin + Result := DisplayXY.Column; +end; + +function TCustomSynEdit.GetDisplayY: Integer; +begin +{$IFDEF SYN_CodeFolding} + if not WordWrap and not UseCodeFolding then +{$ELSE} + if not WordWrap then +{$ENDIF} + Result := CaretY + else + Result := DisplayXY.Row; +end; + +Function TCustomSynEdit.GetDisplayXY: TDisplayCoord; +begin + Result := BufferToDisplayPos(CaretXY); + if WordWrap and FCaretAtEOL then + begin + if Result.Column = 1 then + begin + Dec(Result.Row); + Result.Column := FWordWrapPlugin.GetRowLength(Result.Row) +1; + end + else begin + // Work-around situations where FCaretAtEOL should have been updated because of + //text change (it's only valid when Column = 1). Updating it in ProperSetLine() + //would probably be the right thing, but... + FCaretAtEOL := False; + end; + end; +end; + +procedure TCustomSynEdit.SetCaretXY(const Value: TBufferCoord); +//there are two setCaretXY methods. One Internal, one External. The published +//property CaretXY (re)sets the block as well +begin + IncPaintLock; + try + Include(FStatusChanges, scSelection); + SetCaretXYEx(True, Value); + if SelAvail then + InvalidateSelection; + FBlockBegin.Char := FCaretX; + FBlockBegin.Line := FCaretY; + FBlockEnd := FBlockBegin; + finally + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.InternalSetCaretXY(const Value: TBufferCoord); +begin + SetCaretXYEx(True, Value); +end; + +procedure TCustomSynEdit.UpdateLastCaretX; +begin + FLastCaretX := DisplayX; +end; + +procedure TCustomSynEdit.SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); +var + nMaxX: Integer; + vTriggerPaint: Boolean; +begin + FCaretAtEOL := False; + vTriggerPaint := HandleAllocated; + if vTriggerPaint then + DoOnPaintTransient(ttBefore); + if WordWrap then + nMaxX := MaxInt + else + nMaxX := MaxScrollWidth + 1; + if Value.Line > Lines.Count then + Value.Line := Lines.Count; + if Value.Line < 1 then + begin + // this is just to make sure if Lines stringlist should be empty + Value.Line := 1; + if not (eoScrollPastEol in FOptions) then + nMaxX := 1; + end + else + begin + if not (eoScrollPastEol in FOptions) then + nMaxX := Length(Lines[Value.Line - 1]) + 1; + end; + if (Value.Char > nMaxX) and (not(eoScrollPastEol in Options) or + not(eoAutoSizeMaxScrollWidth in Options)) then + begin + Value.Char := nMaxX; + end; + if Value.Char < 1 then + Value.Char := 1; + if (Value.Char <> FCaretX) or (Value.Line <> FCaretY) then + begin + IncPaintLock; + try + // simply include the flags, FPaintLock is > 0 + if FCaretX <> Value.Char then + begin + FCaretX := Value.Char; + Include(FStatusChanges, scCaretX); + end; + if FCaretY <> Value.Line then + begin + if ActiveLineColor <> clNone then + begin + InvalidateLine(Value.Line); + InvalidateLine(FCaretY); + end; + FCaretY := Value.Line; + Include(FStatusChanges, scCaretY); +{$IFDEF SYN_CodeFolding} + UncollapseAroundLine(fCaretY); +{$ENDIF} + end; + // Call UpdateLastCaretX before DecPaintLock because the event handler it + // calls could raise an exception, and we don't want fLastCaretX to be + // left in an undefined state if that happens. + UpdateLastCaretX; + if CallEnsureCursorPos then + EnsureCursorPosVisible; + Include(FStateFlags, sfCaretChanged); +//++ Flicker Reduction +// Include(fStateFlags, sfScrollbarChanged); +//-- Flicker Reduction + finally + DecPaintLock; + end; + end + else begin + // Also call UpdateLastCaretX if the caret didn't move. Apps don't know + // anything about FLastCaretX and they shouldn't need to. So, to avoid any + // unwanted surprises, always update FLastCaretX whenever CaretXY is + // assigned to. + // Note to SynEdit developers: If this is undesirable in some obscure + // case, just save the value of FLastCaretX before assigning to CaretXY and + // restore it afterward as appropriate. + UpdateLastCaretX; + end; + if vTriggerPaint then + DoOnPaintTransient(ttAfter); +end; + +function TCustomSynEdit.CaretInView: Boolean; +var + vCaretRowCol: TDisplayCoord; +begin + vCaretRowCol := DisplayXY; + Result := (vCaretRowCol.Column >= LeftChar) + and (vCaretRowCol.Column <= LeftChar + CharsInWindow) + and (vCaretRowCol.Row >= TopLine) + and (vCaretRowCol.Row <= TopLine + LinesInWindow); +end; + +procedure TCustomSynEdit.SetActiveLineColor(Value: TColor); +begin + if (FActiveLineColor <> Value) then + begin + FActiveLineColor := Value; + InvalidateLine(CaretY); + end; +end; + +procedure TCustomSynEdit.SetFont(const Value: TFont); +var + DC: HDC; + Save: THandle; + Metrics: TTextMetric; + AveCW, MaxCW: Integer; +begin + DC := GetDC(0); + Save := SelectObject(DC, Value.Handle); + GetTextMetrics(DC, Metrics); + SelectObject(DC, Save); + ReleaseDC(0, DC); + with Metrics do + begin + AveCW := tmAveCharWidth; + MaxCW := tmMaxCharWidth; + end; + case AveCW = MaxCW of + True: inherited Font := Value; + False: + begin + with FFontDummy do + begin + Color := Value.Color; + Pitch := fpFixed; + Size := Value.Size; + Style := Value.Style; + Name := Value.Name; + end; + inherited Font := FFontDummy; + end; + end; + + TSynEditStringList(FLines).FontChanged; + if FGutter.ShowLineNumbers then + GutterChanged(Self); +end; + +procedure TCustomSynEdit.SetGutterWidth(Value: Integer); +begin + Value := Max(Value, 0); + if FGutterWidth <> Value then + begin + FGutterWidth := Value; + FTextOffset := FGutterWidth + 2 - (LeftChar - 1) * FCharWidth; + if HandleAllocated then + begin + FCharsInWindow := Max(ClientWidth - FGutterWidth - 2, 0) div FCharWidth; + if WordWrap then + FWordWrapPlugin.DisplayChanged; + UpdateScrollBars; + Invalidate; + end; + end; +end; + +procedure TCustomSynEdit.SetLeftChar(Value: Integer); +var + MaxVal: Integer; + iDelta: Integer; + iTextArea: TRect; +begin + if WordWrap then + Value := 1; + + if eoScrollPastEol in Options then + begin + if eoAutoSizeMaxScrollWidth in Options then + MaxVal := MaxInt - CharsInWindow + else + MaxVal := MaxScrollWidth - CharsInWindow + 1 + end + else + begin + MaxVal := TSynEditStringList(Lines).LengthOfLongestLine; + if MaxVal > CharsInWindow then + MaxVal := MaxVal - CharsInWindow + 1 + else + MaxVal := 1; + end; + Value := MinMax(Value, 1, MaxVal); + if Value <> FLeftChar then + begin + iDelta := FLeftChar - Value; + FLeftChar := Value; + FTextOffset := FGutterWidth + 2 - (LeftChar - 1) * FCharWidth; + if Abs(iDelta) < CharsInWindow then + begin + iTextArea := ClientRect; + Inc(iTextArea.Left, FGutterWidth + 2); + ScrollWindow(Handle, iDelta * CharWidth, 0, @iTextArea, @iTextArea); + end + else + InvalidateLines(-1, -1); + if (Options >= [eoAutoSizeMaxScrollWidth, eoScrollPastEol]) and + (MaxScrollWidth < LeftChar + CharsInWindow) then + begin + MaxScrollWidth := LeftChar + CharsInWindow + end + else + UpdateScrollBars; + StatusChanged([scLeftChar]); + end; +end; + +procedure TCustomSynEdit.SetLines(Value: TUnicodeStrings); +begin + Lines.Assign(Value); +end; + +procedure TCustomSynEdit.SetLineText(Value: UnicodeString); +begin + if (CaretY >= 1) and (CaretY <= Max(1, Lines.Count)) then + Lines[CaretY - 1] := Value; +end; + +procedure TCustomSynEdit.SetFontSmoothing(AValue: TSynFontSmoothMethod); +begin + if FFontSmoothing <> AValue then + begin + FFontSmoothing := AValue; + FontSmoothingChanged; + end; +end; + +procedure TCustomSynEdit.SetName(const Value: TComponentName); +var + TextToName: Boolean; +begin + TextToName := (ComponentState * [csDesigning, csLoading] = [csDesigning]) + and (TrimRight(Text) = Name); + inherited SetName(Value); + if TextToName then + Text := Value; +end; + +procedure TCustomSynEdit.SetScrollBars(const Value: TScrollStyle); +begin + if (FScrollBars <> Value) then + begin + FScrollBars := Value; + UpdateScrollBars; + Invalidate; + end; +end; + +procedure TCustomSynEdit.SetSelTextPrimitive(const Value: UnicodeString); +begin + SetSelTextPrimitiveEx(FActiveSelectionMode, PWideChar(Value), True); +end; + +// This is really a last minute change and I hope I did it right. +// Reason for this modification: next two lines will loose the CaretX position +// if eoScrollPastEol is not set in Options. That is not really a good idea +// as we would typically want the cursor to stay where it is. +// To fix this (in the absence of a better idea), I changed the code in +// DeleteSelection not to trim the string if eoScrollPastEol is not set. +procedure TCustomSynEdit.SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; + Value: PWideChar; AddToUndoList: Boolean); +var + BB, BE: TBufferCoord; + TempString: UnicodeString; + + procedure DeleteSelection; + var + x, MarkOffset, MarkOffset2: Integer; + UpdateMarks: Boolean; + Count: Integer; + begin + UpdateMarks := False; + MarkOffset := 0; + MarkOffset2 := 0; + case FActiveSelectionMode of + smNormal: + begin + if Lines.Count > 0 then + begin + // Create a string that contains everything on the first line up + // to the selection mark, and everything on the last line after + // the selection mark. + if BB.Char > 1 then + MarkOffset2 := 1; + TempString := Copy(Lines[BB.Line - 1], 1, BB.Char - 1) + + Copy(Lines[BE.Line - 1], BE.Char, MaxInt); + // Delete all lines in the selection range. + TSynEditStringList(Lines).DeleteLines(BB.Line, BE.Line - BB.Line); + // Put the stuff that was outside of selection back in. + if Options >= [eoScrollPastEol, eoTrimTrailingSpaces] then + TempString := TrimTrailingSpaces(TempString); + Lines[BB.Line - 1] := TempString; + end; + UpdateMarks := True; + InternalCaretXY := BB; + end; + smColumn: + begin + // swap X if needed + if BB.Char > BE.Char then + SwapInt(Integer(BB.Char), Integer(BE.Char)); + + for x := BB.Line - 1 to BE.Line - 1 do + begin + TempString := Lines[x]; + Delete(TempString, BB.Char, BE.Char - BB.Char); + ProperSetLine(x, TempString); + end; + // Lines never get deleted completely, so keep caret at end. + InternalCaretXY := BufferCoord(BB.Char, FBlockEnd.Line); + // Column deletion never removes a line entirely, so no mark + // updating is needed here. + end; + smLine: + begin + if BE.Line = Lines.Count then + begin + Lines[BE.Line - 1] := ''; + for x := BE.Line - 2 downto BB.Line - 1 do + Lines.Delete(x); + end + else begin + for x := BE.Line - 1 downto BB.Line - 1 do + Lines.Delete(x); + end; + // smLine deletion always resets to first column. + InternalCaretXY := BufferCoord(1, BB.Line); + UpdateMarks := TRUE; + MarkOffset := 1; + end; + end; + + // Update marks + if UpdateMarks then + begin + Count := BE.Line - BB.Line + MarkOffset; + if Count > 0 then + DoLinesDeleted(BB.Line + MarkOffset2, Count); + end; + end; + + procedure InsertText; + + function CountLines(p: PWideChar): Integer; + begin + Result := 0; + while p^ <> #0 do + begin + if p^ = #13 then + Inc(p); + if p^ = #10 then + Inc(p); + Inc(Result); + p := GetEOL(p); + end; + end; + + function InsertNormal: Integer; + var + sLeftSide: UnicodeString; + sRightSide: UnicodeString; + Str: UnicodeString; + Start: PWideChar; + P: PWideChar; + begin + Result := 0; + sLeftSide := Copy(LineText, 1, CaretX - 1); + if CaretX - 1 > Length(sLeftSide) then + begin + sLeftSide := sLeftSide + UnicodeStringOfChar(#32, + CaretX - 1 - Length(sLeftSide)); + end; + sRightSide := Copy(LineText, CaretX, Length(LineText) - (CaretX - 1)); + // step1: insert the first line of Value into current line + Start := PWideChar(Value); + P := GetEOL(Start); + if P^ <> #0 then + begin + Str := sLeftSide + Copy(Value, 1, P - Start); + ProperSetLine(CaretY - 1, Str); + TSynEditStringList(Lines).InsertLines(CaretY, CountLines(P)); + end + else begin + Str := sLeftSide + Value + sRightSide; + ProperSetLine(CaretY -1, Str); + end; + // step2: insert left lines of Value + while P^ <> #0 do + begin + if P^ = #13 then + Inc(P); + if P^ = #10 then + Inc(P); + Inc(FCaretY); + Include(FStatusChanges, scCaretY); + Start := P; + P := GetEOL(Start); + if P = Start then + begin + if p^ <> #0 then + Str := '' + else + Str := sRightSide; + end + else begin + SetString(Str, Start, P - Start); + if p^ = #0 then + Str := Str + sRightSide + end; + ProperSetLine(CaretY -1, Str); + Inc(Result); + end; + if eoTrimTrailingSpaces in Options then + if sRightSide = '' then + FCaretX := GetExpandedLength(Str, TabWidth) + 1 + else + FCaretX := 1 + Length(Lines[CaretY - 1]) - Length(TrimTrailingSpaces(sRightSide)) + else FCaretX := 1 + Length(Lines[CaretY - 1]) - Length(sRightSide); + StatusChanged([scCaretX]); + end; + + function InsertColumn: Integer; + var + Str: UnicodeString; + Start: PWideChar; + P: PWideChar; + Len: Integer; + InsertPos: Integer; + LineBreakPos: TBufferCoord; + begin + Result := 0; + // Insert string at current position + InsertPos := CaretX; + Start := PWideChar(Value); + repeat + P := GetEOL(Start); + if P <> Start then + begin + SetLength(Str, P - Start); + Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); + if CaretY > Lines.Count then + begin + Inc(Result); + TempString := UnicodeStringOfChar(#32, InsertPos - 1) + Str; + Lines.Add(''); + if AddToUndoList then + begin + LineBreakPos.Line := CaretY -1; + LineBreakPos.Char := Length(Lines[CaretY - 2]) + 1; + FUndoList.AddChange(crLineBreak, LineBreakPos, LineBreakPos, '', smNormal); + end; + end + else begin + TempString := Lines[CaretY - 1]; + Len := Length(TempString); + if Len < InsertPos then + begin + TempString := + TempString + UnicodeStringOfChar(#32, InsertPos - Len - 1) + Str + end + else + Insert(Str, TempString, InsertPos); + end; + ProperSetLine(CaretY - 1, TempString); + // Add undo change here from PasteFromClipboard + if AddToUndoList then + begin + FUndoList.AddChange(crPaste, BufferCoord(InsertPos, CaretY), + BufferCoord(InsertPos + (P - Start), CaretY), '', FActiveSelectionMode); + end; + end; + if P^ = #13 then + begin + Inc(P); + if P^ = #10 then + Inc(P); + Inc(FCaretY); + Include(FStatusChanges, scCaretY); + end; + Start := P; + until P^ = #0; + Inc(FCaretX, Length(Str)); + Include(FStatusChanges, scCaretX); + end; + + function InsertLine: Integer; + var + Start: PWideChar; + P: PWideChar; + Str: UnicodeString; + n: Integer; + begin + Result := 0; + FCaretX := 1; + // Insert string before current line + Start := PWideChar(Value); + repeat + P := GetEOL(Start); + if P <> Start then + begin + SetLength(Str, P - Start); + Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); + end + else + Str := ''; + if (P^ = #0) then + begin + n := Lines.Count; + if (n >= CaretY) then + Lines[CaretY - 1] := Str + Lines[CaretY - 1] + else + Lines.Add(Str); + if eoTrimTrailingSpaces in Options then + Lines[CaretY - 1] := TrimTrailingSpaces(Lines[CaretY - 1]); + FCaretX := 1 + Length(Str); + end + else begin + //--------- KV from SynEditStudio + if (CaretY = Lines.Count) or InsertMode then + begin + Lines.Insert(CaretY -1, ''); + Inc(Result); + end; + //--------- + ProperSetLine(CaretY - 1, Str); + Inc(FCaretY); + Include(FStatusChanges, scCaretY); + Inc(Result); + if P^ = #13 then + Inc(P); + if P^ = #10 then + Inc(P); + Start := P; + end; + until P^ = #0; + StatusChanged([scCaretX]); + end; + + var + StartLine: Integer; + StartCol: Integer; + InsertedLines: Integer; + begin + if Value = '' then + Exit; + + StartLine := CaretY; + StartCol := CaretX; + case PasteMode of + smNormal: + InsertedLines := InsertNormal; + smColumn: + InsertedLines := InsertColumn; + smLine: + InsertedLines := InsertLine; + else + InsertedLines := 0; + end; + // We delete selected based on the current selection mode, but paste + // what's on the clipboard according to what it was when copied. + // Update marks + if InsertedLines > 0 then + begin + if (PasteMode = smNormal) and (StartCol > 1) then + Inc(StartLine); + DoLinesInserted(StartLine, InsertedLines); + end; + // Force caret reset + InternalCaretXY := CaretXY; + end; + +begin + IncPaintLock; + Lines.BeginUpdate; + try + BB := BlockBegin; + BE := BlockEnd; + if SelAvail then + begin + DeleteSelection; + InternalCaretXY := BB; + end; + if (Value <> nil) and (Value[0] <> #0) then + InsertText; + if CaretY < 1 then + InternalCaretY := 1; + finally + Lines.EndUpdate; + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.SynSetText(const Value: UnicodeString); +begin + Lines.Text := Value; +end; + +procedure TCustomSynEdit.SetTopLine(Value: Integer); +var + Delta: Integer; +begin + if (eoScrollPastEof in Options) then + Value := Min(Value, DisplayLineCount) + else + Value := Min(Value, DisplayLineCount - FLinesInWindow + 1); + Value := Max(Value, 1); + if Value <> TopLine then + begin + Delta := TopLine - Value; + FTopLine := Value; + if Abs(Delta) < FLinesInWindow then + ScrollWindow(Handle, 0, FTextHeight * Delta, nil, nil) + else + Invalidate; + + UpdateWindow(Handle); + UpdateScrollBars; + StatusChanged([scTopLine]); + end; +end; + +{$IFDEF SYN_CodeFolding} +procedure TCustomSynEdit.SetUseCodeFolding(const Value: Boolean); +Var + ValidValue : Boolean; +begin + ValidValue := Value and ((Assigned(fHighlighter) and + (fHighlighter is TSynCustomCodeFoldingHighlighter)) + or Assigned(fOnScanForFoldRanges)); + + if fUseCodeFolding <> ValidValue then + begin + AllFoldRanges.Reset; + fUseCodeFolding := ValidValue; + Invalidate; // better Invalidate before changing LeftChar and TopLine + if ValidValue then + begin + // !!Mutually exclusive with WordWrap to reduce complexity + WordWrap := False; + FullFoldScan; + end; + OnCodeFoldingChange(Self); + InvalidateGutter; + end; +end; + +procedure TCustomSynEdit.OnCodeFoldingChange(Sender: TObject); +begin + if fUseCodeFolding then + // The fold shape is drawn in a square 2 * Gutter.RightMargin + // to the right of RightOffset and 2 * Gutter.RightMagin to the left of + // fGuttterWidth. It is centered vertically. + // Gutter.RightMargin is 2 at 96 DPI + Gutter.RightOffset := CodeFolding.GutterShapeSize + 3 * Gutter.RightMargin + else + Gutter.RightOffset := Gutter.RightMargin; + Invalidate; +end; + +function TCustomSynEdit.GetCollapseMarkRect(Row, Line: Integer): TRect; +begin + Result := Rect(0, 0, 0, 0); + + if not UseCodeFolding then + Exit; + + if Line < 0 then + Line := RowToLine(Row); + + if not AllFoldRanges.CollapsedFoldStartAtLine(Line) then + Exit; + + { Prepare rect } + with Result do + begin + Top := (Row - fTopLine) * fTextHeight + 1; + Bottom := Top + fTextHeight - 2; + end; + + Result.Left := fTextOffset + + (TSynEditStringList(fLines).ExpandedStringLengths[Line-1] + 1) * fCharWidth; + + { Fix rect } + if eoShowSpecialChars in fOptions then + Inc(Result.Left, fCharWidth); + + // Deal wwth horizontal Scroll + Result.Left := Max(Result.Left, fGutterWidth + fCharWidth); + + Result.Right := Result.Left + fCharWidth * 3 + 4 * (fCharWidth div 7); +end; + +function TCustomSynEdit.GetFoldShapeRect(Row: Integer): TRect; +begin + // Form a square rect for the square the user can click on + // The fold shape is drawn in a square 4 pixels to the right of RightOffset + // 4 pixels from the fGuttterWidth. It is vertically centered within a line. + Result.Left := fGutterWidth - CodeFolding.GutterShapeSize - 2 * Gutter.RightMargin; + Result.Right := Result.Left + CodeFolding.GutterShapeSize; + Result.Top := (Row - fTopLine) * LineHeight; + // make a square rect + Result.Top := Result.Top + ((LineHeight - (Result.Right - Result.Left)) div 2); + Result.Bottom := Result.Top + (Result.Right - Result.Left); +end; +{$ENDIF} + +procedure TCustomSynEdit.ShowCaret; +begin + if not (eoNoCaret in Options) and not (sfCaretVisible in FStateFlags) then + begin + if Windows.ShowCaret(Handle) then + Include(FStateFlags, sfCaretVisible); + end; +end; + +procedure TCustomSynEdit.UpdateCaret; +var + CX, CY: Integer; + iClientRect: TRect; + vCaretDisplay: TDisplayCoord; + vCaretPix: TPoint; + cf: TCompositionForm; + vSelStartPix: TPoint; +begin + if (PaintLock <> 0) or not (Focused or FAlwaysShowCaret) then + Include(FStateFlags, sfCaretChanged) + else + begin + Exclude(FStateFlags, sfCaretChanged); + vCaretDisplay := DisplayXY; + if WordWrap and (vCaretDisplay.Column > CharsInWindow + 1) then + vCaretDisplay.Column := CharsInWindow + 1; + vCaretPix := RowColumnToPixels(vCaretDisplay); + CX := vCaretPix.X + FCaretOffset.X; + CY := vCaretPix.Y + FCaretOffset.Y; + iClientRect := GetClientRect; + Inc(iClientRect.Left, FGutterWidth); + if (CX >= iClientRect.Left) and (CX < iClientRect.Right) + and (CY >= iClientRect.Top) and (CY < iClientRect.Bottom) then + begin + SetCaretPos(CX, CY); + ShowCaret; + end + else + begin + SetCaretPos(CX, CY); + HideCaret; + end; + if (Self.SelAvail = False) then + begin + cf.dwStyle := CFS_POINT; + cf.ptCurrentPos := Point(CX, CY); + ImmSetCompositionWindow(ImmGetContext(Handle), @cf); + end + else + begin + vSelStartPix := Self.RowColumnToPixels(BufferToDisplayPos(Self.BlockBegin)); + Self.SetImeCompositionWindow(Self.Font, vSelStartPix.X, vSelStartPix.Y); + end; + end; +end; + +procedure TCustomSynEdit.UpdateScrollBars; +var + nMaxScroll: Integer; + ScrollInfo: TScrollInfo; + iRightChar: Integer; +begin + if not HandleAllocated or (PaintLock <> 0) then + Include(FStateFlags, sfScrollbarChanged) + else begin + Exclude(FStateFlags, sfScrollbarChanged); + if fScrollBars <> ssNone then + begin + ScrollInfo.cbSize := SizeOf(ScrollInfo); + ScrollInfo.fMask := SIF_ALL; + if not(eoHideShowScrollbars in Options) then + begin + ScrollInfo.fMask := ScrollInfo.fMask or SIF_DISABLENOSCROLL; + end; + + if Visible then SendMessage(Handle, WM_SETREDRAW, 0, 0); + + 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 + else + nMaxScroll := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); + if nMaxScroll <= MAX_SCROLL then + begin + ScrollInfo.nMin := 1; + ScrollInfo.nMax := nMaxScroll; + ScrollInfo.nPage := CharsInWindow; + ScrollInfo.nPos := LeftChar; + end + else begin + ScrollInfo.nMin := 0; + ScrollInfo.nMax := MAX_SCROLL; + ScrollInfo.nPage := MulDiv(MAX_SCROLL, CharsInWindow, nMaxScroll); + ScrollInfo.nPos := MulDiv(MAX_SCROLL, LeftChar, nMaxScroll); + end; + + ShowScrollBar(Handle, SB_HORZ, not(eoHideShowScrollbars in Options) or + (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > CharsInWindow)); + SetScrollInfo(Handle, SB_HORZ, ScrollInfo, True); + + //Now for the arrows + if (eoDisableScrollArrows in Options) or (nMaxScroll <= CharsInWindow) then + begin + iRightChar := LeftChar + CharsInWindow -1; + if (LeftChar <= 1) and (iRightChar >= nMaxScroll) then + begin + EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_BOTH); + end + else begin + EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); + if (LeftChar <= 1) then + EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_LEFT) + else if iRightChar >= nMaxScroll then + EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_RIGHT) + end; + end + else + EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); + end + else + ShowScrollBar(Handle, SB_HORZ, False); + + if fScrollBars in [ssBoth, ssVertical] then + begin + nMaxScroll := DisplayLineCount; + if (eoScrollPastEof in Options) then + Inc(nMaxScroll, LinesInWindow - 1); + if nMaxScroll <= MAX_SCROLL then + begin + ScrollInfo.nMin := 1; + ScrollInfo.nMax := Max(1, nMaxScroll); + ScrollInfo.nPage := LinesInWindow; + ScrollInfo.nPos := TopLine; + end + else begin + ScrollInfo.nMin := 0; + ScrollInfo.nMax := MAX_SCROLL; + ScrollInfo.nPage := MulDiv(MAX_SCROLL, LinesInWindow, nMaxScroll); + ScrollInfo.nPos := MulDiv(MAX_SCROLL, TopLine, nMaxScroll); + end; + + ShowScrollBar(Handle, SB_VERT, not(eoHideShowScrollbars in Options) or + (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > LinesInWindow)); + SetScrollInfo(Handle, SB_VERT, ScrollInfo, True); + + if (eoDisableScrollArrows in Options) or (nMaxScroll <= LinesInWindow) then + begin + if (TopLine <= 1) and (nMaxScroll <= LinesInWindow) then + begin + EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_BOTH); + end + else begin + EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); + if (TopLine <= 1) then + EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_UP) + else if ((DisplayLineCount - TopLine - LinesInWindow + 1) = 0) then + EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_DOWN); + end; + end + else + EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); + + if Visible then SendMessage(Handle, WM_SETREDRAW, -1, 0); + if FPaintLock=0 then + Invalidate; + + end + else + ShowScrollBar(Handle, SB_VERT, False); + + end {endif fScrollBars <> ssNone} + else + ShowScrollBar(Handle, SB_BOTH, False); + end; +end; + +{$IFDEF SYN_COMPILER_6_UP} +function TCustomSynEdit.DoMouseWheel(Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint): Boolean; +const + WHEEL_DIVISOR = 120; // Mouse Wheel standard +var + iWheelClicks: Integer; + iLinesToScroll: Integer; +begin + Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos); + if Result then + Exit; + if GetKeyState(SYNEDIT_CONTROL) < 0 then + iLinesToScroll := LinesInWindow shr Ord(eoHalfPageScroll in FOptions) + else + iLinesToScroll := 3; + Inc(FMouseWheelAccumulator, WheelDelta); + iWheelClicks := FMouseWheelAccumulator div WHEEL_DIVISOR; + FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DIVISOR; + TopLine := TopLine - iWheelClicks * iLinesToScroll; + Update; + if Assigned(OnScroll) then OnScroll(Self,sbVertical); + Result := True; +end; +{$ENDIF} + +{$IFDEF SYN_COMPILER_12_UP} +type + PHintInfo = Controls.PHintInfo; +{$ENDIF} + +procedure TCustomSynEdit.CMHintShow(var Msg: TMessage); +var + FoundHint: Boolean; + MouseCoords, TokenCoords: TBufferCoord; + TokenStr: UnicodeString; + TokenHint: string; + TokenType, Start: Integer; + Attri: TSynHighlighterAttributes; + D: TDisplayCoord; + P1, P2: TPoint; + TokenRect: TRect; +begin + if FHintMode = shmToken then + begin + FoundHint := False; + if Assigned(FOnTokenHint) and GetPositionOfMouse(MouseCoords) and + GetHighlighterAttriAtRowColEx(MouseCoords, TokenStr, TokenType, Start, Attri) then + begin + TokenCoords.Char := Start; + TokenCoords.Line := MouseCoords.Line; + FOnTokenHint(Self, TokenCoords, TokenStr, TokenType, Attri, TokenHint); + FoundHint := TokenHint <> ''; + end; + + if FoundHint then + begin + D := BufferToDisplayPos(TokenCoords); + P1 := RowColumnToPixels(D); + P2.X := P1.X + Length(TokenStr) * CharWidth; + P2.Y := P1.Y + FTextHeight; + TokenRect.TopLeft := P1; + TokenRect.BottomRight := P2; + + InflateRect(TokenRect, 2, 2); + with PHintInfo(Msg.LParam)^ do + begin + HintStr := TokenHint; + CursorRect := TokenRect; + HintData := nil; + end; + Msg.Result := 0; + end + else + Msg.Result := 1; + end + else + inherited; +end; + +procedure TCustomSynEdit.WMCaptureChanged(var Msg: TMessage); +begin + FScrollTimer.Enabled := False; + inherited; +end; + +procedure TCustomSynEdit.WMChar(var Msg: TWMChar); +begin +{$IFNDEF UNICODE} + if not Win32PlatformIsUnicode then + Msg.CharCode := Word(KeyUnicode(AnsiChar(Msg.CharCode))); +{$ENDIF} + + DoKeyPressW(Msg); +end; + +procedure TCustomSynEdit.WMClear(var Msg: TMessage); +begin + if not ReadOnly then + SelText := ''; +end; + +procedure TCustomSynEdit.WMCopy(var Message: TMessage); +begin + CopyToClipboard; + Message.Result := ord(True); +end; + +procedure TCustomSynEdit.WMCut(var Message: TMessage); +begin + if not ReadOnly then + CutToClipboard; + Message.Result := ord(True); +end; + +procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage); +var + i, iNumberDropped: Integer; + {$IFNDEF UNICODE} + FileNameA: array[0..MAX_PATH - 1] of AnsiChar; + {$ENDIF} + FileNameW: array[0..MAX_PATH - 1] of WideChar; + Point: TPoint; + FilesList: TUnicodeStringList; +begin + try + if Assigned(FOnDropFiles) then + begin + FilesList := TUnicodeStringList.Create; + try + iNumberDropped := DragQueryFile(THandle(Msg.wParam), Cardinal(-1), + nil, 0); + DragQueryPoint(THandle(Msg.wParam), Point); + +{$IFNDEF UNICODE} + if Win32PlatformIsUnicode then +{$ENDIF} + for i := 0 to iNumberDropped - 1 do + begin + DragQueryFileW(THandle(Msg.wParam), i, FileNameW, + sizeof(FileNameW) div 2); + FilesList.Add(FileNameW) +{$IFNDEF UNICODE} + end + else + for i := 0 to iNumberDropped - 1 do + begin + DragQueryFileA(THandle(Msg.wParam), i, FileNameA, + sizeof(FileNameA)); + FilesList.Add(UnicodeString(FileNameA)) +{$ENDIF} + end; + FOnDropFiles(Self, Point.X, Point.Y, FilesList); + finally + FilesList.Free; + end; + end; + finally + Msg.Result := 0; + DragFinish(THandle(Msg.wParam)); + end; +end; + +procedure TCustomSynEdit.WMDestroy(var Message: TWMDestroy); +begin + {$IFDEF UNICODE} + // assign WindowText here, otherwise the VCL will call GetText twice + if WindowText = nil then + WindowText := Lines.GetText; + {$ENDIF} + inherited; +end; + +procedure TCustomSynEdit.WMEraseBkgnd(var Msg: TMessage); +begin + Msg.Result := 1; +end; + +procedure TCustomSynEdit.WMGetDlgCode(var Msg: TWMGetDlgCode); +begin + inherited; + Msg.Result := Msg.Result or DLGC_WANTARROWS or DLGC_WANTCHARS; + if FWantTabs then + Msg.Result := Msg.Result or DLGC_WANTTAB; + if FWantReturns then + Msg.Result := Msg.Result or DLGC_WANTALLKEYS; +end; + +procedure TCustomSynEdit.WMGetText(var Msg: TWMGetText); +begin + if HandleAllocated and IsWindowUnicode(Handle) then + begin + WStrLCopy(PWideChar(Msg.Text), PWideChar(Text), Msg.TextMax - 1); + Msg.Result := WStrLen(PWideChar(Msg.Text)); + end + else + begin + {$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; + +procedure TCustomSynEdit.WMGetTextLength(var Msg: TWMGetTextLength); +begin +{$IFDEF SYN_COMPILER_4_UP} + // Avoid (useless) temporary copy of WindowText while window is recreated + // because of docking. + if csDocking in ControlState then + Msg.Result := 0 + else +{$ENDIF} + Msg.Result := Length(Text); +end; + +procedure TCustomSynEdit.WMHScroll(var Msg: TWMScroll); +var + iMaxWidth: Integer; +begin + Msg.Result := 0; + case Msg.ScrollCode of + // Scrolls to start / end of the line + SB_LEFT: LeftChar := 1; + SB_RIGHT: + if eoScrollPastEol in Options then + LeftChar := MaxScrollWidth - CharsInWindow +1 + else + // Simply set LeftChar property to the LengthOfLongestLine, + // it would do the range checking and constrain the value if necessary + LeftChar := TSynEditStringList(Lines).LengthOfLongestLine; + // Scrolls one char left / right + SB_LINERIGHT: LeftChar := LeftChar + 1; + SB_LINELEFT: LeftChar := LeftChar - 1; + // Scrolls one page of chars left / right + SB_PAGERIGHT: LeftChar := LeftChar + + (FCharsInWindow - Ord(eoScrollByOneLess in FOptions)); + SB_PAGELEFT: LeftChar := LeftChar + - (FCharsInWindow - Ord(eoScrollByOneLess in FOptions)); + // Scrolls to the current scroll bar position + SB_THUMBPOSITION, + SB_THUMBTRACK: + begin + FIsScrolling := True; + if eoScrollPastEol in Options then + iMaxWidth := MaxScrollWidth + else + iMaxWidth := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); + if iMaxWidth > MAX_SCROLL then + LeftChar := MulDiv(iMaxWidth, Msg.Pos, MAX_SCROLL) + else + LeftChar := Msg.Pos; + end; + SB_ENDSCROLL: FIsScrolling := False; + end; + if Assigned(OnScroll) then OnScroll(Self,sbHorizontal); +end; + +function IsWindows98orLater: Boolean; +begin + Result := (Win32MajorVersion > 4) or + (Win32MajorVersion = 4) and (Win32MinorVersion > 0); +end; + +procedure TCustomSynEdit.WMImeChar(var Msg: TMessage); +begin + // do nothing here, the IME string is retrieved in WMImeComposition + + // Handling the WM_IME_CHAR message stops Windows from sending WM_CHAR + // messages while using the IME +end; + +procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage); +var + imc: HIMC; + PW: PWideChar; + PA: PAnsiChar; + PWLength: Integer; + ImeCount: Integer; +begin + if (Msg.LParam and GCS_RESULTSTR) <> 0 then + begin + imc := ImmGetContext(Handle); + try + if IsWindows98orLater then + begin + ImeCount := ImmGetCompositionStringW(imc, GCS_RESULTSTR, nil, 0); + // ImeCount is always the size in bytes, also for Unicode + GetMem(PW, ImeCount + sizeof(WideChar)); + try + ImmGetCompositionStringW(imc, GCS_RESULTSTR, PW, ImeCount); + PW[ImeCount div sizeof(WideChar)] := #0; + CommandProcessor(ecImeStr, #0, PW); + finally + FreeMem(PW); + end; + end + else + begin + ImeCount := ImmGetCompositionStringA(imc, GCS_RESULTSTR, nil, 0); + // ImeCount is always the size in bytes, also for Unicode + GetMem(PA, ImeCount + sizeof(AnsiChar)); + try + ImmGetCompositionStringA(imc, GCS_RESULTSTR, PA, ImeCount); + PA[ImeCount] := #0; + + PWLength := MultiByteToWideChar(DefaultSystemCodePage, 0, PA, ImeCount, + nil, 0); + GetMem(PW, (PWLength + 1) * sizeof(WideChar)); + try + MultiByteToWideChar(DefaultSystemCodePage, 0, PA, ImeCount, + PW, PWLength); + CommandProcessor(ecImeStr, #0, PW); + finally + FreeMem(PW); + end; + finally + FreeMem(PA); + end; + end; + finally + ImmReleaseContext(Handle, imc); + end; + end; + inherited; +end; + +procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage); +var + imc: HIMC; + LogFontW: TLogFontW; + LogFontA: TLogFontA; +begin + with Msg do + begin + case WParam of + IMN_SETOPENSTATUS: + begin + imc := ImmGetContext(Handle); + if imc <> 0 then + begin + if IsWindows98orLater then + begin + GetObjectW(Font.Handle, SizeOf(TLogFontW), @LogFontW); + ImmSetCompositionFontW(imc, @LogFontW); + end + else + begin + GetObjectA(Font.Handle, SizeOf(TLogFontA), @LogFontA); + ImmSetCompositionFontA(imc, @LogFontA); + end; + ImmReleaseContext(Handle, imc); + end; + end; + end; + end; + inherited; +end; + +procedure TCustomSynEdit.WMImeRequest(var Message: TMessage); +var + pReconvert: PReconvertString; + TargetText: string; + TargetByteLength: Integer; + pTarget: PChar; + H: HIMC; +begin + case Message.WParam of + IMR_RECONVERTSTRING: + begin + // Reconversion string + if (Self.SelLength <> 0) then + begin + TargetText := Self.SelText; + end + else + begin + if (Self.Lines.Count >= Self.CaretY - 1) then + TargetText := Self.Lines[Self.CaretY - 1] + else + TargetText := ''; + end; + TargetByteLength := Length(TargetText) * sizeof(Char); + + if (Message.LParam = 0) then + begin + // 1st time (get buffer size (bytes)) + // Select only one row + if (Self.BlockBegin.Line = Self.BlockEnd.Line) then + Message.Result := Sizeof(TReconvertString) + TargetByteLength + else + Message.Result := 0; + end + else + begin + // 2nd time + pReconvert := Pointer(Message.LParam); + pReconvert.dwSize := Sizeof(TReconvertString); + pReconvert.dwVersion := 0; + pReconvert.dwStrLen := Length(TargetText); + pReconvert.dwStrOffset := Sizeof(TReconvertString); + + pTarget := Pointer(Message.LParam + Sizeof(TReconvertString)); + move(TargetText[1], pTarget^, TargetByteLength); + + if (Self.SelLength <> 0) then + begin + pReconvert.dwTargetStrLen := 0; + pReconvert.dwTargetStrOffset := 0; + pReconvert.dwCompStrLen := Length(TargetText); + pReconvert.dwCompStrOffset := 0; + end + else + begin + pReconvert.dwTargetStrLen := 0; + pReconvert.dwTargetStrOffset := (Self.CaretX - 1) * sizeof(Char); + H := Imm32GetContext(Handle); + try + ImmSetCompositionString(H, SCS_QUERYRECONVERTSTRING, pReconvert, Sizeof(TReconvertString) + TargetByteLength, nil, 0); + if (pReconvert.dwCompStrLen <> 0) then + begin + Self.CaretX := pReconvert.dwCompStrOffset div sizeof(Char) + 1; + Self.SelStart := RowColToCharIndex(Self.CaretXY); + Self.SelLength := pReconvert.dwCompStrLen; + end; + finally + Imm32ReleaseContext(Handle, H); + end; + end; + Message.Result := Sizeof(TReconvertString) + TargetByteLength; + end; + end; + IMR_DOCUMENTFEED: + begin + // Notifies an application when the selected IME needs the converted string from the application. + if (Self.Lines.Count >= Self.CaretY) then + TargetText := Self.Lines[Self.CaretY] + else + TargetText := ''; + if (Message.LParam = 0) then + begin + // 1st time (get line size (bytes)) + Message.Result := Sizeof(TReconvertString) + Length(TargetText) * sizeof(Char); + end + else + begin + // 2nd time + pReconvert := Pointer(Message.LParam); + pReconvert.dwSize := Sizeof(TReconvertString); + pReconvert.dwVersion := 0; + pReconvert.dwStrLen := Length(TargetText); + pReconvert.dwStrOffset := Sizeof(TReconvertString); + pReconvert.dwCompStrLen := 0; + pReconvert.dwCompStrOffset := 0; + pReconvert.dwTargetStrLen := 0; + pReconvert.dwTargetStrOffset := (Self.CaretX - 1) * sizeof(Char); + + pTarget := Pointer(Message.LParam + Sizeof(TReconvertString)); + move(TargetText[1], pTarget^, Length(TargetText) * sizeof(Char)); + + Message.Result := Sizeof(TReconvertString) + Length(TargetText) * sizeof(Char); + end; + end; + end; +end; + +procedure TCustomSynEdit.WMKillFocus(var Msg: TWMKillFocus); +begin + inherited; + CommandProcessor(ecLostFocus, #0, nil); + //Added check for focused to prevent caret disappearing problem + if Focused or FAlwaysShowCaret then + Exit; + HideCaret; + Windows.DestroyCaret; + if FHideSelection and SelAvail then + InvalidateSelection; +end; + +procedure TCustomSynEdit.WMPaste(var Message: TMessage); +begin + if not ReadOnly then + PasteFromClipboard; + Message.Result := ord(True); +end; + +procedure TCustomSynEdit.WMCancelMode(var Message:TMessage); +begin + +end; + +procedure TCustomSynEdit.WMSetFocus(var Msg: TWMSetFocus); +begin + CommandProcessor(ecGotFocus, #0, nil); + + InitializeCaret; + if FHideSelection and SelAvail then + InvalidateSelection; +end; + +procedure TCustomSynEdit.WMSetText(var Msg: TWMSetText); +begin + Msg.Result := 1; + try + if HandleAllocated and IsWindowUnicode(Handle) then + Text := PWideChar(Msg.Text) + else + Text := UnicodeString(PAnsiChar(Msg.Text)); + except + Msg.Result := 0; + raise + end +end; + +procedure TCustomSynEdit.WMSize(var Msg: TWMSize); +begin + inherited; + SizeOrFontChanged(False); +end; + +procedure TCustomSynEdit.WMUndo(var Msg: TMessage); +begin + Undo; +end; + +var + ScrollHintWnd: THintWindow; + +function GetScrollHint: THintWindow; +begin + if ScrollHintWnd = nil then + ScrollHintWnd := HintWindowClass.Create(Application); + Result := ScrollHintWnd; +end; + +procedure TCustomSynEdit.WMVScroll(var Msg: TWMScroll); +var + s: string; + rc: TRect; + pt: TPoint; + ScrollHint: THintWindow; + ButtonH: Integer; + ScrollInfo: TScrollInfo; +begin + Msg.Result := 0; + case Msg.ScrollCode of + // Scrolls to start / end of the text + SB_TOP: TopLine := 1; + SB_BOTTOM: TopLine := DisplayLineCount; + // Scrolls one line up / down + SB_LINEDOWN: TopLine := TopLine + 1; + SB_LINEUP: TopLine := TopLine - 1; + // Scrolls one page of lines up / down + SB_PAGEDOWN: TopLine := TopLine + + (FLinesInWindow - Ord(eoScrollByOneLess in FOptions)); + SB_PAGEUP: TopLine := TopLine + - (FLinesInWindow - Ord(eoScrollByOneLess in FOptions)); + // Scrolls to the current scroll bar position + SB_THUMBPOSITION, + SB_THUMBTRACK: + begin + FIsScrolling := True; + if DisplayLineCount > MAX_SCROLL then + TopLine := MulDiv(LinesInWindow + DisplayLineCount - 1, Msg.Pos, + MAX_SCROLL) + else + TopLine := Msg.Pos; + + if eoShowScrollHint in FOptions then + begin + ScrollHint := GetScrollHint; + ScrollHint.Color := FScrollHintColor; + case FScrollHintFormat of + shfTopLineOnly: + s := Format(SYNS_ScrollInfoFmtTop, [RowToLine(TopLine)]); + else + s := Format(SYNS_ScrollInfoFmt, [RowToLine(TopLine), + RowToLine(TopLine + Min(LinesInWindow, DisplayLineCount-TopLine))]); + end; + +{$IFDEF SYN_COMPILER_3_UP} + rc := ScrollHint.CalcHintRect(200, s, nil); +{$ELSE} + rc := Rect(0, 0, TextWidth(ScrollHint.Canvas, s) + 6, + TextHeight(ScrollHint.Canvas, s) + 4); +{$ENDIF} + if eoScrollHintFollows in FOptions then + begin + ButtonH := GetSystemMetrics(SM_CYVSCROLL); + + FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); + ScrollInfo.cbSize := SizeOf(ScrollInfo); + ScrollInfo.fMask := SIF_ALL; + GetScrollInfo(Handle, SB_VERT, ScrollInfo); + + pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, + ((rc.Bottom - rc.Top) shr 1) + //half the size of the hint window + Round((ScrollInfo.nTrackPos / ScrollInfo.nMax) * //The percentage of the page that has been scrolled + (ClientHeight - (ButtonH * 2))) //The height minus the arrow buttons + + ButtonH)); //The height of the top button + end + else + pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); + + OffsetRect(rc, pt.x, pt.y); + ScrollHint.ActivateHint(rc, s); +{$IFDEF SYN_COMPILER_3} + SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0); +{$ENDIF} +{$IFNDEF SYN_COMPILER_3_UP} + ScrollHint.Invalidate; +{$ENDIF} + ScrollHint.Update; + end; + end; + // Ends scrolling + SB_ENDSCROLL: + begin + FIsScrolling := False; + if eoShowScrollHint in FOptions then + ShowWindow(GetScrollHint.Handle, SW_HIDE); + end; + end; + Update; + if Assigned(OnScroll) then OnScroll(Self,sbVertical); +end; + +function TCustomSynEdit.ScanFrom(Index: Integer): Integer; +var + iRange: TSynEditRange; +begin + Result := Index; + if Result >= Lines.Count then Exit; + + if Result = 0 then + FHighlighter.ResetRange + else + FHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Result - 1]); + + repeat + FHighlighter.SetLine(Lines[Result], Result); + FHighlighter.NextToEol; + iRange := FHighlighter.GetRange; + if TSynEditStringList(Lines).Ranges[Result] = iRange then + Exit; // avoid the final decrement + TSynEditStringList(Lines).Ranges[Result] := iRange; + Inc(Result); + until (Result = Lines.Count); + Dec(Result); +end; + +procedure TCustomSynEdit.ListCleared(Sender: TObject); +begin + if WordWrap then + FWordWrapPlugin.Reset; + +{$IFDEF SYN_CodeFolding} + if UseCodeFolding then + AllFoldRanges.Reset; +{$ENDIF} + + ClearUndo; + // invalidate the *whole* client area + FillChar(FInvalidateRect, SizeOf(TRect), 0); + Invalidate; + // set caret and selected block to start of text + CaretXY := BufferCoord(1, 1); + // scroll to start of text + TopLine := 1; + LeftChar := 1; + Include(FStatusChanges, scAll); +end; + +procedure TCustomSynEdit.ListDeleted(Sender: TObject; aIndex: Integer; + aCount: Integer); +{$IFDEF SYN_CodeFolding} +Var + vLastScan: Integer; +begin + vLastScan := aIndex; + if Assigned(fHighlighter) and (Lines.Count > 0) then + vLastScan := ScanFrom(aIndex); + + if UseCodeFolding then begin + AllFoldRanges.LinesDeleted(aIndex, aCount); + // Scan the same lines the highlighter has scanned + ReScanForFoldRanges(aIndex, vLastScan); + InvalidateGutter; + end; +{$ELSE} +begin +{$ENDIF} + if Assigned(FHighlighter) and (Lines.Count > 0) then + ScanFrom(aIndex); + + if WordWrap then + FWordWrapPlugin.LinesDeleted(aIndex, aCount); + + InvalidateLines(aIndex + 1, MaxInt); + InvalidateGutterLines(aIndex + 1, MaxInt); +//++ Flicker Reduction + Include(fStateFlags, sfScrollbarChanged); +//-- Flicker Reduction +end; + +procedure TCustomSynEdit.ListInserted(Sender: TObject; Index: Integer; + aCount: Integer); +var + L: Integer; + vLastScan: Integer; +{$IFDEF SYN_CodeFolding} + FoldIndex: Integer; +begin + vLastScan := Index; +{$ELSE} +begin +{$ENDIF} + if Assigned(FHighlighter) and (Lines.Count > 0) then + begin + vLastScan := Index; + repeat + vLastScan := ScanFrom(vLastScan); + Inc(vLastScan); + until vLastScan >= Index + aCount; + end; + +{$IFDEF SYN_CodeFolding} + if UseCodeFolding then begin + if fAllFoldRanges.CollapsedFoldStartAtLine(Index, FoldIndex) then + // insertion starts at collapsed fold + Uncollapse(FoldIndex); + AllFoldRanges.LinesInserted(Index, aCount); + // Scan the same lines the highlighter has scanned + ReScanForFoldRanges(Index, vLastScan-1); + end; +{$ENDIF} + + if WordWrap then + FWordWrapPlugin.LinesInserted(Index, aCount); + + InvalidateLines(Index + 1, MaxInt); + InvalidateGutterLines(Index + 1, MaxInt); +//++ Flicker Reduction + Include(fStateFlags, sfScrollbarChanged); +//-- Flicker Reduction + + if (eoAutoSizeMaxScrollWidth in FOptions) then + begin + L := TSynEditStringList(Lines).ExpandedStringLengths[Index]; + if L > MaxScrollWidth then + MaxScrollWidth := L; + end; +end; + +procedure TCustomSynEdit.ListPutted(Sender: TObject; Index: Integer; + aCount: Integer); +var + L: Integer; + vEndLine: Integer; +{$IFDEF SYN_CodeFolding} + vLastScan: Integer; + FoldIndex: Integer; +{$ENDIF} +begin + vEndLine := Index +1; + if WordWrap then + begin + if FWordWrapPlugin.LinesPutted(Index, aCount) <> 0 then + vEndLine := MaxInt; + InvalidateGutterLines(Index + 1, vEndLine); + end; +{$IFDEF SYN_CodeFolding} + vLastScan := Index; + if Assigned(fHighlighter) then + begin + vLastScan := ScanFrom(Index); + vEndLine := Max(vEndLine, vLastScan + 1); +{$ELSE} + if Assigned(FHighlighter) then + begin + vEndLine := Max(vEndLine, ScanFrom(Index) + 1); +{$ENDIF} + // If this editor is chained then the real owner of text buffer will probably + // have already parsed the changes, so ScanFrom will return immediately. + if FLines <> FOrigLines then + vEndLine := MaxInt; + end; + + {$IFDEF SYN_CodeFolding} + if fUseCodeFolding then begin + if fAllFoldRanges.CollapsedFoldStartAtLine(Index + 1, FoldIndex) then + // modification happens at collapsed fold + Uncollapse(FoldIndex); + AllFoldRanges.LinesPutted(Index, aCount); + // Scan the same lines the highlighter has scanned + ReScanForFoldRanges(Index, vLastScan); + end; +{$ENDIF} + + InvalidateLines(Index + 1, vEndLine); + InvalidateGutterLines(Index + 1, vEndLine); + + if (eoAutoSizeMaxScrollWidth in FOptions) then + begin + L := TSynEditStringList(Lines).ExpandedStringLengths[Index]; + if L > MaxScrollWidth then + MaxScrollWidth := L; + end; +end; + +procedure TCustomSynEdit.ScanRanges; +var + i: Integer; +begin + if Assigned(FHighlighter) and (Lines.Count > 0) then begin + FHighlighter.ResetRange; + i := 0; + repeat + FHighlighter.SetLine(Lines[i], i); + FHighlighter.NextToEol; + TSynEditStringList(Lines).Ranges[i] := FHighlighter.GetRange; + Inc(i); + until i >= Lines.Count; + end; +end; + +procedure TCustomSynEdit.SetWordBlock(Value: TBufferCoord); +var + vBlockBegin: TBufferCoord; + vBlockEnd: TBufferCoord; + TempString: UnicodeString; + + procedure CharScan; + var + cRun: Integer; + begin + { search BlockEnd } + vBlockEnd.Char := Length(TempString); + for cRun := Value.Char to Length(TempString) do + if not IsIdentChar(TempString[cRun]) then + begin + vBlockEnd.Char := cRun; + Break; + end; + { search BlockBegin } + vBlockBegin.Char := 1; + for cRun := Value.Char - 1 downto 1 do + if not IsIdentChar(TempString[cRun]) then + begin + vBlockBegin.Char := cRun + 1; + Break; + end; + end; + +begin + if (eoScrollPastEol in Options) and not WordWrap then + Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) + else + Value.Char := Max(Value.Char, 1); + Value.Line := MinMax(Value.Line, 1, Lines.Count); + TempString := Lines[Value.Line - 1] + #0; //needed for CaretX = LineLength + 1 + if Value.Char > Length(TempString) then + begin + InternalCaretXY := BufferCoord(Length(TempString), Value.Line); + Exit; + end; + + CharScan; + + vBlockBegin.Line := Value.Line; + vBlockEnd.Line := Value.Line; + SetCaretAndSelection(vBlockEnd, vBlockBegin, vBlockEnd); + InvalidateLine(Value.Line); + StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.DblClick; +var + ptMouse: TPoint; +begin + GetCursorPos(ptMouse); + ptMouse := ScreenToClient(ptMouse); + if ptMouse.X >= FGutterWidth + 2 then + begin + if not (eoNoSelection in FOptions) then + SetWordBlock(CaretXY); + inherited; + Include(FStateFlags, sfDblClicked); + Exclude(FStateFlags, sfMouseCaptured); + MouseCapture := False; + end + else + inherited; +end; + +function TCustomSynEdit.GetCanUndo: Boolean; +begin + Result := not ReadOnly and FUndoList.CanUndo; +end; + +function TCustomSynEdit.GetCanRedo: Boolean; +begin + Result := not ReadOnly and FRedoList.CanUndo; +end; + +function TCustomSynEdit.GetCanPaste; +begin + Result := not ReadOnly and ClipboardProvidesText; +end; + +procedure TCustomSynEdit.InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; + AddToUndoList: Boolean); +// used by BlockIndent and Redo +begin + SetCaretAndSelection(BB, BB, BE); + ActiveSelectionMode := smColumn; + SetSelTextPrimitiveEx(smColumn, ChangeStr, AddToUndoList); + StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.InsertLine(const BB, BE: TBufferCoord; ChangeStr: PWideChar; + AddToUndoList: Boolean); +begin + SetCaretAndSelection(BB, BB, BE); + ActiveSelectionMode := smLine; + SetSelTextPrimitiveEx(smLine, ChangeStr, AddToUndoList); + StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.Redo; + + procedure RemoveGroupBreak; + var + Item: TSynEditUndoItem; + OldBlockNumber: Integer; + begin + if FRedoList.LastChangeReason = crGroupBreak then + begin + OldBlockNumber := UndoList.BlockChangeNumber; + Item := FRedoList.PopItem; + try + UndoList.BlockChangeNumber := Item.ChangeNumber; + FUndoList.AddGroupBreak; + finally + UndoList.BlockChangeNumber := OldBlockNumber; + Item.Free; + end; + UpdateModifiedStatus; + end; + end; + +var + Item: TSynEditUndoItem; + OldChangeNumber: Integer; + SaveChangeNumber: Integer; + FLastChange : TSynChangeReason; + FAutoComplete: Boolean; + FPasteAction: Boolean; + FSpecial1: Boolean; + FSpecial2: Boolean; + FKeepGoing: Boolean; +begin + if ReadOnly then + Exit; + + FLastChange := FRedoList.LastChangeReason; + FAutoComplete := FLastChange = crAutoCompleteBegin; + FPasteAction := FLastChange = crPasteBegin; + FSpecial1 := FLastChange = crSpecial1Begin; + FSpecial2 := FLastChange = crSpecial2Begin; + + Item := FRedoList.PeekItem; + if Item <> nil then + begin + OldChangeNumber := Item.ChangeNumber; + SaveChangeNumber := FUndoList.BlockChangeNumber; + FUndoList.BlockChangeNumber := Item.ChangeNumber; + try + repeat + RedoItem; + Item := FRedoList.PeekItem; + if Item = nil then + FKeepGoing := False + else begin + if FAutoComplete then + FKeepGoing := (FRedoList.LastChangeReason <> crAutoCompleteEnd) + else if FPasteAction then + FKeepGoing := (FRedoList.LastChangeReason <> crPasteEnd) + else if FSpecial1 then + FKeepGoing := (FRedoList.LastChangeReason <> crSpecial1End) + else if FSpecial2 then + FKeepGoing := (FRedoList.LastChangeReason <> crSpecial2End) + else if Item.ChangeNumber = OldChangeNumber then + FKeepGoing := True + else begin + FKeepGoing := ((eoGroupUndo in FOptions) and + (FLastChange = Item.ChangeReason) and + not(FLastChange in [crIndent, crUnindent])); + end; + FLastChange := Item.ChangeReason; + end; + until not(FKeepGoing); + + //we need to eat the last command since it does nothing and also update modified status... + if (FAutoComplete and (FRedoList.LastChangeReason = crAutoCompleteEnd)) or + (FPasteAction and (FRedoList.LastChangeReason = crPasteEnd)) or + (FSpecial1 and (FRedoList.LastChangeReason = crSpecial1End)) or + (FSpecial2 and (FRedoList.LastChangeReason = crSpecial2End)) then + begin + RedoItem; + UpdateModifiedStatus; + end; + + finally + FUndoList.BlockChangeNumber := SaveChangeNumber; + end; + RemoveGroupBreak; + end; +end; + +procedure TCustomSynEdit.RedoItem; +var + Item: TSynEditUndoItem; + Run, StrToDelete: PWideChar; + Len: Integer; + TempString: UnicodeString; + CaretPt: TBufferCoord; + ChangeScrollPastEol: Boolean; + BeginX: Integer; +begin + ChangeScrollPastEol := not (eoScrollPastEol in Options); + Item := FRedoList.PopItem; + if Assigned(Item) then + try + ActiveSelectionMode := Item.ChangeSelMode; + IncPaintLock; + Include(FOptions, eoScrollPastEol); + FUndoList.InsideRedo := True; + case Item.ChangeReason of + crCaret: + begin + FUndoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', FActiveSelectionMode); + InternalCaretXY := Item.ChangeStartPos; + end; + crSelection: + begin + FUndoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', FActiveSelectionMode); + SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); + end; + crInsert, crPaste, crDragDropInsert: + begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeStartPos); + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), + False); + InternalCaretXY := Item.ChangeEndPos; + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, SelText, Item.ChangeSelMode); + if Item.ChangeReason = crDragDropInsert then begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + end; + end; + crDeleteAfterCursor, crSilentDeleteAfterCursor: + begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + TempString := SelText; + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), + False); + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, TempString, Item.ChangeSelMode); + InternalCaretXY := Item.ChangeEndPos; + end; + crDelete, crSilentDelete: + begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + TempString := SelText; + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), + False); + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, TempString, Item.ChangeSelMode); + InternalCaretXY := Item.ChangeStartPos; + end; + crLineBreak: + begin + CaretPt := Item.ChangeStartPos; + SetCaretAndSelection(CaretPt, CaretPt, CaretPt); + CommandProcessor(ecLineBreak, #13, nil); + end; + crIndent: + begin + SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, + Item.ChangeEndPos); + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); + end; + crUnindent : + begin // re-delete the (raggered) column + // Delete string + StrToDelete := PWideChar(Item.ChangeStr); + InternalCaretY := Item.ChangeStartPos.Line; + if Item.ChangeSelMode = smColumn then + BeginX := Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char) + else + BeginX := 1; + repeat + Run := GetEOL(StrToDelete); + if Run <> StrToDelete then + begin + Len := Run - StrToDelete; + if Len > 0 then + begin + TempString := Lines[CaretY - 1]; + Delete(TempString, BeginX, Len); + Lines[CaretY - 1] := TempString; + end; + end + else + Len := 0; + if Run^ = #13 then + begin + Inc(Run); + if Run^ = #10 then + Inc(Run); + Inc(FCaretY); + end; + StrToDelete := Run; + until Run^ = #0; + if Item.ChangeSelMode = smColumn then + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos) + else begin + // restore selection + CaretPt.Char := Item.ChangeStartPos.Char - FTabWidth; + CaretPt.Line := Item.ChangeStartPos.Line; + SetCaretAndSelection( CaretPt, CaretPt, + BufferCoord(Item.ChangeEndPos.Char - Len, Item.ChangeEndPos.Line) ); + end; + // add to undo list + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); + end; + crWhiteSpaceAdd: + begin + FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, '', Item.ChangeSelMode); + SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeEndPos, + Item.ChangeEndPos); + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), True); + InternalCaretXY := Item.ChangeStartPos; + end; + end; + finally + FUndoList.InsideRedo := False; + if ChangeScrollPastEol then + Exclude(FOptions, eoScrollPastEol); + Item.Free; + DecPaintLock; + end; +end; + +{$IFDEF SYN_CodeFolding} +procedure TCustomSynEdit.Collapse(FoldRangeIndex: Integer; Invalidate:Boolean); +begin + AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := True; + + with AllFoldRanges.Ranges[FoldRangeIndex] do + begin + // Extract caret from fold + if (fCaretY > FromLine) and (fCaretY <= ToLine) then + CaretXY := BufferCoord(Length(Lines[FromLine - 1]) + 1, FromLine); + + if Invalidate then begin + // Redraw the collapsed line and below + InvalidateLines(FromLine, MaxInt); + + // Redraw fold mark + InvalidateGutterLines(FromLine, MaxInt); + + UpdateScrollBars; + end else + // Update Scrollbars + Include(fStateFlags, sfScrollbarChanged); + end; +end; + +procedure TCustomSynEdit.CollapseAll; +var + i: Integer; +begin + if not fUseCodeFolding then Exit; + for i := fAllFoldRanges.Count - 1 downto 0 do + Collapse(i, False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; + + +procedure TCustomSynEdit.CollapseLevel(Level: integer); +Var + i : integer; + RangeIndices : TArray; +begin + if not fUseCodeFolding then Exit; + RangeIndices := AllFoldRanges.FoldsAtLevel(Level); + for i := Low(RangeIndices) to High(RangeIndices) do + Collapse(RangeIndices[i], False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.CollapseNearest; +Var + Index : integer; +begin + if not fUseCodeFolding then Exit; + if AllFoldRanges.FoldAroundLineEx(CaretY, False, True, True, Index) then + Collapse(Index); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.CollapseFoldType(FoldType : Integer); +Var + i : integer; + RangeIndices : TArray; +begin + if not fUseCodeFolding then Exit; + RangeIndices := AllFoldRanges.FoldsOfType(FoldType); + for i := Low(RangeIndices) to High(RangeIndices) do + Collapse(RangeIndices[i],False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.Uncollapse(FoldRangeIndex: Integer; Invalidate:Boolean); +begin + AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := False; + + if Invalidate then with AllFoldRanges.Ranges[FoldRangeIndex] do + begin + // Redraw the uncollapsed line and below + InvalidateLines(FromLine, MaxInt); + + // Redraw fold marks + InvalidateGutterLines(FromLine, MaxInt); + + // Make sure we can see the cursor + // EnsureCursorPosVisible; + + UpdateScrollBars; + end else + // Update Scrollbars + Include(fStateFlags, sfScrollbarChanged); +end; + +procedure TCustomSynEdit.UncollapseAroundLine(Line: Integer); +var + Index: Integer; +begin + if not fUseCodeFolding then Exit; + // Open up the closed folds around the focused line until we can see the line we're looking for + while AllFoldRanges.FoldHidesLine(line, Index) do + Uncollapse(Index); +end; + +procedure TCustomSynEdit.UnCollapseLevel(Level: integer); +Var + i : integer; + RangeIndices : TArray; +begin + if not fUseCodeFolding then Exit; + RangeIndices := AllFoldRanges.FoldsAtLevel(Level); + for i := Low(RangeIndices) to High(RangeIndices) do + Uncollapse(RangeIndices[i], False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.UncollapseNearest; +Var + Index : integer; +begin + if not fUseCodeFolding then Exit; + if AllFoldRanges.CollapsedFoldStartAtLine(CaretY, Index) then + Uncollapse(Index); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.UnCollapseFoldType(FoldType : Integer); +Var + i : integer; + RangeIndices : TArray; +begin + if not fUseCodeFolding then Exit; + RangeIndices := AllFoldRanges.FoldsOfType(FoldType); + for i := Low(RangeIndices) to High(RangeIndices) do + Uncollapse(RangeIndices[i], False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.UncollapseAll; +var + i: Integer; +begin + if not fUseCodeFolding then Exit; + for i := fAllFoldRanges.Count - 1 downto 0 do + Uncollapse(i, False); + + InvalidateLines(-1, -1); + InvalidateGutterLines(-1, -1); + + EnsureCursorPosVisible; +end; +{$ENDIF} + +procedure TCustomSynEdit.Undo; + + procedure RemoveGroupBreak; + var + Item: TSynEditUndoItem; + OldBlockNumber: Integer; + begin + if FUndoList.LastChangeReason = crGroupBreak then + begin + OldBlockNumber := RedoList.BlockChangeNumber; + try + Item := FUndoList.PopItem; + RedoList.BlockChangeNumber := Item.ChangeNumber; + Item.Free; + FRedoList.AddGroupBreak; + finally + RedoList.BlockChangeNumber := OldBlockNumber; + end; + end; + end; + +var + Item: TSynEditUndoItem; + OldChangeNumber: Integer; + SaveChangeNumber: Integer; + FLastChange : TSynChangeReason; + FAutoComplete: Boolean; + FPasteAction: Boolean; + FSpecial1: Boolean; + FSpecial2: Boolean; + FKeepGoing: Boolean; +begin + if ReadOnly then + Exit; + + RemoveGroupBreak; + + FLastChange := FUndoList.LastChangeReason; + FAutoComplete := FLastChange = crAutoCompleteEnd; + FPasteAction := FLastChange = crPasteEnd; + FSpecial1 := FLastChange = crSpecial1End; + FSpecial2 := FLastChange = crSpecial2End; + + Item := FUndoList.PeekItem; + if Item <> nil then + begin + OldChangeNumber := Item.ChangeNumber; + SaveChangeNumber := FRedoList.BlockChangeNumber; + FRedoList.BlockChangeNumber := Item.ChangeNumber; + + try + repeat + UndoItem; + Item := FUndoList.PeekItem; + if Item = nil then + FKeepGoing := False + else begin + if FAutoComplete then + FKeepGoing := (FUndoList.LastChangeReason <> crAutoCompleteBegin) + else if FPasteAction then + FKeepGoing := (FUndoList.LastChangeReason <> crPasteBegin) + else if FSpecial1 then + FKeepGoing := (FUndoList.LastChangeReason <> crSpecial1Begin) + else if FSpecial2 then + FKeepGoing := (FUndoList.LastChangeReason <> crSpecial2Begin) + else if Item.ChangeNumber = OldChangeNumber then + FKeepGoing := True + else begin + FKeepGoing := ((eoGroupUndo in FOptions) and + (FLastChange = Item.ChangeReason) and + not(FLastChange in [crIndent, crUnindent])); + end; + FLastChange := Item.ChangeReason; + end; + until not(FKeepGoing); + + //we need to eat the last command since it does nothing and also update modified status... + if (FAutoComplete and (FUndoList.LastChangeReason = crAutoCompleteBegin)) or + (FPasteAction and (FUndoList.LastChangeReason = crPasteBegin)) or + (FSpecial1 and (FUndoList.LastChangeReason = crSpecial1Begin)) or + (FSpecial2 and (FUndoList.LastChangeReason = crSpecial2Begin)) then + begin + UndoItem; + UpdateModifiedStatus; + end; + + finally + FRedoList.BlockChangeNumber := SaveChangeNumber; + end; + end; +end; + +procedure TCustomSynEdit.UndoItem; +var + Item: TSynEditUndoItem; + TmpPos: TBufferCoord; + TmpStr: UnicodeString; + ChangeScrollPastEol: Boolean; + BeginX: Integer; +begin + ChangeScrollPastEol := not (eoScrollPastEol in Options); + Item := FUndoList.PopItem; + if Assigned(Item) then + try + ActiveSelectionMode := Item.ChangeSelMode; + IncPaintLock; + Include(FOptions, eoScrollPastEol); + case Item.ChangeReason of + crCaret: + begin + FRedoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', FActiveSelectionMode); + InternalCaretXY := Item.ChangeStartPos; + end; + crSelection: + begin + FRedoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', FActiveSelectionMode); + SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); + end; + crInsert, crPaste, crDragDropInsert: + begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + TmpStr := SelText; + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), + False); + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, TmpStr, Item.ChangeSelMode); + InternalCaretXY := Item.ChangeStartPos; + end; + crDeleteAfterCursor, crDelete, + crSilentDelete, crSilentDeleteAfterCursor, + crDeleteAll: + begin + // If there's no selection, we have to set + // the Caret's position manualy. + if Item.ChangeSelMode = smColumn then + TmpPos := BufferCoord( + Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char), + Min(Item.ChangeStartPos.Line, Item.ChangeEndPos.Line)) + else + TmpPos := TBufferCoord(MinPoint( + TPoint(Item.ChangeStartPos), TPoint(Item.ChangeEndPos))); + if (Item.ChangeReason in [crDeleteAfterCursor, + crSilentDeleteAfterCursor]) and (TmpPos.Line > Lines.Count) then + begin + InternalCaretXY := BufferCoord(1, Lines.Count); + FLines.Add(''); + end; + CaretXY := TmpPos; + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), + False ); + if Item.ChangeReason in [crDeleteAfterCursor, + crSilentDeleteAfterCursor] + then + TmpPos := Item.ChangeStartPos + else + TmpPos := Item.ChangeEndPos; + if Item.ChangeReason in [crSilentDelete, crSilentDeleteAfterCursor] + then + InternalCaretXY := TmpPos + else begin + SetCaretAndSelection(TmpPos, Item.ChangeStartPos, + Item.ChangeEndPos); + end; + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, '', Item.ChangeSelMode); + if Item.ChangeReason = crDeleteAll then begin + InternalCaretXY := BufferCoord(1, 1); + FBlockEnd := BufferCoord(1, 1); + end; + EnsureCursorPosVisible; + end; + crLineBreak: + begin + // If there's no selection, we have to set + // the Caret's position manualy. + InternalCaretXY := Item.ChangeStartPos; + if CaretY > 0 then + begin + TmpStr := Lines.Strings[CaretY - 1]; + if (Length(TmpStr) < CaretX - 1) + and (LeftSpaces(Item.ChangeStr) = 0) + then + TmpStr := TmpStr + UnicodeStringOfChar(#32, CaretX - 1 - Length(TmpStr)); + ProperSetLine(CaretY - 1, TmpStr + Item.ChangeStr); + Lines.Delete(Item.ChangeEndPos.Line); + end + else + ProperSetLine(CaretY - 1, Item.ChangeStr); + DoLinesDeleted(CaretY + 1, 1); + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, '', Item.ChangeSelMode); + end; + crIndent: + begin + SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, + Item.ChangeEndPos); + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); + end; + crUnindent: // reinsert the (raggered) column that was deleted + begin + // reinsert the string + if Item.ChangeSelMode <> smColumn then + InsertBlock(BufferCoord(1, Item.ChangeStartPos.Line), + BufferCoord(1, Item.ChangeEndPos.Line), + PWideChar(Item.ChangeStr), False) + else + begin + BeginX := Min( Item.ChangeStartPos.Char, Item.ChangeEndPos.Char ); + InsertBlock(BufferCoord(BeginX, Item.ChangeStartPos.Line), + BufferCoord(BeginX, Item.ChangeEndPos.Line), + PWideChar(Item.ChangeStr), False); + end; + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); + end; + crWhiteSpaceAdd: + begin + SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, + Item.ChangeEndPos); + TmpStr := SelText; + SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), True); + FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, + Item.ChangeEndPos, TmpStr, Item.ChangeSelMode); + InternalCaretXY := Item.ChangeStartPos; + end; + end; + finally + if ChangeScrollPastEol then + Exclude(FOptions, eoScrollPastEol); + Item.Free; + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.ClearBookMark(BookMark: Integer); +begin + if (BookMark in [0..9]) and assigned(FBookMarks[BookMark]) then + begin + DoOnClearBookmark(FBookMarks[BookMark]); + FMarkList.Remove(FBookMarks[Bookmark]); + FBookMarks[BookMark] := nil; + end +end; + +procedure TCustomSynEdit.GotoBookMark(BookMark: Integer); +var + iNewPos: TBufferCoord; +begin + if (BookMark in [0..9]) and + assigned(FBookMarks[BookMark]) and + (FBookMarks[BookMark].Line <= FLines.Count) + then + begin + iNewPos.Char := FBookMarks[BookMark].Char; + iNewPos.Line := FBookMarks[BookMark].Line; + //call it this way instead to make sure that the caret ends up in the middle + //if it is off screen (like Delphi does with bookmarks) + SetCaretXYEx(False, iNewPos); + EnsureCursorPosVisibleEx(True); + if SelAvail then + InvalidateSelection; + FBlockBegin.Char := FCaretX; + FBlockBegin.Line := FCaretY; + FBlockEnd := FBlockBegin; + end; +end; + +procedure TCustomSynEdit.GotoLineAndCenter(ALine: Integer); +begin + SetCaretXYEx( False, BufferCoord(1, ALine) ); + if SelAvail then + InvalidateSelection; + FBlockBegin.Char := FCaretX; + FBlockBegin.Line := FCaretY; + FBlockEnd := FBlockBegin; + EnsureCursorPosVisibleEx(True); +end; + +procedure TCustomSynEdit.SetBookMark(BookMark: Integer; X: Integer; Y: Integer); +var + mark: TSynEditMark; +begin + if (BookMark in [0..9]) and (Y >= 1) and (Y <= Max(1, FLines.Count)) then + begin + mark := TSynEditMark.Create(self); + with mark do + begin + Line := Y; + Char := X; + ImageIndex := Bookmark; + BookmarkNumber := Bookmark; + Visible := True; + InternalImage := (FBookMarkOpt.BookmarkImages = nil); + end; + DoOnPlaceMark(Mark); + if (mark <> nil) then + begin + if assigned(FBookMarks[BookMark]) then + ClearBookmark(BookMark); + FBookMarks[BookMark] := mark; + FMarkList.Add(FBookMarks[BookMark]); + end; + end; +end; + +function IsTextMessage(Msg: UINT): Boolean; +begin + Result := (Msg = WM_SETTEXT) or (Msg = WM_GETTEXT) or (Msg = WM_GETTEXTLENGTH); +end; + +procedure TCustomSynEdit.WndProc(var Msg: TMessage); +const + ALT_KEY_DOWN = $20000000; +begin + // Prevent Alt-Backspace from beeping + if (Msg.Msg = WM_SYSCHAR) and (Msg.wParam = VK_BACK) and + (Msg.lParam and ALT_KEY_DOWN <> 0) + then + Msg.Msg := 0; + + // handle direct WndProc calls that could happen through VCL-methods like Perform + if HandleAllocated and IsWindowUnicode(Handle) then + if not FWindowProducedMessage then + begin + FWindowProducedMessage := True; + if IsTextMessage(Msg.Msg) then + begin + with Msg do + Result := SendMessageA(Handle, Msg, wParam, lParam); + Exit; + end; + end + else + FWindowProducedMessage := False; + + inherited; +end; + +procedure TCustomSynEdit.ChainListCleared(Sender: TObject); +begin + if Assigned(FChainListCleared) then + FChainListCleared(Sender); + TSynEditStringList(FOrigLines).OnCleared(Sender); +end; + +procedure TCustomSynEdit.ChainListDeleted(Sender: TObject; aIndex: Integer; + aCount: Integer); +begin + if Assigned(FChainListDeleted) then + FChainListDeleted(Sender, aIndex, aCount); + TSynEditStringList(FOrigLines).OnDeleted(Sender, aIndex, aCount); +end; + +procedure TCustomSynEdit.ChainListInserted(Sender: TObject; aIndex: Integer; + aCount: Integer); +begin + if Assigned(FChainListInserted) then + FChainListInserted(Sender, aIndex, aCount); + TSynEditStringList(FOrigLines).OnInserted(Sender, aIndex, aCount); +end; + +procedure TCustomSynEdit.ChainListPutted(Sender: TObject; aIndex: Integer; + aCount: Integer); +begin + if Assigned(FChainListPutted) then + FChainListPutted(Sender, aIndex, aCount); + TSynEditStringList(FOrigLines).OnPutted(Sender, aIndex, aCount); +end; + +procedure TCustomSynEdit.ChainLinesChanging(Sender: TObject); +begin + if Assigned(FChainLinesChanging) then + FChainLinesChanging(Sender); + TSynEditStringList(FOrigLines).OnChanging(Sender); +end; + +procedure TCustomSynEdit.ChainLinesChanged(Sender: TObject); +begin + if Assigned(FChainLinesChanged) then + FChainLinesChanged(Sender); + TSynEditStringList(FOrigLines).OnChange(Sender); +end; + +procedure TCustomSynEdit.ChainUndoRedoAdded(Sender: TObject); +var + iList: TSynEditUndoList; + iHandler: TNotifyEvent; +begin + if Sender = FUndoList then + begin + iList := FOrigUndoList; + iHandler := FChainUndoAdded; + end + else { if Sender = FRedoList then } + begin + iList := FOrigRedoList; + iHandler := FChainRedoAdded; + end; + if Assigned(iHandler) then + iHandler(Sender); + iList.OnAddedUndo(Sender); +end; + +//++ DPI-Aware +procedure TCustomSynEdit.ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$ifend}); +begin + {$if CompilerVersion >= 31}if isDpiChange then begin{$ifend} + if Assigned(fGutter) then fGutter.ChangeScale(M,D); + if Assigned(fBookMarkOpt) then fBookMarkOpt.ChangeScale(M, D); + if Assigned(fWordWrapGlyph) then fWordWrapGlyph.ChangeScale(M, D); + {$if CompilerVersion >= 31}end;{$ifend} + inherited ChangeScale(M, D{$if CompilerVersion >= 31}, isDpiChange{$ifend}); + end; +//-- DPI-Aware + +procedure TCustomSynEdit.UnHookTextBuffer; +var + vOldWrap: Boolean; +begin + Assert(FChainedEditor = nil); + if FLines = FOrigLines then + Exit; + + vOldWrap := WordWrap; + WordWrap := False; + + //first put back the real methods + with TSynEditStringList(FLines) do + begin + OnCleared := FChainListCleared; + OnDeleted := FChainListDeleted; + OnInserted := FChainListInserted; + OnPutted := FChainListPutted; + OnChanging := FChainLinesChanging; + OnChange := FChainLinesChanged; + end; + FUndoList.OnAddedUndo := FChainUndoAdded; + FRedoList.OnAddedUndo := FChainRedoAdded; + + FChainListCleared := nil; + FChainListDeleted := nil; + FChainListInserted := nil; + FChainListPutted := nil; + FChainLinesChanging := nil; + FChainLinesChanged := nil; + FChainUndoAdded := nil; + + //make the switch + FLines := FOrigLines; + FUndoList := FOrigUndoList; + FRedoList := FOrigRedoList; + LinesHookChanged; + + WordWrap := vOldWrap; +end; + +procedure TCustomSynEdit.HookTextBuffer(aBuffer: TSynEditStringList; + aUndo, aRedo: TSynEditUndoList); +var + vOldWrap: Boolean; +begin + Assert(FChainedEditor = nil); + Assert(FLines = FOrigLines); + + vOldWrap := WordWrap; + WordWrap := False; + + if FChainedEditor <> nil then + RemoveLinesPointer + else if FLines <> FOrigLines then + UnHookTextBuffer; + + //store the current values and put in the chained methods + FChainListCleared := aBuffer.OnCleared; + aBuffer.OnCleared := ChainListCleared; + FChainListDeleted := aBuffer.OnDeleted; + aBuffer.OnDeleted := ChainListDeleted; + FChainListInserted := aBuffer.OnInserted; + aBuffer.OnInserted := ChainListInserted; + FChainListPutted := aBuffer.OnPutted; + aBuffer.OnPutted := ChainListPutted; + FChainLinesChanging := aBuffer.OnChanging; + aBuffer.OnChanging := ChainLinesChanging; + FChainLinesChanged := aBuffer.OnChange; + aBuffer.OnChange := ChainLinesChanged; + + FChainUndoAdded := aUndo.OnAddedUndo; + aUndo.OnAddedUndo := ChainUndoRedoAdded; + FChainRedoAdded := aRedo.OnAddedUndo; + aRedo.OnAddedUndo := ChainUndoRedoAdded; + + //make the switch + FLines := aBuffer; + FUndoList := aUndo; + FRedoList := aRedo; + LinesHookChanged; + + WordWrap := vOldWrap; +end; + +procedure TCustomSynEdit.LinesHookChanged; +var + iLongestLineLength: Integer; +begin + Invalidate; + if eoAutoSizeMaxScrollWidth in FOptions then + begin + iLongestLineLength := TSynEditStringList(Lines).LengthOfLongestLine; + if iLongestLineLength > MaxScrollWidth then + MaxScrollWidth := iLongestLineLength; + end; + UpdateScrollBars; +end; + +procedure TCustomSynEdit.SetLinesPointer(ASynEdit: TCustomSynEdit); +begin + HookTextBuffer(TSynEditStringList(ASynEdit.Lines), + ASynEdit.UndoList, ASynEdit.RedoList); + + FChainedEditor := ASynEdit; + ASynEdit.FreeNotification(Self); +end; + +procedure TCustomSynEdit.RemoveLinesPointer; +begin + {$IFDEF SYN_COMPILER_5_UP} + if Assigned(FChainedEditor) then + RemoveFreeNotification(FChainedEditor); + {$ENDIF} + FChainedEditor := nil; + + UnHookTextBuffer; +end; + +procedure TCustomSynEdit.DragCanceled; +begin + FScrollTimer.Enabled := False; + inherited; +end; + +procedure TCustomSynEdit.DragOver(Source: TObject; X, Y: Integer; + State: TDragState; var Accept: Boolean); +var + vNewPos: TDisplayCoord; +begin + inherited; + if (Source is TCustomSynEdit) and not ReadOnly then + begin + Accept := True; + + //Ctrl is pressed => change cursor to indicate copy instead of move + if GetKeyState(VK_CONTROL) < 0 then + DragCursor := crMultiDrag + else + DragCursor := crDrag; + + if Dragging then //if the drag source is the SynEdit itself + begin + if State = dsDragLeave then //restore prev caret position + ComputeCaret(FMouseDownX, FMouseDownY) + else + begin + vNewPos := PixelsToNearestRowColumn(X, Y); + vNewPos.Column := MinMax(vNewPos.Column, LeftChar, LeftChar + CharsInWindow - 1); + vNewPos.Row := MinMax(vNewPos.Row, TopLine, TopLine + LinesInWindow - 1); + InternalCaretXY := DisplayToBufferPos(vNewPos); + ComputeScroll(X, Y); + end; + end + else //if is dragging from another SynEdit + ComputeCaret(X, Y); //position caret under the mouse cursor + end; +end; + +procedure TCustomSynEdit.DragDrop(Source: TObject; X, Y: Integer); +var + vNewCaret: TBufferCoord; + DoDrop, DropAfter, DropMove: Boolean; + vBB, vBE: TBufferCoord; + DragDropText: UnicodeString; + ChangeScrollPastEOL: Boolean; +begin + if not ReadOnly and (Source is TCustomSynEdit) + and TCustomSynEdit(Source).SelAvail then + begin + IncPaintLock; + try + inherited; + ComputeCaret(X, Y); + vNewCaret := CaretXY; + // if from other control then move when SHIFT, else copy + // if from Self then copy when CTRL, else move + if Source <> Self then + begin + DropMove := GetKeyState(VK_SHIFT) < 0; + DoDrop := True; + DropAfter := False; + end + else + begin + DropMove := GetKeyState(VK_CONTROL) >= 0; + vBB := BlockBegin; + vBE := BlockEnd; + DropAfter := (vNewCaret.Line > vBE.Line) + or ((vNewCaret.Line = vBE.Line) and ((vNewCaret.Char > vBE.Char) or + ((not DropMove) and (vNewCaret.Char = vBE.Char)))); + DoDrop := DropAfter or (vNewCaret.Line < vBB.Line) + or ((vNewCaret.Line = vBB.Line) and ((vNewCaret.Char < vBB.Char) or + ((not DropMove) and (vNewCaret.Char = vBB.Char)))); + end; + if DoDrop then begin + BeginUndoBlock; + try + DragDropText := TCustomSynEdit(Source).SelText; + // delete the selected text if necessary + if DropMove then + begin + if Source <> Self then + TCustomSynEdit(Source).SelText := '' + else + begin + SelText := ''; + // adjust horizontal drop position + if DropAfter and (vNewCaret.Line = vBE.Line) then + Dec(vNewCaret.Char, vBE.Char - vBB.Char); + // adjust vertical drop position + if DropAfter and (vBE.Line > vBB.Line) then + Dec(vNewCaret.Line, vBE.Line - vBB.Line); + end; + end; + //todo: this is probably already done inside SelText + // insert the selected text + ChangeScrollPastEOL := not (eoScrollPastEol in FOptions); + try + if ChangeScrollPastEOL then + Include(FOptions, eoScrollPastEol); + InternalCaretXY := vNewCaret; + BlockBegin := vNewCaret; + { Add the text. Undo is locked so the action is recorded as crDragDropInsert + instead of crInsert (code right bellow). } + Assert(not SelAvail); + LockUndo; + try + SelText := DragDropText; + finally + UnlockUndo; + end; + finally + if ChangeScrollPastEOL then + Exclude(FOptions, eoScrollPastEol); + end; + // save undo information + if Source = Self then + begin + FUndoList.AddChange(crDragDropInsert, vNewCaret, BlockEnd, SelText, + FActiveSelectionMode); + end + else begin + FUndoList.AddChange(crInsert, vNewCaret, BlockEnd, + SelText, FActiveSelectionMode); + end; + BlockEnd := CaretXY; + CommandProcessor(ecSelGotoXY, #0, @vNewCaret); + finally + EndUndoBlock; + end; + end; + finally + DecPaintLock; + end; + end + else + inherited; +end; + +procedure TCustomSynEdit.SetRightEdge(Value: Integer); +begin + if FRightEdge <> Value then + begin + FRightEdge := Value; + Invalidate; + end; +end; + +procedure TCustomSynEdit.SetRightEdgeColor(Value: TColor); +var + nX: Integer; + rcInval: TRect; +begin + if FRightEdgeColor <> Value then + begin + FRightEdgeColor := Value; + if HandleAllocated then + begin + nX := FTextOffset + FRightEdge * FCharWidth; + rcInval := Rect(nX - 1, 0, nX + 1, Height); + InvalidateRect(rcInval, False); + end; + end; +end; + +function TCustomSynEdit.GetMaxUndo: Integer; +begin + result := FUndoList.MaxUndoActions; +end; + +procedure TCustomSynEdit.SetMaxUndo(const Value: Integer); +begin + if Value > -1 then + begin + FUndoList.MaxUndoActions := Value; + FRedoList.MaxUndoActions := Value; + end; +end; + +procedure TCustomSynEdit.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if Operation = opRemove then + begin + if AComponent = FSearchEngine then + begin + SearchEngine := nil; + end; + + if AComponent = FHighlighter then + begin + Highlighter := nil; + end; + + if AComponent = FChainedEditor then + begin + RemoveLinesPointer; + end; + + if (FBookMarkOpt <> nil) then + if (AComponent = FBookMarkOpt.BookmarkImages) then + begin + FBookMarkOpt.BookmarkImages := nil; + InvalidateGutterLines(-1, -1); + end; + end; +end; + +procedure TCustomSynEdit.SetHighlighter(const Value: TSynCustomHighlighter); +{$IFDEF SYN_CodeFolding} +Var + OldUseCodeFolding : Boolean; +{$ENDIF} +begin + if Value <> FHighlighter then + begin + if Assigned(FHighlighter) then + begin + FHighlighter.UnhookAttrChangeEvent(HighlighterAttrChanged); +{$IFDEF SYN_COMPILER_5_UP} + FHighlighter.RemoveFreeNotification(Self); +{$ENDIF} + end; + if Assigned(Value) then + begin + Value.HookAttrChangeEvent(HighlighterAttrChanged); + Value.FreeNotification(Self); + end; + FHighlighter := Value; + if not(csDestroying in ComponentState) then + HighlighterAttrChanged(FHighlighter); + +{$IFDEF SYN_CodeFolding} + // Disable Code Folding if not supported by highlighter + OldUseCodeFolding := fUseCodeFolding; + UseCodeFolding := False; + UseCodeFolding := OldUseCodeFolding; + if fHighlighter is TSynCustomCodeFoldingHighlighter then + TSynCustomCodeFoldingHighlighter(fHighlighter).InitFoldRanges(fAllFoldRanges); +{$ENDIF} + end; +end; + +procedure TCustomSynEdit.SetBorderStyle(Value: TSynBorderStyle); +begin + if FBorderStyle <> Value then + begin + FBorderStyle := Value; + RecreateWnd; + end; +end; + +procedure TCustomSynEdit.SetHideSelection(const Value: Boolean); +begin + if FHideSelection <> Value then + begin + FHideSelection := Value; + InvalidateSelection; + end; +end; + +procedure TCustomSynEdit.SetInsertMode(const Value: Boolean); +begin + if FInserting <> Value then + begin + FInserting := Value; + if not (csDesigning in ComponentState) then + // Reset the caret. + InitializeCaret; + StatusChanged([scInsertMode]); + end; +end; + +procedure TCustomSynEdit.InitializeCaret; +var + ct: TSynEditCaretType; + cw, ch: Integer; +begin + // CreateCaret automatically destroys the previous one, so we don't have to + // worry about cleaning up the old one here with DestroyCaret. + // Ideally, we will have properties that control what these two carets look like. + if InsertMode then + ct := FInsertCaret + else + ct := FOverwriteCaret; + case ct of + ctHorizontalLine: + begin + cw := FCharWidth; + ch := 2; + FCaretOffset := Point(0, FTextHeight - 2); + end; + ctHalfBlock: + begin + cw := FCharWidth; + ch := (FTextHeight - 2) div 2; + FCaretOffset := Point(0, ch); + end; + ctBlock: + begin + cw := FCharWidth; + ch := FTextHeight - 2; + FCaretOffset := Point(0, 0); + end; + ctVerticalLine2: + begin + cw := 2; + ch := FTextHeight + 1; + FCaretOffset := Point(0, 0); + end; + else + begin // ctVerticalLine + cw := 2; + ch := FTextHeight - 2; + FCaretOffset := Point(-1, 0); + end; + end; + Exclude(FStateFlags, sfCaretVisible); + + if Focused or FAlwaysShowCaret then + begin + CreateCaret(Handle, 0, cw, ch); + UpdateCaret; + end; +end; + +procedure TCustomSynEdit.SetInsertCaret(const Value: TSynEditCaretType); +begin + if FInsertCaret <> Value then + begin + FInsertCaret := Value; + InitializeCaret; + end; +end; + +procedure TCustomSynEdit.SetOverwriteCaret(const Value: TSynEditCaretType); +begin + if FOverwriteCaret <> Value then + begin + FOverwriteCaret := Value; + InitializeCaret; + end; +end; + +procedure TCustomSynEdit.SetMaxScrollWidth(Value: Integer); +begin + Value := MinMax(Value, 1, MaxInt - 1); + if MaxScrollWidth <> Value then + begin + FMaxScrollWidth := Value; + if eoScrollPastEol in Options then + UpdateScrollBars; + end; +end; + +procedure TCustomSynEdit.EnsureCursorPosVisible; +begin + EnsureCursorPosVisibleEx(False); +end; + +procedure TCustomSynEdit.EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; + EvenIfVisible: Boolean = False); +var + TmpMiddle: Integer; + VisibleX: Integer; + vCaretRow: Integer; +begin + HandleNeeded; + IncPaintLock; + try + // Make sure X is visible + VisibleX := DisplayX; + if VisibleX < LeftChar then + LeftChar := VisibleX + else if VisibleX >= CharsInWindow + LeftChar then + LeftChar := VisibleX - CharsInWindow + 1 + else + LeftChar := LeftChar; + + // Make sure Y is visible + vCaretRow := DisplayY; + if ForceToMiddle then + begin + if vCaretRow < (TopLine - 1) then + begin + TmpMiddle := LinesInWindow div 2; + if vCaretRow - TmpMiddle < 0 then + TopLine := 1 + else + TopLine := vCaretRow - TmpMiddle + 1; + end + else if vCaretRow > (TopLine + (LinesInWindow - 2)) then + begin + TmpMiddle := LinesInWindow div 2; + TopLine := vCaretRow - (LinesInWindow - 1) + TmpMiddle; + end + { Forces to middle even if visible in viewport } + else if EvenIfVisible then + begin + TmpMiddle := FLinesInWindow div 2; + TopLine := vCaretRow - TmpMiddle + 1; + end; + end + else begin + if vCaretRow < TopLine then + TopLine := vCaretRow + else if vCaretRow > TopLine + Max(1, LinesInWindow) - 1 then + TopLine := vCaretRow - (LinesInWindow - 1) + else + TopLine := TopLine; + end; + finally + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.SetKeystrokes(const Value: TSynEditKeyStrokes); +begin + if Value = nil then + FKeyStrokes.Clear + else + FKeyStrokes.Assign(Value); +end; + +procedure TCustomSynEdit.SetDefaultKeystrokes; +begin + FKeyStrokes.ResetDefaults; +end; + +// If the translations requires Data, memory will be allocated for it via a +// GetMem call. The client must call FreeMem on Data if it is not NIL. + +function TCustomSynEdit.TranslateKeyCode(Code: Word; Shift: TShiftState; + var Data: Pointer): TSynEditorCommand; +var + i: Integer; +{$IFNDEF SYN_COMPILER_3_UP} +const + VK_ACCEPT = $30; +{$ENDIF} +begin + i := KeyStrokes.FindKeycode2(FLastKey, FLastShiftState, Code, Shift); + if i >= 0 then + Result := KeyStrokes[i].Command + else begin + i := Keystrokes.FindKeycode(Code, Shift); + if i >= 0 then + Result := Keystrokes[i].Command + else + Result := ecNone; + end; + if (Result = ecNone) and (Code >= VK_ACCEPT) and (Code <= VK_SCROLL) then + begin + FLastKey := Code; + FLastShiftState := Shift; + end + else + begin + FLastKey := 0; + FLastShiftState := []; + end; +end; + +procedure TCustomSynEdit.CommandProcessor(Command: TSynEditorCommand; + AChar: WideChar; Data: Pointer); +begin + // first the program event handler gets a chance to process the command + DoOnProcessCommand(Command, AChar, Data); + if Command <> ecNone then + begin + // notify hooked command handlers before the command is executed inside of + // the class + NotifyHookedCommandHandlers(False, Command, AChar, Data); + // internal command handler + if (Command <> ecNone) and (Command < ecUserFirst) then + ExecuteCommand(Command, AChar, Data); + // notify hooked command handlers after the command was executed inside of + // the class + if Command <> ecNone then + NotifyHookedCommandHandlers(True, Command, AChar, Data); + end; + DoOnCommandProcessed(Command, AChar, Data); +end; + +procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer); + + procedure SetSelectedTextEmpty; + var + vSelText: UnicodeString; + vUndoBegin, vUndoEnd: TBufferCoord; + begin + vUndoBegin := FBlockBegin; + vUndoEnd := FBlockEnd; + vSelText := SelText; + SetSelTextPrimitive(''); + if (vUndoBegin.Line < vUndoEnd.Line) or ( + (vUndoBegin.Line = vUndoEnd.Line) and (vUndoBegin.Char < vUndoEnd.Char)) then + begin + FUndoList.AddChange(crDelete, vUndoBegin, vUndoEnd, vSelText, + FActiveSelectionMode); + end + else + begin + FUndoList.AddChange(crDeleteAfterCursor, vUndoBegin, vUndoEnd, vSelText, + FActiveSelectionMode); + end; + end; + + procedure ForceCaretX(aCaretX: Integer); + var + vRestoreScroll: Boolean; + begin + vRestoreScroll := not (eoScrollPastEol in FOptions); + Include(FOptions, eoScrollPastEol); + try + InternalCaretX := aCaretX; + finally + if vRestoreScroll then + Exclude(FOptions, eoScrollPastEol); + end; + end; + +var + CX: Integer; + Len: Integer; + Temp: UnicodeString; + Temp2: UnicodeString; + Helper: UnicodeString; + TabBuffer: UnicodeString; + SpaceBuffer: UnicodeString; + SpaceCount1: Integer; + SpaceCount2: Integer; + BackCounter: Integer; + StartOfBlock: TBufferCoord; + EndOfBlock: TBufferCoord; + bChangeScroll: Boolean; + moveBkm: Boolean; + WP: TBufferCoord; + Caret: TBufferCoord; + CaretNew: TBufferCoord; + counter: Integer; + InsDelta: Integer; + iUndoBegin, iUndoEnd: TBufferCoord; + vCaretRow: Integer; + vTabTrim: Integer; + s: UnicodeString; + i: Integer; +begin + IncPaintLock; + try + case Command of +// horizontal caret movement or selection + ecLeft, ecSelLeft: + MoveCaretHorz(-1, Command = ecSelLeft); + ecRight, ecSelRight: + MoveCaretHorz(1, Command = ecSelRight); + ecPageLeft, ecSelPageLeft: + MoveCaretHorz(-CharsInWindow, Command = ecSelPageLeft); + ecPageRight, ecSelPageRight: + MoveCaretHorz(CharsInWindow, Command = ecSelPageRight); + ecLineStart, ecSelLineStart: + begin + DoHomeKey(Command = ecSelLineStart); + end; + ecLineEnd, ecSelLineEnd: + DoEndKey(Command = ecSelLineEnd); +// vertical caret movement or selection + ecUp, ecSelUp: + begin + MoveCaretVert(-1, Command = ecSelUp); + Update; + end; + ecDown, ecSelDown: + begin + MoveCaretVert(1, Command = ecSelDown); + Update; + end; + ecPageUp, ecSelPageUp, ecPageDown, ecSelPageDown: + begin + counter := FLinesInWindow shr Ord(eoHalfPageScroll in FOptions); + if eoScrollByOneLess in FOptions then + Dec(counter); + if (Command in [ecPageUp, ecSelPageUp]) then + counter := -counter; + TopLine := TopLine + counter; + MoveCaretVert(counter, Command in [ecSelPageUp, ecSelPageDown]); + Update; + end; + ecPageTop, ecSelPageTop: + begin + CaretNew := DisplayToBufferPos( + DisplayCoord(DisplayX, TopLine) ); + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageTop); + Update; + end; + ecPageBottom, ecSelPageBottom: + begin + CaretNew := DisplayToBufferPos( + DisplayCoord(DisplayX, TopLine + LinesInWindow -1) ); + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageBottom); + Update; + end; + ecEditorTop, ecSelEditorTop: + begin + CaretNew.Char := 1; + CaretNew.Line := 1; + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorTop); + Update; + end; + ecEditorBottom, ecSelEditorBottom: + begin + CaretNew.Char := 1; + CaretNew.Line := Lines.Count; + if (CaretNew.Line > 0) then + CaretNew.Char := Length(Lines[CaretNew.Line - 1]) + 1; + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorBottom); + Update; + end; +// goto special line / column position + ecGotoXY, ecSelGotoXY: + if Assigned(Data) then + begin + MoveCaretAndSelection(CaretXY, TBufferCoord(Data^), Command = ecSelGotoXY); + Update; + end; +// Word selection + ecWordLeft, ecSelWordLeft: + begin + CaretNew := PrevWordPos; + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordLeft); + end; + ecWordRight, ecSelWordRight: + begin + CaretNew := NextWordPos; + MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordRight); + end; + ecSelWord: + begin + SetSelWord; + end; + ecSelectAll: + begin + SelectAll; + end; + ecDeleteLastChar: + if not ReadOnly then begin + DoOnPaintTransientEx(ttBefore,true); + try + if SelAvail then + SetSelectedTextEmpty + else begin + Temp := LineText; + TabBuffer := TSynEditStringList(Lines).ExpandedStrings[CaretY - 1]; + Len := Length(Temp); + Caret := CaretXY; + vTabTrim := 0; + if CaretX > Len + 1 then + begin + Helper := ''; + if eoSmartTabDelete in FOptions then + begin + //It's at the end of the line, move it to the length + if Len > 0 then + InternalCaretX := Len + 1 + else begin + //move it as if there were normal spaces there + SpaceCount1 := CaretX - 1; + SpaceCount2 := 0; + // unindent + if SpaceCount1 > 0 then + begin + BackCounter := CaretY - 2; + //It's better not to have if statement inside loop + if (eoTrimTrailingSpaces in Options) then + while BackCounter >= 0 do + begin + SpaceCount2 := LeftSpacesEx(Lines[BackCounter], True); + if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); + end + else + while BackCounter >= 0 do + begin + SpaceCount2 := LeftSpaces(Lines[BackCounter]); + if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); + end; + if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then + SpaceCount2 := 0; + end; + if SpaceCount2 = SpaceCount1 then + SpaceCount2 := 0; + FCaretX := FCaretX - (SpaceCount1 - SpaceCount2); + UpdateLastCaretX; + FStateFlags := FStateFlags + [sfCaretChanged]; + StatusChanged([scCaretX]); + end; + end + else begin + // only move caret one column + InternalCaretX := CaretX - 1; + end; + end else if CaretX = 1 then begin + // join this line with the last line if possible + if CaretY > 1 then + begin + InternalCaretY := CaretY - 1; + InternalCaretX := Length(Lines[CaretY - 1]) + 1; + Lines.Delete(CaretY); + DoLinesDeleted(CaretY+1, 1); + if eoTrimTrailingSpaces in Options then + Temp := TrimTrailingSpaces(Temp); + + LineText := LineText + Temp; + Helper := #13#10; + end; + end + else begin + // delete text before the caret + SpaceCount1 := LeftSpaces(Temp); + SpaceCount2 := 0; + if (Temp[CaretX - 1] <= #32) and (SpaceCount1 = CaretX - 1) then + begin + if eoSmartTabDelete in FOptions then + begin + // unindent + if SpaceCount1 > 0 then + begin + BackCounter := CaretY - 2; + //It's better not to have if statement inside loop + if (eoTrimTrailingSpaces in Options) then + while BackCounter >= 0 do + begin + SpaceCount2 := LeftSpacesEx(Lines[BackCounter], True); + if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); + end + else + while BackCounter >= 0 do + begin + SpaceCount2 := LeftSpaces(Lines[BackCounter]); + if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); + end; + if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then + SpaceCount2 := 0; + end; + if SpaceCount2 = SpaceCount1 then + SpaceCount2 := 0; + Helper := Copy(Temp, 1, SpaceCount1 - SpaceCount2); + Delete(Temp, 1, SpaceCount1 - SpaceCount2); + end + else begin + SpaceCount2 := SpaceCount1; + //how much till the next tab column + BackCounter := (DisplayX - 1) mod FTabWidth; + if BackCounter = 0 then BackCounter := FTabWidth; + + SpaceCount1 := 0; + CX := DisplayX - BackCounter; + while (SpaceCount1 < FTabWidth) and + (SpaceCount1 < BackCounter) and + (TabBuffer[CX] <> #9) do + begin + Inc(SpaceCount1); + Inc(CX); + end; + {$IFOPT R+} + // Avoids an exception when compiled with $R+. + // 'CX' can be 'Length(TabBuffer)+1', which isn't an AV and evaluates + //to #0. But when compiled with $R+, Delphi raises an Exception. + if CX <= Length(TabBuffer) then + {$ENDIF} + if TabBuffer[CX] = #9 then + SpaceCount1 := SpaceCount1 + 1; + + if SpaceCount2 = SpaceCount1 then + begin + Helper := Copy(Temp, 1, SpaceCount1); + Delete(Temp, 1, SpaceCount1); + end + else begin + Helper := Copy(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); + Delete(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); + end; + SpaceCount2 := 0; + end; + FCaretX := FCaretX - (SpaceCount1 - SpaceCount2); + UpdateLastCaretX; + // Stores the previous "expanded" CaretX if the line contains tabs. + if (eoTrimTrailingSpaces in Options) and (Len <> Length(TabBuffer)) then + vTabTrim := CharIndex2CaretPos(CaretX, TabWidth, Temp); + ProperSetLine(CaretY - 1, Temp); + FStateFlags := FStateFlags + [sfCaretChanged]; + StatusChanged([scCaretX]); + // Calculates a delta to CaretX to compensate for trimmed tabs. + if vTabTrim <> 0 then + if Length(Temp) <> Length(LineText) then + Dec(vTabTrim, CharIndex2CaretPos(CaretX, TabWidth, LineText)) + else + vTabTrim := 0; + end + else begin + // delete char + counter := 1; + InternalCaretX := CaretX - counter; + // Stores the previous "expanded" CaretX if the line contains tabs. + if (eoTrimTrailingSpaces in Options) and (Len <> Length(TabBuffer)) then + vTabTrim := CharIndex2CaretPos(CaretX, TabWidth, Temp); + Helper := Copy(Temp, CaretX, counter); + Delete(Temp, CaretX, counter); + ProperSetLine(CaretY - 1, Temp); + // Calculates a delta to CaretX to compensate for trimmed tabs. + if vTabTrim <> 0 then + if Length(Temp) <> Length(LineText) then + Dec(vTabTrim, CharIndex2CaretPos(CaretX, TabWidth, LineText)) + else + vTabTrim := 0; + end; + end; + if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then + begin + FUndoList.AddChange(crSilentDelete, CaretXY, Caret, Helper, + smNormal); + if vTabTrim <> 0 then + ForceCaretX(CaretX + vTabTrim); + end; + end; + EnsureCursorPosVisible; + finally + DoOnPaintTransientEx(ttAfter,true); + end; + end; + ecDeleteChar: + if not ReadOnly then begin + DoOnPaintTransient(ttBefore); + + if SelAvail then + SetSelectedTextEmpty + else begin + // Call UpdateLastCaretX. Even though the caret doesn't move, the + // current caret position should "stick" whenever text is modified. + UpdateLastCaretX; + Temp := LineText; + Len := Length(Temp); + if CaretX <= Len then + begin + // delete char + counter := 1; + Helper := Copy(Temp, CaretX, counter); + Caret.Char := CaretX + counter; + Caret.Line := CaretY; + Delete(Temp, CaretX, counter); + ProperSetLine(CaretY - 1, Temp); + end + else begin + // join line with the line after + if CaretY < Lines.Count then + begin + Helper := UnicodeStringOfChar(#32, CaretX - 1 - Len); + ProperSetLine(CaretY - 1, Temp + Helper + Lines[CaretY]); + Caret.Char := 1; + Caret.Line := CaretY + 1; + Helper := #13#10; + Lines.Delete(CaretY); + DoLinesDeleted(CaretY +1, 1); + end; + end; + if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then + begin + FUndoList.AddChange(crSilentDeleteAfterCursor, CaretXY, Caret, + Helper, smNormal); + end; + end; + DoOnPaintTransient(ttAfter); + end; + ecDeleteWord, ecDeleteEOL: + if not ReadOnly then begin + DoOnPaintTransient(ttBefore); + Len := Length(LineText); + if Command = ecDeleteWord then + begin + WP := WordEnd; + Temp := LineText; + if (WP.Char < CaretX) or ((WP.Char = CaretX) and (WP.Line < FLines.Count)) then + begin + if WP.Char > Len then + begin + Inc(WP.Line); + WP.Char := 1; + Temp := Lines[WP.Line - 1]; + end + else if Temp[WP.Char] <> #32 then + Inc(WP.Char); + end; + {$IFOPT R+} + Temp := Temp + #0; + {$ENDIF} + if Temp <> '' then + while Temp[WP.Char] = #32 do + Inc(WP.Char); + end + else begin + WP.Char := Len + 1; + WP.Line := CaretY; + end; + if (WP.Char <> CaretX) or (WP.Line <> CaretY) then + begin + SetBlockBegin(CaretXY); + SetBlockEnd(WP); + ActiveSelectionMode := smNormal; + Helper := SelText; + SetSelTextPrimitive(UnicodeStringOfChar(' ', CaretX - BlockBegin.Char)); + FUndoList.AddChange(crSilentDeleteAfterCursor, CaretXY, WP, + Helper, smNormal); + InternalCaretXY := CaretXY; + end; + end; + ecDeleteLastWord, ecDeleteBOL: + if not ReadOnly then begin + DoOnPaintTransient(ttBefore); + if Command = ecDeleteLastWord then + WP := PrevWordPos + else begin + WP.Char := 1; + WP.Line := CaretY; + end; + if (WP.Char <> CaretX) or (WP.Line <> CaretY) then + begin + SetBlockBegin(CaretXY); + SetBlockEnd(WP); + ActiveSelectionMode := smNormal; + Helper := SelText; + SetSelTextPrimitive(''); + FUndoList.AddChange(crSilentDelete, WP, CaretXY, Helper, + smNormal); + InternalCaretXY := WP; + end; + DoOnPaintTransient(ttAfter); + end; + ecDeleteLine: + if not ReadOnly and (Lines.Count > 0) and not ((CaretY = Lines.Count) and (Length(Lines[CaretY - 1]) = 0)) + then begin + DoOnPaintTransient(ttBefore); + if SelAvail then + SetBlockBegin(CaretXY); + Helper := LineText; + if CaretY = Lines.Count then + begin + Lines[CaretY - 1] := ''; + FUndoList.AddChange(crSilentDeleteAfterCursor, BufferCoord(1, CaretY), + BufferCoord(Length(Helper) + 1, CaretY), Helper, smNormal); + end + else begin + Lines.Delete(CaretY - 1); + Helper := Helper + #13#10; + FUndoList.AddChange(crSilentDeleteAfterCursor, BufferCoord(1, CaretY), + BufferCoord(1, CaretY + 1), Helper, smNormal); + DoLinesDeleted(CaretY, 1); + end; + InternalCaretXY := BufferCoord(1, CaretY); // like seen in the Delphi editor + end; + ecClearAll: + begin + if not ReadOnly then ClearAll; + end; + ecInsertLine, + ecLineBreak: + if not ReadOnly then begin + UndoList.BeginBlock; + try + if SelAvail then + begin + Helper := SelText; + iUndoBegin := FBlockBegin; + iUndoEnd := FBlockEnd; + SetSelTextPrimitive(''); + FUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd, Helper, + FActiveSelectionMode); + end; + Temp := LineText; + Temp2 := Temp; +// This is sloppy, but the Right Thing would be to track the column of markers +// too, so they could be moved depending on whether they are after the caret... + InsDelta := Ord(CaretX = 1); + Len := Length(Temp); + if Len > 0 then + begin + if Len >= CaretX then + begin + if CaretX > 1 then + begin + Temp := Copy(LineText, 1, CaretX - 1); + SpaceCount1 := LeftSpacesEx(Temp,true); + Delete(Temp2, 1, CaretX - 1); + Lines.Insert(CaretY, GetLeftSpacing(SpaceCount1, True) + Temp2); + ProperSetLine(CaretY - 1, Temp); + FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, + smNormal); + if Command = ecLineBreak then + InternalCaretXY := BufferCoord( + Length(GetLeftSpacing(SpaceCount1,true)) + 1, + CaretY + 1); + end + else begin + Lines.Insert(CaretY - 1, ''); + FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, + smNormal); + if Command = ecLineBreak then + InternalCaretY := CaretY + 1; + end; + end + else begin + SpaceCount2 := 0; + BackCounter := CaretY; + if eoAutoIndent in Options then + begin + repeat + Dec(BackCounter); + Temp := Lines[BackCounter]; + SpaceCount2 := LeftSpaces(Temp); + until (BackCounter = 0) or (Temp <> ''); + end; + Lines.Insert(CaretY, ''); + Caret := CaretXY; + + FUndoList.AddChange(crLineBreak, Caret, Caret, '', smNormal); //KV + if Command = ecLineBreak then + begin + InternalCaretXY := BufferCoord(1, CaretY +1); + if SpaceCount2 > 0 then + begin + SpaceBuffer := Copy(Lines[BackCounter], 1, SpaceCount2); + for i := 1 to Length(SpaceBuffer) do + if SpaceBuffer[i] = #9 then + CommandProcessor(ecTab, #0, nil) + else + CommandProcessor(ecChar, SpaceBuffer[i], nil); + end; + end; + end; + end + else begin + if FLines.Count = 0 then + FLines.Add(''); + SpaceCount2 := 0; + if eoAutoIndent in Options then + begin + BackCounter := CaretY - 1; + while BackCounter >= 0 do + begin + SpaceCount2 := LeftSpacesEx(Lines[BackCounter],True); + if Length(Lines[BackCounter]) > 0 then + Break; + Dec(BackCounter); + end; + end; + Lines.Insert(CaretY - 1, ''); + FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, '', smNormal); + if Command = ecLineBreak then + InternalCaretX := SpaceCount2 + 1; + if Command = ecLineBreak then + InternalCaretY := CaretY + 1; + end; + DoLinesInserted(CaretY - InsDelta, 1); + BlockBegin := CaretXY; + BlockEnd := CaretXY; + EnsureCursorPosVisible; + UpdateLastCaretX; + finally + UndoList.EndBlock; + end; + end; + ecTab: + if not ReadOnly then DoTabKey; + ecShiftTab: + if not ReadOnly then DoShiftTabKey; + ecMatchBracket: + FindMatchingBracket; + ecChar: + // #127 is Ctrl + Backspace, #32 is space + if not ReadOnly and (AChar >= #32) and (AChar <> #127) then + begin + if SelAvail then + begin + BeginUndoBlock; + try + Helper := SelText; + iUndoBegin := FBlockBegin; + iUndoEnd := FBlockEnd; + StartOfBlock := BlockBegin; + if FActiveSelectionMode = smLine then + StartOfBlock.Char := 1; + FUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd, Helper, + FActiveSelectionMode); + SetSelTextPrimitive(AChar); + if FActiveSelectionMode <> smColumn then + begin + FUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, '', + smNormal); + end; + finally + EndUndoBlock; + end; + end + else + begin + SpaceCount2 := 0; + Temp := LineText; + Len := Length(Temp); + if Len < CaretX then + begin + if (Len > 0) then + SpaceBuffer := UnicodeStringOfChar(#32, CaretX - Len - Ord(FInserting)) + else + SpaceBuffer := GetLeftSpacing(CaretX - Len - Ord(FInserting), True); + SpaceCount2 := Length(SpaceBuffer); + + Temp := Temp + SpaceBuffer; + end; + // Added the check for whether or not we're in insert mode. + // If we are, we append one less space than we would in overwrite mode. + // This is because in overwrite mode we have to put in a final space + // character which will be overwritten with the typed character. If we put the + // extra space in in insert mode, it would be left at the end of the line and + // cause problems unless eoTrimTrailingSpaces is set. + bChangeScroll := not (eoScrollPastEol in FOptions); + try + if bChangeScroll then Include(FOptions, eoScrollPastEol); + StartOfBlock := CaretXY; + + if FInserting then + begin + if not WordWrap and not (eoAutoSizeMaxScrollWidth in Options) + and (CaretX > MaxScrollWidth) then + begin + Exit; + end; + Insert(AChar, Temp, CaretX); + if (eoTrimTrailingSpaces in Options) and ((AChar = #9) or (AChar = #32)) and (Length(TrimTrailingSpaces(LineText)) = 0) then + InternalCaretX := GetExpandedLength(Temp, TabWidth) + 1 + else + begin + if Len = 0 then + InternalCaretX := Length(Temp) + 1 + else + InternalCaretX := CaretX + 1; + end; + ProperSetLine(CaretY - 1, Temp); + if SpaceCount2 > 0 then + begin + BeginUndoBlock; + try + //if we inserted spaces with this char, we need to account for those + //in the X Position + StartOfBlock.Char := StartOfBlock.Char - SpaceCount2; + EndOfBlock := CaretXY; + EndOfBlock.Char := EndOfBlock.Char - 1; + //The added whitespace + FUndoList.AddChange(crWhiteSpaceAdd, EndOfBlock, StartOfBlock, '', + smNormal); + StartOfBlock.Char := StartOfBlock.Char + SpaceCount2; + + FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', + smNormal); + finally + EndUndoBlock; + end; + end + else begin + FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', + smNormal); + end; + end + else begin +// Processing of case character covers on LeadByte. + counter := 1; + Helper := Copy(Temp, CaretX, counter); + Temp[CaretX] := AChar; + CaretNew.Char := CaretX + counter; + CaretNew.Line := CaretY; + ProperSetLine(CaretY - 1, Temp); + FUndoList.AddChange(crInsert, StartOfBlock, CaretNew, Helper, + smNormal); + InternalCaretX := CaretX + 1; + end; + if CaretX >= LeftChar + FCharsInWindow then + LeftChar := LeftChar + Min(25, FCharsInWindow - 1); + finally + if bChangeScroll then Exclude(FOptions, eoScrollPastEol); + end; + end; + DoOnPaintTransient(ttAfter); + end; + ecUpperCase, + ecLowerCase, + ecToggleCase, + ecTitleCase, + ecUpperCaseBlock, + ecLowerCaseBlock, + ecToggleCaseBlock, + ecTitleCaseBlock: + if not ReadOnly then DoCaseChange(Command); + ecUndo: + begin + if not ReadOnly then Undo; + end; + ecRedo: + begin + if not ReadOnly then Redo; + end; + ecGotoMarker0..ecGotoMarker9: + begin + if BookMarkOptions.EnableKeys then + GotoBookMark(Command - ecGotoMarker0); + end; + ecSetMarker0..ecSetMarker9: + begin + if BookMarkOptions.EnableKeys then + begin + CX := Command - ecSetMarker0; + if Assigned(Data) then + Caret := TBufferCoord(Data^) + else + Caret := CaretXY; + if assigned(FBookMarks[CX]) then + begin + moveBkm := (FBookMarks[CX].Line <> Caret.Line); + ClearBookMark(CX); + if moveBkm then + SetBookMark(CX, Caret.Char, Caret.Line); + end + else + SetBookMark(CX, Caret.Char, Caret.Line); + end; // if BookMarkOptions.EnableKeys + end; + ecCut: + begin + if (not ReadOnly) and SelAvail then + CutToClipboard; + end; + ecCopy: + begin + CopyToClipboard; + end; + ecPaste: + begin + if not ReadOnly then PasteFromClipboard; + end; + ecScrollUp, ecScrollDown: + begin + vCaretRow := DisplayY; + if (vCaretRow < TopLine) or (vCaretRow >= TopLine + LinesInWindow) then + // If the caret is not in view then, like the Delphi editor, move + // it in view and do nothing else + EnsureCursorPosVisible + else begin + if Command = ecScrollUp then + begin + TopLine := TopLine - 1; + if vCaretRow > TopLine + LinesInWindow - 1 then + MoveCaretVert((TopLine + LinesInWindow - 1) - vCaretRow, False); + end + else begin + TopLine := TopLine + 1; + if vCaretRow < TopLine then + MoveCaretVert(TopLine - vCaretRow, False); + end; + EnsureCursorPosVisible; + Update; + end; + end; + ecScrollLeft: + begin + LeftChar := LeftChar - 1; + // todo: The following code was commented out because it is not MBCS or hard-tab safe. + //if CaretX > LeftChar + CharsInWindow then + // InternalCaretX := LeftChar + CharsInWindow; + Update; + end; + ecScrollRight: + begin + LeftChar := LeftChar + 1; + // todo: The following code was commented out because it is not MBCS or hard-tab safe. + //if CaretX < LeftChar then + // InternalCaretX := LeftChar; + Update; + end; + ecInsertMode: + begin + InsertMode := True; + end; + ecOverwriteMode: + begin + InsertMode := False; + end; + ecToggleMode: + begin + InsertMode := not InsertMode; + end; + ecBlockIndent: + if not ReadOnly then DoBlockIndent; + ecBlockUnindent: + if not ReadOnly then DoBlockUnindent; + ecNormalSelect: + SelectionMode := smNormal; + ecColumnSelect: + SelectionMode := smColumn; + ecLineSelect: + SelectionMode := smLine; + ecContextHelp: + begin + if Assigned (FOnContextHelp) then + FOnContextHelp (self,WordAtCursor); + end; + ecImeStr: + if not ReadOnly then + begin + SetString(S, PWideChar(Data), WStrLen(Data)); + if SelAvail then + begin + BeginUndoBlock; + try + FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, + smNormal); + StartOfBlock := BlockBegin; + EndOfBlock.Line := BlockBegin.Line; + EndOfBlock.Char := BlockBegin.Char + Length(s); + SetSelTextPrimitive(s); + FUndoList.AddChange(crInsert, StartOfBlock, EndOfBlock, '', + smNormal); + finally + EndUndoBlock; + end; + InvalidateGutterLines(-1, -1); + end + else + begin + Temp := LineText; + Len := Length(Temp); + if Len < CaretX then + Temp := Temp + UnicodeStringOfChar(#32, CaretX - Len - 1); + bChangeScroll := not (eoScrollPastEol in FOptions); + try + if bChangeScroll then Include(FOptions, eoScrollPastEol); + StartOfBlock := CaretXY; + Len := Length(s); + if not FInserting then + begin + Helper := Copy(Temp, CaretX, Len); + Delete(Temp, CaretX, Len); + end; + Insert(s, Temp, CaretX); + InternalCaretX := (CaretX + Len); + ProperSetLine(CaretY - 1, Temp); + if FInserting then + Helper := ''; + FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, Helper, + smNormal); + if CaretX >= LeftChar + FCharsInWindow then + LeftChar := LeftChar + min(25, FCharsInWindow - 1); + finally + if bChangeScroll then Exclude(FOptions, eoScrollPastEol); + end; + end; + end; +{$IFDEF SYN_CodeFolding} + ecFoldAll: begin CollapseAll; end; + ecUnfoldAll: begin UncollapseAll; end; + ecFoldNearest: begin CollapseNearest; end; + ecUnfoldNearest: begin UncollapseNearest; end; + ecFoldLevel1: begin CollapseLevel(1); end; + ecFoldLevel2: begin CollapseLevel(2); end; + ecFoldLevel3: begin CollapseLevel(3); end; + ecUnfoldLevel1: begin UncollapseLevel(1); end; + ecUnfoldLevel2: begin UncollapseLevel(2); end; + ecUnfoldLevel3: begin UncollapseLevel(3); end; + ecFoldRegions: begin CollapseFoldType(FoldRegionType) end; + ecUnfoldRegions: begin UnCollapseFoldType(FoldRegionType) end; +{$ENDIF} + end; + finally + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.DoOnCommandProcessed(Command: TSynEditorCommand; + AChar: WideChar; Data: Pointer); +begin + if Assigned(FOnCommandProcessed) then + FOnCommandProcessed(Self, Command, AChar, Data); +end; + +procedure TCustomSynEdit.DoOnProcessCommand(var Command: TSynEditorCommand; + var AChar: WideChar; Data: Pointer); +begin + if Command < ecUserFirst then + begin + if Assigned(FOnProcessCommand) then + FOnProcessCommand(Self, Command, AChar, Data); + end + else begin + if Assigned(FOnProcessUserCommand) then + FOnProcessUserCommand(Self, Command, AChar, Data); + end; +end; + +procedure TCustomSynEdit.ClearAll; +begin + Lines.Clear; + FMarkList.Clear; // FMarkList.Clear also frees all bookmarks, + FillChar(FBookMarks, sizeof(FBookMarks), 0); // so FBookMarks should be cleared too + FUndoList.Clear; + FRedoList.Clear; + Modified := False; +end; + +procedure TCustomSynEdit.ClearSelection; +begin + if SelAvail then + SelText := ''; +end; + +function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): TBufferCoord; +var + CX, CY, LineLen: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + + // valid line? + if (CY >= 1) and (CY <= Lines.Count) then + begin + Line := Lines[CY - 1]; + + LineLen := Length(Line); + if CX >= LineLen then + begin + // find first IdentChar or multibyte char in the next line + if CY < Lines.Count then + begin + Line := Lines[CY]; + Inc(CY); + CX := StrScanForCharInCategory(Line, 1, IsIdentChar); + if CX = 0 then + Inc(CX); + end; + end + else + begin + // find next Word-break-char if current char is an IdentChar + if IsIdentChar(Line[CX]) then + CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); + // if Word-break-char found, find the next IdentChar + if CX > 0 then + CX := StrScanForCharInCategory(Line, CX, IsIdentChar); + // if one of those failed just position at the end of the line + if CX = 0 then + CX := LineLen + 1; + end; + end; + Result.Char := CX; + Result.Line := CY; +end; + +function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBufferCoord; +var + CX, CY: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + // valid line? + if (CY >= 1) and (CY <= Lines.Count) then + begin + Line := Lines[CY - 1]; + CX := Min(CX, Length(Line) + 1); + + if CX > 1 then + begin // only find previous char, if not already on start of line + // if previous char isn't a word-break-char search for the last IdentChar + if not IsWordBreakChar(Line[CX - 1]) then + CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; + end; + end; + Result.Char := CX; + Result.Line := CY; +end; + +function TCustomSynEdit.WordEndEx(const XY: TBufferCoord): TBufferCoord; +var + CX, CY: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + // valid line? + if (CY >= 1) and (CY <= Lines.Count) then + begin + Line := Lines[CY - 1]; + + CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); + // if no Word-break-char is found just position at the end of the line + if CX = 0 then + CX := Length(Line) + 1; + end; + Result.Char := CX; + Result.Line := CY; +end; + +function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; +var + CX, CY: Integer; + Line: UnicodeString; +begin + CX := XY.Char; + CY := XY.Line; + // valid line? + if (CY >= 1) and (CY <= Lines.Count) then + begin + Line := Lines[CY - 1]; + CX := Min(CX, Length(Line) + 1); + + if CX <= 1 then + begin + // find last IdentChar in the previous line + if CY > 1 then + begin + Dec(CY); + Line := Lines[CY - 1]; + CX := Length(Line) + 1; + end; + end + else + begin + // if previous char is a Word-break-char search for the last IdentChar + if IsWordBreakChar(Line[CX - 1]) then + CX := StrRScanForCharInCategory(Line, CX - 1, IsIdentChar); + if CX > 0 then + // search for the first IdentChar of this "word" + CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; + if CX = 0 then + begin + // else just position at the end of the previous line + if CY > 1 then + begin + Dec(CY); + Line := Lines[CY - 1]; + CX := Length(Line) + 1; + end + else + CX := 1; + end; + end; + end; + Result.Char := CX; + Result.Line := CY; +end; + +procedure TCustomSynEdit.SetSelectionMode(const Value: TSynSelectionMode); +begin + if FSelectionMode <> Value then + begin + FSelectionMode := Value; + ActiveSelectionMode := Value; + end; +end; + +procedure TCustomSynEdit.SetActiveSelectionMode(const Value: TSynSelectionMode); +begin + if FActiveSelectionMode <> Value then + begin + if SelAvail then + InvalidateSelection; + FActiveSelectionMode := Value; + if SelAvail then + InvalidateSelection; + StatusChanged([scSelection]); + end; +end; + +procedure TCustomSynEdit.SetAdditionalIdentChars(const Value: TSysCharSet); +begin + FAdditionalIdentChars := Value; +end; + +procedure TCustomSynEdit.SetAdditionalWordBreakChars(const Value: TSysCharSet); +begin + FAdditionalWordBreakChars := Value; +end; + +procedure TCustomSynEdit.BeginUndoBlock; +begin + FUndoList.BeginBlock; +end; + +procedure TCustomSynEdit.BeginUpdate; +begin + IncPaintLock; +end; + +procedure TCustomSynEdit.EndUndoBlock; +begin + FUndoList.EndBlock; +end; + +procedure TCustomSynEdit.EndUpdate; +begin + DecPaintLock; +end; + +procedure TCustomSynEdit.AddKey(Command: TSynEditorCommand; + Key1: Word; SS1: TShiftState; Key2: Word; SS2: TShiftState); +var + Key: TSynEditKeyStroke; +begin + Key := Keystrokes.Add; + Key.Command := Command; + Key.Key := Key1; + Key.Shift := SS1; + Key.Key2 := Key2; + Key.Shift2 := SS2; +end; + +{ Called by FMarkList if change } +procedure TCustomSynEdit.MarkListChange(Sender: TObject); +begin + InvalidateGutter; +end; + +procedure TCustomSynEdit.MarkModifiedLinesAsSaved; +begin + TSynEditStringList(FLines).MarkModifiedLinesAsSaved; + if FGutter.ShowModification then + InvalidateGutter; +end; + +function TCustomSynEdit.GetSelStart: Integer; +begin + if GetSelAvail then + Result := RowColToCharIndex(BlockBegin) + else + Result := RowColToCharIndex(CaretXY); +end; + +procedure TCustomSynEdit.SetAlwaysShowCaret(const Value: Boolean); +begin + if FAlwaysShowCaret <> Value then + begin + FAlwaysShowCaret := Value; + if not(csDestroying in ComponentState) and not(focused) then + begin + if Value then + begin + InitializeCaret; + end + else + begin + HideCaret; + Windows.DestroyCaret; + end; + end; + end; +end; + +procedure TCustomSynEdit.SetSelStart(const Value: Integer); +begin + { if we don't call HandleNeeded, CharsInWindow may be 0 and LeftChar will + be set to CaretX } + HandleNeeded; + InternalCaretXY := CharIndexToRowCol(Value); + BlockBegin := CaretXY; +end; + +function TCustomSynEdit.GetSelEnd: Integer; +begin + if GetSelAvail then + Result := RowColToCharIndex(Blockend) + else + Result := RowColToCharIndex(CaretXY); +end; + +procedure TCustomSynEdit.SetSelEnd(const Value: Integer); +begin + HandleNeeded; + BlockEnd := CharIndexToRowCol( Value ); +end; + +procedure TCustomSynEdit.SetSelWord; +begin + SetWordBlock(CaretXY); +end; + +procedure TCustomSynEdit.SetExtraLineSpacing(const Value: Integer); +begin + FExtraLineSpacing := Value; + SynFontChanged(self); +end; + +function TCustomSynEdit.GetBookMark(BookMark: Integer; var X, Y: Integer): + Boolean; +var + i: Integer; +begin + Result := False; + if assigned(Marks) then + for i := 0 to Marks.Count - 1 do + if Marks[i].IsBookmark and (Marks[i].BookmarkNumber = BookMark) then + begin + X := Marks[i].Char; + Y := Marks[i].Line; + Result := True; + Exit; + end; +end; + +function TCustomSynEdit.IsBookmark(BookMark: Integer): Boolean; +var + x, y: Integer; +begin + Result := GetBookMark(BookMark, x, y); +end; + +procedure TCustomSynEdit.ClearUndo; +begin + FUndoList.Clear; + FRedoList.Clear; +end; + +procedure TCustomSynEdit.SetSelTextExternal(const Value: UnicodeString); +var + StartOfBlock, EndOfBlock: TBufferCoord; +begin + BeginUndoBlock; + try + if SelAvail then + begin + FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, + SelText, FActiveSelectionMode); + end + else + ActiveSelectionMode := SelectionMode; + StartOfBlock := BlockBegin; + EndOfBlock := BlockEnd; + FBlockBegin := StartOfBlock; + FBlockEnd := EndOfBlock; + SetSelTextPrimitive(Value); + if (Value <> '') and (FActiveSelectionMode <> smColumn) then + FUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, '', FActiveSelectionMode); + finally + EndUndoBlock; + end; +end; + +procedure TCustomSynEdit.SetGutter(const Value: TSynGutter); +begin + FGutter.Assign(Value); +end; + +procedure TCustomSynEdit.GutterChanged(Sender: TObject); +var + nW: Integer; +begin + if not (csLoading in ComponentState) then + begin + if FGutter.ShowLineNumbers and FGutter.AutoSize then + FGutter.AutoSizeDigitCount(Lines.Count); + if FGutter.UseFontStyle then + begin + FTextDrawer.SetBaseFont(FGutter.Font); + nW := FGutter.RealGutterWidth(FTextDrawer.CharWidth); + FTextDrawer.SetBaseFont(Font); + end + else + nW := FGutter.RealGutterWidth(FCharWidth); + if nW = FGutterWidth then + InvalidateGutter + else + SetGutterWidth(nW); + end; +end; + +procedure TCustomSynEdit.LockUndo; +begin + FUndoList.Lock; + FRedoList.Lock; +end; + +procedure TCustomSynEdit.UnlockUndo; +begin + FUndoList.Unlock; + FRedoList.Unlock; +end; + +function TCustomSynEdit.UnifiedSelection: TBufferBlock; +begin + if BlockBegin.Line > BlockEnd.Line then begin + Result.BeginLine := BlockEnd.Line; + Result.EndLine := BlockBegin.Line; + end else begin + Result.BeginLine := BlockBegin.Line; + Result.EndLine := BlockEnd.Line; + end; + if BlockBegin.Char > BlockEnd.Char then begin + Result.BeginChar := BlockEnd.Char; + Result.EndChar := BlockBegin.Char; + end else begin + Result.BeginChar := BlockBegin.Char; + Result.EndChar := BlockEnd.Char; + end; +end; + + +{$IFNDEF SYN_COMPILER_6_UP} +procedure TCustomSynEdit.WMMouseWheel(var Msg: TMessage); +var + nDelta: Integer; + nWheelClicks: Integer; +{$IFNDEF SYN_COMPILER_4_UP} +const + LinesToScroll = 3; + WHEEL_DELTA = 120; + WHEEL_PAGESCROLL = MAXDWORD; + SPI_GETWHEELSCROLLLINES = 104; +{$ENDIF} +begin + if csDesigning in ComponentState then + Exit; + + Msg.Result := 1; + +{$IFDEF SYN_COMPILER_4_UP} + // In some occasions Windows will not properly initialize mouse wheel, but + // will still keep sending WM_MOUSEWHEEL message. Calling inherited procedure + // will re-initialize related properties (i.e. Mouse.WheelScrollLines) + inherited; +{$ENDIF} + + if GetKeyState(VK_CONTROL) >= 0 then + begin +{$IFDEF SYN_COMPILER_4_UP} + nDelta := Mouse.WheelScrollLines +{$ELSE} + if not SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @nDelta, 0) then + nDelta := LinesToScroll; +{$ENDIF} + end + else + nDelta := LinesInWindow shr Ord(eoHalfPageScroll in FOptions); + + Inc(FMouseWheelAccumulator, SmallInt(Msg.wParamHi)); + nWheelClicks := FMouseWheelAccumulator div WHEEL_DELTA; + FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DELTA; + if (nDelta = Integer(WHEEL_PAGESCROLL)) or (nDelta > LinesInWindow) then + nDelta := LinesInWindow; + TopLine := TopLine - (nDelta * nWheelClicks); + Update; + if Assigned(OnScroll) then OnScroll(Self,sbVertical); +end; +{$ENDIF} + +procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor); +begin + if (Msg.HitTest = HTCLIENT) and (Msg.CursorWnd = Handle) and + not(csDesigning in ComponentState) then + begin + UpdateMouseCursor; + end + else + inherited; +end; + +procedure TCustomSynEdit.SetTabWidth(Value: Integer); +begin + Value := MinMax(Value, 1, 256); + if (Value <> FTabWidth) then begin + FTabWidth := Value; + TSynEditStringList(Lines).TabWidth := Value; + Invalidate; // to redraw text containing tab chars + if WordWrap then + begin + FWordWrapPlugin.Reset; + InvalidateGutter; + end; + end; +end; + +procedure TCustomSynEdit.SelectedColorsChanged(Sender: TObject); +begin + InvalidateSelection; +end; + +// find / replace + +function TCustomSynEdit.SearchReplace(const ASearch, AReplace: UnicodeString; + AOptions: TSynSearchOptions): Integer; +var + ptStart, ptEnd: TBufferCoord; // start and end of the search range + ptCurrent: TBufferCoord; // current search position + nSearchLen, nReplaceLen, n, nFound: Integer; + nInLine: Integer; + bBackward, bFromCursor: Boolean; + bPrompt: Boolean; + bReplace, bReplaceAll: Boolean; + bEndUndoBlock: Boolean; + nAction: TSynReplaceAction; + iResultOffset: Integer; + + function InValidSearchRange(First, Last: Integer): Boolean; + begin + Result := True; + if (FActiveSelectionMode = smNormal) or not (ssoSelectedOnly in AOptions) then + begin + if ((ptCurrent.Line = ptStart.Line) and (First < ptStart.Char)) or + ((ptCurrent.Line = ptEnd.Line) and (Last > ptEnd.Char)) + then + Result := False; + end + else + if (FActiveSelectionMode = smColumn) then + // solves bug in search/replace when smColumn mode active and no selection + Result := (First >= ptStart.Char) and (Last <= ptEnd.Char) or (ptEnd.Char - ptStart.Char < 1); + end; + +begin + if not Assigned(FSearchEngine) then + raise ESynEditError.Create('No search engine has been assigned'); + + Result := 0; + // can't search for or replace an empty string + if Length(ASearch) = 0 then Exit; + // get the text range to search in, ignore the "Search in selection only" + // option if nothing is selected + bBackward := (ssoBackwards in AOptions); + bPrompt := (ssoPrompt in AOptions); + bReplace := (ssoReplace in AOptions); + bReplaceAll := (ssoReplaceAll in AOptions); + bFromCursor := not (ssoEntireScope in AOptions); + if not SelAvail then Exclude(AOptions, ssoSelectedOnly); + if (ssoSelectedOnly in AOptions) then begin + ptStart := BlockBegin; + ptEnd := BlockEnd; + // search the whole line in the line selection mode + if (FActiveSelectionMode = smLine) then + begin + ptStart.Char := 1; + ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; + end + else if (FActiveSelectionMode = smColumn) then + // make sure the start column is smaller than the end column + if (ptStart.Char > ptEnd.Char) then + SwapInt(Integer(ptStart.Char), Integer(ptEnd.Char)); + // ignore the cursor position when searching in the selection + if bBackward then + ptCurrent := ptEnd + else + ptCurrent := ptStart; + end + else + begin + ptStart.Char := 1; + ptStart.Line := 1; + ptEnd.Line := Lines.Count; + ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; + if bFromCursor then + if bBackward then ptEnd := CaretXY else ptStart := CaretXY; + if bBackward then ptCurrent := ptEnd else ptCurrent := ptStart; + end; + // initialize the search engine + FSearchEngine.Options := AOptions; + FSearchEngine.Pattern := ASearch; + // search while the current search position is inside of the search range + nReplaceLen := 0; + DoOnPaintTransient(ttBefore); + if bReplaceAll and not bPrompt then + begin + IncPaintLock; + BeginUndoBlock; + bEndUndoBlock := True; + end + else + bEndUndoBlock := False; + Inc(FPaintTransientLock); + try + while (ptCurrent.Line >= ptStart.Line) and (ptCurrent.Line <= ptEnd.Line) do + begin + nInLine := FSearchEngine.FindAll(Lines[ptCurrent.Line - 1]); + iResultOffset := 0; + if bBackward then + n := Pred(FSearchEngine.ResultCount) + else + n := 0; + // Operate on all results in this line. + while nInLine > 0 do + begin + // An occurrence may have been replaced with a text of different length + nFound := FSearchEngine.Results[n] + iResultOffset; + nSearchLen := FSearchEngine.Lengths[n]; + if bBackward then Dec(n) else Inc(n); + Dec(nInLine); + // Is the search result entirely in the search range? + if not InValidSearchRange(nFound, nFound + nSearchLen) then continue; + Inc(Result); + // Select the text, so the user can see it in the OnReplaceText event + // handler or as the search result. + + ptCurrent.Char := nFound; + BlockBegin := ptCurrent; + // Be sure to use the Ex version of CursorPos so that it appears in the middle if necessary + SetCaretXYEx(False, BufferCoord(1, ptCurrent.Line)); + EnsureCursorPosVisibleEx(True); + Inc(ptCurrent.Char, nSearchLen); + BlockEnd := ptCurrent; + InternalCaretXY := ptCurrent; + if bBackward then InternalCaretXY := BlockBegin else InternalCaretXY := ptCurrent; + // If it's a search only we can leave the procedure now. + if not (bReplace or bReplaceAll) then Exit; + // Prompt and replace or replace all. If user chooses to replace + // all after prompting, turn off prompting. + if bPrompt and Assigned(FOnReplaceText) then + begin + nAction := DoOnReplaceText(ASearch, AReplace, ptCurrent.Line, nFound); + if nAction = raCancel then + Exit; + end + else + nAction := raReplace; + if nAction = raSkip then + Dec(Result) + else begin + // user has been prompted and has requested to silently replace all + // so turn off prompting + if nAction = raReplaceAll then begin + if not bReplaceAll or bPrompt then + begin + bReplaceAll := True; + IncPaintLock; + end; + bPrompt := False; + if bEndUndoBlock = False then + BeginUndoBlock; + bEndUndoBlock := true; + end; + // Allow advanced substition in the search engine + SelText := FSearchEngine.Replace(SelText, AReplace); + nReplaceLen := CaretX - nFound; + end; + // fix the caret position and the remaining results + if not bBackward then begin + InternalCaretX := nFound + nReplaceLen; + if (nSearchLen <> nReplaceLen) and (nAction <> raSkip) then + begin + Inc(iResultOffset, nReplaceLen - nSearchLen); + if (FActiveSelectionMode <> smColumn) and (CaretY = ptEnd.Line) then + begin + Inc(ptEnd.Char, nReplaceLen - nSearchLen); + BlockEnd := ptEnd; + end; + end; + end; + if not bReplaceAll then + Exit; + end; + // search next / previous line + if bBackward then + Dec(ptCurrent.Line) + else + Inc(ptCurrent.Line); + end; + finally + if bReplaceAll and not bPrompt then DecPaintLock; + if bEndUndoBlock then EndUndoBlock; + Dec(FPaintTransientLock); + DoOnPaintTransient( ttAfter ); + end; +end; + +function TCustomSynEdit.IsPointInSelection(const Value: TBufferCoord): Boolean; +var + ptBegin, ptEnd: TBufferCoord; +begin + ptBegin := BlockBegin; + ptEnd := BlockEnd; + if (Value.Line >= ptBegin.Line) and (Value.Line <= ptEnd.Line) and + ((ptBegin.Line <> ptEnd.Line) or (ptBegin.Char <> ptEnd.Char)) then + begin + if FActiveSelectionMode = smLine then + Result := True + else if (FActiveSelectionMode = smColumn) then + begin + if (ptBegin.Char > ptEnd.Char) then + Result := (Value.Char >= ptEnd.Char) and (Value.Char < ptBegin.Char) + else if (ptBegin.Char < ptEnd.Char) then + Result := (Value.Char >= ptBegin.Char) and (Value.Char < ptEnd.Char) + else + Result := False; + end + else + Result := ((Value.Line > ptBegin.Line) or (Value.Char >= ptBegin.Char)) and + ((Value.Line < ptEnd.Line) or (Value.Char < ptEnd.Char)); + end + else + Result := False; +end; + +procedure TCustomSynEdit.SetFocus; +begin + if (FFocusList.Count > 0) then + begin + if TWinControl (FFocusList.Last).CanFocus then + TWinControl (FFocusList.Last).SetFocus; + Exit; + end; + inherited; +end; + +procedure TCustomSynEdit.UpdateMouseCursor; + +var + ptCursor: TPoint; + ptLineCol: TBufferCoord; + iNewCursor: TCursor; +{$IFDEF SYN_CodeFolding} + ptRowCol: TDisplayCoord; + Rect: TRect; +{$ENDIF} +begin + GetCursorPos(ptCursor); + ptCursor := ScreenToClient(ptCursor); +{$IFDEF SYN_CodeFolding} + ptRowCol := PixelsToRowColumn(ptCursor.X, ptCursor.Y); + ptLineCol := DisplayToBufferPos(ptRowCol); + if (ptCursor.X < fGutterWidth) then begin + if UseCodeFolding and + fAllFoldRanges.FoldStartAtLine(ptLineCol.Line) then + begin + Rect := GetFoldShapeRect(ptRowCol.Row); + if PtInRect(Rect, ptCursor) then + SetCursor(Screen.Cursors[crHandPoint]) + else + SetCursor(Screen.Cursors[fGutter.Cursor]); + end else + SetCursor(Screen.Cursors[fGutter.Cursor]) + end else begin + if (eoDragDropEditing in fOptions) and (not MouseCapture) and IsPointInSelection(ptLineCol) then + iNewCursor := crArrow + else if UseCodeFolding and CodeFolding.ShowHintMark and + fAllFoldRanges.CollapsedFoldStartAtLine(ptLineCol.Line) then + begin + Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); + if PtInRect(Rect, ptCursor) then + iNewCursor := crHandPoint; + end else +{$ELSE} + if (ptCursor.X < FGutterWidth) then + SetCursor(Screen.Cursors[FGutter.Cursor]) + else begin + ptLineCol := DisplayToBufferPos(PixelsToRowColumn(ptCursor.X, ptCursor.Y)); + if (eoDragDropEditing in FOptions) and (not MouseCapture) and not (sfMouseCaptured in FStateFlags) and IsPointInSelection(ptLineCol) then + iNewCursor := crArrow + else +{$ENDIF} + iNewCursor := Cursor; + if Assigned(OnMouseCursor) then + OnMouseCursor(Self, ptLineCol, iNewCursor); + FKbdHandler.ExecuteMouseCursor(Self, ptLineCol, iNewCursor); + SetCursor(Screen.Cursors[iNewCursor]); + end; +end; + +procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject); +begin + InvalidateGutter; +end; + +function TCustomSynEdit.GetOptions: TSynEditorOptions; +begin + Result := FOptions; +end; + +procedure TCustomSynEdit.SetOptions(Value: TSynEditorOptions); +const + ScrollOptions = [eoDisableScrollArrows,eoHideShowScrollbars, + eoScrollPastEof,eoScrollPastEol]; +var + bSetDrag: Boolean; + TmpBool: Boolean; + bUpdateScroll: Boolean; + vTempBlockBegin, vTempBlockEnd : TBufferCoord; +begin + if (Value <> FOptions) then + begin + bSetDrag := (eoDropFiles in FOptions) <> (eoDropFiles in Value); + + if not (eoScrollPastEol in Options) then + LeftChar := LeftChar; + if not (eoScrollPastEof in Options) then + TopLine := TopLine; + + bUpdateScroll := (Options * ScrollOptions) <> (Value * ScrollOptions); + + FOptions := Value; + + // constrain caret position to MaxScrollWidth if eoScrollPastEol is enabled + InternalCaretXY := CaretXY; + if (eoScrollPastEol in Options) then + begin + vTempBlockBegin := BlockBegin; + vTempBlockEnd := BlockEnd; + SetBlockBegin(vTempBlockBegin); + SetBlockEnd(vTempBlockEnd); + end; + + // (un)register HWND as drop target + if bSetDrag and not (csDesigning in ComponentState) and HandleAllocated then + DragAcceptFiles(Handle, (eoDropFiles in FOptions)); + + TmpBool := eoShowSpecialChars in Value; + if TmpBool <> FShowSpecChar then + begin + FShowSpecChar := TmpBool; + Invalidate; + end; + if bUpdateScroll then + UpdateScrollBars; + end; +end; + +procedure TCustomSynEdit.SizeOrFontChanged(bFont: Boolean); +begin + if HandleAllocated and (FCharWidth <> 0) then + begin + FCharsInWindow := Max(ClientWidth - FGutterWidth - 2, 0) div FCharWidth; + FLinesInWindow := ClientHeight div FTextHeight; + if WordWrap then + begin + FWordWrapPlugin.DisplayChanged; + Invalidate; + end; + if bFont then + begin + if Gutter.ShowLineNumbers then + GutterChanged(Self) + else + UpdateScrollbars; + InitializeCaret; + Exclude(FStateFlags, sfCaretChanged); + Invalidate; + end + else + UpdateScrollbars; + Exclude(FStateFlags, sfScrollbarChanged); + if not (eoScrollPastEol in Options) then + LeftChar := LeftChar; + if not (eoScrollPastEof in Options) then + TopLine := TopLine; + end; +end; + +procedure TCustomSynEdit.MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); +var + ptO, ptDst: TBufferCoord; + s: UnicodeString; + nLineLen: Integer; + bChangeY: Boolean; + vCaretRowCol: TDisplayCoord; +begin + if WordWrap then + begin + if DX > 0 then + begin + if FCaretAtEOL then + begin + FCaretAtEOL := False; + UpdateLastCaretX; + IncPaintLock; + Include(FStateFlags, sfCaretChanged); + DecPaintLock; + Exit; + end; + end + else + begin // DX < 0. Handle ecLeft/ecPageLeft at BOL. + if (not FCaretAtEOL) and (CaretX > 1) and (DisplayX = 1) then + begin + FCaretAtEOL := True; + UpdateLastCaretX; + if DisplayX > CharsInWindow +1 then + SetInternalDisplayXY( DisplayCoord(CharsInWindow +1, DisplayY) ) + else begin + IncPaintLock; + Include(FStateFlags, sfCaretChanged); + DecPaintLock; + end; + Exit; + end; + end; + end; + ptO := CaretXY; + ptDst := ptO; + s := LineText; + nLineLen := Length(s); + // only moving or selecting one char can change the line + bChangeY := not (eoScrollPastEol in FOptions); + if bChangeY and (DX = -1) and (ptO.Char = 1) and (ptO.Line > 1) then + begin + // end of previous line + Dec(ptDst.Line); + ptDst.Char := Length(Lines[ptDst.Line - 1]) + 1; + end + else if bChangeY and (DX = 1) and (ptO.Char > nLineLen) and (ptO.Line < Lines.Count) then + begin + // start of next line + Inc(ptDst.Line); + ptDst.Char := 1; + end + else begin + ptDst.Char := Max(1, ptDst.Char + DX); + // don't go past last char when ScrollPastEol option not set + if (DX > 0) and bChangeY then + ptDst.Char := Min(ptDst.Char, nLineLen + 1); + end; + // set caret and block begin / end + MoveCaretAndSelection(FBlockBegin, ptDst, SelectionCommand); + // if caret is beyond CharsInWindow move to next row (this means there are + // spaces/tabs at the end of the row) + if WordWrap and (DX > 0) and (CaretX < Length(LineText)) then + begin + vCaretRowCol := DisplayXY; + if (vCaretRowCol.Column = 1) and (LineToRow(CaretY) <> vCaretRowCol.Row) then + begin + FCaretAtEOL := True; + UpdateLastCaretX; + end + else if vCaretRowCol.Column > CharsInWindow +1 then + begin + Inc(vCaretRowCol.Row); + vCaretRowCol.Column := 1; + InternalCaretXY := DisplayToBufferPos(vCaretRowCol); + end; + end; +end; + +procedure TCustomSynEdit.MoveCaretVert(DY: Integer; SelectionCommand: Boolean); +var + ptO, ptDst, vEOLTestPos: TDisplayCoord; + vDstLineChar: TBufferCoord; + SaveLastCaretX: Integer; +begin + ptO := DisplayXY; + ptDst := ptO; + + Inc(ptDst.Row, DY); + if DY >= 0 then + begin + if RowToLine(ptDst.Row) > Lines.Count then + ptDst.Row := Max(1, DisplayLineCount); + end + else begin + if ptDst.Row < 1 then + ptDst.Row := 1; + end; + + if (ptO.Row <> ptDst.Row) then + begin + if eoKeepCaretX in Options then + ptDst.Column := FLastCaretX; + end; + vDstLineChar := DisplayToBufferPos(ptDst); + SaveLastCaretX := FLastCaretX; + + // set caret and block begin / end + IncPaintLock; + MoveCaretAndSelection(FBlockBegin, vDstLineChar, SelectionCommand); + if WordWrap then + begin + vEOLTestPos := BufferToDisplayPos(vDstLineChar); + FCaretAtEOL := (vEOLTestPos.Column = 1) and (vEOLTestPos.Row <> ptDst.Row); + end; + DecPaintLock; + + // Restore FLastCaretX after moving caret, since UpdateLastCaretX, called by + // SetCaretXYEx, changes them. This is the one case where we don't want that. + FLastCaretX := SaveLastCaretX; +end; + +procedure TCustomSynEdit.MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; + SelectionCommand: Boolean); +begin + if (eoGroupUndo in FOptions) and UndoList.CanUndo then + FUndoList.AddGroupBreak; + + IncPaintLock; + if SelectionCommand then + begin + if not SelAvail then + SetBlockBegin(ptBefore); + SetBlockEnd(ptAfter); + end + else + SetBlockBegin(ptAfter); + InternalCaretXY := ptAfter; + DecPaintLock; +end; + +procedure TCustomSynEdit.SetCaretAndSelection(const ptCaret, ptBefore, + ptAfter: TBufferCoord); +var + vOldMode: TSynSelectionMode; +begin + vOldMode := FActiveSelectionMode; + IncPaintLock; + try + InternalCaretXY := ptCaret; + SetBlockBegin(ptBefore); + SetBlockEnd(ptAfter); + finally + ActiveSelectionMode := vOldMode; + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.RecalcCharExtent; +const + iFontStyles: array[0..3] of TFontStyles = ([], [fsItalic], [fsBold], + [fsItalic, fsBold]); +var + iHasStyle: array[0..3] of Boolean; + cAttr: Integer; + cStyle: Integer; + iCurr: TFontStyles; + Done: Boolean; +begin + FillChar(iHasStyle, SizeOf(iHasStyle), 0); + if Assigned(FHighlighter) and (FHighlighter.AttrCount > 0) then + begin + for cAttr := 0 to FHighlighter.AttrCount - 1 do + begin + iCurr := FHighlighter.Attribute[cAttr].Style * [fsItalic, fsBold]; + for cStyle := 0 to 3 do + if iCurr = iFontStyles[cStyle] then + begin + iHasStyle[cStyle] := True; + Break; + end; + end; + end + else + begin + iCurr := Font.Style * [fsItalic, fsBold]; + for cStyle := 0 to 3 do + if iCurr = iFontStyles[cStyle] then + begin + iHasStyle[cStyle] := True; + Break; + end; + end; + + Done := False; + FTextHeight := 0; + FCharWidth := 0; + FTextDrawer.BaseFont := Self.Font; + + if not Done then + for cStyle := 0 to 3 do + if iHasStyle[cStyle] then + begin + FTextDrawer.BaseStyle := iFontStyles[cStyle]; + FTextHeight := Max(FTextHeight, FTextDrawer.CharHeight); + FCharWidth := Max(FCharWidth, FTextDrawer.CharWidth); + end; + Inc(FTextHeight, FExtraLineSpacing); +end; + +procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject); +begin + RecalcCharExtent; + if Sender is TSynCustomHighlighter then + begin + Lines.BeginUpdate; + try + ScanRanges; + finally + Lines.EndUpdate; + end; + end + else + Invalidate; + SizeOrFontChanged(True); +end; + +procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChanges); +begin + FStatusChanges := FStatusChanges + AChanges; + if PaintLock = 0 then + DoOnStatusChange(FStatusChanges); +end; + +procedure TCustomSynEdit.DoCaseChange(const Cmd: TSynEditorCommand); + + function ToggleCase(const aStr: UnicodeString): UnicodeString; + var + i: Integer; + sLower: UnicodeString; + begin + Result := SynWideUpperCase(aStr); + sLower := SynWideLowerCase(aStr); + for i := 1 to Length(aStr) do + begin + if Result[i] = aStr[i] then + Result[i] := sLower[i]; + end; + end; + + function TitleCase(const aStr: UnicodeString): UnicodeString; + var + i: Integer; + begin + Result := SynWideLowerCase(aStr); + for i := 1 to Length(Result) do + if (i = 1) or IsWordBreakChar(Result[i-1]) then Result[i] := SynWideUpperCase(Result[i])[1]; + end; + +var + w: UnicodeString; + oldCaret, oldBlockBegin, oldBlockEnd: TBufferCoord; + bHadSel : Boolean; +begin + Assert((Cmd >= ecUpperCase) and (Cmd <= ecTitleCaseBlock)); + if SelAvail then + begin + bHadSel := True; + oldBlockBegin := BlockBegin; + oldBlockEnd := BlockEnd; + end + else begin + bHadSel := False; + end; + oldCaret := CaretXY; + try + if Cmd < ecUpperCaseBlock then + begin + { Word commands } + SetSelWord; + if SelText = '' then + begin + { searches a previous Word } + InternalCaretXY := PrevWordPos; + SetSelWord; + if SelText = '' then + begin + { try once more since PrevWordPos may have failed last time. + (PrevWordPos "points" to the end of the previous line instead of the + beggining of the previous Word if invoked (e.g.) when CaretX = 1) } + InternalCaretXY := PrevWordPos; + SetSelWord; + end; + end; + end + else begin + { block commands } + if not SelAvail then + begin + if CaretX <= Length(LineText) then + MoveCaretHorz(1, True) + else if CaretY < Lines.Count then + InternalCaretXY := BufferCoord(1, CaretY +1); + end; + end; + + w := SelText; + if w <> '' then + begin + case Cmd of + ecUpperCase, ecUpperCaseBlock: + w := SynWideUpperCase(w); + ecLowerCase, ecLowerCaseBlock: + w := SynWideLowerCase(w); + ecToggleCase, ecToggleCaseBlock: + w := ToggleCase(w); + ecTitleCase, ecTitleCaseBlock: + w := TitleCase(w); + end; + BeginUndoBlock; + try + if bHadSel then + FUndoList.AddChange(crSelection, oldBlockBegin, oldBlockEnd, '', FActiveSelectionMode) + else + FUndoList.AddChange(crSelection, oldCaret, oldCaret, '', FActiveSelectionMode); + FUndoList.AddChange(crCaret, oldCaret, oldCaret, '', FActiveSelectionMode); + SelText := w; + finally + EndUndoBlock; + end; + end; + finally + { "word" commands do not restore Selection } + if bHadSel and (Cmd >= ecUpperCaseBlock) then + begin + BlockBegin := oldBlockBegin; + BlockEnd := oldBlockEnd; + end; + { "block" commands with empty Selection move the Caret } + if bHadSel or (Cmd < ecUpperCaseBlock) then + CaretXY := oldCaret; + end; +end; + +procedure TCustomSynEdit.DoTabKey; +var + StartOfBlock: TBufferCoord; + i, MinLen, iLine: Integer; + PrevLine, Spaces: UnicodeString; + p: PWideChar; + NewCaretX: Integer; + ChangeScroll: Boolean; + nPhysX, nDistanceToTab, nSpacesToNextTabStop : Integer; + OldSelTabLine, vIgnoreSmartTabs: Boolean; +begin + // Provide Visual Studio like block indenting + OldSelTabLine := SelTabLine; + if (eoTabIndent in Options) and ((SelTabBlock) or (OldSelTabLine)) then + begin + DoBlockIndent; + if OldSelTabLine then + begin + if FBlockBegin.Char < FBlockEnd.Char then + FBlockBegin.Char := 1 + else + FBlockEnd.Char := 1; + end; + Exit; + end; + i := 0; + iLine := 0; + MinLen := 0; + vIgnoreSmartTabs := False; + if eoSmartTabs in FOptions then + begin + iLine := CaretY - 1; + if (iLine > 0) and (iLine < Lines.Count) then + begin + Dec(iLine); + repeat + //todo: rethink it + MinLen := DisplayToBufferPos(DisplayCoord( + BufferToDisplayPos(CaretXY).Column, LineToRow(iLine + 1))).Char; + PrevLine := Lines[iLine]; + if (Length(PrevLine) >= MinLen) then begin + p := @PrevLine[MinLen]; + // scan over non-whitespaces + repeat + if (p^ = #9) or (p^ = #32) then + Break; + Inc(i); + Inc(p); + until p^ = #0; + // scan over whitespaces + if p^ <> #0 then + repeat + if (p^ <> #9) and (p^ <> #32) then Break; + Inc(i); + Inc(p); + until p^ = #0; + Break; + end; + Dec(iLine); + until iLine < 0; + end + else + vIgnoreSmartTabs := True; + end; + FUndoList.BeginBlock; + try + if SelAvail then + begin + FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, + FActiveSelectionMode); + SetSelTextPrimitive(''); + end; + StartOfBlock := CaretXY; + + if i = 0 then + begin + if (eoTabsToSpaces in FOptions) then + begin + i := TabWidth - (StartOfBlock.Char - 1) mod TabWidth; + if i = 0 then + i := TabWidth; + end + else + i := TabWidth; + end; + + if eoTabsToSpaces in FOptions then + begin + Spaces := UnicodeStringOfChar(#32, i); + NewCaretX := StartOfBlock.Char + i; + end + else if (eoTrimTrailingSpaces in Options) and (StartOfBlock.Char > Length(LineText)) then + begin + // work-around for trimming Tabs + nPhysX := BufferToDisplayPos(CaretXY).Column; + if (eoSmartTabs in FOptions) and not vIgnoreSmartTabs and (iLine > -1) then + begin + i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ).Column; + nDistanceToTab := i - nPhysX; + end + else + nDistanceToTab := TabWidth - ((nPhysX - 1) mod TabWidth); + NewCaretX := StartOfBlock.Char + nDistanceToTab; + end + else begin + if (eoSmartTabs in FOptions) and not vIgnoreSmartTabs and (iLine > -1) then + begin + Spaces := Copy(FLines[CaretXY.Line - 1], 1, CaretXY.Char - 1); + while Pos(#9, Spaces) > 0 do + Delete(Spaces, Pos(#9, Spaces), 1); + Spaces := WideTrim(Spaces); + + //smart tabs are only in the front of the line *NOT IN THE MIDDLE* + if Spaces = '' then + begin + i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ).Column; + + nPhysX := DisplayX; + nDistanceToTab := i - nPhysX; + nSpacesToNextTabStop := TabWidth - ((nPhysX - 1) mod TabWidth); + if nSpacesToNextTabStop <= nDistanceToTab then begin + Spaces := #9; + Dec(nDistanceToTab, nSpacesToNextTabStop); + end; + while nDistanceToTab >= TabWidth do begin + Spaces := Spaces + #9; + Dec(nDistanceToTab, TabWidth); + end; + if nDistanceToTab > 0 then + Spaces := Spaces + UnicodeStringOfChar(#32, nDistanceToTab); + end else + Spaces := #9; + end + else begin + Spaces := #9; + end; + if (eoTrimTrailingSpaces in Options) and (Length(TrimTrailingSpaces(LineText)) = 0) then + NewCaretX := StartOfBlock.Char + GetExpandedLength(Spaces, TabWidth) + else + NewCaretX := StartOfBlock.Char + Length(Spaces); + end; + + SetSelTextPrimitive(Spaces); + // Undo is already handled in SetSelText when SelectionMode is Column + if FActiveSelectionMode <> smColumn then + begin + FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, SelText, + FActiveSelectionMode); + end; + finally + FUndoList.EndBlock; + end; + + ChangeScroll := not(eoScrollPastEol in FOptions); + try + Include(FOptions, eoScrollPastEol); + InternalCaretX := NewCaretX; + finally + if ChangeScroll then + Exclude(FOptions, eoScrollPastEol); + end; + + EnsureCursorPosVisible; +end; + +procedure TCustomSynEdit.DoShiftTabKey; +// shift-tab key handling +var + NewX: Integer; + Line: UnicodeString; + LineLen: Integer; + DestX: Integer; + + MaxLen, iLine: Integer; + PrevLine, OldSelText: UnicodeString; + p: PWideChar; + OldCaretXY: TBufferCoord; + ChangeScroll: Boolean; +begin + // Provide Visual Studio like block indenting + if (eoTabIndent in Options) and ((SelTabBlock) or (SelTabLine)) then + begin + DoBlockUnIndent; + Exit; + end; + + NewX := CaretX; + + if (NewX <> 1) and (eoSmartTabs in FOptions) then + begin + iLine := CaretY - 1; + if (iLine > 0) and (iLine < Lines.Count) then + begin + Dec(iLine); + MaxLen := CaretX - 1; + repeat + PrevLine := Lines[iLine]; + if (Length(PrevLine) >= MaxLen) then + begin + p := @PrevLine[MaxLen]; + // scan over whitespaces + repeat + if p^ <> #32 then Break; + Dec(NewX); + Dec(p); + until NewX = 1; + // scan over non-whitespaces + if NewX <> 1 then + repeat + if p^ = #32 then Break; + Dec(NewX); + Dec(p); + until NewX = 1; + Break; + end; + Dec(iLine); + until iLine < 0; + end; + end; + + if NewX = CaretX then + begin + Line := LineText; + LineLen := Length(Line); + + // find real un-tab position + + DestX := ((CaretX - 2) div TabWidth) * TabWidth + 1; + if NewX > LineLen then + NewX := DestX + else if (NewX > DestX) and (Line[NewX - 1] = #9) then + Dec(NewX) + else begin + while (NewX > DestX) and ((NewX - 1 > LineLen) or (Line[NewX - 1] = #32)) do + Dec(NewX); + end; + end; + + // perform un-tab + if (NewX <> CaretX) then + begin + SetBlockBegin(BufferCoord(NewX, CaretY)); + SetBlockEnd(CaretXY); + OldCaretXY := CaretXY; + + OldSelText := SelText; + SetSelTextPrimitive(''); + + FUndoList.AddChange(crSilentDelete, BufferCoord(NewX, CaretY), + OldCaretXY, OldSelText, smNormal); + + // KV + ChangeScroll := not(eoScrollPastEol in FOptions); + try + Include(FOptions, eoScrollPastEol); + InternalCaretX := NewX; + finally + if ChangeScroll then + Exclude(FOptions, eoScrollPastEol); + end; + end; +end; + +procedure TCustomSynEdit.DoHomeKey(Selection: Boolean); + + function LastCharInRow: Integer; + var + vPos: TDisplayCoord; + begin + if FLines.Count = 0 then + Result := 1 + else + begin + vPos := DisplayXY; + vPos.Column := Min(CharsInWindow, FWordWrapPlugin.GetRowLength(vPos.Row) + 1); + Result := DisplayToBufferPos(vPos).Char; + end; + end; + +var + newX: Integer; + first_nonblank: Integer; + s: UnicodeString; + vNewPos: TDisplayCoord; + vMaxX: Integer; +begin + // home key enhancement + if (eoEnhanceHomeKey in FOptions) and (LineToRow(CaretY) = DisplayY) then + begin + s := FLines[CaretXY.Line - 1]; + + first_nonblank := 1; + if WordWrap then + vMaxX := LastCharInRow() -1 + else + vMaxX := Length(s); + while (first_nonblank <= vMaxX) and + CharInSet(s[first_nonblank], [#32, #9]) + do + Inc(first_nonblank); + Dec(first_nonblank); + + newX := CaretXY.Char - 1; + + if (newX > first_nonblank) or (newX = 0) then + newX := first_nonblank + 1 + else + newX := 1; + end + else + newX := 1; + + if WordWrap then + begin + vNewPos.Row := DisplayY; + vNewPos.Column := BufferToDisplayPos(BufferCoord(newX, CaretY)).Column; + MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewPos), Selection); + end + else + MoveCaretAndSelection(CaretXY, BufferCoord(newX, CaretY), Selection); +end; + +procedure TCustomSynEdit.DoEndKey(Selection: Boolean); + + function CaretInLastRow: Boolean; + var + vLastRow: Integer; + begin + if not WordWrap then + Result := True + else + begin + vLastRow := LineToRow(CaretY + 1) - 1; + // This check allows good behaviour with empty rows (this can be useful in a diff app ;-) + while (vLastRow > 1) + and (FWordWrapPlugin.GetRowLength(vLastRow) = 0) + and (RowToLine(vLastRow) = CaretY) do + begin + Dec(vLastRow); + end; + Result := DisplayY = vLastRow; + end; + end; + + function FirstCharInRow: Integer; + var + vPos: TDisplayCoord; + begin + vPos.Row := DisplayY; + vPos.Column := 1; + Result := DisplayToBufferPos(vPos).Char; + end; + +var + vText: UnicodeString; + vLastNonBlank: Integer; + vNewX: Integer; + vNewCaret: TDisplayCoord; + vMinX: Integer; + vEnhance: Boolean; +begin + if (eoEnhanceEndKey in FOptions) and CaretInLastRow then + begin + vEnhance := True; + vText := LineText; + vLastNonBlank := Length(vText); + if WordWrap then + vMinX := FirstCharInRow() - 1 + else + vMinX := 0; + while (vLastNonBlank > vMinX) and CharInSet(vText[vLastNonBlank], [#32, #9]) do + Dec(vLastNonBlank); + + vNewX := CaretX - 1; + if vNewX = vLastNonBlank then + vNewX := Length(LineText) + 1 + else + vNewX := vLastNonBlank + 1; + end + else + begin + vNewX := Length(LineText) + 1; + vEnhance := False; + end; + + if WordWrap then + begin + vNewCaret.Row := DisplayY; + if vEnhance then + vNewCaret.Column := BufferToDisplayPos(BufferCoord(vNewX, CaretY)).Column + else + vNewCaret.Column := FWordWrapPlugin.GetRowLength(vNewCaret.Row) + 1; + vNewCaret.Column := Min(CharsInWindow + 1, vNewCaret.Column); + MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewCaret), Selection); + // Updates FCaretAtEOL flag. + SetInternalDisplayXY(vNewCaret); + end + else + MoveCaretAndSelection(CaretXY, + BufferCoord(vNewX, CaretY), Selection); +end; + +procedure TCustomSynEdit.CreateWnd; +begin + inherited; + +{$IFNDEF UNICODE} + if not (csDesigning in ComponentState) then + begin + // "redefine" window-procedure to get Unicode messages + if Win32PlatformIsUnicode then + SetWindowLongW(Handle, GWL_WNDPROC, Integer(GetWindowLongA(Handle, GWL_WNDPROC))); + end; +{$ENDIF} + + if (eoDropFiles in FOptions) and not (csDesigning in ComponentState) then + DragAcceptFiles(Handle, True); + + UpdateScrollBars; +end; + +procedure TCustomSynEdit.DestroyWnd; +begin + if (eoDropFiles in FOptions) and not (csDesigning in ComponentState) then + DragAcceptFiles(Handle, False); + +{$IFNDEF UNICODE} + if not (csDesigning in ComponentState) then + begin + // restore window-procedure to what VCL expects + if Win32PlatformIsUnicode then + SetWindowLongA(Handle, GWL_WNDPROC, Integer(GetWindowLongW(Handle, GWL_WNDPROC))); + end; +{$ENDIF} + +{$IFDEF UNICODE} + // assign WindowText here, otherwise the VCL will call GetText twice + if WindowText = nil then + WindowText := Lines.GetText; +{$ENDIF} + inherited; +end; + +procedure TCustomSynEdit.InvalidateRect(const aRect: TRect; aErase: Boolean); +begin + Windows.InvalidateRect(Handle, @aRect, aErase); +end; + +procedure TCustomSynEdit.DoBlockIndent; +var + OrgCaretPos: TBufferCoord; + BB, BE: TBufferCoord; + Run, StrToInsert: PWideChar; + e, x, i, InsertStrLen: Integer; + Spaces: UnicodeString; + OrgSelectionMode: TSynSelectionMode; + InsertionPos: TBufferCoord; +begin + OrgSelectionMode := FActiveSelectionMode; + OrgCaretPos := CaretXY; + + StrToInsert := nil; + if SelAvail then + try + // keep current selection detail + BB := BlockBegin; + BE := BlockEnd; + + // build text to insert + if (BE.Char = 1) then + begin + e := BE.Line - 1; + x := 1; + end + else begin + e := BE.Line; + if eoTabsToSpaces in Options then + x := CaretX + FTabWidth + else x := CaretX + 1; + end; + if (eoTabsToSpaces in Options) then + begin + InsertStrLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; + // chars per line * lines-1 + last line + null char + StrToInsert := WStrAlloc(InsertStrLen); + Run := StrToInsert; + Spaces := UnicodeStringOfChar(#32, FTabWidth); + end + else begin + InsertStrLen := 3 * (e - BB.Line) + 2; + // #9#13#10 * lines-1 + (last line's #9 + null char) + StrToInsert := WStrAlloc(InsertStrLen); + Run := StrToInsert; + Spaces := #9; + end; + for i := BB.Line to e-1 do + begin + WStrCopy(Run, PWideChar(Spaces + #13#10)); + Inc(Run, Length(spaces) + 2); + end; + WStrCopy(Run, PWideChar(Spaces)); + + FUndoList.BeginBlock; + try + InsertionPos.Line := BB.Line; + if FActiveSelectionMode = smColumn then + InsertionPos.Char := Min(BB.Char, BE.Char) + else + InsertionPos.Char := 1; + InsertBlock(InsertionPos, InsertionPos, StrToInsert, True); + FUndoList.AddChange(crIndent, BB, BE, '', smColumn); + //We need to save the position of the end block for redo + FUndoList.AddChange(crIndent, + BufferCoord(BB.Char + length(Spaces), BB.Line), + BufferCoord(BE.Char + length(Spaces), BE.Line), + '', smColumn); + finally + FUndoList.EndBlock; + end; + + //adjust the x position of orgcaretpos appropriately + OrgCaretPos.Char := X; + finally + if BE.Char > 1 then + Inc(BE.Char, Length(Spaces)); + WStrDispose(StrToInsert); + SetCaretAndSelection(OrgCaretPos, + BufferCoord(BB.Char + Length(Spaces), BB.Line), BE); + ActiveSelectionMode := OrgSelectionMode; + end; +end; + +procedure TCustomSynEdit.DoBlockUnindent; +var + OrgCaretPos, + BB, BE: TBufferCoord; + Line, Run, + FullStrToDelete, + StrToDelete: PWideChar; + Len, x, StrToDeleteLen, i, TmpDelLen, FirstIndent, LastIndent, e: Integer; + TempString: UnicodeString; + OrgSelectionMode: TSynSelectionMode; + SomethingToDelete: Boolean; + + function GetDelLen: Integer; + var + Run: PWideChar; + begin + Result := 0; + Run := Line; + //Take care of tab character + if Run[0] = #9 then + begin + Result := 1; + SomethingToDelete := True; + Exit; + end; + //Deal with compound tabwidths Sometimes they have TabChars after a few + //spaces, yet we need to delete the whole tab width even though the char + //count might not be FTabWidth because of the TabChar + while (Run[0] = #32) and (Result < FTabWidth) do + begin + Inc(Result); + Inc(Run); + SomethingToDelete := True; + end; + if (Run[0] = #9) and (Result < FTabWidth) then + Inc(Result); + end; + +begin + OrgSelectionMode := FActiveSelectionMode; + Len := 0; + LastIndent := 0; + if SelAvail then + begin + // store current selection detail + BB := BlockBegin; + BE := BlockEnd; + OrgCaretPos := CaretXY; + x := FCaretX; + + // convert selection to complete lines + if BE.Char = 1 then + e := BE.Line - 1 + else + e := BE.Line; + + // build string to delete + StrToDeleteLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; + // chars per line * lines-1 + last line + null char + StrToDelete := WStrAlloc(StrToDeleteLen); + StrToDelete[0] := #0; + SomethingToDelete := False; + for i := BB.Line to e-1 do + begin + Line := PWideChar(Lines[i - 1]); + //'Line' is 0-based, 'BB.x' is 1-based, so the '-1' + //And must not increment 'Line' pointer by more than its 'Length' + if FActiveSelectionMode = smColumn then + Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[i - 1])])); + //Instead of doing a UnicodeStringOfChar, we need to get *exactly* what was + //being deleted incase there is a TabChar + TmpDelLen := GetDelLen; + WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); + WStrCat(StrToDelete, PWideChar(UnicodeString(#13#10))); + if (FCaretY = i) and (x <> 1) then + x := x - TmpDelLen; + end; + Line := PWideChar(Lines[e - 1]); + if FActiveSelectionMode = smColumn then + Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[e - 1])])); + TmpDelLen := GetDelLen; + WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); + if (FCaretY = e) and (x <> 1) then + x := x - TmpDelLen; + + FirstIndent := -1; + FullStrToDelete := nil; + // Delete string + if SomethingToDelete then + begin + FullStrToDelete := StrToDelete; + InternalCaretY := BB.Line; + if FActiveSelectionMode <> smColumn then + i := 1 + else + i := Min(BB.Char, BE.Char); + repeat + Run := GetEOL(StrToDelete); + if Run <> StrToDelete then + begin + Len := Run - StrToDelete; + if FirstIndent = -1 then + FirstIndent := Len; + if Len > 0 then + begin + TempString := Lines[CaretY - 1]; + Delete(TempString, i, Len); + Lines[CaretY - 1] := TempString; + end; + end; + if Run^ = #13 then + begin + Inc(Run); + if Run^ = #10 then + Inc(Run); + Inc(FCaretY); + end; + StrToDelete := Run; + until Run^ = #0; + LastIndent := Len; + FUndoList.AddChange(crUnindent, BB, BE, FullStrToDelete, FActiveSelectionMode); + end; + // restore selection + if FirstIndent = -1 then + FirstIndent := 0; + //adjust the x position of orgcaretpos appropriately + if FActiveSelectionMode = smColumn then + SetCaretAndSelection(OrgCaretPos, BB, BE) + else + begin + OrgCaretPos.Char := X; + Dec(BB.Char, FirstIndent); + Dec(BE.Char, LastIndent); + SetCaretAndSelection(OrgCaretPos, BB, BE); + end; + ActiveSelectionMode := OrgSelectionMode; + if FullStrToDelete <> nil then + WStrDispose(FullStrToDelete) + else + WStrDispose(StrToDelete); + end; +end; + +{$IFDEF SYN_COMPILER_4_UP} +function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boolean; +begin + if Action is TEditAction then + begin + Result := Focused; + if Result then + begin + if Action is TEditCut then + CommandProcessor(ecCut, ' ', nil) + else if Action is TEditCopy then + CommandProcessor(ecCopy, ' ', nil) + else if Action is TEditPaste then + CommandProcessor(ecPaste, ' ', nil) +{$IFDEF SYN_COMPILER_5_UP} + else if Action is TEditDelete then + begin + if SelAvail then + ClearSelection + else + CommandProcessor(ecDeleteChar, ' ', nil) + end + else if Action is TEditUndo then + CommandProcessor(ecUndo, ' ', nil) + else if Action is TEditSelectAll then + CommandProcessor(ecSelectAll, ' ', nil); +{$ENDIF} + end + end +{$IFDEF SYN_COMPILER_6_UP} + else if Action is TSearchAction then + begin + Result := Focused; + if Action is TSearchFindFirst then + DoSearchFindFirstExecute(TSearchFindFirst(Action)) + else if Action is TSearchFind then + DoSearchFindExecute(TSearchFind(Action)) + else if Action is TSearchReplace then + DoSearchReplaceExecute(TSearchReplace(Action)); + end + else if Action is TSearchFindNext then + begin + Result := Focused; + DoSearchFindNextExecute(TSearchFindNext(Action)) + end +{$ENDIF} + else + Result := inherited ExecuteAction(Action); +end; + +function TCustomSynEdit.UpdateAction(Action: TBasicAction): Boolean; +begin + if Action is TEditAction then + begin + Result := Focused; + if Result then + begin + if Action is TEditCut then + TEditAction(Action).Enabled := SelAvail and not ReadOnly + else if Action is TEditCopy then + TEditAction(Action).Enabled := SelAvail + else if Action is TEditPaste then + TEditAction(Action).Enabled := CanPaste +{$IFDEF SYN_COMPILER_5_UP} + else if Action is TEditDelete then + TEditAction(Action).Enabled := not ReadOnly + else if Action is TEditUndo then + TEditAction(Action).Enabled := CanUndo + else if Action is TEditSelectAll then + TEditAction(Action).Enabled := True; +{$ENDIF} + end; +{$IFDEF SYN_COMPILER_6_UP} + end else if Action is TSearchAction then + begin + Result := Focused; + if Result then + begin + if Action is TSearchFindFirst then + TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine) + else if Action is TSearchFind then + TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine) + else if Action is TSearchReplace then + TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine); + end; + end else if Action is TSearchFindNext then + begin + Result := Focused; + if Result then + TSearchAction(Action).Enabled := (Text<>'') + and (TSearchFindNext(Action).SearchFind <> nil) + and (TSearchFindNext(Action).SearchFind.Dialog.FindText <> ''); +{$ENDIF} + end + else + Result := inherited UpdateAction(Action); +end; +{$ENDIF} + +procedure TCustomSynEdit.SetModified(Value: Boolean); +begin + if Value <> FModified then begin + FModified := Value; + if (eoGroupUndo in Options) and (not Value) and UndoList.CanUndo then + UndoList.AddGroupBreak; + UndoList.InitialState := not Value; + StatusChanged([scModified]); + end; +end; + +function TCustomSynEdit.DoOnSpecialLineColors(Line: Integer; var Foreground, + Background: TColor): Boolean; +begin + Result := False; + if Assigned(FOnSpecialLineColors) then + FOnSpecialLineColors(Self, Line, Result, Foreground, Background); +end; + +procedure TCustomSynEdit.DoOnSpecialTokenAttributes(ALine, APos: Integer; const AToken: string; var FG, BG: TColor; + var AStyle: TFontStyles); +var + Special: Boolean; +begin + if Assigned(FOnSpecialTokenAttributes) then + begin + Special := False; + FOnSpecialTokenAttributes(Self, ALine, APos, AToken, Special, FG, BG, AStyle); + end; +end; + +procedure TCustomSynEdit.InvalidateLine(Line: Integer); +var + rcInval: TRect; +begin + if (not HandleAllocated) or (Line < 1) or (Line > Lines.Count) or (not Visible) then + Exit; + +{$IFDEF SYN_CodeFolding} + if UseCodeFolding or WordWrap then +{$ELSE} + if WordWrap then +{$ENDIF} + begin + InvalidateLines(Line, Line); + Exit; + end; + + if (Line >= TopLine) and (Line <= TopLine + LinesInWindow) then + begin + // invalidate text area of this line + rcInval := Rect(FGutterWidth, FTextHeight * (Line - TopLine), ClientWidth, 0); + rcInval.Bottom := rcInval.Top + FTextHeight; + if sfLinesChanging in FStateFlags then + UnionRect(fInvalidateRect, rcInval, fInvalidateRect) + else + InvalidateRect(rcInval, False); + end; +end; + +function TCustomSynEdit.GetReadOnly: Boolean; +begin + Result := FReadOnly; +end; + +procedure TCustomSynEdit.SetReadOnly(Value: Boolean); +begin + if FReadOnly <> Value then + begin + FReadOnly := Value; + StatusChanged([scReadOnly]); + end; +end; + +procedure TCustomSynEdit.FindMatchingBracket; +begin + InternalCaretXY := GetMatchingBracket; +end; + +procedure TCustomSynEdit.FontSmoothingChanged; +const + NONANTIALIASED_QUALITY = 3; + ANTIALIASED_QUALITY = 4; + CLEARTYPE_QUALITY = 5; +var + bMethod: Byte; + lf: TLogFont; +begin + case FFontSmoothing of + fsmAntiAlias: + bMethod := ANTIALIASED_QUALITY; + fsmClearType: + bMethod := CLEARTYPE_QUALITY; + else // fsmNone also + bMethod := NONANTIALIASED_QUALITY; + end; + GetObject(Font.Handle, SizeOf(TLogFont), @lf); + lf.lfQuality := bMethod; + Font.Handle := CreateFontIndirect(lf); +end; + +function TCustomSynEdit.GetMatchingBracket: TBufferCoord; +begin + Result := GetMatchingBracketEx(CaretXY); +end; + +function TCustomSynEdit.GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; +const + Brackets: array[0..7] of WideChar = ('(', ')', '[', ']', '{', '}', '<', '>'); +var + Line: UnicodeString; + i, PosX, PosY, Len: Integer; + Test, BracketInc, BracketDec: WideChar; + NumBrackets: Integer; + vDummy: UnicodeString; + attr: TSynHighlighterAttributes; + p: TBufferCoord; + isCommentOrString: Boolean; +begin + Result.Char := 0; + Result.Line := 0; + // get char at caret + PosX := APoint.Char; + PosY := APoint.Line; + Line := Lines[APoint.Line - 1]; + if Length(Line) >= PosX then + begin + Test := Line[PosX]; + // is it one of the recognized brackets? + for i := Low(Brackets) to High(Brackets) do + if Test = Brackets[i] then + begin + // this is the bracket, get the matching one and the direction + BracketInc := Brackets[i]; + BracketDec := Brackets[i xor 1]; // 0 -> 1, 1 -> 0, ... + // search for the matching bracket (that is until NumBrackets = 0) + NumBrackets := 1; + if Odd(i) then + begin + repeat + // search until start of line + while PosX > 1 do + begin + Dec(PosX); + Test := Line[PosX]; + p.Char := PosX; + p.Line := PosY; + if (Test = BracketInc) or (Test = BracketDec) then + begin + if GetHighlighterAttriAtRowCol(p, vDummy, attr) then + isCommentOrString := (attr = Highlighter.StringAttribute) or + (attr = Highlighter.CommentAttribute) + else + isCommentOrString := False; + if (Test = BracketInc) and (not isCommentOrString) then + Inc(NumBrackets) + else if (Test = BracketDec) and (not isCommentOrString) then + begin + Dec(NumBrackets); + if NumBrackets = 0 then + begin + // matching bracket found, set caret and bail out + Result := P; + Exit; + end; + end; + end; + end; + // get previous line if possible + if PosY = 1 then Break; + Dec(PosY); + Line := Lines[PosY - 1]; + PosX := Length(Line) + 1; + until False; + end + else begin + repeat + // search until end of line + Len := Length(Line); + while PosX < Len do + begin + Inc(PosX); + Test := Line[PosX]; + p.Char := PosX; + p.Line := PosY; + if (Test = BracketInc) or (Test = BracketDec) then + begin + if GetHighlighterAttriAtRowCol(p, vDummy, attr) then + isCommentOrString := (attr = Highlighter.StringAttribute) or + (attr = Highlighter.CommentAttribute) or (attr = Highlighter.CharAttribute) + else + isCommentOrString := False; + if (Test = BracketInc) and (not isCommentOrString) then + Inc(NumBrackets) + else if (Test = BracketDec)and (not isCommentOrString) then + begin + Dec(NumBrackets); + if NumBrackets = 0 then + begin + // matching bracket found, set caret and bail out + Result := P; + Exit; + end; + end; + end; + end; + // get next line if possible + if PosY = Lines.Count then + Break; + Inc(PosY); + Line := Lines[PosY - 1]; + PosX := 0; + until False; + end; + // don't test the other brackets, we're done + Break; + end; + end; +end; + +function TCustomSynEdit.GetHighlighterAttriAtRowCol(const XY: TBufferCoord; + var Token: UnicodeString; var Attri: TSynHighlighterAttributes): Boolean; +var + TmpType, TmpStart: Integer; +begin + Result := GetHighlighterAttriAtRowColEx(XY, Token, TmpType, TmpStart, Attri); +end; + +function TCustomSynEdit.GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; + var Token: UnicodeString; var TokenType, Start: Integer; + var Attri: TSynHighlighterAttributes): Boolean; +var + PosX, PosY: Integer; + Line: UnicodeString; +begin + PosY := XY.Line - 1; + if Assigned(Highlighter) and (PosY >= 0) and (PosY < Lines.Count) then + begin + Line := Lines[PosY]; + if PosY = 0 then + Highlighter.ResetRange + else + Highlighter.SetRange(TSynEditStringList(Lines).Ranges[PosY - 1]); + Highlighter.SetLine(Line, PosY); + PosX := XY.Char; + if (PosX > 0) and (PosX <= Length(Line)) then + while not Highlighter.GetEol do + begin + Start := Highlighter.GetTokenPos + 1; + Token := Highlighter.GetToken; + if (PosX >= Start) and (PosX < Start + Length(Token)) then + begin + Attri := Highlighter.GetTokenAttribute; + TokenType := Highlighter.GetTokenKind; + Result := True; + Exit; + end; + Highlighter.Next; + end; + end; + Token := ''; + Attri := nil; + Result := False; +end; + +function TCustomSynEdit.FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): Integer; +var + Entry: THookedCommandHandlerEntry; +begin + Result := GetHookedCommandHandlersCount - 1; + while Result >= 0 do + begin + Entry := THookedCommandHandlerEntry(FHookedCommandHandlers[Result]); + if Entry.Equals(AHandlerProc) then + Break; + Dec(Result); + end; +end; + +function TCustomSynEdit.GetHookedCommandHandlersCount: Integer; +begin + if Assigned(FHookedCommandHandlers) then + Result := FHookedCommandHandlers.Count + else + Result := 0; +end; + +procedure TCustomSynEdit.RegisterCommandHandler( + const AHandlerProc: THookedCommandEvent; AHandlerData: Pointer); +begin + if not Assigned(AHandlerProc) then + begin +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.Create('Event handler is NIL in RegisterCommandHandler'); +{$ENDIF} + Exit; + end; + if not Assigned(FHookedCommandHandlers) then + FHookedCommandHandlers := TObjectList.Create; + if FindHookedCmdEvent(AHandlerProc) = -1 then + FHookedCommandHandlers.Add(THookedCommandHandlerEntry.Create( + AHandlerProc, AHandlerData)) + else +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.CreateFmt('Event handler (%p, %p) already registered', + [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); +{$ENDIF} +end; + +procedure TCustomSynEdit.UnregisterCommandHandler(AHandlerProc: + THookedCommandEvent); +var + i: Integer; +begin + if not Assigned(AHandlerProc) then + begin +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.Create('Event handler is NIL in UnregisterCommandHandler'); +{$ENDIF} + Exit; + end; + i := FindHookedCmdEvent(AHandlerProc); + if i > -1 then + FHookedCommandHandlers.Delete(i) + else +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.CreateFmt('Event handler (%p, %p) is not registered', + [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); +{$ENDIF} +end; + +procedure TCustomSynEdit.NotifyHookedCommandHandlers(AfterProcessing: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); +var + Handled: Boolean; + i: Integer; + Entry: THookedCommandHandlerEntry; +begin + Handled := False; + for i := 0 to GetHookedCommandHandlersCount - 1 do + begin + Entry := THookedCommandHandlerEntry(FHookedCommandHandlers[i]); + // NOTE: Command should NOT be set to ecNone, because this might interfere + // with other handlers. Set Handled to False instead (and check its value + // to not process the command twice). + Entry.FEvent(Self, AfterProcessing, Handled, Command, AChar, Data, + Entry.FData); + end; + if Handled then + Command := ecNone; +end; + +procedure TCustomSynEdit.DoOnClearBookmark(var Mark: TSynEditMark); +begin + if Assigned(FOnClearMark) then + FOnClearMark(Self, Mark); +end; + +procedure TCustomSynEdit.DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); +var + DoTransient: Boolean; + i: Integer; +begin + DoTransient :=(FPaintTransientLock=0); + if Lock then + begin + if (TransientType=ttBefore) then Inc(FPaintTransientLock) + else + begin + Dec(FPaintTransientLock); + DoTransient :=(FPaintTransientLock=0); + end; + end; + + if DoTransient then + begin + // plugins + if FPlugins <> nil then + for i := 0 to FPlugins.Count - 1 do + TSynEditPlugin(FPlugins[i]).PaintTransient(Canvas, TransientType); + // event + if Assigned(FOnPaintTransient) then + begin + Canvas.Font.Assign(Font); + Canvas.Brush.Color := Color; + HideCaret; + try + FOnPaintTransient(Self, Canvas, TransientType); + finally + ShowCaret; + end; + end; + end; +end; + +procedure TCustomSynEdit.DoOnPaintTransient(TransientType: TTransientType); +begin + DoOnPaintTransientEx(TransientType, False); +end; + +procedure TCustomSynEdit.DoOnPaint; +begin + if Assigned(FOnPaint) then + begin + Canvas.Font.Assign(Font); + Canvas.Brush.Color := Color; + FOnPaint(Self, Canvas); + end; +end; + +procedure TCustomSynEdit.DoOnPlaceMark(var Mark: TSynEditMark); +begin + if Assigned(FOnPlaceMark) then + FOnPlaceMark(Self, Mark); +end; + +function TCustomSynEdit.DoOnReplaceText(const ASearch, AReplace: UnicodeString; + Line, Column: Integer): TSynReplaceAction; +begin + Result := raCancel; + if Assigned(FOnReplaceText) then + FOnReplaceText(Self, ASearch, AReplace, Line, Column, Result); +end; + +procedure TCustomSynEdit.DoOnStatusChange(Changes: TSynStatusChanges); +begin + if Assigned(FOnStatusChange) then + begin + FOnStatusChange(Self, FStatusChanges); + FStatusChanges := []; + end; +end; + +procedure TCustomSynEdit.UpdateModifiedStatus; +begin + Modified := not UndoList.InitialState; +end; + +procedure TCustomSynEdit.UndoRedoAdded(Sender: TObject); +begin + UpdateModifiedStatus; + + // we have to clear the redo information, since adding undo info removes + // the necessary context to undo earlier edit actions + if (Sender = FUndoList) and not FUndoList.InsideRedo and + (FUndoList.PeekItem<>nil) and (FUndoList.PeekItem.ChangeReason<>crGroupBreak) then + FRedoList.Clear; + if TSynEditUndoList(Sender).BlockCount = 0 then + DoChange; +end; + +function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): UnicodeString; + +// TODO: consider removing the use of Low/High(string) since this code is anyway not zero-based strings ready +{$IFNDEF SYN_COMPILER_17_UP} + function Low(AStr: UnicodeString): Integer; {$IFDEF SYN_COMPILER_9_UP}inline;{$ENDIF} + begin + Result := 1; + end; + + function High(AStr: UnicodeString): Integer; {$IFDEF SYN_COMPILER_9_UP}inline;{$ENDIF} + begin + Result := Length(AStr); + end; +{$ENDIF} + +var + Line: UnicodeString; + Start, Stop: Integer; +begin + Result := ''; + if (XY.Line >= 1) and (XY.Line <= Lines.Count) then + begin + Line := Lines[XY.Line - 1]; + if (Length(Line) > 0) and + ((XY.Char >= Low(Line)) and (XY.Char <= High(Line))) and + IsIdentChar(Line[XY.Char]) then + begin + Start := XY.Char; + while (Start > Low(Line)) and IsIdentChar(Line[Start - 1]) do + Dec(Start); + + Stop := XY.Char + 1; + while (Stop <= High(Line)) and IsIdentChar(Line[Stop]) do + Inc(Stop); + + Result := Copy(Line, Start, Stop - Start); + end; + end; +end; + +function TCustomSynEdit.BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; +// BufferToDisplayPos takes a position in the text and transforms it into +// the row and column it appears to be on the screen +var + s: UnicodeString; + i, L: Integer; + x, CountOfAvgGlyphs: Integer; +begin + Canvas.Font := Font; + + Result := TDisplayCoord(p); + if p.Line - 1 < Lines.Count then + begin + s := Lines[p.Line - 1]; + l := Length(s); + x := 0; + + for i := 1 to p.Char - 1 do begin + if (i <= l) and (s[i] = #9) then + Inc(x, TabWidth - (x mod TabWidth)) + else if i <= l then + begin + CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(s[i]), FCharWidth); + Inc(x, CountOfAvgGlyphs); + end + else + Inc(x); + end; + Result.Column := x + 1; + end; + if WordWrap then + Result := FWordWrapPlugin.BufferToDisplayPos(TBufferCoord(Result)); +{$IFDEF SYN_CodeFolding} + if UseCodeFolding then + Result.Row := fAllFoldRanges.FoldLineToRow(Result.Row) +{$ENDIF} +end; + +function TCustomSynEdit.DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; +// DisplayToBufferPos takes a position on screen and transfrom it +// into position of text +var + s: UnicodeString; + i, L: Integer; + x, CountOfAvgGlyphs: Integer; +begin + Canvas.Font := Font; + + if WordWrap then + Result := FWordWrapPlugin.DisplayToBufferPos(p) + else + Result := TBufferCoord(p); +{$IFDEF SYN_CodeFolding} + if UseCodeFolding then + Result.Line := fAllFoldRanges.FoldRowToLine(p.Row); +{$ENDIF} + + if Result.Line <= lines.Count then + begin + s := Lines[Result.Line - 1]; + l := Length(s); + x := 0; + i := 0; + + while x < Result.Char do + begin + Inc(i); + if (i <= l) and (s[i] = #9) then + Inc(x, TabWidth - (x mod TabWidth)) + else if i <= l then + begin + CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(s[i]), FCharWidth); + Inc(x, CountOfAvgGlyphs); + end + else + Inc(x); + end; + Result.Char := i; + end; +end; + +procedure TCustomSynEdit.DoLinesDeleted(FirstLine, Count: Integer); +var + i: Integer; +begin + // gutter marks + for i := 0 to Marks.Count - 1 do + if Marks[i].Line >= FirstLine + Count then + Marks[i].Line := Marks[i].Line - Count + else if Marks[i].Line > FirstLine then + Marks[i].Line := FirstLine; + + // plugins + if FPlugins <> nil then + for i := 0 to FPlugins.Count - 1 do + TSynEditPlugin(FPlugins[i]).LinesDeleted(FirstLine, Count); +end; + +procedure TCustomSynEdit.DoLinesInserted(FirstLine, Count: Integer); +var + i: Integer; +begin + // gutter marks + for i := 0 to Marks.Count - 1 do + if Marks[i].Line >= FirstLine then + Marks[i].Line := Marks[i].Line + Count; + + // plugins + if FPlugins <> nil then + for i := 0 to FPlugins.Count - 1 do + TSynEditPlugin(FPlugins[i]).LinesInserted(FirstLine, Count); +end; + +procedure TCustomSynEdit.PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: Integer); +var + i: Integer; +begin + if FPlugins <> nil then + for i := 0 to FPlugins.Count - 1 do + TSynEditPlugin(FPlugins[i]).AfterPaint(ACanvas, AClip, FirstLine, LastLine); +end; + +procedure TCustomSynEdit.ProperSetLine(ALine: Integer; const ALineText: UnicodeString); +begin + if eoTrimTrailingSpaces in Options then + Lines[ALine] := TrimTrailingSpaces(ALineText) + else + Lines[ALine] := ALineText; +end; + +procedure TCustomSynEdit.AddKeyUpHandler(aHandler: TKeyEvent); +begin + FKbdHandler.AddKeyUpHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveKeyUpHandler(aHandler: TKeyEvent); +begin + FKbdHandler.RemoveKeyUpHandler(aHandler); +end; + +procedure TCustomSynEdit.AddKeyDownHandler(aHandler: TKeyEvent); +begin + FKbdHandler.AddKeyDownHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveKeyDownHandler(aHandler: TKeyEvent); +begin + FKbdHandler.RemoveKeyDownHandler(aHandler); +end; + +procedure TCustomSynEdit.AddKeyPressHandler(aHandler: TKeyPressWEvent); +begin + FKbdHandler.AddKeyPressHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveKeyPressHandler(aHandler: TKeyPressWEvent); +begin + FKbdHandler.RemoveKeyPressHandler(aHandler); +end; + +procedure TCustomSynEdit.AddFocusControl(aControl: TWinControl); +begin + FFocusList.Add(aControl); +end; + +procedure TCustomSynEdit.RemoveFocusControl(aControl: TWinControl); +begin + FFocusList.Remove(aControl); +end; + +function TCustomSynEdit.IsIdentChar(AChar: WideChar): Boolean; +begin + if Assigned(Highlighter) then + Result := Highlighter.IsIdentChar(AChar) + else + Result := AChar >= #33; + + if Assigned(Highlighter) then + Result := Result or CharInSet(AChar, Highlighter.AdditionalIdentChars) + else + Result := Result or CharInSet(AChar, Self.AdditionalIdentChars); + + Result := Result and not IsWordBreakChar(AChar); +end; + +function TCustomSynEdit.IsWhiteChar(AChar: WideChar): Boolean; +begin + if Assigned(Highlighter) then + Result := Highlighter.IsWhiteChar(AChar) + else + case AChar of + #0..#32: + Result := True; + else + Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) + end +end; + +function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolean; +begin + if Assigned(Highlighter) then + Result := Highlighter.IsWordBreakChar(AChar) + else + case AChar of + #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), '`', + WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', + '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', + '/', '\', '|': + Result := True; + else + Result := False; + end; + + if Assigned(Highlighter) then + begin + Result := Result or CharInSet(AChar, Highlighter.AdditionalWordBreakChars); + Result := Result and not CharInSet(AChar, Highlighter.AdditionalIdentChars); + end + else + begin + Result := Result or CharInSet(AChar, Self.AdditionalWordBreakChars); + Result := Result and not CharInSet(AChar, Self.AdditionalIdentChars); + end; +end; + +procedure TCustomSynEdit.SetSearchEngine(Value: TSynEditSearchCustom); +begin + if (FSearchEngine <> Value) then + begin + FSearchEngine := Value; + if Assigned(FSearchEngine) then + FSearchEngine.FreeNotification(Self); + end; +end; + +function TCustomSynEdit.NextWordPos: TBufferCoord; +begin + Result := NextWordPosEx(CaretXY); +end; + +function TCustomSynEdit.WordStart: TBufferCoord; +begin + Result := WordStartEx(CaretXY); +end; + +function TCustomSynEdit.WordEnd: TBufferCoord; +begin + Result := WordEndEx(CaretXY); +end; + +function TCustomSynEdit.PrevWordPos: TBufferCoord; +begin + Result := PrevWordPosEx(CaretXY); +end; + +function TCustomSynEdit.GetPositionOfMouse(out aPos: TBufferCoord): Boolean; +// Get XY caret position of mouse. Returns False if point is outside the +// region of the SynEdit control. +var + Point: TPoint; +begin + GetCursorPos(Point); // mouse position (on screen) + Point := Self.ScreenToClient(Point); // convert to SynEdit coordinates + { Make sure it fits within the SynEdit bounds } + if (Point.X < 0) or (Point.Y < 0) or (Point.X > Self.Width) or (Point.Y> Self.Height) then + begin + Result := False; + Exit; + end; + + { inside the editor, get the Word under the mouse pointer } + aPos := DisplayToBufferPos(PixelsToRowColumn(Point.X, Point.Y)); + Result := True; +end; + +function TCustomSynEdit.GetWordAtMouse: UnicodeString; +var + Point: TBufferCoord; +begin + { Return the Word under the mouse } + if GetPositionOfMouse(Point) then // if point is valid + Result := Self.GetWordAtRowCol(Point); // return the point at the mouse position +end; + +function TCustomSynEdit.CharIndexToRowCol(Index: Integer): TBufferCoord; +{ Index is 0-based; Result.x and Result.y are 1-based } +var + x, y, Chars: Integer; +begin + x := 0; + y := 0; + Chars := 0; + while y < Lines.Count do + begin + x := Length(Lines[y]); + if Chars + x + 2 > Index then + begin + x := Index - Chars; + Break; + end; + Inc(Chars, x + 2); + x := 0; + Inc(y); + end; + Result.Char := x + 1; + Result.Line := y + 1; +end; + +function TCustomSynEdit.RowColToCharIndex(RowCol: TBufferCoord): Integer; +{ Row and Col are 1-based; Result is 0-based } +var + synEditStringList : TSynEditStringList; +begin + RowCol.Line := Max(0, Min(Lines.Count, RowCol.Line) - 1); + synEditStringList := (FLines as TSynEditStringList); + // CharIndexToRowCol assumes a line break size of two + Result := synEditStringList.LineCharIndex(RowCol.Line) + + RowCol.Line * 2 + (RowCol.Char -1); +end; + +procedure TCustomSynEdit.Clear; +{ just to attain interface compatibility with TMemo } +begin + ClearAll; +end; + +function TCustomSynEdit.GetSelLength: Integer; +begin + if SelAvail then + Result := RowColToCharIndex(BlockEnd) - RowColToCharIndex(BlockBegin) + else + Result := 0; +end; + +procedure TCustomSynEdit.SetSelLength(const Value: Integer); +var + iNewCharIndex: Integer; + iNewBegin: TBufferCoord; + iNewEnd: TBufferCoord; +begin + iNewCharIndex := RowColToCharIndex(BlockBegin) + Value; + if (Value >= 0) or (iNewCharIndex < 0) then + begin + if iNewCharIndex < 0 then + begin + iNewEnd.Char := Length(Lines[Lines.Count - 1]) + 1; + iNewEnd.Line := Lines.Count; + end + else + iNewEnd := CharIndexToRowCol(iNewCharIndex); + SetCaretAndSelection(iNewEnd, BlockBegin, iNewEnd); + end + else begin + iNewBegin := CharIndexToRowCol(iNewCharIndex); + SetCaretAndSelection(iNewBegin, iNewBegin, BlockBegin); + end; +end; + +procedure TCustomSynEdit.DefineProperties(Filer: TFiler); + +{$IFDEF SYN_COMPILER_6_UP} + function CollectionsEqual(C1, C2: TCollection): Boolean; + begin + Result := Classes.CollectionsEqual(C1, C2, nil, nil); + end; +{$ENDIF} + + function HasKeyData: Boolean; + var + iDefKeys: TSynEditKeyStrokes; + begin + if Filer.Ancestor <> nil then + begin + Result := not CollectionsEqual(Keystrokes, + TCustomSynEdit(Filer.Ancestor).Keystrokes); + end + else begin + iDefKeys := TSynEditKeyStrokes.Create(nil); + try + iDefKeys.ResetDefaults; + Result := not CollectionsEqual(Keystrokes, iDefKeys); + finally + iDefKeys.Free; + end; + end; + end; + +var + iSaveKeyData: Boolean; +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} + iSaveKeyData := HasKeyData; + Filer.DefineProperty('RemovedKeystrokes', ReadRemovedKeystrokes, + WriteRemovedKeystrokes, iSaveKeyData); + Filer.DefineProperty('AddedKeystrokes', ReadAddedKeystrokes, WriteAddedKeystrokes, + iSaveKeyData); +end; + +procedure TCustomSynEdit.DoChange; +begin + if Assigned(FOnChange) then + FOnChange(Self); +end; + +procedure TCustomSynEdit.ReadAddedKeystrokes(Reader: TReader); +var + iAddKeys: TSynEditKeyStrokes; + cKey: Integer; +begin + if Reader.NextValue = vaCollection then + Reader.ReadValue + else + Exit; + iAddKeys := TSynEditKeyStrokes.Create(Self); + try + Reader.ReadCollection(iAddKeys); + for cKey := 0 to iAddKeys.Count -1 do + Keystrokes.Add.Assign(iAddKeys[cKey]); + finally + iAddKeys.Free; + end; +end; + +procedure TCustomSynEdit.ReadRemovedKeystrokes(Reader: TReader); +var + iDelKeys: TSynEditKeyStrokes; + cKey: Integer; + iKey: TSynEditKeyStroke; + iToDelete: Integer; +begin + if Reader.NextValue = vaCollection then + Reader.ReadValue + else + Exit; + iDelKeys := TSynEditKeyStrokes.Create(nil); + try + Reader.ReadCollection(iDelKeys); + for cKey := 0 to iDelKeys.Count -1 do + begin + iKey := iDelKeys[cKey]; + iToDelete := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); + if (iToDelete >= 0) and (Keystrokes[iToDelete].Command = iKey.Command) then + Keystrokes[iToDelete].Free; + end; + finally + iDelKeys.Free; + end; +end; + +procedure TCustomSynEdit.WriteAddedKeystrokes(Writer: TWriter); +var + iDefaultKeys: TSynEditKeyStrokes; + iAddedKeys: TSynEditKeyStrokes; + cKey: Integer; + iKey: TSynEditKeyStroke; + iDelIndex: Integer; +begin + iDefaultKeys := TSynEditKeyStrokes.Create(nil); + try + if Writer.Ancestor <> nil then + iDefaultKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes) + else + iDefaultKeys.ResetDefaults; + iAddedKeys := TSynEditKeyStrokes.Create(nil); + try + for cKey := 0 to Keystrokes.Count -1 do + begin + iKey := Keystrokes[cKey]; + iDelIndex := iDefaultKeys.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); + //if it's not a default keystroke, add it + if (iDelIndex < 0) or (iDefaultKeys[iDelIndex].Command <> iKey.Command) then + iAddedKeys.Add.Assign(iKey); + end; + Writer.WriteCollection(iAddedKeys); + finally + iAddedKeys.Free; + end; + finally + iDefaultKeys.Free; + end; +end; + +procedure TCustomSynEdit.WriteRemovedKeystrokes(Writer: TWriter); +var + iRemovedKeys: TSynEditKeyStrokes; + cKey: Integer; + iKey: TSynEditKeyStroke; + iFoundAt: Integer; +begin + iRemovedKeys := TSynEditKeyStrokes.Create(nil); + try + if Writer.Ancestor <> nil then + iRemovedKeys.Assign(TSynEdit(Writer.Ancestor).Keystrokes) + else + iRemovedKeys.ResetDefaults; + cKey := 0; + while cKey < iRemovedKeys.Count do + begin + iKey := iRemovedKeys[cKey]; + iFoundAt := Keystrokes.FindShortcut2(iKey.ShortCut, iKey.ShortCut2); + if (iFoundAt >= 0) and (Keystrokes[iFoundAt].Command = iKey.Command) then + iKey.Free //if exists in Keystrokes, then shouldn't be in "removed" list + else + Inc(cKey); + end; + Writer.WriteCollection(iRemovedKeys); + finally + iRemovedKeys.Free; + end; +end; + +procedure TCustomSynEdit.AddMouseDownHandler(aHandler: TMouseEvent); +begin + FKbdHandler.AddMouseDownHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveMouseDownHandler(aHandler: TMouseEvent); +begin + FKbdHandler.RemoveMouseDownHandler(aHandler); +end; + +procedure TCustomSynEdit.AddMouseUpHandler(aHandler: TMouseEvent); +begin + FKbdHandler.AddMouseUpHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveMouseUpHandler(aHandler: TMouseEvent); +begin + FKbdHandler.RemoveMouseUpHandler(aHandler); +end; + +procedure TCustomSynEdit.ResetModificationIndicator; +begin + TSynEditStringList(FLines).ResetModificationIndicator; + if FGutter.ShowModification then + InvalidateGutter; +end; + +{$IFDEF SYN_CodeFolding} + +procedure TCustomSynEdit.FullFoldScan; +begin + if UseCodeFolding then + begin + ReScanForFoldRanges(0, fLines.Count -1); + end; +end; + +procedure TCustomSynEdit.ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); +Var + AdjustedToLine: Integer; +begin + AdjustedToLine := Max(Min(ToLine, Lines.Count - 1), FromLine); + fAllFoldRanges.StartScanning; + ScanForFoldRanges(fAllFoldRanges, fLines, FromLine, AdjustedToLine); + { StopScanning recreates AllFoldRanges. + Normally at this point (sfLinesChanging in fStateFlags) = True + and StopScanning will be called when LinesChanged is executed } + if not (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then + begin + if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then + TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, + fLines); + InvalidateGutter; + Include(fStateFlags, sfScrollbarChanged); + end; +end; + +procedure TCustomSynEdit.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); +begin + if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then + TSynCustomCodeFoldingHighlighter(fHighlighter).ScanForFoldRanges(FoldRanges, + LinesToScan, FromLine, ToLine); + + if Assigned(fOnScanForFoldRanges) then + fOnScanForFoldRanges(Self, FoldRanges, LinesToScan, FromLine, ToLine); +end; +{$ENDIF} + +procedure TCustomSynEdit.AddMouseCursorHandler(aHandler: TMouseCursorEvent); +begin + FKbdHandler.AddMouseCursorHandler(aHandler); +end; + +procedure TCustomSynEdit.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); +begin + FKbdHandler.RemoveMouseCursorHandler(aHandler); +end; + +{$IFDEF SYN_COMPILER_6_UP} +procedure TCustomSynEdit.DoSearchFindFirstExecute(Action: TSearchFindFirst); +begin + FOnFindBeforeSearch := Action.Dialog.OnFind; + FOnCloseBeforeSearch := Action.Dialog.OnClose; + FSelStartBeforeSearch := SelStart; FSelLengthBeforeSearch := SelLength; + + Action.Dialog.OnFind := FindDialogFindFirst; + Action.Dialog.OnClose := FindDialogClose; + Action.Dialog.Execute(); +end; + +procedure TCustomSynEdit.DoSearchFindExecute(Action: TSearchFind); +begin + FOnFindBeforeSearch := Action.Dialog.OnFind; + FOnCloseBeforeSearch := Action.Dialog.OnClose; + + Action.Dialog.OnFind := FindDialogFind; + Action.Dialog.OnClose := FindDialogClose; + Action.Dialog.Execute(); +end; + +procedure TCustomSynEdit.DoSearchReplaceExecute(Action: TSearchReplace); +begin + FOnFindBeforeSearch := Action.Dialog.OnFind; + FOnReplaceBeforeSearch := Action.Dialog.OnReplace; + FOnCloseBeforeSearch := Action.Dialog.OnClose; + + Action.Dialog.OnFind := FindDialogFind; + Action.Dialog.OnReplace := FindDialogFind; + Action.Dialog.OnClose := FindDialogClose; + Action.Dialog.Execute(); +end; + +procedure TCustomSynEdit.DoSearchFindNextExecute(Action: TSearchFindNext); +begin + SearchByFindDialog(Action.SearchFind.Dialog); +end; + +procedure TCustomSynEdit.FindDialogFindFirst(Sender: TObject); +begin + TFindDialog(Sender).CloseDialog; + + if (SelStart = FSelStartBeforeSearch) and (SelLength = FSelLengthBeforeSearch) then + begin + SelStart := 0; + SelLength := 0; + end; + + if Sender is TFindDialog then + if not SearchByFindDialog(TFindDialog(Sender)) and (SelStart = 0) and (SelLength = 0) then + begin + SelStart := FSelStartBeforeSearch; + SelLength := FSelLengthBeforeSearch; + end; +end; + +procedure TCustomSynEdit.FindDialogFind(Sender: TObject); +begin + if Sender is TFindDialog then + SearchByFindDialog(TFindDialog(Sender)); +end; + +function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDialog) : bool; +var + Options :TSynSearchOptions; + ReplaceText, MessageText: string; + OldSelStart, OldSelLength: Integer; +begin + if (frReplaceAll in FindDialog.Options) then Options := [ssoReplaceAll] + else if (frReplace in FindDialog.Options) then Options := [ssoReplace] + else Options := [ssoSelectedOnly]; + + if (frMatchCase in FindDialog.Options) then Options := Options + [ssoMatchCase]; + if (frWholeWord in FindDialog.Options) then Options := Options + [ssoWholeWord]; + if (not (frDown in FindDialog.Options)) then Options := Options + [ssoBackwards]; + + if (ssoSelectedOnly in Options) + then ReplaceText := '' + else ReplaceText := TReplaceDialog(FindDialog).ReplaceText; + + OldSelStart := SelStart; OldSelLength := SelLength; + if (UpperCase(SelText) = UpperCase(FindDialog.FindText)) and not (frReplace in FindDialog.Options) then + SelStart := SelStart + SelLength + else + SelLength := 0; + + Result := SearchReplace(FindDialog.FindText, ReplaceText, Options) > 0; + if not Result then + begin + SelStart := OldSelStart; SelLength := OldSelLength; + if Assigned(OnSearchNotFound) then + OnSearchNotFound(self, FindDialog.FindText) + else + begin + MessageText := Format(STextNotFound, [FindDialog.FindText]); + ShowMessage(MessageText); + end; + end + else if (frReplace in FindDialog.Options) then + begin + SelStart := SelStart - Length(FindDialog.FindText) - 1; + SelLength := Length(FindDialog.FindText) + 1; + end; +end; + +procedure TCustomSynEdit.FindDialogClose(Sender: TObject); +begin + TFindDialog(Sender).OnFind := FOnFindBeforeSearch; + if Sender is TReplaceDialog then + TReplaceDialog(Sender).OnReplace := FOnReplaceBeforeSearch; + TFindDialog(Sender).OnClose := FOnCloseBeforeSearch; +end; +{$ENDIF} + +function TCustomSynEdit.GetWordWrap: Boolean; +begin + Result := FWordWrapPlugin <> nil; +end; + +procedure TCustomSynEdit.SetWordWrap(const Value: Boolean); +var + vTempBlockBegin, vTempBlockEnd : TBufferCoord; + vOldTopLine: Integer; + vShowCaret: Boolean; +begin + if WordWrap <> Value then + begin + Invalidate; // better Invalidate before changing LeftChar and TopLine + vShowCaret := CaretInView; + vOldTopLine := RowToLine(TopLine); +{$IFDEF SYN_CodeFolding} + // !!Mutually exclusive with CodeFolding to reduce complexity + if Value and not UseCodeFolding then +{$ELSE} + if Value then +{$ENDIF} + begin + FWordWrapPlugin := TSynWordWrapPlugin.Create(Self); + LeftChar := 1; + end + else + FWordWrapPlugin := nil; + TopLine := LineToRow(vOldTopLine); + UpdateScrollBars; + + // constrain caret position to MaxScrollWidth if eoScrollPastEol is enabled + if (eoScrollPastEol in Options) then + begin + InternalCaretXY := CaretXY; + vTempBlockBegin := BlockBegin; + vTempBlockEnd := BlockEnd; + SetBlockBegin(vTempBlockBegin); + SetBlockEnd(vTempBlockEnd); + end; + if vShowCaret then + EnsureCursorPosVisible; + end; +end; + +function TCustomSynEdit.GetDisplayLineCount: Integer; +begin +{$IFDEF SYN_CodeFolding} + if fWordWrapPlugin = nil then begin + if fUseCodeFolding then + Result := LineToRow(Lines.Count) + else + Result := Lines.Count + end else if Lines.Count = 0 then +{$ELSE} + if FWordWrapPlugin = nil then + Result := Lines.Count + else if Lines.Count = 0 then +{$ENDIF} + Result := 0 + else begin + Result := FWordWrapPlugin.RowCount; + end; +end; + +function TCustomSynEdit.LineToRow(aLine: Integer): Integer; +var + vBufferPos: TBufferCoord; +begin +{$IFDEF SYN_CodeFolding} + if not WordWrap and not UseCodeFolding then +{$ELSE} + if not WordWrap then +{$ENDIF} + Result := aLine + else begin + vBufferPos.Char := 1; + vBufferPos.Line := aLine; + Result := BufferToDisplayPos(vBufferPos).Row; + end; +end; + +function TCustomSynEdit.RowToLine(aRow: Integer): Integer; +var + vDisplayPos: TDisplayCoord; +begin +{$IFDEF SYN_CodeFolding} + if not WordWrap and not UseCodeFolding then +{$ELSE} + if not WordWrap then +{$ENDIF} + Result := aRow + else begin + vDisplayPos.Column := 1; + vDisplayPos.Row := aRow; + Result := DisplayToBufferPos(vDisplayPos).Line; + end; +end; + +procedure TCustomSynEdit.SetInternalDisplayXY(const aPos: TDisplayCoord); +begin + IncPaintLock; + InternalCaretXY := DisplayToBufferPos(aPos); + FCaretAtEOL := WordWrap and (aPos.Row <= FWordWrapPlugin.RowCount) and + (aPos.Column > FWordWrapPlugin.GetRowLength(aPos.Row)) and + (DisplayY <> aPos.Row); + DecPaintLock; + UpdateLastCaretX; +end; + +procedure TCustomSynEdit.SetWantReturns(Value: Boolean); +begin + FWantReturns := Value; +end; + +procedure TCustomSynEdit.SetWantTabs(Value: Boolean); +begin + FWantTabs := Value; +end; + +procedure TCustomSynEdit.SetWordWrapGlyph(const Value: TSynGlyph); +begin + FWordWrapGlyph.Assign(Value); +end; + +procedure TCustomSynEdit.WordWrapGlyphChange(Sender: TObject); +begin + if not (csLoading in ComponentState) then + InvalidateGutter; +end; + + +{ TSynEditMark } + +function TSynEditMark.GetEdit: TCustomSynEdit; +begin + if FEdit <> nil then try + if FEdit.Marks.IndexOf(self) = -1 then + FEdit := nil; + except + FEdit := nil; + end; + Result := FEdit; +end; + +function TSynEditMark.GetIsBookmark: Boolean; +begin + Result := (FBookmarkNum >= 0); +end; + +procedure TSynEditMark.SetChar(const Value: Integer); +begin + FChar := Value; +end; + +procedure TSynEditMark.SetImage(const Value: Integer); +begin + FImage := Value; + if FVisible and Assigned(FEdit) then + FEdit.InvalidateGutterLines(FLine, FLine); +end; + +procedure TSynEditMark.SetInternalImage(const Value: Boolean); +begin + FInternalImage := Value; + if FVisible and Assigned(FEdit) then + FEdit.InvalidateGutterLines(FLine, FLine); +end; + +procedure TSynEditMark.SetLine(const Value: Integer); +begin + if FVisible and Assigned(FEdit) then + begin + if FLine > 0 then + FEdit.InvalidateGutterLines(FLine, FLine); + FLine := Value; + FEdit.InvalidateGutterLines(FLine, FLine); + end + else + FLine := Value; +end; + +procedure TSynEditMark.SetVisible(const Value: Boolean); +begin + if FVisible <> Value then + begin + FVisible := Value; + if Assigned(FEdit) then + FEdit.InvalidateGutterLines(FLine, FLine); + end; +end; + +constructor TSynEditMark.Create(AOwner: TCustomSynEdit); +begin + inherited Create; + FBookmarkNum := -1; + FEdit := AOwner; +end; + +{ TSynEditMarkList } + +procedure TSynEditMarkList.Notify(Ptr: Pointer; Action: TListNotification); +begin + inherited; + if Assigned(FOnChange) then + FOnChange(Self); +end; + +function TSynEditMarkList.GetItem(Index: Integer): TSynEditMark; +begin + Result := TSynEditMark(inherited GetItem(Index)); +end; + +procedure TSynEditMarkList.SetItem(Index: Integer; Item: TSynEditMark); +begin + inherited SetItem(Index, Item); +end; + +constructor TSynEditMarkList.Create(AOwner: TCustomSynEdit); +begin + inherited Create; + FEdit := AOwner; +end; + +function TSynEditMarkList.First: TSynEditMark; +begin + Result := TSynEditMark(inherited First); +end; + +function TSynEditMarkList.Last: TSynEditMark; +begin + Result := TSynEditMark(inherited Last); +end; + +function TSynEditMarkList.Extract(Item: TSynEditMark): TSynEditMark; +begin + Result := TSynEditMark(inherited Extract(Item)); +end; + +procedure TSynEditMarkList.ClearLine(Line: Integer); +var + i: Integer; +begin + for i := Count - 1 downto 0 do + if not Items[i].IsBookmark and (Items[i].Line = Line) then + Delete(i); +end; + +procedure TSynEditMarkList.GetMarksForLine(line: Integer; var marks: TSynEditMarks); +//Returns up to maxMarks book/gutter marks for a chosen line. +var + cnt: Integer; + i: Integer; +begin + FillChar(marks, SizeOf(marks), 0); + cnt := 0; + for i := 0 to Count - 1 do + begin + if Items[i].Line = line then + begin + Inc(cnt); + marks[cnt] := Items[i]; + if cnt = MAX_MARKS then + Break; + end; + end; +end; + +procedure TSynEditMarkList.Place(mark: TSynEditMark); +begin + if assigned(FEdit) then + if Assigned(FEdit.OnPlaceBookmark) then + FEdit.OnPlaceBookmark(FEdit, mark); + if assigned(mark) then + Add(mark); +end; + +{ TSynEditPlugin } + +constructor TSynEditPlugin.Create(AOwner: TCustomSynEdit); +begin + inherited Create; + if AOwner <> nil then + begin + FOwner := AOwner; + if FOwner.FPlugins = nil then + FOwner.FPlugins := TObjectList.Create; + FOwner.FPlugins.Add(Self); + end; +end; + +destructor TSynEditPlugin.Destroy; +begin + if FOwner <> nil then + FOwner.FPlugins.Extract(Self); // we are being destroyed, FOwner should not free us + inherited Destroy; +end; + +procedure TSynEditPlugin.AfterPaint(ACanvas: TCanvas; const AClip: TRect; + FirstLine, LastLine: Integer); +begin + // nothing +end; + +procedure TSynEditPlugin.PaintTransient(ACanvas: TCanvas; ATransientType: TTransientType); +begin + // nothing +end; + +procedure TSynEditPlugin.LinesInserted(FirstLine, Count: Integer); +begin + // nothing +end; + +procedure TSynEditPlugin.LinesDeleted(FirstLine, Count: Integer); +begin + // nothing +end; + +{$IFNDEF UNICODE} +var + GetMsgHook: HHOOK; + +function GetMsgProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; +var +{$IFNDEF SYN_COMPILER_9_UP} + WndProc: Pointer; +{$ENDIF} + WinCtrl: TWinControl; +begin + WinCtrl := TCustomSynEdit(FindControl(PMsg(lParam)^.hWnd)); + if WinCtrl is TCustomSynEdit then + begin + TCustomSynEdit(WinCtrl).FWindowProducedMessage := True; + +{$IFNDEF SYN_COMPILER_9_UP} + if Code = HC_ACTION then + begin + with PMsg(lParam)^ do + case message of + WM_CHAR: + begin + if wParam > Ord(High(AnsiChar)) then + if IsWindowUnicode(hWnd) then + begin + WndProc := Pointer(GetWindowLong(hWnd, GWL_WNDPROC)); + CallWindowProcW(WndProc, hWnd, WM_CHAR, wParam, lParam); + Message := WM_NULL; + end; + end; + end; + end; +{$ENDIF} + + end; + + Result := CallNextHookEx(GetMsgHook, Code, wParam, lParam); +end; +{$ENDIF} + +initialization +{$IFNDEF UNICODE} + if Win32PlatformIsUnicode and not (csDesigning in Application.ComponentState) then + begin + // Hooking GetMessage/PeekMessage-calls is necessary as the use of + // PeekMessageA in TApplication.ProcessMessage mutilates Unicode-messages. + GetMsgHook := SetWindowsHookExW(WH_GETMESSAGE, GetMsgProc, 0, + GetCurrentThreadId); + end + else + GetMsgHook := 0; +{$ENDIF} + SynEditClipboardFormat := RegisterClipboardFormat(SYNEDIT_CLIPBOARD_FORMAT); + +finalization +{$IFNDEF UNICODE} + if Win32PlatformIsUnicode and (GetMsgHook <> 0) then + UnhookWindowsHookEx(GetMsgHook); +{$ENDIF} + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditAutoComplete.pas b/Source/VCL/SynEdit/Source/SynEditAutoComplete.pas index 897e60fb..ca341c61 100644 --- a/Source/VCL/SynEdit/Source/SynEditAutoComplete.pas +++ b/Source/VCL/SynEdit/Source/SynEditAutoComplete.pas @@ -1,511 +1,517 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditAutoComplete.pas, released 2000-06-25. - -The Initial Author of the Original Code is Michael Hieke. -Portions written by Michael Hieke are Copyright 2000 Michael Hieke. -Portions written by Cyrille de Brebisson (from mwCompletionProposal.pas) are -Copyright 1999 Cyrille de Brebisson. -Unicode translation by Maël Hörz. -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: SynEditAutoComplete.pas,v 1.10.2.4 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditAutoComplete; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Menus, - SynEdit, - SynEditTypes, - SynEditKeyCmds, - SynUnicode, - Classes; - -type - TCustomSynAutoComplete = class(TComponent) - protected - fAutoCompleteList: TStrings; - fCompletions: TStrings; - fCompletionComments: TStrings; - fCompletionValues: TStrings; - fEditor: TCustomSynEdit; - fEditors: TList; - fEOTokenChars: string; - fCaseSensitive: boolean; - fParsed: boolean; - procedure CompletionListChanged(Sender: TObject); - procedure DefineProperties(Filer: TFiler); override; - function GetCompletions: TStrings; - function GetCompletionComments: TStrings; - function GetCompletionValues: TStrings; - function GetEditorCount: integer; - function GetNthEditor(Index: integer): TCustomSynEdit; - procedure SetAutoCompleteList(Value: TStrings); virtual; - procedure SetEditor(Value: TCustomSynEdit); - procedure SynEditCommandHandler(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: pointer; HandlerData: pointer); - procedure Notification(AComponent: TComponent; Operation: TOperation); - override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - function AddEditor(AEditor: TCustomSynEdit): boolean; - function RemoveEditor(AEditor: TCustomSynEdit): boolean; - - procedure AddCompletion(const AToken, AValue, AComment: string); - procedure Execute(AEditor: TCustomSynEdit); virtual; - procedure ExecuteCompletion(const AToken: string; AEditor: TCustomSynEdit); - virtual; - procedure ParseCompletionList; virtual; - public - property AutoCompleteList: TStrings read fAutoCompleteList - write SetAutoCompleteList; - property CaseSensitive: boolean read fCaseSensitive write fCaseSensitive; - property Completions: TStrings read GetCompletions; - property CompletionComments: TStrings read GetCompletionComments; - property CompletionValues: TStrings read GetCompletionValues; - property Editor: TCustomSynEdit read fEditor write SetEditor; - property EditorCount: integer read GetEditorCount; - property Editors[Index: integer]: TCustomSynEdit read GetNthEditor; - property EndOfTokenChr: string read fEOTokenChars write fEOTokenChars; - end; - - TSynAutoComplete = class(TCustomSynAutoComplete) - published - property AutoCompleteList; - property CaseSensitive; - property Editor; - property EndOfTokenChr; - end; - -implementation - -uses - SysUtils; - -{ TCustomSynAutoComplete } - -procedure TCustomSynAutoComplete.AddCompletion(const AToken, AValue, AComment: string); -begin - if AToken <> '' then - begin - if (fAutoCompleteList.Count = 0) and (fCompletions.Count = 0) then - fParsed := True; - fCompletions.Add(AToken); - fCompletionComments.Add(AComment); - fCompletionValues.Add(AValue); - end; -end; - -function TCustomSynAutoComplete.AddEditor(AEditor: TCustomSynEdit): boolean; -var - i: integer; -begin - if AEditor <> nil then - begin - i := fEditors.IndexOf(AEditor); - if i = -1 then - begin - AEditor.FreeNotification(Self); - fEditors.Add(AEditor); - AEditor.RegisterCommandHandler(SynEditCommandHandler, nil); - end; - Result := True; - end - else - Result := False; -end; - -procedure TCustomSynAutoComplete.CompletionListChanged(Sender: TObject); -begin - fParsed := False; -end; - -constructor TCustomSynAutoComplete.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fAutoCompleteList := TStringList.Create; - TStringList(fAutoCompleteList).OnChange := CompletionListChanged; - fCompletions := TStringList.Create; - fCompletionComments := TStringList.Create; - fCompletionValues := TStringList.Create; - fEditors := TList.Create; - fEOTokenChars := '()[]{}.'; -end; - -destructor TCustomSynAutoComplete.Destroy; -begin - Editor := nil; - while EditorCount > 0 do - RemoveEditor(TCustomSynEdit(fEditors.Last)); - - inherited Destroy; - fEditors.Free; - fCompletions.Free; - fCompletionComments.Free; - fCompletionValues.Free; - fAutoCompleteList.Free; -end; - -procedure TCustomSynAutoComplete.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -procedure TCustomSynAutoComplete.Execute(AEditor: TCustomSynEdit); -var - s: string; - i, j: integer; -begin - if AEditor <> nil then - begin - // get token - s := AEditor.LineText; - j := AEditor.CaretX; - i := j - 1; - if i <= Length(s) then - begin - while (i > 0) and (s[i] > ' ') and (Pos(s[i], fEOTokenChars) = 0) do - Dec(i); - Inc(i); - s := Copy(s, i, j - i); - ExecuteCompletion(s, AEditor); - end; - end; -end; - -procedure TCustomSynAutoComplete.ExecuteCompletion(const AToken: string; - AEditor: TCustomSynEdit); -var - i, j, Len, IndentLen: integer; - s: string; - IdxMaybe, NumMaybe: integer; - p: TBufferCoord; - NewCaretPos: boolean; - Temp: TStringList; -begin - if not fParsed then - ParseCompletionList; - Len := Length(AToken); - if (Len > 0) and (AEditor <> nil) and not AEditor.ReadOnly - and (fCompletions.Count > 0) then - begin - // find completion for this token - not all chars necessary if unambiguous - i := fCompletions.Count - 1; - IdxMaybe := -1; - NumMaybe := 0; - if fCaseSensitive then - begin - while i > -1 do - begin - s := fCompletions[i]; - if WideCompareStr(s, AToken) = 0 then - break - else if WideCompareStr(Copy(s, 1, Len), AToken) = 0 then - begin - Inc(NumMaybe); - IdxMaybe := i; - end; - Dec(i); - end; - end - else - begin - while i > -1 do - begin - s := fCompletions[i]; - if WideCompareText(s, AToken) = 0 then - break - else if WideCompareText(Copy(s, 1, Len), AToken) = 0 then - begin - Inc(NumMaybe); - IdxMaybe := i; - end; - Dec(i); - end; - end; - if (i = -1) and (NumMaybe = 1) then - i := IdxMaybe; - if i > -1 then - begin - // select token in editor - p := AEditor.CaretXY; - AEditor.BeginUpdate; - try - AEditor.BlockBegin := BufferCoord(p.Char - Len, p.Line); - AEditor.BlockEnd := p; - // indent the completion string if necessary, determine the caret pos - IndentLen := p.Char - Len - 1; - p := AEditor.BlockBegin; - NewCaretPos := False; - Temp := TStringList.Create; - try - Temp.Text := fCompletionValues[i]; - // indent lines - if (IndentLen > 0) and (Temp.Count > 1) then - begin - s := StringofChar(' ', IndentLen); - for i := 1 to Temp.Count - 1 do - Temp[i] := s + Temp[i]; - end; - // find first '|' and use it as caret position - for i := 0 to Temp.Count - 1 do - begin - s := Temp[i]; - j := Pos('|', s); - if j > 0 then - begin - Delete(s, j, 1); - Temp[i] := s; -// if j > 1 then -// Dec(j); - NewCaretPos := True; - Inc(p.Line, i); - if i = 0 then -// Inc(p.x, j) - Inc(p.Char, j - 1) - else - p.Char := j; - break; - end; - end; - s := Temp.Text; - // strip the trailing #13#10 that was appended by the stringlist - i := Length(s); - if (i >= 2) and (s[i - 1] = #13) and (s[i] = #10) then - SetLength(s, i - 2); - finally - Temp.Free; - end; - // replace the selected text and position the caret - AEditor.SelText := s; - if NewCaretPos then - AEditor.CaretXY := p; - finally - AEditor.EndUpdate; - end; - end; - end; -end; - -function TCustomSynAutoComplete.GetCompletions: TStrings; -begin - if not fParsed then - ParseCompletionList; - Result := fCompletions; -end; - -function TCustomSynAutoComplete.GetCompletionComments: TStrings; -begin - if not fParsed then - ParseCompletionList; - Result := fCompletionComments; -end; - -function TCustomSynAutoComplete.GetCompletionValues: TStrings; -begin - if not fParsed then - ParseCompletionList; - Result := fCompletionValues; -end; - -function TCustomSynAutoComplete.GetEditorCount: integer; -begin - Result := fEditors.Count; -end; - -function TCustomSynAutoComplete.GetNthEditor(Index: integer): TCustomSynEdit; -begin - if (Index >= 0) and (Index < fEditors.Count) then - Result := fEditors[Index] - else - Result := nil; -end; - -procedure TCustomSynAutoComplete.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited Notification(AComponent, Operation); - if Operation = opRemove then - begin - if AComponent = Editor then - Editor := nil - else if AComponent is TCustomSynEdit then - RemoveEditor(TCustomSynEdit(AComponent)); - end; -end; - -procedure TCustomSynAutoComplete.ParseCompletionList; -var - BorlandDCI: boolean; - i, j, Len: integer; - s, sCompl, sComment, sComplValue: string; - - procedure SaveEntry; - begin - fCompletions.Add(sCompl); - sCompl := ''; - fCompletionComments.Add(sComment); - sComment := ''; - fCompletionValues.Add(sComplValue); - sComplValue := ''; - end; - -begin - fCompletions.Clear; - fCompletionComments.Clear; - fCompletionValues.Clear; - - if fAutoCompleteList.Count > 0 then - begin - s := fAutoCompleteList[0]; - BorlandDCI := (s <> '') and (s[1] = '['); - - sCompl := ''; - sComment := ''; - sComplValue := ''; - for i := 0 to fAutoCompleteList.Count - 1 do - begin - s := fAutoCompleteList[i]; - Len := Length(s); - if BorlandDCI then - begin - // the style of the Delphi32.dci file - if (Len > 0) and (s[1] = '[') then - begin - // save last entry - if sCompl <> '' then - SaveEntry; - // new completion entry - j := 2; - while (j <= Len) and (s[j] > ' ') do - Inc(j); - sCompl := Copy(s, 2, j - 2); - // start of comment in DCI file - while (j <= Len) and (s[j] <= ' ') do - Inc(j); - if (j <= Len) and (s[j] = '|') then - Inc(j); - while (j <= Len) and (s[j] <= ' ') do - Inc(j); - sComment := Copy(s, j, Len); - if sComment[Length(sComment)] = ']' then - SetLength(sComment, Length(sComment) - 1); - end - else - begin - if sComplValue <> '' then - sComplValue := sComplValue + #13#10; - sComplValue := sComplValue + s; - end; - end - else - begin - // the original style - if (Len > 0) and (s[1] <> '=') then - begin - // save last entry - if sCompl <> '' then - SaveEntry; - // new completion entry - sCompl := s; - end - else if (Len > 0) and (s[1] = '=') then - begin - if sComplValue <> '' then - sComplValue := sComplValue + #13#10; - sComplValue := sComplValue + Copy(s, 2, Len); - end; - end; - end; - if sCompl <> '' then //mg 2000-11-07 - SaveEntry; - end; - fParsed := True; -end; - -function TCustomSynAutoComplete.RemoveEditor(AEditor: TCustomSynEdit): boolean; -var - i: integer; -begin - if AEditor <> nil then - begin - i := fEditors.IndexOf(AEditor); - if (i > -1) then - begin - if fEditor = AEditor then - fEditor := nil; - fEditors.Delete(i); - AEditor.UnregisterCommandHandler(SynEditCommandHandler); - RemoveFreeNotification(AEditor); - end; - end; - Result := False; -end; - -procedure TCustomSynAutoComplete.SetAutoCompleteList(Value: TStrings); -begin - fAutoCompleteList.Assign(Value); - fParsed := False; -end; - -procedure TCustomSynAutoComplete.SetEditor(Value: TCustomSynEdit); -begin - if Value <> fEditor then - begin - if fEditor <> nil then - RemoveEditor(fEditor); - fEditor := Value; - if (Value <> nil) then - AddEditor(Value); - end; -end; - -procedure TCustomSynAutoComplete.SynEditCommandHandler(Sender: TObject; - AfterProcessing: boolean; var Handled: boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data: pointer; - HandlerData: pointer); -begin - if not AfterProcessing and not Handled and (Command = ecAutoCompletion) then - begin - Handled := True; - Execute(Sender as TCustomSynEdit); - end; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditAutoComplete.pas, released 2000-06-25. + +The Initial Author of the Original Code is Michael Hieke. +Portions written by Michael Hieke are Copyright 2000 Michael Hieke. +Portions written by Cyrille de Brebisson (from mwCompletionProposal.pas) are +Copyright 1999 Cyrille de Brebisson. +Unicode translation by Maël Hörz. +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: SynEditAutoComplete.pas,v 1.10.2.4 2008/09/14 16:24:58 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITAUTOCOMPLETE} +unit SynEditAutoComplete; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + Menus, + SynEdit, + SynEditKeyCmds, + SynUnicode, + Classes; + +type + TCustomSynAutoComplete = class(TComponent) + protected + FAutoCompleteList: TUnicodeStrings; + FCompletions: TUnicodeStrings; + FCompletionComments: TUnicodeStrings; + FCompletionValues: TUnicodeStrings; + FEditor: TCustomSynEdit; + FEditors: TList; + FEOTokenChars: UnicodeString; + FCaseSensitive: Boolean; + FParsed: Boolean; + procedure CompletionListChanged(Sender: TObject); + procedure DefineProperties(Filer: TFiler); override; + function GetCompletions: TUnicodeStrings; + function GetCompletionComments: TUnicodeStrings; + function GetCompletionValues: TUnicodeStrings; + function GetEditorCount: Integer; + function GetNthEditor(Index: Integer): TCustomSynEdit; + procedure SetAutoCompleteList(Value: TUnicodeStrings); virtual; + procedure SetEditor(Value: TCustomSynEdit); + procedure SynEditCommandHandler(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data, HandlerData: Pointer); + procedure Notification(AComponent: TComponent; Operation: TOperation); + override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + function AddEditor(AEditor: TCustomSynEdit): Boolean; + function RemoveEditor(AEditor: TCustomSynEdit): Boolean; + + procedure AddCompletion(const AToken, AValue, AComment: UnicodeString); + procedure Execute(AEditor: TCustomSynEdit); virtual; + procedure ExecuteCompletion(const AToken: UnicodeString; AEditor: TCustomSynEdit); + virtual; + procedure ParseCompletionList; virtual; + public + property AutoCompleteList: TUnicodeStrings read FAutoCompleteList + write SetAutoCompleteList; + property CaseSensitive: Boolean read FCaseSensitive write FCaseSensitive; + property Completions: TUnicodeStrings read GetCompletions; + property CompletionComments: TUnicodeStrings read GetCompletionComments; + property CompletionValues: TUnicodeStrings read GetCompletionValues; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property EditorCount: Integer read GetEditorCount; + property Editors[Index: Integer]: TCustomSynEdit read GetNthEditor; + property EndOfTokenChr: UnicodeString read FEOTokenChars write FEOTokenChars; + end; + + TSynAutoComplete = class(TCustomSynAutoComplete) + published + property AutoCompleteList; + property CaseSensitive; + property Editor; + property EndOfTokenChr; + end; + +implementation + +uses + SynEditTypes, + SysUtils; + +{ TCustomSynAutoComplete } + +procedure TCustomSynAutoComplete.AddCompletion(const AToken, AValue, AComment: UnicodeString); +begin + if AToken <> '' then + begin + if (FAutoCompleteList.Count = 0) and (FCompletions.Count = 0) then + FParsed := True; + FCompletions.Add(AToken); + FCompletionComments.Add(AComment); + FCompletionValues.Add(AValue); + end; +end; + +function TCustomSynAutoComplete.AddEditor(AEditor: TCustomSynEdit): Boolean; +var + i: Integer; +begin + if AEditor <> nil then + begin + i := FEditors.IndexOf(AEditor); + if i = -1 then + begin + AEditor.FreeNotification(Self); + FEditors.Add(AEditor); + AEditor.RegisterCommandHandler(SynEditCommandHandler, nil); + end; + Result := True; + end + else + Result := False; +end; + +procedure TCustomSynAutoComplete.CompletionListChanged(Sender: TObject); +begin + FParsed := False; +end; + +constructor TCustomSynAutoComplete.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FAutoCompleteList := TUnicodeStringList.Create; + TUnicodeStringList(FAutoCompleteList).OnChange := CompletionListChanged; + FCompletions := TUnicodeStringList.Create; + FCompletionComments := TUnicodeStringList.Create; + FCompletionValues := TUnicodeStringList.Create; + FEditors := TList.Create; + FEOTokenChars := '()[]{}.'; +end; + +destructor TCustomSynAutoComplete.Destroy; +begin + Editor := nil; + while EditorCount > 0 do + RemoveEditor(TCustomSynEdit(FEditors.Last)); + + inherited Destroy; + FEditors.Free; + FCompletions.Free; + FCompletionComments.Free; + FCompletionValues.Free; + FAutoCompleteList.Free; +end; + +procedure TCustomSynAutoComplete.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +procedure TCustomSynAutoComplete.Execute(AEditor: TCustomSynEdit); +var + s: UnicodeString; + i, j: Integer; +begin + if AEditor <> nil then + begin + // get token + s := AEditor.LineText; + j := AEditor.CaretX; + i := j - 1; + if i <= Length(s) then + begin + while (i > 0) and (s[i] > ' ') and (Pos(s[i], FEOTokenChars) = 0) do + Dec(i); + Inc(i); + s := Copy(s, i, j - i); + ExecuteCompletion(s, AEditor); + end; + end; +end; + +procedure TCustomSynAutoComplete.ExecuteCompletion(const AToken: UnicodeString; + AEditor: TCustomSynEdit); +var + i, j, Len, IndentLen: Integer; + s: UnicodeString; + IdxMaybe, NumMaybe: Integer; + p: TBufferCoord; + NewCaretPos: Boolean; + Temp: TUnicodeStringList; +begin + if not FParsed then + ParseCompletionList; + Len := Length(AToken); + if (Len > 0) and (AEditor <> nil) and not AEditor.ReadOnly + and (FCompletions.Count > 0) then + begin + // find completion for this token - not all chars necessary if unambiguous + i := FCompletions.Count - 1; + IdxMaybe := -1; + NumMaybe := 0; + if FCaseSensitive then + begin + while i > -1 do + begin + s := FCompletions[i]; + if WideCompareStr(s, AToken) = 0 then + Break + else if WideCompareStr(Copy(s, 1, Len), AToken) = 0 then + begin + Inc(NumMaybe); + IdxMaybe := i; + end; + Dec(i); + end; + end + else + begin + while i > -1 do + begin + s := FCompletions[i]; + if WideCompareText(s, AToken) = 0 then + Break + else if WideCompareText(Copy(s, 1, Len), AToken) = 0 then + begin + Inc(NumMaybe); + IdxMaybe := i; + end; + Dec(i); + end; + end; + if (i = -1) and (NumMaybe = 1) then + i := IdxMaybe; + if i > -1 then + begin + // select token in editor + p := AEditor.CaretXY; + AEditor.BeginUpdate; + try + AEditor.BlockBegin := BufferCoord(p.Char - Len, p.Line); + AEditor.BlockEnd := p; + // indent the completion string if necessary, determine the caret pos + IndentLen := p.Char - Len - 1; + p := AEditor.BlockBegin; + NewCaretPos := False; + Temp := TUnicodeStringList.Create; + try + Temp.Text := FCompletionValues[i]; + // indent lines + if (IndentLen > 0) and (Temp.Count > 1) then + begin + s := UnicodeStringOfChar(' ', IndentLen); + for i := 1 to Temp.Count - 1 do + Temp[i] := s + Temp[i]; + end; + // find first '|' and use it as caret position + for i := 0 to Temp.Count - 1 do + begin + s := Temp[i]; + j := Pos('|', s); + if j > 0 then + begin + Delete(s, j, 1); + Temp[i] := s; +// if j > 1 then +// Dec(j); + NewCaretPos := True; + Inc(p.Line, i); + if i = 0 then +// Inc(p.x, j) + Inc(p.Char, j - 1) + else + p.Char := j; + Break; + end; + end; + s := Temp.Text; + // strip the trailing #13#10 that was appended by the stringlist + i := Length(s); + if (i >= 2) and (s[i - 1] = #13) and (s[i] = #10) then + SetLength(s, i - 2); + finally + Temp.Free; + end; + // replace the selected text and position the caret + AEditor.SelText := s; + if NewCaretPos then + AEditor.CaretXY := p; + finally + AEditor.EndUpdate; + end; + end; + end; +end; + +function TCustomSynAutoComplete.GetCompletions: TUnicodeStrings; +begin + if not FParsed then + ParseCompletionList; + Result := FCompletions; +end; + +function TCustomSynAutoComplete.GetCompletionComments: TUnicodeStrings; +begin + if not FParsed then + ParseCompletionList; + Result := FCompletionComments; +end; + +function TCustomSynAutoComplete.GetCompletionValues: TUnicodeStrings; +begin + if not FParsed then + ParseCompletionList; + Result := FCompletionValues; +end; + +function TCustomSynAutoComplete.GetEditorCount: Integer; +begin + Result := FEditors.Count; +end; + +function TCustomSynAutoComplete.GetNthEditor(Index: Integer): TCustomSynEdit; +begin + if (Index >= 0) and (Index < FEditors.Count) then + Result := FEditors[Index] + else + Result := nil; +end; + +procedure TCustomSynAutoComplete.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if Operation = opRemove then + begin + if AComponent = Editor then + Editor := nil + else if AComponent is TCustomSynEdit then + RemoveEditor(TCustomSynEdit(AComponent)); + end; +end; + +procedure TCustomSynAutoComplete.ParseCompletionList; +var + BorlandDCI: Boolean; + i, j, Len: Integer; + s, sCompl, sComment, sComplValue: UnicodeString; + + procedure SaveEntry; + begin + FCompletions.Add(sCompl); + sCompl := ''; + FCompletionComments.Add(sComment); + sComment := ''; + FCompletionValues.Add(sComplValue); + sComplValue := ''; + end; + +begin + FCompletions.Clear; + FCompletionComments.Clear; + FCompletionValues.Clear; + + if FAutoCompleteList.Count > 0 then + begin + s := FAutoCompleteList[0]; + BorlandDCI := (s <> '') and (s[1] = '['); + + sCompl := ''; + sComment := ''; + sComplValue := ''; + for i := 0 to FAutoCompleteList.Count - 1 do + begin + s := FAutoCompleteList[i]; + Len := Length(s); + if BorlandDCI then + begin + // the style of the Delphi32.dci file + if (Len > 0) and (s[1] = '[') then + begin + // save last entry + if sCompl <> '' then + SaveEntry; + // new completion entry + j := 2; + while (j <= Len) and (s[j] > ' ') do + Inc(j); + sCompl := Copy(s, 2, j - 2); + // start of comment in DCI file + while (j <= Len) and (s[j] <= ' ') do + Inc(j); + if (j <= Len) and (s[j] = '|') then + Inc(j); + while (j <= Len) and (s[j] <= ' ') do + Inc(j); + sComment := Copy(s, j, Len); + if sComment[Length(sComment)] = ']' then + SetLength(sComment, Length(sComment) - 1); + end + else + begin + if sComplValue <> '' then + sComplValue := sComplValue + #13#10; + sComplValue := sComplValue + s; + end; + end + else + begin + // the original style + if (Len > 0) and (s[1] <> '=') then + begin + // save last entry + if sCompl <> '' then + SaveEntry; + // new completion entry + sCompl := s; + end + else if (Len > 0) and (s[1] = '=') then + begin + if sComplValue <> '' then + sComplValue := sComplValue + #13#10; + sComplValue := sComplValue + Copy(s, 2, Len); + end; + end; + end; + if sCompl <> '' then //mg 2000-11-07 + SaveEntry; + end; + FParsed := True; +end; + +function TCustomSynAutoComplete.RemoveEditor(AEditor: TCustomSynEdit): Boolean; +var + i: Integer; +begin + if AEditor <> nil then + begin + i := FEditors.IndexOf(AEditor); + if (i > -1) then + begin + if FEditor = AEditor then + FEditor := nil; + FEditors.Delete(i); + AEditor.UnregisterCommandHandler(SynEditCommandHandler); + {$IFDEF SYN_COMPILER_5_UP} + RemoveFreeNotification(AEditor); + {$ENDIF} + end; + end; + Result := False; +end; + +procedure TCustomSynAutoComplete.SetAutoCompleteList(Value: TUnicodeStrings); +begin + FAutoCompleteList.Assign(Value); + FParsed := False; +end; + +procedure TCustomSynAutoComplete.SetEditor(Value: TCustomSynEdit); +begin + if Value <> FEditor then + begin + if FEditor <> nil then + RemoveEditor(FEditor); + FEditor := Value; + if (Value <> nil) then + AddEditor(Value); + end; +end; + +procedure TCustomSynAutoComplete.SynEditCommandHandler(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data, + HandlerData: Pointer); +begin + if not AfterProcessing and not Handled and (Command = ecAutoCompletion) then + begin + Handled := True; + Execute(Sender as TCustomSynEdit); + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditCodeFolding.pas b/Source/VCL/SynEdit/Source/SynEditCodeFolding.pas index 10b601e2..e9228bed 100644 --- a/Source/VCL/SynEdit/Source/SynEditCodeFolding.pas +++ b/Source/VCL/SynEdit/Source/SynEditCodeFolding.pas @@ -8,6 +8,10 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. + The Original Code is SynEditWordWrap.pas by Flávio Etrusco, released 2003-12-11. + Unicode translation by Maël Hörz. + All Rights Reserved. + Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. @@ -58,8 +62,8 @@ Python highlighters as well as the use of the OnScanForFoldRangesEvent event to support code folding in C++ files. - Synedit Commants and Shortcuts - ========= + Synedit Commands and Shortcuts + ============================== The following commands have been added: ecFoldAll, ecUnfoldAll, ecFoldNearest, ecUnfoldNearest, ecFoldLevel1, ecFoldLevel2, ecFoldLevel3,, ecUnfoldLevel1, ecUnfoldLevel2, @@ -102,16 +106,28 @@ } interface +{$I SynEdit.inc} + uses Graphics, Types, Classes, SysUtils, - System.Generics.Defaults, - System.Generics.Collections, + Generics.Defaults, + Generics.Collections, SynEditHighlighter; type +{$IFNDEF SYN_DELPHI_XE3_UP} + // use small hack in XE and XE2 to make internal array accessible as in XE3 and up + TList = class(Generics.Collections.TList) + private + function GetList: TArray; + public + property List: TArray read GetList; + end; +{$ENDIF} + // Custom COde Folding Exception TSynCodeFoldingException = class(Exception) end; @@ -161,6 +177,7 @@ TLineFoldInfo = record AFoldOpenClose : TFoldOpenClose = focOpen; AFoldType : Integer = 1; AIndent : Integer = -1); end; + private fCodeFoldingMode : TSynCodeFoldingMode; fRangesNeedFixing : Boolean; @@ -192,10 +209,8 @@ TLineFoldInfo = record function FoldsOfType(aType : integer) : TArray; {Scanning support} - procedure StoreCollapsedState; overload; - procedure RestoreCollapsedState; overload; - procedure StoreCollapsedState(Stream: TStream); overload; - procedure RestoreCollapsedState(Stream: TStream); overload; + procedure StoreCollapsedState; + procedure RestoreCollapsedState; procedure StartScanning; function StopScanning(Lines : TStrings) : Boolean; // Returns True of Ranges were updated procedure AddLineInfo(ALine: Integer; AFoldType: Integer; @@ -244,28 +259,25 @@ TSynCodeFolding = class(TPersistent) procedure SetShowCollapsedLine(const Value: Boolean); procedure SetShowHintMark(const Value: Boolean); procedure SetGutterShapeSize(const Value: Integer); - function GetGutterShapeSize: Integer; public constructor Create; procedure Assign(Source: TPersistent); override; - procedure ChangeScale(M, D: Integer); virtual; property OnChange: TSynCodeFoldingChangeEvent read fOnChange write fOnChange; published // Size of the gutter shapes in pixels at 96 PPI - had to be odd number - property GutterShapeSize: Integer read GetGutterShapeSize - write SetGutterShapeSize default 11; + property GutterShapeSize: Integer read fGutterShapeSize + write SetGutterShapeSize; property CollapsedLineColor: TColor read fCollapsedLineColor - write SetCollapsedLineColor default clGrayText; + write SetCollapsedLineColor; property FolderBarLinesColor: TColor read fFolderBarLinesColor - write SetFolderBarLinesColor default clGrayText; + write SetFolderBarLinesColor; property IndentGuidesColor: TColor read fIndentGuidesColor - write SetIndentGuidesColor default clGray; - property IndentGuides: Boolean read fIndentGuides write SetIndentGuides - default True; + write SetIndentGuidesColor; + property IndentGuides: Boolean read fIndentGuides write SetIndentGuides; property ShowCollapsedLine: Boolean read fShowCollapsedLine - write SetShowCollapsedLine default False; + write SetShowCollapsedLine; property ShowHintMark: Boolean read fShowHintMark - write SetShowHintMark default True; + write SetShowHintMark; end; TSynCustomCodeFoldingHighlighter = class(TSynCustomHighlighter) @@ -296,10 +308,18 @@ TSynCustomCodeFoldingHighlighter = class(TSynCustomHighlighter) implementation -Uses - Winapi.Windows, - System.Math, - SynEditTextBuffer; +uses + SynEditTextBuffer, + Math; + +{$IFNDEF SYN_DELPHI_XE3_UP} +function TList.GetList: TArray; +begin + // use bug that existed in XE and XE2 that made + // it possible to access private members from parent class + Result := TArray(FItems); +end; +{$ENDIF} { TSynEditFoldRanges } @@ -814,19 +834,7 @@ procedure TSynFoldRanges.Reset; fRangesNeedFixing := False; end; -procedure TSynFoldRanges.RestoreCollapsedState(Stream: TStream); -Var - Size, Line, Index : integer; -begin - Size := Stream.Size; - while Stream.Position < Size do begin - Stream.ReadData(Line); - if FoldStartAtLine(Line, Index) then - fRanges.List[Index].Collapsed := True; - end; -end; - -procedure TSynFoldRanges.RestoreCollapsedState; +procedure TSynFoldRanges.ReStoreCollapsedState; Var i, Index : integer; begin @@ -867,15 +875,6 @@ function TSynFoldRanges.StopScanning(Lines : TStrings) : Boolean; end; end; -procedure TSynFoldRanges.StoreCollapsedState(Stream: TStream); -Var - FoldRange : TSynFoldRange; -begin - for FoldRange in fRanges do - if FoldRange.Collapsed then - Stream.WriteData(FoldRange.FromLine); -end; - procedure TSynFoldRanges.StoreCollapsedState; Var FoldRange : TSynFoldRange; @@ -928,11 +927,6 @@ procedure TSynCodeFolding.Assign(Source: TPersistent); inherited Assign(Source); end; -procedure TSynCodeFolding.ChangeScale(M, D: Integer); -begin - fGutterShapeSize := MulDiv(fGutterShapeSize, M, D); -end; - constructor TSynCodeFolding.Create; begin fIndentGuides := True; @@ -944,14 +938,6 @@ constructor TSynCodeFolding.Create; fGutterShapeSize := 11; end; -function TSynCodeFolding.GetGutterShapeSize: Integer; -{ Always returns an odd number } -begin - Result := fGutterShapeSize; - if not Odd(Result) then - Dec(Result); -end; - { TSynFoldRanges.TLineFoldInfo } constructor TSynFoldRanges.TLineFoldInfo.Create(ALine: Integer; @@ -1060,6 +1046,8 @@ procedure TSynCodeFolding.SetGutterShapeSize(const Value: Integer); NewValue: Integer; begin NewValue := Value; + if not Odd(NewValue) then + Dec(NewValue); if fGutterShapeSize <> NewValue then begin fGutterShapeSize := NewValue; if Assigned(fOnChange) then fOnChange(Self); @@ -1098,5 +1086,4 @@ procedure TSynCodeFolding.SetShowCollapsedLine(const Value: Boolean); end; end; - end. diff --git a/Source/VCL/SynEdit/Source/SynEditDataObject.pas b/Source/VCL/SynEdit/Source/SynEditDataObject.pas deleted file mode 100644 index 27c6cdc5..00000000 --- a/Source/VCL/SynEdit/Source/SynEditDataObject.pas +++ /dev/null @@ -1,314 +0,0 @@ -unit SynEditDataObject; -{ - 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. - - 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. - - This unit implements the IDataObject interface for Clipboard and Drag & Drop - operations. - Code based on Grahame Marsh's articles on OLE Drag & Drop - published in UNDO (www.undo.com) -} - -interface -uses - Windows, - SysUtils, - Classes, - ActiveX, - Generics.Collections; - -Type - - TSynEnumFormatEtc = class (TInterfacedObject, IEnumFORMATETC) - private - FList : TArray; - FIndex : integer; - protected - function GetFormatEtc(ClipFormat : TClipFormat): TFormatEtc; - {IEnumFORMATETC} - function Next (celt: Longint; out elt; pceltFetched: PLongint): HResult; stdcall; - function Skip (celt: Longint): HResult; stdcall; - function Reset : HResult; stdcall; - function Clone (out Enum: IEnumFormatEtc): HResult; stdcall; - public - constructor Create (FormatList : TArray; Index : integer = 0); - end; - - TSynEditDataObject = class (TInterfacedObject, IDataObject) - private - fText : string; - FFormatEtc : TList; - MemoryStream : TMemoryStream; - protected - function GetData (const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult; overload; stdcall; - function GetDataHere (const formatetc: TFormatEtc; out medium: TStgMedium): HResult; overload; stdcall; - function QueryGetData (const formatetc: TFormatEtc): HResult; overload; stdcall; - function GetCanonicalFormatEtc (const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult; overload; stdcall; - function SetData (const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult; overload; stdcall; - function EnumFormatEtc (dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult; overload; stdcall; - function DAdvise (const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult; overload; stdcall; - function DUnadvise (dwConnection: Longint): HResult; overload; stdcall; - function EnumDAdvise (out enumAdvise: IEnumStatData): HResult; overload; stdcall; - public - constructor Create(ASynEdit : TObject); - destructor Destroy; override; - end; - -function MakeGlobal (Value : integer) : hGlobal; overload; -function MakeGlobal (const S: string): hGlobal; overload; -function MakeGlobal (var P; Size : integer) : hGlobal; overload; -function HasFormat(DataObject : IDataObject; Format : TClipFormat): Boolean; - -var - SynEditClipboardFormat: UINT; - -implementation - -uses - SynEdit; - -function MakeGlobal (const S: string): hGlobal; -var - P : PChar; - Size : Integer; -begin - Size := ByteLength(S) + SizeOf(Char); - Result := GlobalAlloc (GHND, Size); - if Result = 0 then - OutOfMemoryError; - P := GlobalLock (Result); - try - Move(PChar(S)^, P^, Size) - finally - GlobalUnlock (Result) - end -end; - -function MakeGlobal (Value : integer) : hGlobal; -begin - Result := MakeGlobal (Value, sizeof (integer)) -end; - -function MakeGlobal (var P; Size : integer) : hGlobal; -var - D : pointer; -begin - Result := GlobalAlloc (GHND, Size); - if Result = 0 then - OutOfMemoryError; - D := GlobalLock (Result); - try - Move (P, D^, Size) - finally - GlobalUnlock (Result) - end -end; - -function HasFormat(DataObject : IDataObject; Format : TClipFormat):Boolean; -Var - FormatEnumerator : IEnumFormatEtc; - FormatEtc : TFormatEtc; - Returned : integer; -begin - Result := False; - if (DataObject.EnumFormatEtc (DATADIR_GET, FormatEnumerator) = S_OK) then begin - FormatEnumerator.Reset; - while FormatEnumerator.Next (1, FormatEtc, @Returned) = S_OK do - if FormatEtc.cfFormat = Format then - Exit(True); - end; -end; - -constructor TSynEditDataObject.Create(ASynEdit : TObject); -begin - inherited Create; - MemoryStream := TMemoryStream.Create; - FFormatEtc := TList.Create; - FFormatEtc.Add(CF_UNICODETEXT); - FFormatEtc.Add(SynEditClipboardFormat); // InternalFormat - fText := (ASynEdit as TCustomSynEdit).SelText; - MemoryStream.Write((ASynEdit as TCustomSynEdit).ActiveSelectionMode, - SizeOf(TCustomSynEdit(ASynEdit).ActiveSelectionMode)); -end; - -destructor TSynEditDataObject.Destroy; -begin - FFormatEtc.Free; - MemoryStream.Free; - inherited Destroy -end; - -function TSynEditDataObject.GetData (const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult; -begin - try - Result := DV_E_FORMATETC; - ZeroMemory (@Medium, sizeof (TStgMedium)); - if FormatEtcIn.tymed and TYMED_HGLOBAL = TYMED_HGLOBAL then - begin - Medium.tymed := TYMED_HGLOBAL; - if FormatEtcIn.cfFormat = CF_UNICODETEXT then - Medium.hGlobal := MakeGlobal(FText) - else if FormatEtcIn.cfFormat = SynEditClipboardFormat then - Medium.hGlobal := MakeGlobal(MemoryStream.Memory^, MemoryStream.Position) - else - Exit; - Result := S_OK - end - except - Result := E_UNEXPECTED; - end -end; - -function TSynEditDataObject.GetDataHere (const formatetc: TFormatEtc; out medium: TStgMedium): HResult; -begin - Result := E_NOTIMPL; -end; - -function TSynEditDataObject.QueryGetData (const formatetc: TFormatEtc): HResult; -Var - ClipFormat : TClipFormat; -begin - for ClipFormat in FFormatEtc do - if (formatetc.cfFormat = ClipFormat) and - (formatetc.tymed and TYMED_HGLOBAL = TYMED_HGLOBAL) - then - Exit(S_OK); - Exit(DV_E_FORMATETC); -end; - -function TSynEditDataObject.GetCanonicalFormatEtc (const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult; -begin - FormatEtcOut.ptd := nil; - Result := DATA_S_SAMEFORMATETC; -end; - -function TSynEditDataObject.SetData (const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult; -begin - Result := E_NOTIMPL; -end; - -function TSynEditDataObject.EnumFormatEtc (dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult; -begin - try - if dwDirection = DATADIR_GET then - begin - EnumFormatEtc := TSynEnumFormatEtc.Create(FFormatEtc.ToArray); - Result := S_OK - end else - Result := E_NOTIMPL; - except - Result := E_UNEXPECTED; - end -end; - -function TSynEditDataObject.DAdvise (const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult; -begin - Result := OLE_E_ADVISENOTSUPPORTED; -end; - -function TSynEditDataObject.DUnadvise (dwConnection: Longint): HResult; -begin - Result := OLE_E_ADVISENOTSUPPORTED; -end; - -function TSynEditDataObject.EnumDAdvise (out enumAdvise: IEnumStatData): HResult; -begin - Result := OLE_E_ADVISENOTSUPPORTED; -end; - - -//=== BASE ENUM FORMATETC CLASS ================================================ - -constructor TSynEnumFormatEtc.Create(FormatList: TArray; - Index: integer); -begin - inherited Create; - FList := FormatList; - FIndex := Index; -end; - -function TSynEnumFormatEtc.GetFormatEtc(ClipFormat: TClipFormat): TFormatEtc; -begin - with Result do - begin - cfFormat := ClipFormat; - dwAspect := DVASPECT_CONTENT; - ptd := nil; - tymed := TYMED_HGLOBAL; - lindex := -1; - end; -end; - -function TSynEnumFormatEtc.Next (celt: Longint; out elt; pceltFetched: PLongint): HResult; -var - I : integer; - FormatEtc: PFormatEtc; -begin - I := 0; - FormatEtc:= PFormatEtc(@Elt); - while (I < Celt) and (FIndex < Length(FList)) do - begin - FormatEtc^ := GetFormatEtc(FList[FIndex]); - Inc(FormatEtc); - Inc (FIndex); - Inc (I) - end; - - if (pCeltFetched <> nil) then pCeltFetched^:= i; - - if (I = Celt) then - Result:= S_OK - else - Result:= S_FALSE; -end; - -function TSynEnumFormatEtc.Skip (celt: Longint): HResult; -begin - Result := S_OK; - if Celt <= Length(FList) - FIndex then - FIndex := FIndex + Celt - else begin - FIndex := Length(FList); - Result := S_FALSE - end -end; - -function TSynEnumFormatEtc.Reset : HResult; -begin - FIndex := 0; - Result := S_OK; -end; - -function TSynEnumFormatEtc.Clone (out Enum: IEnumFormatEtc): HResult; -begin - Result := S_OK; - Enum := TSynEnumFormatEtc.Create (FList, FIndex); -end; - - -initialization - OleInitialize(nil); - SynEditClipboardFormat := RegisterClipboardFormat ('Internal SynEdit clipboard format'); -finalization - OleFlushClipboard; - OleUninitialize; -end. diff --git a/Source/VCL/SynEdit/Source/SynEditDocumentManager.pas b/Source/VCL/SynEdit/Source/SynEditDocumentManager.pas new file mode 100644 index 00000000..b5b64335 --- /dev/null +++ b/Source/VCL/SynEdit/Source/SynEditDocumentManager.pas @@ -0,0 +1,492 @@ +unit SynEditDocumentManager; + +interface + +uses + Classes, + Messages, + ExtCtrls, + SynEditTypes, + SynEdit, + SynMemo, + SynEditTextBuffer, + SynEditHighlighter; + +type + ISynDocument = interface + ['{DC80C7CF-FC56-4FDE-9E3E-6A1C53D6EFCD}'] + procedure SetCaretXY(const value: TBufferCoord); + function GetCaretXY: TBufferCoord; + procedure SetLines(const value: TStrings); + function GetLines: TStrings; + function GetUndoList: TSynEditUndoList; + function GetRedoList: TSynEditUndoList; + function GetTopLine: Integer; + procedure SetTopLine(const value: Integer); + procedure SetModified(const value: Boolean); + function GetModified: Boolean; + function GetName: string; + function GetHighLighter: TSynCustomHighlighter; + procedure SetHighlighter(const value: TSynCustomHighlighter); + function GetDataIntf: IInterface; + procedure SetDataIntf(const value: IInterface); + function GetMarks: TSynEditMarkList; + + property CaretXY: TBufferCoord read GetCaretXY write SetCaretXY; + property Lines: TStrings read GetLines write SetLines; + property UndoList: TSynEditUndoList read GetUndoList; + property RedoList: TSynEditUndoList read GetRedoList; + property TopLine: Integer read GetTopLine write SetTopLine; + property Modified: Boolean read GetModified write SetModified; + property Name: string read GetName; + property Highlighter: TSynCustomHighlighter read GetHighlighter write SetHighLighter; + property DataIntf: IInterface read GetDataIntf write SetDataIntf; + property Marks: TSynEditMarkList read GetMarks; + //Line info allows us to store stuff like gutter icons, breakpoints etc. + end; + + TSynEditDocumentManager = class(TComponent) + private + FDocuments: IInterfaceList; + FCurrentDocumentIndex: Integer; + FMemo: TSynMemo; + FMemoWndProc: TWndMethod; + FUpdateTimer: TTimer; + function GetCount: Integer; + function GetCurrentDocument: ISynDocument; + protected + procedure MemoWndProc(var Msg: TMessage); + procedure SetMemo(const Value: TSynMemo); + function GetDocument(index: Integer): ISynDocument; + function GetDocumentByName(index: string): ISynDocument; + procedure SetCurrentDocumentIndex(const Value: Integer); + procedure UpdateTimerEvent(Sender: TObject); + + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure UpdateCurrentDocument; //saves editor to document + procedure ApplyCurrentDocument; //applies document to editor + function AddDocument(const AName: string; const ALines: TStrings; const AHighlighter: TSynCustomHighlighter): ISynDocument; + procedure RemoveDocument(const index: Integer); overload; + procedure RemoveDocument(const AName: string); overload; + procedure RemoveDocument(const ADocument: ISynDocument); overload; + procedure RemoveAll; + property Documents[index: Integer]: ISynDocument read GetDocument; + property CurrentDocument: ISynDocument read GetCurrentDocument; + property DocumentsByName[index: string]: ISynDocument read GetDocumentByName; + property CurrentDocumentIndex: Integer read FCurrentDocumentIndex write SetCurrentDocumentIndex; + property Count: Integer read GetCount; + published + property Memo: TSynMemo read FMemo write SetMemo; + end; + +implementation + +uses + Windows, SysUtils; +{ TSynEditDocumentManager } + +type + TSynDocument = class(TInterfacedObject, ISynDocument) + private + FName: string; + FLines: TStringList; + FCaretXY: TBufferCoord; + FModified: Boolean; + FRedoList: TSynEditUndoList; + FUndoList: TSynEditUndoList; + FTopLine: Integer; + FHighLighter: TSynCustomHighlighter; + FDataIntf: IInterface; + FMarks: TSynEditMarkList; + protected + function GetCaretXY: TBufferCoord; + function GetLines: TStrings; + function GetModified: Boolean; + function GetName: string; + function GetRedoList: TSynEditUndoList; + function GetTopLine: Integer; + function GetUndoList: TSynEditUndoList; + procedure SetCaretXY(const value: TBufferCoord); + procedure SetLines(const value: TStrings); + procedure SetModified(const value: Boolean); + procedure SetTopLine(const value: Integer); + function GetHighLighter: TSynCustomHighlighter; + procedure SetHighlighter(const value: TSynCustomHighlighter); + function GetDataIntf: IInterface; + procedure SetDataIntf(const value: IInterface); + function GetMarks: TSynEditMarkList; + public + constructor Create(const AName: string; ALines: TStrings); + destructor Destroy; override; + end; + + +constructor TSynEditDocumentManager.Create(AOwner: TComponent); +begin + inherited; + FDocuments := TInterfaceList.Create; + FCurrentDocumentIndex := -1; + FUpdateTimer := TTimer.Create(Self); + FUpdateTimer.enabled := False; + FUpdateTimer.Interval := 200; + FUpdateTimer.OnTimer := UpdateTimerEvent; +end; + +destructor TSynEditDocumentManager.Destroy; +begin + FUpdateTimer.Free; + inherited; +end; + +function TSynEditDocumentManager.AddDocument(const AName: string; + const ALines: TStrings; const AHighlighter: TSynCustomHighlighter): ISynDocument; +begin + Result := GetDocumentByName(AName); + if Result <> nil then + begin + Result.Lines.Assign(ALines); + Result.Highlighter := AHighlighter; + end + else + begin + Result := TSynDocument.Create(AName,ALines); + Result.Highlighter := AHighlighter; + FDocuments.Add(Result); +{ if CurrentDocumentIndex = -1 then + CurrentDocumentIndex := 0;} + end; +end; + +function TSynEditDocumentManager.GetDocument(index: Integer): ISynDocument; +begin + if (index >= 0) and (index < FDocuments.Count) then + Result := FDocuments.Items[index] as ISynDocument + else + Result := nil; +end; + +function TSynEditDocumentManager.GetDocumentByName(index: string): ISynDocument; +var + i: Integer; +begin + Result := nil; + for i := 0 to FDocuments.Count -1 do + begin + Result := GetDocument(i); + if CompareText(Result.Name,index) = 0 then + Break + else + Result := nil; + end; +end; + +procedure TSynEditDocumentManager.RemoveDocument(const index: Integer); +begin + FDocuments.Delete(index); + if FDocuments.Count = 0 then + FCurrentDocumentIndex := -1; +end; + +procedure TSynEditDocumentManager.RemoveDocument(const AName: string); +var + doc: ISynDocument; +begin + doc := GetDocumentByName(AName); + if doc <> nil then + FDocuments.Remove(doc); + if FDocuments.Count = 0 then + FCurrentDocumentIndex := -1; + +end; + +procedure TSynEditDocumentManager.MemoWndProc(var Msg: TMessage); +begin + if (Msg.Msg = WM_CHAR) then + begin + FUpdateTimer.Enabled := False; + FUpdateTimer.Enabled := True; + end; + if Assigned(FMemoWndProc) then + FMemoWndProc(Msg); +end; + +procedure TSynEditDocumentManager.RemoveDocument(const ADocument: ISynDocument); +begin + FDocuments.Remove(ADocument); + if FDocuments.Count = 0 then + FCurrentDocumentIndex := -1; +end; + +procedure TSynEditDocumentManager.SetCurrentDocumentIndex(const Value: Integer); +begin + if FCurrentDocumentIndex <> Value then + begin + UpdateCurrentDocument; + if (Value >= 0) and (Value < FDocuments.Count) then + begin + FCurrentDocumentIndex := Value; + ApplyCurrentDocument; + end; + end; +end; + +procedure TSynEditDocumentManager.SetMemo(const Value: TSynMemo); +begin + if FMemo <> Value then + begin + if FMemo <> nil then + begin + FMemo.RemoveFreeNotification(Self); + if not (csDesigning in ComponentState) then + begin + if Assigned(FMemoWndProc) then + FMemo.WindowProc := FMemoWndProc; + end; + end; + FMemo := Value; + if FMemo <> nil then + begin + FMemo.FreeNotification(Self); + if not (csDesigning in ComponentState) then + begin + FMemoWndProc := FMemo.WindowProc; + FMemo.WindowProc := Self.MemoWndProc; + end; + end; + end; +end; + +procedure TSynEditDocumentManager.RemoveAll; +begin + FDocuments.Clear; + FCurrentDocumentIndex := -1; +end; + +function TSynEditDocumentManager.GetCount: Integer; +begin + Result := FDocuments.Count; +end; + +function TSynEditDocumentManager.GetCurrentDocument: ISynDocument; +begin + if FCurrentDocumentIndex <> -1 then + Result := GetDocument(FCurrentDocumentIndex) + else + Result := nil; +end; + +function CloneMark(const AOwner: TCustomSynEdit; const source: TSynEditMark): TSynEditMark; +begin + Result := TSynEditMark.Create(AOwner); + Result.Line := source.Line; + Result.Char := source.Char; + Result.ImageIndex := source.ImageIndex; + Result.BookmarkNumber := source.BookmarkNumber; + Result.InternalImage := source.InternalImage; + Result.Visible := source.Visible; +end; + +procedure TSynEditDocumentManager.ApplyCurrentDocument; +var + doc: ISynDocument; + I: Integer; +begin + if FCurrentDocumentIndex <> -1 then + begin + if FMemo <> nil then + begin + doc := GetDocument(FCurrentDocumentIndex); + if doc <> nil then + begin + FMemo.Lines.Assign(doc.Lines); + FMemo.TopLine := doc.TopLine; + FMemo.CaretXY := doc.CaretXY; + FMemo.UndoList.Assign(doc.UndoList); + FMemo.RedoList.Assign(doc.RedoList); + FMemo.Highlighter := doc.Highlighter; + //can't do this because it av's now??? +// FMemo.Marks.Assign(doc.Marks); + FMemo.Marks.Clear; + for i := 0 to doc.Marks.Count - 1 do + begin + FMemo.Marks.Place(CloneMark(FMemo,doc.Marks.Items[i])); + end; + FMemo.Modified := doc.Modified; + FMemo.Refresh; + end; + end; + end; +end; + +{ TSynDocument } + +constructor TSynDocument.Create(const AName: string; ALines: TStrings); +begin + inherited Create; + FLines := TStringList.Create; + FRedoList := TSynEditUndoList.Create; + FUndoList := TSynEditUndoList.Create; + FName := AName; + FLines.Assign(ALines); + FModified := False; + FTopLine := 0; + FMarks := TSynEditMarkList.Create(nil); +end; + +destructor TSynDocument.Destroy; +begin + FLines.Free; + FRedoList.Free; + FUndoList.Free; + FMarks.Free; + inherited; +end; + +function TSynDocument.GetCaretXY: TBufferCoord; +begin + Result := FCaretXY; +end; + +function TSynDocument.GetDataIntf: IInterface; +begin + Result := FDataIntf; +end; + +function TSynDocument.GetHighLighter: TSynCustomHighlighter; +begin + Result := FHighLighter; +end; + + +function TSynDocument.GetLines: TStrings; +begin + Result := FLines; +end; + +function TSynDocument.GetMarks: TSynEditMarkList; +begin + Result := FMarks; +end; + +function TSynDocument.GetModified: Boolean; +begin + Result := FModified; +end; + +function TSynDocument.GetName: string; +begin + Result := FName; +end; + +function TSynDocument.GetRedoList: TSynEditUndoList; +begin + Result := FRedoList; +end; + +function TSynDocument.GetTopLine: Integer; +begin + Result := FTopLine; +end; + +function TSynDocument.GetUndoList: TSynEditUndoList; +begin + Result := FUndoList; +end; + +procedure TSynDocument.SetCaretXY(const value: TBufferCoord); +begin + FCaretXY := value; +end; + +procedure TSynDocument.SetDataIntf(const value: IInterface); +begin + FDataIntf := Value; +end; + +procedure TSynDocument.SetHighlighter(const value: TSynCustomHighlighter); +begin + FHighLighter := value; +end; + + +procedure TSynDocument.SetLines(const value: TStrings); +begin + FLines.Assign(value); +end; + +procedure TSynDocument.SetModified(const value: Boolean); +begin + FModified := Value; +end; + +procedure TSynDocument.SetTopLine(const value: Integer); +begin + FTopLine := Value; +end; + +procedure TSynEditDocumentManager.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (AComponent = FMemo) and (Operation = opRemove) then + begin + SetMemo(nil); + end; +end; + +procedure TSynEditDocumentManager.UpdateTimerEvent(Sender: TObject); +var + doc: ISynDocument; +begin + FUpdateTimer.Enabled := False; + if FCurrentDocumentIndex <> -1 then + begin + if FMemo <> nil then + begin + doc := GetDocument(FCurrentDocumentIndex); + if doc <> nil then + begin + doc.Modified := FMemo.Modified; + doc.Lines.Assign(FMemo.Lines); + doc.TopLine := FMemo.TopLine; + doc.CaretXY := FMemo.CaretXY; + doc.UndoList.Assign(FMemo.UndoList); + doc.RedoList.Assign(FMemo.RedoList); + end; + end; + end; +end; + + +procedure TSynEditDocumentManager.UpdateCurrentDocument; +var + doc: ISynDocument; + i: Integer; +begin + if FCurrentDocumentIndex <> -1 then + begin + //save the state of the current document + if FMemo <> nil then + begin + doc := GetDocument(FCurrentDocumentIndex); + if doc <> nil then + begin + doc.Modified := FMemo.Modified; + doc.Lines.Assign(FMemo.Lines); + doc.TopLine := FMemo.TopLine; + doc.CaretXY := FMemo.CaretXY; + doc.UndoList.Assign(FMemo.UndoList); + doc.RedoList.Assign(FMemo.RedoList); + doc.Marks.Clear; + for i := 0 to FMemo.Marks.Count - 1 do + doc.Marks.Place(CloneMark(nil,FMemo.Marks.Items[i])); + FMemo.Highlighter := doc.Highlighter; + end; + end; + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditDragDrop.pas b/Source/VCL/SynEdit/Source/SynEditDragDrop.pas deleted file mode 100644 index 80f0507d..00000000 --- a/Source/VCL/SynEdit/Source/SynEditDragDrop.pas +++ /dev/null @@ -1,227 +0,0 @@ -unit SynEditDragDrop; -{ - 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. - - 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. - - OLE Drag and Drop components and routines - Based on Grahame Marsh's code for UNDO -} - -interface - -Uses - Windows, ActiveX, SysUtils, Classes, Messages, Controls, Forms, ExtCtrls; - - -// Drop effects as Delphi style constants (originals in ActiveX) -const - deNone = DROPEFFECT_NONE; - deMove = DROPEFFECT_MOVE; - deCopy = DROPEFFECT_COPY; - deLink = DROPEFFECT_LINK; - deScroll = DROPEFFECT_SCROLL; - -// Provides a translation of a IDropTarget interface into Delphi -type - TOnDragEvent = procedure (Sender : TObject; DataObject : IDataObject; State : TShiftState; MousePt : TPoint; var Effect: LongInt; var Result: HResult) of Object; - TOnDragLeaveEvent = procedure (Sender : TObject; var Result : HResult) of Object; - - TSynDropTarget = class (TInterfacedObject, IDropTarget) - private - FDataObject : IDataObject; - FOnDragEnter : TOnDragEvent; - FOnDragOver : TOnDragEvent; - FOnDragLeave : TOnDragLeaveEvent; - FOnDrop : TOnDragEvent; -// IDropTarget - function DragEnter (const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; - function DragOver (grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; - function DragLeave : HResult; overload; stdcall; - function Drop (const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; - protected - procedure DragEnter (DataObject : IDataObject; State : TShiftState; Pt : TPoint; var Effect: LongInt; var Result : HResult);overload; - procedure DragOver (State : TShiftState; Pt : TPoint; var Effect: LongInt; var Result: HResult);overload; - procedure DragLeave (var Result : HResult);overload; - procedure Drop (DataObject : IDataObject; State : TShiftState; Pt : TPoint; var Effect: LongInt; var Result: HResult);overload; - public - destructor Destroy; override; - property OnDragEnter : TOnDragEvent read FOnDragEnter write FOnDragEnter; - property OnDragOver : TOnDragEvent read FOnDragOver write FOnDragOver; - property OnDragLeave : TOnDragLeaveEvent read FOnDragLeave write FOnDragLeave; - property OnDrop : TOnDragEvent read FOnDrop write FOnDrop; - end; - - TSynDragSource = class (TInterfacedObject, IDropSource) - private - // IDropSource - // Called routinely by Windows to check that drag operations are to continue. See the - // implementation below of QueryContinueDrag method for the default operation. - function QueryContinueDrag (fEscapePressed: BOOL; grfKeyState: Longint): HResult; overload; stdcall; - // Called routinely to modify the displayed cursor. - function GiveFeedback (dwEffect: Longint): HResult; stdcall; - public - destructor Destroy; override; - end; - -implementation - -//--- returns the normal response for a wanted effect: -// no keys = "move" -// control only = "copy" -// control/shift = "link" - ignored in this case -function StandardEffect (Keys : TShiftState) : integer; -begin - Result := deMove; - if ssCtrl in Keys then - begin - Result := deCopy; - end -end; - -{ TDropTarget } - -function TSynDropTarget.DragEnter(const DataObj: IDataObject; - grfKeyState: Integer; pt: TPoint; var dwEffect: LongInt): HResult; -begin - Result := S_OK; - try - DragEnter(DataObj, KeysToShiftState(grfKeyState), Pt, dwEffect, Result); - except - Result := E_UNEXPECTED; - end -end; - -function TSynDropTarget.DragLeave: HResult; -begin - Result := S_OK; - try - DragLeave(Result) - except - Result := E_UNEXPECTED; - end -end; - -function TSynDropTarget.DragOver(grfKeyState: Integer; pt: TPoint; - var dwEffect: LongInt): HResult; -begin - Result := S_OK; - try - DragOver (KeysToShiftState (grfKeyState), Pt, dwEffect, Result); - except - Result := E_UNEXPECTED; - end -end; - -function TSynDropTarget.Drop(const DataObj: IDataObject; grfKeyState: Integer; - pt: TPoint; var dwEffect: LongInt): HResult; -begin - Result := S_OK; - try - Drop (DataObj, KeysToShiftState (grfKeyState), Pt, dwEffect, Result); - except - Result := E_UNEXPECTED; - end -end; - -procedure TSynDropTarget.DragEnter(DataObject: IDataObject; - State: TShiftState; Pt: TPoint; var Effect: LongInt; var Result: HResult); -begin - Effect := StandardEffect (State); - if Assigned (FOnDragEnter) then - FOnDragEnter (Self, DataObject, State, Pt, Effect, Result); - if Effect = deNone then - FDataObject := nil - else - FDataObject := DataObject; -end; - -procedure TSynDropTarget.DragLeave(var Result: HResult); -begin - if Assigned(FDataObject) then - try - if Assigned (FOnDragLeave) then - FOnDragLeave (Self, Result) - finally - FDataObject := nil - end -end; - -procedure TSynDropTarget.DragOver(State: TShiftState; - Pt: TPoint; var Effect: LongInt; var Result: HResult); -begin - if FDataObject = nil then begin - Effect := deNone; - Exit; - end; - - Effect := StandardEffect (State); - if Assigned (FOnDragOver) then - FOnDragOver (Self, FDataObject, State, Pt, Effect, Result) -end; - -procedure TSynDropTarget.Drop(DataObject: IDataObject; State: TShiftState; - Pt: TPoint; var Effect: LongInt; var Result: HResult); -begin - if FDataObject = nil then begin - Effect := deNone; - Exit; - end; - - Effect := StandardEffect (State); - try - if Assigned (FOnDrop) then - FOnDrop (Self, DataObject, State, Pt, Effect, Result) - finally - FDataObject := nil - end -end; - -destructor TSynDropTarget.Destroy; -begin - FDataObject := nil; - inherited; -end; - -//=== DRAG SOURCE CLASS =================================================== - -function TSynDragSource.QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: Longint): HResult; -begin - if fEscapePressed then // cancel the drop - Result := DRAGDROP_S_CANCEL - else if (grfKeyState and MK_LBUTTON) = 0 then - Result := DRAGDROP_S_DROP // drop has occurred - else - Result := S_OK; -end; - -function TSynDragSource.GiveFeedback(dwEffect: Longint): HResult; -begin - Result := DRAGDROP_S_USEDEFAULTCURSORS; -end; - -destructor TSynDragSource.Destroy; -begin - // for debugging purposes - inherited; -end; - -end. diff --git a/Source/VCL/SynEdit/Source/SynEditExport.pas b/Source/VCL/SynEdit/Source/SynEditExport.pas index 46476e1e..6caa6db0 100644 --- a/Source/VCL/SynEdit/Source/SynEditExport.pas +++ b/Source/VCL/SynEdit/Source/SynEditExport.pas @@ -1,709 +1,738 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditExport.pas, released 2000-04-16. - -The Original Code is partly based on the mwExport.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Portions created by Michael Hieke are Copyright 2000 Michael Hieke. -Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditExport.pas,v 1.17.2.8 2008/09/17 13:59:12 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -{ Base class for exporting a programming language source file or part of it to - a formatted output like HTML or RTF and copying this to the Windows clipboard - or saving it to a file. } -unit SynEditExport; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - Clipbrd, - SynEditHighlighter, - SynEditTypes, - SynUnicode, - Classes, - SysUtils; - -type - ESynEncoding = class(ESynError); - - { Base exporter class, implements the buffering and the common functionality - to track the changes of token attributes, to export to the clipboard or to - save the output to a file. Descendant classes have to implement only the - actual formatting of tokens. } - TSynCustomExporter = class(TComponent) - private - fBuffer: TMemoryStream; - FCharSize: Integer; - fFirstAttribute: Boolean; - FStreaming: Boolean; - procedure AssignFont(Value: TFont); - procedure SetEncoding(const Value: TSynEncoding); - procedure SetExportAsText(Value: Boolean); - procedure SetFont(Value: TFont); - procedure SetHighlighter(Value: TSynCustomHighlighter); - procedure SetTitle(const Value: string); - procedure SetUseBackground(const Value: Boolean); - function StringSize(const AText: string): Integer; - procedure WriteString(const AText: string); - protected - fBackgroundColor: TColor; - fClipboardFormat: UINT; - fDefaultFilter: string; - FEncoding: TSynEncoding; - fExportAsText: Boolean; - fFont: TFont; - fHighlighter: TSynCustomHighlighter; - fLastBG: TColor; - fLastFG: TColor; - fLastStyle: TFontStyles; - fTitle: string; - fUseBackground: Boolean; - { Adds a string to the output buffer. } - procedure AddData(const AText: string); - { Adds a string and a trailing newline to the output buffer. } - procedure AddDataNewLine(const AText: string); - { Adds a newline to the output buffer. } - procedure AddNewLine; - { Copies the data under this format to the clipboard. The clipboard has to - be opened explicitly when more than one format is to be set. } - procedure CopyToClipboardFormat(AFormat: UINT); - procedure DefineProperties(Filer: TFiler); override; - { Has to be overridden in descendant classes to add the closing format - strings to the output buffer. The parameters can be used to track what - changes are made for the next token. } - procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean; - FontStylesChanged: TFontStyles); virtual; abstract; - { Has to be overridden in descendant classes to add the opening format - strings to the output buffer. The parameters can be used to track what - changes have been made in respect to the previous token. } - procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean; - FontStylesChanged: TFontStyles); virtual; abstract; - { Has to be overridden in descendant classes to add the closing format - strings to the output buffer after the last token has been written. } - procedure FormatAfterLastAttribute; virtual; abstract; - { Has to be overridden in descendant classes to add the opening format - strings to the output buffer when the first token is about to be written. } - procedure FormatBeforeFirstAttribute(BackgroundChanged, - ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); - virtual; abstract; - { Has to be overridden in descendant classes to add the formatted text of - the actual token text to the output buffer. } - procedure FormatToken(Token: string); virtual; - { Has to be overridden in descendant classes to add a newline in the output - format to the output buffer. } - procedure FormatNewLine; virtual; abstract; - { Returns the size of the formatted text in the output buffer, to be used - in the format header or footer. } - function GetBufferSize: integer; - { The clipboard format the exporter creates as native format. } - function GetClipboardFormat: UINT; virtual; - { Has to be overridden in descendant classes to return the correct output - format footer. } - function GetFooter: string; virtual; abstract; - { Has to be overridden in descendant classes to return the name of the - output format. } - function GetFormatName: string; virtual; - { Has to be overridden in descendant classes to return the correct output - format header. } - function GetHeader: string; virtual; abstract; - { Inserts a data block at the given position into the output buffer. Is - used to insert the format header after the exporting, since some header - data may be known only after the conversion is done. } - procedure InsertData(APos: Integer; const AText: string); - function ReplaceReservedChar(AChar: WideChar): string; virtual; abstract; - { Returns a string that has all the invalid chars of the output format - replaced with the entries in the replacement array. } - function ReplaceReservedChars(AToken: string): string; - { Sets the token attribute of the next token to determine the changes - of colors and font styles so the properties of the next token can be - added to the output buffer. } - procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); virtual; - function UseBom: Boolean; virtual; abstract; - public - { Creates an instance of the exporter. } - constructor Create(AOwner: TComponent); override; - { Destroys an instance of the exporter. } - destructor Destroy; override; - { Clears the output buffer and any internal data that relates to the last - exported text. } - procedure Clear; virtual; - { Copies the output buffer contents to the clipboard, as the native format - or as text depending on the ExportAsText property. } - procedure CopyToClipboard; - { Exports everything in the strings parameter to the output buffer. } - procedure ExportAll(ALines: TStrings); - { Exports the given range of the strings parameter to the output buffer. } - procedure ExportRange(ALines: TStrings; Start, Stop: TBufferCoord); - { Saves the contents of the output buffer to a file. } - procedure SaveToFile(const FileName: string); - { Saves the contents of the output buffer to a stream. } - procedure SaveToStream(Stream: TStream); - function SupportedEncodings: TSynEncodings; virtual; abstract; - public - { Default background color for text that has no token attribute assigned or - for token attributes that have the background set to default. } - property Color: TColor read fBackgroundColor write fBackgroundColor; - { Filter string for the output format for SaveAs file dialogs. } - property DefaultFilter: string read fDefaultFilter write fDefaultFilter; - property Encoding: TSynEncoding read FEncoding write SetEncoding default seUTF8; - property ExportAsText: Boolean read fExportAsText write SetExportAsText; - { The font to be used for the output format. The font color is used for text - that has no token attribute assigned or for token attributes that have - the background set to default. } - property Font: TFont read fFont write SetFont; - { The output format of the exporter. } - property FormatName: string read GetFormatName; - { The highlighter to use for exporting. } - property Highlighter: TSynCustomHighlighter - read fHighlighter write SetHighlighter; - { The title to embedd into the output header. } - property Title: string read fTitle write SetTitle; - { Use the token attribute background for the exporting. } - property UseBackground: Boolean read fUseBackground write SetUseBackground; - end; - -const - EncodingStrs: array[TSynEncoding] of string = - ('UTF-8', 'UTF-16 Little Endian', 'UTF-16 Big Endian', 'ANSI'); - -resourcestring - SEncodingError = '%s encoding is not supported by %s-exporter'; - -implementation - -uses - Math, - SynEditMiscProcs, - SynEditStrConst; - -{ TSynCustomExporter } - -constructor TSynCustomExporter.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fBuffer := TMemoryStream.Create; - fClipboardFormat := CF_TEXT; - FCharSize := 1; - FEncoding := seUTF8; - fFont := TFont.Create; - fBackgroundColor := clWindow; - AssignFont(nil); - Clear; - fTitle := SYNS_Untitled; -end; - -destructor TSynCustomExporter.Destroy; -begin - fFont.Free; - fBuffer.Free; - inherited Destroy; -end; - -procedure TSynCustomExporter.AddData(const AText: string); -begin - if AText <> '' then - begin - WriteString(AText); - fBuffer.SetSize(fBuffer.Position); - end; -end; - -procedure TSynCustomExporter.AddDataNewLine(const AText: string); -begin - AddData(AText); - AddNewLine; -end; - -procedure TSynCustomExporter.AddNewLine; -begin - WriteString(WideCRLF); - fBuffer.SetSize(fBuffer.Position); -end; - -procedure TSynCustomExporter.AssignFont(Value: TFont); -begin - if Value <> nil then - fFont.Assign(Value) - else - begin - fFont.Name := DefaultFontName; - fFont.Size := 10; - fFont.Color := clWindowText; - fFont.Style := []; - end; -end; - -procedure TSynCustomExporter.Clear; -begin - fBuffer.Position := 0; - // Size is ReadOnly in Delphi 2 - fBuffer.SetSize(0); - fLastStyle := []; - fLastBG := clWindow; - fLastFG := clWindowText; -end; - -procedure SetClipboardText(Text: string); -var - Mem: HGLOBAL; - P: PByte; - SLen: Integer; -begin - SLen := Length(Text); - Clipboard.Open; - try - Clipboard.Clear; - - // set unicode text, this also works on Win9X, even if the clipboard-viewer - // can't show it, Word 2000+ can paste it including the unicode only characters - Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, - (SLen + 1) * sizeof(WideChar)); - if Mem <> 0 then - begin - P := GlobalLock(Mem); - try - if P <> nil then - begin - Move(PWideChar(Text)^, P^, (SLen + 1) * sizeof(WideChar)); - Clipboard.SetAsHandle(CF_UNICODETEXT, Mem); - end; - finally - GlobalUnlock(Mem); - end; - end; - // Don't free Mem! It belongs to the clipboard now, and it will free it - // when it is done with it. - finally - Clipboard.Close; - end; -end; - -procedure TSynCustomExporter.CopyToClipboard; -const - Nulls: array[0..1] of Byte = (0, 0); -var - S: string; -begin - if fExportAsText then - begin - fBuffer.Position := fBuffer.Size; - fBuffer.Write(Nulls, FCharSize); - case Encoding of - seUTF16LE: - S := PWideChar(fBuffer.Memory); - seUTF16BE: - begin - S := PWideChar(fBuffer.Memory); - StrSwapByteOrder(PWideChar(S)); - end; - seUTF8: - S := UTF8ToUnicodeString(PAnsiChar(fBuffer.Memory)); - seAnsi: - S := string(PAnsiChar(fBuffer.Memory)); - end; - SetClipboardText(S); - end - else - CopyToClipboardFormat(GetClipboardFormat); -end; - -procedure TSynCustomExporter.CopyToClipboardFormat(AFormat: UINT); -var - hData: THandle; - hDataSize: UINT; - PtrData: PByte; -begin - hDataSize := GetBufferSize + 1; - hData := GlobalAlloc(GMEM_MOVEABLE or GMEM_ZEROINIT or GMEM_SHARE, hDataSize); - if hData <> 0 then - try - PtrData := GlobalLock(hData); - if Assigned(PtrData) then - begin - try - fBuffer.Position := 0; - fBuffer.Read(PtrData^, hDataSize - 1); // trailing #0 - finally - GlobalUnlock(hData); - end; - Clipboard.SetAsHandle(AFormat, hData); - end - else - Abort; - except - GlobalFree(hData); - OutOfMemoryError; - end; -end; - -procedure TSynCustomExporter.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -procedure TSynCustomExporter.ExportAll(ALines: TStrings); -begin - ExportRange(ALines, BufferCoord(1, 1), BufferCoord(MaxInt, MaxInt)); -end; - -procedure TSynCustomExporter.ExportRange(ALines: TStrings; Start, Stop: TBufferCoord); -var - i: Integer; - Line, Token: string; - Attri: TSynHighlighterAttributes; -begin - FStreaming := True; - try - // abort if not all necessary conditions are met - if not Assigned(ALines) or not Assigned(Highlighter) or (ALines.Count = 0) - or (Start.Line > ALines.Count) or (Start.Line > Stop.Line) - then - Abort; - Stop.Line := Max(1, Min(Stop.Line, ALines.Count)); - Stop.Char := Max(1, Min(Stop.Char, Length(ALines[Stop.Line - 1]) + 1)); - Start.Char := Max(1, Min(Start.Char, Length(ALines[Start.Line - 1]) + 1)); - if (Start.Line = Stop.Line) and (Start.Char >= Stop.Char) then - Abort; - // initialization - fBuffer.Position := 0; - // Size is ReadOnly in Delphi 2 - fBuffer.SetSize(Max($1000, (Stop.Line - Start.Line) * 128) * FCharSize); - Highlighter.ResetRange; - // export all the lines into fBuffer - fFirstAttribute := True; - for i := Start.Line to Stop.Line do - begin - Line := ALines[i - 1]; - // order is important, since Start.Y might be equal to Stop.Y - if i = Stop.Line then - Delete(Line, Stop.Char, MaxInt); - if (i = Start.Line) and (Start.Char > 1) then - Delete(Line, 1, Start.Char - 1); - // export the line - Highlighter.SetLine(Line, i); - while not Highlighter.GetEOL do - begin - Attri := Highlighter.GetTokenAttribute; - if Assigned(Attri) then // The .pas highlighter, for example, can return a nil Attri above for a trailing EOF/null that was loaded from a stream - begin - Token := ReplaceReservedChars(Highlighter.GetToken); - SetTokenAttribute(Attri); - FormatToken(Token); - end; - Highlighter.Next; - end; - FormatNewLine; - end; - if not fFirstAttribute then - FormatAfterLastAttribute; - - // insert header - InsertData(0, GetHeader); - // add footer - AddData(GetFooter); - finally - FStreaming := False - end -end; - -procedure TSynCustomExporter.FormatToken(Token: string); -begin - AddData(Token); -end; - -function TSynCustomExporter.GetBufferSize: integer; -begin - Result := fBuffer.Size; -end; - -function TSynCustomExporter.GetClipboardFormat: UINT; -begin - Result := fClipboardFormat; -end; - -function TSynCustomExporter.GetFormatName: string; -begin - Result := ''; -end; - -procedure TSynCustomExporter.InsertData(APos: Integer; const AText: string); -var - Size, ToMove, SizeNeeded: Integer; - Dest: PByte; -begin - Size := StringSize(AText); - if Size > 0 then - begin - ToMove := fBuffer.Position; - SizeNeeded := ToMove + Size; - if fBuffer.Size < SizeNeeded then - // Size is ReadOnly in Delphi 2 - fBuffer.SetSize((SizeNeeded + $1800) and not $FFF); // increment in pages - Dest := fBuffer.Memory; - Inc(Dest, Size); - Move(fBuffer.Memory^, Dest^, ToMove); - fBuffer.Position := 0; - WriteString(AText); - fBuffer.Position := ToMove + Size; - fBuffer.SetSize(fBuffer.Position); - end; -end; - -function TSynCustomExporter.ReplaceReservedChars(AToken: string): string; -var - I, ISrc, IDest, SrcLen, DestLen: Integer; - Replace: string; - c: WideChar; -begin - if AToken <> '' then - begin - SrcLen := Length(AToken); - ISrc := 1; - DestLen := SrcLen; - IDest := 1; - SetLength(Result, DestLen); - while ISrc <= SrcLen do - begin - c := AToken[ISrc]; - Replace := ReplaceReservedChar(c); - if Replace <> '' then - Inc(ISrc) - else - begin - if IDest > DestLen then - begin - Inc(DestLen, 32); - SetLength(Result, DestLen); - end; - Result[IDest] := c; - Inc(ISrc); - Inc(IDest); - continue; - end; - if IDest + Length(Replace) - 1 > DestLen then - begin - Inc(DestLen, Max(32, IDest + Length(Replace) - DestLen)); - SetLength(Result, DestLen); - end; - for I := 1 to Length(Replace) do - begin - Result[IDest] := Replace[I]; - Inc(IDest); - end; - end; - SetLength(Result, IDest - 1); - end - else - Result := ''; -end; - -procedure TSynCustomExporter.SaveToFile(const FileName: string); -var - Stream: TStream; -begin - Stream := TFileStream.Create(FileName, fmCreate); - try - SaveToStream(Stream); - finally - Stream.Free; - end; -end; - -procedure TSynCustomExporter.SaveToStream(Stream: TStream); -begin - if UseBOM then - case Encoding of - seUTF8: - Stream.WriteBuffer(UTF8BOM, 3); - seUTF16LE: - Stream.WriteBuffer(UTF16BOMLE, 2); - seUTF16BE: - Stream.WriteBuffer(UTF16BOMBE, 2); - end; - fBuffer.Position := 0; - fBuffer.SaveToStream(Stream); -end; - -procedure TSynCustomExporter.SetEncoding(const Value: TSynEncoding); -begin - // don't change encoding while streaming as this could corrupt output data - if FStreaming then exit; - - if not (Value in SupportedEncodings) then - raise ESynEncoding.CreateFmt(SEncodingError, [EncodingStrs[Value], - GetFormatName]); - - FEncoding := Value; - if Value in [seUTF8, seAnsi] then - FCharSize := 1 - else if Value in [seUTF16LE, seUTF16BE] then - FCharSize := 2; -end; - -procedure TSynCustomExporter.SetExportAsText(Value: Boolean); -begin - if fExportAsText <> Value then - begin - fExportAsText := Value; - Clear; - end; -end; - -procedure TSynCustomExporter.SetFont(Value: TFont); -begin - AssignFont(Value); -end; - -procedure TSynCustomExporter.SetHighlighter(Value: TSynCustomHighlighter); -begin - if fHighlighter <> Value then - begin - if fHighlighter <> nil then - fHighlighter.FreeNotification(Self); - fHighlighter := Value; - Clear; - if Assigned(fHighlighter) and Assigned(fHighlighter.WhitespaceAttribute) and fUseBackground then - fBackgroundColor := fHighlighter.WhitespaceAttribute.Background; - end; -end; - -procedure TSynCustomExporter.SetTitle(const Value: string); -begin - if fTitle <> Value then - begin - if Value <> '' then - fTitle := Value - else - fTitle := SYNS_Untitled; - end; -end; - -procedure TSynCustomExporter.SetTokenAttribute(Attri: TSynHighlighterAttributes); -var - ChangedBG: Boolean; - ChangedFG: Boolean; - ChangedStyles: TFontStyles; - - function ValidatedColor(AColor, ADefColor: TColor): TColor; - begin - if AColor = clNone then - Result := ColorToRGB(ADefColor) - else - Result := ColorToRGB(AColor); - end; - -begin - if fFirstAttribute then - begin - fFirstAttribute := False; - fLastBG := ValidatedColor(Attri.Background, fBackgroundColor); - fLastFG := ValidatedColor(Attri.Foreground, fFont.Color); - fLastStyle := Attri.Style; - FormatBeforeFirstAttribute(UseBackground and (fLastBG <> fBackgroundColor), - fLastFG <> fFont.Color, Attri.Style); - end - else - begin - ChangedBG := UseBackground and - (fLastBG <> ValidatedColor(Attri.Background, fBackgroundColor)); - ChangedFG := (fLastFG <> ValidatedColor(Attri.Foreground, fFont.Color)); - // which font style bits are to be reset? - ChangedStyles := fLastStyle - Attri.Style; - if ChangedBG or ChangedFG or (fLastStyle <> Attri.Style) then - begin - FormatAttributeDone(ChangedBG, ChangedFG, ChangedStyles); - // which font style bits are to be set? - ChangedStyles := Attri.Style - fLastStyle; - fLastBG := ValidatedColor(Attri.Background, fBackgroundColor); - fLastFG := ValidatedColor(Attri.Foreground, fFont.Color); - fLastStyle := Attri.Style; - FormatAttributeInit(ChangedBG, ChangedFG, ChangedStyles); - end; - end; -end; - -procedure TSynCustomExporter.SetUseBackground(const Value: Boolean); -begin - fUseBackground := Value; - if Assigned(fHighlighter) and Assigned(fHighlighter.WhitespaceAttribute) and fUseBackground then - fBackgroundColor := fHighlighter.WhitespaceAttribute.Background; -end; - -function TSynCustomExporter.StringSize(const AText: string): Integer; -begin - case Encoding of - seUTF8: - Result := Length(UTF8Encode(AText)); - seUTF16LE, seUTF16BE: - Result := Length(AText); - seAnsi: - Result := Length(AnsiString(AText)); - else - Result := Length(AText); - end; - Result := Result * FCharSize; -end; - -procedure TSynCustomExporter.WriteString(const AText: string); -var - UTF8Str: UTF8String; - AnsiStr: AnsiString; -begin - case Encoding of - seUTF8: - begin - UTF8Str := UTF8Encode(AText); - fBuffer.WriteBuffer(UTF8Str[1], Length(UTF8Str)); - end; - seUTF16LE: - fBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); - seUTF16BE: - begin - StrSwapByteOrder(PWideChar(AText)); - fBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); - end; - seAnsi: - begin - AnsiStr := AnsiString(PWideChar(AText)); - fBuffer.WriteBuffer(AnsiStr[1], Length(AnsiStr)); - end; - end; -end; - - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditExport.pas, released 2000-04-16. + +The Original Code is partly based on the mwExport.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Michael Hieke. +Portions created by Michael Hieke are Copyright 2000 Michael Hieke. +Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditExport.pas,v 1.17.2.8 2008/09/17 13:59:12 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{ Base class for exporting a programming language source file or part of it to + a formatted output like HTML or RTF and copying this to the Windows clipboard + or saving it to a file. } +{$IFNDEF QSYNEDITEXPORT} +unit SynEditExport; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + Graphics, + Clipbrd, + SynEditHighlighter, + SynEditTypes, + SynUnicode, + Classes, + SysUtils; + +type + ESynEncoding = class(ESynError); + + { Base exporter class, implements the buffering and the common functionality + to track the changes of token attributes, to export to the clipboard or to + save the output to a file. Descendant classes have to implement only the + actual formatting of tokens. } + TSynCustomExporter = class(TComponent) + private + FBuffer: TMemoryStream; + FCharSize: Integer; + FFirstAttribute: Boolean; + FStreaming: Boolean; + procedure AssignFont(Value: TFont); + procedure SetEncoding(const Value: TSynEncoding); + procedure SetExportAsText(Value: Boolean); + procedure SetFont(Value: TFont); + procedure SetHighlighter(Value: TSynCustomHighlighter); + procedure SetTitle(const Value: UnicodeString); + procedure SetUseBackground(const Value: Boolean); + function StringSize(const AText: UnicodeString): Integer; + procedure WriteString(const AText: UnicodeString); + protected + FBackgroundColor: TColor; + FClipboardFormat: UINT; + FDefaultFilter: string; + FEncoding: TSynEncoding; + FExportAsText: Boolean; + FFont: TFont; + FHighlighter: TSynCustomHighlighter; + FLastBG: TColor; + FLastFG: TColor; + FLastStyle: TFontStyles; + FTitle: UnicodeString; + FUseBackground: Boolean; + { Adds a string to the output buffer. } + procedure AddData(const AText: UnicodeString); + { Adds a string and a trailing newline to the output buffer. } + procedure AddDataNewLine(const AText: UnicodeString); + { Adds a newline to the output buffer. } + procedure AddNewLine; + { Copies the data under this format to the clipboard. The clipboard has to + be opened explicitly when more than one format is to be set. } + procedure CopyToClipboardFormat(AFormat: UINT); + procedure DefineProperties(Filer: TFiler); override; + { Has to be overridden in descendant classes to add the closing format + strings to the output buffer. The parameters can be used to track what + changes are made for the next token. } + procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean; + FontStylesChanged: TFontStyles); virtual; abstract; + { Has to be overridden in descendant classes to add the opening format + strings to the output buffer. The parameters can be used to track what + changes have been made in respect to the previous token. } + procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean; + FontStylesChanged: TFontStyles); virtual; abstract; + { Has to be overridden in descendant classes to add the closing format + strings to the output buffer after the last token has been written. } + procedure FormatAfterLastAttribute; virtual; abstract; + { Has to be overridden in descendant classes to add the opening format + strings to the output buffer when the first token is about to be written. } + procedure FormatBeforeFirstAttribute(BackgroundChanged, + ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); + virtual; abstract; + { Has to be overridden in descendant classes to add the formatted text of + the actual token text to the output buffer. } + procedure FormatToken(Token: UnicodeString); virtual; + { Has to be overridden in descendant classes to add a newline in the output + format to the output buffer. } + procedure FormatNewLine; virtual; abstract; + { Returns the size of the formatted text in the output buffer, to be used + in the format header or footer. } + function GetBufferSize: Integer; + { The clipboard format the exporter creates as native format. } + function GetClipboardFormat: UINT; virtual; + { Has to be overridden in descendant classes to return the correct output + format footer. } + function GetFooter: UnicodeString; virtual; abstract; + { Has to be overridden in descendant classes to return the name of the + output format. } + function GetFormatName: string; virtual; + { Has to be overridden in descendant classes to return the correct output + format header. } + function GetHeader: UnicodeString; virtual; abstract; + { Inserts a data block at the given position into the output buffer. Is + used to insert the format header after the exporting, since some header + data may be known only after the conversion is done. } + procedure InsertData(APos: Integer; const AText: UnicodeString); + function ReplaceReservedChar(AChar: WideChar): UnicodeString; virtual; abstract; + { Returns a string that has all the invalid chars of the output format + replaced with the entries in the replacement array. } + function ReplaceReservedChars(AToken: UnicodeString): UnicodeString; + { Sets the token attribute of the next token to determine the changes + of colors and font styles so the properties of the next token can be + added to the output buffer. } + procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); virtual; + function UseBom: Boolean; virtual; abstract; + public + { Creates an instance of the exporter. } + constructor Create(AOwner: TComponent); override; + { Destroys an instance of the exporter. } + destructor Destroy; override; + { Clears the output buffer and any internal data that relates to the last + exported text. } + procedure Clear; virtual; + { Copies the output buffer contents to the clipboard, as the native format + or as text depending on the ExportAsText property. } + procedure CopyToClipboard; + { Exports everything in the strings parameter to the output buffer. } + procedure ExportAll(ALines: TUnicodeStrings); + { Exports the given range of the strings parameter to the output buffer. } + procedure ExportRange(ALines: TUnicodeStrings; Start, Stop: TBufferCoord); + { Saves the contents of the output buffer to a file. } + procedure SaveToFile(const FileName: UnicodeString); + { Saves the contents of the output buffer to a stream. } + procedure SaveToStream(Stream: TStream); + function SupportedEncodings: TSynEncodings; virtual; abstract; + public + { Default background color for text that has no token attribute assigned or + for token attributes that have the background set to default. } + property Color: TColor read FBackgroundColor write FBackgroundColor; + { Filter string for the output format for SaveAs file dialogs. } + property DefaultFilter: string read FDefaultFilter write FDefaultFilter; + property Encoding: TSynEncoding read FEncoding write SetEncoding default seUTF8; + property ExportAsText: Boolean read FExportAsText write SetExportAsText; + { The font to be used for the output format. The font color is used for text + that has no token attribute assigned or for token attributes that have + the background set to default. } + property Font: TFont read FFont write SetFont; + { The output format of the exporter. } + property FormatName: string read GetFormatName; + { The highlighter to use for exporting. } + property Highlighter: TSynCustomHighlighter + read FHighlighter write SetHighlighter; + { The title to embedd into the output header. } + property Title: UnicodeString read FTitle write SetTitle; + { Use the token attribute background for the exporting. } + property UseBackground: Boolean read FUseBackground write SetUseBackground; + end; + +const + EncodingStrs: array[TSynEncoding] of string = + ('UTF-8', 'UTF-16 Little Endian', 'UTF-16 Big Endian', 'ANSI'); + +resourcestring + SEncodingError = '%s encoding is not supported by %s-exporter'; + +implementation + +uses +{$IFDEF SYN_COMPILER_4_UP} + Math, +{$ENDIF} + SynEditMiscProcs, + SynEditStrConst; + +{ TSynCustomExporter } + +constructor TSynCustomExporter.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FBuffer := TMemoryStream.Create; + FClipboardFormat := CF_TEXT; + FCharSize := 1; + FEncoding := seUTF8; + FFont := TFont.Create; + FBackgroundColor := clWindow; + AssignFont(nil); + Clear; + FTitle := SYNS_Untitled; +end; + +destructor TSynCustomExporter.Destroy; +begin + FFont.Free; + FBuffer.Free; + inherited Destroy; +end; + +procedure TSynCustomExporter.AddData(const AText: UnicodeString); +begin + if AText <> '' then + begin + WriteString(AText); + FBuffer.SetSize(FBuffer.Position); + end; +end; + +procedure TSynCustomExporter.AddDataNewLine(const AText: UnicodeString); +begin + AddData(AText); + AddNewLine; +end; + +procedure TSynCustomExporter.AddNewLine; +begin + WriteString(WideCRLF); + FBuffer.SetSize(FBuffer.Position); +end; + +procedure TSynCustomExporter.AssignFont(Value: TFont); +begin + if Value <> nil then + FFont.Assign(Value) + else + begin + FFont.Name := 'Courier New'; + FFont.Size := 10; + FFont.Color := clWindowText; + FFont.Style := []; + end; +end; + +procedure TSynCustomExporter.Clear; +begin + FBuffer.Position := 0; + // Size is ReadOnly in Delphi 2 + FBuffer.SetSize(0); + FLastStyle := []; + FLastBG := clWindow; + FLastFG := clWindowText; +end; + +procedure SetClipboardText(Text: UnicodeString); +var + Mem: HGLOBAL; + P: PByte; + SLen: Integer; +begin + SLen := Length(Text); + Clipboard.Open; + try + Clipboard.Clear; + + // set ANSI text only on Win9X, WinNT automatically creates ANSI from Unicode + if Win32Platform <> VER_PLATFORM_WIN32_NT then + begin + Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, SLen + 1); + if Mem <> 0 then + begin + P := GlobalLock(Mem); + try + if P <> nil then + begin + Move(PAnsiChar(AnsiString(Text))^, P^, SLen + 1); + Clipboard.SetAsHandle(CF_TEXT, Mem); + end; + finally + GlobalUnlock(Mem); + end; + end; + end; + + // set unicode text, this also works on Win9X, even if the clipboard-viewer + // can't show it, Word 2000+ can paste it including the unicode only characters + Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, + (SLen + 1) * sizeof(WideChar)); + if Mem <> 0 then + begin + P := GlobalLock(Mem); + try + if P <> nil then + begin + Move(PWideChar(Text)^, P^, (SLen + 1) * sizeof(WideChar)); + Clipboard.SetAsHandle(CF_UNICODETEXT, Mem); + end; + finally + GlobalUnlock(Mem); + end; + end; + // Don't free Mem! It belongs to the clipboard now, and it will free it + // when it is done with it. + finally + Clipboard.Close; + end; +end; + +procedure TSynCustomExporter.CopyToClipboard; +const + Nulls: array[0..1] of Byte = (0, 0); +var + S: UnicodeString; +begin + if FExportAsText then + begin + FBuffer.Position := FBuffer.Size; + FBuffer.Write(Nulls, FCharSize); + case Encoding of + seUTF16LE: + S := PWideChar(FBuffer.Memory); + seUTF16BE: + begin + S := PWideChar(FBuffer.Memory); + StrSwapByteOrder(PWideChar(S)); + end; + seUTF8: +{$IFDEF UNICODE} + S := UTF8ToUnicodeString(PAnsiChar(FBuffer.Memory)); +{$ELSE} + S := UTF8Decode(PAnsiChar(FBuffer.Memory)); +{$ENDIF} + seAnsi: + S := UnicodeString(PAnsiChar(FBuffer.Memory)); + end; + SetClipboardText(S); + end + else + CopyToClipboardFormat(GetClipboardFormat); +end; + +procedure TSynCustomExporter.CopyToClipboardFormat(AFormat: UINT); +var + hData: THandle; + hDataSize: UINT; + PtrData: PByte; +begin + hDataSize := GetBufferSize + 1; + hData := GlobalAlloc(GMEM_MOVEABLE or GMEM_ZEROINIT or GMEM_SHARE, hDataSize); + if hData <> 0 then + try + PtrData := GlobalLock(hData); + if Assigned(PtrData) then + begin + try + FBuffer.Position := 0; + FBuffer.Read(PtrData^, hDataSize - 1); // trailing #0 + finally + GlobalUnlock(hData); + end; + Clipboard.SetAsHandle(AFormat, hData); + end + else + Abort; + except + GlobalFree(hData); + OutOfMemoryError; + end; +end; + +procedure TSynCustomExporter.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +procedure TSynCustomExporter.ExportAll(ALines: TUnicodeStrings); +begin + ExportRange(ALines, BufferCoord(1, 1), BufferCoord(MaxInt, MaxInt)); +end; + +procedure TSynCustomExporter.ExportRange(ALines: TUnicodeStrings; Start, Stop: TBufferCoord); +var + i: Integer; + Line, Token: UnicodeString; + Attri: TSynHighlighterAttributes; +begin + FStreaming := True; + try + // abort if not all necessary conditions are met + if not Assigned(ALines) or not Assigned(Highlighter) or (ALines.Count = 0) + or (Start.Line > ALines.Count) or (Start.Line > Stop.Line) + then + Abort; + + Stop.Line := Max(1, Min(Stop.Line, ALines.Count)); + Stop.Char := Max(1, Min(Stop.Char, Length(ALines[Stop.Line - 1]) + 1)); + Start.Char := Max(1, Min(Start.Char, Length(ALines[Start.Line - 1]) + 1)); + if (Start.Line = Stop.Line) and (Start.Char >= Stop.Char) then + Abort; + + // initialization + FBuffer.Position := 0; + // Size is ReadOnly in Delphi 2 + FBuffer.SetSize(Max($1000, (Stop.Line - Start.Line) * 128) * FCharSize); + Highlighter.ResetRange; + // export all the lines into FBuffer + FFirstAttribute := True; + for i := Start.Line to Stop.Line do + begin + Line := ALines[i - 1]; + // order is important, since Start.Y might be equal to Stop.Y + if i = Stop.Line then + Delete(Line, Stop.Char, MaxInt); + if (i = Start.Line) and (Start.Char > 1) then + Delete(Line, 1, Start.Char - 1); + // export the line + Highlighter.SetLine(Line, i); + while not Highlighter.GetEOL do + begin + Attri := Highlighter.GetTokenAttribute; + if Assigned(Attri) then // The .pas highlighter, for example, can return a nil Attri above for a trailing EOF/null that was loaded from a stream + begin + Token := ReplaceReservedChars(Highlighter.GetToken); + SetTokenAttribute(Attri); + FormatToken(Token); + end; + Highlighter.Next; + end; + FormatNewLine; + end; + if not FFirstAttribute then + FormatAfterLastAttribute; + + // insert header + InsertData(0, GetHeader); + // add footer + AddData(GetFooter); + finally + FStreaming := False + end +end; + +procedure TSynCustomExporter.FormatToken(Token: UnicodeString); +begin + AddData(Token); +end; + +function TSynCustomExporter.GetBufferSize: Integer; +begin + Result := FBuffer.Size; +end; + +function TSynCustomExporter.GetClipboardFormat: UINT; +begin + Result := FClipboardFormat; +end; + +function TSynCustomExporter.GetFormatName: string; +begin + Result := ''; +end; + +procedure TSynCustomExporter.InsertData(APos: Integer; const AText: UnicodeString); +var + Size, ToMove, SizeNeeded: Integer; + Dest: PByte; +begin + Size := StringSize(AText); + if Size > 0 then + begin + ToMove := FBuffer.Position; + SizeNeeded := ToMove + Size; + if FBuffer.Size < SizeNeeded then + // Size is ReadOnly in Delphi 2 + FBuffer.SetSize((SizeNeeded + $1800) and not $FFF); // increment in pages + Dest := FBuffer.Memory; + Inc(Dest, Size); + Move(FBuffer.Memory^, Dest^, ToMove); + FBuffer.Position := 0; + WriteString(AText); + FBuffer.Position := ToMove + Size; + FBuffer.SetSize(FBuffer.Position); + end; +end; + +function TSynCustomExporter.ReplaceReservedChars(AToken: UnicodeString): UnicodeString; +var + I, ISrc, IDest, SrcLen, DestLen: Integer; + Replace: UnicodeString; + c: WideChar; //mh 2000-10-10 +begin + if AToken <> '' then + begin + SrcLen := Length(AToken); + ISrc := 1; + DestLen := SrcLen; + IDest := 1; + SetLength(Result, DestLen); + while ISrc <= SrcLen do + begin + c := AToken[ISrc]; + Replace := ReplaceReservedChar(c); + if Replace <> '' then + Inc(ISrc) + else + begin + if IDest > DestLen then + begin + Inc(DestLen, 32); + SetLength(Result, DestLen); + end; + Result[IDest] := c; + Inc(ISrc); + Inc(IDest); + continue; + end; + if IDest + Length(Replace) - 1 > DestLen then + begin + Inc(DestLen, Max(32, IDest + Length(Replace) - DestLen)); + SetLength(Result, DestLen); + end; + for I := 1 to Length(Replace) do + begin + Result[IDest] := Replace[I]; + Inc(IDest); + end; + end; + SetLength(Result, IDest - 1); + end + else + Result := ''; +end; + +procedure TSynCustomExporter.SaveToFile(const FileName: UnicodeString); +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmCreate); + try + SaveToStream(Stream); + finally + Stream.Free; + end; +end; + +procedure TSynCustomExporter.SaveToStream(Stream: TStream); +begin + if UseBOM then + case Encoding of + seUTF8: + Stream.WriteBuffer(UTF8BOM, 3); + seUTF16LE: + Stream.WriteBuffer(UTF16BOMLE, 2); + seUTF16BE: + Stream.WriteBuffer(UTF16BOMBE, 2); + end; + FBuffer.Position := 0; + FBuffer.SaveToStream(Stream); +end; + +procedure TSynCustomExporter.SetEncoding(const Value: TSynEncoding); +begin + // don't change encoding while streaming as this could corrupt output data + if FStreaming then Exit; + + if not (Value in SupportedEncodings) then + raise ESynEncoding.CreateFmt(SEncodingError, [EncodingStrs[Value], + GetFormatName]); + + FEncoding := Value; + if Value in [seUTF8, seAnsi] then + FCharSize := 1 + else if Value in [seUTF16LE, seUTF16BE] then + FCharSize := 2; +end; + +procedure TSynCustomExporter.SetExportAsText(Value: Boolean); +begin + if FExportAsText <> Value then + begin + FExportAsText := Value; + Clear; + end; +end; + +procedure TSynCustomExporter.SetFont(Value: TFont); +begin + AssignFont(Value); +end; + +procedure TSynCustomExporter.SetHighlighter(Value: TSynCustomHighlighter); +begin + if FHighlighter <> Value then + begin + if FHighlighter <> nil then + FHighlighter.FreeNotification(Self); + FHighlighter := Value; + Clear; + if Assigned(FHighlighter) and Assigned(FHighlighter.WhitespaceAttribute) and FUseBackground then + FBackgroundColor := FHighlighter.WhitespaceAttribute.Background; + end; +end; + +procedure TSynCustomExporter.SetTitle(const Value: UnicodeString); +begin + if FTitle <> Value then + begin + if Value <> '' then + FTitle := Value + else + FTitle := SYNS_Untitled; + end; +end; + +procedure TSynCustomExporter.SetTokenAttribute(Attri: TSynHighlighterAttributes); +var + ChangedBG: Boolean; + ChangedFG: Boolean; + ChangedStyles: TFontStyles; + + function ValidatedColor(AColor, ADefColor: TColor): TColor; + begin + if AColor = clNone then + Result := ColorToRGB(ADefColor) + else + Result := ColorToRGB(AColor); + end; + +begin + if FFirstAttribute then + begin + FFirstAttribute := False; + FLastBG := ValidatedColor(Attri.Background, FBackgroundColor); + FLastFG := ValidatedColor(Attri.Foreground, FFont.Color); + FLastStyle := Attri.Style; + FormatBeforeFirstAttribute(UseBackground and (FLastBG <> FBackgroundColor), + FLastFG <> FFont.Color, Attri.Style); + end + else + begin + ChangedBG := UseBackground and + (FLastBG <> ValidatedColor(Attri.Background, FBackgroundColor)); + ChangedFG := (FLastFG <> ValidatedColor(Attri.Foreground, FFont.Color)); + // which font style bits are to be reset? + ChangedStyles := FLastStyle - Attri.Style; + if ChangedBG or ChangedFG or (FLastStyle <> Attri.Style) then + begin + FormatAttributeDone(ChangedBG, ChangedFG, ChangedStyles); + // which font style bits are to be set? + ChangedStyles := Attri.Style - FLastStyle; + FLastBG := ValidatedColor(Attri.Background, FBackgroundColor); + FLastFG := ValidatedColor(Attri.Foreground, FFont.Color); + FLastStyle := Attri.Style; + FormatAttributeInit(ChangedBG, ChangedFG, ChangedStyles); + end; + end; +end; + +procedure TSynCustomExporter.SetUseBackground(const Value: Boolean); +begin + FUseBackground := Value; + if Assigned(FHighlighter) and Assigned(FHighlighter.WhitespaceAttribute) and FUseBackground then + FBackgroundColor := FHighlighter.WhitespaceAttribute.Background; +end; + +function TSynCustomExporter.StringSize(const AText: UnicodeString): Integer; +begin + Result := 0; + case Encoding of + seUTF8: + Result := Length(UTF8Encode(AText)); + seUTF16LE, seUTF16BE: + Result := Length(AText); + seAnsi: + Result := Length(AnsiString(PWideChar(AText))); + end; + Result := Result * FCharSize; +end; + +procedure TSynCustomExporter.WriteString(const AText: UnicodeString); +var + UTF8Str: UTF8String; + AnsiStr: AnsiString; +begin + case Encoding of + seUTF8: + begin + UTF8Str := UTF8Encode(AText); + FBuffer.WriteBuffer(UTF8Str[1], Length(UTF8Str)); + end; + seUTF16LE: + FBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); + seUTF16BE: + begin + StrSwapByteOrder(PWideChar(AText)); + FBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); + end; + seAnsi: + begin + AnsiStr := AnsiString(PWideChar(AText)); + FBuffer.WriteBuffer(AnsiStr[1], Length(AnsiStr)); + end; + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditHighlighter.pas b/Source/VCL/SynEdit/Source/SynEditHighlighter.pas index 73fd7051..374f5213 100644 --- a/Source/VCL/SynEdit/Source/SynEditHighlighter.pas +++ b/Source/VCL/SynEdit/Source/SynEditHighlighter.pas @@ -1,1315 +1,1194 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditHighlighter.pas, released 2000-04-07. - -The Original Code is based on mwHighlighter.pas by Martin Waldenburg, part of -the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -Options property added by CodehunterWorks -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditHighlighter; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Windows, - Registry, - IniFiles, - SynEditTypes, - SynEditMiscClasses, - SynUnicode, - SysUtils, - Classes, - SynEditHighlighterOptions; - -type - TBetterRegistry = SynEditMiscClasses.TBetterRegistry; - -type - TSynHighlighterAttributes = class(TPersistent) - private - fBackground: TColor; - fBackgroundDefault: TColor; - fForeground: TColor; - fForegroundDefault: TColor; - fFriendlyName: string; - fName: string; - fStyle: TFontStyles; - fStyleDefault: TFontStyles; - fOnChange: TNotifyEvent; - procedure Changed; virtual; - function GetBackgroundColorStored: Boolean; - function GetForegroundColorStored: Boolean; - function GetFontStyleStored: Boolean; - procedure SetBackground(Value: TColor); - procedure SetForeground(Value: TColor); - procedure SetStyle(Value: TFontStyles); - function GetStyleFromInt: Integer; - procedure SetStyleFromInt(const Value: Integer); - public - procedure Assign(Source: TPersistent); override; - procedure AssignColorAndStyle(Source: TSynHighlighterAttributes); - constructor Create(AName: string; AFriendlyName: string); - procedure InternalSaveDefaultValues; - function LoadFromBorlandRegistry(RootKey: HKEY; AttrKey, AttrName: string; - OldStyle: Boolean): Boolean; virtual; - function LoadFromRegistry(Reg: TBetterRegistry): Boolean; - function SaveToRegistry(Reg: TBetterRegistry): Boolean; - function LoadFromFile(Ini: TCustomIniFile): Boolean; - function SaveToFile(Ini: TCustomIniFile): Boolean; - public - procedure SetColors(Foreground, Background: TColor); - property FriendlyName: string read fFriendlyName; - property IntegerStyle: Integer read GetStyleFromInt write SetStyleFromInt; - property Name: string read fName; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - published - property Background: TColor read fBackground write SetBackground - stored GetBackgroundColorStored; - property Foreground: TColor read fForeground write SetForeground - stored GetForegroundColorStored; - property Style: TFontStyles read fStyle write SetStyle - stored GetFontStyleStored; - end; - - TSynHighlighterCapability = ( - hcUserSettings, // supports Enum/UseUserSettings - hcRegistry // supports LoadFrom/SaveToRegistry - ); - - TSynHighlighterCapabilities = set of TSynHighlighterCapability; - -const - SYN_ATTR_COMMENT = 0; - SYN_ATTR_IDENTIFIER = 1; - SYN_ATTR_KEYWORD = 2; - SYN_ATTR_STRING = 3; - SYN_ATTR_WHITESPACE = 4; - SYN_ATTR_SYMBOL = 5; - -type - TSynCustomHighlighter = class(TComponent) - private - fAttributes: TStringList; - fAttrChangeHooks: TSynNotifyEventChain; - fUpdateCount: Integer; - fEnabled: Boolean; - FAdditionalWordBreakChars: TSysCharSet; - FAdditionalIdentChars: TSysCharSet; - FExportName: string; - FOptions: TSynEditHighlighterOptions; - function GetExportName: string; - procedure SetEnabled(const Value: Boolean); - procedure SetAdditionalIdentChars(const Value: TSysCharSet); - procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); - protected - fCasedLine: PWideChar; - fCasedLineStr: string; - fCaseSensitive: Boolean; - fDefaultFilter: string; - fExpandedLine: PWideChar; - fExpandedLineLen: Integer; - fExpandedLineStr: string; - fExpandedTokenPos: Integer; - fLine: PWideChar; - fLineLen: Integer; - fLineStr: string; - fLineNumber: Integer; - fStringLen: Integer; - fToIdent: PWideChar; - fTokenPos: Integer; - fUpdateChange: Boolean; - Run: Integer; - ExpandedRun: Integer; - fOldRun: Integer; - procedure Loaded; override; - procedure AddAttribute(Attri: TSynHighlighterAttributes); - procedure DefHighlightChange(Sender: TObject); - procedure DefineProperties(Filer: TFiler); override; - procedure FreeHighlighterAttributes; - function GetAttribCount: Integer; virtual; - function GetAttribute(Index: Integer): TSynHighlighterAttributes; virtual; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - virtual; abstract; - function GetDefaultFilter: string; virtual; - function GetSampleSource: string; virtual; - procedure DoSetLine(const Value: string; LineNumber: Integer); virtual; - function IsCurrentToken(const Token: string): Boolean; virtual; - function IsFilterStored: Boolean; virtual; - function IsLineEnd(Run: Integer): Boolean; virtual; - procedure SetAttributesOnChange(AEvent: TNotifyEvent); - procedure SetDefaultFilter(Value: string); virtual; - procedure SetSampleSource(Value: string); virtual; - protected - function GetCapabilitiesProp: TSynHighlighterCapabilities; - function GetFriendlyLanguageNameProp: string; - function GetLanguageNameProp: string; - public - class function GetCapabilities: TSynHighlighterCapabilities; virtual; - class function GetFriendlyLanguageName: string; virtual; - class function GetLanguageName: string; virtual; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - procedure BeginUpdate; - procedure EndUpdate; - function GetEol: Boolean; virtual; abstract; - function GetExpandedToken: string; virtual; - function GetExpandedTokenPos: Integer; virtual; - function GetKeyWords(TokenKind: Integer): string; virtual; - function GetRange: Pointer; virtual; - function GetToken: string; virtual; - function GetTokenAttribute: TSynHighlighterAttributes; virtual; abstract; - function GetTokenKind: Integer; virtual; abstract; - function GetTokenPos: Integer; virtual; - function IsKeyword(const AKeyword: string): Boolean; virtual; - procedure Next; virtual; - procedure NextToEol; - function PosToExpandedPos(Pos: Integer): Integer; - procedure SetLineExpandedAtWideGlyphs(const Line, ExpandedLine: string; - LineNumber: Integer); virtual; - procedure SetLine(const Value: string; LineNumber: Integer); virtual; - procedure SetRange(Value: Pointer); virtual; - procedure ResetRange; virtual; - function UseUserSettings(settingIndex: Integer): Boolean; virtual; - procedure EnumUserSettings(Settings: TStrings); virtual; - function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; virtual; - function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; virtual; - function LoadFromIniFile(AIni: TCustomIniFile): Boolean; - function SaveToIniFile(AIni: TCustomIniFile): Boolean; - function LoadFromFile(AFileName: string): Boolean; - function SaveToFile(AFileName: string): Boolean; - procedure HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); - procedure UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); - function IsIdentChar(AChar: WideChar): Boolean; virtual; - function IsWhiteChar(AChar: WideChar): Boolean; virtual; - function IsWordBreakChar(AChar: WideChar): Boolean; virtual; - property FriendlyLanguageName: string read GetFriendlyLanguageNameProp; - property LanguageName: string read GetLanguageNameProp; - public - property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; - property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; - property AttrCount: Integer read GetAttribCount; - property Attribute[Index: Integer]: TSynHighlighterAttributes - read GetAttribute; - property Capabilities: TSynHighlighterCapabilities read GetCapabilitiesProp; - property SampleSource: string read GetSampleSource write SetSampleSource; - property CommentAttribute: TSynHighlighterAttributes - index SYN_ATTR_COMMENT read GetDefaultAttribute; - property IdentifierAttribute: TSynHighlighterAttributes - index SYN_ATTR_IDENTIFIER read GetDefaultAttribute; - property KeywordAttribute: TSynHighlighterAttributes - index SYN_ATTR_KEYWORD read GetDefaultAttribute; - property StringAttribute: TSynHighlighterAttributes - index SYN_ATTR_STRING read GetDefaultAttribute; - property SymbolAttribute: TSynHighlighterAttributes - index SYN_ATTR_SYMBOL read GetDefaultAttribute; - property WhitespaceAttribute: TSynHighlighterAttributes - index SYN_ATTR_WHITESPACE read GetDefaultAttribute; - property ExportName: string read GetExportName; - published - property DefaultFilter: string read GetDefaultFilter write SetDefaultFilter - stored IsFilterStored; - property Enabled: Boolean read fEnabled write SetEnabled default True; - property Options: TSynEditHighlighterOptions read FOptions write FOptions; // <-- Codehunter patch - end; - - TSynCustomHighlighterClass = class of TSynCustomHighlighter; - - TSynHighlighterList = class(TList) - private - hlList: TList; - function GetItem(Index: Integer): TSynCustomHighlighterClass; - public - constructor Create; - destructor Destroy; override; - function Count: Integer; - function FindByFriendlyName(FriendlyName: string): Integer; - function FindByName(Name: string): Integer; - function FindByClass(Comp: TComponent): Integer; - property Items[Index: Integer]: TSynCustomHighlighterClass - read GetItem; default; - end; - - procedure RegisterPlaceableHighlighter(highlighter: - TSynCustomHighlighterClass); - function GetPlaceableHighlighters: TSynHighlighterList; - -implementation - -uses - SynEditMiscProcs, - SynEditStrConst; - -{ THighlighterList } -function TSynHighlighterList.Count: Integer; -begin - Result := hlList.Count; -end; - -constructor TSynHighlighterList.Create; -begin - inherited Create; - hlList := TList.Create; -end; - -destructor TSynHighlighterList.Destroy; -begin - hlList.Free; - inherited; -end; - -function TSynHighlighterList.FindByClass(Comp: TComponent): Integer; -var - i: Integer; -begin - Result := -1; - for i := 0 to Count - 1 do - begin - if Comp is Items[i] then - begin - Result := i; - Exit; - end; - end; -end; - -function TSynHighlighterList.FindByFriendlyName(FriendlyName: string): Integer; -var - i: Integer; -begin - Result := -1; - for i := 0 to Count - 1 do - begin - if Items[i].GetFriendlyLanguageName = FriendlyName then - begin - Result := i; - Exit; - end; - end; -end; - -function TSynHighlighterList.FindByName(Name: string): Integer; -var - i: Integer; -begin - Result := -1; - for i := 0 to Count - 1 do - begin - if Items[i].GetLanguageName = Name then - begin - Result := i; - Exit; - end; - end; -end; - -function TSynHighlighterList.GetItem(Index: Integer): TSynCustomHighlighterClass; -begin - Result := TSynCustomHighlighterClass(hlList[Index]); -end; - -var - G_PlaceableHighlighters: TSynHighlighterList; - - function GetPlaceableHighlighters: TSynHighlighterList; - begin - Result := G_PlaceableHighlighters; - end; - - procedure RegisterPlaceableHighlighter(highlighter: TSynCustomHighlighterClass); - begin - if G_PlaceableHighlighters.hlList.IndexOf(highlighter) < 0 then - G_PlaceableHighlighters.hlList.Add(highlighter); - end; - -{ TSynHighlighterAttributes } - -procedure TSynHighlighterAttributes.Assign(Source: TPersistent); -begin - if Source is TSynHighlighterAttributes then - begin - fName := TSynHighlighterAttributes(Source).fName; - AssignColorAndStyle(TSynHighlighterAttributes(Source)); - end - else - inherited Assign(Source); -end; - -procedure TSynHighlighterAttributes.AssignColorAndStyle(Source: TSynHighlighterAttributes); -var - bChanged: Boolean; -begin - bChanged := False; - if fBackground <> Source.fBackground then - begin - fBackground := Source.fBackground; - bChanged := True; - end; - if fForeground <> Source.fForeground then - begin - fForeground := Source.fForeground; - bChanged := True; - end; - if fStyle <> Source.fStyle then - begin - fStyle := Source.fStyle; - bChanged := True; - end; - if bChanged then - Changed; -end; - - -procedure TSynHighlighterAttributes.Changed; -begin - if Assigned(fOnChange) then - fOnChange(Self); -end; - -constructor TSynHighlighterAttributes.Create(AName: string; AFriendlyName: string); -begin - inherited Create; - Background := clNone; - Foreground := clNone; - fName := AName; - fFriendlyName := AFriendlyName; -end; - -function TSynHighlighterAttributes.GetBackgroundColorStored: Boolean; -begin - Result := fBackground <> fBackgroundDefault; -end; - -function TSynHighlighterAttributes.GetForegroundColorStored: Boolean; -begin - Result := fForeground <> fForegroundDefault; -end; - -function TSynHighlighterAttributes.GetFontStyleStored: Boolean; -begin - Result := fStyle <> fStyleDefault; -end; - -procedure TSynHighlighterAttributes.InternalSaveDefaultValues; -begin - fForegroundDefault := fForeground; - fBackgroundDefault := fBackground; - fStyleDefault := fStyle; -end; - -function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; - AttrKey, AttrName: string; OldStyle: Boolean): Boolean; - // How the highlighting information is stored: - // Delphi 1.0: - // I don't know and I don't care. - // Delphi 2.0 & 3.0: - // In the registry branch HKCU\Software\Borland\Delphi\x.0\Highlight - // where x=2 or x=3. - // Each entry is one string value, encoded as - // ,,,,,, - // Example: - // 0,16777215,BI,0,1,0,15 - // foreground color (RGB): 0 - // background color (RGB): 16777215 ($FFFFFF) - // font style: BI (bold italic), possible flags: B(old), I(talic), U(nderline) - // default foreground: no, specified color will be used (black (0) is used when this flag is 1) - // default background: yes, white ($FFFFFF, 15) will be used for background - // foreground index: 0 (foreground index (Pal16), corresponds to foreground RGB color) - // background index: 15 (background index (Pal16), corresponds to background RGB color) - // Delphi 4.0 & 5.0: - // In the registry branch HKCU\Software\Borland\Delphi\4.0\Editor\Highlight. - // Each entry is subkey containing several values: - // Foreground Color: foreground index (Pal16), 0..15 (dword) - // Background Color: background index (Pal16), 0..15 (dword) - // Bold: fsBold yes/no, 0/True (string) - // Italic: fsItalic yes/no, 0/True (string) - // Underline: fsUnderline yes/no, 0/True (string) - // Default Foreground: use default foreground (clBlack) yes/no, False/-1 (string) - // Default Background: use default backround (clWhite) yes/no, False/-1 (string) -const - Pal16: array [0..15] of TColor = ( - clBlack, clMaroon, clGreen, clOlive, clNavy, clPurple, clTeal, clLtGray, - clDkGray, clRed, clLime, clYellow, clBlue, clFuchsia, clAqua, clWhite - ); - - function LoadOldStyle(RootKey: HKEY; AttrKey, AttrName: string): Boolean; - var - descript: string; - fgColRGB: string; - bgColRGB: string; - fontStyle: string; - fgDefault: string; - bgDefault: string; - fgIndex16: string; - bgIndex16: string; - reg: TBetterRegistry; - - function Get(var Name: string): string; - var - p: Integer; - begin - p := Pos(',', Name); - if p = 0 then p := Length(Name) + 1; - Result := Copy(name, 1, p - 1); - name := Copy(name, p + 1, Length(name) - p); - end; - - begin { LoadOldStyle } - Result := False; - try - reg := TBetterRegistry.Create; - reg.RootKey := RootKey; - try - with reg do - begin - if OpenKeyReadOnly(AttrKey) then - begin - try - if ValueExists(AttrName) then - begin - descript := ReadString(AttrName); - fgColRGB := Get(descript); - bgColRGB := Get(descript); - fontStyle := Get(descript); - fgDefault := Get(descript); - bgDefault := Get(descript); - fgIndex16 := Get(descript); - bgIndex16 := Get(descript); - if bgDefault = '1' then - Background := clWindow - else - Background := Pal16[StrToInt(bgIndex16)]; - if fgDefault = '1' then - Foreground := clWindowText - else - Foreground := Pal16[StrToInt(fgIndex16)]; - Style := []; - if Pos('B', fontStyle) > 0 then Style := Style + [fsBold]; - if Pos('I', fontStyle) > 0 then Style := Style + [fsItalic]; - if Pos('U', fontStyle) > 0 then Style := Style + [fsUnderline]; - Result := True; - end; - finally - CloseKey; - end; - end; // if - end; // with - finally - reg.Free; - end; - except - end; - end; { LoadOldStyle } - - function LoadNewStyle(RootKey: HKEY; AttrKey, AttrName: string): Boolean; - var - fgColor: Integer; - bgColor: Integer; - fontBold: string; - fontItalic: string; - fontUnderline: string; - fgDefault: string; - bgDefault: string; - reg: TBetterRegistry; - - function IsTrue(Value: string): Boolean; - begin - Result := not ((UpperCase(Value) = 'FALSE') or (Value = '0')); - end; { IsTrue } - - begin - Result := False; - try - reg := TBetterRegistry.Create; - reg.RootKey := RootKey; - try - with reg do - begin - if OpenKeyReadOnly(AttrKey + '\' + AttrName) then - begin - try - if ValueExists('Foreground Color') - then fgColor := Pal16[ReadInteger('Foreground Color')] - else if ValueExists('Foreground Color New') then - fgColor := StringToColor(ReadString('Foreground Color New')) - else - Exit; - if ValueExists('Background Color') - then bgColor := Pal16[ReadInteger('Background Color')] - else if ValueExists('Background Color New') then - bgColor := StringToColor(ReadString('Background Color New')) - else - Exit; - if ValueExists('Bold') - then fontBold := ReadString('Bold') - else Exit; - if ValueExists('Italic') - then fontItalic := ReadString('Italic') - else Exit; - if ValueExists('Underline') - then fontUnderline := ReadString('Underline') - else Exit; - if ValueExists('Default Foreground') - then fgDefault := ReadString('Default Foreground') - else Exit; - if ValueExists('Default Background') - then bgDefault := ReadString('Default Background') - else Exit; - if IsTrue(bgDefault) - then Background := clWindow - else Background := bgColor; - if IsTrue(fgDefault) - then Foreground := clWindowText - else Foreground := fgColor; - Style := []; - if IsTrue(fontBold) then Style := Style + [fsBold]; - if IsTrue(fontItalic) then Style := Style + [fsItalic]; - if IsTrue(fontUnderline) then Style := Style + [fsUnderline]; - Result := True; - finally - CloseKey; - end; - end; // if - end; // with - finally - reg.Free; - end; - except - end; - end; { LoadNewStyle } - -begin - if OldStyle then - Result := LoadOldStyle(RootKey, AttrKey, AttrName) - else - Result := LoadNewStyle(RootKey, AttrKey, AttrName); -end; { TSynHighlighterAttributes.LoadFromBorlandRegistry } - -procedure TSynHighlighterAttributes.SetBackground(Value: TColor); -begin - if fBackGround <> Value then - begin - fBackGround := Value; - Changed; - end; -end; - -procedure TSynHighlighterAttributes.SetColors(Foreground, Background: TColor); -begin - if (fForeGround <> Foreground) or (fBackground <> Background) then - begin - fForeGround := Foreground; - fBackground := Background; - Changed; - end; -end; - -procedure TSynHighlighterAttributes.SetForeground(Value: TColor); -begin - if fForeGround <> Value then - begin - fForeGround := Value; - Changed; - end; -end; - -procedure TSynHighlighterAttributes.SetStyle(Value: TFontStyles); -begin - if fStyle <> Value then - begin - fStyle := Value; - Changed; - end; -end; - -function TSynHighlighterAttributes.LoadFromRegistry(Reg: TBetterRegistry): Boolean; -var - Key: string; -begin - Key := Reg.CurrentPath; - if Reg.OpenKeyReadOnly(Name) then - begin - if Reg.ValueExists('Background') then - Background := Reg.ReadInteger('Background'); - if Reg.ValueExists('Foreground') then - Foreground := Reg.ReadInteger('Foreground'); - if Reg.ValueExists('Style') then - IntegerStyle := Reg.ReadInteger('Style'); - reg.OpenKeyReadOnly('\' + Key); - Result := True; - end - else - Result := False; -end; - -function TSynHighlighterAttributes.SaveToRegistry(Reg: TBetterRegistry): Boolean; -var - Key: string; -begin - Key := Reg.CurrentPath; - if Reg.OpenKey(Name, True) then - begin - Reg.WriteInteger('Background', Background); - Reg.WriteInteger('Foreground', Foreground); - Reg.WriteInteger('Style', IntegerStyle); - reg.OpenKey('\' + Key, False); - Result := True; - end - else - Result := False; -end; - -function TSynHighlighterAttributes.LoadFromFile(Ini: TCustomIniFile): Boolean; -var - S: TStringList; -begin - S := TStringList.Create; - try - Ini.ReadSection(Name, S); - if S.Count > 0 then - begin - if S.IndexOf('Background') <> -1 then - Background := Ini.ReadInteger(Name, 'Background', Background); - if S.IndexOf('Foreground') <> -1 then - Foreground := Ini.ReadInteger(Name, 'Foreground', Foreground); - if S.IndexOf('Style') <> -1 then - IntegerStyle := Ini.ReadInteger(Name, 'Style', IntegerStyle); - Result := true; - end - else - Result := False; - finally - S.Free; - end; -end; - -function TSynHighlighterAttributes.SaveToFile(Ini: TCustomIniFile): Boolean; -begin - Ini.WriteInteger(Name, 'Background', Background); - Ini.WriteInteger(Name, 'Foreground', Foreground); - Ini.WriteInteger(Name, 'Style', IntegerStyle); - Result := True; -end; - -function TSynHighlighterAttributes.GetStyleFromInt: Integer; -begin - if fsBold in Style then Result := 1 else Result := 0; - if fsItalic in Style then Result := Result + 2; - if fsUnderline in Style then Result:= Result + 4; - if fsStrikeout in Style then Result:= Result + 8; -end; - -procedure TSynHighlighterAttributes.SetStyleFromInt(const Value: Integer); -begin - if Value and $1 = 0 then Style:= [] else Style := [fsBold]; - if Value and $2 <> 0 then Style:= Style + [fsItalic]; - if Value and $4 <> 0 then Style:= Style + [fsUnderline]; - if Value and $8 <> 0 then Style:= Style + [fsStrikeout]; -end; - -{ TSynCustomHighlighter } - -constructor TSynCustomHighlighter.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fAttributes := TStringList.Create; - fAttributes.Duplicates := dupError; - fAttributes.Sorted := True; - fAttrChangeHooks := TSynNotifyEventChain.CreateEx(Self); - fDefaultFilter := ''; - fEnabled := True; - FOptions:= TSynEditHighlighterOptions.Create; // <-- Codehunter patch -end; - -destructor TSynCustomHighlighter.Destroy; -begin - inherited Destroy; - FreeHighlighterAttributes; - fAttributes.Free; - fAttrChangeHooks.Free; - FOptions.Free; // <-- Codehunter patch -end; - -procedure TSynCustomHighlighter.BeginUpdate; -begin - Inc(fUpdateCount); -end; - -procedure TSynCustomHighlighter.EndUpdate; -begin - if fUpdateCount > 0 then - begin - Dec(fUpdateCount); - if (fUpdateCount = 0) and fUpdateChange then - begin - fUpdateChange := False; - DefHighlightChange(nil); - end; - end; -end; - -procedure TSynCustomHighlighter.FreeHighlighterAttributes; -var - i: Integer; -begin - if fAttributes <> nil then - begin - for i := fAttributes.Count - 1 downto 0 do - TSynHighlighterAttributes(fAttributes.Objects[i]).Free; - fAttributes.Clear; - end; -end; - -procedure TSynCustomHighlighter.Assign(Source: TPersistent); -var - Src: TSynCustomHighlighter; - i, j: Integer; - AttriName: string; - SrcAttri: TSynHighlighterAttributes; -begin - if (Source <> nil) and (Source is TSynCustomHighlighter) then - begin - BeginUpdate; - try - Src := TSynCustomHighlighter(Source); - for i := 0 to AttrCount - 1 do - begin - // assign first attribute with the same name - AttriName := Attribute[i].Name; - for j := 0 to Src.AttrCount - 1 do - begin - SrcAttri := Src.Attribute[j]; - if AttriName = SrcAttri.Name then - begin - Attribute[i].Assign(SrcAttri); - break; - end; - end; - end; - // assign the sample source text only if same or descendant class - if Src is ClassType then - SampleSource := Src.SampleSource; - //fWordBreakChars := Src.WordBreakChars; //TODO: does this make sense anyway? - DefaultFilter := Src.DefaultFilter; - Enabled := Src.Enabled; - finally - EndUpdate; - end; - end - else - inherited Assign(Source); -end; - -procedure TSynCustomHighlighter.EnumUserSettings(Settings: TStrings); -begin - Settings.Clear; -end; - -function TSynCustomHighlighter.UseUserSettings(settingIndex: Integer): Boolean; -begin - Result := False; -end; - -function TSynCustomHighlighter.LoadFromRegistry(RootKey: HKEY; - Key: string): Boolean; -var - r: TBetterRegistry; - i: Integer; -begin - r := TBetterRegistry.Create; - try - r.RootKey := RootKey; - if r.OpenKeyReadOnly(Key) then - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].LoadFromRegistry(r) and Result; - end - else - Result := False; - finally - r.Free; - end; -end; - -function TSynCustomHighlighter.SaveToRegistry(RootKey: HKEY; - Key: string): Boolean; -var - r: TBetterRegistry; - i: Integer; -begin - r := TBetterRegistry.Create; - try - r.RootKey := RootKey; - if r.OpenKey(Key,True) then - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].SaveToRegistry(r) and Result; - end - else - Result := False; - finally - r.Free; - end; -end; - -function TSynCustomHighlighter.LoadFromFile(AFileName : String): boolean; -var - AIni: TMemIniFile; -begin - AIni := TMemIniFile.Create(AFileName); - try - Result := LoadFromIniFile(AIni); - finally - AIni.Free; - end; -end; - -function TSynCustomHighlighter.SaveToFile(AFileName : String): boolean; -var - AIni: TMemIniFile; -begin - AIni := TMemIniFile.Create(AFileName); - try - Result := SaveToIniFile(AIni); - finally - AIni.Free; - end; -end; - -procedure TSynCustomHighlighter.AddAttribute(Attri: TSynHighlighterAttributes); -begin - fAttributes.AddObject(Attri.Name, Attri); -end; - -procedure TSynCustomHighlighter.DefHighlightChange(Sender: TObject); -begin - if fUpdateCount > 0 then - fUpdateChange := True - else if not(csLoading in ComponentState) then - begin - fAttrChangeHooks.Sender := Sender; - fAttrChangeHooks.Fire; - end; -end; - -procedure TSynCustomHighlighter.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -function TSynCustomHighlighter.GetAttribCount: Integer; -begin - Result := fAttributes.Count; -end; - -function TSynCustomHighlighter.GetAttribute(Index: Integer): - TSynHighlighterAttributes; -begin - Result := nil; - if (Index >= 0) and (Index < fAttributes.Count) then - Result := TSynHighlighterAttributes(fAttributes.Objects[Index]); -end; - -class function TSynCustomHighlighter.GetCapabilities: TSynHighlighterCapabilities; -begin - Result := [hcRegistry]; //registry save/load supported by default -end; - -function TSynCustomHighlighter.GetCapabilitiesProp: TSynHighlighterCapabilities; -begin - Result := GetCapabilities; -end; - -function TSynCustomHighlighter.GetDefaultFilter: string; -begin - Result := fDefaultFilter; -end; - -function TSynCustomHighlighter.GetExpandedTokenPos: Integer; -begin - if fExpandedLine = nil then - Result := fTokenPos - else - Result := fExpandedTokenPos; -end; - -function TSynCustomHighlighter.GetExportName: string; -begin - if FExportName = '' then - FExportName := SynEditMiscProcs.DeleteTypePrefixAndSynSuffix(ClassName); - Result := FExportName; -end; - -function TSynCustomHighlighter.GetExpandedToken: string; -var - Len: Integer; -begin - if fExpandedLine = nil then - begin - Result := GetToken; - Exit; - end; - - Len := ExpandedRun - fExpandedTokenPos; - SetLength(Result, Len); - if Len > 0 then - StrLCopy(@Result[1], fExpandedLine + fExpandedTokenPos, Len); -end; - -class function TSynCustomHighlighter.GetFriendlyLanguageName: string; -begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('%s.GetFriendlyLanguageName not implemented', [ClassName]); -{$ENDIF} - Result := SYNS_FriendlyLangUnknown; -end; - -class function TSynCustomHighlighter.GetLanguageName: string; -begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('%s.GetLanguageName not implemented', [ClassName]); -{$ENDIF} - Result := SYNS_LangUnknown; -end; - -function TSynCustomHighlighter.GetFriendlyLanguageNameProp: string; -begin - Result := GetFriendlyLanguageName; -end; - -function TSynCustomHighlighter.GetLanguageNameProp: string; -begin - Result := GetLanguageName; -end; - -function TSynCustomHighlighter.GetRange: Pointer; -begin - Result := nil; -end; - -function TSynCustomHighlighter.GetToken: string; -var - Len: Integer; -begin - Len := Run - fTokenPos; - SetLength(Result, Len); - if Len > 0 then - StrLCopy(@Result[1], fCasedLine + fTokenPos, Len); -end; - -function TSynCustomHighlighter.GetTokenPos: Integer; -begin - Result := fTokenPos; -end; - -function TSynCustomHighlighter.GetKeyWords(TokenKind: Integer): string; -begin - Result := ''; -end; - -function TSynCustomHighlighter.GetSampleSource: string; -begin - Result := ''; -end; - -procedure TSynCustomHighlighter.HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); -begin - fAttrChangeHooks.Add(ANotifyEvent); -end; - -function TSynCustomHighlighter.IsCurrentToken(const Token: string): Boolean; -var - I: Integer; - Temp: PWideChar; -begin - Temp := fToIdent; - if Length(Token) = fStringLen then - begin - Result := True; - for i := 1 to fStringLen do - begin - if Temp^ <> Token[i] then - begin - Result := False; - break; - end; - inc(Temp); - end; - end - else - Result := False; -end; - -function TSynCustomHighlighter.IsFilterStored: Boolean; -begin - Result := True; -end; - -function TSynCustomHighlighter.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '_', '0'..'9', 'A'..'Z', 'a'..'z': - Result := True; - else - Result := False; - end; -end; - -function TSynCustomHighlighter.IsKeyword(const AKeyword: string): Boolean; -begin - Result := False; -end; - -function TSynCustomHighlighter.IsLineEnd(Run: Integer): Boolean; -begin - Result := (Run >= fLineLen) or (fLine[Run] = #10) or (fLine[Run] = #13); -end; - -function TSynCustomHighlighter.IsWhiteChar(AChar: WideChar): Boolean; -begin - case Ord(AChar) of - 0..32: - Result := True; - else - Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) - end -end; - -function TSynCustomHighlighter.IsWordBreakChar(AChar: WideChar): Boolean; -begin - case AChar of - '.', ',', ';', ':', '"', '''', '´', '`', '°', '^', '!', '?', '&', - '$', '@', '§', '%', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', - '-', '=', '+', '*', '/', '\', '|': - Result := True; - else - begin - case Ord(AChar) of - 0..32: Result := True; - else - Result := False; - end; - end; - end; -end; - -function TSynCustomHighlighter.SaveToIniFile(AIni: TCustomIniFile): Boolean; -var - i: Integer; -begin - with AIni do - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].SaveToFile(AIni) and Result; - end; - AIni.UpdateFile; -end; - -function TSynCustomHighlighter.LoadFromIniFile(AIni: TCustomIniFile): Boolean; -var - i: Integer; -begin - with AIni do - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].LoadFromFile(AIni) and Result; - end; -end; - -procedure TSynCustomHighlighter.Next; -var - Delta: Integer; -begin - if fOldRun = Run then Exit; - - fExpandedTokenPos := ExpandedRun; - if fExpandedLine = nil then Exit; - - Delta := Run - fOldRun; - while Delta > 0 do - begin - while fExpandedLine[ExpandedRun] = FillerChar do - inc(ExpandedRun); - inc(ExpandedRun); - dec(Delta); - end; - fOldRun := Run; -end; - -procedure TSynCustomHighlighter.NextToEol; -begin - while not GetEol do Next; -end; - -procedure TSynCustomHighlighter.ResetRange; -begin -end; - -procedure TSynCustomHighlighter.SetAdditionalIdentChars( - const Value: TSysCharSet); -begin - FAdditionalIdentChars := Value; -end; - -procedure TSynCustomHighlighter.SetAdditionalWordBreakChars( - const Value: TSysCharSet); -begin - FAdditionalWordBreakChars := Value; -end; - -procedure TSynCustomHighlighter.SetAttributesOnChange(AEvent: TNotifyEvent); -var - i: Integer; - Attri: TSynHighlighterAttributes; -begin - for i := fAttributes.Count - 1 downto 0 do - begin - Attri := TSynHighlighterAttributes(fAttributes.Objects[i]); - if Attri <> nil then - begin - Attri.OnChange := AEvent; - Attri.InternalSaveDefaultValues; - end; - end; -end; - -procedure TSynCustomHighlighter.SetLineExpandedAtWideGlyphs(const Line, - ExpandedLine: string; LineNumber: Integer); -begin - fExpandedLineStr := ExpandedLine; - fExpandedLine := PWideChar(fExpandedLineStr); - fExpandedLineLen := Length(fExpandedLineStr); - DoSetLine(Line, LineNumber); - Next; -end; - -procedure TSynCustomHighlighter.SetLine(const Value: string; LineNumber: Integer); -begin - fExpandedLineStr := ''; - fExpandedLine := nil; - fExpandedLineLen := 0; - DoSetLine(Value, LineNumber); - Next; -end; - -procedure TSynCustomHighlighter.DoSetLine(const Value: string; LineNumber: Integer); - - procedure DoWideLowerCase(const value : string; var dest : string); - begin - // segregated here so case-insensitive highlighters don't have to pay the overhead - // of the exception frame for the release of the temporary string - dest := SysUtils.AnsiLowerCase(value); - end; - -begin - // UnicodeStrings are not reference counted, hence we need to copy - if fCaseSensitive then - begin - fLineStr := Value; - fCasedLineStr := ''; - fCasedLine := PWideChar(fLineStr); - end - else - begin - DoWideLowerCase(Value, fLineStr); - fCasedLineStr := Value; - fCasedLine := PWideChar(fCasedLineStr); - end; - fLine := PWideChar(fLineStr); - fLineLen := Length(fLineStr); - - Run := 0; - ExpandedRun := 0; - fOldRun := Run; - fLineNumber := LineNumber; -end; - -procedure TSynCustomHighlighter.SetRange(Value: Pointer); -begin -end; - -procedure TSynCustomHighlighter.SetDefaultFilter(Value: string); -begin - fDefaultFilter := Value; -end; - -procedure TSynCustomHighlighter.SetSampleSource(Value: string); -begin - // TODO: sure this should be empty? -end; - -procedure TSynCustomHighlighter.UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); -begin - fAttrChangeHooks.Remove(ANotifyEvent); -end; - -procedure TSynCustomHighlighter.SetEnabled(const Value: Boolean); -begin - if fEnabled <> Value then - begin - fEnabled := Value; - DefHighlightChange(nil); - end; -end; - -procedure TSynCustomHighlighter.Loaded; -begin - inherited; - DefHighlightChange(nil); -end; - -// Pos and Result are 1-based (i.e. positions in a string not a PWideChar) -function TSynCustomHighlighter.PosToExpandedPos(Pos: Integer): Integer; -var - i: Integer; -begin - if fExpandedLine = nil then - begin - Result := Pos; - Exit; - end; - - Result := 0; - i := 0; - while i < Pos do - begin - while fExpandedLine[Result] = FillerChar do - inc(Result); - inc(Result); - inc(i); - end; -end; - -initialization - G_PlaceableHighlighters := TSynHighlighterList.Create; -finalization - G_PlaceableHighlighters.Free; - G_PlaceableHighlighters := nil; -end. +{------------------------------------------------------------------------------- +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. +The Original Code is: SynEditHighlighter.pas, released 2000-04-07. +The Original Code is based on mwHighlighter.pas by Martin Waldenburg, part of +the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +Options property added by CodehunterWorks +All Rights Reserved. +Contributors to the SynEdit and mwEdit projects are listed in the +Contributors.txt file. +$Id: SynEditHighlighter.pas,v 1.9.1 2012/09/12 08:17:19 CodehunterWorks Exp $ +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net +Known Issues: +-------------------------------------------------------------------------------} +unit SynEditHighlighter; +{$I SynEdit.inc} +interface +uses + Graphics, + Windows, + Registry, + IniFiles, + SynEditTypes, + SynEditMiscClasses, + SynUnicode, + SysUtils, + Classes, + SynEditHighlighterOptions; +type + TBetterRegistry = SynEditMiscClasses.TBetterRegistry; +type + TSynHighlighterAttributes = class(TPersistent) + private + FBackground: TColor; + FBackgroundDefault: TColor; + FForeground: TColor; + FForegroundDefault: TColor; + FFriendlyName: UnicodeString; + FName: string; + FStyle: TFontStyles; + FStyleDefault: TFontStyles; + FOnChange: TNotifyEvent; + procedure Changed; virtual; + function GetBackgroundColorStored: Boolean; + function GetForegroundColorStored: Boolean; + function GetFontStyleStored: Boolean; + procedure SetBackground(Value: TColor); + procedure SetForeground(Value: TColor); + procedure SetStyle(Value: TFontStyles); + function GetStyleFromInt: Integer; + procedure SetStyleFromInt(const Value: Integer); + public + procedure Assign(Source: TPersistent); override; + procedure AssignColorAndStyle(Source: TSynHighlighterAttributes); + constructor Create(AName: string); overload; + constructor Create(AName: string; AFriendlyName: UnicodeString); overload; + procedure InternalSaveDefaultValues; + function LoadFromBorlandRegistry(RootKey: HKEY; AttrKey, AttrName: string; + OldStyle: Boolean): Boolean; virtual; + function LoadFromRegistry(Reg: TBetterRegistry): Boolean; + function SaveToRegistry(Reg: TBetterRegistry): Boolean; +//Fix type changed to TCustomIniFile for use both TMemIniFile and TIniFile + function LoadFromFile(Ini: TCustomIniFile): Boolean; + function SaveToFile(Ini: TCustomIniFile): Boolean; + public + procedure SetColors(Foreground, Background: TColor); + property FriendlyName: UnicodeString read FFriendlyName; + property IntegerStyle: Integer read GetStyleFromInt write SetStyleFromInt; + property Name: string read FName; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + published + property Background: TColor read FBackground write SetBackground + stored GetBackgroundColorStored; + property Foreground: TColor read FForeground write SetForeground + stored GetForegroundColorStored; + property Style: TFontStyles read FStyle write SetStyle + stored GetFontStyleStored; + end; + TSynHighlighterCapability = ( + hcUserSettings, // supports Enum/UseUserSettings + hcRegistry // supports LoadFrom/SaveToRegistry + ); + TSynHighlighterCapabilities = set of TSynHighlighterCapability; +const + SYN_ATTR_COMMENT = 0; + SYN_ATTR_IDENTIFIER = 1; + SYN_ATTR_KEYWORD = 2; + SYN_ATTR_STRING = 3; + SYN_ATTR_WHITESPACE = 4; + SYN_ATTR_SYMBOL = 5; + SYN_ATTR_CHAR = 6; + +type + TSynCustomHighlighter = class(TComponent) + private + FAttributes: TStringList; + FAttrChangeHooks: TSynNotifyEventChain; + FUpdateCount: Integer; + FEnabled: Boolean; + FAdditionalWordBreakChars: TSysCharSet; + FAdditionalIdentChars: TSysCharSet; + FExportName: string; + FOptions: TSynEditHighlighterOptions; + function GetExportName: string; + procedure SetEnabled(const Value: Boolean); + procedure SetAdditionalIdentChars(const Value: TSysCharSet); + procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); + protected + FCasedLine: PWideChar; + FCasedLineStr: UnicodeString; + FCaseSensitive: Boolean; + FDefaultFilter: string; + FExpandedLine: PWideChar; + FExpandedLineLen: Integer; + FExpandedLineStr: UnicodeString; + FExpandedTokenPos: Integer; + FLine: PWideChar; + FLineLen: Integer; + FLineStr: UnicodeString; + FLineNumber: Integer; + FStringLen: Integer; + FToIdent: PWideChar; + FTokenPos: Integer; + FUpdateChange: Boolean; + Run: Integer; + FExpandedRun: Integer; + FOldRun: Integer; + procedure Loaded; override; + procedure AddAttribute(Attri: TSynHighlighterAttributes); + procedure DefHighlightChange(Sender: TObject); + procedure DefineProperties(Filer: TFiler); override; + procedure FreeHighlighterAttributes; + function GetAttribCount: Integer; virtual; + function GetAttribute(Index: Integer): TSynHighlighterAttributes; virtual; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + virtual; abstract; + function GetDefaultFilter: string; virtual; + function GetSampleSource: UnicodeString; virtual; + procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); virtual; + function IsCurrentToken(const Token: UnicodeString): Boolean; virtual; + function IsFilterStored: Boolean; virtual; + function IsLineEnd(Run: Integer): Boolean; virtual; + procedure SetAttributesOnChange(AEvent: TNotifyEvent); + procedure SetDefaultFilter(Value: string); virtual; + procedure SetSampleSource(Value: UnicodeString); virtual; + protected + function GetCapabilitiesProp: TSynHighlighterCapabilities; + function GetFriendlyLanguageNameProp: UnicodeString; + function GetLanguageNameProp: string; + public + class function GetCapabilities: TSynHighlighterCapabilities; virtual; + class function GetFriendlyLanguageName: UnicodeString; virtual; + class function GetLanguageName: string; virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + procedure BeginUpdate; + procedure EndUpdate; + function GetEol: Boolean; virtual; abstract; + function GetExpandedToken: UnicodeString; virtual; + function GetExpandedTokenPos: Integer; virtual; + function GetKeyWords(TokenKind: Integer): UnicodeString; virtual; + function GetRange: Pointer; virtual; + function GetToken: UnicodeString; virtual; + function GetTokenAttribute: TSynHighlighterAttributes; virtual; abstract; + function GetTokenKind: Integer; virtual; abstract; + function GetTokenPos: Integer; virtual; + function IsKeyword(const AKeyword: UnicodeString): Boolean; virtual; + procedure Next; virtual; + procedure NextToEol; + function PosToExpandedPos(Pos: Integer): Integer; + procedure SetLineExpandedAtWideGlyphs(const Line, ExpandedLine: UnicodeString; + LineNumber: Integer); virtual; + procedure SetLine(const Value: UnicodeString; LineNumber: Integer); virtual; + procedure SetRange(Value: Pointer); virtual; + procedure ResetRange; virtual; + function UseUserSettings(settingIndex: Integer): Boolean; virtual; + procedure EnumUserSettings(Settings: TStrings); virtual; + function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; virtual; + function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; virtual; + function LoadFromFile(AFileName: string): Boolean; + function SaveToFile(AFileName: string): Boolean; + procedure HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); + procedure UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); + function IsIdentChar(AChar: WideChar): Boolean; virtual; + function IsWhiteChar(AChar: WideChar): Boolean; virtual; + function IsWordBreakChar(AChar: WideChar): Boolean; virtual; + property FriendlyLanguageName: UnicodeString read GetFriendlyLanguageNameProp; + property LanguageName: string read GetLanguageNameProp; + public + property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; + property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; + property AttrCount: Integer read GetAttribCount; + property Attribute[Index: Integer]: TSynHighlighterAttributes + read GetAttribute; + property Capabilities: TSynHighlighterCapabilities read GetCapabilitiesProp; + property SampleSource: UnicodeString read GetSampleSource write SetSampleSource; + property CommentAttribute: TSynHighlighterAttributes + index SYN_ATTR_COMMENT read GetDefaultAttribute; + property IdentifierAttribute: TSynHighlighterAttributes + index SYN_ATTR_IDENTIFIER read GetDefaultAttribute; + property KeywordAttribute: TSynHighlighterAttributes + index SYN_ATTR_KEYWORD read GetDefaultAttribute; + property StringAttribute: TSynHighlighterAttributes + index SYN_ATTR_STRING read GetDefaultAttribute; + property SymbolAttribute: TSynHighlighterAttributes + index SYN_ATTR_SYMBOL read GetDefaultAttribute; + property WhitespaceAttribute: TSynHighlighterAttributes + index SYN_ATTR_WHITESPACE read GetDefaultAttribute; + property CharAttribute: TSynHighlighterAttributes + index SYN_ATTR_CHAR read GetDefaultAttribute; + property ExportName: string read GetExportName; + published + property DefaultFilter: string read GetDefaultFilter write SetDefaultFilter + stored IsFilterStored; + property Enabled: Boolean read FEnabled write SetEnabled default True; + property Options: TSynEditHighlighterOptions read FOptions write FOptions; // <-- Codehunter patch + end; + TSynCustomHighlighterClass = class of TSynCustomHighlighter; +{$IFNDEF SYN_CPPB_1} + TSynHighlighterList = class(TList) + private + FHighlighterList: TList; + function GetItem(Index: Integer): TSynCustomHighlighterClass; + public + constructor Create; + destructor Destroy; override; + function Count: Integer; + function FindByFriendlyName(FriendlyName: string): Integer; + function FindByName(Name: string): Integer; + function FindByClass(Comp: TComponent): Integer; + property Items[Index: Integer]: TSynCustomHighlighterClass + read GetItem; default; + end; + procedure RegisterPlaceableHighlighter(highlighter: + TSynCustomHighlighterClass); + function GetPlaceableHighlighters: TSynHighlighterList; +{$ENDIF} +implementation +uses + SynEditMiscProcs, +{$IFDEF UNICODE} + WideStrUtils, +{$ENDIF} + SynEditStrConst; +{$IFNDEF SYN_CPPB_1} +{ THighlighterList } +function TSynHighlighterList.Count: Integer; +begin + Result := FHighlighterList.Count; +end; +constructor TSynHighlighterList.Create; +begin + inherited Create; + FHighlighterList := TList.Create; +end; +destructor TSynHighlighterList.Destroy; +begin + FHighlighterList.Free; + inherited; +end; +function TSynHighlighterList.FindByClass(Comp: TComponent): Integer; +var + i: Integer; +begin + Result := -1; + for i := 0 to Count - 1 do + begin + if Comp is Items[i] then + begin + Result := i; + Exit; + end; + end; +end; +function TSynHighlighterList.FindByFriendlyName(FriendlyName: string): Integer; +var + i: Integer; +begin + Result := -1; + for i := 0 to Count - 1 do + begin + if Items[i].GetFriendlyLanguageName = FriendlyName then + begin + Result := i; + Exit; + end; + end; +end; +function TSynHighlighterList.FindByName(Name: string): Integer; +var + i: Integer; +begin + Result := -1; + for i := 0 to Count - 1 do + begin + if Items[i].GetLanguageName = Name then + begin + Result := i; + Exit; + end; + end; +end; +function TSynHighlighterList.GetItem(Index: Integer): TSynCustomHighlighterClass; +begin + Result := TSynCustomHighlighterClass(FHighlighterList[Index]); +end; +var + G_PlaceableHighlighters: TSynHighlighterList; + function GetPlaceableHighlighters: TSynHighlighterList; + begin + Result := G_PlaceableHighlighters; + end; + procedure RegisterPlaceableHighlighter(highlighter: TSynCustomHighlighterClass); + begin + if G_PlaceableHighlighters.FHighlighterList.IndexOf(highlighter) < 0 then + G_PlaceableHighlighters.FHighlighterList.Add(highlighter); + end; +{$ENDIF} +{ TSynHighlighterAttributes } +procedure TSynHighlighterAttributes.Assign(Source: TPersistent); +begin + if Source is TSynHighlighterAttributes then + begin + FName := TSynHighlighterAttributes(Source).FName; + AssignColorAndStyle(TSynHighlighterAttributes(Source)); + end + else + inherited Assign(Source); +end; +procedure TSynHighlighterAttributes.AssignColorAndStyle(Source: TSynHighlighterAttributes); +var + bChanged: Boolean; +begin + bChanged := False; + if FBackground <> Source.FBackground then + begin + FBackground := Source.FBackground; + bChanged := True; + end; + if FForeground <> Source.FForeground then + begin + FForeground := Source.FForeground; + bChanged := True; + end; + if FStyle <> Source.FStyle then + begin + FStyle := Source.FStyle; + bChanged := True; + end; + if bChanged then + Changed; +end; + +procedure TSynHighlighterAttributes.Changed; +begin + if Assigned(FOnChange) then + FOnChange(Self); +end; +constructor TSynHighlighterAttributes.Create(AName: string); +begin + Create(AName, AName); +end; +constructor TSynHighlighterAttributes.Create(AName: string; AFriendlyName: UnicodeString); +begin + inherited Create; + Background := clNone; + Foreground := clNone; + FName := AName; + FFriendlyName := AFriendlyName; +end; +function TSynHighlighterAttributes.GetBackgroundColorStored: Boolean; +begin + Result := FBackground <> FBackgroundDefault; +end; +function TSynHighlighterAttributes.GetForegroundColorStored: Boolean; +begin + Result := FForeground <> FForegroundDefault; +end; +function TSynHighlighterAttributes.GetFontStyleStored: Boolean; +begin + Result := FStyle <> FStyleDefault; +end; +procedure TSynHighlighterAttributes.InternalSaveDefaultValues; +begin + FForegroundDefault := FForeground; + FBackgroundDefault := FBackground; + FStyleDefault := FStyle; +end; +function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; + AttrKey, AttrName: string; OldStyle: Boolean): Boolean; + // How the highlighting information is stored: + // Delphi 1.0: + // I don't know and I don't care. + // Delphi 2.0 & 3.0: + // In the registry branch HKCU\Software\Borland\Delphi\x.0\Highlight + // where x=2 or x=3. + // Each entry is one string value, encoded as + // ,,,,,, + // Example: + // 0,16777215,BI,0,1,0,15 + // foreground color (RGB): 0 + // background color (RGB): 16777215 ($FFFFFF) + // font style: BI (bold italic), possible flags: B(old), I(talic), U(nderline) + // default foreground: no, specified color will be used (black (0) is used when this flag is 1) + // default background: yes, white ($FFFFFF, 15) will be used for background + // foreground index: 0 (foreground index (Pal16), corresponds to foreground RGB color) + // background index: 15 (background index (Pal16), corresponds to background RGB color) + // Delphi 4.0 & 5.0: + // In the registry branch HKCU\Software\Borland\Delphi\4.0\Editor\Highlight. + // Each entry is subkey containing several values: + // Foreground Color: foreground index (Pal16), 0..15 (dword) + // Background Color: background index (Pal16), 0..15 (dword) + // Bold: fsBold yes/no, 0/True (string) + // Italic: fsItalic yes/no, 0/True (string) + // Underline: fsUnderline yes/no, 0/True (string) + // Default Foreground: use default foreground (clBlack) yes/no, False/-1 (string) + // Default Background: use default backround (clWhite) yes/no, False/-1 (string) +const + Pal16: array [0..15] of TColor = ( + clBlack, clMaroon, clGreen, clOlive, clNavy, clPurple, clTeal, clLtGray, + clDkGray, clRed, clLime, clYellow, clBlue, clFuchsia, clAqua, clWhite + ); + function LoadOldStyle(RootKey: HKEY; AttrKey, AttrName: string): Boolean; + var + descript: string; + fgColRGB: string; + bgColRGB: string; + fontStyle: string; + fgDefault: string; + bgDefault: string; + fgIndex16: string; + bgIndex16: string; + reg: TBetterRegistry; + function Get(var Name: string): string; + var + p: Integer; + begin + p := Pos(',', Name); + if p = 0 then p := Length(Name) + 1; + Result := Copy(name, 1, p - 1); + name := Copy(name, p + 1, Length(name) - p); + end; + begin { LoadOldStyle } + Result := False; + try + reg := TBetterRegistry.Create; + reg.RootKey := RootKey; + try + with reg do + begin + if OpenKeyReadOnly(AttrKey) then + begin + try + if ValueExists(AttrName) then + begin + descript := ReadString(AttrName); + fgColRGB := Get(descript); + bgColRGB := Get(descript); + fontStyle := Get(descript); + fgDefault := Get(descript); + bgDefault := Get(descript); + fgIndex16 := Get(descript); + bgIndex16 := Get(descript); + if bgDefault = '1' then + Background := clWindow + else + Background := Pal16[StrToInt(bgIndex16)]; + if fgDefault = '1' then + Foreground := clWindowText + else + Foreground := Pal16[StrToInt(fgIndex16)]; + Style := []; + if Pos('B', fontStyle) > 0 then Style := Style + [fsBold]; + if Pos('I', fontStyle) > 0 then Style := Style + [fsItalic]; + if Pos('U', fontStyle) > 0 then Style := Style + [fsUnderline]; + Result := True; + end; + finally + CloseKey; + end; + end; // if + end; // with + finally + reg.Free; + end; + except + end; + end; { LoadOldStyle } + function LoadNewStyle(RootKey: HKEY; AttrKey, AttrName: string): Boolean; + var + fgColor: Integer; + bgColor: Integer; + fontBold: string; + fontItalic: string; + fontUnderline: string; + fgDefault: string; + bgDefault: string; + reg: TBetterRegistry; + function IsTrue(Value: string): Boolean; + begin + Result := not ((UpperCase(Value) = 'FALSE') or (Value = '0')); + end; { IsTrue } + begin + Result := False; + try + reg := TBetterRegistry.Create; + reg.RootKey := RootKey; + try + with reg do + begin + if OpenKeyReadOnly(AttrKey + '\' + AttrName) then + begin + try + if ValueExists('Foreground Color') + then fgColor := Pal16[ReadInteger('Foreground Color')] + else if ValueExists('Foreground Color New') then + fgColor := StringToColor(ReadString('Foreground Color New')) + else + Exit; + if ValueExists('Background Color') + then bgColor := Pal16[ReadInteger('Background Color')] + else if ValueExists('Background Color New') then + bgColor := StringToColor(ReadString('Background Color New')) + else + Exit; + if ValueExists('Bold') + then fontBold := ReadString('Bold') + else Exit; + if ValueExists('Italic') + then fontItalic := ReadString('Italic') + else Exit; + if ValueExists('Underline') + then fontUnderline := ReadString('Underline') + else Exit; + if ValueExists('Default Foreground') + then fgDefault := ReadString('Default Foreground') + else Exit; + if ValueExists('Default Background') + then bgDefault := ReadString('Default Background') + else Exit; + if IsTrue(bgDefault) + then Background := clWindow + else Background := bgColor; + if IsTrue(fgDefault) + then Foreground := clWindowText + else Foreground := fgColor; + Style := []; + if IsTrue(fontBold) then Style := Style + [fsBold]; + if IsTrue(fontItalic) then Style := Style + [fsItalic]; + if IsTrue(fontUnderline) then Style := Style + [fsUnderline]; + Result := True; + finally + CloseKey; + end; + end; // if + end; // with + finally + reg.Free; + end; + except + end; + end; { LoadNewStyle } +begin + if OldStyle then + Result := LoadOldStyle(RootKey, AttrKey, AttrName) + else + Result := LoadNewStyle(RootKey, AttrKey, AttrName); +end; { TSynHighlighterAttributes.LoadFromBorlandRegistry } +procedure TSynHighlighterAttributes.SetBackground(Value: TColor); +begin + if FBackground <> Value then + begin + FBackground := Value; + Changed; + end; +end; +procedure TSynHighlighterAttributes.SetColors(Foreground, Background: TColor); +begin + if (FForeground <> Foreground) or (FBackground <> Background) then + begin + FForeground := Foreground; + FBackground := Background; + Changed; + end; +end; +procedure TSynHighlighterAttributes.SetForeground(Value: TColor); +begin + if FForeground <> Value then + begin + FForeground := Value; + Changed; + end; +end; +procedure TSynHighlighterAttributes.SetStyle(Value: TFontStyles); +begin + if FStyle <> Value then + begin + FStyle := Value; + Changed; + end; +end; +function TSynHighlighterAttributes.LoadFromRegistry(Reg: TBetterRegistry): Boolean; +var + Key: string; +begin + Key := Reg.CurrentPath; + if Reg.KeyExists(Name) then + begin + if Reg.OpenKeyReadOnly(Name) then + begin + if Reg.ValueExists('Background') then + Background := Reg.ReadInteger('Background'); + if Reg.ValueExists('Foreground') then + Foreground := Reg.ReadInteger('Foreground'); + if Reg.ValueExists('Style') then + IntegerStyle := Reg.ReadInteger('Style'); + reg.OpenKeyReadOnly('\' + Key); + Result := True; + end + else + Result := False; + end + else + Result := False; +end; +function TSynHighlighterAttributes.SaveToRegistry(Reg: TBetterRegistry): Boolean; +var + Key: string; +begin + Key := Reg.CurrentPath; + if Reg.OpenKey(Name, True) then + begin + Reg.WriteInteger('Background', Background); + Reg.WriteInteger('Foreground', Foreground); + Reg.WriteInteger('Style', IntegerStyle); + reg.OpenKey('\' + Key, False); + Result := True; + end + else + Result := False; +end; +function TSynHighlighterAttributes.LoadFromFile(Ini : TCustomIniFile): boolean; +var + S: TStringList; +begin + S := TStringList.Create; + try + Ini.ReadSection(Name, S); + if S.Count > 0 then + begin + if S.IndexOf('Background') <> -1 then + Background := Ini.ReadInteger(Name, 'Background', Background); + if S.IndexOf('Foreground') <> -1 then + Foreground := Ini.ReadInteger(Name, 'Foreground', Foreground); + if S.IndexOf('Style') <> -1 then + IntegerStyle := Ini.ReadInteger(Name, 'Style', IntegerStyle); + Result := true; + end + else + Result := False; + finally + S.Free; + end; +end; +function TSynHighlighterAttributes.SaveToFile(Ini : TCustomIniFile): boolean; +begin + Ini.WriteInteger(Name, 'Background', Background); + Ini.WriteInteger(Name, 'Foreground', Foreground); + Ini.WriteInteger(Name, 'Style', IntegerStyle); + Result := True; +end; +function TSynHighlighterAttributes.GetStyleFromInt: Integer; +begin + if fsBold in Style then Result := 1 else Result := 0; + if fsItalic in Style then Result := Result + 2; + if fsUnderline in Style then Result:= Result + 4; + if fsStrikeout in Style then Result:= Result + 8; +end; +procedure TSynHighlighterAttributes.SetStyleFromInt(const Value: Integer); +begin + if Value and $1 = 0 then Style:= [] else Style := [fsBold]; + if Value and $2 <> 0 then Style:= Style + [fsItalic]; + if Value and $4 <> 0 then Style:= Style + [fsUnderline]; + if Value and $8 <> 0 then Style:= Style + [fsStrikeout]; +end; +{ TSynCustomHighlighter } +constructor TSynCustomHighlighter.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FAttributes := TStringList.Create; + FAttributes.Duplicates := dupError; + FAttributes.Sorted := True; + FAttrChangeHooks := TSynNotifyEventChain.CreateEx(Self); + FDefaultFilter := ''; + FEnabled := True; + FOptions:= TSynEditHighlighterOptions.Create; // <-- Codehunter patch +end; +destructor TSynCustomHighlighter.Destroy; +begin + inherited Destroy; + FreeHighlighterAttributes; + FAttributes.Free; + FAttrChangeHooks.Free; + FOptions.Free; // <-- Codehunter patch +end; +procedure TSynCustomHighlighter.BeginUpdate; +begin + Inc(FUpdateCount); +end; +procedure TSynCustomHighlighter.EndUpdate; +begin + if FUpdateCount > 0 then + begin + Dec(FUpdateCount); + if (FUpdateCount = 0) and FUpdateChange then + begin + FUpdateChange := False; + DefHighlightChange(nil); + end; + end; +end; +procedure TSynCustomHighlighter.FreeHighlighterAttributes; +var + i: Integer; +begin + if FAttributes <> nil then + begin + for i := FAttributes.Count - 1 downto 0 do + TSynHighlighterAttributes(FAttributes.Objects[i]).Free; + FAttributes.Clear; + end; +end; +procedure TSynCustomHighlighter.Assign(Source: TPersistent); +var + Src: TSynCustomHighlighter; + i, j: Integer; + AttriName: string; + SrcAttri: TSynHighlighterAttributes; +begin + if (Source <> nil) and (Source is TSynCustomHighlighter) then + begin + Src := TSynCustomHighlighter(Source); + for i := 0 to AttrCount - 1 do + begin + // assign first attribute with the same name + AttriName := Attribute[i].Name; + for j := 0 to Src.AttrCount - 1 do + begin + SrcAttri := Src.Attribute[j]; + if AttriName = SrcAttri.Name then + begin + Attribute[i].Assign(SrcAttri); + Break; + end; + end; + end; + // assign the sample source text only if same or descendant class + if Src is ClassType then + SampleSource := Src.SampleSource; + //fWordBreakChars := Src.WordBreakChars; //TODO: does this make sense anyway? + DefaultFilter := Src.DefaultFilter; + Enabled := Src.Enabled; + end + else + inherited Assign(Source); +end; +procedure TSynCustomHighlighter.EnumUserSettings(Settings: TStrings); +begin + Settings.Clear; +end; +function TSynCustomHighlighter.UseUserSettings(settingIndex: Integer): Boolean; +begin + Result := False; +end; +function TSynCustomHighlighter.LoadFromRegistry(RootKey: HKEY; + Key: string): Boolean; +var + r: TBetterRegistry; + i: Integer; +begin + r := TBetterRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKeyReadOnly(Key) then + begin + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].LoadFromRegistry(r) and Result; + end + else + Result := False; + finally + r.Free; + end; +end; +function TSynCustomHighlighter.SaveToRegistry(RootKey: HKEY; + Key: string): Boolean; +var + r: TBetterRegistry; + i: Integer; +begin + r := TBetterRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKey(Key,True) then + begin + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].SaveToRegistry(r) and Result; + end + else + Result := False; + finally + r.Free; + end; +end; +function TSynCustomHighlighter.LoadFromFile(AFileName : String): Boolean; +var + AIni: TIniFile; + i: Integer; +begin + AIni := TIniFile.Create(AFileName); + try + with AIni do + begin + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].LoadFromFile(AIni) and Result; + end; + finally + AIni.Free; + end; +end; +function TSynCustomHighlighter.SaveToFile(AFileName : String): Boolean; +var + AIni: TIniFile; + i: Integer; +begin + AIni := TIniFile.Create(AFileName); + try + with AIni do + begin + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].SaveToFile(AIni) and Result; + end; + finally + AIni.Free; + end; +end; +procedure TSynCustomHighlighter.AddAttribute(Attri: TSynHighlighterAttributes); +begin + FAttributes.AddObject(Attri.Name, Attri); +end; +procedure TSynCustomHighlighter.DefHighlightChange(Sender: TObject); +begin + if FUpdateCount > 0 then + FUpdateChange := True + else if not(csLoading in ComponentState) then + begin + FAttrChangeHooks.Sender := Sender; + FAttrChangeHooks.Fire; + end; +end; +procedure TSynCustomHighlighter.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; +function TSynCustomHighlighter.GetAttribCount: Integer; +begin + Result := FAttributes.Count; +end; +function TSynCustomHighlighter.GetAttribute(Index: Integer): + TSynHighlighterAttributes; +begin + Result := nil; + if (Index >= 0) and (Index < FAttributes.Count) then + Result := TSynHighlighterAttributes(FAttributes.Objects[Index]); +end; +class function TSynCustomHighlighter.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := [hcRegistry]; //registry save/load supported by default +end; +function TSynCustomHighlighter.GetCapabilitiesProp: TSynHighlighterCapabilities; +begin + Result := GetCapabilities; +end; +function TSynCustomHighlighter.GetDefaultFilter: string; +begin + Result := FDefaultFilter; +end; +function TSynCustomHighlighter.GetExpandedTokenPos: Integer; +begin + if FExpandedLine = nil then + Result := FTokenPos + else + Result := FExpandedTokenPos; +end; +function TSynCustomHighlighter.GetExportName: string; +begin + if FExportName = '' then + FExportName := SynEditMiscProcs.DeleteTypePrefixAndSynSuffix(ClassName); + Result := FExportName; +end; +function TSynCustomHighlighter.GetExpandedToken: UnicodeString; +var + Len: Integer; +begin + if FExpandedLine = nil then + begin + Result := GetToken; + Exit; + end; + Len := FExpandedRun - FExpandedTokenPos; + SetLength(Result, Len); + if Len > 0 then + WStrLCopy(@Result[1], FExpandedLine + FExpandedTokenPos, Len); +end; +class function TSynCustomHighlighter.GetFriendlyLanguageName: UnicodeString; +begin +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.CreateFmt('%s.GetFriendlyLanguageName not implemented', [ClassName]); +{$ENDIF} + Result := SYNS_FriendlyLangUnknown; +end; +class function TSynCustomHighlighter.GetLanguageName: string; +begin +{$IFDEF SYN_DEVELOPMENT_CHECKS} + raise Exception.CreateFmt('%s.GetLanguageName not implemented', [ClassName]); +{$ENDIF} + Result := SYNS_LangUnknown; +end; +function TSynCustomHighlighter.GetFriendlyLanguageNameProp: UnicodeString; +begin + Result := GetFriendlyLanguageName; +end; +function TSynCustomHighlighter.GetLanguageNameProp: string; +begin + Result := GetLanguageName; +end; +function TSynCustomHighlighter.GetRange: Pointer; +begin + Result := nil; +end; +function TSynCustomHighlighter.GetToken: UnicodeString; +var + Len: Integer; +begin + Len := Run - FTokenPos; + SetLength(Result, Len); + if Len > 0 then + WStrLCopy(@Result[1], FCasedLine + FTokenPos, Len); +end; +function TSynCustomHighlighter.GetTokenPos: Integer; +begin + Result := FTokenPos; +end; +function TSynCustomHighlighter.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := ''; +end; +function TSynCustomHighlighter.GetSampleSource: UnicodeString; +begin + Result := ''; +end; +procedure TSynCustomHighlighter.HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); +begin + FAttrChangeHooks.Add(ANotifyEvent); +end; +function TSynCustomHighlighter.IsCurrentToken(const Token: UnicodeString): Boolean; +var + I: Integer; + Temp: PWideChar; +begin + Temp := FToIdent; + if Length(Token) = FStringLen then + begin + Result := True; + for i := 1 to FStringLen do + begin + if Temp^ <> Token[i] then + begin + Result := False; + Break; + end; + Inc(Temp); + end; + end + else + Result := False; +end; +function TSynCustomHighlighter.IsFilterStored: Boolean; +begin + Result := True; +end; +function TSynCustomHighlighter.IsIdentChar(AChar: WideChar): Boolean; +begin + if IsWordBreakChar(Achar) then + Result := False + else + Result := True; +end; +function TSynCustomHighlighter.IsKeyword(const AKeyword: UnicodeString): Boolean; +begin + Result := False; +end; +function TSynCustomHighlighter.IsLineEnd(Run: Integer): Boolean; +begin + Result := (Run >= FLineLen) or (FLine[Run] = #10) or (FLine[Run] = #13); +end; +function TSynCustomHighlighter.IsWhiteChar(AChar: WideChar): Boolean; +begin + case AChar of + #0..#32: + Result := True; + else + Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) + end +end; +function TSynCustomHighlighter.IsWordBreakChar(AChar: WideChar): Boolean; +begin + case AChar of + #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), WideChar(#$0060), + WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', '#', + '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', '/', '\', + '|': + Result := True; + else + Result := False; + end; +end; +procedure TSynCustomHighlighter.Next; +var + Delta: Integer; +begin + if FOldRun = Run then Exit; + FExpandedTokenPos := FExpandedRun; + if FExpandedLine = nil then Exit; + Delta := Run - FOldRun; + while Delta > 0 do + begin + while FExpandedLine[FExpandedRun] = FillerChar do + Inc(FExpandedRun); + Inc(FExpandedRun); + Dec(Delta); + end; + FOldRun := Run; +end; +procedure TSynCustomHighlighter.NextToEol; +begin + while not GetEol do Next; +end; +procedure TSynCustomHighlighter.ResetRange; +begin +end; +procedure TSynCustomHighlighter.SetAdditionalIdentChars( + const Value: TSysCharSet); +begin + FAdditionalIdentChars := Value; +end; +procedure TSynCustomHighlighter.SetAdditionalWordBreakChars( + const Value: TSysCharSet); +begin + FAdditionalWordBreakChars := Value; +end; +procedure TSynCustomHighlighter.SetAttributesOnChange(AEvent: TNotifyEvent); +var + i: Integer; + Attri: TSynHighlighterAttributes; +begin + for i := FAttributes.Count - 1 downto 0 do + begin + Attri := TSynHighlighterAttributes(FAttributes.Objects[i]); + if Attri <> nil then + begin + Attri.OnChange := AEvent; + Attri.InternalSaveDefaultValues; + end; + end; +end; +procedure TSynCustomHighlighter.SetLineExpandedAtWideGlyphs(const Line, + ExpandedLine: UnicodeString; LineNumber: Integer); +begin + FExpandedLineStr := ExpandedLine; + FExpandedLine := PWideChar(FExpandedLineStr); + FExpandedLineLen := Length(FExpandedLineStr); + DoSetLine(Line, LineNumber); + Next; +end; +procedure TSynCustomHighlighter.SetLine(const Value: UnicodeString; LineNumber: Integer); +begin + FExpandedLineStr := ''; + FExpandedLine := nil; + FExpandedLineLen := 0; + DoSetLine(Value, LineNumber); + Next; +end; +procedure TSynCustomHighlighter.DoSetLine(const Value: UnicodeString; LineNumber: Integer); + procedure DoWideLowerCase(const value : UnicodeString; var dest : UnicodeString); + begin + // segregated here so case-insensitive highlighters don't have to pay the overhead + // of the exception frame for the release of the temporary string + dest := SynWideLowerCase(value); + end; +begin + // UnicodeStrings are not reference counted, hence we need to copy + if FCaseSensitive then + begin + FLineStr := Value; + FCasedLineStr := ''; + FCasedLine := PWideChar(FLineStr); + end + else + begin + DoWideLowerCase(Value, FLineStr); + FCasedLineStr := Value; + FCasedLine := PWideChar(FCasedLineStr); + end; + FLine := PWideChar(FLineStr); + FLineLen := Length(FLineStr); + Run := 0; + FExpandedRun := 0; + FOldRun := Run; + FLineNumber := LineNumber; +end; +procedure TSynCustomHighlighter.SetRange(Value: Pointer); +begin +end; +procedure TSynCustomHighlighter.SetDefaultFilter(Value: string); +begin + FDefaultFilter := Value; +end; +procedure TSynCustomHighlighter.SetSampleSource(Value: UnicodeString); +begin + // TODO: sure this should be empty? +end; +procedure TSynCustomHighlighter.UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); +begin + FAttrChangeHooks.Remove(ANotifyEvent); +end; +procedure TSynCustomHighlighter.SetEnabled(const Value: Boolean); +begin + if FEnabled <> Value then + begin + FEnabled := Value; + DefHighlightChange(nil); + end; +end; +procedure TSynCustomHighlighter.Loaded; +begin + inherited; + DefHighlightChange(nil); +end; +// Pos and Result are 1-based (i.e. positions in a UnicodeString not a PWideChar) +function TSynCustomHighlighter.PosToExpandedPos(Pos: Integer): Integer; +var + i: Integer; +begin + if FExpandedLine = nil then + begin + Result := Pos; + Exit; + end; + Result := 0; + i := 0; + while i < Pos do + begin + while FExpandedLine[Result] = FillerChar do + Inc(Result); + Inc(Result); + Inc(i); + end; +end; +{$IFNDEF SYN_CPPB_1} +initialization + G_PlaceableHighlighters := TSynHighlighterList.Create; +finalization + G_PlaceableHighlighters.Free; + G_PlaceableHighlighters := nil; +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynEditHighlighterOptions.pas b/Source/VCL/SynEdit/Source/SynEditHighlighterOptions.pas index c56bd9e2..0ddaa0f2 100644 --- a/Source/VCL/SynEdit/Source/SynEditHighlighterOptions.pas +++ b/Source/VCL/SynEdit/Source/SynEditHighlighterOptions.pas @@ -16,6 +16,8 @@ Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. +$Id: SynEditHighlighterOptions.pas,v 1.0.2 25.10.2012 11:16:19 CodehunterWorks Exp $ + You may retrieve the latest version of this file at the SynEdit home page, located at http://SynEdit.SourceForge.net @@ -64,14 +66,14 @@ procedure TSynEditHighlighterOptions.Assign(Source: TPersistent); begin if Source.InheritsFrom(TSynEditHighlighterOptions) then begin with TSynEditHighlighterOptions(Source) do begin - FAutoDetectEnabled:= AutoDetectEnabled; - FAutoDetectMatchExpression:= AutoDetectMatchExpression; - FAutoDetectLineLimit:= AutoDetectLineLimit; - FDefaultExtension:= DefaultExtension; - FLineCommentarStart:= LineCommentarStart; - FLineCommentarEnd:= LineCommentarEnd; - FTitle:= Title; - FVisible:= Visible; + FAutoDetectEnabled := AutoDetectEnabled; + FAutoDetectMatchExpression := AutoDetectMatchExpression; + FAutoDetectLineLimit := AutoDetectLineLimit; + FDefaultExtension := DefaultExtension; + FLineCommentarStart := LineCommentarStart; + FLineCommentarEnd := LineCommentarEnd; + FTitle := Title; + FVisible := Visible; end; end; end; @@ -80,14 +82,14 @@ procedure TSynEditHighlighterOptions.AssignTo(Dest: TPersistent); begin if Dest.InheritsFrom(TSynEditHighlighterOptions) then begin with TSynEditHighlighterOptions(Dest) do begin - AutoDetectEnabled:= FAutoDetectEnabled; - AutoDetectMatchExpression:= FAutoDetectMatchExpression; - AutoDetectLineLimit:= FAutoDetectLineLimit; - DefaultExtension:= FDefaultExtension; - LineCommentarStart:= FLineCommentarStart; - LineCommentarEnd:= FLineCommentarEnd; - Title:= FTitle; - Visible:= FVisible; + AutoDetectEnabled := FAutoDetectEnabled; + AutoDetectMatchExpression := FAutoDetectMatchExpression; + AutoDetectLineLimit := FAutoDetectLineLimit; + DefaultExtension := FDefaultExtension; + LineCommentarStart := FLineCommentarStart; + LineCommentarEnd := FLineCommentarEnd; + Title := FTitle; + Visible := FVisible; end; end; end; diff --git a/Source/VCL/SynEdit/Source/SynEditJedi.inc b/Source/VCL/SynEdit/Source/SynEditJedi.inc index 8ceae4f4..0cc5baaa 100644 --- a/Source/VCL/SynEdit/Source/SynEditJedi.inc +++ b/Source/VCL/SynEdit/Source/SynEditJedi.inc @@ -30,7 +30,7 @@ { This file defines various generic compiler directives used in different libraries, e.g. in the } { JEDI Code Library (JCL) and JEDI Visual Component Library Library (JVCL). The directives in } { this file are of generic nature and consist mostly of mappings from the VERXXX directives } -{ defined by Delphi, C++Builder and FPC to friendly names such as DELPHI5 and } +{ defined by Delphi, C++ Builder and FPC to friendly names such as DELPHI5 and } { SUPPORTS_WIDESTRING. These friendly names are subsequently used in the libraries to test for } { compiler versions and/or whether the compiler supports certain features (such as widestrings or } { 64 bit integers. The libraries provide an additional, library specific, include file. For the } @@ -39,9 +39,9 @@ { } {**************************************************************************************************} { } -{ Last modified: $Date:: $ } -{ Revision: $Rev:: $ } -{ Author: $Author:: $ } +{ Last modified: $Date: 2009/01/06 16:26:01 $ } +{ Revision: $Rev:: 2446 $ } +{ Author: $Author: maelh $ } { } {**************************************************************************************************} @@ -51,18 +51,18 @@ This file defines two directives to indicate which development environment the library is being compiled with. Currently this can either be Delphi, Kylix, - C++Builder or FPC. + C++ Builder or FPC. Directive Description ------------------------------------------------------------------------------ DELPHI Defined if compiled with Delphi KYLIX Defined if compiled with Kylix DELPHICOMPILER Defined if compiled with Delphi or Kylix/Delphi - BCB Defined if compiled with C++Builder - CPPBUILDER Defined if compiled with C++Builder (alias for BCB) - BCBCOMPILER Defined if compiled with C++Builder or Kylix/C++ - DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++Builder - BORLAND Defined if compiled with Delphi, Kylix or C++Builder + BCB Defined if compiled with C++ Builder + CPPBUILDER Defined if compiled with C++ Builder (alias for BCB) + BCBCOMPILER Defined if compiled with C++ Builder or Kylix/C++ + DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++ Builder + BORLAND Defined if compiled with Delphi, Kylix or C++ Builder FPC Defined if compiled with FPC - Platform Directives @@ -87,7 +87,6 @@ CPUx86_64 Defined when target platform is native x86_64 (win64) CPU32 Defined when target is 32-bit CPU64 Defined when target is 64-bit - CPUASM Defined when target assembler is available - Visual library Directives @@ -122,48 +121,22 @@ Directive Description ------------------------------------------------------------------------------ - DELPHI1 Defined when compiling with Delphi 1 (Codename WASABI/MANGO) - DELPHI2 Defined when compiling with Delphi 2 (Codename POLARIS) - DELPHI3 Defined when compiling with Delphi 3 (Codename IVORY) - DELPHI4 Defined when compiling with Delphi 4 (Codename ALLEGRO) - DELPHI5 Defined when compiling with Delphi 5 (Codename ARGUS) - DELPHI6 Defined when compiling with Delphi 6 (Codename ILLIAD) - DELPHI7 Defined when compiling with Delphi 7 (Codename AURORA) - DELPHI8 Defined when compiling with Delphi 8 (Codename OCTANE) - DELPHI2005 Defined when compiling with Delphi 2005 (Codename DIAMONDBACK) + DELPHI1 Defined when compiling with Delphi 1 + DELPHI2 Defined when compiling with Delphi 2 + DELPHI3 Defined when compiling with Delphi 3 + DELPHI4 Defined when compiling with Delphi 4 + DELPHI5 Defined when compiling with Delphi 5 + DELPHI6 Defined when compiling with Delphi 6 + DELPHI7 Defined when compiling with Delphi 7 + DELPHI8 Defined when compiling with Delphi 8 + DELPHI2005 Defined when compiling with Delphi 2005 DELPHI9 Alias for DELPHI2005 - DELPHI10 Defined when compiling with Delphi 2006 (Codename DEXTER) + DELPHI10 Defined when compiling with Delphi Personality of BDS 4.0 DELPHI2006 Alias for DELPHI10 - DELPHI11 Defined when compiling with Delphi 2007 for Win32 (Codename SPACELY) + DELPHI11 Defined when compiling with Delphi 2007 for Win32 DELPHI2007 Alias for DELPHI11 - DELPHI12 Defined when compiling with Delphi 2009 for Win32 (Codename TIBURON) + DELPHI12 Defined when compiling with Delphi for Win32 2009 DELPHI2009 Alias for DELPHI12 - DELPHI14 Defined when compiling with Delphi 2010 for Win32 (Codename WEAVER) - DELPHI2010 Alias for DELPHI14 - DELPHI15 Defined when compiling with Delphi XE for Win32 (Codename FULCRUM) - DELPHIXE Alias for DELPHI15 - DELPHI16 Defined when compiling with Delphi XE2 for Win32 (Codename PULSAR) - DELPHIXE2 Alias for DELPHI16 - DELPHI17 Defined when compiling with Delphi XE3 for Win32 (Codename WATERDRAGON) - DELPHIXE3 Alias for DELPHI17 - DELPHI18 Defined when compiling with Delphi XE4 for Win32 (Codename QUINTESSENCE) - DELPHIXE4 Alias for DELPHI18 - DELPHI19 Defined when compiling with Delphi XE5 for Win32 (Codename ZEPHYR) - DELPHIXE5 Alias for DELPHI19 - DELPHI20 Defined when compiling with Delphi XE6 for Win32 (Codename PROTEUS) - DELPHIXE6 Alias for DELPHI20 - DELPHI21 Defined when compiling with Delphi XE7 for Win32 (Codename CARPATHIA) - DELPHIXE7 Alias for DELPHI21 - DELPHI22 Defined when compiling with Delphi XE8 for Win32 (Codename ELBRUS) - DELPHIXE8 Alias for DELPHI22 - DELPHI23 Defined when compiling with Delphi 10 for Win32 (Codename AITANA) - DELPHIX_SEATTLE Alias for DELPHI23 - DELPHI24 Defined when compiling with Delphi 10.1 for Win32 (Codename BIGBEN) - DELPHIX_BERLIN Alias for DELPHI24 - DELPHI25 Defined when compiling with Delphi 10.2 for Win32 (Codename GODZILLA) - DELPHIX_TOKYO Alias for DELPHI25 - DELPHI26 Defined when compiling with Delphi 10.3 for Win32 (Codename CARNIVAL) - DELPHIX_RIO Alias for DELPHI26 DELPHI1_UP Defined when compiling with Delphi 1 or higher DELPHI2_UP Defined when compiling with Delphi 2 or higher DELPHI3_UP Defined when compiling with Delphi 3 or higher @@ -174,39 +147,12 @@ DELPHI8_UP Defined when compiling with Delphi 8 or higher DELPHI2005_UP Defined when compiling with Delphi 2005 or higher DELPHI9_UP Alias for DELPHI2005_UP - DELPHI10_UP Defined when compiling with Delphi 2006 or higher + DELPHI10_UP Defined when compiling with Delphi Personality of BDS 4.0 or higher DELPHI2006_UP Alias for DELPHI10_UP DELPHI11_UP Defined when compiling with Delphi 2007 for Win32 or higher DELPHI2007_UP Alias for DELPHI11_UP - DELPHI12_UP Defined when compiling with Delphi 2009 for Win32 or higher + DELPHI12_UP Defined when compiling with Delphi for Win32 2009 or higher DELPHI2009_UP Alias for DELPHI12_UP - DELPHI14_UP Defined when compiling with Delphi 2010 for Win32 or higher - DELPHI2010_UP Alias for DELPHI14_UP - DELPHI15_UP Defined when compiling with Delphi XE for Win32 or higher - DELPHIXE_UP Alias for DELPHI15_UP - DELPHI16_UP Defined when compiling with Delphi XE2 for Win32 or higher - DELPHIXE2_UP Alias for DELPHI16_UP - DELPHI17_UP Defined when compiling with Delphi XE3 for Win32 or higher - DELPHIXE3_UP Alias for DELPHI17_UP - DELPHI18_UP Defined when compiling with Delphi XE4 for Win32 or higher - DELPHIXE4_UP Alias for DELPHI18_UP - DELPHI19_UP Defined when compiling with Delphi XE5 for Win32 or higher - DELPHIXE5_UP Alias for DELPHI19_UP - DELPHI20_UP Defined when compiling with Delphi XE6 for Win32 or higher - DELPHIXE6_UP Alias for DELPHI20_UP - DELPHI21_UP Defined when compiling with Delphi XE7 for Win32 or higher - DELPHIXE7_UP Alias for DELPHI21_UP - DELPHI22_UP Defined when compiling with Delphi XE8 for Win32 or higher - DELPHIXE8_UP Alias for DELPHI22_UP - DELPHI23_UP Defined when compiling with Delphi 10 for Win32 or higher - DELPHIX_SEATTLE_UP Alias for DELPHI23_UP - DELPHI24_UP Defined when compiling with Delphi 10.1 for Win32 or higher - DELPHIX_BERLIN_UP Alias for DELPHI24_UP - DELPHI25_UP Defined when compiling with Delphi 10.2 for Win32 or higher - DELPHIX_TOKYO_UP Alias for DELPHI25_UP - DELPHI26_UP Defined when compiling with Delphi 10.3 for Win32 or higher - DELPHIX_RIO_UP Alias for DELPHI26_UP - DELPHI27_UP Defined when compiling with Delphi 10.4 for Win32 or higher - Kylix Versions @@ -219,7 +165,7 @@ ------------------------------------------------------------------------------ KYLIX1 Defined when compiling with Kylix 1 KYLIX2 Defined when compiling with Kylix 2 - KYLIX3 Defined when compiling with Kylix 3 (Codename CORTEZ) + KYLIX3 Defined when compiling with Kylix 3 KYLIX1_UP Defined when compiling with Kylix 1 or higher KYLIX2_UP Defined when compiling with Kylix 2 or higher KYLIX3_UP Defined when compiling with Kylix 3 or higher @@ -241,20 +187,6 @@ DELPHICOMPILER10 Defined when compiling with Delphi Personality of BDS 4.0 DELPHICOMPILER11 Defined when compiling with Delphi 2007 for Win32 DELPHICOMPILER12 Defined when compiling with Delphi Personality of BDS 6.0 - DELPHICOMPILER14 Defined when compiling with Delphi Personality of BDS 7.0 - DELPHICOMPILER15 Defined when compiling with Delphi Personality of BDS 8.0 - DELPHICOMPILER16 Defined when compiling with Delphi Personality of BDS 9.0 - DELPHICOMPILER17 Defined when compiling with Delphi Personality of BDS 10.0 - DELPHICOMPILER18 Defined when compiling with Delphi Personality of BDS 11.0 - DELPHICOMPILER19 Defined when compiling with Delphi Personality of BDS 12.0 - DELPHICOMPILER20 Defined when compiling with Delphi Personality of BDS 14.0 - DELPHICOMPILER21 Defined when compiling with Delphi Personality of BDS 15.0 - DELPHICOMPILER22 Defined when compiling with Delphi Personality of BDS 16.0 - DELPHICOMPILER23 Defined when compiling with Delphi Personality of BDS 17.0 - DELPHICOMPILER24 Defined when compiling with Delphi Personality of BDS 18.0 - DELPHICOMPILER25 Defined when compiling with Delphi Personality of BDS 19.0 - DELPHICOMPILER26 Defined when compiling with Delphi Personality of BDS 20.0 - DELPHICOMPILER27 Defined when compiling with Delphi Personality of BDS 21.0 DELPHICOMPILER1_UP Defined when compiling with Delphi 1 or higher DELPHICOMPILER2_UP Defined when compiling with Delphi 2 or higher DELPHICOMPILER3_UP Defined when compiling with Delphi 3 or higher @@ -264,80 +196,38 @@ DELPHICOMPILER7_UP Defined when compiling with Delphi 7 or higher DELPHICOMPILER8_UP Defined when compiling with Delphi 8 or higher DELPHICOMPILER9_UP Defined when compiling with Delphi 2005 - DELPHICOMPILER10_UP Defined when compiling with Delphi 2006 or higher + DELPHICOMPILER10_UP Defined when compiling with Delphi Personality of BDS 4.0 or higher DELPHICOMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher - DELPHICOMPILER12_UP Defined when compiling with Delphi 2009 for Win32 or higher - DELPHICOMPILER14_UP Defined when compiling with Delphi 2010 for Win32 or higher - DELPHICOMPILER15_UP Defined when compiling with Delphi XE for Win32 or higher - DELPHICOMPILER16_UP Defined when compiling with Delphi XE2 for Win32 or higher - DELPHICOMPILER17_UP Defined when compiling with Delphi XE3 for Win32 or higher - DELPHICOMPILER18_UP Defined when compiling with Delphi XE4 for Win32 or higher - DELPHICOMPILER19_UP Defined when compiling with Delphi XE5 for Win32 or higher - DELPHICOMPILER20_UP Defined when compiling with Delphi XE6 for Win32 or higher - DELPHICOMPILER21_UP Defined when compiling with Delphi XE7 for Win32 or higher - DELPHICOMPILER22_UP Defined when compiling with Delphi XE8 for Win32 or higher - DELPHICOMPILER23_UP Defined when compiling with Delphi 10 for Win32 or higher - DELPHICOMPILER24_UP Defined when compiling with Delphi 10.1 for Win32 or higher - DELPHICOMPILER25_UP Defined when compiling with Delphi 10.2 for Win32 or higher - DELPHICOMPILER26_UP Defined when compiling with Delphi 10.3 for Win32 or higher - DELPHICOMPILER27_UP Defined when compiling with Delphi 10.4 for Win32 or higher - - -- C++Builder Versions + DELPHICOMPILER12_UP Defined when compiling with Delphi Personality of BDS 6.0 or higher + + +- C++ Builder Versions The following directives are direct mappings from the VERXXX directives to a friendly name of the associated compiler. These directives are only defined if - the compiler is C++Builder (ie BCB is defined). + the compiler is C++ Builder (ie BCB is defined). Directive Description ------------------------------------------------------------------------------ - BCB1 Defined when compiling with C++Builder 1 - BCB3 Defined when compiling with C++Builder 3 - BCB4 Defined when compiling with C++Builder 4 - BCB5 Defined when compiling with C++Builder 5 (Codename RAMPAGE) - BCB6 Defined when compiling with C++Builder 6 (Codename RIPTIDE) - BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) (Codename DEXTER) - BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) (Codename COGSWELL) - BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) (Codename TIBURON) - BCB14 Defined when compiling with C++Builder Personality of RAD Studio 2010 (also known as C++Builder 2010) (Codename WEAVER) - BCB15 Defined when compiling with C++Builder Personality of RAD Studio XE (also known as C++Builder XE) (Codename FULCRUM) - BCB16 Defined when compiling with C++Builder Personality of RAD Studio XE2 (also known as C++Builder XE2) (Codename PULSAR) - BCB17 Defined when compiling with C++Builder Personality of RAD Studio XE3 (also known as C++Builder XE3) (Codename WATERDRAGON) - BCB18 Defined when compiling with C++Builder Personality of RAD Studio XE4 (also known as C++Builder XE4) (Codename QUINTESSENCE) - BCB19 Defined when compiling with C++Builder Personality of RAD Studio XE5 (also known as C++Builder XE5) (Codename ZEPHYR) - BCB20 Defined when compiling with C++Builder Personality of RAD Studio XE6 (also known as C++Builder XE6) (Codename PROTEUS) - BCB21 Defined when compiling with C++Builder Personality of RAD Studio XE7 (also known as C++Builder XE7) (Codename CARPATHIA) - BCB22 Defined when compiling with C++Builder Personality of RAD Studio XE8 (also known as C++Builder XE8) (Codename ELBRUS) - BCB23 Defined when compiling with C++Builder Personality of RAD Studio 10 Seattle (also known as C++Builder 10 Seattle) (Codename AITANA) - BCB24 Defined when compiling with C++Builder Personality of RAD Studio 10.1 Berlin (also known as C++Builder 10.1 Berlin) (Codename BIGBEN) - BCB25 Defined when compiling with C++Builder Personality of RAD Studio 10.2 Tokyo (also known as C++Builder 10.2 Tokyo) (Codename GODZILLA) - BCB26 Defined when compiling with C++Builder Personality of RAD Studio 10.3 Rio (also known as C++Builder 10.3) (Codename CARNIVAL) - BCB27 Defined when compiling with C++Builder Personality of RAD Studio 10.4 Rio (also known as C++Builder 10.4) (Codename DENALI) - BCB1_UP Defined when compiling with C++Builder 1 or higher - BCB3_UP Defined when compiling with C++Builder 3 or higher - BCB4_UP Defined when compiling with C++Builder 4 or higher - BCB5_UP Defined when compiling with C++Builder 5 or higher - BCB6_UP Defined when compiling with C++Builder 6 or higher - BCB10_UP Defined when compiling with C++Builder Personality of BDS 4.0 or higher - BCB11_UP Defined when compiling with C++Builder Personality of RAD Studio 2007 or higher - BCB12_UP Defined when compiling with C++Builder Personality of RAD Studio 2009 or higher - BCB14_UP Defined when compiling with C++Builder Personality of RAD Studio 2010 or higher - BCB15_UP Defined when compiling with C++Builder Personality of RAD Studio XE or higher - BCB16_UP Defined when compiling with C++Builder Personality of RAD Studio XE2 or higher - BCB17_UP Defined when compiling with C++Builder Personality of RAD Studio XE3 or higher - BCB18_UP Defined when compiling with C++Builder Personality of RAD Studio XE4 or higher - BCB19_UP Defined when compiling with C++Builder Personality of RAD Studio XE5 or higher - BCB20_UP Defined when compiling with C++Builder Personality of RAD Studio XE6 or higher - BCB21_UP Defined when compiling with C++Builder Personality of RAD Studio XE7 or higher - BCB22_UP Defined when compiling with C++Builder Personality of RAD Studio XE8 or higher - BCB23_UP Defined when compiling with C++Builder Personality of RAD Studio 10 or higher - BCB24_UP Defined when compiling with C++Builder Personality of RAD Studio 10.1 or higher - BCB25_UP Defined when compiling with C++Builder Personality of RAD Studio 10.2 or higher - BCB26_UP Defined when compiling with C++Builder Personality of RAD Studio 10.3 or higher - BCB27_UP Defined when compiling with C++Builder Personality of RAD Studio 10.4 or higher - - -- RAD Studio / Borland Developer Studio Versions + BCB1 Defined when compiling with C++ Builder 1 + BCB3 Defined when compiling with C++ Builder 3 + BCB4 Defined when compiling with C++ Builder 4 + BCB5 Defined when compiling with C++ Builder 5 + BCB6 Defined when compiling with C++ Builder 6 + BCB10 Defined when compiling with C++ Builder Personality of BDS 4.0 (also known as C++Builder 2006) + BCB11 Defined when compiling with C++ Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) + BCB12 Defined when compiling with C++ Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) + BCB1_UP Defined when compiling with C++ Builder 1 or higher + BCB3_UP Defined when compiling with C++ Builder 3 or higher + BCB4_UP Defined when compiling with C++ Builder 4 or higher + BCB5_UP Defined when compiling with C++ Builder 5 or higher + BCB6_UP Defined when compiling with C++ Builder 6 or higher + BCB10_UP Defined when compiling with C++ Builder Personality of BDS 4.0 or higher + BCB11_UP Defined when compiling with C++ Builder Personality of RAD Studio 2007 or higher + BCB12_UP Defined when compiling with C++ Builder Personality of RAD Studio 2009 or higher + + +- CodeGear RAD Studio / Borland Developer Studio Versions The following directives are direct mappings from the VERXXX directives to a friendly name of the associated IDE. These directives are only defined if @@ -348,45 +238,17 @@ Directive Description ------------------------------------------------------------------------------ - BDS Defined when compiling with BDS version of dcc32.exe (Codename SIDEWINDER) - BDS2 Defined when compiling with BDS 2.0 (Delphi 8) (Codename OCTANE) - BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) (Codename DIAMONDBACK) - BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) (Codename DEXTER) - BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) (Codename HIGHLANDER) - BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) (Codename TIBURON) - BDS7 Defined when compiling with BDS 7.0 (Embarcadero RAD Studio 2010) (Codename WEAVER) - BDS8 Defined when compiling with BDS 8.0 (Embarcadero RAD Studio XE) (Codename FULCRUM) - BDS9 Defined when compiling with BDS 9.0 (Embarcadero RAD Studio XE2) (Codename PULSAR) - BDS10 Defined when compiling with BDS 10.0 (Embarcadero RAD Studio XE3) (Codename WATERDRAGON) - BDS11 Defined when compiling with BDS 11.0 (Embarcadero RAD Studio XE4) (Codename QUINTESSENCE) - BDS12 Defined when compiling with BDS 12.0 (Embarcadero RAD Studio XE5) (Codename ZEPHYR) - BDS14 Defined when compiling with BDS 14.0 (Embarcadero RAD Studio XE6) (Codename PROTEUS) - BDS15 Defined when compiling with BDS 15.0 (Embarcadero RAD Studio XE7) (Codename CARPATHIA) - BDS16 Defined when compiling with BDS 16.0 (Embarcadero RAD Studio XE8) (Codename ELBRUS) - BDS17 Defined when compiling with BDS 17.0 (Embarcadero RAD Studio 10) (Codename AITANA) - BDS18 Defined when compiling with BDS 18.0 (Embarcadero RAD Studio 10.1) (Codename BIGBEN) - BDS19 Defined when compiling with BDS 19.0 (Embarcadero RAD Studio 10.2) (Codename GODZILLA) - BDS20 Defined when compiling with BDS 20.0 (Embarcadero RAD Studio 10.3) (Codename CARNIVAL) - BDS21 Defined when compiling with BDS 21.0 (Embarcadero RAD Studio 10.4) (Codename DENALI) + BDS Defined when compiling with a Borland Developer Studio version's dcc32.exe + BDS2 Defined when compiling with BDS 2.0 (Delphi 8) + BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) + BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) + BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) + BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) BDS2_UP Defined when compiling with BDS 2.0 or higher BDS3_UP Defined when compiling with BDS 3.0 or higher BDS4_UP Defined when compiling with BDS 4.0 or higher BDS5_UP Defined when compiling with BDS 5.0 or higher BDS6_UP Defined when compiling with BDS 6.0 or higher - BDS7_UP Defined when compiling with BDS 7.0 or higher - BDS8_UP Defined when compiling with BDS 8.0 or higher - BDS9_UP Defined when compiling with BDS 9.0 or higher - BDS10_UP Defined when compiling with BDS 10.0 or higher - BDS11_UP Defined when compiling with BDS 11.0 or higher - BDS12_UP Defined when compiling with BDS 12.0 or higher - BDS14_UP Defined when compiling with BDS 14.0 or higher - BDS15_UP Defined when compiling with BDS 15.0 or higher - BDS16_UP Defined when compiling with BDS 16.0 or higher - BDS17_UP Defined when compiling with BDS 17.0 or higher - BDS18_UP Defined when compiling with BDS 18.0 or higher - BDS19_UP Defined when compiling with BDS 19.0 or higher - BDS20_UP Defined when compiling with BDS 20.0 or higher - BDS21_UP Defined when compiling with BDS 21.0 or higher - Compiler Versions @@ -394,64 +256,36 @@ friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X directives, these directives are indepedent of the development environment. That is, they are defined regardless of whether compilation takes place using - Delphi or C++Builder. + Delphi or C++ Builder. Directive Description ------------------------------------------------------------------------------ COMPILER1 Defined when compiling with Delphi 1 - COMPILER2 Defined when compiling with Delphi 2 or C++Builder 1 + COMPILER2 Defined when compiling with Delphi 2 or C++ Builder 1 COMPILER3 Defined when compiling with Delphi 3 - COMPILER35 Defined when compiling with C++Builder 3 - COMPILER4 Defined when compiling with Delphi 4 or C++Builder 4 - COMPILER5 Defined when compiling with Delphi 5 or C++Builder 5 - COMPILER6 Defined when compiling with Delphi 6 or C++Builder 6 + COMPILER35 Defined when compiling with C++ Builder 3 + COMPILER4 Defined when compiling with Delphi 4 or C++ Builder 4 + COMPILER5 Defined when compiling with Delphi 5 or C++ Builder 5 + COMPILER6 Defined when compiling with Delphi 6 or C++ Builder 6 COMPILER7 Defined when compiling with Delphi 7 COMPILER8 Defined when compiling with Delphi 8 COMPILER9 Defined when compiling with Delphi 9 - COMPILER10 Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 - COMPILER11 Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 - COMPILER12 Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 - COMPILER14 Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 - COMPILER15 Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 - COMPILER16 Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 - COMPILER17 Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 - COMPILER18 Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 - COMPILER19 Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 - COMPILER20 Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 - COMPILER21 Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 - COMPILER22 Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 - COMPILER23 Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 - COMPILER24 Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 - COMPILER25 Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 - COMPILER26 Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 - COMPILER27 Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 + COMPILER10 Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 + COMPILER11 Defined when compiling with Delphi 2007 for Win32 + COMPILER12 Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 COMPILER1_UP Defined when compiling with Delphi 1 or higher - COMPILER2_UP Defined when compiling with Delphi 2 or C++Builder 1 or higher + COMPILER2_UP Defined when compiling with Delphi 2 or C++ Builder 1 or higher COMPILER3_UP Defined when compiling with Delphi 3 or higher - COMPILER35_UP Defined when compiling with C++Builder 3 or higher - COMPILER4_UP Defined when compiling with Delphi 4 or C++Builder 4 or higher - COMPILER5_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher - COMPILER6_UP Defined when compiling with Delphi 6 or C++Builder 6 or higher + COMPILER35_UP Defined when compiling with C++ Builder 3 or higher + COMPILER4_UP Defined when compiling with Delphi 4 or C++ Builder 4 or higher + COMPILER5_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher + COMPILER6_UP Defined when compiling with Delphi 6 or C++ Builder 6 or higher COMPILER7_UP Defined when compiling with Delphi 7 COMPILER8_UP Defined when compiling with Delphi 8 COMPILER9_UP Defined when compiling with Delphi Personalities of BDS 3.0 - COMPILER10_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher - COMPILER11_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher - COMPILER12_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher - COMPILER14_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher - COMPILER15_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher - COMPILER16_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher - COMPILER17_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher - COMPILER18_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher - COMPILER19_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher - COMPILER20_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher - COMPILER21_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher - COMPILER22_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher - COMPILER23_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher - COMPILER24_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher - COMPILER25_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher - COMPILER26_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 or higher - COMPILER27_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 or higher + COMPILER10_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 or higher + COMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher + COMPILER12_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 or higher - RTL Versions @@ -459,7 +293,7 @@ Use e.g. following to determine the exact RTL version since version 14.0: {$IFDEF CONDITIONALEXPRESSIONS} {$IF Declared(RTLVersion) and (RTLVersion >= 14.2)} - // code for Delphi 6.02 or higher, Kylix 2 or higher, C++Builder 6 or higher + // code for Delphi 6.02 or higher, Kylix 2 or higher, C++ Builder 6 or higher ... {$IFEND} {$ENDIF} @@ -468,34 +302,20 @@ ------------------------------------------------------------------------------ RTL80_UP Defined when compiling with Delphi 1 or higher RTL90_UP Defined when compiling with Delphi 2 or higher - RTL93_UP Defined when compiling with C++Builder 1 or higher + RTL93_UP Defined when compiling with C++ Builder 1 or higher RTL100_UP Defined when compiling with Delphi 3 or higher - RTL110_UP Defined when compiling with C++Builder 3 or higher + RTL110_UP Defined when compiling with C++ Builder 3 or higher RTL120_UP Defined when compiling with Delphi 4 or higher - RTL125_UP Defined when compiling with C++Builder 4 or higher - RTL130_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher - RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++Builder 6 or higher + RTL125_UP Defined when compiling with C++ Builder 4 or higher + RTL130_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher + RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++ Builder 6 or higher RTL150_UP Defined when compiling with Delphi 7 or higher RTL160_UP Defined when compiling with Delphi 8 or higher RTL170_UP Defined when compiling with Delphi Personalities of BDS 3.0 or higher - RTL180_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher - RTL185_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher - RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or higher - RTL200_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher - RTL210_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher - RTL220_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher - RTL230_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher - RTL240_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher - RTL250_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher - RTL260_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher - RTL270_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher - RTL280_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher - RTL290_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher - RTL300_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher - RTL310_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher - RTL320_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher - RTL330_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 or higher - RTL340_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 or higher + RTL180_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 or higher + RTL185_UP Defined when compiling with Delphi 2007 for Win32 or higher + RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or later + RTL200_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 or later - CLR Versions @@ -520,98 +340,67 @@ Directive Description ------------------------------------------------------------------------------ - SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) - SUPPORTS_SINGLE Compiler supports the Single type (D1+) - SUPPORTS_DOUBLE Compiler supports the Double type (D1+) - SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) - SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) - SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) - SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) - SUPPORTS_VARIANT Compiler supports variant (D2+) - SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) - SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) - SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) - SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) - SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) - SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) - SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) - SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) - SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) - SUPPORTS_UINT64 Compiler supports the UInt64 type (D7+) - SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) - SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) - SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) - SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) - SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) - SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) - SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) - SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) - SUPPORTS_SETPEFLAGS Compiler supports the SetPEFlags directive (D6+/BCB6+) - SUPPORTS_EXPERIMENTAL_WARNINGS Compiler supports the WARN SYMBOL_EXPERIMENTAL and WARN UNIT_EXPERIMENTAL directives (D6+/BCB6+) - SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) - SUPPORTS_FOR_IN Compiler supports for in loops (D9+) - SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) - SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) - SUPPORTS_REGION Compiler supports the REGION and ENDREGION directives (D9+) - SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) - SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) - SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) - SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) - SUPPORTS_CLASS_CTORDTORS Compiler supports class contructors/destructors (D14+) - SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) - SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) - SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) - SUPPORTS_METHODINFO Compiler supports the METHODINFO directives (D10+) - SUPPORTS_GENERICS Compiler supports generic implementations (D11.NET, D12+) - SUPPORTS_GENERIC_TYPES Compiler supports generic implementations of types (D11.NET, D12+, FPC) - SUPPORTS_GENERIC_METHODS Compiler supports generic implementations of methods (D11.NET, D12+, FPC) - SUPPORTS_GENERIC_ROUTINES Compiler supports generic implementations of global functions/procedures (FPC) - SUPPORTS_DEPRECATED_DETAILS Compiler supports additional text for the deprecated directive (D11.NET, D12+) - ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) - ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) - ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) - SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) - SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) - SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) - SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) - SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) - SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) - SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) - SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive - SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive - SUPPORTS_PACKAGES Compiler supports Packages - HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) - HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) - HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) - HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) - HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) - HAS_UNIT_HTTPPROD Unit HTTPProd exists (D9+) - HAS_UNIT_GIFIMG Unit GifImg exists (D11+) - HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) - HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+) - HAS_UNIT_CHARACTER Unit Character exists (D12+) - XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) - SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.NET, D12+) - SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) - SUPPORTS_INT_ALIASES Types Int8, Int16, Int32, UInt8, UInt16 and UInt32 are defined in the unit System (D12+) - HAS_UNIT_RTTI Unit RTTI is available (D14+) - SUPPORTS_CAST_INTERFACE_TO_OBJ The compiler supports casts from interfaces to objects (D14+) - SUPPORTS_DELAYED_LOADING The compiler generates stubs for delaying imported function loads (D14+) - HAS_UNIT_REGULAREXPRESSIONSAPI Unit RegularExpressionsAPI is available (D15+) - HAS_UNIT_SYSTEM_UITYPES Unit System.UITypes is available (D16+) - HAS_UNIT_SYSTEM_ACTIONS Unit System.Actions is available (D17+) - DEPRECATED_SYSUTILS_ANSISTRINGS AnsiString functions from SysUtils are deprecated and moved to System.AnsiStrings (D18+) - HAS_PROPERTY_STYLEELEMENTS TControl has a StyleElements property (D17+) - HAS_AUTOMATIC_DB_FIELDS Database fields are automatically created/refreshed (D20+) - HAS_EARGUMENTEXCEPTION Exception class EArgumentException is available (D14+) - HAS_ENOTIMPLEMENTED Exception class ENotImplemented is available (D15+) - HAS_UNIT_VCL_THEMES Unit Vcl.Themes is available (D16+) - HAS_UNIT_UXTHEME Unit (Vcl.)UxTheme is available (D7+) - HAS_EXCEPTION_STACKTRACE Exception class has the StackTrace propery (D12+) - SUPPORTS_LEGACYIFEND Compiler supports the LEGACYIFEND directive (D17+) - DEPRECATED_TCHARACTER TCharacter is deprecated and replaced by a record helper on Char (D18+) + SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) + SUPPORTS_SINGLE Compiler supports the Single type (D1+) + SUPPORTS_DOUBLE Compiler supports the Double type (D1+) + SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) + SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) + SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) + SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) + SUPPORTS_VARIANT Compiler supports variant (D2+) + SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) + SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) + SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) + SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) + SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) + SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) + SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) + SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) + SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) + SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) + SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) + SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) + SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) + SUPPORTS_FOR_IN Compiler supports for in loops (D9+) + SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) + SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) + SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) + SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) + SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) + SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) + SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) + SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) + SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) + SUPPORTS_GENERICS Compiler supports generic implementations (D11.net, D12+) + ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) + ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) + ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) + SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) + SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) + SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) + SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) + SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) + SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) + SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) + SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive + SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive + SUPPORTS_PACKAGES Compiler supports Packages + HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) + HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) + HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) + HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) + HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) + HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) + XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) + SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.net, D12+) + SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) - Compiler Settings @@ -631,7 +420,6 @@ IOCHECKS_ON Compiling in the I+ state (I/O checking enabled) WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified) LOCALSYMBOLS Compiling in the L+ state (local symbol generation) - LOCALSYMBOLS_ON Alias of LOCALSYMBOLS TYPEINFO_ON Compiling in the M+ state (RTTI generation on) OPTIMIZATION_ON Compiling in the O+ state (code optimization on) OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings) @@ -651,44 +439,16 @@ {$MODE DELPHI} {$ASMMODE Intel} {$UNDEF BORLAND} - {$DEFINE CPUASM} - // FPC defines CPU32, CPU64 and Unix automatically + // FPC defines CPU* and Unix automatically {$ENDIF} {$IFDEF BORLAND} {$IFDEF LINUX} - {$IFDEF VER140} // Only under Delphi 6, LINUX implies Kylix {$DEFINE KYLIX} - {$ENDIF} {$ENDIF LINUX} {$IFNDEF CLR} - {$IFNDEF CPUX86} - // CPUX86 is not defined, which means it most likely is a 64 bits compiler. - // However, this is only the case if either of two other symbols are defined: - // http://docwiki.embarcadero.com/RADStudio/Seattle/en/Conditional_compilation_%28Delphi%29 - {$DEFINE CPU64} - {$DEFINE DELPHI64_TEMPORARY} - {$IFNDEF CPUX64} - {$IFNDEF CPU64BITS} - {$DEFINE CPU386} // None of the two 64-bits symbols are defined, assume this is 32-bit - {$DEFINE CPU32} - {$UNDEF CPU64} - {$UNDEF DELPHI64_TEMPORARY} - {$ENDIF ~CPU64BITS} - {$ENDIF ~CPUX64} - {$ELSE ~CPUX86} - {$DEFINE CPU386} - {$DEFINE CPU32} - {$ENDIF ~CPUX86} - - // The ASSEMBLER symbol appeared with Delphi 7 - {$IFNDEF COMPILER7_UP} - {$DEFINE CPUASM} - {$ELSE} - {$IFDEF ASSEMBLER} - {$DEFINE CPUASM} - {$ENDIF ASSEMBLER} - {$ENDIF ~COMPILER7_UP} + {$DEFINE CPU386} // For Borland compilers select the x86 compat assembler by default + {$DEFINE CPU32} // Assume Borland compilers are 32-bit (rather than 64-bit) {$ENDIF ~CLR} {$ENDIF BORLAND} @@ -738,7 +498,6 @@ {$IFDEF VER110} {$DEFINE COMPILER35} {$DEFINE BCB3} - {$DEFINE BCB} {$DEFINE RTL110_UP} {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF} @@ -885,226 +644,22 @@ {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF VER200} - {$IFDEF VER210} // RAD Studio 2010 - {$DEFINE BDS} - {$DEFINE BDS7} - {$DEFINE COMPILER14} - {$IFDEF BCB} - {$DEFINE BCB14} - {$ELSE} - {$DEFINE DELPHI14} - {$DEFINE DELPHI2010} // synonym to DELPHI14 - {$DEFINE DELPHICOMPILER14} - {$ENDIF BCB} - {$DEFINE RTL210_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER210} - - {$IFDEF VER220} // RAD Studio XE - {$DEFINE BDS} - {$DEFINE BDS8} - {$DEFINE COMPILER15} - {$IFDEF BCB} - {$DEFINE BCB15} - {$ELSE} - {$DEFINE DELPHI15} - {$DEFINE DELPHIXE} // synonym to DELPHI15 - {$DEFINE DELPHICOMPILER15} - {$ENDIF BCB} - {$DEFINE RTL220_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER220} - - {$IFDEF VER230} // RAD Studio XE2 - {$DEFINE BDS} - {$DEFINE BDS9} - {$DEFINE COMPILER16} - {$IFDEF BCB} - {$DEFINE BCB16} - {$ELSE} - {$DEFINE DELPHI16} - {$DEFINE DELPHIXE2} // synonym to DELPHI16 - {$DEFINE DELPHICOMPILER16} - {$ENDIF BCB} - {$DEFINE RTL230_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER230} - - {$IFDEF VER240} // RAD Studio XE3 - {$DEFINE BDS} - {$DEFINE BDS10} - {$DEFINE COMPILER17} - {$IFDEF BCB} - {$DEFINE BCB17} - {$ELSE} - {$DEFINE DELPHI17} - {$DEFINE DELPHIXE3} // synonym to DELPHI17 - {$DEFINE DELPHICOMPILER17} - {$ENDIF BCB} - {$DEFINE RTL240_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER240} - - {$IFDEF VER250} // RAD Studio XE4 - {$DEFINE BDS} - {$DEFINE BDS11} - {$DEFINE COMPILER18} - {$IFDEF BCB} - {$DEFINE BCB18} - {$ELSE} - {$DEFINE DELPHI18} - {$DEFINE DELPHIXE4} // synonym to DELPHI18 - {$DEFINE DELPHICOMPILER18} - {$ENDIF BCB} - {$DEFINE RTL250_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER250} - - {$IFDEF VER260} // RAD Studio XE5 - {$DEFINE BDS} - {$DEFINE BDS12} - {$DEFINE COMPILER19} - {$IFDEF BCB} - {$DEFINE BCB19} - {$ELSE} - {$DEFINE DELPHI19} - {$DEFINE DELPHIXE5} // synonym to DELPHI19 - {$DEFINE DELPHICOMPILER19} - {$ENDIF BCB} - {$DEFINE RTL260_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER260} - - {$IFDEF VER270} // RAD Studio XE6 - {$DEFINE BDS} - {$DEFINE BDS14} - {$DEFINE COMPILER20} - {$IFDEF BCB} - {$DEFINE BCB20} - {$ELSE} - {$DEFINE DELPHI20} - {$DEFINE DELPHIXE6} // synonym to DELPHI20 - {$DEFINE DELPHICOMPILER20} - {$ENDIF BCB} - {$DEFINE RTL270_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER270} - - {$IFDEF VER280} // RAD Studio XE7 - {$DEFINE BDS} - {$DEFINE BDS15} - {$DEFINE COMPILER21} - {$IFDEF BCB} - {$DEFINE BCB21} - {$ELSE} - {$DEFINE DELPHI21} - {$DEFINE DELPHIXE7} // synonym to DELPHI21 - {$DEFINE DELPHICOMPILER21} - {$ENDIF BCB} - {$DEFINE RTL280_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER280} - - {$IFDEF VER290} // RAD Studio XE8 - {$DEFINE BDS} - {$DEFINE BDS16} - {$DEFINE COMPILER22} - {$IFDEF BCB} - {$DEFINE BCB22} - {$ELSE} - {$DEFINE DELPHI22} - {$DEFINE DELPHIXE8} // synonym to DELPHI22 - {$DEFINE DELPHICOMPILER22} - {$ENDIF BCB} - {$DEFINE RTL290_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER290} - - {$IFDEF VER300} // RAD Studio 10 - {$DEFINE BDS} - {$DEFINE BDS17} - {$DEFINE COMPILER23} - {$IFDEF BCB} - {$DEFINE BCB23} - {$ELSE} - {$DEFINE DELPHI23} - {$DEFINE DELPHIX_SEATTLE} // synonym to DELPHI23 - {$DEFINE DELPHICOMPILER23} - {$ENDIF BCB} - {$DEFINE RTL300_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER300} - - {$IFDEF VER310} // RAD Studio 10.1 - {$DEFINE BDS} - {$DEFINE BDS18} - {$DEFINE COMPILER24} - {$IFDEF BCB} - {$DEFINE BCB24} - {$ELSE} - {$DEFINE DELPHI24} - {$DEFINE DELPHIX_BERLIN} // synonym to DELPHI24 - {$DEFINE DELPHICOMPILER24} - {$ENDIF BCB} - {$DEFINE RTL310_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER310} - - {$IFDEF VER320} // RAD Studio 10.2 - {$DEFINE BDS} - {$DEFINE BDS19} - {$DEFINE COMPILER25} - {$IFDEF BCB} - {$DEFINE BCB25} - {$ELSE} - {$DEFINE DELPHI25} - {$DEFINE DELPHIX_TOKYO} // synonym to DELPHI25 - {$DEFINE DELPHICOMPILER25} - {$ENDIF BCB} - {$DEFINE RTL320_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER320} - - {$IFDEF VER330} // RAD Studio 10.3 - {$DEFINE BDS} - {$DEFINE BDS20} - {$DEFINE COMPILER26} - {$IFDEF BCB} - {$DEFINE BCB26} - {$ELSE} - {$DEFINE DELPHI26} - {$DEFINE DELPHIX_RIO} // synonym to DELPHI26 - {$DEFINE DELPHICOMPILER26} - {$ENDIF BCB} - {$DEFINE RTL330_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER330} - - {$IFDEF VER340} // RAD Studio 10.4 - {$DEFINE BDS} - {$DEFINE BDS21} - {$DEFINE COMPILER27} - {$IFDEF BCB} - {$DEFINE BCB27} - {$ELSE} - {$DEFINE DELPHI27} - {$DEFINE DELPHICOMPILER27} - {$ENDIF BCB} - {$DEFINE RTL340_UP} - {$UNDEF UNKNOWN_COMPILER_VERSION} - {$ENDIF VER340} - {$IFDEF UNKNOWN_COMPILER_VERSION} // adjust for newer version (always use latest version) {$DEFINE BDS} - {$DEFINE BDS21} - {$DEFINE COMPILER27} + {$DEFINE BDS6} + {$DEFINE COMPILER12} {$IFDEF BCB} - {$DEFINE BCB27} + {$DEFINE BCB12} {$ELSE} - {$DEFINE DELPHI27} - {$DEFINE DELPHICOMPILER27} + {$DEFINE DELPHI12} + {$DEFINE DELPHI2009} // synonym to DELPHI12 + {$DEFINE DELPHICOMPILER12} {$ENDIF BCB} - {$DEFINE RTL340_UP} + {$IFDEF CLR} + {$DEFINE RTL190_UP} + {$ELSE} + {$DEFINE RTL200_UP} + {$ENDIF} {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF} @@ -1124,20 +679,6 @@ { DELPHIX_UP from DELPHIX mappings } {------------------------------------------------------------------------------} -{$IFDEF DELPHI27} {$DEFINE DELPHI27_UP} {$ENDIF} -{$IFDEF DELPHI26} {$DEFINE DELPHI26_UP} {$ENDIF} -{$IFDEF DELPHI25} {$DEFINE DELPHI25_UP} {$ENDIF} -{$IFDEF DELPHI24} {$DEFINE DELPHI24_UP} {$ENDIF} -{$IFDEF DELPHI23} {$DEFINE DELPHI23_UP} {$ENDIF} -{$IFDEF DELPHI22} {$DEFINE DELPHI22_UP} {$ENDIF} -{$IFDEF DELPHI21} {$DEFINE DELPHI21_UP} {$ENDIF} -{$IFDEF DELPHI20} {$DEFINE DELPHI20_UP} {$ENDIF} -{$IFDEF DELPHI19} {$DEFINE DELPHI19_UP} {$ENDIF} -{$IFDEF DELPHI18} {$DEFINE DELPHI18_UP} {$ENDIF} -{$IFDEF DELPHI17} {$DEFINE DELPHI17_UP} {$ENDIF} -{$IFDEF DELPHI16} {$DEFINE DELPHI16_UP} {$ENDIF} -{$IFDEF DELPHI15} {$DEFINE DELPHI15_UP} {$ENDIF} -{$IFDEF DELPHI14} {$DEFINE DELPHI14_UP} {$ENDIF} {$IFDEF DELPHI12} {$DEFINE DELPHI12_UP} {$ENDIF} {$IFDEF DELPHI11} {$DEFINE DELPHI11_UP} {$ENDIF} {$IFDEF DELPHI10} {$DEFINE DELPHI10_UP} {$ENDIF} @@ -1155,75 +696,6 @@ { DELPHIX_UP from DELPHIX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF DELPHI27_UP} - {$DEFINE DELPHI26_UP} -{$ENDIF} - -{$IFDEF DELPHI26_UP} - {$DEFINE DELPHIX_RIO_UP} // synonym to DELPHI26_UP - {$DEFINE DELPHI25_UP} -{$ENDIF} - -{$IFDEF DELPHI25_UP} - {$DEFINE DELPHIX_TOKYO_UP} // synonym to DELPHI25_UP - {$DEFINE DELPHI24_UP} -{$ENDIF} - -{$IFDEF DELPHI24_UP} - {$DEFINE DELPHIX_BERLIN_UP} // synonym to DELPHI24_UP - {$DEFINE DELPHI23_UP} -{$ENDIF} - -{$IFDEF DELPHI23_UP} - {$DEFINE DELPHIX_SEATTLE_UP} // synonym to DELPHI23_UP - {$DEFINE DELPHI22_UP} -{$ENDIF} - -{$IFDEF DELPHI22_UP} - {$DEFINE DELPHIXE8_UP} // synonym to DELPHI22_UP - {$DEFINE DELPHI21_UP} -{$ENDIF} - -{$IFDEF DELPHI21_UP} - {$DEFINE DELPHIXE7_UP} // synonym to DELPHI21_UP - {$DEFINE DELPHI20_UP} -{$ENDIF} - -{$IFDEF DELPHI20_UP} - {$DEFINE DELPHIXE6_UP} // synonym to DELPHI20_UP - {$DEFINE DELPHI19_UP} -{$ENDIF} - -{$IFDEF DELPHI19_UP} - {$DEFINE DELPHIXE5_UP} // synonym to DELPHI19_UP - {$DEFINE DELPHI18_UP} -{$ENDIF} - -{$IFDEF DELPHI18_UP} - {$DEFINE DELPHIXE4_UP} // synonym to DELPHI18_UP - {$DEFINE DELPHI17_UP} -{$ENDIF} - -{$IFDEF DELPHI17_UP} - {$DEFINE DELPHIXE3_UP} // synonym to DELPHI17_UP - {$DEFINE DELPHI16_UP} -{$ENDIF} - -{$IFDEF DELPHI16_UP} - {$DEFINE DELPHIXE2_UP} // synonym to DELPHI16_UP - {$DEFINE DELPHI15_UP} -{$ENDIF} - -{$IFDEF DELPHI15_UP} - {$DEFINE DELPHIXE_UP} // synonym to DELPHI15_UP - {$DEFINE DELPHI14_UP} -{$ENDIF} - -{$IFDEF DELPHI14_UP} - {$DEFINE DELPHI2010_UP} // synonym to DELPHI14_UP - {$DEFINE DELPHI12_UP} -{$ENDIF} - {$IFDEF DELPHI12_UP} {$DEFINE DELPHI2009_UP} // synonym to DELPHI12_UP {$DEFINE DELPHI11_UP} @@ -1256,20 +728,6 @@ { BCBX_UP from BCBX mappings } {------------------------------------------------------------------------------} -{$IFDEF BCB27} {$DEFINE BCB27_UP} {$ENDIF} -{$IFDEF BCB26} {$DEFINE BCB26_UP} {$ENDIF} -{$IFDEF BCB25} {$DEFINE BCB25_UP} {$ENDIF} -{$IFDEF BCB24} {$DEFINE BCB24_UP} {$ENDIF} -{$IFDEF BCB23} {$DEFINE BCB23_UP} {$ENDIF} -{$IFDEF BCB22} {$DEFINE BCB22_UP} {$ENDIF} -{$IFDEF BCB21} {$DEFINE BCB21_UP} {$ENDIF} -{$IFDEF BCB20} {$DEFINE BCB20_UP} {$ENDIF} -{$IFDEF BCB19} {$DEFINE BCB19_UP} {$ENDIF} -{$IFDEF BCB18} {$DEFINE BCB18_UP} {$ENDIF} -{$IFDEF BCB17} {$DEFINE BCB17_UP} {$ENDIF} -{$IFDEF BCB16} {$DEFINE BCB16_UP} {$ENDIF} -{$IFDEF BCB15} {$DEFINE BCB15_UP} {$ENDIF} -{$IFDEF BCB14} {$DEFINE BCB14_UP} {$ENDIF} {$IFDEF BCB12} {$DEFINE BCB12_UP} {$ENDIF} {$IFDEF BCB11} {$DEFINE BCB11_UP} {$ENDIF} {$IFDEF BCB10} {$DEFINE BCB10_UP} {$ENDIF} @@ -1283,20 +741,6 @@ { BCBX_UP from BCBX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF BCB27_UP} {$DEFINE BCB26_UP} {$ENDIF} -{$IFDEF BCB26_UP} {$DEFINE BCB25_UP} {$ENDIF} -{$IFDEF BCB25_UP} {$DEFINE BCB24_UP} {$ENDIF} -{$IFDEF BCB24_UP} {$DEFINE BCB23_UP} {$ENDIF} -{$IFDEF BCB23_UP} {$DEFINE BCB22_UP} {$ENDIF} -{$IFDEF BCB22_UP} {$DEFINE BCB21_UP} {$ENDIF} -{$IFDEF BCB21_UP} {$DEFINE BCB20_UP} {$ENDIF} -{$IFDEF BCB20_UP} {$DEFINE BCB19_UP} {$ENDIF} -{$IFDEF BCB19_UP} {$DEFINE BCB18_UP} {$ENDIF} -{$IFDEF BCB18_UP} {$DEFINE BCB17_UP} {$ENDIF} -{$IFDEF BCB17_UP} {$DEFINE BCB16_UP} {$ENDIF} -{$IFDEF BCB16_UP} {$DEFINE BCB15_UP} {$ENDIF} -{$IFDEF BCB15_UP} {$DEFINE BCB14_UP} {$ENDIF} -{$IFDEF BCB14_UP} {$DEFINE BCB12_UP} {$ENDIF} {$IFDEF BCB12_UP} {$DEFINE BCB11_UP} {$ENDIF} {$IFDEF BCB11_UP} {$DEFINE BCB10_UP} {$ENDIF} {$IFDEF BCB10_UP} {$DEFINE BCB6_UP} {$ENDIF} @@ -1309,20 +753,6 @@ { BDSX_UP from BDSX mappings } {------------------------------------------------------------------------------} -{$IFDEF BDS21} {$DEFINE BDS21_UP} {$ENDIF} -{$IFDEF BDS20} {$DEFINE BDS20_UP} {$ENDIF} -{$IFDEF BDS19} {$DEFINE BDS19_UP} {$ENDIF} -{$IFDEF BDS18} {$DEFINE BDS18_UP} {$ENDIF} -{$IFDEF BDS17} {$DEFINE BDS17_UP} {$ENDIF} -{$IFDEF BDS16} {$DEFINE BDS16_UP} {$ENDIF} -{$IFDEF BDS15} {$DEFINE BDS15_UP} {$ENDIF} -{$IFDEF BDS14} {$DEFINE BDS14_UP} {$ENDIF} -{$IFDEF BDS12} {$DEFINE BDS12_UP} {$ENDIF} -{$IFDEF BDS11} {$DEFINE BDS11_UP} {$ENDIF} -{$IFDEF BDS10} {$DEFINE BDS10_UP} {$ENDIF} -{$IFDEF BDS9} {$DEFINE BDS9_UP} {$ENDIF} -{$IFDEF BDS8} {$DEFINE BDS8_UP} {$ENDIF} -{$IFDEF BDS7} {$DEFINE BDS7_UP} {$ENDIF} {$IFDEF BDS6} {$DEFINE BDS6_UP} {$ENDIF} {$IFDEF BDS5} {$DEFINE BDS5_UP} {$ENDIF} {$IFDEF BDS4} {$DEFINE BDS4_UP} {$ENDIF} @@ -1333,20 +763,6 @@ { BDSX_UP from BDSX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF BDS21_UP} {$DEFINE BDS20_UP} {$ENDIF} -{$IFDEF BDS20_UP} {$DEFINE BDS19_UP} {$ENDIF} -{$IFDEF BDS19_UP} {$DEFINE BDS18_UP} {$ENDIF} -{$IFDEF BDS18_UP} {$DEFINE BDS17_UP} {$ENDIF} -{$IFDEF BDS17_UP} {$DEFINE BDS16_UP} {$ENDIF} -{$IFDEF BDS16_UP} {$DEFINE BDS15_UP} {$ENDIF} -{$IFDEF BDS15_UP} {$DEFINE BDS14_UP} {$ENDIF} -{$IFDEF BDS14_UP} {$DEFINE BDS12_UP} {$ENDIF} -{$IFDEF BDS12_UP} {$DEFINE BDS11_UP} {$ENDIF} -{$IFDEF BDS11_UP} {$DEFINE BDS10_UP} {$ENDIF} -{$IFDEF BDS10_UP} {$DEFINE BDS9_UP} {$ENDIF} -{$IFDEF BDS9_UP} {$DEFINE BDS8_UP} {$ENDIF} -{$IFDEF BDS8_UP} {$DEFINE BDS7_UP} {$ENDIF} -{$IFDEF BDS7_UP} {$DEFINE BDS6_UP} {$ENDIF} {$IFDEF BDS6_UP} {$DEFINE BDS5_UP} {$ENDIF} {$IFDEF BDS5_UP} {$DEFINE BDS4_UP} {$ENDIF} {$IFDEF BDS4_UP} {$DEFINE BDS3_UP} {$ENDIF} @@ -1356,20 +772,6 @@ { DELPHICOMPILERX_UP from DELPHICOMPILERX mappings } {------------------------------------------------------------------------------} -{$IFDEF DELPHICOMPILER27} {$DEFINE DELPHICOMPILER27_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER26} {$DEFINE DELPHICOMPILER26_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER25} {$DEFINE DELPHICOMPILER25_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER24} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER23} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER22} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER21} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER20} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER19} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER18} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER17} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER16} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER15} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER14} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} {$IFDEF DELPHICOMPILER12} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} {$IFDEF DELPHICOMPILER11} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} {$IFDEF DELPHICOMPILER10} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} @@ -1387,20 +789,6 @@ { DELPHICOMPILERX_UP from DELPHICOMPILERX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF DELPHICOMPILER27_UP} {$DEFINE DELPHICOMPILER26_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER26_UP} {$DEFINE DELPHICOMPILER25_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER25_UP} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER24_UP} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER23_UP} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER22_UP} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER21_UP} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER20_UP} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER19_UP} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER18_UP} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER17_UP} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER16_UP} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER15_UP} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} -{$IFDEF DELPHICOMPILER14_UP} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} {$IFDEF DELPHICOMPILER12_UP} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} {$IFDEF DELPHICOMPILER11_UP} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} {$IFDEF DELPHICOMPILER10_UP} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF} @@ -1418,20 +806,6 @@ { COMPILERX_UP from COMPILERX mappings } {------------------------------------------------------------------------------} -{$IFDEF COMPILER27} {$DEFINE COMPILER27_UP} {$ENDIF} -{$IFDEF COMPILER26} {$DEFINE COMPILER26_UP} {$ENDIF} -{$IFDEF COMPILER25} {$DEFINE COMPILER25_UP} {$ENDIF} -{$IFDEF COMPILER24} {$DEFINE COMPILER24_UP} {$ENDIF} -{$IFDEF COMPILER23} {$DEFINE COMPILER23_UP} {$ENDIF} -{$IFDEF COMPILER22} {$DEFINE COMPILER22_UP} {$ENDIF} -{$IFDEF COMPILER21} {$DEFINE COMPILER21_UP} {$ENDIF} -{$IFDEF COMPILER20} {$DEFINE COMPILER20_UP} {$ENDIF} -{$IFDEF COMPILER19} {$DEFINE COMPILER19_UP} {$ENDIF} -{$IFDEF COMPILER18} {$DEFINE COMPILER18_UP} {$ENDIF} -{$IFDEF COMPILER17} {$DEFINE COMPILER17_UP} {$ENDIF} -{$IFDEF COMPILER16} {$DEFINE COMPILER16_UP} {$ENDIF} -{$IFDEF COMPILER15} {$DEFINE COMPILER15_UP} {$ENDIF} -{$IFDEF COMPILER14} {$DEFINE COMPILER14_UP} {$ENDIF} {$IFDEF COMPILER12} {$DEFINE COMPILER12_UP} {$ENDIF} {$IFDEF COMPILER11} {$DEFINE COMPILER11_UP} {$ENDIF} {$IFDEF COMPILER10} {$DEFINE COMPILER10_UP} {$ENDIF} @@ -1450,20 +824,6 @@ { COMPILERX_UP from COMPILERX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF COMPILER27_UP} {$DEFINE COMPILER26_UP} {$ENDIF} -{$IFDEF COMPILER26_UP} {$DEFINE COMPILER25_UP} {$ENDIF} -{$IFDEF COMPILER25_UP} {$DEFINE COMPILER24_UP} {$ENDIF} -{$IFDEF COMPILER24_UP} {$DEFINE COMPILER23_UP} {$ENDIF} -{$IFDEF COMPILER23_UP} {$DEFINE COMPILER22_UP} {$ENDIF} -{$IFDEF COMPILER22_UP} {$DEFINE COMPILER21_UP} {$ENDIF} -{$IFDEF COMPILER21_UP} {$DEFINE COMPILER20_UP} {$ENDIF} -{$IFDEF COMPILER20_UP} {$DEFINE COMPILER19_UP} {$ENDIF} -{$IFDEF COMPILER19_UP} {$DEFINE COMPILER18_UP} {$ENDIF} -{$IFDEF COMPILER18_UP} {$DEFINE COMPILER17_UP} {$ENDIF} -{$IFDEF COMPILER17_UP} {$DEFINE COMPILER16_UP} {$ENDIF} -{$IFDEF COMPILER16_UP} {$DEFINE COMPILER15_UP} {$ENDIF} -{$IFDEF COMPILER15_UP} {$DEFINE COMPILER14_UP} {$ENDIF} -{$IFDEF COMPILER14_UP} {$DEFINE COMPILER12_UP} {$ENDIF} {$IFDEF COMPILER12_UP} {$DEFINE COMPILER11_UP} {$ENDIF} {$IFDEF COMPILER11_UP} {$DEFINE COMPILER10_UP} {$ENDIF} {$IFDEF COMPILER10_UP} {$DEFINE COMPILER9_UP} {$ENDIF} @@ -1481,20 +841,6 @@ { RTLX_UP from RTLX_UP mappings } {------------------------------------------------------------------------------} -{$IFDEF RTL340_UP} {$DEFINE RTL330_UP} {$ENDIF} -{$IFDEF RTL330_UP} {$DEFINE RTL320_UP} {$ENDIF} -{$IFDEF RTL320_UP} {$DEFINE RTL310_UP} {$ENDIF} -{$IFDEF RTL310_UP} {$DEFINE RTL300_UP} {$ENDIF} -{$IFDEF RTL300_UP} {$DEFINE RTL290_UP} {$ENDIF} -{$IFDEF RTL290_UP} {$DEFINE RTL280_UP} {$ENDIF} -{$IFDEF RTL280_UP} {$DEFINE RTL270_UP} {$ENDIF} -{$IFDEF RTL270_UP} {$DEFINE RTL260_UP} {$ENDIF} -{$IFDEF RTL260_UP} {$DEFINE RTL250_UP} {$ENDIF} -{$IFDEF RTL250_UP} {$DEFINE RTL240_UP} {$ENDIF} -{$IFDEF RTL240_UP} {$DEFINE RTL230_UP} {$ENDIF} -{$IFDEF RTL230_UP} {$DEFINE RTL220_UP} {$ENDIF} -{$IFDEF RTL220_UP} {$DEFINE RTL210_UP} {$ENDIF} -{$IFDEF RTL210_UP} {$DEFINE RTL200_UP} {$ENDIF} {$IFDEF RTL200_UP} {$DEFINE RTL190_UP} {$ENDIF} {$IFDEF RTL190_UP} {$DEFINE RTL185_UP} {$ENDIF} {$IFDEF RTL185_UP} {$DEFINE RTL180_UP} {$ENDIF} @@ -1585,26 +931,15 @@ {$IFDEF VER1_0} Please use FPC 2.0 or higher to compile this. {$ELSE} - { FPC_FULLVERSION is available from 2.2.4 on } - {$DEFINE SUPPORTS_OUTPARAMS} {$DEFINE SUPPORTS_WIDECHAR} {$DEFINE SUPPORTS_WIDESTRING} - {$IF DEFINED(VER2_0) OR DEFINED(VER2_1)} - {$IFDEF HASINTF} - {$DEFINE SUPPORTS_INTERFACE} - {$ENDIF} - {$IFDEF HASVARIANT} - {$DEFINE SUPPORTS_VARIANT} - {$ENDIF} - {$IFDEF HASCURRENCY} - {$DEFINE SUPPORTS_CURRENCY} - {$ENDIF} - {$ELSE} + {$IFDEF HASINTF} {$DEFINE SUPPORTS_INTERFACE} + {$ENDIF} + {$IFDEF HASVARIANT} {$DEFINE SUPPORTS_VARIANT} - {$DEFINE SUPPORTS_CURRENCY} - {$IFEND} + {$ENDIF} {$IFDEF FPC_HAS_TYPE_SINGLE} {$DEFINE SUPPORTS_SINGLE} {$ENDIF} @@ -1614,6 +949,9 @@ {$IFDEF FPC_HAS_TYPE_EXTENDED} {$DEFINE SUPPORTS_EXTENDED} {$ENDIF} + {$IFDEF HASCURRENCY} + {$DEFINE SUPPORTS_CURRENCY} + {$ENDIF} {$DEFINE SUPPORTS_THREADVAR} {$DEFINE SUPPORTS_CONSTPARAMS} {$DEFINE SUPPORTS_LONGWORD} @@ -1624,26 +962,15 @@ {$DEFINE ACCEPT_DEPRECATED} // 2.2 also gives warnings {$DEFINE ACCEPT_PLATFORM} // 2.2 also gives warnings {$DEFINE ACCEPT_LIBRARY} - {$DEFINE SUPPORTS_DEPRECATED} - {$DEFINE SUPPORTS_PLATFORM} - {$DEFINE SUPPORTS_LIBRARY} - {$DEFINE SUPPORTS_DEPRECATED_WARNINGS} - {$DEFINE SUPPORTS_PLATFORM_WARNINGS} {$DEFINE SUPPORTS_EXTSYM} {$DEFINE SUPPORTS_NODEFINE} - {$DEFINE SUPPORTS_DISPINTERFACE} - {$DEFINE SUPPORTS_IMPLEMENTS} - {$DEFINE SUPPORTS_DISPID} - {$DEFINE SUPPORTS_INLINE} - {$DEFINE SUPPORTS_STATIC} - {$DEFINE SUPPORTS_COMPILETIME_MESSAGES} {$DEFINE SUPPORTS_CUSTOMVARIANTS} {$DEFINE SUPPORTS_VARARGS} {$DEFINE SUPPORTS_ENUMVALUE} - {$IF DEFINED(LINUX) AND DEFINED(CPU386)} + {$IFDEF LINUX} {$DEFINE HAS_UNIT_LIBC} - {$IFEND} + {$ENDIF LINUX} {$DEFINE HAS_UNIT_CONTNRS} {$DEFINE HAS_UNIT_TYPES} {$DEFINE HAS_UNIT_VARIANTS} @@ -1653,68 +980,15 @@ {$DEFINE XPLATFORM_RTL} - {$IF DEFINED(FPC_FULLVERSION)} - { 2.2.4 or newer } - - {$DEFINE SUPPORTS_SETPEFLAGS} - {$DEFINE SUPPORTS_STRICT} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20400)} - {$DEFINE SUPPORTS_UINT64} - {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} - {$DEFINE SUPPORTS_REGION} - {$DEFINE SUPPORTS_UNICODE_STRING} - {$IFEND} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20402)} - {$DEFINE SUPPORTS_FOR_IN} - {$IFEND} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20600)} - {$DEFINE SUPPORTS_LIBRARY_WARNINGS} - {$DEFINE SUPPORTS_DEPRECATED_DETAILS} - {$DEFINE SUPPORTS_NESTED_TYPES} - {$DEFINE SUPPORTS_NESTED_CONSTANTS} - {$DEFINE SUPPORTS_ENHANCED_RECORDS} // called Advanced Records in FPC - {$DEFINE SUPPORTS_CLASS_FIELDS} - {$DEFINE SUPPORTS_CLASS_HELPERS} - {$DEFINE SUPPORTS_CLASS_OPERATORS} - {$DEFINE SUPPORTS_CLASS_CTORDTORS} - {$DEFINE SUPPORTS_FINAL} - {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ} - - {$DEFINE HAS_ENOTIMPLEMENTED} - {$IFEND} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20602)} - {$DEFINE SUPPORTS_INT_ALIASES} - - {$DEFINE HAS_EARGUMENTEXCEPTION} - {$IFEND} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 30000)} - {$DEFINE SUPPORTS_GENERICS} - {$DEFINE SUPPORTS_GENERIC_TYPES} - - {$DEFINE HAS_UNIT_CHARACTER} - {$IFEND} - - {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 30200)} - {$DEFINE SUPPORTS_GENERIC_METHODS} - {$DEFINE SUPPORTS_GENERIC_ROUTINES} - {$DEFINE SUPPORTS_WEAKPACKAGEUNIT} - - {$DEFINE HAS_UNIT_RTTI} - {$DEFINE HAS_UNIT_SYSTEM_UITYPES} - {$IFEND} + {$IFDEF VER2_2} + {$DEFINE SUPPORTS_DISPINTERFACE} + {$DEFINE SUPPORTS_IMPLEMENTS} + {$DEFINE SUPPORTS_DISPID} {$ELSE} - { older than 2.2.4 } - - {$IFDEF VER2_2} - {$SUPPORTS_SETPEFLAGS} - {$SUPPORTS_STRICT} - {$ENDIF} - {$IFEND} + {$UNDEF SUPPORTS_DISPINTERFACE} + {$UNDEF SUPPORTS_IMPLEMENTS} + {$endif} + {$UNDEF SUPPORTS_UNSAFE_WARNINGS} {$ENDIF} {$ENDIF FPC} @@ -1727,7 +1001,7 @@ {$DEFINE SUPPORTS_SINGLE} {$DEFINE SUPPORTS_DOUBLE} {$DEFINE SUPPORTS_EXTENDED} - {$DEFINE SUPPORTS_PACKAGES} + {$DEFINE SUPPORTS_PACKAGES} {$ENDIF COMPILER1_UP} {$IFDEF COMPILER2_UP} @@ -1765,8 +1039,6 @@ {$DEFINE SUPPORTS_LIBRARY} {$DEFINE SUPPORTS_PLATFORM} {$DEFINE SUPPORTS_LOCAL} - {$DEFINE SUPPORTS_SETPEFLAGS} - {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} {$DEFINE ACCEPT_DEPRECATED} {$DEFINE ACCEPT_PLATFORM} {$DEFINE ACCEPT_LIBRARY} @@ -1781,7 +1053,6 @@ {$IFDEF COMPILER7_UP} {$DEFINE SUPPORTS_UNSAFE_WARNINGS} - {$DEFINE SUPPORTS_UINT64} {$ENDIF COMPILER7_UP} {$IFDEF COMPILER9_UP} @@ -1789,7 +1060,6 @@ {$DEFINE SUPPORTS_INLINE} {$DEFINE SUPPORTS_NESTED_CONSTANTS} {$DEFINE SUPPORTS_NESTED_TYPES} - {$DEFINE SUPPORTS_REGION} {$IFDEF CLR} {$DEFINE SUPPORTS_ENHANCED_RECORDS} {$DEFINE SUPPORTS_CLASS_FIELDS} @@ -1809,49 +1079,23 @@ {$DEFINE SUPPORTS_STRICT} {$DEFINE SUPPORTS_STATIC} {$DEFINE SUPPORTS_FINAL} - {$DEFINE SUPPORTS_METHODINFO} {$ENDIF COMPILER10_UP} {$IFDEF COMPILER11_UP} {$IFDEF CLR} {$DEFINE SUPPORTS_GENERICS} - {$DEFINE SUPPORTS_GENERIC_TYPES} - {$DEFINE SUPPORTS_GENERIC_METHODS} - {$DEFINE SUPPORTS_DEPRECATED_DETAILS} {$ENDIF CLR} {$ENDIF COMPILER11_UP} {$IFDEF COMPILER12_UP} {$DEFINE SUPPORTS_GENERICS} - {$DEFINE SUPPORTS_GENERIC_TYPES} - {$DEFINE SUPPORTS_GENERIC_METHODS} - {$DEFINE SUPPORTS_DEPRECATED_DETAILS} - {$DEFINE SUPPORTS_INT_ALIASES} + {$DEFINE HAS_UNIT_ANSISTRINGS} {$IFNDEF CLR} {$DEFINE SUPPORTS_UNICODE} {$DEFINE SUPPORTS_UNICODE_STRING} {$ENDIF CLR} {$ENDIF COMPILER12_UP} -{$IFDEF COMPILER14_UP} - {$DEFINE SUPPORTS_CLASS_CTORDTORS} - {$DEFINE HAS_UNIT_RTTI} - {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ} - {$DEFINE SUPPORTS_DELAYED_LOADING} -{$ENDIF COMPILER14_UP} - -{$IFDEF COMPILER16_UP} - {$DEFINE USE_64BIT_TYPES} -{$ENDIF COMPILER16_UP} - -{$IFDEF COMPILER17_UP} - {$DEFINE SUPPORTS_LEGACYIFEND} -{$ENDIF COMPILER17_UP} - -{$IFDEF RTL130_UP} - {$DEFINE HAS_UNIT_CONTNRS} -{$ENDIF RTL130_UP} - {$IFDEF RTL140_UP} {$IFDEF LINUX} {$DEFINE HAS_UNIT_LIBC} @@ -1864,61 +1108,17 @@ {$DEFINE XPLATFORM_RTL} {$ENDIF RTL140_UP} -{$IFDEF RTL150_UP} - {$DEFINE HAS_UNIT_UXTHEME} -{$ENDIF RTL150_UP} - -{$IFDEF RTL170_UP} - {$DEFINE HAS_UNIT_HTTPPROD} -{$ENDIF RTL170_UP} - -{$IFDEF RTL185_UP} - {$DEFINE HAS_UNIT_GIFIMG} -{$ENDIF RTL185_UP} - -{$IFDEF RTL200_UP} - {$DEFINE HAS_UNIT_ANSISTRINGS} - {$DEFINE HAS_UNIT_PNGIMAGE} - {$DEFINE HAS_UNIT_CHARACTER} - {$DEFINE HAS_EXCEPTION_STACKTRACE} -{$ENDIF RTL200_UP} - -{$IFDEF RTL210_UP} - {$DEFINE HAS_EARGUMENTEXCEPTION} -{$ENDIF RTL210_UP} - -{$IFDEF RTL220_UP} - {$DEFINE HAS_UNIT_REGULAREXPRESSIONSAPI} - {$DEFINE HAS_ENOTIMPLEMENTED} -{$ENDIF RTL220_UP} - -{$IFDEF RTL230_UP} - {$DEFINE HAS_UNITSCOPE} - {$DEFINE HAS_UNIT_SYSTEM_UITYPES} - {$DEFINE HAS_UNIT_VCL_THEMES} -{$ENDIF RTL230_UP} - -{$IFDEF RTL240_UP} - {$DEFINE HAS_UNIT_SYSTEM_ACTIONS} - {$DEFINE HAS_PROPERTY_STYLEELEMENTS} -{$ENDIF RTL240_UP} - -{$IFDEF RTL250_UP} - {$DEFINE DEPRECATED_SYSUTILS_ANSISTRINGS} - {$DEFINE DEPRECATED_TCHARACTER} -{$ENDIF RTL250_UP} - -{$IFDEF RTL270_UP} - {$DEFINE HAS_AUTOMATIC_DB_FIELDS} -{$ENDIF RTL270_UP} +{$IFDEF RTL130_UP} + {$DEFINE HAS_UNIT_CONTNRS} +{$ENDIF RTL130_UP} {------------------------------------------------------------------------------} { Cross-platform related defines } {------------------------------------------------------------------------------} -{$IFNDEF CPUASM} +{$IFNDEF CPU386} {$DEFINE PUREPASCAL} -{$ENDIF ~CPUASM} +{$ENDIF} {$IFDEF WIN32} {$DEFINE MSWINDOWS} // predefined for D6+/BCB6+ @@ -1960,7 +1160,7 @@ {$IFDEF COMPILER2_UP} {$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF} {$ENDIF} -{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$DEFINE LOCALSYMBOLS_ON} {$ENDIF} +{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$ENDIF} {$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF} {$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF} {$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF} diff --git a/Source/VCL/SynEdit/Source/SynEditKbdHandler.pas b/Source/VCL/SynEdit/Source/SynEditKbdHandler.pas index 3b7abbe3..ed8711e8 100644 --- a/Source/VCL/SynEdit/Source/SynEditKbdHandler.pas +++ b/Source/VCL/SynEdit/Source/SynEditKbdHandler.pas @@ -1,397 +1,401 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. -The Original Code is based on the mwKeyCmds.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Brad Stowers. -Unicode translation by Maël Hörz. -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: SynEditKbdHandler.pas,v 1.10.2.1 2004/08/31 12:55:17 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditKbdHandler; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Graphics, - Controls, - Forms, - SynEditTypes, - SysUtils, - Classes; - -type - { This class provides a TWinControl-Object which supports only the - needed Methods } - TKeyboardControl = class(TWinControl) - public - property OnKeyDown; - property OnKeyPress; - property OnMouseDown; - end; - - TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; - var aCursor: TCursor) of object; - - TMethodList = class - private - fData: TList; - function GetItem(Index: integer): TMethod; - function GetCount: Integer; - public - constructor Create; - destructor Destroy; override; - procedure Add(aHandler: TMethod); - procedure Remove(aHandler: TMethod); - property Items[Index: Integer]: TMethod read GetItem; default; - property Count: Integer read GetCount; - end; - - TSynEditKbdHandler = class (TObject) - private - fKeyPressChain: TMethodList; - fKeyDownChain: TMethodList; - fKeyUpChain: TMethodList; - fMouseDownChain: TMethodList; - fMouseUpChain: TMethodList; - fMouseCursorChain: TMethodList; - { avoid infinite recursiveness } - fInKeyPress: Boolean; - fInKeyDown: Boolean; - fInKeyUp: Boolean; - fInMouseDown: Boolean; - fInMouseUp: Boolean; - fInMouseCursor: Boolean; - public - constructor Create; - destructor Destroy; override; - - procedure ExecuteKeyPress(Sender: TObject; var Key: WideChar); - procedure ExecuteKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure ExecuteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure ExecuteMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure ExecuteMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure ExecuteMouseCursor(Sender: TObject; const aLineCharPos: TBufferCoord; - var aCursor: TCursor); - - procedure AddKeyDownHandler(aHandler: TKeyEvent); - procedure RemoveKeyDownHandler(aHandler: TKeyEvent); - procedure AddKeyUpHandler(aHandler: TKeyEvent); - procedure RemoveKeyUpHandler(aHandler: TKeyEvent); - procedure AddKeyPressHandler(aHandler: TKeyPressEvent); - procedure RemoveKeyPressHandler(aHandler: TKeyPressEvent); - procedure AddMouseDownHandler(aHandler: TMouseEvent); - procedure RemoveMouseDownHandler(aHandler: TMouseEvent); - procedure AddMouseUpHandler(aHandler: TMouseEvent); - procedure RemoveMouseUpHandler(aHandler: TMouseEvent); - procedure AddMouseCursorHandler(aHandler: TMouseCursorEvent); - procedure RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); - end; - - -implementation - -{ TSynEditKbdHandler } - -procedure TSynEditKbdHandler.AddKeyDownHandler(aHandler: TKeyEvent); -begin - fKeyDownChain.Add(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.AddKeyUpHandler(aHandler: TKeyEvent); -begin - fKeyUpChain.Add(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.AddKeyPressHandler(aHandler: TKeyPressEvent); -begin - fKeyPressChain.Add(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.AddMouseDownHandler(aHandler: TMouseEvent); -begin - fMouseDownChain.Add(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.AddMouseUpHandler(aHandler: TMouseEvent); -begin - fMouseUpChain.Add(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.AddMouseCursorHandler(aHandler: TMouseCursorEvent); -begin - fMouseCursorChain.Add(TMethod(aHandler)); -end; - -constructor TSynEditKbdHandler.Create; -begin - inherited Create; - - { Elements to handle KeyDown-Events } - fKeyDownChain := TMethodList.Create; - - { Elements to handle KeyUp-Events } - fKeyUpChain := TMethodList.Create; - - { Elements to handle KeyPress-Events } - fKeyPressChain := TMethodList.Create; - - { Elements to handle MouseDown Events } - fMouseDownChain := TMethodList.Create; - - { Elements to handle MouseUp Events } - fMouseUpChain := TMethodList.Create; - - { Elements to handle MouseCursor Events } - fMouseCursorChain := TMethodList.Create; -end; - -destructor TSynEditKbdHandler.Destroy; -begin - fKeyPressChain.Free; - fKeyDownChain.Free; - fKeyUpChain.Free; - fMouseDownChain.Free; - fMouseUpChain.Free; - fMouseCursorChain.Free; - - inherited Destroy; -end; - -procedure TSynEditKbdHandler.ExecuteKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); -var - idx: Integer; -begin - if fInKeyDown then - exit; - fInKeyDown := True; - try - with fKeyDownChain do - begin - for idx := Count - 1 downto 0 do - begin - TKeyEvent(Items[idx])(Sender, Key, Shift); - if (Key = 0) then - begin - fInKeyDown := False; - exit; - end; - end; - end; - finally - fInKeyDown := False; - end; -end; - -procedure TSynEditKbdHandler.ExecuteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); -var - idx: Integer; -begin - if fInKeyUp then - exit; - fInKeyUp := True; - try - with fKeyUpChain do - begin - for idx := Count - 1 downto 0 do - begin - TKeyEvent(Items[idx])(Sender,Key,Shift); - if (Key = 0) then - begin - fInKeyUp := False; - exit; - end; - end; - end; - finally - fInKeyUp := False; - end; -end; - -procedure TSynEditKbdHandler.ExecuteKeyPress(Sender: TObject; var Key: WideChar); -var - idx: Integer; -begin - if fInKeyPress then - exit; - fInKeyPress := True; - try - with fKeyPressChain do - begin - for idx := Count - 1 downto 0 do - begin - TKeyPressEvent(Items[idx])(Sender, Key); - if (Key = #0) then - begin - fInKeyPress := False; - exit; - end; - end; - end; - finally - fInKeyPress := False; - end; -end; - -procedure TSynEditKbdHandler.ExecuteMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -var - cHandler: Integer; -begin - if fInMouseDown then - Exit; - fInMouseDown := True; - try - for cHandler := fMouseDownChain.Count - 1 downto 0 do - TMouseEvent(fMouseDownChain[cHandler])(Sender, Button, Shift, X, Y); - finally - fInMouseDown := False; - end; -end; - -procedure TSynEditKbdHandler.ExecuteMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -var - cHandler: Integer; -begin - if fInMouseUp then - Exit; - fInMouseUp := True; - try - for cHandler := fMouseUpChain.Count - 1 downto 0 do - TMouseEvent(fMouseUpChain[cHandler])(Sender, Button, Shift, X, Y); - finally - fInMouseUp := False; - end; -end; - -procedure TSynEditKbdHandler.ExecuteMouseCursor(Sender: TObject; - const aLineCharPos: TBufferCoord; var aCursor: TCursor); -var - cHandler: Integer; -begin - if fInMouseCursor then - Exit; - fInMouseCursor := True; - try - for cHandler := fMouseCursorChain.Count - 1 downto 0 do - TMouseCursorEvent(fMouseCursorChain[cHandler])(Sender, aLineCharPos, aCursor); - finally - fInMouseCursor := False; - end; -end; - -procedure TSynEditKbdHandler.RemoveKeyDownHandler(aHandler: TKeyEvent); -begin - fKeyDownChain.Remove(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.RemoveKeyUpHandler(aHandler: TKeyEvent); -begin - fKeyUpChain.Remove(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.RemoveKeyPressHandler(aHandler: TKeyPressEvent); -begin - fKeyPressChain.Remove(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.RemoveMouseDownHandler(aHandler: TMouseEvent); -begin - fMouseDownChain.Remove(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.RemoveMouseUpHandler(aHandler: TMouseEvent); -begin - fMouseUpChain.Remove(TMethod(aHandler)); -end; - -procedure TSynEditKbdHandler.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); -begin - fMouseCursorChain.Remove(TMethod(aHandler)); -end; - -{ TMethodList } - -procedure TMethodList.Add(aHandler: TMethod); -begin - fData.Add(aHandler.Data); - fData.Add(aHandler.Code); -end; - -constructor TMethodList.Create; -begin - inherited Create; - fData := TList.Create; -end; - -destructor TMethodList.Destroy; -begin - fData.Free; - inherited Destroy; -end; - -function TMethodList.GetCount: Integer; -begin - Result := fData.Count div 2; -end; - -function TMethodList.GetItem(Index: Integer): TMethod; -begin - Index := Index * 2; - Result.Data := fData[Index]; - Result.Code := fData[Index + 1]; -end; - -procedure TMethodList.Remove(aHandler: TMethod); -var - cPos: Integer; -begin - cPos := fData.Count - 2; - while cPos >= 0 do - begin - if (fData.List[cPos] = aHandler.Data) and (fData.List[cPos + 1] = aHandler.Code) then - begin - fData.Delete(cPos); - fData.Delete(cPos); - Exit; - end; - Dec(cPos, 2); - end; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. +The Original Code is based on the mwKeyCmds.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Brad Stowers. +Unicode translation by Maël Hörz. +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: SynEditKbdHandler.pas,v 1.10.2.1 2004/08/31 12:55:17 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITKBDHANDLER} +unit SynEditKbdHandler; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + Messages, + Graphics, + Controls, + Forms, + SynEditTypes, + SysUtils, + Classes; + +type + { This class provides a TWinControl-Object which supports only the + needed Methods } + TKeyboardControl = class(TWinControl) + public + property OnKeyDown; + property OnKeyPress; + property OnMouseDown; + end; + + TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; + var aCursor: TCursor) of object; + + TMethodList = class + private + FData: TList; + function GetItem(Index: Integer): TMethod; + function GetCount: Integer; + public + constructor Create; + destructor Destroy; override; + procedure Add(aHandler: TMethod); + procedure Remove(aHandler: TMethod); + property Items[Index: Integer]: TMethod read GetItem; default; + property Count: Integer read GetCount; + end; + + TSynEditKbdHandler = class (TObject) + private + FKeyPressChain: TMethodList; + FKeyDownChain: TMethodList; + FKeyUpChain: TMethodList; + FMouseDownChain: TMethodList; + FMouseUpChain: TMethodList; + FMouseCursorChain: TMethodList; + { avoid infinite recursiveness } + FInKeyPress: Boolean; + FInKeyDown: Boolean; + FInKeyUp: Boolean; + FInMouseDown: Boolean; + FInMouseUp: Boolean; + FInMouseCursor: Boolean; + public + constructor Create; + destructor Destroy; override; + + procedure ExecuteKeyPress(Sender: TObject; var Key: WideChar); + procedure ExecuteKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure ExecuteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure ExecuteMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ExecuteMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ExecuteMouseCursor(Sender: TObject; const aLineCharPos: TBufferCoord; + var aCursor: TCursor); + + procedure AddKeyDownHandler(aHandler: TKeyEvent); + procedure RemoveKeyDownHandler(aHandler: TKeyEvent); + procedure AddKeyUpHandler(aHandler: TKeyEvent); + procedure RemoveKeyUpHandler(aHandler: TKeyEvent); + procedure AddKeyPressHandler(aHandler: TKeyPressWEvent); + procedure RemoveKeyPressHandler(aHandler: TKeyPressWEvent); + procedure AddMouseDownHandler(aHandler: TMouseEvent); + procedure RemoveMouseDownHandler(aHandler: TMouseEvent); + procedure AddMouseUpHandler(aHandler: TMouseEvent); + procedure RemoveMouseUpHandler(aHandler: TMouseEvent); + procedure AddMouseCursorHandler(aHandler: TMouseCursorEvent); + procedure RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); + end; + + +implementation + +{ TSynEditKbdHandler } + +procedure TSynEditKbdHandler.AddKeyDownHandler(aHandler: TKeyEvent); +begin + FKeyDownChain.Add(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.AddKeyUpHandler(aHandler: TKeyEvent); +begin + FKeyUpChain.Add(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.AddKeyPressHandler(aHandler: TKeyPressWEvent); +begin + FKeyPressChain.Add(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.AddMouseDownHandler(aHandler: TMouseEvent); +begin + FMouseDownChain.Add(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.AddMouseUpHandler(aHandler: TMouseEvent); +begin + FMouseUpChain.Add(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.AddMouseCursorHandler(aHandler: TMouseCursorEvent); +begin + FMouseCursorChain.Add(TMethod(aHandler)); +end; + +constructor TSynEditKbdHandler.Create; +begin + inherited; + + { Elements to handle KeyDown-Events } + FKeyDownChain := TMethodList.Create; + + { Elements to handle KeyUp-Events } + FKeyUpChain := TMethodList.Create; + + { Elements to handle KeyPress-Events } + FKeyPressChain := TMethodList.Create; + + { Elements to handle MouseDown Events } + FMouseDownChain := TMethodList.Create; + + { Elements to handle MouseUp Events } + FMouseUpChain := TMethodList.Create; + + { Elements to handle MouseCursor Events } + FMouseCursorChain := TMethodList.Create; +end; + +destructor TSynEditKbdHandler.Destroy; +begin + FKeyPressChain.Free; + FKeyDownChain.Free; + FKeyUpChain.Free; + FMouseDownChain.Free; + FMouseUpChain.Free; + FMouseCursorChain.Free; + + inherited Destroy; +end; + +procedure TSynEditKbdHandler.ExecuteKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +var + idx: Integer; +begin + if FInKeyDown then + Exit; + FInKeyDown := True; + try + with FKeyDownChain do + begin + for idx := Count - 1 downto 0 do + begin + TKeyEvent(Items[idx])(Sender, Key, Shift); + if (Key = 0) then + begin + FInKeyDown := False; + Exit; + end; + end; + end; + finally + FInKeyDown := False; + end; +end; + +procedure TSynEditKbdHandler.ExecuteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); +var + idx: Integer; +begin + if FInKeyUp then + Exit; + FInKeyUp := True; + try + with FKeyUpChain do + begin + for idx := Count - 1 downto 0 do + begin + TKeyEvent(Items[idx])(Sender,Key,Shift); + if (Key = 0) then + begin + FInKeyUp := False; + Exit; + end; + end; + end; + finally + FInKeyUp := False; + end; +end; + +procedure TSynEditKbdHandler.ExecuteKeyPress(Sender: TObject; var Key: WideChar); +var + idx: Integer; +begin + if FInKeyPress then + Exit; + FInKeyPress := True; + try + with FKeyPressChain do + begin + for idx := Count - 1 downto 0 do + begin + TKeyPressWEvent(Items[idx])(Sender, Key); + if (Key = #0) then + begin + FInKeyPress := False; + Exit; + end; + end; + end; + finally + FInKeyPress := False; + end; +end; + +procedure TSynEditKbdHandler.ExecuteMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + cHandler: Integer; +begin + if FInMouseDown then + Exit; + FInMouseDown := True; + try + for cHandler := FMouseDownChain.Count - 1 downto 0 do + TMouseEvent(FMouseDownChain[cHandler])(Sender, Button, Shift, X, Y); + finally + FInMouseDown := False; + end; +end; + +procedure TSynEditKbdHandler.ExecuteMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + cHandler: Integer; +begin + if FInMouseUp then + Exit; + FInMouseUp := True; + try + for cHandler := FMouseUpChain.Count - 1 downto 0 do + TMouseEvent(FMouseUpChain[cHandler])(Sender, Button, Shift, X, Y); + finally + FInMouseUp := False; + end; +end; + +procedure TSynEditKbdHandler.ExecuteMouseCursor(Sender: TObject; + const aLineCharPos: TBufferCoord; var aCursor: TCursor); +var + cHandler: Integer; +begin + if FInMouseCursor then + Exit; + FInMouseCursor := True; + try + for cHandler := FMouseCursorChain.Count - 1 downto 0 do + TMouseCursorEvent(FMouseCursorChain[cHandler])(Sender, aLineCharPos, aCursor); + finally + FInMouseCursor := False; + end; +end; + +procedure TSynEditKbdHandler.RemoveKeyDownHandler(aHandler: TKeyEvent); +begin + FKeyDownChain.Remove(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.RemoveKeyUpHandler(aHandler: TKeyEvent); +begin + FKeyUpChain.Remove(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.RemoveKeyPressHandler(aHandler: TKeyPressWEvent); +begin + FKeyPressChain.Remove(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.RemoveMouseDownHandler(aHandler: TMouseEvent); +begin + FMouseDownChain.Remove(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.RemoveMouseUpHandler(aHandler: TMouseEvent); +begin + FMouseUpChain.Remove(TMethod(aHandler)); +end; + +procedure TSynEditKbdHandler.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); +begin + FMouseCursorChain.Remove(TMethod(aHandler)); +end; + +{ TMethodList } + +procedure TMethodList.Add(aHandler: TMethod); +begin + FData.Add(aHandler.Data); + FData.Add(aHandler.Code); +end; + +constructor TMethodList.Create; +begin + inherited; + + FData := TList.Create; +end; + +destructor TMethodList.Destroy; +begin + FData.Free; + + inherited; +end; + +function TMethodList.GetCount: Integer; +begin + Result := FData.Count div 2; +end; + +function TMethodList.GetItem(Index: Integer): TMethod; +begin + Index := Index * 2; + Result.Data := FData[Index]; + Result.Code := FData[Index + 1]; +end; + +procedure TMethodList.Remove(aHandler: TMethod); +var + cPos: Integer; +begin + cPos := FData.Count - 2; + while cPos >= 0 do + begin + if (FData.List[cPos] = aHandler.Data) and (FData.List[cPos + 1] = aHandler.Code) then + begin + FData.Delete(cPos); + FData.Delete(cPos); + Exit; + end; + Dec(cPos, 2); + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.dfm b/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.dfm index f848c972..c2df0041 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.dfm +++ b/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.dfm @@ -1,86 +1,88 @@ -object SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm - Left = 424 - Top = 306 - BorderStyle = bsDialog - Caption = 'Edit Keystroke' - ClientHeight = 129 - ClientWidth = 269 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter - OnCreate = FormCreate - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object pnlAlign: TPanel - Left = 3 - Top = 5 - Width = 262 - Height = 120 - BevelInner = bvRaised - BevelOuter = bvLowered - TabOrder = 0 - object Label1: TLabel - Left = 9 - Top = 14 - Width = 50 - Height = 13 - Caption = 'Command:' - end - object Label2: TLabel - Left = 9 - Top = 41 - Width = 50 - Height = 13 - Caption = 'Keystroke:' - end - object Label4: TLabel - Left = 9 - Top = 65 - Width = 50 - Height = 13 - Caption = 'Keystroke:' - end - object bntClearKey: TButton - Left = 9 - Top = 86 - Width = 75 - Height = 25 - Caption = 'Clear Key' - TabOrder = 3 - OnClick = bntClearKeyClick - end - object btnOK: TButton - Left = 93 - Top = 86 - Width = 75 - Height = 25 - Caption = 'OK' - TabOrder = 1 - OnClick = btnOKClick - end - object cmbCommand: TComboBox - Left = 65 - Top = 14 - Width = 186 - Height = 21 - Style = csDropDownList - TabOrder = 0 - end - object btnCancel: TButton - Left = 177 - Top = 86 - Width = 75 - Height = 25 - Cancel = True - Caption = 'Cancel' - ModalResult = 2 - TabOrder = 2 - end - end -end +object SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm + Left = 424 + Top = 306 + BorderStyle = bsDialog + Caption = 'Edit Keystroke' + ClientHeight = 129 + ClientWidth = 269 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + OnKeyDown = FormKeyDown + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object pnlAlign: TPanel + Left = 3 + Top = 5 + Width = 262 + Height = 120 + BevelInner = bvRaised + BevelOuter = bvLowered + TabOrder = 0 + object Label1: TLabel + Left = 9 + Top = 14 + Width = 50 + Height = 13 + Caption = 'Command:' + end + object Label2: TLabel + Left = 9 + Top = 41 + Width = 50 + Height = 13 + Caption = 'Keystroke:' + end + object Label4: TLabel + Left = 9 + Top = 65 + Width = 50 + Height = 13 + Caption = 'Keystroke:' + end + object bntClearKey: TButton + Left = 9 + Top = 86 + Width = 75 + Height = 25 + Caption = 'Clear Key' + TabOrder = 3 + OnClick = bntClearKeyClick + end + object btnOK: TButton + Left = 93 + Top = 86 + Width = 75 + Height = 25 + Caption = 'OK' + TabOrder = 1 + OnClick = btnOKClick + end + object cmbCommand: TComboBox + Left = 65 + Top = 10 + Width = 186 + Height = 21 + TabOrder = 0 + OnExit = cmbCommandExit + OnKeyPress = cmbCommandKeyPress + end + object btnCancel: TButton + Left = 177 + Top = 86 + Width = 75 + Height = 25 + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 2 + end + end +end diff --git a/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.pas b/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.pas index 32951276..55d72199 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.pas +++ b/Source/VCL/SynEdit/Source/SynEditKeyCmdEditor.pas @@ -1,210 +1,270 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditKeyCmdEditor.pas, released 2000-04-07. -The Original Code is based on the mwKeyCmdEditor.pas file from the -mwEdit component suite by Martin Waldenburg and other developers. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -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. - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditKeyCmdEditor; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Graphics, - Menus, - Controls, - Forms, - Dialogs, - StdCtrls, - ComCtrls, - ExtCtrls, - SynEditTypes, - SynEditKeyCmds, - SynEditMiscClasses, - SysUtils, - Classes; - -type - TSynEditKeystrokeEditorForm = class(TForm) - pnlAlign: TPanel; - Label1: TLabel; - Label2: TLabel; - Label4: TLabel; - bntClearKey: TButton; - btnOK: TButton; - cmbCommand: TComboBox; - btnCancel: TButton; - - procedure FormShow(Sender: TObject); - procedure bntClearKeyClick(Sender: TObject); - procedure btnOKClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - private - FExtended: Boolean; - procedure SetCommand(const Value: TSynEditorCommand); - procedure SetKeystroke(const Value: TShortcut); - procedure AddEditorCommand(const S: string); - function GetCommand: TSynEditorCommand; - function GetKeystroke: TShortcut; - function GetKeystroke2: TShortcut; - procedure SetKeystroke2(const Value: TShortcut); - public - hkKeystroke2: TSynHotKey; - hkKeystroke: TSynHotKey; - property Command: TSynEditorCommand read GetCommand write SetCommand; - property Keystroke: TShortcut read GetKeystroke write SetKeystroke; - property Keystroke2: TShortcut read GetKeystroke2 write SetKeystroke2; - property ExtendedString: Boolean read FExtended write FExtended default True; - end; - -var - SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm; - -implementation - -{$R *.dfm} - -uses - UITypes; - -{ TSynEditKeystrokeEditorForm } - -procedure TSynEditKeystrokeEditorForm.SetCommand(const Value: TSynEditorCommand); -begin - if FExtended then - cmbCommand.Text := ConvertCodeStringToExtended(EditorCommandToCodeString(Value)) - else cmbCommand.Text := EditorCommandToCodeString(Value); -end; - -procedure TSynEditKeystrokeEditorForm.SetKeystroke(const Value: TShortcut); -begin - hkKeystroke.Hotkey := Value; -end; - -procedure TSynEditKeystrokeEditorForm.FormShow(Sender: TObject); -Var i : Integer; -begin - if FExtended then - GetEditorCommandExtended(AddEditorCommand) - else GetEditorCommandValues(AddEditorCommand); - - //Now add the values for quick access - for i := 0 to cmbCommand.Items.Count - 1 do - cmbCommand.Items.Objects[i] := TObject(IndexToEditorCommand(i)); - if FExtended then - cmbCommand.Sorted := True; -end; - -procedure TSynEditKeystrokeEditorForm.AddEditorCommand(const S: string); -begin - cmbCommand.Items.Add(S); -end; - -function TSynEditKeystrokeEditorForm.GetCommand: TSynEditorCommand; -begin - if cmbCommand.ItemIndex <> -1 then - begin - Result := TSynEditorCommand(Integer(cmbCommand.Items.Objects[cmbCommand.ItemIndex])); - end else - Result := ecNone; -end; - -function TSynEditKeystrokeEditorForm.GetKeystroke: TShortcut; -begin - Result := hkKeystroke.HotKey; -end; - -procedure TSynEditKeystrokeEditorForm.bntClearKeyClick(Sender: TObject); -begin - hkKeystroke.HotKey := 0; - hkKeystroke2.HotKey := 0; -end; - -function TSynEditKeystrokeEditorForm.GetKeystroke2: TShortcut; -begin - Result := hkKeystroke2.HotKey; -end; - -procedure TSynEditKeystrokeEditorForm.SetKeystroke2(const Value: TShortcut); -begin - hkKeystroke2.Hotkey := Value; -end; - -procedure TSynEditKeystrokeEditorForm.btnOKClick(Sender: TObject); -begin - if Command = ecNone then - begin - MessageDlg('You must first select a command.', mtError, [mbOK], 0); - cmbCommand.SetFocus; - cmbCommand.SelectAll; - end else if Keystroke = 0 then - begin - MessageDlg('The command "'+cmbCommand.Text+'" needs to have at least one keystroke assigned to it.', mtError, [mbOK], 0); - hkKeystroke.SetFocus; - end else ModalResult := mrOK; -end; - -procedure TSynEditKeystrokeEditorForm.FormCreate(Sender: TObject); -begin - hkKeystroke := TSynHotKey.Create(self); - with hkKeystroke do - begin - Parent := pnlAlign; - Left := 65; - Top := 38; - Width := 186; - Height := 19; - HotKey := 0; - InvalidKeys := []; - Modifiers := []; - TabOrder := 1; - end; - - hkKeystroke2 := TSynHotKey.Create(self); - with hkKeystroke2 do - begin - Parent := pnlAlign; - Left := 65; - Top := 62; - Width := 186; - Height := 19; - HotKey := 0; - InvalidKeys := []; - Modifiers := []; - TabOrder := 2; - end; -end; - -end. - - - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditKeyCmdEditor.pas, released 2000-04-07. +The Original Code is based on the mwKeyCmdEditor.pas file from the +mwEdit component suite by Martin Waldenburg and other developers. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +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: SynEditKeyCmdEditor.pas,v 1.10.2.1 2004/08/31 12:55:17 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITKEYCMDEDITOR} +unit SynEditKeyCmdEditor; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} + Windows, + Messages, + Graphics, + Menus, + Controls, + Forms, + Dialogs, + StdCtrls, + ComCtrls, + ExtCtrls, + SynEditKeyCmds, + SynEditMiscClasses, + SysUtils, + Classes; + + +type + TSynEditKeystrokeEditorForm = class(TForm) + pnlAlign: TPanel; + Label1: TLabel; + Label2: TLabel; + Label4: TLabel; + bntClearKey: TButton; + btnOK: TButton; + cmbCommand: TComboBox; + btnCancel: TButton; + + procedure FormShow(Sender: TObject); + procedure bntClearKeyClick(Sender: TObject); + procedure cmbCommandKeyPress(Sender: TObject; var Key: Char); + procedure cmbCommandExit(Sender: TObject); + procedure btnOKClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + private + FExtended: Boolean; + procedure SetCommand(const Value: TSynEditorCommand); + procedure SetKeystroke(const Value: TShortcut); + procedure AddEditorCommand(const S: string); + function GetCommand: TSynEditorCommand; + function GetKeystroke: TShortcut; + function GetKeystroke2: TShortcut; + procedure SetKeystroke2(const Value: TShortcut); + public + hkKeystroke2: TSynHotKey; + hkKeystroke: TSynHotKey; + property Command: TSynEditorCommand read GetCommand write SetCommand; + property Keystroke: TShortcut read GetKeystroke write SetKeystroke; + property Keystroke2: TShortcut read GetKeystroke2 write SetKeystroke2; + property ExtendedString: Boolean read FExtended write FExtended default True; + end; + +var + SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm; + +implementation + +{$R *.dfm} + +{ TSynEditKeystrokeEditorForm } + +procedure TSynEditKeystrokeEditorForm.SetCommand(const Value: TSynEditorCommand); +begin + if FExtended then + cmbCommand.Text := ConvertCodeStringToExtended(EditorCommandToCodeString(Value)) + else cmbCommand.Text := EditorCommandToCodeString(Value); +end; + +procedure TSynEditKeystrokeEditorForm.SetKeystroke(const Value: TShortcut); +begin + hkKeystroke.Hotkey := Value; +end; + +procedure TSynEditKeystrokeEditorForm.FormShow(Sender: TObject); +Var i : Integer; +begin + if FExtended then + GetEditorCommandExtended(AddEditorCommand) + else GetEditorCommandValues(AddEditorCommand); + + //Now add the values for quick access + for i := 0 to cmbCommand.Items.Count - 1 do + cmbCommand.Items.Objects[i] := TObject(IndexToEditorCommand(i)); + if FExtended then + cmbCommand.Sorted := True; +end; + +procedure TSynEditKeystrokeEditorForm.AddEditorCommand(const S: string); +begin + cmbCommand.Items.Add(S); +end; + +function TSynEditKeystrokeEditorForm.GetCommand: TSynEditorCommand; +var + NewCmd: longint; +begin + cmbCommand.ItemIndex := cmbCommand.Items.IndexOf(cmbCommand.Text); + if cmbCommand.ItemIndex <> -1 then + begin + NewCmd := TSynEditorCommand(Integer(cmbCommand.Items.Objects[cmbCommand.ItemIndex])); + end else if not IdentToEditorCommand(cmbCommand.Text, NewCmd) then + begin + try + NewCmd := StrToInt(cmbCommand.Text); + except + NewCmd := ecNone; + end; + end; + Result := NewCmd; +end; + +function TSynEditKeystrokeEditorForm.GetKeystroke: TShortcut; +begin + Result := hkKeystroke.HotKey; +end; + +procedure TSynEditKeystrokeEditorForm.bntClearKeyClick(Sender: TObject); +begin + hkKeystroke.HotKey := 0; + hkKeystroke2.HotKey := 0; +end; + +function TSynEditKeystrokeEditorForm.GetKeystroke2: TShortcut; +begin + Result := hkKeystroke2.HotKey; +end; + +procedure TSynEditKeystrokeEditorForm.SetKeystroke2(const Value: TShortcut); +begin + hkKeystroke2.Hotkey := Value; +end; + +procedure TSynEditKeystrokeEditorForm.cmbCommandKeyPress(Sender: TObject; + var Key: Char); +var WorkStr : String; + i : Integer; +begin +//This would be better if componentized, but oh well... + WorkStr := AnsiUppercase(Copy(cmbCommand.Text, 1, cmbCommand.SelStart) + Key); + i := 0; + while i < cmbCommand.Items.Count do + begin + if pos(WorkStr, AnsiUppercase(cmbCommand.Items[i])) = 1 then + begin + cmbCommand.Text := cmbCommand.Items[i]; + cmbCommand.SelStart := length(WorkStr); + cmbCommand.SelLength := Length(cmbCommand.Text) - cmbCommand.SelStart; + Key := #0; + Break; + end + else + Inc(i); + end; +end; + +procedure TSynEditKeystrokeEditorForm.cmbCommandExit(Sender: TObject); +VAR TmpIndex : Integer; +begin + TmpIndex := cmbCommand.Items.IndexOf(cmbCommand.Text); + if TmpIndex = -1 then + begin + cmbCommand.ItemIndex := cmbCommand.Items.IndexOf(ConvertCodeStringToExtended('ecNone')); + end else cmbCommand.ItemIndex := TmpIndex; //need to force it incase they just typed something in +end; + +procedure TSynEditKeystrokeEditorForm.btnOKClick(Sender: TObject); +begin + if Command = ecNone then + begin + MessageDlg('You must first select a command.', mtError, [mbOK], 0); + cmbCommand.SetFocus; + cmbCommand.SelectAll; + end else if Keystroke = 0 then + begin + MessageDlg('The command "'+cmbCommand.Text+'" needs to have at least one keystroke assigned to it.', mtError, [mbOK], 0); + hkKeystroke.SetFocus; + end else ModalResult := mrOK; +end; + +procedure TSynEditKeystrokeEditorForm.FormCreate(Sender: TObject); +begin + hkKeystroke := TSynHotKey.Create(self); + with hkKeystroke do + begin + Parent := pnlAlign; + Left := 65; + Top := 38; + Width := 186; + Height := 19; + HotKey := 0; + InvalidKeys := []; + Modifiers := []; + TabOrder := 1; + end; + + hkKeystroke2 := TSynHotKey.Create(self); + with hkKeystroke2 do + begin + Parent := pnlAlign; + Left := 65; + Top := 62; + Width := 186; + Height := 19; + HotKey := 0; + InvalidKeys := []; + Modifiers := []; + TabOrder := 2; + end; +end; + +procedure TSynEditKeystrokeEditorForm.FormKeyDown(Sender: TObject; + var Key: Word; Shift: TShiftState); +begin + // if this event is not present CLX will complain +end; + +end. + + + diff --git a/Source/VCL/SynEdit/Source/SynEditKeyCmds.pas b/Source/VCL/SynEdit/Source/SynEditKeyCmds.pas index d11c3762..0abe774d 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyCmds.pas +++ b/Source/VCL/SynEdit/Source/SynEditKeyCmds.pas @@ -1,994 +1,1026 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. -The Original Code is based on the mwKeyCmds.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Brad Stowers. -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: SynEditKeyCmds.pas,v 1.23.2.4 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -// TODO: introduce friendly Names for the Commands (EditorCommandStrs is not good enough for end-users) - -unit SynEditKeyCmds; - -{$I SynEdit.inc} - -interface - -uses - Menus, - SynUnicode, - Classes, - SynEditTypes, - SysUtils; - -const - //**************************************************************************** - // NOTE! If you add an editor command, you must also update the - // EditorCommandStrs constant array in implementation section below, or the - // command will not show up in the IDE. - //**************************************************************************** - - // "Editor Commands". Key strokes are translated from a table into these - // I used constants instead of a set so that additional commands could be - // added in descendants (you can't extend a set) - - // There are two ranges of editor commands: the ecViewXXX commands are always - // valid, while the ecEditXXX commands are ignored when the editor is in - // read-only mode - - ecNone = 0; // Nothing. Useful for user event to handle command - ecViewCommandFirst = 0; - ecViewCommandLast = 500; - ecEditCommandFirst = 501; - ecEditCommandLast = 1000; - - ecLeft = 1; // Move cursor left one char - ecRight = 2; // Move cursor right one char - ecUp = 3; // Move cursor up one line - ecDown = 4; // Move cursor down one line - ecWordLeft = 5; // Move cursor left one word - ecWordRight = 6; // Move cursor right one word - ecLineStart = 7; // Move cursor to beginning of line - ecLineEnd = 8; // Move cursor to end of line - ecPageUp = 9; // Move cursor up one page - ecPageDown = 10; // Move cursor down one page - ecPageLeft = 11; // Move cursor right one page - ecPageRight = 12; // Move cursor left one page - ecPageTop = 13; // Move cursor to top of page - ecPageBottom = 14; // Move cursor to bottom of page - ecEditorTop = 15; // Move cursor to absolute beginning - ecEditorBottom = 16; // Move cursor to absolute end - ecGotoXY = 17; // Move cursor to specific coordinates, Data = PPoint - -//****************************************************************************** -// Maybe the command processor should just take a boolean that signifies if -// selection is affected or not? -//****************************************************************************** - - ecSelection = 100; // Add this to ecXXX command to get equivalent - // command, but with selection enabled. This is not - // a command itself. - // Same as commands above, except they affect selection, too - ecSelLeft = ecLeft + ecSelection; - ecSelRight = ecRight + ecSelection; - ecSelUp = ecUp + ecSelection; - ecSelDown = ecDown + ecSelection; - ecSelWordLeft = ecWordLeft + ecSelection; - ecSelWordRight = ecWordRight + ecSelection; - ecSelLineStart = ecLineStart + ecSelection; - ecSelLineEnd = ecLineEnd + ecSelection; - ecSelPageUp = ecPageUp + ecSelection; - ecSelPageDown = ecPageDown + ecSelection; - ecSelPageLeft = ecPageLeft + ecSelection; - ecSelPageRight = ecPageRight + ecSelection; - ecSelPageTop = ecPageTop + ecSelection; - ecSelPageBottom = ecPageBottom + ecSelection; - ecSelEditorTop = ecEditorTop + ecSelection; - ecSelEditorBottom = ecEditorBottom + ecSelection; - ecSelGotoXY = ecGotoXY + ecSelection; // Data = PPoint - - ecSelWord = 198; - ecSelectAll = 199; // Select entire contents of editor, cursor to end - - ecCopy = 201; // Copy selection to clipboard - - ecScrollUp = 211; // Scroll up one line leaving cursor position unchanged. - ecScrollDown = 212; // Scroll down one line leaving cursor position unchanged. - ecScrollLeft = 213; // Scroll left one char leaving cursor position unchanged. - ecScrollRight = 214; // Scroll right one char leaving cursor position unchanged. - - ecInsertMode = 221; // Set insert mode - ecOverwriteMode = 222; // Set overwrite mode - ecToggleMode = 223; // Toggle ins/ovr mode - - ecNormalSelect = 231; // Normal selection mode - ecColumnSelect = 232; // Column selection mode - ecLineSelect = 233; // Line selection mode - - ecMatchBracket = 250; // Go to matching bracket - ecCommentBlock = 251; // Comment Block - - ecGotoMarker0 = 301; // Goto marker - ecGotoMarker1 = 302; // Goto marker - ecGotoMarker2 = 303; // Goto marker - ecGotoMarker3 = 304; // Goto marker - ecGotoMarker4 = 305; // Goto marker - ecGotoMarker5 = 306; // Goto marker - ecGotoMarker6 = 307; // Goto marker - ecGotoMarker7 = 308; // Goto marker - ecGotoMarker8 = 309; // Goto marker - ecGotoMarker9 = 310; // Goto marker - ecSetMarker0 = 351; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker1 = 352; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker2 = 353; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker3 = 354; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker4 = 355; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker5 = 356; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker6 = 357; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker7 = 358; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker8 = 359; // Set marker, Data = PPoint - X, Y Pos - ecSetMarker9 = 360; // Set marker, Data = PPoint - X, Y Pos - - ecGotFocus = 480; - ecLostFocus = 481; - - ecContextHelp = 490; // Help on Word, Data = Word - - ecDeleteLastChar = 501; // Delete last char (i.e. backspace key) - ecDeleteChar = 502; // Delete char at cursor (i.e. delete key) - ecDeleteWord = 503; // Delete from cursor to end of word - ecDeleteLastWord = 504; // Delete from cursor to start of word - ecDeleteBOL = 505; // Delete from cursor to beginning of line - ecDeleteEOL = 506; // Delete from cursor to end of line - ecDeleteLine = 507; // Delete current line - ecClearAll = 508; // Delete everything - ecLineBreak = 509; // Break line at current position, move caret to new line - ecInsertLine = 510; // Break line at current position, leave caret - ecChar = 511; // Insert a character at current position - - ecImeStr = 550; // Insert character(s) from IME - - ecUndo = 601; // Perform undo if available - ecRedo = 602; // Perform redo if available - ecCut = 603; // Cut selection to clipboard - ecPaste = 604; // Paste clipboard to current position - - ecBlockIndent = 610; // Indent selection - ecBlockUnindent = 611; // Unindent selection - ecTab = 612; // Tab key - ecShiftTab = 613; // Shift+Tab key - - ecUpperCase = 620; // apply to the current selction or word - ecLowerCase = 621; - ecToggleCase = 622; - ecTitleCase = 623; - - ecString = 630; //Insert a whole string - - ecAutoCompletion = 650; - - ecCopyLineUp = 661; - ecCopyLineDown = 662; - ecMoveLineUp = 663; - ecMoveLineDown = 664; - - //++ CodeFolding - ecFoldAll = 701; - ecUnfoldAll = 702; - ecFoldNearest = 705; - ecUnfoldNearest = 706; - ecFoldLevel1 = 711; - ecFoldLevel2 = 712; - ecFoldLevel3 = 713; - ecUnfoldLevel1 = 721; - ecUnfoldLevel2 = 722; - ecUnfoldLevel3 = 723; - ecFoldRegions = 731; - ecUnfoldRegions = 732; - //-- CodeFolding - - ecUserFirst = 1001; // Start of user-defined commands - -type - ESynKeyError = class(Exception); - - TSynEditKeyStroke = class(TCollectionItem) - private - FKey: word; // Virtual keycode, i.e. VK_xxx - FShift: TShiftState; - FKey2: word; - FShift2: TShiftState; - FCommand: TSynEditorCommand; - function GetShortCut: TShortCut; - function GetShortCut2: TShortCut; - procedure SetCommand(const Value: TSynEditorCommand); - procedure SetKey(const Value: word); - procedure SetKey2(const Value: word); - procedure SetShift(const Value: TShiftState); - procedure SetShift2(const Value: TShiftState); - procedure SetShortCut(const Value: TShortCut); - procedure SetShortCut2(const Value: TShortCut); - protected - function GetDisplayName: string; override; - public - procedure Assign(Source: TPersistent); override; - procedure LoadFromStream(AStream: TStream); - procedure SaveToStream(AStream: TStream); - // No duplicate checking is done if assignment made via these properties! - property Key: word read FKey write SetKey; - property Key2: word read FKey2 write SetKey2; - property Shift: TShiftState read FShift write SetShift; - property Shift2: TShiftState read FShift2 write SetShift2; - published - property Command: TSynEditorCommand read FCommand write SetCommand; - property ShortCut: TShortCut read GetShortCut write SetShortCut - default 0; - property ShortCut2: TShortCut read GetShortCut2 write SetShortCut2 - default 0; - end; - - TSynEditKeyStrokes = class(TCollection) - private - FOwner: TPersistent; - function GetItem(Index: Integer): TSynEditKeyStroke; - procedure SetItem(Index: Integer; Value: TSynEditKeyStroke); - protected - function GetOwner: TPersistent; override; - public - constructor Create(AOwner: TPersistent); - function Add: TSynEditKeyStroke; -//++ CodeFolding - procedure AddKey(const ACmd: TSynEditorCommand; const AKey: word; - const AShift: TShiftState; const AKey2: word = 0; - const AShift2: TShiftState = []); -//-- CodeFolding - procedure Assign(Source: TPersistent); override; - function FindCommand(Cmd: TSynEditorCommand): integer; - function FindKeycode(Code: word; SS: TShiftState): integer; - function FindKeycode2(Code1: word; SS1: TShiftState; - Code2: word; SS2: TShiftState): integer; - function FindShortcut(SC: TShortcut): integer; - function FindShortcut2(SC, SC2: TShortcut): integer; - procedure LoadFromStream(AStream: TStream); - procedure ResetDefaults; - procedure SaveToStream(AStream: TStream); - public - property Items[Index: Integer]: TSynEditKeyStroke read GetItem - write SetItem; default; - end; - -// These are mainly for the TSynEditorCommand property editor, but could be -// useful elsewhere. -function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; -function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; -procedure GetEditorCommandValues(Proc: TGetStrProc); -procedure GetEditorCommandExtended(Proc: TGetStrProc); -function IdentToEditorCommand(const Ident: string; var Cmd: Integer): Boolean; -function EditorCommandToIdent(Cmd: Integer; var Ident: string): Boolean; -function ConvertCodeStringToExtended(AString: string): string; -function ConvertExtendedToCodeString(AString: string): string; -function ConvertExtendedToCommand(AString: string): TSynEditorCommand; -function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; -function IndexToEditorCommand(const AIndex: Integer): Integer; - -implementation - -uses - Windows, - SynEditKeyConst, - SynEditStrConst; - -{ Command mapping routines } - -const -//++ CodeFolding - EditorCommandStrs: array[0..112] of TIdentMapEntry = ( -//-- CodeFolding - (Value: ecNone; Name: 'ecNone'), - (Value: ecLeft; Name: 'ecLeft'), - (Value: ecRight; Name: 'ecRight'), - (Value: ecUp; Name: 'ecUp'), - (Value: ecDown; Name: 'ecDown'), - (Value: ecWordLeft; Name: 'ecWordLeft'), - (Value: ecWordRight; Name: 'ecWordRight'), - (Value: ecLineStart; Name: 'ecLineStart'), - (Value: ecLineEnd; Name: 'ecLineEnd'), - (Value: ecPageUp; Name: 'ecPageUp'), - (Value: ecPageDown; Name: 'ecPageDown'), - (Value: ecPageLeft; Name: 'ecPageLeft'), - (Value: ecPageRight; Name: 'ecPageRight'), - (Value: ecPageTop; Name: 'ecPageTop'), - (Value: ecPageBottom; Name: 'ecPageBottom'), - (Value: ecEditorTop; Name: 'ecEditorTop'), - (Value: ecEditorBottom; Name: 'ecEditorBottom'), - (Value: ecGotoXY; Name: 'ecGotoXY'), - (Value: ecSelLeft; Name: 'ecSelLeft'), - (Value: ecSelRight; Name: 'ecSelRight'), - (Value: ecSelUp; Name: 'ecSelUp'), - (Value: ecSelDown; Name: 'ecSelDown'), - (Value: ecSelWordLeft; Name: 'ecSelWordLeft'), - (Value: ecSelWordRight; Name: 'ecSelWordRight'), - (Value: ecSelLineStart; Name: 'ecSelLineStart'), - (Value: ecSelLineEnd; Name: 'ecSelLineEnd'), - (Value: ecSelPageUp; Name: 'ecSelPageUp'), - (Value: ecSelPageDown; Name: 'ecSelPageDown'), - (Value: ecSelPageLeft; Name: 'ecSelPageLeft'), - (Value: ecSelPageRight; Name: 'ecSelPageRight'), - (Value: ecSelPageTop; Name: 'ecSelPageTop'), - (Value: ecSelPageBottom; Name: 'ecSelPageBottom'), - (Value: ecSelEditorTop; Name: 'ecSelEditorTop'), - (Value: ecSelEditorBottom; Name: 'ecSelEditorBottom'), - (Value: ecSelGotoXY; Name: 'ecSelGotoXY'), - (Value: ecSelWord; Name: 'ecSelWord'), - (Value: ecSelectAll; Name: 'ecSelectAll'), - (Value: ecDeleteLastChar; Name: 'ecDeleteLastChar'), - (Value: ecDeleteChar; Name: 'ecDeleteChar'), - (Value: ecDeleteWord; Name: 'ecDeleteWord'), - (Value: ecDeleteLastWord; Name: 'ecDeleteLastWord'), - (Value: ecDeleteBOL; Name: 'ecDeleteBOL'), - (Value: ecDeleteEOL; Name: 'ecDeleteEOL'), - (Value: ecDeleteLine; Name: 'ecDeleteLine'), - (Value: ecClearAll; Name: 'ecClearAll'), - (Value: ecLineBreak; Name: 'ecLineBreak'), - (Value: ecInsertLine; Name: 'ecInsertLine'), - (Value: ecChar; Name: 'ecChar'), - (Value: ecImeStr; Name: 'ecImeStr'), - (Value: ecUndo; Name: 'ecUndo'), - (Value: ecRedo; Name: 'ecRedo'), - (Value: ecCut; Name: 'ecCut'), - (Value: ecCopy; Name: 'ecCopy'), - (Value: ecPaste; Name: 'ecPaste'), - (Value: ecScrollUp; Name: 'ecScrollUp'), - (Value: ecScrollDown; Name: 'ecScrollDown'), - (Value: ecScrollLeft; Name: 'ecScrollLeft'), - (Value: ecScrollRight; Name: 'ecScrollRight'), - (Value: ecInsertMode; Name: 'ecInsertMode'), - (Value: ecOverwriteMode; Name: 'ecOverwriteMode'), - (Value: ecToggleMode; Name: 'ecToggleMode'), - (Value: ecBlockIndent; Name: 'ecBlockIndent'), - (Value: ecBlockUnindent; Name: 'ecBlockUnindent'), - (Value: ecTab; Name: 'ecTab'), - (Value: ecShiftTab; Name: 'ecShiftTab'), - (Value: ecMatchBracket; Name: 'ecMatchBracket'), - (Value: ecCommentBlock; Name: 'ecCommentBlock'), - (Value: ecNormalSelect; Name: 'ecNormalSelect'), - (Value: ecColumnSelect; Name: 'ecColumnSelect'), - (Value: ecLineSelect; Name: 'ecLineSelect'), - (Value: ecAutoCompletion; Name: 'ecAutoCompletion'), - (Value: ecContextHelp; Name: 'ecContextHelp'), - (Value: ecGotoMarker0; Name: 'ecGotoMarker0'), - (Value: ecGotoMarker1; Name: 'ecGotoMarker1'), - (Value: ecGotoMarker2; Name: 'ecGotoMarker2'), - (Value: ecGotoMarker3; Name: 'ecGotoMarker3'), - (Value: ecGotoMarker4; Name: 'ecGotoMarker4'), - (Value: ecGotoMarker5; Name: 'ecGotoMarker5'), - (Value: ecGotoMarker6; Name: 'ecGotoMarker6'), - (Value: ecGotoMarker7; Name: 'ecGotoMarker7'), - (Value: ecGotoMarker8; Name: 'ecGotoMarker8'), - (Value: ecGotoMarker9; Name: 'ecGotoMarker9'), - (Value: ecSetMarker0; Name: 'ecSetMarker0'), - (Value: ecSetMarker1; Name: 'ecSetMarker1'), - (Value: ecSetMarker2; Name: 'ecSetMarker2'), - (Value: ecSetMarker3; Name: 'ecSetMarker3'), - (Value: ecSetMarker4; Name: 'ecSetMarker4'), - (Value: ecSetMarker5; Name: 'ecSetMarker5'), - (Value: ecSetMarker6; Name: 'ecSetMarker6'), - (Value: ecSetMarker7; Name: 'ecSetMarker7'), - (Value: ecSetMarker8; Name: 'ecSetMarker8'), - (Value: ecSetMarker9; Name: 'ecSetMarker9'), - (Value: ecUpperCase; Name: 'ecUpperCase'), - (Value: ecLowerCase; Name: 'ecLowerCase'), - (Value: ecToggleCase; Name: 'ecToggleCase'), - (Value: ecTitleCase; Name: 'ecTitleCase'), - (Value: ecCopyLineUp; Name:'ecCopyLineUp'), - (Value: ecCopyLineDown; Name:'ecCopyLineDown'), - (Value: ecMoveLineUp; Name:'ecMoveLineUp'), - (Value: ecMoveLineDown; Name:'ecMoveLineDown'), - (Value: ecString; Name:'ecString'), -//++ CodeFolding - (Value: ecFoldAll; Name:'ecFoldAll'), - (Value: ecUnfoldAll; Name:'ecUnfoldAll'), - (Value: ecFoldNearest; Name:'ecFoldNearest'), - (Value: ecUnfoldNearest; Name:'ecUnfoldNearest'), - (Value: ecFoldLevel1; Name:'ecFoldLevel1'), - (Value: ecFoldLevel2; Name:'ecFoldLevel2'), - (Value: ecFoldLevel3; Name:'ecFoldLevel3'), - (Value: ecUnfoldLevel1; Name:'ecUnfoldLevel1'), - (Value: ecUnfoldLevel2; Name:'ecUnfoldLevel2'), - (Value: ecUnfoldLevel3; Name:'ecUnfoldLevel3'), - (Value: ecFoldRegions; Name:'ecFoldRanges'), - (Value: ecUnfoldRegions; Name:'ecUnfoldRanges')); -//-- CodeFolding - -// GetEditorCommandValues and GetEditorCommandExtended for editing key assignments -procedure GetEditorCommandValues(Proc: TGetStrProc); -var - i: integer; -begin - for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - case EditorCommandStrs[I].Value of - ecNone, ecChar, ecString, ecImeStr, ecGotoXY, ecSelGotoXY: - ;// skip commands that cannot be used by the end-user - else - Proc(EditorCommandStrs[I].Name); - end; -end; - -procedure GetEditorCommandExtended(Proc: TGetStrProc); -var - i: integer; -begin - for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - case EditorCommandStrs[I].Value of - ecNone, ecChar, ecString, ecImeStr, ecGotoXY, ecSelGotoXY: - ;// skip commands that cannot be used by the end-user - else - Proc(ConvertCodeStringToExtended(EditorCommandStrs[I].Name)); - end; -end; - -function IdentToEditorCommand(const Ident: string; var Cmd: Integer): boolean; -begin - Result := IdentToInt(Ident, Cmd, EditorCommandStrs); -end; - -function EditorCommandToIdent(Cmd: Integer; var Ident: string): boolean; -begin - Result := IntToIdent(Cmd, Ident, EditorCommandStrs); -end; - -function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; -begin - // Doesn't do anything yet. - Result := ''; -end; - -function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; -begin - if not EditorCommandToIdent(Cmd, Result) then - Result := IntToStr(Cmd); -end; - -{ TSynEditKeyStroke } - -procedure TSynEditKeyStroke.Assign(Source: TPersistent); -begin - if Source is TSynEditKeyStroke then - begin - Command := TSynEditKeyStroke(Source).Command; - Key := TSynEditKeyStroke(Source).Key; - Key2 := TSynEditKeyStroke(Source).Key2; - Shift := TSynEditKeyStroke(Source).Shift; - Shift2 := TSynEditKeyStroke(Source).Shift2; - end else - inherited Assign(Source); -end; - -function TSynEditKeyStroke.GetDisplayName: string; -begin - Result := EditorCommandToCodeString(Command) + ' - ' + ShortCutToText(ShortCut); - if ShortCut2 <> 0 then - Result := Result + ' ' + ShortCutToText(ShortCut2); - if Result = '' then - Result := inherited GetDisplayName; -end; - -function TSynEditKeyStroke.GetShortCut: TShortCut; -begin - Result := Menus.ShortCut(Key, Shift); -end; - -procedure TSynEditKeyStroke.SetCommand(const Value: TSynEditorCommand); -begin - if Value <> FCommand then - FCommand := Value; -end; - -procedure TSynEditKeyStroke.SetKey(const Value: word); -begin - if Value <> FKey then - FKey := Value; -end; - -procedure TSynEditKeyStroke.SetShift(const Value: TShiftState); -begin - if Value <> FShift then - FShift := Value; -end; - -procedure TSynEditKeyStroke.SetShortCut(const Value: TShortCut); -var - NewKey: Word; - NewShift: TShiftState; - Dup: integer; -begin - // Duplicate values of no shortcut are OK. - if Value <> 0 then - begin - // Check for duplicate shortcut in the collection and disallow if there is. - Dup := TSynEditKeyStrokes(Collection).FindShortcut2(Value, ShortCut2); - if (Dup <> -1) and (Dup <> Self.Index) then - begin - raise ESynKeyError.Create(SYNS_EDuplicateShortCut); - end; - end; - - Menus.ShortCutToKey(Value, NewKey, NewShift); - - if (NewKey <> Key) or (NewShift <> Shift) then - begin - Key := NewKey; - Shift := NewShift; - end; -end; - -procedure TSynEditKeyStroke.SetKey2(const Value: word); -begin - if Value <> FKey2 then - FKey2 := Value; -end; - -procedure TSynEditKeyStroke.SetShift2(const Value: TShiftState); -begin - if Value <> FShift2 then - FShift2 := Value; -end; - -procedure TSynEditKeyStroke.SetShortCut2(const Value: TShortCut); -var - NewKey: Word; - NewShift: TShiftState; - Dup: integer; -begin - // Duplicate values of no shortcut are OK. - if Value <> 0 then - begin - // Check for duplicate shortcut in the collection and disallow if there is. - Dup := TSynEditKeyStrokes(Collection).FindShortcut2(ShortCut, Value); - if (Dup <> -1) and (Dup <> Self.Index) then - raise ESynKeyError.Create(SYNS_EDuplicateShortCut); - end; - - Menus.ShortCutToKey(Value, NewKey, NewShift); - if (NewKey <> Key2) or (NewShift <> Shift2) then - begin - Key2 := NewKey; - Shift2 := NewShift; - end; -end; - -function TSynEditKeyStroke.GetShortCut2: TShortCut; -begin - Result := Menus.ShortCut(Key2, Shift2); -end; - -procedure TSynEditKeyStroke.LoadFromStream(AStream: TStream); -begin - with AStream do begin - Read(fKey, SizeOf(fKey)); - Read(fShift, SizeOf(fShift)); - Read(fKey2, SizeOf(fKey2)); - Read(fShift2, SizeOf(fShift2)); - Read(fCommand, SizeOf(fCommand)); - end; -end; - -procedure TSynEditKeyStroke.SaveToStream(AStream: TStream); -begin - with AStream do begin - Write(fKey, SizeOf(fKey)); - Write(fShift, SizeOf(fShift)); - Write(fKey2, SizeOf(fKey2)); - Write(fShift2, SizeOf(fShift2)); - Write(fCommand, SizeOf(fCommand)); - end; -end; - - -{ TSynEditKeyStrokes } - -function TSynEditKeyStrokes.Add: TSynEditKeyStroke; -begin - Result := TSynEditKeyStroke(inherited Add); -end; - -//++ CodeFolding -procedure TSynEditKeyStrokes.AddKey(const ACmd: TSynEditorCommand; const AKey: word; - const AShift: TShiftState; const AKey2: word; const AShift2: TShiftState); -var - NewKeystroke: TSynEditKeyStroke; -begin - NewKeystroke := Add; - try - NewKeystroke.Key := AKey; - NewKeystroke.Shift := AShift; - NewKeystroke.Key2 := AKey2; - NewKeystroke.Shift2 := AShift2; - NewKeystroke.Command := ACmd; - except - NewKeystroke.Free; - raise; - end; -end; -//-- CodeFolding - -procedure TSynEditKeyStrokes.Assign(Source: TPersistent); -var - x: integer; -begin - if Source is TSynEditKeyStrokes then - begin - Clear; - for x := 0 to TSynEditKeyStrokes(Source).Count-1 do - begin - with Add do - Assign(TSynEditKeyStrokes(Source)[x]); - end; - end - else - inherited Assign(Source); -end; - -constructor TSynEditKeyStrokes.Create(AOwner: TPersistent); -begin - inherited Create(TSynEditKeyStroke); - FOwner := AOwner; -end; - -function TSynEditKeyStrokes.FindCommand(Cmd: TSynEditorCommand): integer; -var - x: integer; -begin - Result := -1; - for x := 0 to Count-1 do - if Items[x].Command = Cmd then - begin - Result := x; - break; - end; -end; - -function TSynEditKeyStrokes.FindKeycode(Code: word; SS: TShiftState): integer; -var - x: integer; -begin - Result := -1; - for x := 0 to Count-1 do - if (Items[x].Key = Code) and (Items[x].Shift = SS) and (Items[x].Key2 = 0) - then begin - Result := x; - break; - end; -end; - -function TSynEditKeyStrokes.FindKeycode2(Code1: word; SS1: TShiftState; - Code2: word; SS2: TShiftState): integer; -var - x: integer; -begin - Result := -1; - for x := 0 to Count-1 do - if (Items[x].Key = Code1) and (Items[x].Shift = SS1) and - (Items[x].Key2 = Code2) and (Items[x].Shift2 = SS2) then - begin - Result := x; - break; - end; -end; - -function TSynEditKeyStrokes.FindShortcut(SC: TShortcut): integer; -var - x: integer; -begin - Result := -1; - for x := 0 to Count-1 do - if Items[x].Shortcut = SC then - begin - Result := x; - break; - end; -end; - -function TSynEditKeyStrokes.FindShortcut2(SC, SC2: TShortcut): integer; -var - x: integer; -begin - Result := -1; - for x := 0 to Count-1 do - if (Items[x].Shortcut = SC) and (Items[x].Shortcut2 = SC2) then - begin - Result := x; - break; - end; -end; - -function TSynEditKeyStrokes.GetItem(Index: Integer): TSynEditKeyStroke; -begin - Result := TSynEditKeyStroke(inherited GetItem(Index)); -end; - -function TSynEditKeyStrokes.GetOwner: TPersistent; -begin - Result := FOwner; -end; - -procedure TSynEditKeyStrokes.LoadFromStream(AStream: TStream); -var - Num: integer; -begin - Clear; - AStream.Read(Num, SizeOf(Num)); - while Num > 0 do begin - with Add do - LoadFromStream(AStream); - Dec(Num); - end; -end; - -procedure TSynEditKeyStrokes.ResetDefaults; -begin - Clear; - - AddKey(ecUp, SYNEDIT_UP, []); - AddKey(ecSelUp, SYNEDIT_UP, [ssShift]); - AddKey(ecScrollUp, SYNEDIT_UP, [ssCtrl]); - AddKey(ecDown, SYNEDIT_DOWN, []); - AddKey(ecSelDown, SYNEDIT_DOWN, [ssShift]); - AddKey(ecScrollDown, SYNEDIT_DOWN, [ssCtrl]); - AddKey(ecLeft, SYNEDIT_LEFT, []); - AddKey(ecSelLeft, SYNEDIT_LEFT, [ssShift]); - AddKey(ecWordLeft, SYNEDIT_LEFT, [ssCtrl]); - AddKey(ecSelWordLeft, SYNEDIT_LEFT, [ssShift,ssCtrl]); - AddKey(ecRight, SYNEDIT_RIGHT, []); - AddKey(ecSelRight, SYNEDIT_RIGHT, [ssShift]); - AddKey(ecWordRight, SYNEDIT_RIGHT, [ssCtrl]); - AddKey(ecSelWordRight, SYNEDIT_RIGHT, [ssShift,ssCtrl]); - AddKey(ecPageDown, SYNEDIT_NEXT, []); - AddKey(ecSelPageDown, SYNEDIT_NEXT, [ssShift]); - AddKey(ecPageBottom, SYNEDIT_NEXT, [ssCtrl]); - AddKey(ecSelPageBottom, SYNEDIT_NEXT, [ssShift,ssCtrl]); - AddKey(ecPageUp, SYNEDIT_PRIOR, []); - AddKey(ecSelPageUp, SYNEDIT_PRIOR, [ssShift]); - AddKey(ecPageTop, SYNEDIT_PRIOR, [ssCtrl]); - AddKey(ecSelPageTop, SYNEDIT_PRIOR, [ssShift,ssCtrl]); - AddKey(ecLineStart, SYNEDIT_HOME, []); - AddKey(ecSelLineStart, SYNEDIT_HOME, [ssShift]); - AddKey(ecEditorTop, SYNEDIT_HOME, [ssCtrl]); - AddKey(ecSelEditorTop, SYNEDIT_HOME, [ssShift,ssCtrl]); - AddKey(ecLineEnd, SYNEDIT_END, []); - AddKey(ecSelLineEnd, SYNEDIT_END, [ssShift]); - AddKey(ecEditorBottom, SYNEDIT_END, [ssCtrl]); - AddKey(ecSelEditorBottom, SYNEDIT_END, [ssShift,ssCtrl]); - AddKey(ecToggleMode, SYNEDIT_INSERT, []); - AddKey(ecCopy, SYNEDIT_INSERT, [ssCtrl]); - AddKey(ecCut, SYNEDIT_DELETE, [ssShift]); - AddKey(ecPaste, SYNEDIT_INSERT, [ssShift]); - AddKey(ecDeleteChar, SYNEDIT_DELETE, []); - AddKey(ecDeleteLastChar, SYNEDIT_BACK, []); - AddKey(ecDeleteLastChar, SYNEDIT_BACK, [ssShift]); - AddKey(ecDeleteLastWord, SYNEDIT_BACK, [ssCtrl]); - AddKey(ecUndo, SYNEDIT_BACK, [ssAlt]); - AddKey(ecRedo, SYNEDIT_BACK, [ssAlt,ssShift]); - AddKey(ecLineBreak, SYNEDIT_RETURN, []); - AddKey(ecLineBreak, SYNEDIT_RETURN, [ssShift]); - AddKey(ecTab, SYNEDIT_TAB, []); - AddKey(ecShiftTab, SYNEDIT_TAB, [ssShift]); - AddKey(ecContextHelp, SYNEDIT_F1, []); - - AddKey(ecSelectAll, Ord('A'), [ssCtrl]); - AddKey(ecCopy, Ord('C'), [ssCtrl]); - AddKey(ecPaste, Ord('V'), [ssCtrl]); - AddKey(ecCut, Ord('X'), [ssCtrl]); - AddKey(ecBlockIndent, Ord('I'), [ssCtrl,ssShift]); - AddKey(ecBlockUnindent, Ord('U'), [ssCtrl,ssShift]); - AddKey(ecLineBreak, Ord('M'), [ssCtrl]); - AddKey(ecInsertLine, Ord('N'), [ssCtrl]); - AddKey(ecDeleteWord, Ord('T'), [ssCtrl]); - AddKey(ecDeleteLine, Ord('Y'), [ssCtrl]); - AddKey(ecDeleteEOL, Ord('Y'), [ssCtrl,ssShift]); - AddKey(ecUndo, Ord('Z'), [ssCtrl]); - AddKey(ecRedo, Ord('Z'), [ssCtrl,ssShift]); - AddKey(ecGotoMarker0, Ord('0'), [ssCtrl]); - AddKey(ecGotoMarker1, Ord('1'), [ssCtrl]); - AddKey(ecGotoMarker2, Ord('2'), [ssCtrl]); - AddKey(ecGotoMarker3, Ord('3'), [ssCtrl]); - AddKey(ecGotoMarker4, Ord('4'), [ssCtrl]); - AddKey(ecGotoMarker5, Ord('5'), [ssCtrl]); - AddKey(ecGotoMarker6, Ord('6'), [ssCtrl]); - AddKey(ecGotoMarker7, Ord('7'), [ssCtrl]); - AddKey(ecGotoMarker8, Ord('8'), [ssCtrl]); - AddKey(ecGotoMarker9, Ord('9'), [ssCtrl]); - AddKey(ecSetMarker0, Ord('0'), [ssCtrl,ssShift]); - AddKey(ecSetMarker1, Ord('1'), [ssCtrl,ssShift]); - AddKey(ecSetMarker2, Ord('2'), [ssCtrl,ssShift]); - AddKey(ecSetMarker3, Ord('3'), [ssCtrl,ssShift]); - AddKey(ecSetMarker4, Ord('4'), [ssCtrl,ssShift]); - AddKey(ecSetMarker5, Ord('5'), [ssCtrl,ssShift]); - AddKey(ecSetMarker6, Ord('6'), [ssCtrl,ssShift]); - AddKey(ecSetMarker7, Ord('7'), [ssCtrl,ssShift]); - AddKey(ecSetMarker8, Ord('8'), [ssCtrl,ssShift]); - AddKey(ecSetMarker9, Ord('9'), [ssCtrl,ssShift]); - AddKey(ecNormalSelect, Ord('N'), [ssCtrl,ssShift]); - AddKey(ecColumnSelect, Ord('C'), [ssCtrl,ssShift]); - AddKey(ecLineSelect, Ord('L'), [ssCtrl,ssShift]); - AddKey(ecMatchBracket, Ord('B'), [ssCtrl,ssShift]); - AddKey(ecLowerCase, Ord('K'), [ssCtrl], Ord('L'), [ssCtrl]); - AddKey(ecUpperCase, Ord('K'), [ssCtrl], Ord('U'), [ssCtrl]); - AddKey(ecTitleCase, Ord('K'), [ssCtrl], Ord('T'), [ssCtrl]); - AddKey(ecCopyLineUp, SYNEDIT_UP, [ssShift, ssAlt]); - AddKey(ecCopyLineDown, SYNEDIT_DOWN, [ssShift, ssAlt]); - AddKey(ecMoveLineUp, SYNEDIT_UP, [ssAlt]); - AddKey(ecMoveLineDown, SYNEDIT_DOWN, [ssAlt]); -//++ CodeFolding - AddKey(ecFoldAll, VK_OEM_MINUS, [ssCtrl, ssShift]); {- _} - AddKey(ecUnfoldAll, VK_OEM_PLUS, [ssCtrl, ssShift]); {= +} - AddKey(ecFoldNearest, VK_OEM_2, [ssCtrl]); // Divide {'/'} - AddKey(ecUnfoldNearest, VK_OEM_2, [ssCtrl, ssShift]); - AddKey(ecFoldLevel1, Ord('K'), [ssCtrl], Ord('1'), [ssCtrl]); - AddKey(ecFoldLevel2, Ord('K'), [ssCtrl], Ord('2'), [ssCtrl]); - AddKey(ecFoldLevel3, Ord('K'), [ssCtrl], Ord('3'), [ssCtrl]); - AddKey(ecUnfoldLevel1, Ord('K'), [ssCtrl, ssShift], Ord('1'), [ssCtrl, ssShift]); - AddKey(ecUnfoldLevel2, Ord('K'), [ssCtrl, ssShift], Ord('2'), [ssCtrl, ssShift]); - AddKey(ecUnfoldLevel3, Ord('K'), [ssCtrl, ssShift], Ord('3'), [ssCtrl, ssShift]); -//-- CodeFolding -end; - -procedure TSynEditKeyStrokes.SetItem(Index: Integer; Value: TSynEditKeyStroke); -begin - inherited SetItem(Index, Value); -end; - -procedure TSynEditKeyStrokes.SaveToStream(AStream: TStream); -var - i, Num: integer; -begin - Num := Count; - AStream.Write(Num, SizeOf(Num)); - for i := 0 to Num - 1 do - Items[i].SaveToStream(AStream); -end; - -function ConvertCodeStringToExtended(AString: string): string; -var - i: integer; - WorkStr: string; -begin - if pos('ec', AString) = 1 then - begin - Delete(AString, 1, 2); - WorkStr := ''; - - for i := length(AString) downto 1 do - if CharInSet(AString[i], ['A'..'Z', '0'..'9']) and (i > 1) and - not CharInSet(AString[i - 1], ['A'..'Z', '0'..'9']) then - begin - WorkStr := ' ' + AString[i] + WorkStr - end - else - WorkStr := AString[i] + WorkStr; - - trim(WorkStr); - - i := pos('Sel ', WorkStr); - while i <> 0 do - begin - Delete(WorkStr, i, Length('Sel ')); - Insert('Select ', WorkStr, i); - i := pos('Sel ', WorkStr); - end; - - i := pos('Marker ', WorkStr); - while i <> 0 do - begin - Delete(WorkStr, i, Length('Marker ')); - Insert('Bookmark ', WorkStr,i); - i := pos('Marker ', WorkStr); - end; - - Result := Trim(WorkStr); - end - else - Result := AString; -end; - -function ConvertExtendedToCodeString(AString: string): string; -var - i: Integer; - WorkStr: string; -begin - if pos('ec', AString) = 1 then - begin - result := AString; - exit; - end; - - WorkStr := AString; - - i := pos('Select All', WorkStr); - if i = 0 then - begin - i := pos('Select ', WorkStr); - while i <> 0 do - begin - Delete(WorkStr,i,Length('Select ')); - Insert('Sel ',WorkStr,i); - i := pos('Select ', WorkStr); - end; - end; - - i := pos('Bookmark ', WorkStr); - while i <> 0 do - begin - Delete(WorkStr,i,Length('Bookmark ')); - Insert('Marker ',WorkStr,i); - i := pos('Bookmark ', WorkStr); - end; - - i := pos(' ', WorkStr); - while i <> 0 do - begin - delete(WorkStr,i,1); - i := pos(' ', WorkStr); - end; - - Result := 'ec' + WorkStr; -end; - -function IndexToEditorCommand(const AIndex: Integer): Integer; -begin - Result := EditorCommandStrs[AIndex].Value; -end; - -function ConvertExtendedToCommand(AString: string): TSynEditorCommand; -begin - Result := ConvertCodeStringToCommand(ConvertExtendedToCodeString(AString)); -end; - -function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; -var - I: Integer; -begin - Result := ecNone; - - AString := Uppercase(AString); - for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - if Uppercase(EditorCommandStrs[i].Name) = AString then - begin - Result := EditorCommandStrs[i].Value; - break; - end; -end; - - -initialization - RegisterIntegerConsts(TypeInfo(TSynEditorCommand), IdentToEditorCommand, - EditorCommandToIdent); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. +The Original Code is based on the mwKeyCmds.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Brad Stowers. +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: SynEditKeyCmds.pas,v 1.23.2.4 2008/09/14 16:24:58 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +// TODO: introduce friendly Names for the Commands (EditorCommandStrs is not good enough for end-users) + +{$IFNDEF QSYNEDITKEYCMDS} +unit SynEditKeyCmds; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Menus, + SynUnicode, + Classes, + SysUtils; + +const + //**************************************************************************** + // NOTE! If you add an editor command, you must also update the + // EditorCommandStrs constant array in implementation section below, or the + // command will not show up in the IDE. + //**************************************************************************** + + // "Editor Commands". Key strokes are translated from a table into these + // I used constants instead of a set so that additional commands could be + // added in descendants (you can't extend a set) + + // There are two ranges of editor commands: the ecViewXXX commands are always + // valid, while the ecEditXXX commands are ignored when the editor is in + // read-only mode + + ecNone = 0; // Nothing. Useful for user event to handle command + ecViewCommandFirst = 0; + ecViewCommandLast = 500; + ecEditCommandFirst = 501; + ecEditCommandLast = 1000; + + ecLeft = 1; // Move cursor left one char + ecRight = 2; // Move cursor right one char + ecUp = 3; // Move cursor up one line + ecDown = 4; // Move cursor down one line + ecWordLeft = 5; // Move cursor left one Word + ecWordRight = 6; // Move cursor right one Word + ecLineStart = 7; // Move cursor to beginning of line + ecLineEnd = 8; // Move cursor to end of line + ecPageUp = 9; // Move cursor up one page + ecPageDown = 10; // Move cursor down one page + ecPageLeft = 11; // Move cursor right one page + ecPageRight = 12; // Move cursor left one page + ecPageTop = 13; // Move cursor to top of page + ecPageBottom = 14; // Move cursor to bottom of page + ecEditorTop = 15; // Move cursor to absolute beginning + ecEditorBottom = 16; // Move cursor to absolute end + ecGotoXY = 17; // Move cursor to specific coordinates, Data = PPoint + +//****************************************************************************** +// Maybe the command processor should just take a Boolean that signifies if +// selection is affected or not? +//****************************************************************************** + + ecSelection = 100; // Add this to ecXXX command to get equivalent + // command, but with selection enabled. This is not + // a command itself. + // Same as commands above, except they affect selection, too + ecSelLeft = ecLeft + ecSelection; + ecSelRight = ecRight + ecSelection; + ecSelUp = ecUp + ecSelection; + ecSelDown = ecDown + ecSelection; + ecSelWordLeft = ecWordLeft + ecSelection; + ecSelWordRight = ecWordRight + ecSelection; + ecSelLineStart = ecLineStart + ecSelection; + ecSelLineEnd = ecLineEnd + ecSelection; + ecSelPageUp = ecPageUp + ecSelection; + ecSelPageDown = ecPageDown + ecSelection; + ecSelPageLeft = ecPageLeft + ecSelection; + ecSelPageRight = ecPageRight + ecSelection; + ecSelPageTop = ecPageTop + ecSelection; + ecSelPageBottom = ecPageBottom + ecSelection; + ecSelEditorTop = ecEditorTop + ecSelection; + ecSelEditorBottom = ecEditorBottom + ecSelection; + ecSelGotoXY = ecGotoXY + ecSelection; // Data = PPoint + + ecSelWord = 198; + ecSelectAll = 199; // Select entire contents of editor, cursor to end + + ecCopy = 201; // Copy selection to clipboard + + ecScrollUp = 211; // Scroll up one line leaving cursor position unchanged. + ecScrollDown = 212; // Scroll down one line leaving cursor position unchanged. + ecScrollLeft = 213; // Scroll left one char leaving cursor position unchanged. + ecScrollRight = 214; // Scroll right one char leaving cursor position unchanged. + + ecInsertMode = 221; // Set insert mode + ecOverwriteMode = 222; // Set overwrite mode + ecToggleMode = 223; // Toggle ins/ovr mode + + ecNormalSelect = 231; // Normal selection mode + ecColumnSelect = 232; // Column selection mode + ecLineSelect = 233; // Line selection mode + + ecMatchBracket = 250; // Go to matching bracket + ecCommentBlock = 251; // Comment Block + + ecGotoMarker0 = 301; // Goto marker + ecGotoMarker1 = 302; // Goto marker + ecGotoMarker2 = 303; // Goto marker + ecGotoMarker3 = 304; // Goto marker + ecGotoMarker4 = 305; // Goto marker + ecGotoMarker5 = 306; // Goto marker + ecGotoMarker6 = 307; // Goto marker + ecGotoMarker7 = 308; // Goto marker + ecGotoMarker8 = 309; // Goto marker + ecGotoMarker9 = 310; // Goto marker + ecSetMarker0 = 351; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker1 = 352; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker2 = 353; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker3 = 354; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker4 = 355; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker5 = 356; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker6 = 357; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker7 = 358; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker8 = 359; // Set marker, Data = PPoint - X, Y Pos + ecSetMarker9 = 360; // Set marker, Data = PPoint - X, Y Pos + + ecGotFocus = 480; + ecLostFocus = 481; + + ecContextHelp = 490; // Help on Word, Data = Word + + ecDeleteLastChar = 501; // Delete last char (i.e. backspace key) + ecDeleteChar = 502; // Delete char at cursor (i.e. delete key) + ecDeleteWord = 503; // Delete from cursor to end of Word + ecDeleteLastWord = 504; // Delete from cursor to start of Word + ecDeleteBOL = 505; // Delete from cursor to beginning of line + ecDeleteEOL = 506; // Delete from cursor to end of line + ecDeleteLine = 507; // Delete current line + ecClearAll = 508; // Delete everything + ecLineBreak = 509; // Break line at current position, move caret to new line + ecInsertLine = 510; // Break line at current position, leave caret + ecChar = 511; // Insert a character at current position + + ecImeStr = 550; // Insert character(s) from IME + + ecUndo = 601; // Perform undo if available + ecRedo = 602; // Perform redo if available + ecCut = 603; // Cut selection to clipboard + ecPaste = 604; // Paste clipboard to current position + + ecBlockIndent = 610; // Indent selection + ecBlockUnindent = 611; // Unindent selection + ecTab = 612; // Tab key + ecShiftTab = 613; // Shift+Tab key + + ecAutoCompletion = 650; + + ecUpperCase = 620; // apply to the current or previous Word + ecLowerCase = 621; + ecToggleCase = 622; + ecTitleCase = 623; + ecUpperCaseBlock = 625; // apply to current selection, or current char if no selection + ecLowerCaseBlock = 626; + ecToggleCaseBlock = 627; + ecTitleCaseBlock = 628; + + ecString = 630; //Insert a whole string + + {$IFDEF SYN_CodeFolding} + ecFoldAll = 701; + ecUnfoldAll = 702; + ecFoldNearest = 705; + ecUnfoldNearest = 706; + ecFoldLevel1 = 711; + ecFoldLevel2 = 712; + ecFoldLevel3 = 713; + ecUnfoldLevel1 = 721; + ecUnfoldLevel2 = 722; + ecUnfoldLevel3 = 723; + ecFoldRegions = 731; + ecUnfoldRegions = 732; + {$ENDIF} + + ecUserFirst = 1001; // Start of user-defined commands + +type + ESynKeyError = class(Exception); + + TSynEditorCommand = type Word; + + TSynEditKeyStroke = class(TCollectionItem) + private + FKey: Word; // Virtual keycode, i.e. VK_xxx + FShift: TShiftState; + FKey2: Word; + FShift2: TShiftState; + FCommand: TSynEditorCommand; + function GetShortCut: TShortCut; + function GetShortCut2: TShortCut; + procedure SetCommand(const Value: TSynEditorCommand); + procedure SetKey(const Value: Word); + procedure SetKey2(const Value: Word); + procedure SetShift(const Value: TShiftState); + procedure SetShift2(const Value: TShiftState); + procedure SetShortCut(const Value: TShortCut); + procedure SetShortCut2(const Value: TShortCut); + protected +{$IFDEF SYN_COMPILER_3_UP} + function GetDisplayName: string; override; +{$ENDIF} + public + procedure Assign(Source: TPersistent); override; + procedure LoadFromStream(AStream: TStream); + procedure SaveToStream(AStream: TStream); + // No duplicate checking is done if assignment made via these properties! + property Key: Word read FKey write SetKey; + property Key2: Word read FKey2 write SetKey2; + property Shift: TShiftState read FShift write SetShift; + property Shift2: TShiftState read FShift2 write SetShift2; + published + property Command: TSynEditorCommand read FCommand write SetCommand; + property ShortCut: TShortCut read GetShortCut write SetShortCut + default 0; + property ShortCut2: TShortCut read GetShortCut2 write SetShortCut2 + default 0; + end; + + TSynEditKeyStrokes = class(TCollection) + private + FOwner: TPersistent; + function GetItem(Index: Integer): TSynEditKeyStroke; + procedure SetItem(Index: Integer; Value: TSynEditKeyStroke); + protected +{$IFDEF SYN_COMPILER_3_UP} + function GetOwner: TPersistent; override; +{$ENDIF} + public + constructor Create(AOwner: TPersistent); + function Add: TSynEditKeyStroke; + procedure AddKey(const ACmd: TSynEditorCommand; const AKey: word; + const AShift: TShiftState; const AKey2: word = 0; + const AShift2: TShiftState = []); + procedure Assign(Source: TPersistent); override; + function FindCommand(Cmd: TSynEditorCommand): Integer; + function FindKeycode(Code: Word; SS: TShiftState): Integer; + function FindKeycode2(Code1: Word; SS1: TShiftState; + Code2: Word; SS2: TShiftState): Integer; + function FindShortcut(SC: TShortcut): Integer; + function FindShortcut2(SC, SC2: TShortcut): Integer; + procedure LoadFromStream(AStream: TStream); + procedure ResetDefaults; + procedure SaveToStream(AStream: TStream); + public + property Items[Index: Integer]: TSynEditKeyStroke read GetItem + write SetItem; default; + end; + +// These are mainly for the TSynEditorCommand property editor, but could be +// useful elsewhere. +function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; +function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; +procedure GetEditorCommandValues(Proc: TGetStrProc); +procedure GetEditorCommandExtended(Proc: TGetStrProc); +function IdentToEditorCommand(const Ident: string; var Cmd: longint): Boolean; +function EditorCommandToIdent(Cmd: longint; var Ident: string): Boolean; +function ConvertCodeStringToExtended(AString: string): string; +function ConvertExtendedToCodeString(AString: string): string; +function ConvertExtendedToCommand(AString: string): TSynEditorCommand; +function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; +function IndexToEditorCommand(const AIndex: Integer): Integer; + +implementation + +uses + Windows, + SynEditKeyConst, + SynEditStrConst; + +{ Command mapping routines } + +{$IFDEF SYN_COMPILER_2} +// This is defined in D3/C3 and up. +type + TIdentMapEntry = record + Value: TSynEditorCommand; + Name: string; + end; +{$ENDIF} + +const +{$IFDEF SYN_CodeFolding} + EditorCommandStrs: array[0..113] of TIdentMapEntry = ( +{$ELSE} + EditorCommandStrs: array[0..101] of TIdentMapEntry = ( +{$ENDIF} + (Value: ecNone; Name: 'ecNone'), + (Value: ecLeft; Name: 'ecLeft'), + (Value: ecRight; Name: 'ecRight'), + (Value: ecUp; Name: 'ecUp'), + (Value: ecDown; Name: 'ecDown'), + (Value: ecWordLeft; Name: 'ecWordLeft'), + (Value: ecWordRight; Name: 'ecWordRight'), + (Value: ecLineStart; Name: 'ecLineStart'), + (Value: ecLineEnd; Name: 'ecLineEnd'), + (Value: ecPageUp; Name: 'ecPageUp'), + (Value: ecPageDown; Name: 'ecPageDown'), + (Value: ecPageLeft; Name: 'ecPageLeft'), + (Value: ecPageRight; Name: 'ecPageRight'), + (Value: ecPageTop; Name: 'ecPageTop'), + (Value: ecPageBottom; Name: 'ecPageBottom'), + (Value: ecEditorTop; Name: 'ecEditorTop'), + (Value: ecEditorBottom; Name: 'ecEditorBottom'), + (Value: ecGotoXY; Name: 'ecGotoXY'), + (Value: ecSelLeft; Name: 'ecSelLeft'), + (Value: ecSelRight; Name: 'ecSelRight'), + (Value: ecSelUp; Name: 'ecSelUp'), + (Value: ecSelDown; Name: 'ecSelDown'), + (Value: ecSelWordLeft; Name: 'ecSelWordLeft'), + (Value: ecSelWordRight; Name: 'ecSelWordRight'), + (Value: ecSelLineStart; Name: 'ecSelLineStart'), + (Value: ecSelLineEnd; Name: 'ecSelLineEnd'), + (Value: ecSelPageUp; Name: 'ecSelPageUp'), + (Value: ecSelPageDown; Name: 'ecSelPageDown'), + (Value: ecSelPageLeft; Name: 'ecSelPageLeft'), + (Value: ecSelPageRight; Name: 'ecSelPageRight'), + (Value: ecSelPageTop; Name: 'ecSelPageTop'), + (Value: ecSelPageBottom; Name: 'ecSelPageBottom'), + (Value: ecSelEditorTop; Name: 'ecSelEditorTop'), + (Value: ecSelEditorBottom; Name: 'ecSelEditorBottom'), + (Value: ecSelGotoXY; Name: 'ecSelGotoXY'), + (Value: ecSelWord; Name: 'ecSelWord'), + (Value: ecSelectAll; Name: 'ecSelectAll'), + (Value: ecDeleteLastChar; Name: 'ecDeleteLastChar'), + (Value: ecDeleteChar; Name: 'ecDeleteChar'), + (Value: ecDeleteWord; Name: 'ecDeleteWord'), + (Value: ecDeleteLastWord; Name: 'ecDeleteLastWord'), + (Value: ecDeleteBOL; Name: 'ecDeleteBOL'), + (Value: ecDeleteEOL; Name: 'ecDeleteEOL'), + (Value: ecDeleteLine; Name: 'ecDeleteLine'), + (Value: ecClearAll; Name: 'ecClearAll'), + (Value: ecLineBreak; Name: 'ecLineBreak'), + (Value: ecInsertLine; Name: 'ecInsertLine'), + (Value: ecChar; Name: 'ecChar'), + (Value: ecImeStr; Name: 'ecImeStr'), + (Value: ecUndo; Name: 'ecUndo'), + (Value: ecRedo; Name: 'ecRedo'), + (Value: ecCut; Name: 'ecCut'), + (Value: ecCopy; Name: 'ecCopy'), + (Value: ecPaste; Name: 'ecPaste'), + (Value: ecScrollUp; Name: 'ecScrollUp'), + (Value: ecScrollDown; Name: 'ecScrollDown'), + (Value: ecScrollLeft; Name: 'ecScrollLeft'), + (Value: ecScrollRight; Name: 'ecScrollRight'), + (Value: ecInsertMode; Name: 'ecInsertMode'), + (Value: ecOverwriteMode; Name: 'ecOverwriteMode'), + (Value: ecToggleMode; Name: 'ecToggleMode'), + (Value: ecBlockIndent; Name: 'ecBlockIndent'), + (Value: ecBlockUnindent; Name: 'ecBlockUnindent'), + (Value: ecTab; Name: 'ecTab'), + (Value: ecShiftTab; Name: 'ecShiftTab'), + (Value: ecMatchBracket; Name: 'ecMatchBracket'), + (Value: ecCommentBlock; Name: 'ecCommentBlock'), + (Value: ecNormalSelect; Name: 'ecNormalSelect'), + (Value: ecColumnSelect; Name: 'ecColumnSelect'), + (Value: ecLineSelect; Name: 'ecLineSelect'), + (Value: ecAutoCompletion; Name: 'ecAutoCompletion'), + (Value: ecUserFirst; Name: 'ecUserFirst'), + (Value: ecContextHelp; Name: 'ecContextHelp'), + (Value: ecGotoMarker0; Name: 'ecGotoMarker0'), + (Value: ecGotoMarker1; Name: 'ecGotoMarker1'), + (Value: ecGotoMarker2; Name: 'ecGotoMarker2'), + (Value: ecGotoMarker3; Name: 'ecGotoMarker3'), + (Value: ecGotoMarker4; Name: 'ecGotoMarker4'), + (Value: ecGotoMarker5; Name: 'ecGotoMarker5'), + (Value: ecGotoMarker6; Name: 'ecGotoMarker6'), + (Value: ecGotoMarker7; Name: 'ecGotoMarker7'), + (Value: ecGotoMarker8; Name: 'ecGotoMarker8'), + (Value: ecGotoMarker9; Name: 'ecGotoMarker9'), + (Value: ecSetMarker0; Name: 'ecSetMarker0'), + (Value: ecSetMarker1; Name: 'ecSetMarker1'), + (Value: ecSetMarker2; Name: 'ecSetMarker2'), + (Value: ecSetMarker3; Name: 'ecSetMarker3'), + (Value: ecSetMarker4; Name: 'ecSetMarker4'), + (Value: ecSetMarker5; Name: 'ecSetMarker5'), + (Value: ecSetMarker6; Name: 'ecSetMarker6'), + (Value: ecSetMarker7; Name: 'ecSetMarker7'), + (Value: ecSetMarker8; Name: 'ecSetMarker8'), + (Value: ecSetMarker9; Name: 'ecSetMarker9'), + (Value: ecUpperCase; Name: 'ecUpperCase'), + (Value: ecLowerCase; Name: 'ecLowerCase'), + (Value: ecToggleCase; Name: 'ecToggleCase'), + (Value: ecTitleCase; Name: 'ecTitleCase'), + (Value: ecUpperCaseBlock; Name: 'ecUpperCaseBlock'), + (Value: ecLowerCaseBlock; Name: 'ecLowerCaseBlock'), + (Value: ecToggleCaseBlock; Name: 'ecToggleCaseBlock'), + (Value: ecTitleCaseBlock; Name: 'ecTitleCaseBlock'), +{$IFDEF SYN_CodeFolding} + (Value: ecString; Name:'ecString'), + (Value: ecFoldAll; Name:'ecFoldAll'), + (Value: ecUnfoldAll; Name:'ecUnfoldAll'), + (Value: ecFoldNearest; Name:'ecFoldNearest'), + (Value: ecUnfoldNearest; Name:'ecUnfoldNearest'), + (Value: ecFoldLevel1; Name:'ecFoldLevel1'), + (Value: ecFoldLevel2; Name:'ecFoldLevel2'), + (Value: ecFoldLevel3; Name:'ecFoldLevel3'), + (Value: ecUnfoldLevel1; Name:'ecUnfoldLevel1'), + (Value: ecUnfoldLevel2; Name:'ecUnfoldLevel2'), + (Value: ecUnfoldLevel3; Name:'ecUnfoldLevel3'), + (Value: ecFoldRegions; Name:'ecFoldRanges'), + (Value: ecUnfoldRegions; Name:'ecUnfoldRanges')); +{$ELSE} + (Value: ecString; Name:'ecString')); +{$ENDIF} + +procedure GetEditorCommandValues(Proc: TGetStrProc); +var + i: Integer; +begin + for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do + Proc(EditorCommandStrs[I].Name); +end; + +procedure GetEditorCommandExtended(Proc: TGetStrProc); +var + i: Integer; +begin + for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do + Proc(ConvertCodeStringToExtended(EditorCommandStrs[I].Name)); +end; + +function IdentToEditorCommand(const Ident: string; var Cmd: longint): Boolean; +{$IFDEF SYN_COMPILER_2} +var + I: Integer; +{$ENDIF} +begin +{$IFDEF SYN_COMPILER_2} + Result := FALSE; + for I := Low(EditorCommandStrs) to High(EditorCommandStrs) do + if CompareText(EditorCommandStrs[I].Name, Ident) = 0 then + begin + Result := TRUE; + Cmd := EditorCommandStrs[I].Value; + Break; + end; +{$ELSE} + Result := IdentToInt(Ident, Cmd, EditorCommandStrs); +{$ENDIF} +end; + +function EditorCommandToIdent(Cmd: longint; var Ident: string): Boolean; +{$IFDEF SYN_COMPILER_2} +var + I: Integer; +{$ENDIF} +begin +{$IFDEF SYN_COMPILER_2} + Result := FALSE; + for I := Low(EditorCommandStrs) to High(EditorCommandStrs) do + if EditorCommandStrs[I].Value = Cmd then + begin + Result := TRUE; + Ident := EditorCommandStrs[I].Name; + Break; + end; +{$ELSE} + Result := IntToIdent(Cmd, Ident, EditorCommandStrs); +{$ENDIF} +end; + +function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; +begin + // Doesn't do anything yet. + Result := ''; +end; + +function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; +begin + if not EditorCommandToIdent(Cmd, Result) then + Result := IntToStr(Cmd); +end; + +{ TSynEditKeyStroke } + +procedure TSynEditKeyStroke.Assign(Source: TPersistent); +begin + if Source is TSynEditKeyStroke then + begin + Command := TSynEditKeyStroke(Source).Command; + Key := TSynEditKeyStroke(Source).Key; + Key2 := TSynEditKeyStroke(Source).Key2; + Shift := TSynEditKeyStroke(Source).Shift; + Shift2 := TSynEditKeyStroke(Source).Shift2; + end else + inherited Assign(Source); +end; + +{$IFDEF SYN_COMPILER_3_UP} +function TSynEditKeyStroke.GetDisplayName: string; +begin + Result := EditorCommandToCodeString(Command) + ' - ' + ShortCutToText(ShortCut); + if ShortCut <> 0 then + Result := Result + ' ' + ShortCutToText(ShortCut2); + if Result = '' then + Result := inherited GetDisplayName; +end; +{$ENDIF} + +function TSynEditKeyStroke.GetShortCut: TShortCut; +begin + Result := Menus.ShortCut(Key, Shift); +end; + +procedure TSynEditKeyStroke.SetCommand(const Value: TSynEditorCommand); +begin + if Value <> FCommand then + FCommand := Value; +end; + +procedure TSynEditKeyStroke.SetKey(const Value: Word); +begin + if Value <> FKey then + FKey := Value; +end; + +procedure TSynEditKeyStroke.SetShift(const Value: TShiftState); +begin + if Value <> FShift then + FShift := Value; +end; + +procedure TSynEditKeyStroke.SetShortCut(const Value: TShortCut); +var + NewKey: Word; + NewShift: TShiftState; + Dup: Integer; +begin + // Duplicate values of no shortcut are OK. + if Value <> 0 then + begin + // Check for duplicate shortcut in the collection and disallow if there is. + Dup := TSynEditKeyStrokes(Collection).FindShortcut2(Value, ShortCut2); + if (Dup <> -1) and (Dup <> Self.Index) then + begin + raise ESynKeyError.Create(SYNS_EDuplicateShortCut); + end; + end; + + Menus.ShortCutToKey(Value, NewKey, NewShift); + + if (NewKey <> Key) or (NewShift <> Shift) then + begin + Key := NewKey; + Shift := NewShift; + end; +end; + +procedure TSynEditKeyStroke.SetKey2(const Value: Word); +begin + if Value <> FKey2 then + FKey2 := Value; +end; + +procedure TSynEditKeyStroke.SetShift2(const Value: TShiftState); +begin + if Value <> FShift2 then + FShift2 := Value; +end; + +procedure TSynEditKeyStroke.SetShortCut2(const Value: TShortCut); +var + NewKey: Word; + NewShift: TShiftState; + Dup: Integer; +begin + // Duplicate values of no shortcut are OK. + if Value <> 0 then + begin + // Check for duplicate shortcut in the collection and disallow if there is. + Dup := TSynEditKeyStrokes(Collection).FindShortcut2(ShortCut, Value); + if (Dup <> -1) and (Dup <> Self.Index) then + raise ESynKeyError.Create(SYNS_EDuplicateShortCut); + end; + + Menus.ShortCutToKey(Value, NewKey, NewShift); + if (NewKey <> Key2) or (NewShift <> Shift2) then + begin + Key2 := NewKey; + Shift2 := NewShift; + end; +end; + +function TSynEditKeyStroke.GetShortCut2: TShortCut; +begin + Result := Menus.ShortCut(Key2, Shift2); +end; + +procedure TSynEditKeyStroke.LoadFromStream(AStream: TStream); +begin + with AStream do begin + Read(fKey, SizeOf(fKey)); + Read(fShift, SizeOf(fShift)); + Read(fKey2, SizeOf(fKey2)); + Read(fShift2, SizeOf(fShift2)); + Read(fCommand, SizeOf(fCommand)); + end; +end; + +procedure TSynEditKeyStroke.SaveToStream(AStream: TStream); +begin + with AStream do begin + Write(fKey, SizeOf(fKey)); + Write(fShift, SizeOf(fShift)); + Write(fKey2, SizeOf(fKey2)); + Write(fShift2, SizeOf(fShift2)); + Write(fCommand, SizeOf(fCommand)); + end; +end; + + +{ TSynEditKeyStrokes } + +function TSynEditKeyStrokes.Add: TSynEditKeyStroke; +begin + Result := TSynEditKeyStroke(inherited Add); +end; + +procedure TSynEditKeyStrokes.AddKey(const ACmd: TSynEditorCommand; const AKey: word; + const AShift: TShiftState; const AKey2: word; const AShift2: TShiftState); +var + NewKeystroke: TSynEditKeyStroke; +begin + NewKeystroke := Add; + try + NewKeystroke.Key := AKey; + NewKeystroke.Shift := AShift; + NewKeystroke.Key2 := AKey2; + NewKeystroke.Shift2 := AShift2; + NewKeystroke.Command := ACmd; + except + NewKeystroke.Free; + raise; + end; +end; + +procedure TSynEditKeyStrokes.Assign(Source: TPersistent); +var + x: Integer; +begin + if Source is TSynEditKeyStrokes then + begin + Clear; + for x := 0 to TSynEditKeyStrokes(Source).Count-1 do + begin + with Add do + Assign(TSynEditKeyStrokes(Source)[x]); + end; + end + else + inherited Assign(Source); +end; + +constructor TSynEditKeyStrokes.Create(AOwner: TPersistent); +begin + inherited Create(TSynEditKeyStroke); + FOwner := AOwner; +end; + +function TSynEditKeyStrokes.FindCommand(Cmd: TSynEditorCommand): Integer; +var + x: Integer; +begin + Result := -1; + for x := 0 to Count-1 do + if Items[x].Command = Cmd then + begin + Result := x; + Break; + end; +end; + +function TSynEditKeyStrokes.FindKeycode(Code: Word; SS: TShiftState): Integer; +var + x: Integer; +begin + Result := -1; + for x := 0 to Count-1 do + if (Items[x].Key = Code) and (Items[x].Shift = SS) and (Items[x].Key2 = 0) + then begin + Result := x; + Break; + end; +end; + +function TSynEditKeyStrokes.FindKeycode2(Code1: Word; SS1: TShiftState; + Code2: Word; SS2: TShiftState): Integer; +var + x: Integer; +begin + Result := -1; + for x := 0 to Count-1 do + if (Items[x].Key = Code1) and (Items[x].Shift = SS1) and + (Items[x].Key2 = Code2) and (Items[x].Shift2 = SS2) then + begin + Result := x; + Break; + end; +end; + +function TSynEditKeyStrokes.FindShortcut(SC: TShortcut): Integer; +var + x: Integer; +begin + Result := -1; + for x := 0 to Count-1 do + if Items[x].Shortcut = SC then + begin + Result := x; + Break; + end; +end; + +function TSynEditKeyStrokes.FindShortcut2(SC, SC2: TShortcut): Integer; +var + x: Integer; +begin + Result := -1; + for x := 0 to Count-1 do + if (Items[x].Shortcut = SC) and (Items[x].Shortcut2 = SC2) then + begin + Result := x; + Break; + end; +end; + +function TSynEditKeyStrokes.GetItem(Index: Integer): TSynEditKeyStroke; +begin + Result := TSynEditKeyStroke(inherited GetItem(Index)); +end; + +{$IFDEF SYN_COMPILER_3_UP} +function TSynEditKeyStrokes.GetOwner: TPersistent; +begin + Result := FOwner; +end; +{$ENDIF} + +procedure TSynEditKeyStrokes.LoadFromStream(AStream: TStream); +var + Num: Integer; +begin + Clear; + AStream.Read(Num, SizeOf(Num)); + while Num > 0 do begin + with Add do + LoadFromStream(AStream); + Dec(Num); + end; +end; + +procedure TSynEditKeyStrokes.ResetDefaults; +begin + Clear; + + AddKey(ecUp, SYNEDIT_UP, []); + AddKey(ecSelUp, SYNEDIT_UP, [ssShift]); + AddKey(ecScrollUp, SYNEDIT_UP, [ssCtrl]); + AddKey(ecDown, SYNEDIT_DOWN, []); + AddKey(ecSelDown, SYNEDIT_DOWN, [ssShift]); + AddKey(ecScrollDown, SYNEDIT_DOWN, [ssCtrl]); + AddKey(ecLeft, SYNEDIT_LEFT, []); + AddKey(ecSelLeft, SYNEDIT_LEFT, [ssShift]); + AddKey(ecWordLeft, SYNEDIT_LEFT, [ssCtrl]); + AddKey(ecSelWordLeft, SYNEDIT_LEFT, [ssShift,ssCtrl]); + AddKey(ecRight, SYNEDIT_RIGHT, []); + AddKey(ecSelRight, SYNEDIT_RIGHT, [ssShift]); + AddKey(ecWordRight, SYNEDIT_RIGHT, [ssCtrl]); + AddKey(ecSelWordRight, SYNEDIT_RIGHT, [ssShift,ssCtrl]); + AddKey(ecPageDown, SYNEDIT_NEXT, []); + AddKey(ecSelPageDown, SYNEDIT_NEXT, [ssShift]); + AddKey(ecPageBottom, SYNEDIT_NEXT, [ssCtrl]); + AddKey(ecSelPageBottom, SYNEDIT_NEXT, [ssShift,ssCtrl]); + AddKey(ecPageUp, SYNEDIT_PRIOR, []); + AddKey(ecSelPageUp, SYNEDIT_PRIOR, [ssShift]); + AddKey(ecPageTop, SYNEDIT_PRIOR, [ssCtrl]); + AddKey(ecSelPageTop, SYNEDIT_PRIOR, [ssShift,ssCtrl]); + AddKey(ecLineStart, SYNEDIT_HOME, []); + AddKey(ecSelLineStart, SYNEDIT_HOME, [ssShift]); + AddKey(ecEditorTop, SYNEDIT_HOME, [ssCtrl]); + AddKey(ecSelEditorTop, SYNEDIT_HOME, [ssShift,ssCtrl]); + AddKey(ecLineEnd, SYNEDIT_END, []); + AddKey(ecSelLineEnd, SYNEDIT_END, [ssShift]); + AddKey(ecEditorBottom, SYNEDIT_END, [ssCtrl]); + AddKey(ecSelEditorBottom, SYNEDIT_END, [ssShift,ssCtrl]); + AddKey(ecToggleMode, SYNEDIT_INSERT, []); + AddKey(ecCopy, SYNEDIT_INSERT, [ssCtrl]); + AddKey(ecCut, SYNEDIT_DELETE, [ssShift]); + AddKey(ecPaste, SYNEDIT_INSERT, [ssShift]); + AddKey(ecDeleteChar, SYNEDIT_DELETE, []); + AddKey(ecDeleteLastChar, SYNEDIT_BACK, []); + AddKey(ecDeleteLastChar, SYNEDIT_BACK, [ssShift]); + AddKey(ecDeleteLastWord, SYNEDIT_BACK, [ssCtrl]); + AddKey(ecUndo, SYNEDIT_BACK, [ssAlt]); + AddKey(ecRedo, SYNEDIT_BACK, [ssAlt,ssShift]); + AddKey(ecLineBreak, SYNEDIT_RETURN, []); + AddKey(ecLineBreak, SYNEDIT_RETURN, [ssShift]); + AddKey(ecTab, SYNEDIT_TAB, []); + AddKey(ecShiftTab, SYNEDIT_TAB, [ssShift]); + AddKey(ecContextHelp, SYNEDIT_F1, []); + + AddKey(ecSelectAll, ord('A'), [ssCtrl]); + AddKey(ecCopy, ord('C'), [ssCtrl]); + AddKey(ecPaste, ord('V'), [ssCtrl]); + AddKey(ecCut, ord('X'), [ssCtrl]); + AddKey(ecBlockIndent, ord('I'), [ssCtrl,ssShift]); + AddKey(ecBlockUnindent, ord('U'), [ssCtrl,ssShift]); + AddKey(ecLineBreak, ord('M'), [ssCtrl]); + AddKey(ecInsertLine, ord('N'), [ssCtrl]); + AddKey(ecDeleteWord, ord('T'), [ssCtrl]); + AddKey(ecDeleteLine, ord('Y'), [ssCtrl]); + AddKey(ecDeleteEOL, ord('Y'), [ssCtrl,ssShift]); + AddKey(ecUndo, ord('Z'), [ssCtrl]); + AddKey(ecRedo, ord('Z'), [ssCtrl,ssShift]); + AddKey(ecGotoMarker0, ord('0'), [ssCtrl]); + AddKey(ecGotoMarker1, ord('1'), [ssCtrl]); + AddKey(ecGotoMarker2, ord('2'), [ssCtrl]); + AddKey(ecGotoMarker3, ord('3'), [ssCtrl]); + AddKey(ecGotoMarker4, ord('4'), [ssCtrl]); + AddKey(ecGotoMarker5, ord('5'), [ssCtrl]); + AddKey(ecGotoMarker6, ord('6'), [ssCtrl]); + AddKey(ecGotoMarker7, ord('7'), [ssCtrl]); + AddKey(ecGotoMarker8, ord('8'), [ssCtrl]); + AddKey(ecGotoMarker9, ord('9'), [ssCtrl]); + AddKey(ecSetMarker0, ord('0'), [ssCtrl,ssShift]); + AddKey(ecSetMarker1, ord('1'), [ssCtrl,ssShift]); + AddKey(ecSetMarker2, ord('2'), [ssCtrl,ssShift]); + AddKey(ecSetMarker3, ord('3'), [ssCtrl,ssShift]); + AddKey(ecSetMarker4, ord('4'), [ssCtrl,ssShift]); + AddKey(ecSetMarker5, ord('5'), [ssCtrl,ssShift]); + AddKey(ecSetMarker6, ord('6'), [ssCtrl,ssShift]); + AddKey(ecSetMarker7, ord('7'), [ssCtrl,ssShift]); + AddKey(ecSetMarker8, ord('8'), [ssCtrl,ssShift]); + AddKey(ecSetMarker9, ord('9'), [ssCtrl,ssShift]); + AddKey(ecNormalSelect, ord('N'), [ssCtrl,ssShift]); + AddKey(ecColumnSelect, ord('C'), [ssCtrl,ssShift]); + AddKey(ecLineSelect, ord('L'), [ssCtrl,ssShift]); + AddKey(ecMatchBracket, ord('B'), [ssCtrl,ssShift]); +{$IFDEF SYN_CodeFolding} + AddKey(ecFoldAll, VK_OEM_MINUS, [ssCtrl, ssShift]); {- _} + AddKey(ecUnfoldAll, VK_OEM_PLUS, [ssCtrl, ssShift]); {= +} + AddKey(ecFoldNearest, VK_OEM_2, [ssCtrl]); // Divide {'/'} + AddKey(ecUnfoldNearest, VK_OEM_2, [ssCtrl, ssShift]); + AddKey(ecFoldLevel1, ord('K'), [ssCtrl], Ord('1'), [ssCtrl]); + AddKey(ecFoldLevel2, ord('K'), [ssCtrl], Ord('2'), [ssCtrl]); + AddKey(ecFoldLevel3, ord('K'), [ssCtrl], Ord('3'), [ssCtrl]); + AddKey(ecUnfoldLevel1, ord('K'), [ssCtrl, ssShift], Ord('1'), [ssCtrl, ssShift]); + AddKey(ecUnfoldLevel2, ord('K'), [ssCtrl, ssShift], Ord('2'), [ssCtrl, ssShift]); + AddKey(ecUnfoldLevel3, ord('K'), [ssCtrl, ssShift], Ord('3'), [ssCtrl, ssShift]); +{$ENDIF} +end; + +procedure TSynEditKeyStrokes.SetItem(Index: Integer; Value: TSynEditKeyStroke); +begin + inherited SetItem(Index, Value); +end; + +procedure TSynEditKeyStrokes.SaveToStream(AStream: TStream); +var + i, Num: Integer; +begin + Num := Count; + AStream.Write(Num, SizeOf(Num)); + for i := 0 to Num - 1 do + Items[i].SaveToStream(AStream); +end; + +function ConvertCodeStringToExtended(AString: string): string; +var + i: Integer; + WorkStr: string; +begin + if pos('ec', AString) = 1 then + begin + Delete(AString, 1, 2); + WorkStr := ''; + + for i := length(AString) downto 1 do + if CharInSet(AString[i], ['A'..'Z', '0'..'9']) and (i > 1) and + not CharInSet(AString[i - 1], ['A'..'Z', '0'..'9']) then + begin + WorkStr := ' ' + AString[i] + WorkStr + end + else + WorkStr := AString[i] + WorkStr; + + trim(WorkStr); + + i := pos('Sel ', WorkStr); + while i <> 0 do + begin + Delete(WorkStr, i, Length('Sel ')); + Insert('Select ', WorkStr, i); + i := pos('Sel ', WorkStr); + end; + + i := pos('Marker ', WorkStr); + while i <> 0 do + begin + Delete(WorkStr, i, Length('Marker ')); + Insert('Bookmark ', WorkStr,i); + i := pos('Marker ', WorkStr); + end; + + Result := Trim(WorkStr); + end + else + Result := AString; +end; + +function ConvertExtendedToCodeString(AString: string): string; +var + i: Integer; + WorkStr: string; +begin + if pos('ec', AString) = 1 then + begin + Result := AString; + Exit; + end; + + WorkStr := AString; + + i := pos('Select All', WorkStr); + if i = 0 then + begin + i := pos('Select ', WorkStr); + while i <> 0 do + begin + Delete(WorkStr,i,Length('Select ')); + Insert('Sel ',WorkStr,i); + i := pos('Select ', WorkStr); + end; + end; + + i := pos('Bookmark ', WorkStr); + while i <> 0 do + begin + Delete(WorkStr,i,Length('Bookmark ')); + Insert('Marker ',WorkStr,i); + i := pos('Bookmark ', WorkStr); + end; + + i := pos(' ', WorkStr); + while i <> 0 do + begin + delete(WorkStr,i,1); + i := pos(' ', WorkStr); + end; + + Result := 'ec' + WorkStr; +end; + +function IndexToEditorCommand(const AIndex: Integer): Integer; +begin + Result := EditorCommandStrs[AIndex].Value; +end; + +function ConvertExtendedToCommand(AString: string): TSynEditorCommand; +begin + Result := ConvertCodeStringToCommand(ConvertExtendedToCodeString(AString)); +end; + +function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; +var + I: Integer; +begin + Result := ecNone; + + AString := Uppercase(AString); + for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do + if Uppercase(EditorCommandStrs[i].Name) = AString then + begin + Result := EditorCommandStrs[i].Value; + Break; + end; +end; + + +initialization + RegisterIntegerConsts(TypeInfo(TSynEditorCommand), IdentToEditorCommand, + EditorCommandToIdent); +end. diff --git a/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.dfm b/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.dfm index 101f0a80..b81225d9 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.dfm +++ b/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.dfm @@ -1,143 +1,143 @@ -object SynEditKeystrokesEditorForm: TSynEditKeystrokesEditorForm - Left = 300 - Top = 241 - BorderIcons = [biSystemMenu, biMaximize] - Caption = 'Keystroke Editor' - ClientHeight = 319 - ClientWidth = 382 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter - OnCreate = FormCreate - OnResize = FormResize - PixelsPerInch = 96 - TextHeight = 13 - object pnlBottom: TPanel - Left = 8 - Top = 8 - Width = 365 - Height = 308 - BevelInner = bvRaised - BevelOuter = bvLowered - TabOrder = 0 - object lnlInfo: TLabel - Left = 5 - Top = 271 - Width = 229 - Height = 13 - Caption = 'NOTE: To have multiple keystrokes do the same' - end - object lnlInfo2: TLabel - Left = 42 - Top = 287 - Width = 217 - Height = 13 - Caption = 'command, assign the command multiple times.' - end - object pnlCommands: TPanel - Left = 16 - Top = 16 - Width = 246 - Height = 244 - BevelInner = bvLowered - BorderWidth = 4 - Caption = 'pnlCommands' - TabOrder = 0 - object KeyCmdList: TListView - Left = 6 - Top = 6 - Width = 234 - Height = 232 - Align = alClient - BorderStyle = bsNone - Columns = < - item - Caption = 'Command' - Width = 117 - end - item - Caption = 'Keystroke' - Width = 101 - end> - ColumnClick = False - HideSelection = False - TabOrder = 0 - ViewStyle = vsReport - OnClick = KeyCmdListClick - OnDblClick = btnEditClick - end - end - object btnAdd: TButton - Left = 276 - Top = 20 - Width = 75 - Height = 25 - Caption = '&Add' - TabOrder = 1 - OnClick = btnAddClick - end - object btnEdit: TButton - Left = 276 - Top = 52 - Width = 75 - Height = 25 - Caption = '&Edit' - Enabled = False - TabOrder = 2 - OnClick = btnEditClick - end - object btnDelete: TButton - Left = 276 - Top = 84 - Width = 75 - Height = 25 - Caption = '&Delete' - Enabled = False - TabOrder = 3 - OnClick = btnDeleteClick - end - object btnClear: TButton - Left = 276 - Top = 116 - Width = 75 - Height = 25 - Caption = 'C&lear List' - TabOrder = 4 - OnClick = btnClearClick - end - object btnReset: TButton - Left = 276 - Top = 148 - Width = 75 - Height = 25 - Caption = '&Reset List' - TabOrder = 5 - OnClick = btnResetClick - end - object btnOK: TButton - Left = 276 - Top = 241 - Width = 75 - Height = 25 - Caption = '&OK' - Default = True - TabOrder = 6 - OnClick = btnOKClick - end - object btnCancel: TButton - Left = 276 - Top = 273 - Width = 75 - Height = 25 - Cancel = True - Caption = '&Cancel' - TabOrder = 7 - OnClick = btnCancelClick - end - end -end +object SynEditKeystrokesEditorForm: TSynEditKeystrokesEditorForm + Left = 300 + Top = 241 + BorderIcons = [biSystemMenu, biMaximize] + Caption = 'Keystroke Editor' + ClientHeight = 319 + ClientWidth = 382 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + OnResize = FormResize + PixelsPerInch = 96 + TextHeight = 13 + object pnlBottom: TPanel + Left = 8 + Top = 8 + Width = 365 + Height = 308 + BevelInner = bvRaised + BevelOuter = bvLowered + TabOrder = 0 + object lnlInfo: TLabel + Left = 5 + Top = 271 + Width = 229 + Height = 13 + Caption = 'NOTE: To have multiple keystrokes do the same' + end + object lnlInfo2: TLabel + Left = 42 + Top = 287 + Width = 217 + Height = 13 + Caption = 'command, assign the command multiple times.' + end + object pnlCommands: TPanel + Left = 16 + Top = 16 + Width = 246 + Height = 244 + BevelInner = bvLowered + BorderWidth = 4 + Caption = 'pnlCommands' + TabOrder = 0 + object KeyCmdList: TListView + Left = 6 + Top = 6 + Width = 234 + Height = 232 + Align = alClient + BorderStyle = bsNone + Columns = < + item + Caption = 'Command' + Width = 117 + end + item + Caption = 'Keystroke' + Width = 101 + end> + ColumnClick = False + HideSelection = False + TabOrder = 0 + ViewStyle = vsReport + OnClick = KeyCmdListClick + OnDblClick = btnEditClick + end + end + object btnAdd: TButton + Left = 276 + Top = 20 + Width = 75 + Height = 25 + Caption = '&Add' + TabOrder = 1 + OnClick = btnAddClick + end + object btnEdit: TButton + Left = 276 + Top = 52 + Width = 75 + Height = 25 + Caption = '&Edit' + Enabled = False + TabOrder = 2 + OnClick = btnEditClick + end + object btnDelete: TButton + Left = 276 + Top = 84 + Width = 75 + Height = 25 + Caption = '&Delete' + Enabled = False + TabOrder = 3 + OnClick = btnDeleteClick + end + object btnClear: TButton + Left = 276 + Top = 116 + Width = 75 + Height = 25 + Caption = 'C&lear List' + TabOrder = 4 + OnClick = btnClearClick + end + object btnReset: TButton + Left = 276 + Top = 148 + Width = 75 + Height = 25 + Caption = '&Reset List' + TabOrder = 5 + OnClick = btnResetClick + end + object btnOK: TButton + Left = 276 + Top = 241 + Width = 75 + Height = 25 + Caption = '&OK' + Default = True + TabOrder = 6 + OnClick = btnOKClick + end + object btnCancel: TButton + Left = 276 + Top = 273 + Width = 75 + Height = 25 + Cancel = True + Caption = '&Cancel' + TabOrder = 7 + OnClick = btnCancelClick + end + end +end diff --git a/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.pas b/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.pas index 24370f3c..4d1ae63d 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.pas +++ b/Source/VCL/SynEdit/Source/SynEditKeyCmdsEditor.pas @@ -1,416 +1,410 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditKeyCmdsEditor.pas, released 2000-04-07. -The Original Code is based on the mwKeyCmdsEditor.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Brad Stowers. -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: SynEditKeyCmdsEditor.pas,v 1.10.2.2 2004/12/10 15:31:05 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditKeyCmdsEditor; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Graphics, - Controls, - Forms, - Dialogs, - ComCtrls, - Menus, - StdCtrls, - Buttons, - ExtCtrls, - SynEditKeyCmds, - SysUtils, - Classes; - -type - TSynEditKeystrokesEditorForm = class(TForm) - pnlBottom: TPanel; - lnlInfo: TLabel; - lnlInfo2: TLabel; - btnAdd: TButton; - btnEdit: TButton; - btnDelete: TButton; - btnClear: TButton; - btnReset: TButton; - btnOK: TButton; - btnCancel: TButton; - pnlCommands: TPanel; - KeyCmdList: TListView; - procedure FormResize(Sender: TObject); - procedure btnAddClick(Sender: TObject); - procedure btnEditClick(Sender: TObject); - procedure btnDeleteClick(Sender: TObject); - procedure btnResetClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure btnClearClick(Sender: TObject); - procedure btnOKClick(Sender: TObject); - procedure btnCancelClick(Sender: TObject); - procedure KeyCmdListClick(Sender: TObject); - private - FKeystrokes: TSynEditKeystrokes; - FExtended: Boolean; - procedure SetKeystrokes(const Value: TSynEditKeyStrokes); - procedure UpdateKeystrokesList; - procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); - message WM_GETMINMAXINFO; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - property Keystrokes: TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; - property ExtendedString: Boolean read FExtended write FExtended; - end; - -implementation - -{$R *.dfm} - -uses - Types, - UITypes, - SynEditKeyCmdEditor, - SynEditStrConst; - -{ TSynEditKeystrokesEditorForm } - -constructor TSynEditKeystrokesEditorForm.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FKeystrokes := nil; -end; - -destructor TSynEditKeystrokesEditorForm.Destroy; -begin - if Assigned(FKeyStrokes) then FKeystrokes.Free; - inherited Destroy; -end; - -procedure TSynEditKeystrokesEditorForm.SetKeystrokes(const Value: - TSynEditKeyStrokes); -begin - if FKeystrokes = nil then - FKeystrokes := TSynEditKeyStrokes.Create(Self); - FKeystrokes.Assign(Value); - UpdateKeystrokesList; -end; - -procedure TSynEditKeystrokesEditorForm.UpdateKeystrokesList; -var - x: integer; -begin - KeyCmdList.Items.BeginUpdate; - try - KeyCmdList.Items.Clear; - for x := 0 to FKeystrokes.Count-1 do - begin - with KeyCmdList.Items.Add do - begin - if FExtended then - Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[x].Command)) - else Caption := EditorCommandToCodeString(FKeystrokes[x].Command); - if FKeystrokes[x].ShortCut = 0 then - SubItems.Add(SYNS_ShortCutNone) - else - if FKeystrokes[x].ShortCut2 = 0 then - SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)) - else - SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)+ ' '+ - Menus.ShortCutToText(FKeystrokes[x].ShortCut2)); - end; - end; - finally - KeyCmdList.Items.EndUpdate; - end; -end; - -procedure TSynEditKeystrokesEditorForm.FormResize(Sender: TObject); -begin - pnlBottom.Width := pnlBottom.Left + ClientWidth - 25; - pnlBottom.Height := ClientHeight - 11; - pnlCommands.Width := ClientWidth - 136; - pnlCommands.Height := ClientHeight - 75; - - btnAdd.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnEdit.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnDelete.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnClear.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnReset.Left := pnlCommands.Left + pnlCommands.Width + 14; - - btnOK.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnOK.Top := pnlCommands.Top + pnlCommands.Height - 19; - btnCancel.Left := pnlCommands.Left + pnlCommands.Width + 14; - btnCancel.Top := pnlCommands.Top + pnlCommands.Height + 13; - - lnlInfo.Top := pnlCommands.Top + pnlCommands.Height + 11; - lnlInfo2.Top := pnlCommands.Top + pnlCommands.Height + 27; -end; - -procedure TSynEditKeystrokesEditorForm.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); -begin - inherited; - Msg.MinMaxInfo.ptMinTrackSize := Point(300, 225); -end; - -procedure TSynEditKeystrokesEditorForm.btnAddClick(Sender: TObject); //DDH 10/16/01 Begin (reworked proc) -var - NewStroke: TSynEditKeyStroke; - AForm : TSynEditKeystrokeEditorForm; - - function AddKeyStroke: Boolean; - var - KeyLoc: Integer; - TmpCommand: string; - begin - Result := False; - KeyLoc := 0; - if AForm.ShowModal = mrOK then - begin - Result := True; - NewStroke := FKeystrokes.Add; - NewStroke.Command := AForm.Command; - try - KeyLoc := TSynEditKeyStrokes(NewStroke.Collection).FindShortcut2(AForm.Keystroke, AForm.Keystroke2); - NewStroke.ShortCut := AForm.Keystroke; - NewStroke.ShortCut2 := AForm.Keystroke2; - except - on ESynKeyError do - begin - // Shortcut already exists in the collection! - if FExtended then - TmpCommand := ConvertCodeStringToExtended(EditorCommandToCodeString(TSynEditKeyStrokes(NewStroke.Collection).Items[KeyLoc].Command)) - else TmpCommand := EditorCommandToCodeString(TSynEditKeyStrokes(NewStroke.Collection).Items[KeyLoc].Command); - - Result := MessageDlg(Format(SYNS_DuplicateShortcutMsg, - [Menus.ShortCutToText(AForm.Keystroke), TmpCommand]), - mtError, [mbOK, mbCancel], 0) = mrOK; - NewStroke.Free; - - if Result then - Result := AddKeyStroke; - end; - // Some other kind of exception, we don't deal with it... - end; - end; - end; - -begin - AForm := TSynEditKeystrokeEditorForm.Create(Self); - with AForm do - try - Caption := 'Add Keystroke'; - ExtendedString := self.ExtendedString; - Command := ecNone; - Keystroke := 0; - Keystroke2 := 0; - - if AddKeyStroke then - begin - with KeyCmdList.Items.Add do - begin - if FExtended then - Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(NewStroke.Command)) - else Caption := EditorCommandToCodeString(NewStroke.Command); - if NewStroke.ShortCut = 0 then - SubItems.Add(SYNS_ShortcutNone) - else - if NewStroke.ShortCut2 = 0 then - SubItems.Add(Menus.ShortCutToText(NewStroke.ShortCut)) - else - SubItems.Add(Menus.ShortCutToText(NewStroke.ShortCut)+ ' '+ - Menus.ShortCutToText(NewStroke.ShortCut2)); - end; - end; - finally - AForm.Free; - end; -end; - -procedure TSynEditKeystrokesEditorForm.btnEditClick(Sender: TObject); -var - SelItem: TListItem; - OldShortcut: TShortcut; - OldShortcut2: TShortcut; - AForm: TSynEditKeystrokeEditorForm; - - function EditKeyStroke: Boolean; - var - KeyLoc: Integer; - TmpCommand: string; - begin - Result := False; - KeyLoc := 0; - if AForm.ShowModal = mrOK then - begin - Result := True; - OldShortCut := FKeystrokes[SelItem.Index].ShortCut; - OldShortCut2 := FKeystrokes[SelItem.Index].ShortCut2; - - try - KeyLoc := TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).FindShortcut2(AForm.Keystroke, AForm.Keystroke2); - FKeystrokes[SelItem.Index].Command := AForm.Command; - FKeystrokes[SelItem.Index].ShortCut := AForm.Keystroke; - FKeystrokes[SelItem.Index].ShortCut2 := AForm.Keystroke2; - except - on ESynKeyError do - begin - // Shortcut already exists in the collection! - if FExtended then - TmpCommand := ConvertCodeStringToExtended(EditorCommandToCodeString(TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).Items[KeyLoc].Command)) - else TmpCommand := EditorCommandToCodeString(TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).Items[KeyLoc].Command); - - Result := MessageDlg(Format(SYNS_DuplicateShortcutMsg, - [Menus.ShortCutToText(AForm.Keystroke), TmpCommand]), - mtError, [mbOK, mbCancel], 0) = mrOK; - - FKeystrokes[SelItem.Index].ShortCut := OldShortCut; - FKeystrokes[SelItem.Index].ShortCut2 := OldShortCut2; - - if Result then - Result := EditKeyStroke; - end; - // Some other kind of exception, we don't deal with it... - end; - end; -(* - if ShowModal = mrOK then - begin - - try - except - on ESynKeyError do - begin - // Shortcut already exists in the collection! - MessageDlg(Format(SYNS_DuplicateShortcutMsg2, - [Menus.ShortCutToText(Keystroke)]), mtError, [mbOK], 0); - end; - // Some other kind of exception, we don't deal with it... - end; -*) - end; -begin - SelItem := KeyCmdList.Selected; - if SelItem = NIL then - begin - MessageBeep(1); - exit; - end; - AForm := TSynEditKeystrokeEditorForm.Create(Self); - with AForm do - try - ExtendedString := self.ExtendedString; - Command := FKeystrokes[SelItem.Index].Command; - Keystroke := FKeystrokes[SelItem.Index].Shortcut; - Keystroke2 := FKeystrokes[SelItem.Index].Shortcut2; - if EditKeyStroke then - begin - KeyCmdList.Items.BeginUpdate; - try - with SelItem do - begin - - if FExtended then - Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[Index].Command)) - else Caption := EditorCommandToCodeString(FKeystrokes[Index].Command); - - if FKeystrokes[Index].ShortCut = 0 then - SubItems[0] := SYNS_ShortcutNone - else - if FKeystrokes[Index].ShortCut2 = 0 then - SubItems[0] := Menus.ShortCutToText(FKeystrokes[Index].ShortCut) - else - SubItems[0] := Menus.ShortCutToText(FKeystrokes[Index].ShortCut) - + ' ' + Menus.ShortCutToText(FKeystrokes[Index].ShortCut2); - end; - finally - KeyCmdList.Items.EndUpdate; - end; - end; - finally - AForm.Free; - end; -end; //DDH 10/16/01 End (reworked procs) - -procedure TSynEditKeystrokesEditorForm.btnDeleteClick(Sender: TObject); -var - SelItem: TListItem; -begin - SelItem := KeyCmdList.Selected; - if SelItem = nil then - begin - MessageBeep(1); - exit; - end; - FKeystrokes[SelItem.Index].Free; - KeyCmdList.Items.Delete(SelItem.Index); -end; - -procedure TSynEditKeystrokesEditorForm.btnClearClick(Sender: TObject); -begin - FKeystrokes.Clear; - KeyCmdList.Items.Clear; -end; - -procedure TSynEditKeystrokesEditorForm.btnResetClick(Sender: TObject); -begin - FKeystrokes.ResetDefaults; - UpdateKeystrokesList; -end; - -procedure TSynEditKeystrokesEditorForm.FormCreate(Sender: TObject); -begin - KeyCmdList.RowSelect := True; -end; - -procedure TSynEditKeystrokesEditorForm.btnOKClick(Sender: TObject); -begin - ModalResult := mrOK; -end; - -procedure TSynEditKeystrokesEditorForm.btnCancelClick(Sender: TObject); -begin - ModalResult := mrCancel; -end; - -procedure TSynEditKeystrokesEditorForm.KeyCmdListClick(Sender: TObject); -begin - btnEdit.Enabled := Assigned(KeyCmdList.Selected); - btnDelete.Enabled := btnEdit.Enabled; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditKeyCmdsEditor.pas, released 2000-04-07. +The Original Code is based on the mwKeyCmdsEditor.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Brad Stowers. +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: SynEditKeyCmdsEditor.pas,v 1.10.2.2 2004/12/10 15:31:05 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITKEYCMDSEDITOR} +unit SynEditKeyCmdsEditor; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_15_UP} + Types, + {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} + Windows, + Messages, + Graphics, + Controls, + Forms, + Dialogs, + ComCtrls, + Menus, + StdCtrls, + Buttons, + ExtCtrls, + SynEditKeyCmds, + SysUtils, + Classes; + +type + TSynEditKeystrokesEditorForm = class(TForm) + pnlBottom: TPanel; + lnlInfo: TLabel; + lnlInfo2: TLabel; + btnAdd: TButton; + btnEdit: TButton; + btnDelete: TButton; + btnClear: TButton; + btnReset: TButton; + btnOK: TButton; + btnCancel: TButton; + pnlCommands: TPanel; + KeyCmdList: TListView; + procedure FormResize(Sender: TObject); + procedure btnAddClick(Sender: TObject); + procedure btnEditClick(Sender: TObject); + procedure btnDeleteClick(Sender: TObject); + procedure btnResetClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure btnClearClick(Sender: TObject); + procedure btnOKClick(Sender: TObject); + procedure btnCancelClick(Sender: TObject); + procedure KeyCmdListClick(Sender: TObject); + private + FKeystrokes: TSynEditKeystrokes; + FExtended: Boolean; + procedure SetKeystrokes(const Value: TSynEditKeyStrokes); + procedure UpdateKeystrokesList; + procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); + message WM_GETMINMAXINFO; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + property Keystrokes: TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + property ExtendedString: Boolean read FExtended write FExtended; + end; + +implementation + +{$R *.dfm} + +uses + SynEditKeyCmdEditor, + SynEditStrConst; + +{ TSynEditKeystrokesEditorForm } + +constructor TSynEditKeystrokesEditorForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FKeystrokes := nil; +end; + +destructor TSynEditKeystrokesEditorForm.Destroy; +begin + if Assigned(FKeystrokes) then FKeystrokes.Free; + inherited Destroy; +end; + +procedure TSynEditKeystrokesEditorForm.SetKeystrokes(const Value: + TSynEditKeyStrokes); +begin + if FKeystrokes = nil then + FKeystrokes := TSynEditKeyStrokes.Create(Self); + FKeystrokes.Assign(Value); + UpdateKeystrokesList; +end; + +procedure TSynEditKeystrokesEditorForm.UpdateKeystrokesList; +var + x: Integer; +begin + KeyCmdList.Items.BeginUpdate; + try + KeyCmdList.Items.Clear; + for x := 0 to FKeystrokes.Count-1 do + begin + with KeyCmdList.Items.Add do + begin + if FExtended then + Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[x].Command)) + else Caption := EditorCommandToCodeString(FKeystrokes[x].Command); + if FKeystrokes[x].ShortCut = 0 then + SubItems.Add(SYNS_ShortCutNone) + else + if FKeystrokes[x].ShortCut2 = 0 then + SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)) + else + SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)+ ' '+ + Menus.ShortCutToText(FKeystrokes[x].ShortCut2)); + end; + end; + finally + KeyCmdList.Items.EndUpdate; + end; +end; + +procedure TSynEditKeystrokesEditorForm.FormResize(Sender: TObject); +begin + pnlBottom.Width := pnlBottom.Left + ClientWidth - 25; + pnlBottom.Height := ClientHeight - 11; + pnlCommands.Width := ClientWidth - 136; + pnlCommands.Height := ClientHeight - 75; + + btnAdd.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnEdit.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnDelete.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnClear.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnReset.Left := pnlCommands.Left + pnlCommands.Width + 14; + + btnOK.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnOK.Top := pnlCommands.Top + pnlCommands.Height - 19; + btnCancel.Left := pnlCommands.Left + pnlCommands.Width + 14; + btnCancel.Top := pnlCommands.Top + pnlCommands.Height + 13; + + lnlInfo.Top := pnlCommands.Top + pnlCommands.Height + 11; + lnlInfo2.Top := pnlCommands.Top + pnlCommands.Height + 27; +end; + +procedure TSynEditKeystrokesEditorForm.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); +begin + inherited; + Msg.MinMaxInfo.ptMinTrackSize := Point(300, 225); +end; + +procedure TSynEditKeystrokesEditorForm.btnAddClick(Sender: TObject); //DDH 10/16/01 Begin (reworked proc) +var + NewStroke: TSynEditKeyStroke; + AForm : TSynEditKeystrokeEditorForm; + + function AddKeyStroke: Boolean; + var + KeyLoc: Integer; + TmpCommand: string; + begin + Result := False; + KeyLoc := 0; + if AForm.ShowModal = mrOK then + begin + Result := True; + NewStroke := FKeystrokes.Add; + NewStroke.Command := AForm.Command; + try + KeyLoc := TSynEditKeyStrokes(NewStroke.Collection).FindShortcut2(AForm.Keystroke, AForm.Keystroke2); + NewStroke.ShortCut := AForm.Keystroke; + NewStroke.ShortCut2 := AForm.Keystroke2; + except + on ESynKeyError do + begin + // Shortcut already exists in the collection! + if FExtended then + TmpCommand := ConvertCodeStringToExtended(EditorCommandToCodeString(TSynEditKeyStrokes(NewStroke.Collection).Items[KeyLoc].Command)) + else TmpCommand := EditorCommandToCodeString(TSynEditKeyStrokes(NewStroke.Collection).Items[KeyLoc].Command); + + Result := MessageDlg(Format(SYNS_DuplicateShortcutMsg, + [Menus.ShortCutToText(AForm.Keystroke), TmpCommand]), + mtError, [mbOK, mbCancel], 0) = mrOK; + NewStroke.Free; + + if Result then + Result := AddKeyStroke; + end; + // Some other kind of exception, we don't deal with it... + end; + end; + end; + +begin + AForm := TSynEditKeystrokeEditorForm.Create(Self); + with AForm do + try + Caption := 'Add Keystroke'; + ExtendedString := self.ExtendedString; + Command := ecNone; + Keystroke := 0; + Keystroke2 := 0; + + if AddKeyStroke then + begin + + with KeyCmdList.Items.Add do + begin + if FExtended then + Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(NewStroke.Command)) + else Caption := EditorCommandToCodeString(NewStroke.Command); + if NewStroke.ShortCut = 0 then + SubItems.Add(SYNS_ShortcutNone) + else + if NewStroke.ShortCut2 = 0 then + SubItems.Add(Menus.ShortCutToText(NewStroke.ShortCut)) + else + SubItems.Add(Menus.ShortCutToText(NewStroke.ShortCut)+ ' '+ + Menus.ShortCutToText(NewStroke.ShortCut2)); + end; + end; + finally + AForm.Free; + end; +end; + +procedure TSynEditKeystrokesEditorForm.btnEditClick(Sender: TObject); +var + SelItem: TListItem; + OldShortcut: TShortcut; + OldShortcut2: TShortcut; + AForm: TSynEditKeystrokeEditorForm; + + function EditKeyStroke: Boolean; + var + KeyLoc: Integer; + TmpCommand: string; + begin + Result := False; + KeyLoc := 0; + if AForm.ShowModal = mrOK then + begin + Result := True; + OldShortCut := FKeystrokes[SelItem.Index].ShortCut; + OldShortCut2 := FKeystrokes[SelItem.Index].ShortCut2; + + try + KeyLoc := TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).FindShortcut2(AForm.Keystroke, AForm.Keystroke2); + FKeystrokes[SelItem.Index].Command := AForm.Command; + FKeystrokes[SelItem.Index].ShortCut := AForm.Keystroke; + FKeystrokes[SelItem.Index].ShortCut2 := AForm.Keystroke2; + except + on ESynKeyError do + begin + // Shortcut already exists in the collection! + if FExtended then + TmpCommand := ConvertCodeStringToExtended(EditorCommandToCodeString(TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).Items[KeyLoc].Command)) + else TmpCommand := EditorCommandToCodeString(TSynEditKeyStrokes(FKeystrokes[SelItem.Index].Collection).Items[KeyLoc].Command); + + Result := MessageDlg(Format(SYNS_DuplicateShortcutMsg, + [Menus.ShortCutToText(AForm.Keystroke), TmpCommand]), + mtError, [mbOK, mbCancel], 0) = mrOK; + + FKeystrokes[SelItem.Index].ShortCut := OldShortCut; + FKeystrokes[SelItem.Index].ShortCut2 := OldShortCut2; + + if Result then + Result := EditKeyStroke; + end; + // Some other kind of exception, we don't deal with it... + end; + end; + end; +begin + SelItem := KeyCmdList.Selected; + if SelItem = NIL then + begin + MessageBeep(1); + Exit; + end; + AForm := TSynEditKeystrokeEditorForm.Create(Self); + with AForm do + try + ExtendedString := self.ExtendedString; + Command := FKeystrokes[SelItem.Index].Command; + Keystroke := FKeystrokes[SelItem.Index].Shortcut; + Keystroke2 := FKeystrokes[SelItem.Index].Shortcut2; + if EditKeyStroke then + begin + KeyCmdList.Items.BeginUpdate; + try + with SelItem do + begin + + if FExtended then + Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[Index].Command)) + else Caption := EditorCommandToCodeString(FKeystrokes[Index].Command); + + if FKeystrokes[Index].ShortCut = 0 then + SubItems[0] := SYNS_ShortcutNone + else + if FKeystrokes[Index].ShortCut2 = 0 then + SubItems[0] := Menus.ShortCutToText(FKeystrokes[Index].ShortCut) + else + SubItems[0] := Menus.ShortCutToText(FKeystrokes[Index].ShortCut) + + ' ' + Menus.ShortCutToText(FKeystrokes[Index].ShortCut2); + end; + finally + KeyCmdList.Items.EndUpdate; + end; + end; + finally + AForm.Free; + end; +end; //DDH 10/16/01 End (reworked procs) + +procedure TSynEditKeystrokesEditorForm.btnDeleteClick(Sender: TObject); +var + SelItem: TListItem; +begin + SelItem := KeyCmdList.Selected; + if SelItem = nil then + begin + MessageBeep(1); + Exit; + end; + FKeystrokes[SelItem.Index].Free; + KeyCmdList.Items.Delete(SelItem.Index); +end; + +procedure TSynEditKeystrokesEditorForm.btnClearClick(Sender: TObject); +begin + FKeystrokes.Clear; + KeyCmdList.Items.Clear; +end; + +procedure TSynEditKeystrokesEditorForm.btnResetClick(Sender: TObject); +begin + FKeystrokes.ResetDefaults; + UpdateKeystrokesList; +end; + +procedure TSynEditKeystrokesEditorForm.FormCreate(Sender: TObject); +begin + {$IFDEF SYN_COMPILER_3_UP} + KeyCmdList.RowSelect := True; + {$ENDIF} +end; + +procedure TSynEditKeystrokesEditorForm.btnOKClick(Sender: TObject); +begin + ModalResult := mrOK; +end; + +procedure TSynEditKeystrokesEditorForm.btnCancelClick(Sender: TObject); +begin + ModalResult := mrCancel; +end; + +procedure TSynEditKeystrokesEditorForm.KeyCmdListClick(Sender: TObject); +begin + btnEdit.Enabled := Assigned(KeyCmdList.Selected); + btnDelete.Enabled := btnEdit.Enabled; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditKeyConst.pas b/Source/VCL/SynEdit/Source/SynEditKeyConst.pas index a97b4335..1d6dd9ef 100644 --- a/Source/VCL/SynEdit/Source/SynEditKeyConst.pas +++ b/Source/VCL/SynEdit/Source/SynEditKeyConst.pas @@ -1,119 +1,121 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. -The Original Code is based on the mwKeyCmds.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Brad Stowers. -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: SynEditKeyConst.pas,v 1.4.2.1 2004/08/31 12:55:17 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditKeyConst; - -{ This unit provides a translation of DELPHI and CLX key constants to - more readable SynEdit constants } - -{$I SynEdit.inc} - -interface - -uses - Windows; - -const - - SYNEDIT_RETURN = VK_RETURN; - SYNEDIT_ESCAPE = VK_ESCAPE; - SYNEDIT_SPACE = VK_SPACE; - SYNEDIT_PRIOR = VK_PRIOR; - SYNEDIT_NEXT = VK_NEXT; - SYNEDIT_END = VK_END; - SYNEDIT_HOME = VK_HOME; - SYNEDIT_UP = VK_UP; - SYNEDIT_DOWN = VK_DOWN; - SYNEDIT_BACK = VK_BACK; - SYNEDIT_LEFT = VK_LEFT; - SYNEDIT_RIGHT = VK_RIGHT; - SYNEDIT_MENU = VK_MENU; - SYNEDIT_CONTROL = VK_CONTROL; - SYNEDIT_SHIFT = VK_SHIFT; - SYNEDIT_F1 = VK_F1; - SYNEDIT_F2 = VK_F2; - SYNEDIT_F3 = VK_F3; - SYNEDIT_F4 = VK_F4; - SYNEDIT_F5 = VK_F5; - SYNEDIT_F6 = VK_F6; - SYNEDIT_F7 = VK_F7; - SYNEDIT_F8 = VK_F8; - SYNEDIT_F9 = VK_F9; - SYNEDIT_F10 = VK_F10; - SYNEDIT_F11 = VK_F11; - SYNEDIT_F12 = VK_F12; - SYNEDIT_F13 = VK_F13; - SYNEDIT_F14 = VK_F14; - SYNEDIT_F15 = VK_F15; - SYNEDIT_F16 = VK_F16; - SYNEDIT_F17 = VK_F17; - SYNEDIT_F18 = VK_F18; - SYNEDIT_F19 = VK_F19; - SYNEDIT_F20 = VK_F20; - SYNEDIT_F21 = VK_F21; - SYNEDIT_F22 = VK_F22; - SYNEDIT_F23 = VK_F23; - SYNEDIT_F24 = VK_F24; - SYNEDIT_PRINT = VK_PRINT; - SYNEDIT_INSERT = VK_INSERT; - SYNEDIT_DELETE = VK_DELETE; - SYNEDIT_NUMPAD0 = VK_NUMPAD0; - SYNEDIT_NUMPAD1 = VK_NUMPAD1; - SYNEDIT_NUMPAD2 = VK_NUMPAD2; - SYNEDIT_NUMPAD3 = VK_NUMPAD3; - SYNEDIT_NUMPAD4 = VK_NUMPAD4; - SYNEDIT_NUMPAD5 = VK_NUMPAD5; - SYNEDIT_NUMPAD6 = VK_NUMPAD6; - SYNEDIT_NUMPAD7 = VK_NUMPAD7; - SYNEDIT_NUMPAD8 = VK_NUMPAD8; - SYNEDIT_NUMPAD9 = VK_NUMPAD9; - SYNEDIT_MULTIPLY = VK_MULTIPLY; - SYNEDIT_ADD = VK_ADD; - SYNEDIT_SEPARATOR = VK_SEPARATOR; - SYNEDIT_SUBTRACT = VK_SUBTRACT; - SYNEDIT_DECIMAL = VK_DECIMAL; - SYNEDIT_DIVIDE = VK_DIVIDE; - SYNEDIT_NUMLOCK = VK_NUMLOCK; - SYNEDIT_SCROLL = VK_SCROLL; - SYNEDIT_TAB = VK_TAB; - SYNEDIT_CLEAR = VK_CLEAR; - SYNEDIT_PAUSE = VK_PAUSE; - SYNEDIT_CAPITAL = VK_CAPITAL; - -implementation - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditKeyCmds.pas, released 2000-04-07. +The Original Code is based on the mwKeyCmds.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Brad Stowers. +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: SynEditKeyConst.pas,v 1.4.2.1 2004/08/31 12:55:17 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITKEYCONST} +unit SynEditKeyConst; +{$ENDIF} + +{ This unit provides a translation of DELPHI and CLX key constants to + more readable SynEdit constants } + +{$I SynEdit.inc} + +interface + +uses + Windows; + +const + + SYNEDIT_RETURN = VK_RETURN; + SYNEDIT_ESCAPE = VK_ESCAPE; + SYNEDIT_SPACE = VK_SPACE; + SYNEDIT_PRIOR = VK_PRIOR; + SYNEDIT_NEXT = VK_NEXT; + SYNEDIT_END = VK_END; + SYNEDIT_HOME = VK_HOME; + SYNEDIT_UP = VK_UP; + SYNEDIT_DOWN = VK_DOWN; + SYNEDIT_BACK = VK_BACK; + SYNEDIT_LEFT = VK_LEFT; + SYNEDIT_RIGHT = VK_RIGHT; + SYNEDIT_MENU = VK_MENU; + SYNEDIT_CONTROL = VK_CONTROL; + SYNEDIT_SHIFT = VK_SHIFT; + SYNEDIT_F1 = VK_F1; + SYNEDIT_F2 = VK_F2; + SYNEDIT_F3 = VK_F3; + SYNEDIT_F4 = VK_F4; + SYNEDIT_F5 = VK_F5; + SYNEDIT_F6 = VK_F6; + SYNEDIT_F7 = VK_F7; + SYNEDIT_F8 = VK_F8; + SYNEDIT_F9 = VK_F9; + SYNEDIT_F10 = VK_F10; + SYNEDIT_F11 = VK_F11; + SYNEDIT_F12 = VK_F12; + SYNEDIT_F13 = VK_F13; + SYNEDIT_F14 = VK_F14; + SYNEDIT_F15 = VK_F15; + SYNEDIT_F16 = VK_F16; + SYNEDIT_F17 = VK_F17; + SYNEDIT_F18 = VK_F18; + SYNEDIT_F19 = VK_F19; + SYNEDIT_F20 = VK_F20; + SYNEDIT_F21 = VK_F21; + SYNEDIT_F22 = VK_F22; + SYNEDIT_F23 = VK_F23; + SYNEDIT_F24 = VK_F24; + SYNEDIT_PRINT = VK_PRINT; + SYNEDIT_INSERT = VK_INSERT; + SYNEDIT_DELETE = VK_DELETE; + SYNEDIT_NUMPAD0 = VK_NUMPAD0; + SYNEDIT_NUMPAD1 = VK_NUMPAD1; + SYNEDIT_NUMPAD2 = VK_NUMPAD2; + SYNEDIT_NUMPAD3 = VK_NUMPAD3; + SYNEDIT_NUMPAD4 = VK_NUMPAD4; + SYNEDIT_NUMPAD5 = VK_NUMPAD5; + SYNEDIT_NUMPAD6 = VK_NUMPAD6; + SYNEDIT_NUMPAD7 = VK_NUMPAD7; + SYNEDIT_NUMPAD8 = VK_NUMPAD8; + SYNEDIT_NUMPAD9 = VK_NUMPAD9; + SYNEDIT_MULTIPLY = VK_MULTIPLY; + SYNEDIT_ADD = VK_ADD; + SYNEDIT_SEPARATOR = VK_SEPARATOR; + SYNEDIT_SUBTRACT = VK_SUBTRACT; + SYNEDIT_DECIMAL = VK_DECIMAL; + SYNEDIT_DIVIDE = VK_DIVIDE; + SYNEDIT_NUMLOCK = VK_NUMLOCK; + SYNEDIT_SCROLL = VK_SCROLL; + SYNEDIT_TAB = VK_TAB; + SYNEDIT_CLEAR = VK_CLEAR; + SYNEDIT_PAUSE = VK_PAUSE; + SYNEDIT_CAPITAL = VK_CAPITAL; + +implementation + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditMiscClasses.pas b/Source/VCL/SynEdit/Source/SynEditMiscClasses.pas index 9f815a3c..b3d73594 100644 --- a/Source/VCL/SynEdit/Source/SynEditMiscClasses.pas +++ b/Source/VCL/SynEdit/Source/SynEditMiscClasses.pas @@ -1,1421 +1,1609 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditMiscClasses.pas, released 2000-04-07. -The Original Code is based on the mwSupportClasses.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Unicode translation by Maël Hörz. -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: SynEditMiscClasses.pas,v 1.35.2.9 2008/09/17 13:59:12 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditMiscClasses; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Registry, - Consts, - SysUtils, - Classes, - Math, - Graphics, - Controls, - Forms, - StdCtrls, - Menus, - ImgList, - SynEditTypes, - SynEditKeyConst, - SynUnicode; - -type - TSynSelectedColor = class(TPersistent) - private - fBG: TColor; - fFG: TColor; - fOnChange: TNotifyEvent; - procedure SetBG(Value: TColor); - procedure SetFG(Value: TColor); - public - constructor Create; - procedure Assign(Source: TPersistent); override; - published - property Background: TColor read fBG write SetBG default clHighLight; - property Foreground: TColor read fFG write SetFG default clHighLightText; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - end; - - TSynGutterBorderStyle = (gbsNone, gbsMiddle, gbsRight); - - TSynGutter = class(TPersistent) - private - fFont: TFont; - fColor: TColor; - fBorderColor: TColor; - fWidth: integer; - fShowLineNumbers: boolean; - fDigitCount: integer; - fLeadingZeros: boolean; - fZeroStart: boolean; - fLeftOffset: integer; - fRightOffset: integer; - fRightMargin: integer; - fOnChange: TNotifyEvent; - fCursor: TCursor; - fVisible: boolean; - fUseFontStyle: boolean; - fAutoSize: boolean; - fAutoSizeDigitCount: integer; - fBorderStyle: TSynGutterBorderStyle; - fLineNumberStart: Integer; - fGradient: Boolean; - fGradientStartColor: TColor; - fGradientEndColor: TColor; - fGradientSteps: Integer; - procedure SetAutoSize(const Value: boolean); - procedure SetBorderColor(const Value: TColor); - procedure SetColor(const Value: TColor); - procedure SetDigitCount(Value: integer); - procedure SetLeadingZeros(const Value: boolean); - procedure SetLeftOffset(Value: integer); - procedure SetRightOffset(Value: integer); - procedure SetRightMargin(Value: integer); - procedure SetShowLineNumbers(const Value: boolean); - procedure SetUseFontStyle(Value: boolean); - procedure SetVisible(Value: boolean); - procedure SetWidth(Value: integer); - procedure SetZeroStart(const Value: boolean); - procedure SetFont(Value: TFont); - procedure OnFontChange(Sender: TObject); - procedure SetBorderStyle(const Value: TSynGutterBorderStyle); - procedure SetLineNumberStart(const Value: Integer); - procedure SetGradient(const Value: Boolean); - procedure SetGradientStartColor(const Value: TColor); - procedure SetGradientEndColor(const Value: TColor); - procedure SetGradientSteps(const Value: Integer); - function GetWidth: integer; - public - constructor Create; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - procedure AutoSizeDigitCount(LinesCount: integer); - function FormatLineNumber(Line: integer): string; - function RealGutterWidth(CharWidth: integer): integer; - //++ DPI-Aware - procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware - published - property AutoSize: boolean read fAutoSize write SetAutoSize default FALSE; - property BorderStyle: TSynGutterBorderStyle read fBorderStyle - write SetBorderStyle default gbsMiddle; - property Color: TColor read fColor write SetColor default clBtnFace; - property BorderColor: TColor read fBorderColor write SetBorderColor default clWindow; - property Cursor: TCursor read fCursor write fCursor default crDefault; - property DigitCount: integer read fDigitCount write SetDigitCount - default 4; - property Font: TFont read fFont write SetFont; - property LeadingZeros: boolean read fLeadingZeros write SetLeadingZeros - default FALSE; - property LeftOffset: integer read fLeftOffset write SetLeftOffset - default 16; - property RightOffset: integer read fRightOffset write SetRightOffset - default 2; - property RightMargin: integer read fRightMargin write SetRightMargin - default 2; - property ShowLineNumbers: boolean read fShowLineNumbers - write SetShowLineNumbers default FALSE; - property UseFontStyle: boolean read fUseFontStyle write SetUseFontStyle - default True; - property Visible: boolean read fVisible write SetVisible default TRUE; - property Width: integer read GetWidth write SetWidth default 30; - property ZeroStart: boolean read fZeroStart write SetZeroStart - default False; - property LineNumberStart: Integer read fLineNumberStart write SetLineNumberStart default 1; - property Gradient: Boolean read fGradient write SetGradient default False; - property GradientStartColor: TColor read fGradientStartColor write SetGradientStartColor default clWindow; - property GradientEndColor: TColor read fGradientEndColor write SetGradientEndColor default clBtnFace; - property GradientSteps: Integer read fGradientSteps write SetGradientSteps default 48; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - end; - - TSynBookMarkOpt = class(TPersistent) - private - fBookmarkImages: TCustomImageList; - fDrawBookmarksFirst: boolean; - fEnableKeys: Boolean; - fGlyphsVisible: Boolean; - fLeftMargin: Integer; - fOwner: TComponent; - fXoffset: integer; - fOnChange: TNotifyEvent; - procedure SetBookmarkImages(const Value: TCustomImageList); - procedure SetDrawBookmarksFirst(Value: boolean); - procedure SetGlyphsVisible(Value: Boolean); - procedure SetLeftMargin(Value: Integer); - procedure SetXOffset(Value: integer); - public - constructor Create(AOwner: TComponent); - procedure Assign(Source: TPersistent); override; - //++ DPI-Aware - procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware - published - property BookmarkImages: TCustomImageList - read fBookmarkImages write SetBookmarkImages; - property DrawBookmarksFirst: boolean read fDrawBookmarksFirst - write SetDrawBookmarksFirst default True; - property EnableKeys: Boolean - read fEnableKeys write fEnableKeys default True; - property GlyphsVisible: Boolean - read fGlyphsVisible write SetGlyphsVisible default True; - property LeftMargin: Integer read fLeftMargin write SetLeftMargin default 2; - property Xoffset: integer read fXoffset write SetXOffset default 12; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - end; - - TSynGlyph = class(TPersistent) - private - fVisible: boolean; - fInternalGlyph, fGlyph: TBitmap; - fInternalMaskColor, fMaskColor: TColor; - fOnChange: TNotifyEvent; - procedure SetGlyph(Value: TBitmap); - procedure GlyphChange(Sender: TObject); - procedure SetMaskColor(Value: TColor); - procedure SetVisible(Value: boolean); - function GetWidth : integer; - function GetHeight : integer; - public - constructor Create(aModule: THandle; const aName: string; aMaskColor: TColor); - destructor Destroy; override; - procedure Assign(aSource: TPersistent); override; - procedure Draw(aCanvas: TCanvas; aX, aY, aLineHeight: integer); - property Width : integer read GetWidth; - property Height : integer read GetHeight; - //++ DPI-Aware - procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware - published - property Glyph: TBitmap read fGlyph write SetGlyph; - property MaskColor: TColor read fMaskColor write SetMaskColor default clNone; - property Visible: boolean read fVisible write SetVisible default True; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - end; - - { TSynMethodChain } - - ESynMethodChain = class(Exception); - TSynExceptionEvent = procedure (Sender: TObject; E: Exception; - var DoContinue: Boolean) of object; - - TSynMethodChain = class(TObject) - private - FNotifyProcs: TList; - FExceptionHandler: TSynExceptionEvent; - protected - procedure DoFire(const AEvent: TMethod); virtual; abstract; - function DoHandleException(E: Exception): Boolean; virtual; - property ExceptionHandler: TSynExceptionEvent read FExceptionHandler - write FExceptionHandler; - public - constructor Create; virtual; - destructor Destroy; override; - procedure Add(AEvent: TMethod); - procedure Remove(AEvent: TMethod); - procedure Fire; - end; - - { TSynNotifyEventChain } - - TSynNotifyEventChain = class(TSynMethodChain) - private - FSender: TObject; - protected - procedure DoFire(const AEvent: TMethod); override; - public - constructor CreateEx(ASender: TObject); - procedure Add(AEvent: TNotifyEvent); - procedure Remove(AEvent: TNotifyEvent); - property ExceptionHandler; - property Sender: TObject read FSender write FSender; - end; - - { TSynInternalImage } - - TSynInternalImage = class(TObject) - private - fImages : TBitmap; - fWidth : Integer; - fHeight : Integer; - fCount : Integer; - - public - constructor Create(aModule: THandle; const Name: string; Count: integer); - destructor Destroy; override; - procedure Draw(ACanvas: TCanvas; Number, X, Y, LineHeight: integer); - procedure DrawTransparent(ACanvas: TCanvas; Number, X, Y, - LineHeight: integer; TransparentColor: TColor); - //++ DPI-Aware - procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware - end; - -{ TSynHotKey } - -const - BorderWidth = 0; - -type - TSynBorderStyle = TBorderStyle; - - THKModifier = (hkShift, hkCtrl, hkAlt); - THKModifiers = set of THKModifier; - THKInvalidKey = (hcNone, hcShift, hcCtrl, hcAlt, hcShiftCtrl, - hcShiftAlt, hcCtrlAlt, hcShiftCtrlAlt); - THKInvalidKeys = set of THKInvalidKey; - - TSynHotKey = class(TCustomControl) - private - FBorderStyle: TSynBorderStyle; - FHotKey: TShortCut; - FInvalidKeys: THKInvalidKeys; - FModifiers: THKModifiers; - FPressedOnlyModifiers: Boolean; - procedure SetBorderStyle(const Value: TSynBorderStyle); - procedure SetHotKey(const Value: TShortCut); - procedure SetInvalidKeys(const Value: THKInvalidKeys); - procedure SetModifiers(const Value: THKModifiers); - procedure WMGetDlgCode(var Message: TMessage); message WM_GETDLGCODE; - procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; - procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; - protected - procedure CreateParams(var Params: TCreateParams); override; - procedure DoExit; override; - procedure KeyDown(var Key: Word; Shift: TShiftState); override; - procedure KeyUp(var Key: Word; Shift: TShiftState); override; - procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; - procedure Paint; override; - public - constructor Create(AOwner: TComponent); override; - published - property Font; - property Color; - property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle - default bsSingle; - property HotKey: TShortCut read FHotKey write SetHotKey default $0041; { Alt+A } - property InvalidKeys: THKInvalidKeys read FInvalidKeys write SetInvalidKeys default [hcNone, hcShift]; - property Modifiers: THKModifiers read FModifiers write SetModifiers default [hkAlt]; - end; - - TSynEditSearchCustom = class(TComponent) - protected - function GetPattern: string; virtual; abstract; - procedure SetPattern(const Value: string); virtual; abstract; - function GetLength(Index: Integer): Integer; virtual; abstract; - function GetResult(Index: Integer): Integer; virtual; abstract; - function GetResultCount: Integer; virtual; abstract; - procedure SetOptions(const Value: TSynSearchOptions); virtual; abstract; - public - function FindAll(const NewText: string): Integer; virtual; abstract; - function Replace(const aOccurrence, aReplacement: string): string; virtual; abstract; - property Pattern: string read GetPattern write SetPattern; - property ResultCount: Integer read GetResultCount; - property Results[Index: Integer]: Integer read GetResult; - property Lengths[Index: Integer]: Integer read GetLength; - property Options: TSynSearchOptions write SetOptions; - end; - - TBetterRegistry = class(TRegistry) - function OpenKeyReadOnly(const Key: string): Boolean; - end; - -//++ DPI-Aware - procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, - NewHeight: integer); -//-- DPI-Aware - - -implementation - -uses - Winapi.Wincodec, - SynEditMiscProcs; - -//++ DPI-Aware -procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer); -var - Factory: IWICImagingFactory; - Scaler: IWICBitmapScaler; - Source : TWICImage; -begin - //Bitmap.AlphaFormat := afDefined; - Source := TWICImage.Create; - try - Source.Assign(Bitmap); - Factory := TWICImage.ImagingFactory; - Factory.CreateBitmapScaler(Scaler); - try - Scaler.Initialize(Source.Handle, NewWidth, NewHeight, - WICBitmapInterpolationModeHighQualityCubic); - Source.Handle := IWICBitmap(Scaler); - finally - Scaler := nil; - Factory := nil; - end; - Bitmap.Assign(Source); - finally - Source.Free; - end; -end; -//-- DPI-Aware - -{ TSynSelectedColor } - -constructor TSynSelectedColor.Create; -begin - inherited Create; - fBG := clHighLight; - fFG := clHighLightText; -end; - -procedure TSynSelectedColor.Assign(Source: TPersistent); -var - Src: TSynSelectedColor; -begin - if (Source <> nil) and (Source is TSynSelectedColor) then begin - Src := TSynSelectedColor(Source); - fBG := Src.fBG; - fFG := Src.fFG; - if Assigned(fOnChange) then fOnChange(Self); - end else - inherited Assign(Source); -end; - -procedure TSynSelectedColor.SetBG(Value: TColor); -begin - if (fBG <> Value) then begin - fBG := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynSelectedColor.SetFG(Value: TColor); -begin - if (fFG <> Value) then begin - fFG := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -{ TSynGutter } - //++ DPI-Aware -procedure TSynGutter.ChangeScale(M, D: Integer); -begin - fWidth := MulDiv(fWidth, M, D); - fLeftOffset := MulDiv(fLeftOffset, M, D); - fRightOffset := MulDiv(fRightOffset, M, D); - fRightMargin := MulDiv(fRightMargin, M, D); - fFont.Height := Round(fFont.Height * M / D); - if Assigned(fOnChange) then fOnChange(Self); -end; -//-- DPI-Aware - -constructor TSynGutter.Create; -begin - inherited Create; - fFont := TFont.Create; - fFont.Name := DefaultFontName; - fFont.Size := 8; - fFont.Style := []; - fUseFontStyle := True; - fFont.OnChange := OnFontChange; - - fColor := clBtnFace; - fVisible := TRUE; - fWidth := 30; - fLeftOffset := 16; - fDigitCount := 4; - fAutoSizeDigitCount := fDigitCount; - fRightOffset := 2; - fRightMargin := 2; - fBorderColor := clWindow; - fBorderStyle := gbsMiddle; - fLineNumberStart := 1; - fZeroStart := False; - fGradient := False; - fGradientStartColor := clWindow; - fGradientEndColor := clBtnFace; - fGradientSteps := 48; -end; - -destructor TSynGutter.Destroy; -begin - fFont.Free; - inherited Destroy; -end; - -procedure TSynGutter.Assign(Source: TPersistent); -var - Src: TSynGutter; -begin - if Assigned(Source) and (Source is TSynGutter) then - begin - Src := TSynGutter(Source); - fFont.Assign(src.Font); - fUseFontStyle := src.fUseFontStyle; - fColor := Src.fColor; - fVisible := Src.fVisible; - fWidth := Src.fWidth; - fShowLineNumbers := Src.fShowLineNumbers; - fLeadingZeros := Src.fLeadingZeros; - fZeroStart := Src.fZeroStart; - fLeftOffset := Src.fLeftOffset; - fDigitCount := Src.fDigitCount; -//++ Code Folding - // Do not change RightOffset since it varies with Code Folding - //fRightOffset := Src.fRightOffset; -//-- Code Folding - fRightMargin := Src.fRightMargin; - fAutoSize := Src.fAutoSize; - fAutoSizeDigitCount := Src.fAutoSizeDigitCount; - fLineNumberStart := Src.fLineNumberStart; - fBorderColor := Src.fBorderColor; - fBorderStyle := Src.fBorderStyle; - fGradient := Src.fGradient; - fGradientStartColor := Src.fGradientStartColor; - fGradientEndColor := Src.fGradientEndColor; - fGradientSteps := Src.fGradientSteps; - if Assigned(fOnChange) then fOnChange(Self); - end - else - inherited; -end; - -procedure TSynGutter.AutoSizeDigitCount(LinesCount: integer); -var - nDigits: integer; -begin - if fVisible and fAutoSize and fShowLineNumbers then - begin - if fZeroStart then - Dec(LinesCount) - else if fLineNumberStart > 1 then - Inc(LinesCount, fLineNumberStart - 1); - - nDigits := Max(Length(IntToStr(LinesCount)), fDigitCount); - if fAutoSizeDigitCount <> nDigits then begin - fAutoSizeDigitCount := nDigits; - if Assigned(fOnChange) then fOnChange(Self); - end; - end else - fAutoSizeDigitCount := fDigitCount; -end; - -function TSynGutter.FormatLineNumber(Line: integer): string; -var - i: integer; -begin - if fZeroStart then - Dec(Line) - else if fLineNumberStart > 1 then - Inc(Line, fLineNumberStart - 1); - Result := Format('%*d', [fAutoSizeDigitCount, Line]); - if fLeadingZeros then - for i := 1 to fAutoSizeDigitCount - 1 do begin - if (Result[i] <> ' ') then break; - Result[i] := '0'; - end; -end; - -function TSynGutter.RealGutterWidth(CharWidth: integer): integer; -begin - if not fVisible then - Result := 0 - else if fShowLineNumbers then - Result := fLeftOffset + fRightOffset + fAutoSizeDigitCount * CharWidth + fRightMargin - else if fAutoSize then - Result := fLeftOffset + fRightOffset + fRightMargin - else - Result := fWidth; -end; - -procedure TSynGutter.SetAutoSize(const Value: boolean); -begin - if fAutoSize <> Value then begin - fAutoSize := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetColor(const Value: TColor); -begin - if fColor <> Value then begin - fColor := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetFont(Value: TFont); -begin - fFont.Assign(Value); -end; - -procedure TSynGutter.OnFontChange(Sender: TObject); -begin - if Assigned(fOnChange) then fOnChange(Self); -end; - -procedure TSynGutter.SetDigitCount(Value: integer); -begin - Value := MinMax(Value, 2, 12); - if fDigitCount <> Value then begin - fDigitCount := Value; - fAutoSizeDigitCount := fDigitCount; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetLeadingZeros(const Value: boolean); -begin - if fLeadingZeros <> Value then begin - fLeadingZeros := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetLeftOffset(Value: integer); -begin - Value := Max(0, Value); - if fLeftOffset <> Value then begin - fLeftOffset := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetRightOffset(Value: integer); -begin - Value := Max(0, Value); - if fRightOffset <> Value then begin - fRightOffset := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetRightMargin(Value: integer); -begin - Value := Max(0, Value); - if fRightMargin <> Value then begin - fRightMargin := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetShowLineNumbers(const Value: boolean); -begin - if fShowLineNumbers <> Value then begin - fShowLineNumbers := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetUseFontStyle(Value: boolean); -begin - if fUseFontStyle <> Value then begin - fUseFontStyle := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetVisible(Value: boolean); -begin - if fVisible <> Value then begin - fVisible := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetWidth(Value: integer); -begin - Value := Max(0, Value); - if fWidth <> Value then begin - fWidth := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetZeroStart(const Value: boolean); -begin - if fZeroStart <> Value then begin - fZeroStart := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetBorderStyle(const Value: TSynGutterBorderStyle); -begin - fBorderStyle := Value; - if Assigned(fOnChange) then fOnChange(Self); -end; - -procedure TSynGutter.SetLineNumberStart(const Value: Integer); -begin - if Value <> fLineNumberStart then - begin - fLineNumberStart := Value; - if fLineNumberStart < 0 then - fLineNumberStart := 0; - if fLineNumberStart = 0 then - fZeroStart := True - else - fZeroStart := False; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetBorderColor(const Value: TColor); -begin - if fBorderColor <> Value then - begin - fBorderColor := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetGradient(const Value: Boolean); -begin - if Value <> fGradient then - begin - fGradient := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetGradientEndColor(const Value: TColor); -begin - if Value <> fGradientEndColor then - begin - fGradientEndColor := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetGradientStartColor(const Value: TColor); -begin - if Value <> fGradientStartColor then - begin - fGradientStartColor := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGutter.SetGradientSteps(const Value: Integer); -begin - if Value <> fGradientSteps then - begin - fGradientSteps := Value; - if fGradientSteps < 2 then - fGradientSteps := 2; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -function TSynGutter.GetWidth: integer; -begin - if not Visible then - Result := 0 - else - Result := fWidth; -end; - -{ TSynBookMarkOpt } - -//++ DPI-Aware -procedure TSynBookMarkOpt.ChangeScale(M, D: Integer); -begin - fLeftMargin := MulDiv(fLeftMargin, M, D); - fXoffset := MulDiv(fXoffset, M, D); -end; -//-- DPI-Aware - -constructor TSynBookMarkOpt.Create(AOwner: TComponent); -begin - inherited Create; - fDrawBookmarksFirst := TRUE; - fEnableKeys := True; - fGlyphsVisible := True; - fLeftMargin := 2; - fOwner := AOwner; - fXOffset := 12; -end; - -procedure TSynBookMarkOpt.Assign(Source: TPersistent); -var - Src: TSynBookMarkOpt; -begin - if (Source <> nil) and (Source is TSynBookMarkOpt) then begin - Src := TSynBookMarkOpt(Source); - fBookmarkImages := Src.fBookmarkImages; - fDrawBookmarksFirst := Src.fDrawBookmarksFirst; - fEnableKeys := Src.fEnableKeys; - fGlyphsVisible := Src.fGlyphsVisible; - fLeftMargin := Src.fLeftMargin; - fXoffset := Src.fXoffset; - if Assigned(fOnChange) then fOnChange(Self); - end else - inherited Assign(Source); -end; - -procedure TSynBookMarkOpt.SetBookmarkImages(const Value: TCustomImageList); -begin - if fBookmarkImages <> Value then begin - fBookmarkImages := Value; - if Assigned(fBookmarkImages) then fBookmarkImages.FreeNotification(fOwner); - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynBookMarkOpt.SetDrawBookmarksFirst(Value: boolean); -begin - if Value <> fDrawBookmarksFirst then begin - fDrawBookmarksFirst := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynBookMarkOpt.SetGlyphsVisible(Value: Boolean); -begin - if fGlyphsVisible <> Value then begin - fGlyphsVisible := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynBookMarkOpt.SetLeftMargin(Value: Integer); -begin - if fLeftMargin <> Value then begin - fLeftMargin := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynBookMarkOpt.SetXOffset(Value: integer); -begin - if fXOffset <> Value then begin - fXOffset := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -{ TSynGlyph } - -//++ DPI-Aware -procedure TSynGlyph.ChangeScale(M, D: Integer); -begin - ResizeBitmap(fInternalGlyph, MulDiv(fInternalGlyph.Width, M, D), MulDiv(fInternalGlyph.Height, M, D)); - if not fGlyph.Empty then - ResizeBitmap(fGlyph, MulDiv(fGlyph.Width, M, D), MulDiv(fGlyph.Height, M, D)); -end; -//-- DPI-Aware - -constructor TSynGlyph.Create(aModule: THandle; const aName: string; aMaskColor: TColor); -begin - inherited Create; - - if aName <> '' then - begin - fInternalGlyph := TBitmap.Create; - fInternalGlyph.LoadFromResourceName(aModule, aName); - fInternalMaskColor := aMaskColor; - end - else - fInternalMaskColor := clNone; - - fVisible := True; - fGlyph := TBitmap.Create; - fGlyph.OnChange := GlyphChange; - fMaskColor := clNone; -end; - -destructor TSynGlyph.Destroy; -begin - if Assigned(fInternalGlyph) then - FreeAndNil(fInternalGlyph); - - fGlyph.Free; - - inherited Destroy; -end; - -procedure TSynGlyph.Assign(aSource: TPersistent); -var - vSrc : TSynGlyph; -begin - if Assigned(aSource) and (aSource is TSynGlyph) then - begin - vSrc := TSynGlyph(aSource); - fInternalGlyph := vSrc.fInternalGlyph; - fInternalMaskColor := vSrc.fInternalMaskColor; - fVisible := vSrc.fVisible; - fGlyph := vSrc.fGlyph; - fMaskColor := vSrc.fMaskColor; - if Assigned(fOnChange) then fOnChange(Self); - end - else - inherited; -end; - -procedure TSynGlyph.Draw(aCanvas: TCanvas; aX, aY, aLineHeight: integer); -var - rcSrc, rcDest : TRect; - vGlyph : TBitmap; - vMaskColor : TColor; -begin - if not fGlyph.Empty then - begin - vGlyph := fGlyph; - vMaskColor := fMaskColor; - end - else if Assigned(fInternalGlyph) then - begin - vGlyph := fInternalGlyph; - vMaskColor := fInternalMaskColor; - end - else - Exit; - - if aLineHeight >= vGlyph.Height then - begin - rcSrc := Rect(0, 0, vGlyph.Width, vGlyph.Height); - Inc(aY, (aLineHeight - vGlyph.Height) div 2); - rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + vGlyph.Height); - end - else - begin - rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + aLineHeight); - aY := (vGlyph.Height - aLineHeight) div 2; - rcSrc := Rect(0, aY, vGlyph.Width, aY + aLineHeight); - end; - - aCanvas.BrushCopy(rcDest, vGlyph, rcSrc, vMaskColor); -end; - -procedure TSynGlyph.SetGlyph(Value: TBitmap); -begin - fGlyph.Assign(Value); -end; - -procedure TSynGlyph.GlyphChange(Sender: TObject); -begin - if Assigned(fOnChange) then fOnChange(Self); -end; - -procedure TSynGlyph.SetMaskColor(Value: TColor); -begin - if fMaskColor <> Value then - begin - fMaskColor := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynGlyph.SetVisible(Value: boolean); -begin - if fVisible <> Value then - begin - fVisible := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -function TSynGlyph.GetWidth : integer; -begin - if not fGlyph.Empty then - Result := fGlyph.Width - else - if Assigned(fInternalGlyph) then - Result := fInternalGlyph.Width - else - Result := 0; -end; - -function TSynGlyph.GetHeight : integer; -begin - if not fGlyph.Empty then - Result := fGlyph.Height - else - if Assigned(fInternalGlyph) then - Result := fInternalGlyph.Height - else - Result := 0; -end; - -{ TSynMethodChain } - -procedure TSynMethodChain.Add(AEvent: TMethod); -begin - if not Assigned(@AEvent) then - raise ESynMethodChain.CreateFmt( - '%s.Entry : the parameter `AEvent'' must be specified.', [ClassName]); - - with FNotifyProcs, AEvent do - begin - Add(Code); - Add(Data); - end -end; - -constructor TSynMethodChain.Create; -begin - inherited; - FNotifyProcs := TList.Create; -end; - -destructor TSynMethodChain.Destroy; -begin - FNotifyProcs.Free; - inherited; -end; - -function TSynMethodChain.DoHandleException(E: Exception): Boolean; -begin - if not Assigned(FExceptionHandler) then - raise E - else - try - Result := True; - FExceptionHandler(Self, E, Result); - except - raise ESynMethodChain.CreateFmt( - '%s.DoHandleException : MUST NOT occur any kind of exception in '+ - 'ExceptionHandler', [ClassName]); - end; -end; - -procedure TSynMethodChain.Fire; -var - AMethod: TMethod; - i: Integer; -begin - i := 0; - with FNotifyProcs, AMethod do - while i < Count do - try - repeat - Code := Items[i]; - Inc(i); - Data := Items[i]; - Inc(i); - - DoFire(AMethod) - until i >= Count; - except - on E: Exception do - if not DoHandleException(E) then - i := MaxInt; - end; -end; - -procedure TSynMethodChain.Remove(AEvent: TMethod); -var - i: Integer; -begin - if not Assigned(@AEvent) then - raise ESynMethodChain.CreateFmt( - '%s.Remove: the parameter `AEvent'' must be specified.', [ClassName]); - - with FNotifyProcs, AEvent do - begin - i := Count - 1; - while i > 0 do - if Items[i] <> Data then - Dec(i, 2) - else - begin - Dec(i); - if Items[i] = Code then - begin - Delete(i); - Delete(i); - end; - Dec(i); - end; - end; -end; - -{ TSynNotifyEventChain } - -procedure TSynNotifyEventChain.Add(AEvent: TNotifyEvent); -begin - inherited Add(TMethod(AEvent)); -end; - -constructor TSynNotifyEventChain.CreateEx(ASender: TObject); -begin - inherited Create; - FSender := ASender; -end; - -procedure TSynNotifyEventChain.DoFire(const AEvent: TMethod); -begin - TNotifyEvent(AEvent)(FSender); -end; - -procedure TSynNotifyEventChain.Remove(AEvent: TNotifyEvent); -begin - inherited Remove(TMethod(AEvent)); -end; - - -{ TSynInternalImage } - -type - TInternalResource = class (TObject) - public - UsageCount : Integer; - Name : string; - Bitmap : TBitmap; - end; - -procedure TSynInternalImage.ChangeScale(M, D: Integer); -begin - if M = D then Exit; - - fWidth := MulDiv(fWidth, M, D); - ResizeBitmap(fImages, fWidth * fCount, MulDiv(fImages.Height, M, D)); - fHeight := fImages.Height; -end; - -constructor TSynInternalImage.Create(aModule: THandle; const Name: string; Count: integer); -begin - inherited Create; - fImages := TBitmap.Create; - fImages.LoadFromResourceName(aModule, Name); - fWidth := (fImages.Width + Count shr 1) div Count; - fHeight := fImages.Height; - fCount := Count; -end; - -destructor TSynInternalImage.Destroy; -begin - fImages.Free; - inherited Destroy; -end; - -procedure TSynInternalImage.Draw(ACanvas: TCanvas; - Number, X, Y, LineHeight: integer); -var - rcSrc, rcDest: TRect; -begin - if (Number >= 0) and (Number < fCount) then - begin - if LineHeight >= fHeight then begin - rcSrc := Rect(Number * fWidth, 0, (Number + 1) * fWidth, fHeight); - Inc(Y, (LineHeight - fHeight) div 2); - rcDest := Rect(X, Y, X + fWidth, Y + fHeight); - end else begin - rcDest := Rect(X, Y, X + fWidth, Y + LineHeight); - Y := (fHeight - LineHeight) div 2; - rcSrc := Rect(Number * fWidth, Y, (Number + 1) * fWidth, - Y + LineHeight); - end; - ACanvas.CopyRect(rcDest, fImages.Canvas, rcSrc); - end; -end; - -procedure TSynInternalImage.DrawTransparent(ACanvas: TCanvas; Number, X, Y, - LineHeight: integer; TransparentColor: TColor); -var - rcSrc, rcDest: TRect; -begin - if (Number >= 0) and (Number < fCount) then - begin - if LineHeight >= fHeight then begin - rcSrc := Rect(Number * fWidth, 0, (Number + 1) * fWidth, fHeight); - Inc(Y, (LineHeight - fHeight) div 2); - rcDest := Rect(X, Y, X + fWidth, Y + fHeight); - end else begin - rcDest := Rect(X, Y, X + fWidth, Y + LineHeight); - Y := (fHeight - LineHeight) div 2; - rcSrc := Rect(Number * fWidth, Y, (Number + 1) * fWidth, - Y + LineHeight); - end; - ACanvas.BrushCopy(rcDest, fImages, rcSrc, TransparentColor); - end; -end; - -{ TSynHotKey } - -function KeySameAsShiftState(Key: Word; Shift: TShiftState): Boolean; -begin - Result := (Key = SYNEDIT_SHIFT) and (ssShift in Shift) or - (Key = SYNEDIT_CONTROL) and (ssCtrl in Shift) or - (Key = SYNEDIT_MENU) and (ssAlt in Shift); -end; - -function ModifiersToShiftState(Modifiers: THKModifiers): TShiftState; -begin - Result := []; - if hkShift in Modifiers then Include(Result, ssShift); - if hkCtrl in Modifiers then Include(Result, ssCtrl); - if hkAlt in Modifiers then Include(Result, ssAlt); -end; - -function ShiftStateToTHKInvalidKey(Shift: TShiftState): THKInvalidKey; -begin - Shift := Shift * [ssShift, ssAlt, ssCtrl]; - if Shift = [ssShift] then - Result := hcShift - else if Shift = [ssCtrl] then - Result := hcCtrl - else if Shift = [ssAlt] then - Result := hcAlt - else if Shift = [ssShift, ssCtrl] then - Result := hcShiftCtrl - else if Shift = [ssShift, ssAlt] then - Result := hcShiftAlt - else if Shift = [ssCtrl, ssAlt] then - Result := hcCtrlAlt - else if Shift = [ssShift, ssCtrl, ssAlt] then - Result := hcShiftCtrlAlt - else - Result := hcNone; -end; - -function ShortCutToTextEx(Key: Word; Shift: TShiftState): string; -begin - if ssCtrl in Shift then Result := SmkcCtrl; - if ssShift in Shift then Result := Result + SmkcShift; - if ssAlt in Shift then Result := Result + SmkcAlt; - - Result := Result + ShortCutToText(TShortCut(Key)); - if Result = '' then - Result := srNone; -end; - -constructor TSynHotKey.Create(AOwner: TComponent); -begin - inherited; - - BorderStyle := bsSingle; - ControlStyle := ControlStyle + [csNeedsBorderPaint]; - - FInvalidKeys := [hcNone, hcShift]; - FModifiers := [hkAlt]; - SetHotKey($0041); { Alt+A } - - ParentColor := False; - Color := clWindow; - TabStop := True; -end; - -procedure TSynHotKey.CreateParams(var Params: TCreateParams); -const - BorderStyles: array[TSynBorderStyle] of DWORD = (0, WS_BORDER); - ClassStylesOff = CS_VREDRAW or CS_HREDRAW; -begin - inherited CreateParams(Params); - with Params do - begin - WindowClass.Style := WindowClass.Style and not ClassStylesOff; - Style := Style or BorderStyles[fBorderStyle] or WS_CLIPCHILDREN; - - if NewStyleControls and Ctl3D and (fBorderStyle = bsSingle) then - begin - Style := Style and not WS_BORDER; - ExStyle := ExStyle or WS_EX_CLIENTEDGE; - end; - end; -end; - -procedure TSynHotKey.DoExit; -begin - inherited; - if FPressedOnlyModifiers then - begin - Text := srNone; - Invalidate; - end; -end; - -procedure TSynHotKey.KeyDown(var Key: Word; Shift: TShiftState); -var - MaybeInvalidKey: THKInvalidKey; - SavedKey: Word; -begin - SavedKey := Key; - FPressedOnlyModifiers := KeySameAsShiftState(Key, Shift); - - MaybeInvalidKey := ShiftStateToTHKInvalidKey(Shift); - if MaybeInvalidKey in FInvalidKeys then - Shift := ModifiersToShiftState(FModifiers); - - if not FPressedOnlyModifiers then - begin - FHotKey := ShortCut(Key, Shift) - end - else - begin - FHotKey := 0; - Key := 0; - end; - - if Text <> ShortCutToTextEx(Key, Shift) then - begin - Text := ShortCutToTextEx(Key, Shift); - Invalidate; - SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); - end; - - Key := SavedKey; -end; - -procedure TSynHotKey.KeyUp(var Key: Word; Shift: TShiftState); -begin - if FPressedOnlyModifiers then - begin - Text := srNone; - Invalidate; - SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); - end; -end; - -procedure TSynHotKey.MouseDown(Button: TMouseButton; Shift: TShiftState; X, - Y: Integer); -begin - inherited; - SetFocus; -end; - -procedure TSynHotKey.Paint; -var - r: TRect; -begin - r := ClientRect; - - Canvas.Brush.Style := bsSolid; - Canvas.Brush.Color := Color; - InflateRect(r, -BorderWidth, -BorderWidth); - Canvas.FillRect(r); - Canvas.Font := Font; - Canvas.TextRect(r, BorderWidth + 1, BorderWidth + 1, Text); -end; - -procedure TSynHotKey.SetBorderStyle(const Value: TSynBorderStyle); -begin - if FBorderStyle <> Value then - begin - FBorderStyle := Value; - RecreateWnd; - end; -end; - -procedure TSynHotKey.SetHotKey(const Value: TShortCut); -var - Key: Word; - Shift: TShiftState; - MaybeInvalidKey: THKInvalidKey; -begin - ShortCutToKey(Value, Key, Shift); - - MaybeInvalidKey := ShiftStateToTHKInvalidKey(Shift); - if MaybeInvalidKey in FInvalidKeys then - Shift := ModifiersToShiftState(FModifiers); - - FHotKey := ShortCut(Key, Shift); - Text := ShortCutToTextEx(Key, Shift); - Invalidate; - if not Visible then - SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); -end; - -procedure TSynHotKey.SetInvalidKeys(const Value: THKInvalidKeys); -begin - FInvalidKeys := Value; - SetHotKey(FHotKey); -end; - -procedure TSynHotKey.SetModifiers(const Value: THKModifiers); -begin - FModifiers := Value; - SetHotKey(FHotKey); -end; - -procedure TSynHotKey.WMGetDlgCode(var Message: TMessage); -begin - Message.Result := DLGC_WANTTAB or DLGC_WANTARROWS; -end; - -procedure TSynHotKey.WMKillFocus(var Msg: TWMKillFocus); -begin - DestroyCaret; -end; - -procedure TSynHotKey.WMSetFocus(var Msg: TWMSetFocus); -begin - Canvas.Font := Font; - CreateCaret(Handle, 0, 1, -Canvas.Font.Height + 2); - SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); - ShowCaret(Handle); -end; - -{ TBetterRegistry } - -function TBetterRegistry.OpenKeyReadOnly(const Key: string): Boolean; - - function IsRelative(const Value: string): Boolean; - begin - Result := not ((Value <> '') and (Value[1] = '\')); - end; - -var - TempKey: HKey; - S: string; - Relative: Boolean; -begin - S := Key; - Relative := IsRelative(S); - - if not Relative then Delete(S, 1, 1); - TempKey := 0; - Result := RegOpenKeyEx(GetBaseKey(Relative), PChar(S), 0, - KEY_READ, TempKey) = ERROR_SUCCESS; - if Result then - begin - if (CurrentKey <> 0) and Relative then S := CurrentPath + '\' + S; - ChangeKey(TempKey, S); - end; -end; { TBetterRegistry.OpenKeyReadOnly } - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditMiscClasses.pas, released 2000-04-07. +The Original Code is based on the mwSupportClasses.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Michael Hieke. +Unicode translation by Ma�l H�rz. +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: SynEditMiscClasses.pas,v 1.35.2.9 2008/09/17 13:59:12 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITMISCCLASSES} +unit SynEditMiscClasses; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Consts, + Windows, + Messages, + Graphics, + Controls, + Forms, + StdCtrls, + Menus, + Registry, + SynEditTypes, + SynEditKeyConst, + SynUnicode, +{$IFDEF SYN_COMPILER_4_UP} + Math, +{$ENDIF} + Classes, + SysUtils; + +type + TSynSelectedColor = class(TPersistent) + private + FBG: TColor; + FFG: TColor; + FOnChange: TNotifyEvent; + procedure SetBG(Value: TColor); + procedure SetFG(Value: TColor); + public + constructor Create; + procedure Assign(Source: TPersistent); override; + published + property Background: TColor read FBG write SetBG default clHighLight; + property Foreground: TColor read FFG write SetFG default clHighLightText; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + TSynGutterBorderStyle = (gbsNone, gbsMiddle, gbsRight); + + TSynGutter = class(TPersistent) + private + FFont: TFont; + FColor: TColor; + FBorderColor: TColor; + FWidth: Integer; + FShowLineNumbers: Boolean; + FShowModification: Boolean; + FDigitCount: Integer; + FLeadingZeros: Boolean; + FZeroStart: Boolean; + FLeftOffset: Integer; + FRightOffset: Integer; + FRightMargin: integer; + FOnChange: TNotifyEvent; + FCursor: TCursor; + FVisible: Boolean; + FUseFontStyle: Boolean; + FAutoSize: Boolean; + FAutoSizeDigitCount: Integer; + FBorderStyle: TSynGutterBorderStyle; + FLineNumberStart: Integer; + FGradient: Boolean; + FGradientStartColor: TColor; + FGradientEndColor: TColor; + FGradientSteps: Integer; + FModificationBarWidth: Integer; + FModificationColorModified: TColor; + FModificationColorSaved: TColor; + procedure SetAutoSize(const Value: Boolean); + procedure SetBorderColor(const Value: TColor); + procedure SetColor(const Value: TColor); + procedure SetDigitCount(Value: Integer); + procedure SetLeadingZeros(const Value: Boolean); + procedure SetLeftOffset(Value: Integer); + procedure SetRightOffset(Value: Integer); + procedure SetRightMargin(Value: integer); + procedure SetShowLineNumbers(const Value: Boolean); + procedure SetShowModification(const Value: Boolean); + procedure SetUseFontStyle(Value: Boolean); + procedure SetVisible(Value: Boolean); + procedure SetWidth(Value: Integer); + procedure SetZeroStart(const Value: Boolean); + procedure SetFont(Value: TFont); + procedure OnFontChange(Sender: TObject); + procedure SetBorderStyle(const Value: TSynGutterBorderStyle); + procedure SetLineNumberStart(const Value: Integer); + procedure SetGradient(const Value: Boolean); + procedure SetGradientStartColor(const Value: TColor); + procedure SetGradientEndColor(const Value: TColor); + procedure SetGradientSteps(const Value: Integer); + function GetWidth: Integer; + procedure SetModificationColorModified(const Value: TColor); + procedure SetModificationColorSaved(const Value: TColor); + procedure SetModificationBarWidth(const Value: Integer); + public + constructor Create; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + procedure AutoSizeDigitCount(LinesCount: Integer); + function FormatLineNumber(Line: Integer): string; + function RealGutterWidth(CharWidth: Integer): Integer; +//++ DPI-Aware + procedure ChangeScale(M, D: Integer); virtual; +//-- DPI-Aware + published + property AutoSize: Boolean read FAutoSize write SetAutoSize default FALSE; + property BorderStyle: TSynGutterBorderStyle read FBorderStyle + write SetBorderStyle default gbsMiddle; + property Color: TColor read FColor write SetColor default clBtnFace; + property BorderColor: TColor read FBorderColor write SetBorderColor default clWindow; + property Cursor: TCursor read FCursor write FCursor default crDefault; + property DigitCount: Integer read FDigitCount write SetDigitCount + default 4; + property Font: TFont read FFont write SetFont; + property LeadingZeros: Boolean read FLeadingZeros write SetLeadingZeros + default FALSE; + property LeftOffset: Integer read FLeftOffset write SetLeftOffset + default 16; + property ModificationBarWidth: Integer read FModificationBarWidth + write SetModificationBarWidth default 4; + property ModificationColorModified: TColor read FModificationColorModified + write SetModificationColorModified default clYellow; + property ModificationColorSaved: TColor read FModificationColorSaved + write SetModificationColorSaved default clLime; + property RightOffset: Integer read FRightOffset write SetRightOffset + default 2; + property RightMargin: integer read FRightMargin write SetRightMargin + default 2; + property ShowLineNumbers: Boolean read FShowLineNumbers + write SetShowLineNumbers default FALSE; + property ShowModification: Boolean read FShowModification + write SetShowModification default FALSE; + property UseFontStyle: Boolean read FUseFontStyle write SetUseFontStyle + default True; + property Visible: Boolean read FVisible write SetVisible default TRUE; + property Width: Integer read GetWidth write SetWidth default 30; + property ZeroStart: Boolean read FZeroStart write SetZeroStart + default False; + property LineNumberStart: Integer read FLineNumberStart write SetLineNumberStart default 1; + property Gradient: Boolean read FGradient write SetGradient default False; + property GradientStartColor: TColor read FGradientStartColor write SetGradientStartColor default clWindow; + property GradientEndColor: TColor read FGradientEndColor write SetGradientEndColor default clBtnFace; + property GradientSteps: Integer read FGradientSteps write SetGradientSteps default 48; + + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + TSynBookMarkOpt = class(TPersistent) + private + FBookmarkImages: TImageList; + FDrawBookmarksFirst: Boolean; + FEnableKeys: Boolean; + FGlyphsVisible: Boolean; + FLeftMargin: Integer; + FOwner: TComponent; + FXoffset: Integer; + FOnChange: TNotifyEvent; + procedure SetBookmarkImages(const Value: TImageList); + procedure SetDrawBookmarksFirst(Value: Boolean); + procedure SetGlyphsVisible(Value: Boolean); + procedure SetLeftMargin(Value: Integer); + procedure SetXOffset(Value: Integer); + public + constructor Create(AOwner: TComponent); + procedure Assign(Source: TPersistent); override; +//++ DPI-Aware + procedure ChangeScale(M, D: Integer); virtual; +//-- DPI-Aware + published + property BookmarkImages: TImageList + read FBookmarkImages write SetBookmarkImages; + property DrawBookmarksFirst: Boolean read FDrawBookmarksFirst + write SetDrawBookmarksFirst default True; + property EnableKeys: Boolean + read FEnableKeys write FEnableKeys default True; + property GlyphsVisible: Boolean + read FGlyphsVisible write SetGlyphsVisible default True; + property LeftMargin: Integer read FLeftMargin write SetLeftMargin default 2; + property XOffset: Integer read FXoffset write SetXOffset default 12; + + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + TSynGlyph = class(TPersistent) + private + FVisible: Boolean; + FInternalGlyph, FGlyph: TBitmap; + FInternalMaskColor, FMaskColor: TColor; + FOnChange: TNotifyEvent; + procedure SetGlyph(Value: TBitmap); + procedure GlyphChange(Sender: TObject); + procedure SetMaskColor(Value: TColor); + procedure SetVisible(Value: Boolean); + function GetWidth : Integer; + function GetHeight : Integer; + public + constructor Create(aModule: THandle; const aName: string; aMaskColor: TColor); + destructor Destroy; override; + procedure Assign(aSource: TPersistent); override; + procedure Draw(aCanvas: TCanvas; aX, aY, aLineHeight: Integer); + property Width : Integer read GetWidth; + property Height : Integer read GetHeight; +//++ DPI-Aware + procedure ChangeScale(M, D: Integer); virtual; +//-- DPI-Aware + published + property Glyph: TBitmap read FGlyph write SetGlyph; + property MaskColor: TColor read FMaskColor write SetMaskColor default clNone; + property Visible: Boolean read FVisible write SetVisible default True; + + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + + { TSynMethodChain } + + ESynMethodChain = class(Exception); + TSynExceptionEvent = procedure (Sender: TObject; E: Exception; + var DoContinue: Boolean) of object; + + TSynMethodChain = class(TObject) + private + FNotifyProcs: TList; + FExceptionHandler: TSynExceptionEvent; + protected + procedure DoFire(const AEvent: TMethod); virtual; abstract; + function DoHandleException(E: Exception): Boolean; virtual; + property ExceptionHandler: TSynExceptionEvent read FExceptionHandler + write FExceptionHandler; + public + constructor Create; virtual; + destructor Destroy; override; + procedure Add(AEvent: TMethod); + procedure Remove(AEvent: TMethod); + procedure Fire; + end; + + { TSynNotifyEventChain } + + TSynNotifyEventChain = class(TSynMethodChain) + private + FSender: TObject; + protected + procedure DoFire(const AEvent: TMethod); override; + public + constructor CreateEx(ASender: TObject); + procedure Add(AEvent: TNotifyEvent); + procedure Remove(AEvent: TNotifyEvent); + property ExceptionHandler; + property Sender: TObject read FSender write FSender; + end; + + { TSynInternalImage } + + TSynInternalImage = class(TObject) + private + FImages : TBitmap; + FWidth : Integer; + FHeight : Integer; + FCount : Integer; + + function CreateBitmapFromInternalList(aModule: THandle; const Name: string): TBitmap; + procedure FreeBitmapFromInternalList; + public + constructor Create(aModule: THandle; const Name: string; Count: Integer); + destructor Destroy; override; + + procedure Draw(ACanvas: TCanvas; Number, X, Y, LineHeight: Integer); overload; + procedure DrawTransparent(ACanvas: TCanvas; Number, X, Y, + LineHeight: Integer; TransparentColor: TColor); overload; +//++ DPI-Aware + procedure ChangeScale(M, D: Integer); virtual; +//-- DPI-Aware + end; + +{ TSynHotKey } + +const + BorderWidth = 0; + +type + TSynBorderStyle = TBorderStyle; + + THKModifier = (hkShift, hkCtrl, hkAlt); + THKModifiers = set of THKModifier; + THKInvalidKey = (hcNone, hcShift, hcCtrl, hcAlt, hcShiftCtrl, + hcShiftAlt, hcCtrlAlt, hcShiftCtrlAlt); + THKInvalidKeys = set of THKInvalidKey; + + TSynHotKey = class(TCustomControl) + private + FBorderStyle: TSynBorderStyle; + FHotKey: TShortCut; + FInvalidKeys: THKInvalidKeys; + FModifiers: THKModifiers; + FPressedOnlyModifiers: Boolean; + procedure SetBorderStyle(const Value: TSynBorderStyle); + procedure SetHotKey(const Value: TShortCut); + procedure SetInvalidKeys(const Value: THKInvalidKeys); + procedure SetModifiers(const Value: THKModifiers); + procedure WMGetDlgCode(var Message: TMessage); message WM_GETDLGCODE; + procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; + procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; + protected + procedure DoExit; override; + procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure KeyUp(var Key: Word; Shift: TShiftState); override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Paint; override; + procedure CreateParams(var Params: TCreateParams); override; + public + constructor Create(AOwner: TComponent); override; + published + property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle + default bsSingle; + property HotKey: TShortCut read FHotKey write SetHotKey default $0041; { Alt+A } + property InvalidKeys: THKInvalidKeys read FInvalidKeys write SetInvalidKeys default [hcNone, hcShift]; + property Modifiers: THKModifiers read FModifiers write SetModifiers default [hkAlt]; + end; + + TSynEditSearchCustom = class(TComponent) + protected + function GetPattern: UnicodeString; virtual; abstract; + procedure SetPattern(const Value: UnicodeString); virtual; abstract; + function GetLength(Index: Integer): Integer; virtual; abstract; + function GetResult(Index: Integer): Integer; virtual; abstract; + function GetResultCount: Integer; virtual; abstract; + procedure SetOptions(const Value: TSynSearchOptions); virtual; abstract; + public + function FindAll(const NewText: UnicodeString): Integer; virtual; abstract; + function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; virtual; abstract; + property Pattern: UnicodeString read GetPattern write SetPattern; + property ResultCount: Integer read GetResultCount; + property Results[Index: Integer]: Integer read GetResult; + property Lengths[Index: Integer]: Integer read GetLength; + property Options: TSynSearchOptions write SetOptions; + end; + + {$IFNDEF SYN_COMPILER_4_UP} + TBetterRegistry = class(TRegistry) + function OpenKeyReadOnly(const Key: string): Boolean; + end; + {$ELSE} + TBetterRegistry = TRegistry; + {$ENDIF} + +//++ DPI-Aware + procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, + NewHeight: integer); +//-- DPI-Aware + + +implementation + +uses + SynEditMiscProcs; + +//++ DPI-Aware +procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, + NewHeight: integer); +var + buffer: TBitmap; +begin + buffer := TBitmap.Create; + try + {$IFDEF SYN_COMPILER_12_UP} + buffer.SetSize(NewWidth, NewHeight); + {$ELSE} + buffer.Width := NewWidth; + buffer.Height := NewHeight; + {$ENDIF} + buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap); + {$IFDEF SYN_COMPILER_12_UP} + buffer.SetSize(NewWidth, NewHeight); + {$ELSE} + buffer.Width := NewWidth; + buffer.Height := NewHeight; + {$ENDIF} + Bitmap.Canvas.Draw(0, 0, buffer); + finally + buffer.Free; + end; +end; +//-- DPI-Aware + +{ TSynSelectedColor } + +constructor TSynSelectedColor.Create; +begin + inherited Create; + FBG := clHighLight; + FFG := clHighLightText; +end; + +procedure TSynSelectedColor.Assign(Source: TPersistent); +var + Src: TSynSelectedColor; +begin + if (Source <> nil) and (Source is TSynSelectedColor) then begin + Src := TSynSelectedColor(Source); + FBG := Src.FBG; + FFG := Src.FFG; + if Assigned(FOnChange) then FOnChange(Self); + end else + inherited Assign(Source); +end; + +procedure TSynSelectedColor.SetBG(Value: TColor); +begin + if (FBG <> Value) then begin + FBG := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynSelectedColor.SetFG(Value: TColor); +begin + if (FFG <> Value) then begin + FFG := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +{ TSynGutter } +//++ DPI-Aware +procedure TSynGutter.ChangeScale(M, D: Integer); +begin + fWidth := MulDiv(fWidth, M, D); + fLeftOffset := MulDiv(fLeftOffset, M, D); + fRightOffset := MulDiv(fRightOffset, M, D); + fFont.Height := MulDiv(fFont.Height, M, D); + if Assigned(fOnChange) then fOnChange(Self); +end; +//-- DPI-Aware + + +constructor TSynGutter.Create; +begin + inherited Create; + FFont := TFont.Create; + FFont.Name := 'Courier New'; + FFont.Size := 8; + FFont.Style := []; + FUseFontStyle := True; + FFont.OnChange := OnFontChange; + + FColor := clBtnFace; + FVisible := TRUE; + FWidth := 30; + FLeftOffset := 16; + FDigitCount := 4; + FAutoSizeDigitCount := FDigitCount; + FRightOffset := 2; + FRightMargin := 2; + FBorderColor := clWindow; + FBorderStyle := gbsMiddle; + FLineNumberStart := 1; + FZeroStart := False; + FGradient := False; + FGradientStartColor := clWindow; + FGradientEndColor := clBtnFace; + FGradientSteps := 48; + + FShowModification := FALSE; + FModificationBarWidth := 4; + FModificationColorModified := clYellow; + FModificationColorSaved := clLime; +end; + +destructor TSynGutter.Destroy; +begin + FFont.Free; + inherited Destroy; +end; + +procedure TSynGutter.Assign(Source: TPersistent); +var + Src: TSynGutter; +begin + if Assigned(Source) and (Source is TSynGutter) then + begin + Src := TSynGutter(Source); + FFont.Assign(src.Font); + FUseFontStyle := src.FUseFontStyle; + FColor := Src.FColor; + FVisible := Src.FVisible; + FWidth := Src.FWidth; + FShowLineNumbers := Src.FShowLineNumbers; + FLeadingZeros := Src.FLeadingZeros; + FZeroStart := Src.FZeroStart; + FLeftOffset := Src.FLeftOffset; + FDigitCount := Src.FDigitCount; + FRightOffset := Src.FRightOffset; + FRightMargin := Src.FRightMargin; + FAutoSize := Src.FAutoSize; + FAutoSizeDigitCount := Src.FAutoSizeDigitCount; + FLineNumberStart := Src.FLineNumberStart; + FBorderColor := Src.FBorderColor; + FBorderStyle := Src.FBorderStyle; + FGradient := Src.FGradient; + FGradientStartColor := Src.FGradientStartColor; + FGradientEndColor := Src.FGradientEndColor; + FGradientSteps := Src.FGradientSteps; + if Assigned(FOnChange) then FOnChange(Self); + end + else + inherited; +end; + +procedure TSynGutter.AutoSizeDigitCount(LinesCount: Integer); +var + nDigits: Integer; +begin + if FVisible and FAutoSize and FShowLineNumbers then + begin + if FZeroStart then + Dec(LinesCount) + else if FLineNumberStart > 1 then + Inc(LinesCount, FLineNumberStart - 1); + + nDigits := Max(Length(IntToStr(LinesCount)), FDigitCount); + if FAutoSizeDigitCount <> nDigits then begin + FAutoSizeDigitCount := nDigits; + if Assigned(FOnChange) then FOnChange(Self); + end; + end else + FAutoSizeDigitCount := FDigitCount; +end; + +function TSynGutter.FormatLineNumber(Line: Integer): string; +var + i: Integer; +begin + if FZeroStart then + Dec(Line) + else if FLineNumberStart > 1 then + Inc(Line, FLineNumberStart - 1); + Result := Format('%*d', [FAutoSizeDigitCount, Line]); + if FLeadingZeros then + for i := 1 to FAutoSizeDigitCount - 1 do + begin + if (Result[i] <> ' ') then + Break; + Result[i] := '0'; + end; +end; + +function TSynGutter.RealGutterWidth(CharWidth: Integer): Integer; +begin + if not FVisible then + Result := 0 + else + begin + if FShowLineNumbers then + Result := FLeftOffset + FRightOffset + FAutoSizeDigitCount * CharWidth + FRightMargin + else if FAutoSize then + Result := FLeftOffset + FRightOffset + FRightMargin + else + Result := FWidth; + + // take modification indicator into account + if FShowModification then + Result := Result + FModificationBarWidth; + end; +end; + +procedure TSynGutter.SetAutoSize(const Value: Boolean); +begin + if FAutoSize <> Value then begin + FAutoSize := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetColor(const Value: TColor); +begin + if FColor <> Value then begin + FColor := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetFont(Value: TFont); +begin + FFont.Assign(Value); +end; + +procedure TSynGutter.OnFontChange(Sender: TObject); +begin + if Assigned(FOnChange) then FOnChange(Self); +end; + +procedure TSynGutter.SetDigitCount(Value: Integer); +begin + Value := MinMax(Value, 2, 12); + if FDigitCount <> Value then begin + FDigitCount := Value; + FAutoSizeDigitCount := FDigitCount; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetLeadingZeros(const Value: Boolean); +begin + if FLeadingZeros <> Value then begin + FLeadingZeros := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetLeftOffset(Value: Integer); +begin + Value := Max(0, Value); + if FLeftOffset <> Value then begin + FLeftOffset := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetRightOffset(Value: Integer); +begin + Value := Max(0, Value); + if FRightOffset <> Value then begin + FRightOffset := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetRightMargin(Value: integer); +begin + Value := Max(0, Value); + if fRightMargin <> Value then begin + fRightMargin := Value; + if Assigned(fOnChange) then fOnChange(Self); + end; +end; + +procedure TSynGutter.SetShowLineNumbers(const Value: Boolean); +begin + if FShowLineNumbers <> Value then begin + FShowLineNumbers := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetShowModification(const Value: Boolean); +begin + if FShowModification <> Value then begin + FShowModification := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetUseFontStyle(Value: Boolean); +begin + if FUseFontStyle <> Value then begin + FUseFontStyle := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetVisible(Value: Boolean); +begin + if FVisible <> Value then begin + FVisible := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetWidth(Value: Integer); +begin + Value := Max(0, Value); + if FWidth <> Value then begin + FWidth := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetZeroStart(const Value: Boolean); +begin + if FZeroStart <> Value then begin + FZeroStart := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetBorderStyle(const Value: TSynGutterBorderStyle); +begin + FBorderStyle := Value; + if Assigned(FOnChange) then FOnChange(Self); +end; + +procedure TSynGutter.SetLineNumberStart(const Value: Integer); +begin + if Value <> FLineNumberStart then + begin + FLineNumberStart := Value; + if FLineNumberStart < 0 then + FLineNumberStart := 0; + if FLineNumberStart = 0 then + FZeroStart := True + else + FZeroStart := False; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetModificationBarWidth(const Value: Integer); +begin + if FModificationBarWidth <> Value then + begin + FModificationBarWidth := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetModificationColorModified(const Value: TColor); +begin + if FModificationColorModified <> Value then + begin + FModificationColorModified := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetModificationColorSaved(const Value: TColor); +begin + if FModificationColorSaved <> Value then + begin + FModificationColorSaved := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetBorderColor(const Value: TColor); +begin + if FBorderColor <> Value then + begin + FBorderColor := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetGradient(const Value: Boolean); +begin + if Value <> FGradient then + begin + FGradient := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetGradientEndColor(const Value: TColor); +begin + if Value <> FGradientEndColor then + begin + FGradientEndColor := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetGradientStartColor(const Value: TColor); +begin + if Value <> FGradientStartColor then + begin + FGradientStartColor := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGutter.SetGradientSteps(const Value: Integer); +begin + if Value <> FGradientSteps then + begin + FGradientSteps := Value; + if FGradientSteps < 2 then + FGradientSteps := 2; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +function TSynGutter.GetWidth: Integer; +begin + if not Visible then + Result := 0 + else + Result := FWidth; +end; + +{ TSynBookMarkOpt } + +//++ DPI-Aware +procedure TSynBookMarkOpt.ChangeScale(M, D: Integer); +Var + L : Integer; +begin + L := (M div D) * D; // Factor multiple of 100% + fLeftMargin := MulDiv(fLeftMargin, L, D); + fXoffset := MulDiv(fXoffset, L, D); +end; +//-- DPI-Aware + +constructor TSynBookMarkOpt.Create(AOwner: TComponent); +begin + inherited Create; + FDrawBookmarksFirst := TRUE; + FEnableKeys := True; + FGlyphsVisible := True; + FLeftMargin := 2; + FOwner := AOwner; + FXoffset := 12; +end; + +procedure TSynBookMarkOpt.Assign(Source: TPersistent); +var + Src: TSynBookMarkOpt; +begin + if (Source <> nil) and (Source is TSynBookMarkOpt) then begin + Src := TSynBookMarkOpt(Source); + FBookmarkImages := Src.FBookmarkImages; + FDrawBookmarksFirst := Src.FDrawBookmarksFirst; + FEnableKeys := Src.FEnableKeys; + FGlyphsVisible := Src.FGlyphsVisible; + FLeftMargin := Src.FLeftMargin; + FXoffset := Src.FXoffset; + if Assigned(FOnChange) then FOnChange(Self); + end else + inherited Assign(Source); +end; + +procedure TSynBookMarkOpt.SetBookmarkImages(const Value: TImageList); +begin + if FBookmarkImages <> Value then begin + FBookmarkImages := Value; + if Assigned(FBookmarkImages) then FBookmarkImages.FreeNotification(FOwner); + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynBookMarkOpt.SetDrawBookmarksFirst(Value: Boolean); +begin + if Value <> FDrawBookmarksFirst then begin + FDrawBookmarksFirst := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynBookMarkOpt.SetGlyphsVisible(Value: Boolean); +begin + if FGlyphsVisible <> Value then begin + FGlyphsVisible := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynBookMarkOpt.SetLeftMargin(Value: Integer); +begin + if FLeftMargin <> Value then begin + FLeftMargin := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynBookMarkOpt.SetXOffset(Value: Integer); +begin + if FXoffset <> Value then begin + FXoffset := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +{ TSynGlyph } + +//++ DPI-Aware +procedure TSynGlyph.ChangeScale(M, D: Integer); +Var + L : Integer; +begin + L := (M div D) * D; // Factor multiple of 100% + ResizeBitmap(fInternalGlyph, MulDiv(fInternalGlyph.Width, L, D), MulDiv(fInternalGlyph.Height, L, D)); + ResizeBitmap(fGlyph, MulDiv(fGlyph.Width, L, D), MulDiv(fGlyph.Height, L, D)); +end; +//-- DPI-Aware + +constructor TSynGlyph.Create(aModule: THandle; const aName: string; aMaskColor: TColor); +begin + inherited Create; + + if aName <> '' then + begin + FInternalGlyph := TBitmap.Create; + FInternalGlyph.LoadFromResourceName(aModule, aName); + FInternalMaskColor := aMaskColor; + end + else + FInternalMaskColor := clNone; + + FVisible := True; + FGlyph := TBitmap.Create; + FGlyph.OnChange := GlyphChange; + FMaskColor := clNone; +end; + +destructor TSynGlyph.Destroy; +begin + if Assigned(FInternalGlyph) then + FreeAndNil(FInternalGlyph); + + FGlyph.Free; + + inherited Destroy; +end; + +procedure TSynGlyph.Assign(aSource: TPersistent); +var + vSrc : TSynGlyph; +begin + if Assigned(aSource) and (aSource is TSynGlyph) then + begin + vSrc := TSynGlyph(aSource); + FInternalGlyph := vSrc.FInternalGlyph; + FInternalMaskColor := vSrc.FInternalMaskColor; + FVisible := vSrc.FVisible; + FGlyph := vSrc.FGlyph; + FMaskColor := vSrc.FMaskColor; + if Assigned(FOnChange) then FOnChange(Self); + end + else + inherited; +end; + +procedure TSynGlyph.Draw(aCanvas: TCanvas; aX, aY, aLineHeight: Integer); +var + rcSrc, rcDest : TRect; + vGlyph : TBitmap; + vMaskColor : TColor; +begin + if not FGlyph.Empty then + begin + vGlyph := FGlyph; + vMaskColor := FMaskColor; + end + else if Assigned(FInternalGlyph) then + begin + vGlyph := FInternalGlyph; + vMaskColor := FInternalMaskColor; + end + else + Exit; + + if aLineHeight >= vGlyph.Height then + begin + rcSrc := Rect(0, 0, vGlyph.Width, vGlyph.Height); + Inc(aY, (aLineHeight - vGlyph.Height) div 2); + rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + vGlyph.Height); + end + else + begin + rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + aLineHeight); + aY := (vGlyph.Height - aLineHeight) div 2; + rcSrc := Rect(0, aY, vGlyph.Width, aY + aLineHeight); + end; + + aCanvas.BrushCopy(rcDest, vGlyph, rcSrc, vMaskColor); +end; + +procedure TSynGlyph.SetGlyph(Value: TBitmap); +begin + FGlyph.Assign(Value); +end; + +procedure TSynGlyph.GlyphChange(Sender: TObject); +begin + if Assigned(FOnChange) then FOnChange(Self); +end; + +procedure TSynGlyph.SetMaskColor(Value: TColor); +begin + if FMaskColor <> Value then + begin + FMaskColor := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +procedure TSynGlyph.SetVisible(Value: Boolean); +begin + if FVisible <> Value then + begin + FVisible := Value; + if Assigned(FOnChange) then FOnChange(Self); + end; +end; + +function TSynGlyph.GetWidth : Integer; +begin + if not FGlyph.Empty then + Result := FGlyph.Width + else + if Assigned(FInternalGlyph) then + Result := FInternalGlyph.Width + else + Result := 0; +end; + +function TSynGlyph.GetHeight : Integer; +begin + if not FGlyph.Empty then + Result := FGlyph.Height + else + if Assigned(FInternalGlyph) then + Result := FInternalGlyph.Height + else + Result := 0; +end; + +{ TSynMethodChain } + +procedure TSynMethodChain.Add(AEvent: TMethod); +begin + if not Assigned(@AEvent) then + raise ESynMethodChain.CreateFmt( + '%s.Entry : the parameter `AEvent'' must be specified.', [ClassName]); + + with FNotifyProcs, AEvent do + begin + Add(Code); + Add(Data); + end +end; + +constructor TSynMethodChain.Create; +begin + inherited; + FNotifyProcs := TList.Create; +end; + +destructor TSynMethodChain.Destroy; +begin + FNotifyProcs.Free; + inherited; +end; + +function TSynMethodChain.DoHandleException(E: Exception): Boolean; +begin + if not Assigned(FExceptionHandler) then + raise E + else + try + Result := True; + FExceptionHandler(Self, E, Result); + except + raise ESynMethodChain.CreateFmt( + '%s.DoHandleException : MUST NOT occur any kind of exception in '+ + 'ExceptionHandler', [ClassName]); + end; +end; + +procedure TSynMethodChain.Fire; +var + AMethod: TMethod; + i: Integer; +begin + i := 0; + with FNotifyProcs, AMethod do + while i < Count do + try + repeat + Code := Items[i]; + Inc(i); + Data := Items[i]; + Inc(i); + + DoFire(AMethod) + until i >= Count; + except + on E: Exception do + if not DoHandleException(E) then + i := MaxInt; + end; +end; + +procedure TSynMethodChain.Remove(AEvent: TMethod); +var + i: Integer; +begin + if not Assigned(@AEvent) then + raise ESynMethodChain.CreateFmt( + '%s.Remove: the parameter `AEvent'' must be specified.', [ClassName]); + + with FNotifyProcs, AEvent do + begin + i := Count - 1; + while i > 0 do + if Items[i] <> Data then + Dec(i, 2) + else + begin + Dec(i); + if Items[i] = Code then + begin + Delete(i); + Delete(i); + end; + Dec(i); + end; + end; +end; + +{ TSynNotifyEventChain } + +procedure TSynNotifyEventChain.Add(AEvent: TNotifyEvent); +begin + inherited Add(TMethod(AEvent)); +end; + +constructor TSynNotifyEventChain.CreateEx(ASender: TObject); +begin + inherited Create; + FSender := ASender; +end; + +procedure TSynNotifyEventChain.DoFire(const AEvent: TMethod); +begin + TNotifyEvent(AEvent)(FSender); +end; + +procedure TSynNotifyEventChain.Remove(AEvent: TNotifyEvent); +begin + inherited Remove(TMethod(AEvent)); +end; + + +{ TSynInternalImage } + +type + TInternalResource = class (TObject) + public + UsageCount : Integer; + Name : string; + Bitmap : TBitmap; + end; + +var + InternalResources: TList; + +//++ DPI-Aware +procedure TSynInternalImage.ChangeScale(M, D: Integer); +Var + L: Integer; +begin + L := (M div D) * D; // Factor multiple of 100% + fWidth := MulDiv(fWidth, L, D); + ResizeBitmap(fImages, fWidth * fCount, MulDiv(fImages.Height, L, D)); + fHeight := fImages.Height; +end; +//-- DPI-Aware + +constructor TSynInternalImage.Create(aModule: THandle; const Name: string; + Count: Integer); +begin + inherited Create; + FImages := CreateBitmapFromInternalList(aModule, Name); + FWidth := (FImages.Width + Count shr 1) div Count; + FHeight := FImages.Height; + FCount := Count; +end; + +destructor TSynInternalImage.Destroy; +begin + FreeBitmapFromInternalList; + inherited Destroy; +end; + +function TSynInternalImage.CreateBitmapFromInternalList(aModule: THandle; + const Name: string): TBitmap; +var + idx: Integer; + newIntRes: TInternalResource; +begin + { There is no list until now } + if (InternalResources = nil) then + InternalResources := TList.Create; + + { Search the list for the needed resource } + for idx := 0 to InternalResources.Count - 1 do + if (TInternalResource(InternalResources[idx]).Name = UpperCase(Name)) then + with TInternalResource(InternalResources[idx]) do begin + UsageCount := UsageCount + 1; + Result := Bitmap; + Exit; + end; + + { There is no loaded resource in the list so let's create a new one } + Result := TBitmap.Create; + Result.LoadFromResourceName(aModule, Name); + + { Add the new resource to our list } + newIntRes:= TInternalResource.Create; + newIntRes.UsageCount := 1; + newIntRes.Name := UpperCase(Name); + newIntRes.Bitmap := Result; + InternalResources.Add(newIntRes); +end; + +procedure TSynInternalImage.FreeBitmapFromInternalList; +var + idx: Integer; + intRes: TInternalResource; + function FindImageInList: Integer; + begin + for Result := 0 to InternalResources.Count - 1 do + if (TInternalResource (InternalResources[Result]).Bitmap = FImages) then + Exit; + Result := -1; + end; +begin + { Search the index of our resource in the list } + idx := FindImageInList; + + { Ey, what's this ???? } + if (idx = -1) then + Exit; + + { Decrement the usagecount in the object. If there are no more users + remove the object from the list and free it } + intRes := TInternalResource (InternalResources[idx]); + with intRes do begin + UsageCount := UsageCount - 1; + if (UsageCount = 0) then begin + Bitmap.Free; + InternalResources.Delete (idx); + intRes.Free; + end; + end; + + { If there are no more entries in the list free it } + if (InternalResources.Count = 0) then begin + InternalResources.Free; + InternalResources := nil; + end; +end; + +procedure TSynInternalImage.Draw(ACanvas: TCanvas; + Number, X, Y, LineHeight: Integer); +var + rcSrc, rcDest: TRect; +begin + if (Number >= 0) and (Number < FCount) then + begin + if LineHeight >= FHeight then begin + rcSrc := Rect(Number * FWidth, 0, (Number + 1) * FWidth, FHeight); + Inc(Y, (LineHeight - FHeight) div 2); + rcDest := Rect(X, Y, X + FWidth, Y + FHeight); + end else begin + rcDest := Rect(X, Y, X + FWidth, Y + LineHeight); + Y := (FHeight - LineHeight) div 2; + rcSrc := Rect(Number * FWidth, Y, (Number + 1) * FWidth, + Y + LineHeight); + end; + ACanvas.CopyRect(rcDest, FImages.Canvas, rcSrc); + end; +end; + +procedure TSynInternalImage.DrawTransparent(ACanvas: TCanvas; Number, X, Y, + LineHeight: Integer; TransparentColor: TColor); +var + rcSrc, rcDest: TRect; +begin + if (Number >= 0) and (Number < FCount) then + begin + if LineHeight >= FHeight then begin + rcSrc := Rect(Number * FWidth, 0, (Number + 1) * FWidth, FHeight); + Inc(Y, (LineHeight - FHeight) div 2); + rcDest := Rect(X, Y, X + FWidth, Y + FHeight); + end else begin + rcDest := Rect(X, Y, X + FWidth, Y + LineHeight); + Y := (FHeight - LineHeight) div 2; + rcSrc := Rect(Number * FWidth, Y, (Number + 1) * FWidth, + Y + LineHeight); + end; + ACanvas.BrushCopy(rcDest, FImages, rcSrc, TransparentColor); + end; +end; + + +{ TSynHotKey } + +function KeySameAsShiftState(Key: Word; Shift: TShiftState): Boolean; +begin + Result := (Key = SYNEDIT_SHIFT) and (ssShift in Shift) or + (Key = SYNEDIT_CONTROL) and (ssCtrl in Shift) or + (Key = SYNEDIT_MENU) and (ssAlt in Shift); +end; + +function ModifiersToShiftState(Modifiers: THKModifiers): TShiftState; +begin + Result := []; + if hkShift in Modifiers then Include(Result, ssShift); + if hkCtrl in Modifiers then Include(Result, ssCtrl); + if hkAlt in Modifiers then Include(Result, ssAlt); +end; + +function ShiftStateToTHKInvalidKey(Shift: TShiftState): THKInvalidKey; +begin + Shift := Shift * [ssShift, ssAlt, ssCtrl]; + if Shift = [ssShift] then + Result := hcShift + else if Shift = [ssCtrl] then + Result := hcCtrl + else if Shift = [ssAlt] then + Result := hcAlt + else if Shift = [ssShift, ssCtrl] then + Result := hcShiftCtrl + else if Shift = [ssShift, ssAlt] then + Result := hcShiftAlt + else if Shift = [ssCtrl, ssAlt] then + Result := hcCtrlAlt + else if Shift = [ssShift, ssCtrl, ssAlt] then + Result := hcShiftCtrlAlt + else + Result := hcNone; +end; + +function ShortCutToTextEx(Key: Word; Shift: TShiftState): UnicodeString; +begin + if ssCtrl in Shift then Result := SmkcCtrl; + if ssShift in Shift then Result := Result + SmkcShift; + if ssAlt in Shift then Result := Result + SmkcAlt; + + Result := Result + ShortCutToText(TShortCut(Key)); + if Result = '' then + Result := srNone; +end; + +constructor TSynHotKey.Create(AOwner: TComponent); +begin + inherited; + + BorderStyle := bsSingle; + {$IFDEF SYN_COMPILER_7_UP} + ControlStyle := ControlStyle + [csNeedsBorderPaint]; + {$ENDIF} + + FInvalidKeys := [hcNone, hcShift]; + FModifiers := [hkAlt]; + SetHotKey($0041); { Alt+A } + + ParentColor := False; + Color := clWindow; + TabStop := True; +end; + +procedure TSynHotKey.CreateParams(var Params: TCreateParams); +const + BorderStyles: array[TSynBorderStyle] of DWORD = (0, WS_BORDER); + ClassStylesOff = CS_VREDRAW or CS_HREDRAW; +begin + inherited CreateParams(Params); + with Params do + begin + WindowClass.Style := WindowClass.Style and not ClassStylesOff; + Style := Style or BorderStyles[FBorderStyle] or WS_CLIPCHILDREN; + + if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then + begin + Style := Style and not WS_BORDER; + ExStyle := ExStyle or WS_EX_CLIENTEDGE; + end; + end; +end; + +procedure TSynHotKey.DoExit; +begin + inherited; + if FPressedOnlyModifiers then + begin + Text := srNone; + Invalidate; + end; +end; + +procedure TSynHotKey.KeyDown(var Key: Word; Shift: TShiftState); +var + MaybeInvalidKey: THKInvalidKey; + SavedKey: Word; + {$IFDEF SYN_LINUX} + Code: Byte; + {$ENDIF} +begin + {$IFDEF SYN_LINUX} + // uniform Keycode: key has the same value wether Shift is pressed or not + if Key <= 255 then + begin + Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); + Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); + if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); + end; + {$ENDIF} + + SavedKey := Key; + FPressedOnlyModifiers := KeySameAsShiftState(Key, Shift); + + MaybeInvalidKey := ShiftStateToTHKInvalidKey(Shift); + if MaybeInvalidKey in FInvalidKeys then + Shift := ModifiersToShiftState(FModifiers); + + if not FPressedOnlyModifiers then + begin + FHotKey := ShortCut(Key, Shift) + end + else + begin + FHotKey := 0; + Key := 0; + end; + + if Text <> ShortCutToTextEx(Key, Shift) then + begin + Text := ShortCutToTextEx(Key, Shift); + Invalidate; + SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + end; + + Key := SavedKey; +end; + +procedure TSynHotKey.KeyUp(var Key: Word; Shift: TShiftState); +{$IFDEF SYN_LINUX} +var + Code: Byte; +{$ENDIF} +begin + {$IFDEF SYN_LINUX} + // uniform Keycode: key has the same value wether Shift is pressed or not + if Key <= 255 then + begin + Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); + Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); + if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); + end; + {$ENDIF} + + if FPressedOnlyModifiers then + begin + Text := srNone; + Invalidate; + SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + end; +end; + +procedure TSynHotKey.MouseDown(Button: TMouseButton; Shift: TShiftState; X, + Y: Integer); +begin + inherited; + SetFocus; +end; + +procedure TSynHotKey.Paint; +var + r: TRect; +begin + r := ClientRect; + + Canvas.Brush.Style := bsSolid; + Canvas.Brush.Color := Color; + InflateRect(r, -BorderWidth, -BorderWidth); + Canvas.FillRect(r); + TextRect(Canvas, r, BorderWidth + 1, BorderWidth + 1, Text); +end; + +procedure TSynHotKey.SetBorderStyle(const Value: TSynBorderStyle); +begin + if FBorderStyle <> Value then + begin + FBorderStyle := Value; + RecreateWnd; + end; +end; + +procedure TSynHotKey.SetHotKey(const Value: TShortCut); +var + Key: Word; + Shift: TShiftState; + MaybeInvalidKey: THKInvalidKey; +begin + ShortCutToKey(Value, Key, Shift); + + MaybeInvalidKey := ShiftStateToTHKInvalidKey(Shift); + if MaybeInvalidKey in FInvalidKeys then + Shift := ModifiersToShiftState(FModifiers); + + FHotKey := ShortCut(Key, Shift); + Text := ShortCutToTextEx(Key, Shift); + Invalidate; + if not Visible then + SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); +end; + +procedure TSynHotKey.SetInvalidKeys(const Value: THKInvalidKeys); +begin + FInvalidKeys := Value; + SetHotKey(FHotKey); +end; + +procedure TSynHotKey.SetModifiers(const Value: THKModifiers); +begin + FModifiers := Value; + SetHotKey(FHotKey); +end; + +procedure TSynHotKey.WMGetDlgCode(var Message: TMessage); +begin + Message.Result := DLGC_WANTTAB or DLGC_WANTARROWS; +end; + +procedure TSynHotKey.WMKillFocus(var Msg: TWMKillFocus); +begin + DestroyCaret; +end; + +procedure TSynHotKey.WMSetFocus(var Msg: TWMSetFocus); +begin + Canvas.Font := Font; + CreateCaret(Handle, 0, 1, -Canvas.Font.Height + 2); + SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + ShowCaret(Handle); +end; + + +{$IFNDEF SYN_COMPILER_4_UP} + +{ TBetterRegistry } + +function TBetterRegistry.OpenKeyReadOnly(const Key: string): Boolean; + + function IsRelative(const Value: string): Boolean; + begin + Result := not ((Value <> '') and (Value[1] = '\')); + end; + +var + TempKey: HKey; + S: string; + Relative: Boolean; +begin + S := Key; + Relative := IsRelative(S); + + if not Relative then Delete(S, 1, 1); + TempKey := 0; + Result := RegOpenKeyEx(GetBaseKey(Relative), PChar(S), 0, + KEY_READ, TempKey) = ERROR_SUCCESS; + if Result then + begin + if (CurrentKey <> 0) and Relative then S := CurrentPath + '\' + S; + ChangeKey(TempKey, S); + end; +end; { TBetterRegistry.OpenKeyReadOnly } + +{$ENDIF SYN_COMPILER_4_UP} + +begin + InternalResources := nil; +end. diff --git a/Source/VCL/SynEdit/Source/SynEditMiscProcs.pas b/Source/VCL/SynEdit/Source/SynEditMiscProcs.pas index fcb42402..340701e2 100644 --- a/Source/VCL/SynEdit/Source/SynEditMiscProcs.pas +++ b/Source/VCL/SynEdit/Source/SynEditMiscProcs.pas @@ -1,857 +1,963 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditMiscProcs.pas, released 2000-04-07. -The Original Code is based on the mwSupportProcs.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Unicode translation by Maël Hörz. -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: SynEditMiscProcs.pas,v 1.35.2.8 2009/09/28 17:54:20 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditMiscProcs; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - Math, - Classes; - -const - MaxIntArraySize = MaxInt div 16; - -type - PIntArray = ^TIntArray; - TIntArray = array[0..MaxIntArraySize - 1] of Integer; - -function MinMax(x, mi, ma: Integer): Integer; -procedure SwapInt(var l, r: Integer); -function MaxPoint(const P1, P2: TPoint): TPoint; -function MinPoint(const P1, P2: TPoint): TPoint; - -function GetIntArray(Count: Cardinal; InitialValue: integer): PIntArray; - -procedure InternalFillRect(dc: HDC; const rcPaint: TRect); - -// Converting tabs to spaces: To use the function several times it's better -// to use a function pointer that is set to the fastest conversion function. -type - TConvertTabsProc = function(const Line: string; - TabWidth: Integer): string; - -function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; -// This is the slowest conversion function which can handle TabWidth <> 2^n. -function ConvertTabs(const Line: string; TabWidth: Integer): string; - -type - TConvertTabsProcEx = function(const Line: string; TabWidth: Integer; - var HasTabs: Boolean): string; - -function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; -// This is the slowest conversion function which can handle TabWidth <> 2^n. -function ConvertTabsEx(const Line: string; TabWidth: Integer; - var HasTabs: Boolean): string; - -function GetExpandedLength(const aStr: string; aTabWidth: Integer): Integer; - -function CharIndex2CaretPos(Index, TabWidth: Integer; - const Line: string): Integer; -function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: string; - var InsideTabChar: Boolean): Integer; - -// search for the first char of set AChars in Line, starting at index Start -function StrScanForCharInCategory(const Line: string; Start: Integer; - IsOfCategory: TCategoryMethod): Integer; -// the same, but searching backwards -function StrRScanForCharInCategory(const Line: string; Start: Integer; - IsOfCategory: TCategoryMethod): Integer; - -function GetEOL(Line: PWideChar): PWideChar; - -// Remove all '/' characters from string by changing them into '\.'. -// Change all '\' characters into '\\' to allow for unique decoding. -function EncodeString(s: string): string; - -// Decodes string, encoded with EncodeString. -function DecodeString(s: string): string; - -type - THighlighterAttriProc = function (Highlighter: TSynCustomHighlighter; - Attri: TSynHighlighterAttributes; UniqueAttriName: string; - Params: array of Pointer): Boolean of object; - -// Enums all child highlighters and their attributes of a TSynMultiSyn through a -// callback function. -// This function also handles nested TSynMultiSyns including their MarkerAttri. -function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; - SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; - Params: array of Pointer): Boolean; - -{$IFDEF SYN_HEREDOC} -// Calculates Frame Check Sequence (FCS) 16-bit Checksum (as defined in RFC 1171) -function CalcFCS(const ABuf; ABufSize: Cardinal): Word; -{$ENDIF} - -procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, AEndColor: TColor; - ASteps: Integer; const ARect: TRect; const AHorizontal: Boolean); - -function DeleteTypePrefixAndSynSuffix(S: string): string; - -// In Windows Vista or later use the Consolas font -function DefaultFontName: string; - -implementation - -uses - SysUtils, - SynHighlighterMulti; - -function MinMax(x, mi, ma: Integer): Integer; -begin - x := Min(x, ma); - Result := Max(x, mi); -end; - -procedure SwapInt(var l, r: Integer); -var - tmp: Integer; -begin - tmp := r; - r := l; - l := tmp; -end; - -function MaxPoint(const P1, P2: TPoint): TPoint; -begin - if (P2.y > P1.y) or ((P2.y = P1.y) and (P2.x > P1.x)) then - Result := P2 - else - Result := P1; -end; - -function MinPoint(const P1, P2: TPoint): TPoint; -begin - if (P2.y < P1.y) or ((P2.y = P1.y) and (P2.x < P1.x)) then - Result := P2 - else - Result := P1; -end; - -function GetIntArray(Count: Cardinal; InitialValue: Integer): PIntArray; -var - p: PInteger; -begin - Result := AllocMem(Count * SizeOf(Integer)); - if Assigned(Result) and (InitialValue <> 0) then - begin - p := PInteger(Result); - while (Count > 0) do - begin - p^ := InitialValue; - Inc(p); - Dec(Count); - end; - end; -end; - -procedure InternalFillRect(dc: HDC; const rcPaint: TRect); -begin - ExtTextOut(dc, 0, 0, ETO_OPAQUE, @rcPaint, nil, 0, nil); -end; - -// Please don't change this function; no stack frame and efficient register use. -function GetHasTabs(pLine: PWideChar; var CharsBefore: Integer): Boolean; -begin - CharsBefore := 0; - if Assigned(pLine) then - begin - while pLine^ <> #0 do - begin - if pLine^ = #9 then break; - Inc(CharsBefore); - Inc(pLine); - end; - Result := pLine^ = #9; - end - else - Result := False; -end; - - -function ConvertTabs1Ex(const Line: string; TabWidth: Integer; - var HasTabs: Boolean): string; -var - pDest: PWideChar; - nBeforeTab: Integer; -begin - Result := Line; // increment reference count only - if GetHasTabs(pointer(Line), nBeforeTab) then - begin - HasTabs := True; - pDest := @Result[nBeforeTab + 1]; // this will make a copy of Line - // We have at least one tab in the string, and the tab width is 1. - // pDest points to the first tab char. We overwrite all tabs with spaces. - repeat - if (pDest^ = #9) then pDest^ := ' '; - Inc(pDest); - until (pDest^ = #0); - end - else - HasTabs := False; -end; - -function ConvertTabs1(const Line: string; TabWidth: Integer): string; -var - HasTabs: Boolean; -begin - Result := ConvertTabs1Ex(Line, TabWidth, HasTabs); -end; - -function ConvertTabs2nEx(const Line: string; TabWidth: Integer; - var HasTabs: Boolean): string; -var - i, DestLen, TabCount, TabMask: Integer; - pSrc, pDest: PWideChar; -begin - Result := Line; // increment reference count only - if GetHasTabs(pointer(Line), DestLen) then - begin - HasTabs := True; - pSrc := @Line[1 + DestLen]; - // We have at least one tab in the string, and the tab width equals 2^n. - // pSrc points to the first tab char in Line. We get the number of tabs - // and the length of the expanded string now. - TabCount := 0; - TabMask := (TabWidth - 1) xor $7FFFFFFF; - repeat - if pSrc^ = #9 then - begin - DestLen := (DestLen + TabWidth) and TabMask; - Inc(TabCount); - end - else - Inc(DestLen); - Inc(pSrc); - until (pSrc^ = #0); - // Set the length of the expanded string. - SetLength(Result, DestLen); - DestLen := 0; - pSrc := PWideChar(Line); - pDest := PWideChar(Result); - // We use another TabMask here to get the difference to 2^n. - TabMask := TabWidth - 1; - repeat - if pSrc^ = #9 then - begin - i := TabWidth - (DestLen and TabMask); - Inc(DestLen, i); - //This is used for both drawing and other stuff and is meant to be #9 and not #32 - repeat - pDest^ := #9; - Inc(pDest); - Dec(i); - until (i = 0); - Dec(TabCount); - if TabCount = 0 then - begin - repeat - Inc(pSrc); - pDest^ := pSrc^; - Inc(pDest); - until (pSrc^ = #0); - exit; - end; - end - else - begin - pDest^ := pSrc^; - Inc(pDest); - Inc(DestLen); - end; - Inc(pSrc); - until (pSrc^ = #0); - end - else - HasTabs := False; -end; - -function ConvertTabs2n(const Line: string; TabWidth: Integer): string; -var - HasTabs: Boolean; -begin - Result := ConvertTabs2nEx(Line, TabWidth, HasTabs); -end; - -function ConvertTabsEx(const Line: string; TabWidth: Integer; - var HasTabs: Boolean): string; -var - i, DestLen, TabCount: Integer; - pSrc, pDest: PWideChar; -begin - Result := Line; // increment reference count only - if GetHasTabs(pointer(Line), DestLen) then - begin - HasTabs := True; - pSrc := @Line[1 + DestLen]; - // We have at least one tab in the string, and the tab width is greater - // than 1. pSrc points to the first tab char in Line. We get the number - // of tabs and the length of the expanded string now. - TabCount := 0; - repeat - if pSrc^ = #9 then - begin - DestLen := DestLen + TabWidth - DestLen mod TabWidth; - Inc(TabCount); - end - else - Inc(DestLen); - Inc(pSrc); - until (pSrc^ = #0); - // Set the length of the expanded string. - SetLength(Result, DestLen); - DestLen := 0; - pSrc := PWideChar(Line); - pDest := PWideChar(Result); - repeat - if pSrc^ = #9 then - begin - i := TabWidth - (DestLen mod TabWidth); - Inc(DestLen, i); - repeat - pDest^ := #9; - Inc(pDest); - Dec(i); - until (i = 0); - Dec(TabCount); - if TabCount = 0 then - begin - repeat - Inc(pSrc); - pDest^ := pSrc^; - Inc(pDest); - until (pSrc^ = #0); - exit; - end; - end - else - begin - pDest^ := pSrc^; - Inc(pDest); - Inc(DestLen); - end; - Inc(pSrc); - until (pSrc^ = #0); - end - else - HasTabs := False; -end; - -function ConvertTabs(const Line: string; TabWidth: Integer): string; -var - HasTabs: Boolean; -begin - Result := ConvertTabsEx(Line, TabWidth, HasTabs); -end; - -function IsPowerOfTwo(TabWidth: Integer): Boolean; -var - nW: Integer; -begin - nW := 2; - repeat - if (nW >= TabWidth) then break; - Inc(nW, nW); - until (nW >= $10000); // we don't want 64 kByte spaces... - Result := (nW = TabWidth); -end; - -function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; -begin - if (TabWidth < 2) then Result := TConvertTabsProc(@ConvertTabs1) - else if IsPowerOfTwo(TabWidth) then - Result := TConvertTabsProc(@ConvertTabs2n) - else - Result := TConvertTabsProc(@ConvertTabs); -end; - -function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; -begin - if (TabWidth < 2) then Result := ConvertTabs1Ex - else if IsPowerOfTwo(TabWidth) then - Result := ConvertTabs2nEx - else - Result := ConvertTabsEx; -end; - -function GetExpandedLength(const aStr: string; aTabWidth: Integer): Integer; -var - iRun: PWideChar; -begin - Result := 0; - iRun := PWideChar(aStr); - while iRun^ <> #0 do - begin - if iRun^ = #9 then - Inc(Result, aTabWidth - (Result mod aTabWidth)) - else - Inc(Result); - Inc(iRun); - end; -end; - -function CharIndex2CaretPos(Index, TabWidth: Integer; - const Line: string): Integer; -var - iChar: Integer; - pNext: PWideChar; -begin -// possible sanity check here: Index := Max(Index, Length(Line)); - if Index > 1 then - begin - if (TabWidth <= 1) or not GetHasTabs(pointer(Line), iChar) then - Result := Index - else - begin - if iChar + 1 >= Index then - Result := Index - else - begin - // iChar is number of chars before first #9 - Result := iChar; - // Index is *not* zero-based - Inc(iChar); - Dec(Index, iChar); - pNext := @Line[iChar]; - while Index > 0 do - begin - case pNext^ of - #0: - begin - Inc(Result, Index); - break; - end; - #9: - begin - // Result is still zero-based - Inc(Result, TabWidth); - Dec(Result, Result mod TabWidth); - end; - else - Inc(Result); - end; - Dec(Index); - Inc(pNext); - end; - // done with zero-based computation - Inc(Result); - end; - end; - end - else - Result := 1; -end; - -function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: string; - var InsideTabChar: Boolean): Integer; -var - iPos: Integer; - pNext: PWideChar; -begin - InsideTabChar := False; - if Position > 1 then - begin - if (TabWidth <= 1) or not GetHasTabs(pointer(Line), iPos) then - Result := Position - else - begin - if iPos + 1 >= Position then - Result := Position - else - begin - // iPos is number of chars before first #9 - Result := iPos + 1; - pNext := @Line[Result]; - // for easier computation go zero-based (mod-operation) - Dec(Position); - while iPos < Position do - begin - case pNext^ of - #0: break; - #9: begin - Inc(iPos, TabWidth); - Dec(iPos, iPos mod TabWidth); - if iPos > Position then - begin - InsideTabChar := True; - break; - end; - end; - else - Inc(iPos); - end; - Inc(Result); - Inc(pNext); - end; - end; - end; - end - else - Result := Position; -end; - -function StrScanForCharInCategory(const Line: string; Start: Integer; - IsOfCategory: TCategoryMethod): Integer; -var - p: PWideChar; -begin - if (Start > 0) and (Start <= Length(Line)) then - begin - p := PWideChar(@Line[Start]); - repeat - if IsOfCategory(p^) then - begin - Result := Start; - exit; - end; - Inc(p); - Inc(Start); - until p^ = #0; - end; - Result := 0; -end; - -function StrRScanForCharInCategory(const Line: string; Start: Integer; - IsOfCategory: TCategoryMethod): Integer; -var - I: Integer; -begin - Result := 0; - if (Start > 0) and (Start <= Length(Line)) then - begin - for I := Start downto 1 do - if IsOfCategory(Line[I]) then - begin - Result := I; - Exit; - end; - end; -end; - -function GetEOL(Line: PWideChar): PWideChar; -begin - Result := Line; - if Assigned(Result) then - while (Result^ <> #0) and (Result^ <> #10) and (Result^ <> #13) do - Inc(Result); -end; - -{$IFOPT R+}{$DEFINE RestoreRangeChecking}{$ELSE}{$UNDEF RestoreRangeChecking}{$ENDIF} -{$R-} -function EncodeString(s: string): string; -var - i, j: Integer; -begin - SetLength(Result, 2 * Length(s)); // worst case - j := 0; - for i := 1 to Length(s) do - begin - Inc(j); - if s[i] = '\' then - begin - Result[j] := '\'; - Result[j + 1] := '\'; - Inc(j); - end - else if s[i] = '/' then - begin - Result[j] := '\'; - Result[j + 1] := '.'; - Inc(j); - end - else - Result[j] := s[i]; - end; //for - SetLength(Result, j); -end; { EncodeString } - -function DecodeString(s: string): string; -var - i, j: Integer; -begin - SetLength(Result, Length(s)); // worst case - j := 0; - i := 1; - while i <= Length(s) do - begin - Inc(j); - if s[i] = '\' then - begin - Inc(i); - if s[i] = '\' then - Result[j] := '\' - else - Result[j] := '/'; - end - else - Result[j] := s[i]; - Inc(i); - end; //for - SetLength(Result,j); -end; { DecodeString } -{$IFDEF RestoreRangeChecking}{$R+}{$ENDIF} - -function DeleteTypePrefixAndSynSuffix(S: string): string; -begin - Result := S; - if CharInSet(Result[1], ['T', 't']) then //ClassName is never empty so no AV possible - if Pos('tsyn', LowerCase(Result)) = 1 then - Delete(Result, 1, 4) - else - Delete(Result, 1, 1); - - if Copy(LowerCase(Result), Length(Result) - 2, 3) = 'syn' then - SetLength(Result, Length(Result) - 3); -end; - -function GetHighlighterIndex(Highlighter: TSynCustomHighlighter; - HighlighterList: TList): Integer; -var - i: Integer; -begin - Result := 1; - for i := 0 to HighlighterList.Count - 1 do - if HighlighterList[i] = Highlighter then - Exit - else if Assigned(HighlighterList[i]) and (TObject(HighlighterList[i]).ClassType = Highlighter.ClassType) then - inc(Result); -end; - -function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; - SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; - Params: array of Pointer; HighlighterList: TList): Boolean; -var - i: Integer; - UniqueAttriName: string; -begin - Result := True; - - if (HighlighterList.IndexOf(Highlighter) >= 0) then - begin - if SkipDuplicates then Exit; - end - else - HighlighterList.Add(Highlighter); - - if Highlighter is TSynMultiSyn then - with TSynMultiSyn(Highlighter) do - begin - Result := InternalEnumHighlighterAttris(DefaultHighlighter, SkipDuplicates, - HighlighterAttriProc, Params, HighlighterList); - if not Result then Exit; - - for i := 0 to Schemes.Count - 1 do - begin - UniqueAttriName := Highlighter.ExportName + - IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + - Schemes[i].MarkerAttri.Name + IntToStr(i + 1); - - Result := HighlighterAttriProc(Highlighter, Schemes[i].MarkerAttri, - UniqueAttriName, Params); - if not Result then Exit; - - Result := InternalEnumHighlighterAttris(Schemes[i].Highlighter, - SkipDuplicates, HighlighterAttriProc, Params, HighlighterList); - if not Result then Exit - end - end - else if Assigned(Highlighter) then - for i := 0 to Highlighter.AttrCount - 1 do - begin - UniqueAttriName := Highlighter.ExportName + - IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + - Highlighter.Attribute[i].Name; - - Result := HighlighterAttriProc(Highlighter, Highlighter.Attribute[i], - UniqueAttriName, Params); - if not Result then Exit - end -end; - -function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; - SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; - Params: array of Pointer): Boolean; -var - HighlighterList: TList; -begin - if not Assigned(Highlighter) or not Assigned(HighlighterAttriProc) then - begin - Result := False; - Exit; - end; - - HighlighterList := TList.Create; - try - Result := InternalEnumHighlighterAttris(Highlighter, SkipDuplicates, - HighlighterAttriProc, Params, HighlighterList) - finally - HighlighterList.Free - end -end; - -{$IFDEF SYN_HEREDOC} -// Fast Frame Check Sequence (FCS) Implementation -// Translated from sample code given with RFC 1171 by Marko Njezic - -const - fcstab : array[Byte] of Word = ( - $0000, $1189, $2312, $329b, $4624, $57ad, $6536, $74bf, - $8c48, $9dc1, $af5a, $bed3, $ca6c, $dbe5, $e97e, $f8f7, - $1081, $0108, $3393, $221a, $56a5, $472c, $75b7, $643e, - $9cc9, $8d40, $bfdb, $ae52, $daed, $cb64, $f9ff, $e876, - $2102, $308b, $0210, $1399, $6726, $76af, $4434, $55bd, - $ad4a, $bcc3, $8e58, $9fd1, $eb6e, $fae7, $c87c, $d9f5, - $3183, $200a, $1291, $0318, $77a7, $662e, $54b5, $453c, - $bdcb, $ac42, $9ed9, $8f50, $fbef, $ea66, $d8fd, $c974, - $4204, $538d, $6116, $709f, $0420, $15a9, $2732, $36bb, - $ce4c, $dfc5, $ed5e, $fcd7, $8868, $99e1, $ab7a, $baf3, - $5285, $430c, $7197, $601e, $14a1, $0528, $37b3, $263a, - $decd, $cf44, $fddf, $ec56, $98e9, $8960, $bbfb, $aa72, - $6306, $728f, $4014, $519d, $2522, $34ab, $0630, $17b9, - $ef4e, $fec7, $cc5c, $ddd5, $a96a, $b8e3, $8a78, $9bf1, - $7387, $620e, $5095, $411c, $35a3, $242a, $16b1, $0738, - $ffcf, $ee46, $dcdd, $cd54, $b9eb, $a862, $9af9, $8b70, - $8408, $9581, $a71a, $b693, $c22c, $d3a5, $e13e, $f0b7, - $0840, $19c9, $2b52, $3adb, $4e64, $5fed, $6d76, $7cff, - $9489, $8500, $b79b, $a612, $d2ad, $c324, $f1bf, $e036, - $18c1, $0948, $3bd3, $2a5a, $5ee5, $4f6c, $7df7, $6c7e, - $a50a, $b483, $8618, $9791, $e32e, $f2a7, $c03c, $d1b5, - $2942, $38cb, $0a50, $1bd9, $6f66, $7eef, $4c74, $5dfd, - $b58b, $a402, $9699, $8710, $f3af, $e226, $d0bd, $c134, - $39c3, $284a, $1ad1, $0b58, $7fe7, $6e6e, $5cf5, $4d7c, - $c60c, $d785, $e51e, $f497, $8028, $91a1, $a33a, $b2b3, - $4a44, $5bcd, $6956, $78df, $0c60, $1de9, $2f72, $3efb, - $d68d, $c704, $f59f, $e416, $90a9, $8120, $b3bb, $a232, - $5ac5, $4b4c, $79d7, $685e, $1ce1, $0d68, $3ff3, $2e7a, - $e70e, $f687, $c41c, $d595, $a12a, $b0a3, $8238, $93b1, - $6b46, $7acf, $4854, $59dd, $2d62, $3ceb, $0e70, $1ff9, - $f78f, $e606, $d49d, $c514, $b1ab, $a022, $92b9, $8330, - $7bc7, $6a4e, $58d5, $495c, $3de3, $2c6a, $1ef1, $0f78 - ); - -function CalcFCS(const ABuf; ABufSize: Cardinal): Word; -var - CurFCS: Word; - P: ^Byte; -begin - CurFCS := $ffff; - P := @ABuf; - while ABufSize <> 0 do - begin - CurFCS := (CurFCS shr 8) xor fcstab[(CurFCS xor P^) and $ff]; - Dec(ABufSize); - Inc(P); - end; - Result := CurFCS; -end; -{$ENDIF} - -procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, AEndColor: TColor; - ASteps: Integer; const ARect: TRect; const AHorizontal: Boolean); -var - StartColorR, StartColorG, StartColorB: Byte; - DiffColorR, DiffColorG, DiffColorB: Integer; - i, Size: Integer; - PaintRect: TRect; -begin - StartColorR := GetRValue(ColorToRGB(AStartColor)); - StartColorG := GetGValue(ColorToRGB(AStartColor)); - StartColorB := GetBValue(ColorToRGB(AStartColor)); - - DiffColorR := GetRValue(ColorToRGB(AEndColor)) - StartColorR; - DiffColorG := GetGValue(ColorToRGB(AEndColor)) - StartColorG; - DiffColorB := GetBValue(ColorToRGB(AEndColor)) - StartColorB; - - ASteps := MinMax(ASteps, 2, 256); - - if AHorizontal then - begin - Size := ARect.Right - ARect.Left; - PaintRect.Top := ARect.Top; - PaintRect.Bottom := ARect.Bottom; - - for i := 0 to ASteps - 1 do - begin - PaintRect.Left := ARect.Left + MulDiv(i, Size, ASteps); - PaintRect.Right := ARect.Left + MulDiv(i + 1, Size, ASteps); - - ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), - StartColorG + MulDiv(i, DiffColorG, ASteps - 1), - StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); - - ACanvas.FillRect(PaintRect); - end; - end - else - begin - Size := ARect.Bottom - ARect.Top; - PaintRect.Left := ARect.Left; - PaintRect.Right := ARect.Right; - - for i := 0 to ASteps - 1 do - begin - PaintRect.Top := ARect.Top + MulDiv(i, Size, ASteps); - PaintRect.Bottom := ARect.Top + MulDiv(i + 1, Size, ASteps); - - ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), - StartColorG + MulDiv(i, DiffColorG, ASteps - 1), - StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); - - ACanvas.FillRect(PaintRect); - end; - end; -end; - - -function DefaultFontName: string; -begin - if CheckWin32Version(6) then - Result := 'Consolas' - else - Result := 'Courier New'; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditMiscProcs.pas, released 2000-04-07. +The Original Code is based on the mwSupportProcs.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Michael Hieke. +Unicode translation by Maël Hörz. +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: SynEditMiscProcs.pas,v 1.35.2.8 2009/09/28 17:54:20 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITMISCPROCS} +unit SynEditMiscProcs; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, +{$IFDEF SYN_COMPILER_4_UP} + Math, +{$ENDIF} + Classes; + +const + MaxIntArraySize = MaxInt div 16; + +type + PIntArray = ^TIntArray; + TIntArray = array[0..MaxIntArraySize - 1] of Integer; + +{$IFNDEF SYN_COMPILER_4_UP} +function Max(x, y: Integer): Integer; +function Min(x, y: Integer): Integer; +{$ENDIF} + +function MinMax(x, mi, ma: Integer): Integer; +procedure SwapInt(var l, r: Integer); +function MaxPoint(const P1, P2: TPoint): TPoint; +function MinPoint(const P1, P2: TPoint): TPoint; + +function GetIntArray(Count: Cardinal; InitialValue: Integer): PIntArray; + +procedure InternalFillRect(dc: HDC; const rcPaint: TRect); + +// Converting tabs to spaces: To use the function several times it's better +// to use a function pointer that is set to the fastest conversion function. +type + TConvertTabsProc = function(const Line: UnicodeString; + TabWidth: Integer): UnicodeString; + +function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; +// This is the slowest conversion function which can handle TabWidth <> 2^n. +function ConvertTabs(const Line: UnicodeString; TabWidth: Integer): UnicodeString; + +type + TConvertTabsProcEx = function(const Line: UnicodeString; TabWidth: Integer; + var HasTabs: Boolean): UnicodeString; + +function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; +// This is the slowest conversion function which can handle TabWidth <> 2^n. +function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; + var HasTabs: Boolean): UnicodeString; + +function GetExpandedLength(const aStr: UnicodeString; aTabWidth: Integer): Integer; + +function CharIndex2CaretPos(Index, TabWidth: Integer; + const Line: UnicodeString): Integer; +function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeString; + var InsideTabChar: Boolean): Integer; + +// search for the first char of set AChars in Line, starting at index Start +function StrScanForCharInCategory(const Line: UnicodeString; Start: Integer; + IsOfCategory: TCategoryMethod): Integer; +// the same, but searching backwards +function StrRScanForCharInCategory(const Line: UnicodeString; Start: Integer; + IsOfCategory: TCategoryMethod): Integer; + +function GetEOL(Line: PWideChar): PWideChar; + +// Remove all '/' characters from string by changing them into '\.'. +// Change all '\' characters into '\\' to allow for unique decoding. +function EncodeString(s: UnicodeString): UnicodeString; + +// Decodes string, encoded with EncodeString. +function DecodeString(s: UnicodeString): UnicodeString; + +{$IFNDEF SYN_COMPILER_5_UP} +procedure FreeAndNil(var Obj); +{$ENDIF} + +{$IFNDEF SYN_COMPILER_3_UP} +procedure Assert(Expr: Boolean); { stub for Delphi 2 } +{$ENDIF} + +{$IFNDEF SYN_COMPILER_3_UP} +function LastDelimiter(const Delimiters, S: UnicodeString): Integer; +{$ENDIF} + +{$IFNDEF SYN_COMPILER_4_UP} +type + TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); + +function StringReplace(const S, OldPattern, NewPattern: UnicodeString; + Flags: TReplaceFlags): UnicodeString; +{$ENDIF} + +type + THighlighterAttriProc = function (Highlighter: TSynCustomHighlighter; + Attri: TSynHighlighterAttributes; UniqueAttriName: string; + Params: array of Pointer): Boolean of object; + +// Enums all child highlighters and their attributes of a TSynMultiSyn through a +// callback function. +// This function also handles nested TSynMultiSyns including their MarkerAttri. +function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; + SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; + Params: array of Pointer): Boolean; + +{$IFDEF SYN_HEREDOC} +// Calculates Frame Check Sequence (FCS) 16-bit Checksum (as defined in RFC 1171) +function CalcFCS(const ABuf; ABufSize: Cardinal): Word; +{$ENDIF} + +procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, + AEndColor: TColor; ASteps: Integer; const ARect: TRect; + const AHorizontal: Boolean); overload; + +function DeleteTypePrefixAndSynSuffix(S: string): string; + +implementation + +uses + SysUtils, + SynHighlighterMulti; + +{$IFNDEF SYN_COMPILER_4_UP} +function Max(x, y: Integer): Integer; +begin + if x > y then Result := x else Result := y; +end; + +function Min(x, y: Integer): Integer; +begin + if x < y then Result := x else Result := y; +end; +{$ENDIF} + +function MinMax(x, mi, ma: Integer): Integer; +begin + x := Min(x, ma); + Result := Max(x, mi); +end; + +procedure SwapInt(var l, r: Integer); +var + tmp: Integer; +begin + tmp := r; + r := l; + l := tmp; +end; + +function MaxPoint(const P1, P2: TPoint): TPoint; +begin + if (P2.y > P1.y) or ((P2.y = P1.y) and (P2.x > P1.x)) then + Result := P2 + else + Result := P1; +end; + +function MinPoint(const P1, P2: TPoint): TPoint; +begin + if (P2.y < P1.y) or ((P2.y = P1.y) and (P2.x < P1.x)) then + Result := P2 + else + Result := P1; +end; + +function GetIntArray(Count: Cardinal; InitialValue: Integer): PIntArray; +var + p: PInteger; +begin + Result := AllocMem(Count * SizeOf(Integer)); + if Assigned(Result) and (InitialValue <> 0) then + begin + p := PInteger(Result); + while (Count > 0) do + begin + p^ := InitialValue; + Inc(p); + Dec(Count); + end; + end; +end; + +procedure InternalFillRect(dc: HDC; const rcPaint: TRect); +begin + ExtTextOut(dc, 0, 0, ETO_OPAQUE, @rcPaint, nil, 0, nil); +end; + +// Please don't change this function; no stack frame and efficient register use. +function GetHasTabs(pLine: PWideChar; var CharsBefore: Integer): Boolean; +begin + CharsBefore := 0; + if Assigned(pLine) then + begin + while pLine^ <> #0 do + begin + if pLine^ = #9 then + Break; + Inc(CharsBefore); + Inc(pLine); + end; + Result := pLine^ = #9; + end + else + Result := False; +end; + + +function ConvertTabs1Ex(const Line: UnicodeString; TabWidth: Integer; + var HasTabs: Boolean): UnicodeString; +var + pDest: PWideChar; + nBeforeTab: Integer; +begin + Result := Line; // increment reference count only + if GetHasTabs(Pointer(Line), nBeforeTab) then + begin + HasTabs := True; + pDest := @Result[nBeforeTab + 1]; // this will make a copy of Line + // We have at least one tab in the string, and the tab width is 1. + // pDest points to the first tab char. We overwrite all tabs with spaces. + repeat + if (pDest^ = #9) then pDest^ := ' '; + Inc(pDest); + until (pDest^ = #0); + end + else + HasTabs := False; +end; + +function ConvertTabs1(const Line: UnicodeString; TabWidth: Integer): UnicodeString; +var + HasTabs: Boolean; +begin + Result := ConvertTabs1Ex(Line, TabWidth, HasTabs); +end; + +function ConvertTabs2nEx(const Line: UnicodeString; TabWidth: Integer; + var HasTabs: Boolean): UnicodeString; +var + i, DestLen, TabCount, TabMask: Integer; + pSrc, pDest: PWideChar; +begin + Result := Line; // increment reference count only + if GetHasTabs(Pointer(Line), DestLen) then + begin + HasTabs := True; + pSrc := @Line[1 + DestLen]; + // We have at least one tab in the string, and the tab width equals 2^n. + // pSrc points to the first tab char in Line. We get the number of tabs + // and the length of the expanded string now. + TabCount := 0; + TabMask := (TabWidth - 1) xor $7FFFFFFF; + repeat + if pSrc^ = #9 then + begin + DestLen := (DestLen + TabWidth) and TabMask; + Inc(TabCount); + end + else + Inc(DestLen); + Inc(pSrc); + until (pSrc^ = #0); + // Set the length of the expanded string. + SetLength(Result, DestLen); + DestLen := 0; + pSrc := PWideChar(Line); + pDest := PWideChar(Result); + // We use another TabMask here to get the difference to 2^n. + TabMask := TabWidth - 1; + repeat + if pSrc^ = #9 then + begin + i := TabWidth - (DestLen and TabMask); + Inc(DestLen, i); + //This is used for both drawing and other stuff and is meant to be #9 and not #32 + repeat + pDest^ := #9; + Inc(pDest); + Dec(i); + until (i = 0); + Dec(TabCount); + if TabCount = 0 then + begin + repeat + Inc(pSrc); + pDest^ := pSrc^; + Inc(pDest); + until (pSrc^ = #0); + Exit; + end; + end + else + begin + pDest^ := pSrc^; + Inc(pDest); + Inc(DestLen); + end; + Inc(pSrc); + until (pSrc^ = #0); + end + else + HasTabs := False; +end; + +function ConvertTabs2n(const Line: UnicodeString; TabWidth: Integer): UnicodeString; +var + HasTabs: Boolean; +begin + Result := ConvertTabs2nEx(Line, TabWidth, HasTabs); +end; + +function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; + var HasTabs: Boolean): UnicodeString; +var + i, DestLen, TabCount: Integer; + pSrc, pDest: PWideChar; +begin + Result := Line; // increment reference count only + if GetHasTabs(Pointer(Line), DestLen) then + begin + HasTabs := True; + pSrc := @Line[1 + DestLen]; + // We have at least one tab in the string, and the tab width is greater + // than 1. pSrc points to the first tab char in Line. We get the number + // of tabs and the length of the expanded string now. + TabCount := 0; + repeat + if pSrc^ = #9 then + begin + DestLen := DestLen + TabWidth - DestLen mod TabWidth; + Inc(TabCount); + end + else + Inc(DestLen); + Inc(pSrc); + until (pSrc^ = #0); + // Set the length of the expanded string. + SetLength(Result, DestLen); + DestLen := 0; + pSrc := PWideChar(Line); + pDest := PWideChar(Result); + repeat + if pSrc^ = #9 then + begin + i := TabWidth - (DestLen mod TabWidth); + Inc(DestLen, i); + repeat + pDest^ := #9; + Inc(pDest); + Dec(i); + until (i = 0); + Dec(TabCount); + if TabCount = 0 then + begin + repeat + Inc(pSrc); + pDest^ := pSrc^; + Inc(pDest); + until (pSrc^ = #0); + Exit; + end; + end + else + begin + pDest^ := pSrc^; + Inc(pDest); + Inc(DestLen); + end; + Inc(pSrc); + until (pSrc^ = #0); + end + else + HasTabs := False; +end; + +function ConvertTabs(const Line: UnicodeString; TabWidth: Integer): UnicodeString; +var + HasTabs: Boolean; +begin + Result := ConvertTabsEx(Line, TabWidth, HasTabs); +end; + +function IsPowerOfTwo(TabWidth: Integer): Boolean; +var + nW: Integer; +begin + nW := 2; + repeat + if (nW >= TabWidth) then + Break; + Inc(nW, nW); + until (nW >= $10000); // we don't want 64 kByte spaces... + Result := (nW = TabWidth); +end; + +function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; +begin + if (TabWidth < 2) then Result := TConvertTabsProc(@ConvertTabs1) + else if IsPowerOfTwo(TabWidth) then + Result := TConvertTabsProc(@ConvertTabs2n) + else + Result := TConvertTabsProc(@ConvertTabs); +end; + +function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; +begin + if (TabWidth < 2) then Result := ConvertTabs1Ex + else if IsPowerOfTwo(TabWidth) then + Result := ConvertTabs2nEx + else + Result := ConvertTabsEx; +end; + +function GetExpandedLength(const aStr: UnicodeString; aTabWidth: Integer): Integer; +var + iRun: PWideChar; +begin + Result := 0; + iRun := PWideChar(aStr); + while iRun^ <> #0 do + begin + if iRun^ = #9 then + Inc(Result, aTabWidth - (Result mod aTabWidth)) + else + Inc(Result); + Inc(iRun); + end; +end; + +function CharIndex2CaretPos(Index, TabWidth: Integer; + const Line: UnicodeString): Integer; +var + iChar: Integer; + pNext: PWideChar; +begin +// possible sanity check here: Index := Max(Index, Length(Line)); + if Index > 1 then + begin + if (TabWidth <= 1) or not GetHasTabs(Pointer(Line), iChar) then + Result := Index + else + begin + if iChar + 1 >= Index then + Result := Index + else + begin + // iChar is number of chars before first #9 + Result := iChar; + // Index is *not* zero-based + Inc(iChar); + Dec(Index, iChar); + pNext := @Line[iChar]; + while Index > 0 do + begin + case pNext^ of + #0: + begin + Inc(Result, Index); + Break; + end; + #9: + begin + // Result is still zero-based + Inc(Result, TabWidth); + Dec(Result, Result mod TabWidth); + end; + else + Inc(Result); + end; + Dec(Index); + Inc(pNext); + end; + // done with zero-based computation + Inc(Result); + end; + end; + end + else + Result := 1; +end; + +function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeString; + var InsideTabChar: Boolean): Integer; +var + iPos: Integer; + pNext: PWideChar; +begin + InsideTabChar := False; + if Position > 1 then + begin + if (TabWidth <= 1) or not GetHasTabs(Pointer(Line), iPos) then + Result := Position + else + begin + if iPos + 1 >= Position then + Result := Position + else + begin + // iPos is number of chars before first #9 + Result := iPos + 1; + pNext := @Line[Result]; + // for easier computation go zero-based (mod-operation) + Dec(Position); + while iPos < Position do + begin + case pNext^ of + #0: + Break; + #9: + begin + Inc(iPos, TabWidth); + Dec(iPos, iPos mod TabWidth); + if iPos > Position then + begin + InsideTabChar := True; + Break; + end; + end; + else + Inc(iPos); + end; + Inc(Result); + Inc(pNext); + end; + end; + end; + end + else + Result := Position; +end; + +function StrScanForCharInCategory(const Line: UnicodeString; Start: Integer; + IsOfCategory: TCategoryMethod): Integer; +var + p: PWideChar; +begin + if (Start > 0) and (Start <= Length(Line)) then + begin + p := PWideChar(@Line[Start]); + repeat + if IsOfCategory(p^) then + begin + Result := Start; + Exit; + end; + Inc(p); + Inc(Start); + until p^ = #0; + end; + Result := 0; +end; + +function StrRScanForCharInCategory(const Line: UnicodeString; Start: Integer; + IsOfCategory: TCategoryMethod): Integer; +var + I: Integer; +begin + Result := 0; + if (Start > 0) and (Start <= Length(Line)) then + begin + for I := Start downto 1 do + if IsOfCategory(Line[I]) then + begin + Result := I; + Exit; + end; + end; +end; + +function GetEOL(Line: PWideChar): PWideChar; +begin + Result := Line; + if Assigned(Result) then + while (Result^ <> #0) and (Result^ <> #10) and (Result^ <> #13) do + Inc(Result); +end; + +{$IFOPT R+}{$DEFINE RestoreRangeChecking}{$ELSE}{$UNDEF RestoreRangeChecking}{$ENDIF} +{$R-} +function EncodeString(s: UnicodeString): UnicodeString; +var + i, j: Integer; +begin + SetLength(Result, 2 * Length(s)); // worst case + j := 0; + for i := 1 to Length(s) do + begin + Inc(j); + if s[i] = '\' then + begin + Result[j] := '\'; + Result[j + 1] := '\'; + Inc(j); + end + else if s[i] = '/' then + begin + Result[j] := '\'; + Result[j + 1] := '.'; + Inc(j); + end + else + Result[j] := s[i]; + end; //for + SetLength(Result, j); +end; { EncodeString } + +function DecodeString(s: UnicodeString): UnicodeString; +var + i, j: Integer; +begin + SetLength(Result, Length(s)); // worst case + j := 0; + i := 1; + while i <= Length(s) do + begin + Inc(j); + if s[i] = '\' then + begin + Inc(i); + if s[i] = '\' then + Result[j] := '\' + else + Result[j] := '/'; + end + else + Result[j] := s[i]; + Inc(i); + end; //for + SetLength(Result,j); +end; { DecodeString } +{$IFDEF RestoreRangeChecking}{$R+}{$ENDIF} + +{$IFNDEF SYN_COMPILER_5_UP} +procedure FreeAndNil(var Obj); +var + P: TObject; +begin + P := TObject(Obj); + TObject(Obj) := nil; + P.Free; +end; +{$ENDIF} + +{$IFNDEF SYN_COMPILER_3_UP} +procedure Assert(Expr: Boolean); { stub for Delphi 2 } +begin +end; +{$ENDIF} + +{$IFNDEF SYN_COMPILER_3_UP} +function LastDelimiter(const Delimiters, S: UnicodeString): Integer; +var + P: PWideChar; +begin + Result := Length(S); + P := PWideChar(Delimiters); + while Result > 0 do + begin + if (S[Result] <> #0) and (StrScan(P, S[Result]) <> nil) then + Exit; + Dec(Result); + end; +end; +{$ENDIF} + +{$IFNDEF SYN_COMPILER_4_UP} +function StringReplace(const S, OldPattern, NewPattern: UnicodeString; + Flags: TReplaceFlags): UnicodeString; +var + SearchStr, Patt, NewStr: UnicodeString; + Offset: Integer; +begin + if rfIgnoreCase in Flags then + begin + SearchStr := SynWideUpperCase(S); + Patt := SynWideUpperCase(OldPattern); + end + else + begin + SearchStr := S; + Patt := OldPattern; + end; + NewStr := S; + Result := ''; + while SearchStr <> '' do + begin + Offset := Pos(Patt, SearchStr); + if Offset = 0 then + begin + Result := Result + NewStr; + Break; + end; + Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern; + NewStr := Copy(NewStr, Offset + Length(OldPattern), MaxInt); + if not (rfReplaceAll in Flags) then + begin + Result := Result + NewStr; + Break; + end; + SearchStr := Copy(SearchStr, Offset + Length(Patt), MaxInt); + end; +end; +{$ENDIF} + +function DeleteTypePrefixAndSynSuffix(S: string): string; +begin + Result := S; + if CharInSet(Result[1], ['T', 't']) then //ClassName is never empty so no AV possible + if Pos('tsyn', LowerCase(Result)) = 1 then + Delete(Result, 1, 4) + else + Delete(Result, 1, 1); + + if Copy(LowerCase(Result), Length(Result) - 2, 3) = 'syn' then + SetLength(Result, Length(Result) - 3); +end; + +function GetHighlighterIndex(Highlighter: TSynCustomHighlighter; + HighlighterList: TList): Integer; +var + i: Integer; +begin + Result := 1; + for i := 0 to HighlighterList.Count - 1 do + if HighlighterList[i] = Highlighter then + Exit + else if Assigned(HighlighterList[i]) and (TObject(HighlighterList[i]).ClassType = Highlighter.ClassType) then + Inc(Result); +end; + +function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; + SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; + Params: array of Pointer; HighlighterList: TList): Boolean; +var + i: Integer; + UniqueAttriName: string; +begin + Result := True; + + if (HighlighterList.IndexOf(Highlighter) >= 0) then + begin + if SkipDuplicates then Exit; + end + else + HighlighterList.Add(Highlighter); + + if Highlighter is TSynMultiSyn then + with TSynMultiSyn(Highlighter) do + begin + Result := InternalEnumHighlighterAttris(DefaultHighlighter, SkipDuplicates, + HighlighterAttriProc, Params, HighlighterList); + if not Result then Exit; + + for i := 0 to Schemes.Count - 1 do + begin + UniqueAttriName := Highlighter.ExportName + + IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + + Schemes[i].MarkerAttri.Name + IntToStr(i + 1); + + Result := HighlighterAttriProc(Highlighter, Schemes[i].MarkerAttri, + UniqueAttriName, Params); + if not Result then Exit; + + Result := InternalEnumHighlighterAttris(Schemes[i].Highlighter, + SkipDuplicates, HighlighterAttriProc, Params, HighlighterList); + if not Result then Exit + end + end + else if Assigned(Highlighter) then + for i := 0 to Highlighter.AttrCount - 1 do + begin + UniqueAttriName := Highlighter.ExportName + + IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + + Highlighter.Attribute[i].Name; + + Result := HighlighterAttriProc(Highlighter, Highlighter.Attribute[i], + UniqueAttriName, Params); + if not Result then Exit + end +end; + +function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; + SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; + Params: array of Pointer): Boolean; +var + HighlighterList: TList; +begin + if not Assigned(Highlighter) or not Assigned(HighlighterAttriProc) then + begin + Result := False; + Exit; + end; + + HighlighterList := TList.Create; + try + Result := InternalEnumHighlighterAttris(Highlighter, SkipDuplicates, + HighlighterAttriProc, Params, HighlighterList) + finally + HighlighterList.Free + end +end; + +{$IFDEF SYN_HEREDOC} +// Fast Frame Check Sequence (FCS) Implementation +// Translated from sample code given with RFC 1171 by Marko Njezic + +const + fcstab : array[Byte] of Word = ( + $0000, $1189, $2312, $329b, $4624, $57ad, $6536, $74bf, + $8c48, $9dc1, $af5a, $bed3, $ca6c, $dbe5, $e97e, $f8f7, + $1081, $0108, $3393, $221a, $56a5, $472c, $75b7, $643e, + $9cc9, $8d40, $bfdb, $ae52, $daed, $cb64, $f9ff, $e876, + $2102, $308b, $0210, $1399, $6726, $76af, $4434, $55bd, + $ad4a, $bcc3, $8e58, $9fd1, $eb6e, $fae7, $c87c, $d9f5, + $3183, $200a, $1291, $0318, $77a7, $662e, $54b5, $453c, + $bdcb, $ac42, $9ed9, $8f50, $fbef, $ea66, $d8fd, $c974, + $4204, $538d, $6116, $709f, $0420, $15a9, $2732, $36bb, + $ce4c, $dfc5, $ed5e, $fcd7, $8868, $99e1, $ab7a, $baf3, + $5285, $430c, $7197, $601e, $14a1, $0528, $37b3, $263a, + $decd, $cf44, $fddf, $ec56, $98e9, $8960, $bbfb, $aa72, + $6306, $728f, $4014, $519d, $2522, $34ab, $0630, $17b9, + $ef4e, $fec7, $cc5c, $ddd5, $a96a, $b8e3, $8a78, $9bf1, + $7387, $620e, $5095, $411c, $35a3, $242a, $16b1, $0738, + $ffcf, $ee46, $dcdd, $cd54, $b9eb, $a862, $9af9, $8b70, + $8408, $9581, $a71a, $b693, $c22c, $d3a5, $e13e, $f0b7, + $0840, $19c9, $2b52, $3adb, $4e64, $5fed, $6d76, $7cff, + $9489, $8500, $b79b, $a612, $d2ad, $c324, $f1bf, $e036, + $18c1, $0948, $3bd3, $2a5a, $5ee5, $4f6c, $7df7, $6c7e, + $a50a, $b483, $8618, $9791, $e32e, $f2a7, $c03c, $d1b5, + $2942, $38cb, $0a50, $1bd9, $6f66, $7eef, $4c74, $5dfd, + $b58b, $a402, $9699, $8710, $f3af, $e226, $d0bd, $c134, + $39c3, $284a, $1ad1, $0b58, $7fe7, $6e6e, $5cf5, $4d7c, + $c60c, $d785, $e51e, $f497, $8028, $91a1, $a33a, $b2b3, + $4a44, $5bcd, $6956, $78df, $0c60, $1de9, $2f72, $3efb, + $d68d, $c704, $f59f, $e416, $90a9, $8120, $b3bb, $a232, + $5ac5, $4b4c, $79d7, $685e, $1ce1, $0d68, $3ff3, $2e7a, + $e70e, $f687, $c41c, $d595, $a12a, $b0a3, $8238, $93b1, + $6b46, $7acf, $4854, $59dd, $2d62, $3ceb, $0e70, $1ff9, + $f78f, $e606, $d49d, $c514, $b1ab, $a022, $92b9, $8330, + $7bc7, $6a4e, $58d5, $495c, $3de3, $2c6a, $1ef1, $0f78 + ); + +function CalcFCS(const ABuf; ABufSize: Cardinal): Word; +var + CurFCS: Word; + P: ^Byte; +begin + CurFCS := $ffff; + P := @ABuf; + while ABufSize <> 0 do + begin + CurFCS := (CurFCS shr 8) xor fcstab[(CurFCS xor P^) and $ff]; + Dec(ABufSize); + Inc(P); + end; + Result := CurFCS; +end; +{$ENDIF} + +procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, AEndColor: TColor; + ASteps: Integer; const ARect: TRect; const AHorizontal: Boolean); +var + StartColorR, StartColorG, StartColorB: Byte; + DiffColorR, DiffColorG, DiffColorB: Integer; + i, Size: Integer; + PaintRect: TRect; +begin + StartColorR := GetRValue(ColorToRGB(AStartColor)); + StartColorG := GetGValue(ColorToRGB(AStartColor)); + StartColorB := GetBValue(ColorToRGB(AStartColor)); + + DiffColorR := GetRValue(ColorToRGB(AEndColor)) - StartColorR; + DiffColorG := GetGValue(ColorToRGB(AEndColor)) - StartColorG; + DiffColorB := GetBValue(ColorToRGB(AEndColor)) - StartColorB; + + ASteps := MinMax(ASteps, 2, 256); + + if AHorizontal then + begin + Size := ARect.Right - ARect.Left; + PaintRect.Top := ARect.Top; + PaintRect.Bottom := ARect.Bottom; + + for i := 0 to ASteps - 1 do + begin + PaintRect.Left := ARect.Left + MulDiv(i, Size, ASteps); + PaintRect.Right := ARect.Left + MulDiv(i + 1, Size, ASteps); + + ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), + StartColorG + MulDiv(i, DiffColorG, ASteps - 1), + StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); + + ACanvas.FillRect(PaintRect); + end; + end + else + begin + Size := ARect.Bottom - ARect.Top; + PaintRect.Left := ARect.Left; + PaintRect.Right := ARect.Right; + + for i := 0 to ASteps - 1 do + begin + PaintRect.Top := ARect.Top + MulDiv(i, Size, ASteps); + PaintRect.Bottom := ARect.Top + MulDiv(i + 1, Size, ASteps); + + ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), + StartColorG + MulDiv(i, DiffColorG, ASteps - 1), + StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); + + ACanvas.FillRect(PaintRect); + end; + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditOptionsDialog.dfm b/Source/VCL/SynEdit/Source/SynEditOptionsDialog.dfm index 63ad87c2..3ae1715b 100644 --- a/Source/VCL/SynEdit/Source/SynEditOptionsDialog.dfm +++ b/Source/VCL/SynEdit/Source/SynEditOptionsDialog.dfm @@ -1,900 +1,931 @@ -object fmEditorOptionsDialog: TfmEditorOptionsDialog - Left = 580 - Top = 154 - BorderStyle = bsDialog - Caption = 'Editor Options' - ClientHeight = 394 - ClientWidth = 369 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter - OnCreate = FormCreate - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object PageControl1: TPageControl - Left = 6 - Top = 8 - Width = 355 - Height = 345 - ActivePage = Keystrokes - TabOrder = 0 - object Display: TTabSheet - Caption = 'Display' - object gbRightEdge: TGroupBox - Left = 8 - Top = 136 - Width = 159 - Height = 88 - Caption = 'Right Edge' - TabOrder = 1 - object Label3: TLabel - Left = 9 - Top = 56 - Width = 54 - Height = 13 - Caption = 'Edge color:' - end - object Label10: TLabel - Left = 9 - Top = 26 - Width = 66 - Height = 13 - Caption = 'Edge Column:' - end - object pRightEdgeBack: TPanel - Left = 80 - Top = 54 - Width = 52 - Height = 21 - BorderWidth = 1 - TabOrder = 1 - object pRightEdgeColor: TPanel - Left = 2 - Top = 2 - Width = 38 - Height = 17 - Align = alClient - BevelOuter = bvLowered - Color = clGray - TabOrder = 0 - OnClick = pRightEdgeColorClick - end - object btnRightEdge: TPanel - Left = 40 - Top = 2 - Width = 10 - Height = 17 - Align = alRight - BevelOuter = bvNone - TabOrder = 1 - OnMouseDown = btnRightEdgeMouseDown - object Image1: TImage - Left = 3 - Top = 6 - Width = 5 - Height = 5 - Picture.Data = { - 07544269746D61708A000000424D8A0000000000000076000000280000000500 - 0000050000000100040000000000140000000000000000000000100000001000 - 0000000000000000800000800000008080008000000080008000808000008080 - 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00DDDDD000DD0DD000D000D00000000000DDDDD000} - Transparent = True - OnMouseDown = btnRightEdgeMouseDown - end - end - end - object eRightEdge: TEdit - Left = 80 - Top = 23 - Width = 51 - Height = 21 - TabOrder = 0 - Text = '0' - end - end - object gbGutter: TGroupBox - Left = 8 - Top = 8 - Width = 330 - Height = 121 - Caption = 'Gutter' - TabOrder = 0 - object Label1: TLabel - Left = 176 - Top = 89 - Width = 58 - Height = 13 - Caption = 'Gutter color:' - end - object ckGutterAutosize: TCheckBox - Left = 9 - Top = 37 - Width = 120 - Height = 17 - Caption = 'Autosize' - TabOrder = 1 - end - object ckGutterShowLineNumbers: TCheckBox - Left = 9 - Top = 56 - Width = 120 - Height = 17 - Caption = 'Show line numbers' - TabOrder = 2 - end - object ckGutterShowLeaderZeros: TCheckBox - Left = 9 - Top = 94 - Width = 120 - Height = 17 - Caption = 'Show leading zeros' - TabOrder = 4 - end - object ckGutterStartAtZero: TCheckBox - Left = 9 - Top = 75 - Width = 120 - Height = 17 - Caption = 'Start at zero' - TabOrder = 3 - end - object ckGutterVisible: TCheckBox - Left = 9 - Top = 18 - Width = 120 - Height = 17 - Caption = 'Visible' - Checked = True - State = cbChecked - TabOrder = 0 - end - object cbGutterFont: TCheckBox - Left = 176 - Top = 18 - Width = 120 - Height = 17 - Caption = 'Use Gutter Font' - TabOrder = 5 - OnClick = cbGutterFontClick - end - object btnGutterFont: TButton - Left = 282 - Top = 13 - Width = 40 - Height = 25 - Caption = 'Font' - TabOrder = 6 - OnClick = btnGutterFontClick - end - object pGutterBack: TPanel - Left = 252 - Top = 85 - Width = 52 - Height = 21 - BorderWidth = 1 - TabOrder = 8 - object pGutterColor: TPanel - Left = 2 - Top = 2 - Width = 38 - Height = 17 - Align = alClient - BevelOuter = bvLowered - Color = clGray - TabOrder = 0 - OnClick = pGutterColorClick - end - object btnGutterColor: TPanel - Left = 40 - Top = 2 - Width = 10 - Height = 17 - Align = alRight - BevelOuter = bvNone - TabOrder = 1 - OnMouseDown = btnGutterColorMouseDown - object Image2: TImage - Left = 3 - Top = 6 - Width = 5 - Height = 5 - Picture.Data = { - 07544269746D61708A000000424D8A0000000000000076000000280000000500 - 0000050000000100040000000000140000000000000000000000100000001000 - 0000000000000000800000800000008080008000000080008000808000008080 - 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00DDDDD000DD0DD000D000D00000000000DDDDD000} - Transparent = True - OnMouseDown = btnGutterColorMouseDown - end - end - end - object pnlGutterFontDisplay: TPanel - Left = 176 - Top = 40 - Width = 145 - Height = 33 - BevelOuter = bvNone - TabOrder = 7 - object lblGutterFont: TLabel - Left = 19 - Top = 9 - Width = 105 - Height = 14 - Caption = 'Courier New 8pt' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Courier New' - Font.Style = [] - ParentFont = False - end - end - end - object gbBookmarks: TGroupBox - Left = 8 - Top = 232 - Width = 159 - Height = 79 - Caption = 'Bookmarks' - TabOrder = 3 - object ckBookmarkKeys: TCheckBox - Left = 9 - Top = 24 - Width = 97 - Height = 17 - Caption = 'Bookmark keys' - TabOrder = 0 - end - object ckBookmarkVisible: TCheckBox - Left = 9 - Top = 48 - Width = 121 - Height = 17 - Caption = 'Bookmarks visible' - TabOrder = 1 - end - end - object gbEditorFont: TGroupBox - Left = 180 - Top = 232 - Width = 159 - Height = 79 - Caption = 'Editor Font' - TabOrder = 4 - object btnFont: TButton - Left = 64 - Top = 49 - Width = 84 - Height = 25 - Caption = 'Font' - TabOrder = 0 - OnClick = btnFontClick - end - object Panel3: TPanel - Left = 8 - Top = 19 - Width = 143 - Height = 30 - BevelOuter = bvNone - TabOrder = 1 - object labFont: TLabel - Left = 2 - Top = 1 - Width = 128 - Height = 16 - Caption = 'Courier New 10pt' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Courier New' - Font.Style = [] - ParentFont = False - end - end - end - object gbLineSpacing: TGroupBox - Left = 180 - Top = 136 - Width = 159 - Height = 88 - Caption = 'Line spacing / Tab spacing' - TabOrder = 2 - object Label8: TLabel - Left = 9 - Top = 27 - Width = 55 - Height = 13 - Caption = 'Extra Lines:' - end - object Label9: TLabel - Left = 9 - Top = 56 - Width = 53 - Height = 13 - Caption = 'Tab Width:' - end - object eLineSpacing: TEdit - Left = 80 - Top = 23 - Width = 52 - Height = 21 - TabOrder = 0 - Text = '0' - end - object eTabWidth: TEdit - Left = 80 - Top = 53 - Width = 52 - Height = 21 - TabOrder = 1 - Text = '8' - end - end - end - object Options: TTabSheet - Caption = 'Options' - object gbOptions: TGroupBox - Left = 8 - Top = 0 - Width = 330 - Height = 247 - Caption = 'Options' - TabOrder = 0 - object ckAutoIndent: TCheckBox - Left = 9 - Top = 15 - Width = 130 - Height = 17 - Hint = - 'Will indent the caret on new lines with the same amount of leadi' + - 'ng white space as the preceding line' - Caption = 'Auto indent' - TabOrder = 0 - end - object ckDragAndDropEditing: TCheckBox - Left = 9 - Top = 34 - Width = 130 - Height = 17 - Hint = - 'Allows you to select a block of text and drag it within the docu' + - 'ment to another location' - Caption = 'Drag and drop editing' - TabOrder = 1 - end - object ckHalfPageScroll: TCheckBox - Left = 176 - Top = 15 - Width = 130 - Height = 17 - Hint = - 'When scrolling with page-up and page-down commands, only scroll ' + - 'a half page at a time' - Caption = 'Half page scroll' - TabOrder = 11 - end - object ckEnhanceEndKey: TCheckBox - Left = 9 - Top = 167 - Width = 130 - Height = 17 - Hint = 'Makes it so the caret is never visible' - Caption = 'Enhance End Key' - TabOrder = 8 - end - object ckScrollByOneLess: TCheckBox - Left = 176 - Top = 34 - Width = 130 - Height = 17 - Hint = 'Forces scrolling to be one less' - Caption = 'Scroll by one less' - TabOrder = 12 - end - object ckScrollPastEOF: TCheckBox - Left = 176 - Top = 53 - Width = 130 - Height = 17 - Hint = 'Allows the cursor to go past the end of file marker' - Caption = 'Scroll past end of file' - TabOrder = 13 - end - object ckScrollPastEOL: TCheckBox - Left = 176 - Top = 72 - Width = 130 - Height = 17 - Hint = - 'Allows the cursor to go past the last character into the white s' + - 'pace at the end of a line' - Caption = 'Scroll past end of line' - TabOrder = 14 - end - object ckShowScrollHint: TCheckBox - Left = 176 - Top = 91 - Width = 130 - Height = 17 - Hint = - 'Shows a hint of the visible line numbers when scrolling vertical' + - 'ly' - Caption = 'Show scroll hint' - TabOrder = 15 - end - object ckSmartTabs: TCheckBox - Left = 9 - Top = 110 - Width = 130 - Height = 17 - Hint = - 'When tabbing, the cursor will go to the next non-white space cha' + - 'racter of the previous line' - Caption = 'Smart tabs' - TabOrder = 5 - end - object ckTabsToSpaces: TCheckBox - Left = 176 - Top = 129 - Width = 130 - Height = 17 - Hint = 'Converts a tab character to the number of spaces in Tab Width' - Caption = 'Tabs to spaces' - TabOrder = 17 - end - object ckTrimTrailingSpaces: TCheckBox - Left = 176 - Top = 148 - Width = 130 - Height = 17 - Hint = 'Spaces at the end of lines will be trimmed and not saved' - Caption = 'Trim trailing spaces' - TabOrder = 18 - end - object ckWantTabs: TCheckBox - Left = 9 - Top = 91 - Width = 130 - Height = 17 - Hint = - 'Let the editor accept tab characters instead of going to the nex' + - 't control' - Caption = 'Want tabs' - TabOrder = 4 - end - object ckAltSetsColumnMode: TCheckBox - Left = 9 - Top = 53 - Width = 130 - Height = 17 - Hint = - 'Holding down the Alt Key will put the selection mode into column' + - 'ar format' - Caption = 'Alt sets column mode' - TabOrder = 2 - end - object ckKeepCaretX: TCheckBox - Left = 9 - Top = 72 - Width = 130 - Height = 17 - Hint = - 'When moving through lines the X position will always stay the sa' + - 'me' - Caption = 'Maintain caret column' - TabOrder = 3 - end - object ckScrollHintFollows: TCheckBox - Left = 176 - Top = 110 - Width = 152 - Height = 17 - Hint = 'The scroll hint follows the mouse when scrolling vertically' - Caption = 'Scroll hint follows mouse' - TabOrder = 16 - end - object ckGroupUndo: TCheckBox - Left = 177 - Top = 167 - Width = 130 - Height = 17 - Hint = - 'When undoing/redoing actions, handle all continous changes of th' + - 'e same kind in one call instead undoing/redoing each command sep' + - 'arately' - Caption = 'Group undo' - TabOrder = 19 - end - object ckSmartTabDelete: TCheckBox - Left = 9 - Top = 129 - Width = 130 - Height = 17 - Hint = 'similar to Smart Tabs, but when you delete characters' - Caption = 'Smart tab delete' - TabOrder = 6 - end - object ckRightMouseMoves: TCheckBox - Left = 177 - Top = 186 - Width = 146 - Height = 17 - Hint = - 'When clicking with the right mouse for a popup menu, move the cu' + - 'rsor to that location' - Caption = 'Right mouse moves cursor' - TabOrder = 20 - end - object ckEnhanceHomeKey: TCheckBox - Left = 9 - Top = 148 - Width = 146 - Height = 17 - Hint = 'enhances home key positioning, similar to visual studio' - Caption = 'Enhance Home Key' - TabOrder = 7 - end - object ckHideShowScrollbars: TCheckBox - Left = 9 - Top = 186 - Width = 156 - Height = 17 - Hint = - 'if enabled, then the scrollbars will only show when necessary. ' + - 'If you have ScrollPastEOL, then it the horizontal bar will alway' + - 's be there (it uses MaxLength instead)' - Caption = 'Hide scrollbars as necessary' - TabOrder = 9 - end - object ckDisableScrollArrows: TCheckBox - Left = 9 - Top = 205 - Width = 130 - Height = 17 - Hint = - 'Disables the scroll bar arrow buttons when you can'#39't scroll in t' + - 'hat direction any more' - Caption = 'Disable scroll arrows' - TabOrder = 10 - end - object ckShowSpecialChars: TCheckBox - Left = 177 - Top = 205 - Width = 130 - Height = 17 - Hint = 'Shows linebreaks, spaces and tabs using special symbols' - Caption = 'Show special chars' - TabOrder = 21 - end - end - object gbCaret: TGroupBox - Left = 8 - Top = 249 - Width = 330 - Height = 62 - Caption = 'Caret' - TabOrder = 1 - object Label2: TLabel - Left = 16 - Top = 17 - Width = 56 - Height = 13 - Caption = 'Insert caret:' - end - object Label4: TLabel - Left = 16 - Top = 41 - Width = 75 - Height = 13 - Caption = 'Overwrite caret:' - end - object cInsertCaret: TComboBox - Left = 120 - Top = 13 - Width = 186 - Height = 21 - Style = csDropDownList - TabOrder = 0 - Items.Strings = ( - 'Vertical Line' - 'Horizontal Line' - 'Half Block' - 'Block') - end - object cOverwriteCaret: TComboBox - Left = 120 - Top = 37 - Width = 186 - Height = 21 - Style = csDropDownList - TabOrder = 1 - Items.Strings = ( - 'Vertical Line' - 'Horizontal Line' - 'Half Block' - 'Block') - end - end - end - object Keystrokes: TTabSheet - Caption = 'Keystrokes' - object btnAddKey: TButton - Left = 96 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Add' - TabOrder = 2 - OnClick = btnAddKeyClick - end - object btnRemKey: TButton - Left = 176 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Remove' - TabOrder = 3 - OnClick = btnRemKeyClick - end - object gbKeyStrokes: TGroupBox - Left = 8 - Top = 192 - Width = 330 - Height = 119 - Caption = 'Keystroke Options' - TabOrder = 4 - object Label5: TLabel - Left = 16 - Top = 28 - Width = 50 - Height = 13 - Caption = 'Command:' - end - object Label6: TLabel - Left = 16 - Top = 91 - Width = 50 - Height = 13 - Caption = 'Keystroke:' - end - object Label7: TLabel - Left = 16 - Top = 59 - Width = 50 - Height = 13 - Caption = 'Keystroke:' - end - object cKeyCommand: TComboBox - Left = 120 - Top = 23 - Width = 186 - Height = 21 - Style = csDropDownList - TabOrder = 0 - OnKeyUp = cKeyCommandKeyUp - end - end - object btnUpdateKey: TButton - Left = 16 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Update' - TabOrder = 1 - OnClick = btnUpdateKeyClick - end - object pnlCommands: TPanel - Left = 8 - Top = 13 - Width = 330 - Height = 132 - BevelInner = bvRaised - BevelOuter = bvLowered - Caption = 'pnlCommands' - TabOrder = 0 - object KeyList: TListView - Left = 2 - Top = 2 - Width = 326 - Height = 128 - Align = alClient - BorderStyle = bsNone - Columns = < - item - Caption = 'Command' - Width = 167 - end - item - Caption = 'Keystroke' - Width = 142 - end> - ColumnClick = False - HideSelection = False - ReadOnly = True - RowSelect = True - TabOrder = 0 - ViewStyle = vsReport - OnChanging = KeyListChanging - end - end - end - end - object btnOk: TButton - Left = 200 - Top = 362 - Width = 75 - Height = 25 - Caption = '&OK' - ModalResult = 1 - TabOrder = 1 - OnClick = btnOkClick - end - object btnCancel: TButton - Left = 280 - Top = 362 - Width = 75 - Height = 25 - Caption = '&Cancel' - ModalResult = 2 - TabOrder = 2 - end - object ColorDialog: TColorDialog - Left = 8 - Top = 368 - end - object ColorPopup: TPopupMenu - Left = 40 - Top = 368 - object None1: TMenuItem - Tag = -1 - Caption = 'None' - OnClick = PopupMenuClick - end - object Scrollbar1: TMenuItem - Caption = 'Scrollbar' - OnClick = PopupMenuClick - end - object Background1: TMenuItem - Tag = 1 - Caption = 'Background' - OnClick = PopupMenuClick - end - object ActiveCaption1: TMenuItem - Tag = 2 - Caption = 'Active Caption' - OnClick = PopupMenuClick - end - object InactiveCaption1: TMenuItem - Tag = 3 - Caption = 'Inactive Caption' - OnClick = PopupMenuClick - end - object Menu1: TMenuItem - Tag = 4 - Caption = 'Menu' - OnClick = PopupMenuClick - end - object Window1: TMenuItem - Tag = 5 - Caption = 'Window' - OnClick = PopupMenuClick - end - object WindowFrame1: TMenuItem - Tag = 6 - Caption = 'Window Frame' - OnClick = PopupMenuClick - end - object MEnu2: TMenuItem - Tag = 7 - Caption = 'Menu Text' - OnClick = PopupMenuClick - end - object WindowText1: TMenuItem - Tag = 8 - Caption = 'Window Text' - OnClick = PopupMenuClick - end - object CaptionText1: TMenuItem - Tag = 9 - Caption = 'Caption Text' - OnClick = PopupMenuClick - end - object ActiveBorder1: TMenuItem - Tag = 10 - Caption = 'Active Border' - OnClick = PopupMenuClick - end - object InactiveBorder1: TMenuItem - Tag = 11 - Caption = 'Inactive Border' - OnClick = PopupMenuClick - end - object ApplicationWorkspace1: TMenuItem - Tag = 12 - Caption = 'Application Workspace' - OnClick = PopupMenuClick - end - object Highlight1: TMenuItem - Tag = 13 - Caption = 'Highlight' - OnClick = PopupMenuClick - end - object HighlightText1: TMenuItem - Tag = 14 - Caption = 'Highlight Text' - OnClick = PopupMenuClick - end - object ButtonFace1: TMenuItem - Tag = 15 - Caption = 'Button Face' - OnClick = PopupMenuClick - end - object ButtonShadow1: TMenuItem - Tag = 16 - Caption = 'Button Shadow' - OnClick = PopupMenuClick - end - object GrayText1: TMenuItem - Tag = 17 - Caption = 'Gray Text' - OnClick = PopupMenuClick - end - object ButtonText1: TMenuItem - Tag = 18 - Caption = 'Button Text' - OnClick = PopupMenuClick - end - object InactiveCaptionText1: TMenuItem - Tag = 19 - Caption = 'Inactive Caption Text' - OnClick = PopupMenuClick - end - object Highlight2: TMenuItem - Tag = 20 - Caption = 'Highlight' - OnClick = PopupMenuClick - end - object N3dDarkShadow1: TMenuItem - Tag = 21 - Caption = '3D Dark Shadow' - OnClick = PopupMenuClick - end - object N3DLight1: TMenuItem - Tag = 22 - Caption = '3D Light' - OnClick = PopupMenuClick - end - object InfoTipText1: TMenuItem - Tag = 23 - Caption = 'Info Tip Text' - OnClick = PopupMenuClick - end - object InfoTipBackground1: TMenuItem - Tag = 24 - Caption = 'Info Tip Background' - OnClick = PopupMenuClick - end - end - object ImageList1: TImageList - Left = 72 - Top = 368 - end - object FontDialog: TFontDialog - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - Options = [fdEffects, fdFixedPitchOnly] - Left = 104 - Top = 368 - end -end +object fmEditorOptionsDialog: TfmEditorOptionsDialog + Left = 580 + Top = 154 + BorderStyle = bsDialog + Caption = 'Editor Options' + ClientHeight = 394 + ClientWidth = 369 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object PageControl: TPageControl + Left = 6 + Top = 8 + Width = 355 + Height = 345 + ActivePage = Display + TabOrder = 0 + object Display: TTabSheet + Caption = 'Display' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 + object gbRightEdge: TGroupBox + Left = 8 + Top = 136 + Width = 159 + Height = 88 + Caption = 'Right Edge' + TabOrder = 1 + object lblEdgeColor: TLabel + Left = 9 + Top = 56 + Width = 54 + Height = 13 + Caption = 'Edge color:' + end + object lblEdgeColumn: TLabel + Left = 9 + Top = 26 + Width = 66 + Height = 13 + Caption = 'Edge Column:' + end + object pnlRightEdgeBack: TPanel + Left = 80 + Top = 54 + Width = 52 + Height = 21 + BorderWidth = 1 + TabOrder = 1 + object pnlRightEdgeColor: TPanel + Left = 2 + Top = 2 + Width = 38 + Height = 17 + Align = alClient + BevelOuter = bvLowered + Color = clGray + TabOrder = 0 + OnClick = pnlRightEdgeColorClick + end + object btnRightEdge: TPanel + Left = 40 + Top = 2 + Width = 10 + Height = 17 + Align = alRight + BevelOuter = bvNone + TabOrder = 1 + OnMouseDown = btnRightEdgeMouseDown + object Image1: TImage + Left = 3 + Top = 6 + Width = 5 + Height = 5 + Picture.Data = { + 07544269746D61708A000000424D8A0000000000000076000000280000000500 + 0000050000000100040000000000140000000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00DDDDD000DD0DD000D000D00000000000DDDDD000} + Transparent = True + OnMouseDown = btnRightEdgeMouseDown + end + end + end + object eRightEdge: TEdit + Left = 80 + Top = 23 + Width = 51 + Height = 21 + TabOrder = 0 + Text = '0' + end + end + object gbGutter: TGroupBox + Left = 8 + Top = 8 + Width = 330 + Height = 121 + Caption = 'Gutter' + TabOrder = 0 + object lblGutterColor: TLabel + Left = 176 + Top = 89 + Width = 58 + Height = 13 + Caption = 'Gutter color:' + end + object ckGutterAutosize: TCheckBox + Left = 9 + Top = 37 + Width = 120 + Height = 17 + Caption = 'Autosize' + TabOrder = 1 + end + object ckGutterShowLineNumbers: TCheckBox + Left = 9 + Top = 56 + Width = 120 + Height = 17 + Caption = 'Show line numbers' + TabOrder = 2 + end + object ckGutterShowLeaderZeros: TCheckBox + Left = 9 + Top = 94 + Width = 120 + Height = 17 + Caption = 'Show leading zeros' + TabOrder = 4 + end + object ckGutterStartAtZero: TCheckBox + Left = 9 + Top = 75 + Width = 120 + Height = 17 + Caption = 'Start at zero' + TabOrder = 3 + end + object ckGutterVisible: TCheckBox + Left = 9 + Top = 18 + Width = 120 + Height = 17 + Caption = 'Visible' + Checked = True + State = cbChecked + TabOrder = 0 + end + object cbGutterFont: TCheckBox + Left = 176 + Top = 18 + Width = 120 + Height = 17 + Caption = 'Use Gutter Font' + TabOrder = 5 + OnClick = cbGutterFontClick + end + object btnGutterFont: TButton + Left = 282 + Top = 13 + Width = 40 + Height = 25 + Caption = 'Font' + TabOrder = 6 + OnClick = btnGutterFontClick + end + object pnlGutterBack: TPanel + Left = 252 + Top = 85 + Width = 52 + Height = 21 + BorderWidth = 1 + TabOrder = 8 + object pnlGutterColor: TPanel + Left = 2 + Top = 2 + Width = 38 + Height = 17 + Align = alClient + BevelOuter = bvLowered + Color = clGray + TabOrder = 0 + OnClick = pnlGutterColorClick + end + object btnGutterColor: TPanel + Left = 40 + Top = 2 + Width = 10 + Height = 17 + Align = alRight + BevelOuter = bvNone + TabOrder = 1 + OnMouseDown = btnGutterColorMouseDown + object Image2: TImage + Left = 3 + Top = 6 + Width = 5 + Height = 5 + Picture.Data = { + 07544269746D61708A000000424D8A0000000000000076000000280000000500 + 0000050000000100040000000000140000000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00DDDDD000DD0DD000D000D00000000000DDDDD000} + Transparent = True + OnMouseDown = btnGutterColorMouseDown + end + end + end + object pnlGutterFontDisplay: TPanel + Left = 176 + Top = 40 + Width = 145 + Height = 33 + BevelOuter = bvNone + TabOrder = 7 + object lblGutterFont: TLabel + Left = 19 + Top = 9 + Width = 105 + Height = 14 + Caption = 'Courier New 8pt' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + end + end + end + object gbBookmarks: TGroupBox + Left = 8 + Top = 232 + Width = 159 + Height = 79 + Caption = 'Bookmarks' + TabOrder = 3 + object ckBookmarkKeys: TCheckBox + Left = 9 + Top = 24 + Width = 97 + Height = 17 + Caption = 'Bookmark keys' + TabOrder = 0 + end + object ckBookmarkVisible: TCheckBox + Left = 9 + Top = 48 + Width = 121 + Height = 17 + Caption = 'Bookmarks visible' + TabOrder = 1 + end + end + object gbEditorFont: TGroupBox + Left = 180 + Top = 232 + Width = 159 + Height = 79 + Caption = 'Editor Font' + TabOrder = 4 + object btnFont: TButton + Left = 64 + Top = 49 + Width = 84 + Height = 25 + Caption = 'Font' + TabOrder = 0 + OnClick = btnFontClick + end + object pnlEditorFont: TPanel + Left = 8 + Top = 19 + Width = 143 + Height = 30 + BevelOuter = bvNone + TabOrder = 1 + object lblFont: TLabel + Left = 2 + Top = 1 + Width = 128 + Height = 16 + Caption = 'Courier New 10pt' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + end + end + end + object gbLineSpacing: TGroupBox + Left = 180 + Top = 136 + Width = 159 + Height = 88 + Caption = 'Line spacing / Tab spacing' + TabOrder = 2 + object lblExtraLines: TLabel + Left = 9 + Top = 27 + Width = 55 + Height = 13 + Caption = 'Extra Lines:' + end + object lblTabWidth: TLabel + Left = 9 + Top = 56 + Width = 53 + Height = 13 + Caption = 'Tab Width:' + end + object eLineSpacing: TEdit + Left = 80 + Top = 23 + Width = 52 + Height = 21 + TabOrder = 0 + Text = '0' + end + object eTabWidth: TEdit + Left = 80 + Top = 53 + Width = 52 + Height = 21 + TabOrder = 1 + Text = '8' + end + end + end + object Options: TTabSheet + Caption = 'Options' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 + object gbOptions: TGroupBox + Left = 8 + Top = 0 + Width = 330 + Height = 247 + Caption = 'Options' + TabOrder = 0 + object ckAutoIndent: TCheckBox + Left = 9 + Top = 15 + Width = 130 + Height = 17 + Hint = + 'Will indent the caret on new lines with the same amount of leadi' + + 'ng white space as the preceding line' + Caption = 'Auto indent' + TabOrder = 0 + end + object ckDragAndDropEditing: TCheckBox + Left = 9 + Top = 53 + Width = 130 + Height = 17 + Hint = + 'Allows you to select a block of text and drag it within the docu' + + 'ment to another location' + Caption = 'Drag and drop editing' + TabOrder = 2 + end + object ckAutoSizeMaxWidth: TCheckBox + Left = 9 + Top = 34 + Width = 130 + Height = 17 + Hint = 'Allows the editor accept OLE file drops' + Caption = 'Auto size scroll width' + TabOrder = 1 + end + object ckHalfPageScroll: TCheckBox + Left = 176 + Top = 15 + Width = 130 + Height = 17 + Hint = + 'When scrolling with page-up and page-down commands, only scroll ' + + 'a half page at a time' + Caption = 'Half page scroll' + TabOrder = 12 + end + object ckEnhanceEndKey: TCheckBox + Left = 9 + Top = 186 + Width = 130 + Height = 17 + Hint = 'Makes it so the caret is never visible' + Caption = 'Enhance End Key' + TabOrder = 9 + end + object ckScrollByOneLess: TCheckBox + Left = 176 + Top = 34 + Width = 130 + Height = 17 + Hint = 'Forces scrolling to be one less' + Caption = 'Scroll by one less' + TabOrder = 13 + end + object ckScrollPastEOF: TCheckBox + Left = 176 + Top = 53 + Width = 130 + Height = 17 + Hint = 'Allows the cursor to go past the end of file marker' + Caption = 'Scroll past end of file' + TabOrder = 14 + end + object ckScrollPastEOL: TCheckBox + Left = 176 + Top = 72 + Width = 130 + Height = 17 + Hint = + 'Allows the cursor to go past the last character into the white s' + + 'pace at the end of a line' + Caption = 'Scroll past end of line' + TabOrder = 15 + end + object ckShowScrollHint: TCheckBox + Left = 176 + Top = 91 + Width = 130 + Height = 17 + Hint = + 'Shows a hint of the visible line numbers when scrolling vertical' + + 'ly' + Caption = 'Show scroll hint' + TabOrder = 16 + end + object ckSmartTabs: TCheckBox + Left = 9 + Top = 129 + Width = 130 + Height = 17 + Hint = + 'When tabbing, the cursor will go to the next non-white space cha' + + 'racter of the previous line' + Caption = 'Smart tabs' + TabOrder = 6 + end + object ckTabsToSpaces: TCheckBox + Left = 176 + Top = 148 + Width = 130 + Height = 17 + Hint = 'Converts a tab character to the number of spaces in Tab Width' + Caption = 'Tabs to spaces' + TabOrder = 18 + end + object ckTrimTrailingSpaces: TCheckBox + Left = 176 + Top = 167 + Width = 130 + Height = 17 + Hint = 'Spaces at the end of lines will be trimmed and not saved' + Caption = 'Trim trailing spaces' + TabOrder = 19 + end + object ckWantTabs: TCheckBox + Left = 9 + Top = 110 + Width = 130 + Height = 17 + Hint = + 'Let the editor accept tab characters instead of going to the nex' + + 't control' + Caption = 'Want tabs' + TabOrder = 5 + end + object ckAltSetsColumnMode: TCheckBox + Left = 9 + Top = 72 + Width = 130 + Height = 17 + Hint = + 'Holding down the Alt Key will put the selection mode into column' + + 'ar format' + Caption = 'Alt sets column mode' + TabOrder = 3 + end + object ckKeepCaretX: TCheckBox + Left = 9 + Top = 91 + Width = 130 + Height = 17 + Hint = + 'When moving through lines the X position will always stay the sa' + + 'me' + Caption = 'Maintain caret column' + TabOrder = 4 + end + object ckScrollHintFollows: TCheckBox + Left = 176 + Top = 110 + Width = 152 + Height = 17 + Hint = 'The scroll hint follows the mouse when scrolling vertically' + Caption = 'Scroll hint follows mouse' + TabOrder = 17 + end + object ckGroupUndo: TCheckBox + Left = 176 + Top = 186 + Width = 130 + Height = 17 + Hint = + 'When undoing/redoing actions, handle all continous changes of th' + + 'e same kind in one call instead undoing/redoing each command sep' + + 'arately' + Caption = 'Group undo' + TabOrder = 20 + end + object ckSmartTabDelete: TCheckBox + Left = 9 + Top = 148 + Width = 130 + Height = 17 + Hint = 'similar to Smart Tabs, but when you delete characters' + Caption = 'Smart tab delete' + TabOrder = 7 + end + object ckRightMouseMoves: TCheckBox + Left = 176 + Top = 205 + Width = 146 + Height = 17 + Hint = + 'When clicking with the right mouse for a popup menu, move the cu' + + 'rsor to that location' + Caption = 'Right mouse moves cursor' + TabOrder = 21 + end + object ckEnhanceHomeKey: TCheckBox + Left = 9 + Top = 167 + Width = 146 + Height = 17 + Hint = 'enhances home key positioning, similar to visual studio' + Caption = 'Enhance Home Key' + TabOrder = 8 + end + object ckHideShowScrollbars: TCheckBox + Left = 9 + Top = 205 + Width = 156 + Height = 17 + Hint = + 'if enabled, then the scrollbars will only show when necessary. ' + + 'If you have ScrollPastEOL, then it the horizontal bar will alway' + + 's be there (it uses MaxLength instead)' + Caption = 'Hide scrollbars as necessary' + TabOrder = 10 + end + object ckDisableScrollArrows: TCheckBox + Left = 9 + Top = 224 + Width = 130 + Height = 17 + Hint = + 'Disables the scroll bar arrow buttons when you can'#39't scroll in t' + + 'hat direction any more' + Caption = 'Disable scroll arrows' + TabOrder = 11 + end + object ckShowSpecialChars: TCheckBox + Left = 176 + Top = 224 + Width = 130 + Height = 17 + Hint = 'Shows linebreaks, spaces and tabs using special symbols' + Caption = 'Show special chars' + TabOrder = 22 + end + object ckTabIndent: TCheckBox + Left = 176 + Top = 129 + Width = 130 + Height = 17 + Hint = 'Use tab for indention' + Caption = 'Tab indent' + TabOrder = 23 + end + end + object gbCaret: TGroupBox + Left = 8 + Top = 249 + Width = 330 + Height = 62 + Caption = 'Caret' + TabOrder = 1 + object lblInsertCaret: TLabel + Left = 16 + Top = 17 + Width = 56 + Height = 13 + Caption = 'Insert caret:' + end + object lblOverwriteCaret: TLabel + Left = 16 + Top = 41 + Width = 75 + Height = 13 + Caption = 'Overwrite caret:' + end + object cInsertCaret: TComboBox + Left = 120 + Top = 13 + Width = 186 + Height = 21 + Style = csDropDownList + TabOrder = 0 + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') + end + object cOverwriteCaret: TComboBox + Left = 120 + Top = 37 + Width = 186 + Height = 21 + Style = csDropDownList + TabOrder = 1 + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') + end + end + end + object Keystrokes: TTabSheet + Caption = 'Keystrokes' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 + object btnAddKey: TButton + Left = 96 + Top = 152 + Width = 75 + Height = 25 + Caption = '&Add' + TabOrder = 2 + OnClick = btnAddKeyClick + end + object btnRemKey: TButton + Left = 176 + Top = 152 + Width = 75 + Height = 25 + Caption = '&Remove' + TabOrder = 3 + OnClick = btnRemKeyClick + end + object gbKeyStrokes: TGroupBox + Left = 8 + Top = 192 + Width = 330 + Height = 119 + Caption = 'Keystroke Options' + TabOrder = 4 + object lblCommand: TLabel + Left = 16 + Top = 28 + Width = 50 + Height = 13 + Caption = 'Command:' + end + object lblKeystroke2: TLabel + Left = 16 + Top = 91 + Width = 50 + Height = 13 + Caption = 'Keystroke:' + end + object lblKeystroke: TLabel + Left = 16 + Top = 59 + Width = 50 + Height = 13 + Caption = 'Keystroke:' + end + object cKeyCommand: TComboBox + Left = 120 + Top = 23 + Width = 186 + Height = 21 + TabOrder = 0 + OnExit = cKeyCommandExit + OnKeyPress = cKeyCommandKeyPress + OnKeyUp = cKeyCommandKeyUp + end + end + object btnUpdateKey: TButton + Left = 16 + Top = 152 + Width = 75 + Height = 25 + Caption = '&Update' + TabOrder = 1 + OnClick = btnUpdateKeyClick + end + object pnlCommands: TPanel + Left = 8 + Top = 13 + Width = 330 + Height = 132 + BevelInner = bvRaised + BevelOuter = bvLowered + Caption = 'pnlCommands' + TabOrder = 0 + object KeyList: TListView + Left = 2 + Top = 2 + Width = 326 + Height = 128 + Align = alClient + BorderStyle = bsNone + Columns = < + item + Caption = 'Command' + Width = 167 + end + item + Caption = 'Keystroke' + Width = 142 + end> + ColumnClick = False + HideSelection = False + ReadOnly = True + RowSelect = True + TabOrder = 0 + ViewStyle = vsReport + OnChanging = KeyListChanging + end + end + end + end + object btnOk: TButton + Left = 200 + Top = 362 + Width = 75 + Height = 25 + Caption = '&OK' + ModalResult = 1 + TabOrder = 1 + OnClick = btnOkClick + end + object btnCancel: TButton + Left = 280 + Top = 362 + Width = 75 + Height = 25 + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 2 + end + object ColorDialog: TColorDialog + Left = 8 + Top = 368 + end + object ColorPopup: TPopupMenu + Left = 40 + Top = 368 + object mnuNone: TMenuItem + Tag = -1 + Caption = 'None' + OnClick = PopupMenuClick + end + object mnuScrollBar: TMenuItem + Caption = 'Scrollbar' + OnClick = PopupMenuClick + end + object mnuBackground: TMenuItem + Tag = 1 + Caption = 'Background' + OnClick = PopupMenuClick + end + object mnuActiveCaption: TMenuItem + Tag = 2 + Caption = 'Active Caption' + OnClick = PopupMenuClick + end + object mnuInactiveCaption: TMenuItem + Tag = 3 + Caption = 'Inactive Caption' + OnClick = PopupMenuClick + end + object mnuMenu: TMenuItem + Tag = 4 + Caption = 'Menu' + OnClick = PopupMenuClick + end + object mnuWindow: TMenuItem + Tag = 5 + Caption = 'Window' + OnClick = PopupMenuClick + end + object mnuWindowFrame: TMenuItem + Tag = 6 + Caption = 'Window Frame' + OnClick = PopupMenuClick + end + object Menu2: TMenuItem + Tag = 7 + Caption = 'Menu Text' + OnClick = PopupMenuClick + end + object mnuWindowText: TMenuItem + Tag = 8 + Caption = 'Window Text' + OnClick = PopupMenuClick + end + object mnuCaptionText: TMenuItem + Tag = 9 + Caption = 'Caption Text' + OnClick = PopupMenuClick + end + object mnuActiveBorder: TMenuItem + Tag = 10 + Caption = 'Active Border' + OnClick = PopupMenuClick + end + object mnuInactiveBorder: TMenuItem + Tag = 11 + Caption = 'Inactive Border' + OnClick = PopupMenuClick + end + object mnuApplicationWorkspace: TMenuItem + Tag = 12 + Caption = 'Application Workspace' + OnClick = PopupMenuClick + end + object mnuHighlight: TMenuItem + Tag = 13 + Caption = 'Highlight' + OnClick = PopupMenuClick + end + object mnuHighlightText: TMenuItem + Tag = 14 + Caption = 'Highlight Text' + OnClick = PopupMenuClick + end + object mnuButtonFace: TMenuItem + Tag = 15 + Caption = 'Button Face' + OnClick = PopupMenuClick + end + object mnuButtonShadow: TMenuItem + Tag = 16 + Caption = 'Button Shadow' + OnClick = PopupMenuClick + end + object mnuGrayText: TMenuItem + Tag = 17 + Caption = 'Gray Text' + OnClick = PopupMenuClick + end + object mnuButtonText: TMenuItem + Tag = 18 + Caption = 'Button Text' + OnClick = PopupMenuClick + end + object mnuInactiveCaptionText: TMenuItem + Tag = 19 + Caption = 'Inactive Caption Text' + OnClick = PopupMenuClick + end + object mnuHighlight2: TMenuItem + Tag = 20 + Caption = 'Highlight' + OnClick = PopupMenuClick + end + object mnu3dDarkShadow: TMenuItem + Tag = 21 + Caption = '3D Dark Shadow' + OnClick = PopupMenuClick + end + object mnu3DLight: TMenuItem + Tag = 22 + Caption = '3D Light' + OnClick = PopupMenuClick + end + object mnuInfoTipText: TMenuItem + Tag = 23 + Caption = 'Info Tip Text' + OnClick = PopupMenuClick + end + object mnuInfoTipBackground: TMenuItem + Tag = 24 + Caption = 'Info Tip Background' + OnClick = PopupMenuClick + end + end + object ImageList: TImageList + Left = 72 + Top = 368 + end + object FontDialog: TFontDialog + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + Options = [fdEffects, fdFixedPitchOnly] + Left = 104 + Top = 368 + end +end diff --git a/Source/VCL/SynEdit/Source/SynEditOptionsDialog.pas b/Source/VCL/SynEdit/Source/SynEditOptionsDialog.pas index 0ee104fd..680c0335 100644 --- a/Source/VCL/SynEdit/Source/SynEditOptionsDialog.pas +++ b/Source/VCL/SynEdit/Source/SynEditOptionsDialog.pas @@ -1,960 +1,1056 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEdit.pas, released 2000-04-07. -The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of -the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -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: SynEditOptionsDialog.pas,v 1.21.2.5 2005/07/20 13:37:18 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - --------------------------------------------------------------------------------} - -unit SynEditOptionsDialog; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - ComCtrls, - CommCtrl, - Registry, - ExtCtrls, - Buttons, - ImgList, - Menus, - SynEdit, - SynEditHighlighter, - SynEditMiscClasses, - SynEditKeyCmds, - Classes, - SysUtils, System.ImageList; - -type - TColorPopup = (cpGutter, cpRightEdge); - - TSynEditorOptionsUserCommand = procedure(AUserCommand: Integer; - var ADescription: string) of object; - - //NOTE: in order for the user commands to be recorded correctly, you must - // put the command itself in the object property. - // you can do this like so: - // - // StringList.AddObject('ecSomeCommand', TObject(ecSomeCommand)) - // - // where ecSomeCommand is the command that you want to add - - TSynEditorOptionsAllUserCommands = procedure(ACommands: TStrings) of object; - - TSynEditorOptionsContainer = class; - - TfmEditorOptionsDialog = class(TForm) - PageControl1: TPageControl; - btnOk: TButton; - btnCancel: TButton; - Display: TTabSheet; - ColorDialog: TColorDialog; - ColorPopup: TPopupMenu; - None1: TMenuItem; - Scrollbar1: TMenuItem; - ActiveCaption1: TMenuItem; - Background1: TMenuItem; - InactiveCaption1: TMenuItem; - Menu1: TMenuItem; - Window1: TMenuItem; - WindowFrame1: TMenuItem; - MEnu2: TMenuItem; - WindowText1: TMenuItem; - CaptionText1: TMenuItem; - ActiveBorder1: TMenuItem; - InactiveBorder1: TMenuItem; - ApplicationWorkspace1: TMenuItem; - Highlight1: TMenuItem; - HighlightText1: TMenuItem; - ButtonFace1: TMenuItem; - ButtonShadow1: TMenuItem; - GrayText1: TMenuItem; - ButtonText1: TMenuItem; - InactiveCaptionText1: TMenuItem; - Highlight2: TMenuItem; - N3dDarkShadow1: TMenuItem; - N3DLight1: TMenuItem; - InfoTipText1: TMenuItem; - InfoTipBackground1: TMenuItem; - ImageList1: TImageList; - Options: TTabSheet; - Keystrokes: TTabSheet; - gbBookmarks: TGroupBox; - ckBookmarkKeys: TCheckBox; - ckBookmarkVisible: TCheckBox; - gbLineSpacing: TGroupBox; - eLineSpacing: TEdit; - gbGutter: TGroupBox; - Label1: TLabel; - ckGutterAutosize: TCheckBox; - ckGutterShowLineNumbers: TCheckBox; - ckGutterShowLeaderZeros: TCheckBox; - ckGutterStartAtZero: TCheckBox; - ckGutterVisible: TCheckBox; - gbRightEdge: TGroupBox; - Label3: TLabel; - pRightEdgeBack: TPanel; - eRightEdge: TEdit; - gbEditorFont: TGroupBox; - btnFont: TButton; - gbOptions: TGroupBox; - ckAutoIndent: TCheckBox; - ckDragAndDropEditing: TCheckBox; - ckHalfPageScroll: TCheckBox; - ckEnhanceEndKey: TCheckBox; - ckScrollByOneLess: TCheckBox; - ckScrollPastEOF: TCheckBox; - ckScrollPastEOL: TCheckBox; - ckShowScrollHint: TCheckBox; - ckSmartTabs: TCheckBox; - ckTabsToSpaces: TCheckBox; - ckTrimTrailingSpaces: TCheckBox; - ckWantTabs: TCheckBox; - gbCaret: TGroupBox; - cInsertCaret: TComboBox; - Label2: TLabel; - Label4: TLabel; - cOverwriteCaret: TComboBox; - Panel3: TPanel; - labFont: TLabel; - FontDialog: TFontDialog; - btnAddKey: TButton; - btnRemKey: TButton; - gbKeyStrokes: TGroupBox; - Label5: TLabel; - Label6: TLabel; - Label7: TLabel; - cKeyCommand: TComboBox; - btnUpdateKey: TButton; - ckAltSetsColumnMode: TCheckBox; - ckKeepCaretX: TCheckBox; - eTabWidth: TEdit; - pRightEdgeColor: TPanel; - Label8: TLabel; - Label9: TLabel; - Label10: TLabel; - cbGutterFont: TCheckBox; - btnGutterFont: TButton; - btnRightEdge: TPanel; - Image1: TImage; - pGutterBack: TPanel; - pGutterColor: TPanel; - btnGutterColor: TPanel; - Image2: TImage; - ckScrollHintFollows: TCheckBox; - ckGroupUndo: TCheckBox; - ckSmartTabDelete: TCheckBox; - ckRightMouseMoves: TCheckBox; - pnlGutterFontDisplay: TPanel; - lblGutterFont: TLabel; - ckEnhanceHomeKey: TCheckBox; - pnlCommands: TPanel; - KeyList: TListView; - ckHideShowScrollbars: TCheckBox; - ckDisableScrollArrows: TCheckBox; - ckShowSpecialChars: TCheckBox; - procedure PopupMenuClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure pGutterColorClick(Sender: TObject); - procedure pRightEdgeColorClick(Sender: TObject); - procedure btnFontClick(Sender: TObject); - procedure KeyListSelectItem(Sender: TObject; Item: TListItem; - Selected: Boolean); - procedure btnUpdateKeyClick(Sender: TObject); - procedure btnAddKeyClick(Sender: TObject); - procedure btnRemKeyClick(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure KeyListEditing(Sender: TObject; Item: TListItem; - var AllowEdit: Boolean); - procedure btnOkClick(Sender: TObject); - procedure btnGutterFontClick(Sender: TObject); - procedure cbGutterFontClick(Sender: TObject); - procedure btnRightEdgeMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure btnGutterColorMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - procedure cKeyCommandKeyUp(Sender: TObject; var Key: Word; - Shift: TShiftState); - procedure KeyListChanging(Sender: TObject; Item: TListItem; - Change: TItemChange; var AllowChange: Boolean); - private - FSynEdit: TSynEditorOptionsContainer; - FPoppedFrom : TColorPopup; - FUserCommand: TSynEditorOptionsUserCommand; - FAllUserCommands: TSynEditorOptionsAllUserCommands; - - OldSelected: TListItem; - InChanging: Boolean; - FExtended: Boolean; - - function GetColor(Item : TMenuItem) : TColor; - procedure GetData; - procedure PutData; - procedure EditStrCallback(const S: string); - procedure FillInKeystrokeInfo(AKey: TSynEditKeystroke; AItem: TListItem); - public - eKeyShort2: TSynHotKey; - eKeyShort1: TSynHotKey; - - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; - property GetUserCommandNames: TSynEditorOptionsUserCommand read FUserCommand - write FUserCommand; - property GetAllUserCommands: TSynEditorOptionsAllUserCommands - read FAllUserCommands - write FAllUserCommands; - property UseExtendedStrings: Boolean read FExtended write FExtended; - end; - - TSynEditOptionsDialog = class(TComponent) - private - FForm: TfmEditorOptionsDialog; - function GetUserCommandNames: TSynEditorOptionsUserCommand; - procedure SetUserCommandNames( - const Value: TSynEditorOptionsUserCommand); - function GetUserCommands: TSynEditorOptionsAllUserCommands; - procedure SetUserCommands( - const Value: TSynEditorOptionsAllUserCommands); - function GetExtended: Boolean; - procedure SetExtended(const Value: Boolean); - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; - property Form: TfmEditorOptionsDialog read FForm; - published - property GetUserCommand: TSynEditorOptionsUserCommand - read GetUserCommandNames - write SetUserCommandNames; - property GetAllUserCommands: TSynEditorOptionsAllUserCommands - read GetUserCommands - write SetUserCommands; - property UseExtendedStrings: Boolean read GetExtended write SetExtended; - end; - - //This class is assignable to a SynEdit without modifying key properties that affect function - TSynEditorOptionsContainer = class(TComponent) - private - FHideSelection: Boolean; - FWantTabs: Boolean; - FMaxUndo: Integer; - FExtraLineSpacing: Integer; - FTabWidth: Integer; - FMaxScrollWidth: Integer; - FRightEdge: Integer; - FSelectedColor: TSynSelectedColor; - FRightEdgeColor: TColor; - FFont: TFont; - FBookmarks: TSynBookMarkOpt; - FOverwriteCaret: TSynEditCaretType; - FInsertCaret: TSynEditCaretType; - FKeystrokes: TSynEditKeyStrokes; - FOptions: TSynEditorOptions; - FSynGutter: TSynGutter; - FColor: TColor; - procedure SetBookMarks(const Value: TSynBookMarkOpt); - procedure SetFont(const Value: TFont); - procedure SetKeystrokes(const Value: TSynEditKeyStrokes); - procedure SetOptions(const Value: TSynEditorOptions); - procedure SetSynGutter(const Value: TSynGutter); - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Assign(Source : TPersistent); override; - procedure AssignTo(Dest : TPersistent); override; - published - property Options : TSynEditorOptions read FOptions write SetOptions; - property BookMarkOptions : TSynBookMarkOpt read FBookmarks write SetBookMarks; - property Color : TColor read FColor write FColor; - property Font : TFont read FFont write SetFont; - property ExtraLineSpacing : Integer read FExtraLineSpacing write FExtraLineSpacing; - property Gutter : TSynGutter read FSynGutter write SetSynGutter; - property RightEdge : Integer read FRightEdge write FRightEdge; - property RightEdgeColor : TColor read FRightEdgeColor write FRightEdgeColor; - property WantTabs : Boolean read FWantTabs write FWantTabs; - property InsertCaret : TSynEditCaretType read FInsertCaret write FInsertCaret; - property OverwriteCaret : TSynEditCaretType read FOverwriteCaret write FOverwriteCaret; - property HideSelection : Boolean read FHideSelection write FHideSelection; - property MaxScrollWidth : Integer read FMaxScrollWidth write FMaxScrollWidth; - property MaxUndo : Integer read FMaxUndo write FMaxUndo; - property SelectedColor : TSynSelectedColor read FSelectedColor write FSelectedColor; - property TabWidth : Integer read FTabWidth write FTabWidth; - property Keystrokes : TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; - end; - -implementation - -{$R *.dfm} - -uses - Types, - SynEditKeyConst, - SynEditMiscProcs; - -{ TSynEditOptionsDialog } - -constructor TSynEditOptionsDialog.create(AOwner: TComponent); -begin - inherited; - FForm:= TfmEditorOptionsDialog.Create(Self); -end; - -destructor TSynEditOptionsDialog.destroy; -begin - FForm.Free; - inherited; -end; - -function TSynEditOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; -begin - Result:= FForm.Execute(EditOptions); -end; - -function TSynEditOptionsDialog.GetUserCommands: TSynEditorOptionsAllUserCommands; -begin - Result := FForm.GetAllUserCommands; -end; - -function TSynEditOptionsDialog.GetUserCommandNames: TSynEditorOptionsUserCommand; -begin - Result := FForm.GetUserCommandNames -end; - -procedure TSynEditOptionsDialog.SetUserCommands( - const Value: TSynEditorOptionsAllUserCommands); -begin - FForm.GetAllUserCommands := Value; -end; - -procedure TSynEditOptionsDialog.SetUserCommandNames( - const Value: TSynEditorOptionsUserCommand); -begin - FForm.GetUserCommandNames := Value; -end; - -function TSynEditOptionsDialog.GetExtended: Boolean; -begin - Result := FForm.UseExtendedStrings; -end; - -procedure TSynEditOptionsDialog.SetExtended(const Value: Boolean); -begin - FForm.UseExtendedStrings := Value; -end; - -{ TSynEditorOptionsContainer } - -procedure TSynEditorOptionsContainer.Assign(Source: TPersistent); -begin - if Assigned(Source) and (Source is TCustomSynEdit) then - begin - Self.Font.Assign(TCustomSynEdit(Source).Font); - Self.BookmarkOptions.Assign(TCustomSynEdit(Source).BookmarkOptions); - Self.Gutter.Assign(TCustomSynEdit(Source).Gutter); - Self.Keystrokes.Assign(TCustomSynEdit(Source).Keystrokes); - Self.SelectedColor.Assign(TCustomSynEdit(Source).SelectedColor); - - Self.Color := TCustomSynEdit(Source).Color; - Self.Options := TCustomSynEdit(Source).Options; - Self.ExtraLineSpacing := TCustomSynEdit(Source).ExtraLineSpacing; - Self.HideSelection := TCustomSynEdit(Source).HideSelection; - Self.InsertCaret := TCustomSynEdit(Source).InsertCaret; - Self.OverwriteCaret := TCustomSynEdit(Source).OverwriteCaret; - Self.MaxUndo := TCustomSynEdit(Source).MaxUndo; - Self.RightEdge := TCustomSynEdit(Source).RightEdge; - Self.RightEdgeColor := TCustomSynEdit(Source).RightEdgeColor; - Self.TabWidth := TCustomSynEdit(Source).TabWidth; - Self.WantTabs := TCustomSynEdit(Source).WantTabs; - end else - inherited; -end; - -procedure TSynEditorOptionsContainer.AssignTo(Dest: TPersistent); -begin - if Assigned(Dest) and (Dest is TCustomSynEdit) then - begin - TCustomSynEdit(Dest).Font.Assign(Self.Font); - TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); - TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); - TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); - TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); - - TCustomSynEdit(Dest).Color := Self.Color; - TCustomSynEdit(Dest).Options := Self.Options; - TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; - TCustomSynEdit(Dest).HideSelection := Self.HideSelection; - TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; - TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; - TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; - TCustomSynEdit(Dest).RightEdge := Self.RightEdge; - TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; - TCustomSynEdit(Dest).TabWidth := Self.TabWidth; - TCustomSynEdit(Dest).WantTabs := Self.WantTabs; - end else - inherited; -end; - -constructor TSynEditorOptionsContainer.create(AOwner: TComponent); -begin - inherited; - FBookmarks:= TSynBookMarkOpt.Create(Self); - FKeystrokes:= TSynEditKeyStrokes.Create(Self); - FSynGutter:= TSynGutter.Create; - FSelectedColor:= TSynSelectedColor.Create; - FSelectedColor.Foreground:= clHighlightText; - FSelectedColor.Background:= clHighlight; - FFont:= TFont.Create; - FFont.Name:= DefaultFontName; - FFont.Size:= 8; - Color:= clWindow; - Keystrokes.ResetDefaults; - Options := [eoAutoIndent,eoDragDropEditing,eoDropFiles,eoScrollPastEol, - eoShowScrollHint,eoSmartTabs,eoAltSetsColumnMode, eoTabsToSpaces,eoTrimTrailingSpaces, eoKeepCaretX]; - ExtraLineSpacing := 0; - HideSelection := False; - InsertCaret := ctVerticalLine; - OverwriteCaret := ctBlock; - MaxScrollWidth := 1024; - MaxUndo := 1024; - RightEdge := 80; - RightEdgeColor := clSilver; - TabWidth := 8; - WantTabs := True; -end; - -destructor TSynEditorOptionsContainer.destroy; -begin - FBookMarks.Free; - FKeyStrokes.Free; - FSynGutter.Free; - FSelectedColor.Free; - FFont.Free; - inherited; -end; - -procedure TSynEditorOptionsContainer.SetBookMarks( - const Value: TSynBookMarkOpt); -begin - FBookmarks.Assign(Value); -end; - -procedure TSynEditorOptionsContainer.SetFont(const Value: TFont); -begin - FFont.Assign(Value); -end; - -procedure TSynEditorOptionsContainer.SetKeystrokes( - const Value: TSynEditKeyStrokes); -begin - FKeystrokes.Assign(Value); -end; - -procedure TSynEditorOptionsContainer.SetOptions( - const Value: TSynEditorOptions); -begin - FOptions:= Value; -end; - -procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); -begin - FSynGutter.Assign(Value); -end; - -{ TfmEditorOptionsDialog } - -function TfmEditorOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; -begin - if (EditOptions = nil) then - begin - Result:= False; - Exit; - end; - //Assign the Containers - FSynEdit:= EditOptions; - //Get Data - GetData; - //Show the form - Result:= Showmodal = mrOk; - //PutData - if Result then PutData; -end; - - -procedure TfmEditorOptionsDialog.GetData; -var I : Integer; - Item : TListItem; -begin - //Gutter - ckGutterVisible.Checked:= FSynEdit.Gutter.Visible; - ckGutterAutosize.Checked:= FSynEdit.Gutter.AutoSize; - ckGutterShowLineNumbers.Checked:= FSynEdit.Gutter.ShowLineNumbers; - ckGutterShowLeaderZeros.Checked:= FSynEdit.Gutter.LeadingZeros; - ckGutterStartAtZero.Checked:= FSynEdit.Gutter.ZeroStart; - cbGutterFont.Checked := FSynEdit.Gutter.UseFontStyle; - pGutterColor.Color:= FSynEdit.Gutter.Color; - lblGutterFont.Font.Assign(FSynEdit.Gutter.Font); - lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; - //Right Edge - eRightEdge.Text:= IntToStr(FSynEdit.RightEdge); - pRightEdgeColor.Color:= FSynEdit.RightEdgeColor; - //Line Spacing - eLineSpacing.Text:= IntToStr(FSynEdit.ExtraLineSpacing); - eTabWidth.Text:= IntToStr(FSynEdit.TabWidth); - //Bookmarks - ckBookmarkKeys.Checked:= FSynEdit.BookMarkOptions.EnableKeys; - ckBookmarkVisible.Checked:= FSynEdit.BookMarkOptions.GlyphsVisible; - //Font - labFont.Font.Assign(FSynEdit.Font); - labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; - //Options - ckAutoIndent.Checked:= eoAutoIndent in FSynEdit.Options; - ckDragAndDropEditing.Checked:= eoDragDropEditing in FSynEdit.Options; - ckWantTabs.Checked:= FSynEdit.WantTabs; - ckSmartTabs.Checked:= eoSmartTabs in FSynEdit.Options; - ckAltSetsColumnMode.Checked:= eoAltSetsColumnMode in FSynEdit.Options; - ckHalfPageScroll.Checked:= eoHalfPageScroll in FSynEdit.Options; - ckScrollByOneLess.Checked:= eoScrollByOneLess in FSynEdit.Options; - ckScrollPastEOF.Checked:= eoScrollPastEof in FSynEdit.Options; - ckScrollPastEOL.Checked:= eoScrollPastEol in FSynEdit.Options; - ckShowScrollHint.Checked:= eoShowScrollHint in FSynEdit.Options; - ckTabsToSpaces.Checked:= eoTabsToSpaces in FSynEdit.Options; - ckTrimTrailingSpaces.Checked:= eoTrimTrailingSpaces in FSynEdit.Options; - ckKeepCaretX.Checked:= eoKeepCaretX in FSynEdit.Options; - ckSmartTabDelete.Checked := eoSmartTabDelete in FSynEdit.Options; - ckRightMouseMoves.Checked := eoRightMouseMovesCursor in FSynEdit.Options; - ckEnhanceHomeKey.Checked := eoEnhanceHomeKey in FSynEdit.Options; - ckEnhanceEndKey.Checked := eoEnhanceEndKey in FSynEdit.Options; - ckGroupUndo.Checked := eoGroupUndo in FSynEdit.Options; - ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.Options; - ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.Options; - ckShowSpecialChars.Checked := eoShowSpecialChars in FSynEdit.Options; - - //Caret - cInsertCaret.ItemIndex:= ord(FSynEdit.InsertCaret); - cOverwriteCaret.ItemIndex:= ord(FSynEdit.OverwriteCaret); - - - KeyList.Items.BeginUpdate; - try - KeyList.Items.Clear; - for I:= 0 to FSynEdit.Keystrokes.Count-1 do - begin - Item:= KeyList.Items.Add; - FillInKeystrokeInfo(FSynEdit.Keystrokes.Items[I], Item); - Item.Data:= FSynEdit.Keystrokes.Items[I]; - end; - if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected:= True; - finally - KeyList.Items.EndUpdate; - end; -end; - -procedure TfmEditorOptionsDialog.PutData; -var - vOptions: TSynEditorOptions; - - procedure SetFlag(aOption: TSynEditorOption; aValue: Boolean); - begin - if aValue then - Include(vOptions, aOption) - else - Exclude(vOptions, aOption); - end; - -begin - //Gutter - FSynEdit.Gutter.Visible:= ckGutterVisible.Checked; - FSynEdit.Gutter.AutoSize := ckGutterAutosize.Checked; - FSynEdit.Gutter.ShowLineNumbers:= ckGutterShowLineNumbers.Checked; - FSynEdit.Gutter.LeadingZeros:= ckGutterShowLeaderZeros.Checked; - FSynEdit.Gutter.ZeroStart:= ckGutterStartAtZero.Checked; - FSynEdit.Gutter.Color:= pGutterColor.Color; - FSynEdit.Gutter.UseFontStyle := cbGutterFont.Checked; - FSynEdit.Gutter.Font.Assign(lblGutterFont.Font); - //Right Edge - FSynEdit.RightEdge:= StrToIntDef(eRightEdge.Text, 80); - FSynEdit.RightEdgeColor:= pRightEdgeColor.Color; - //Line Spacing - FSynEdit.ExtraLineSpacing:= StrToIntDef(eLineSpacing.Text, 0); - FSynEdit.TabWidth:= StrToIntDef(eTabWidth.Text, 8); - //Bookmarks - FSynEdit.BookMarkOptions.EnableKeys:= ckBookmarkKeys.Checked; - FSynEdit.BookMarkOptions.GlyphsVisible:= ckBookmarkVisible.Checked; - //Font - FSynEdit.Font.Assign(labFont.Font); - //Options - FSynEdit.WantTabs:= ckWantTabs.Checked; - vOptions := FSynEdit.Options; //Keep old values for unsupported options - SetFlag(eoAutoIndent, ckAutoIndent.Checked); - SetFlag(eoDragDropEditing, ckDragAndDropEditing.Checked); - SetFlag(eoSmartTabs, ckSmartTabs.Checked); - SetFlag(eoAltSetsColumnMode, ckAltSetsColumnMode.Checked); - SetFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); - SetFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); - SetFlag(eoScrollPastEof, ckScrollPastEOF.Checked); - SetFlag(eoScrollPastEol, ckScrollPastEOL.Checked); - SetFlag(eoShowScrollHint, ckShowScrollHint.Checked); - SetFlag(eoTabsToSpaces, ckTabsToSpaces.Checked); - SetFlag(eoTrimTrailingSpaces, ckTrimTrailingSpaces.Checked); - SetFlag(eoKeepCaretX, ckKeepCaretX.Checked); - SetFlag(eoSmartTabDelete, ckSmartTabDelete.Checked); - SetFlag(eoRightMouseMovesCursor, ckRightMouseMoves.Checked); - SetFlag(eoEnhanceHomeKey, ckEnhanceHomeKey.Checked); - SetFlag(eoEnhanceEndKey, ckEnhanceEndKey.Checked); - SetFlag(eoGroupUndo, ckGroupUndo.Checked); - SetFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); - SetFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); - SetFlag(eoShowSpecialChars, ckShowSpecialChars.Checked); - FSynEdit.Options := vOptions; - //Caret - FSynEdit.InsertCaret:= TSynEditCaretType(cInsertCaret.ItemIndex); - FSynEdit.OverwriteCaret:= TSynEditCaretType(cOverwriteCaret.ItemIndex); -end; - -function TfmEditorOptionsDialog.GetColor(Item: TMenuItem): TColor; -begin - if (Item.Tag = -1) or (Item.Tag > 24) then - Result:= clNone - else - Result:= TColor(Byte(Item.Tag) or $80000000); -end; - -procedure TfmEditorOptionsDialog.PopupMenuClick(Sender: TObject); -var C : TColor; -begin - C:= GetColor(TMenuItem(Sender)); - //Set the color based on where it was "popped from" - if (FPoppedFrom = cpGutter) then - pGutterColor.Color:= C - else if (FPoppedFrom = cpRightEdge) then - pRightEdgeColor.Color:= C; -end; - -procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); -var I : Integer; - C : TColor; - B : TBitmap; -begin - KeyList.OnSelectItem := KeyListSelectItem; - - InChanging := False; - B:= TBitmap.Create; - try - B.Width:= 16; - B.Height:= 16; - //Loop through and create colored images - for I:= 0 to ColorPopup.Items.Count-1 do - begin - if ColorPopup.Items[I].Tag = -1 then Continue; - C:= GetColor(ColorPopup.Items[I]); - B.Canvas.Brush.Color:= C; - B.Canvas.Brush.Style:= bsSolid; - B.Canvas.Pen.Style:= psSolid; - B.Canvas.Pen.Color:= clBlack; - B.Canvas.Rectangle(0,0,16,16); - ImageList1.Add(B, nil); - ColorPopup.Items[I].ImageIndex:= ColorPopup.Items[I].Tag; - end; - finally - B.Free; - end; - - eKeyShort1:= TSynHotKey.Create(Self); - with eKeyShort1 do - begin - Parent := gbKeystrokes; - Left := 120; - Top := 55; - Width := 185; - Height := 21; - HotKey := 0; - InvalidKeys := []; - Modifiers := []; - TabOrder := 1; - end; - - eKeyShort2:= TSynHotKey.Create(Self); - with eKeyShort2 do - begin - Parent := gbKeystrokes; - Left := 120; - Top := 87; - Width := 185; - Height := 21; - HotKey := 0; - InvalidKeys := []; - Modifiers := []; - TabOrder := 2; - end; -end; - -procedure TfmEditorOptionsDialog.pGutterColorClick(Sender: TObject); -begin - ColorDialog.Color:= pGutterColor.Color; - if (ColorDialog.Execute) then - begin - pGutterColor.Color:= ColorDialog.Color; - end; -end; - -procedure TfmEditorOptionsDialog.pRightEdgeColorClick(Sender: TObject); -begin - ColorDialog.Color:= pRightEdgeColor.Color; - if (ColorDialog.Execute) then - begin - pRightEdgeColor.Color:= ColorDialog.Color; - end; -end; - -procedure TfmEditorOptionsDialog.btnFontClick(Sender: TObject); -begin - FontDialog.Font.Assign(labFont.Font); - if FontDialog.Execute then - begin - labFont.Font.Assign(FontDialog.Font); - labFont.Caption:= labFont.Font.Name; - labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; - end; -end; - -procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; - Item: TListItem; Selected: Boolean); -begin - if KeyList.Selected = nil then Exit; - cKeyCommand.Text := KeyList.Selected.Caption; - cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(KeyList.Selected.Caption); - eKeyShort1.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut; - eKeyShort2.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut2; - OldSelected := Item; -end; - -procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); -var Cmd : Integer; -{ KeyLoc : Integer; - TmpCommand : string; - OldShortcut : TShortcut; - OldShortcut2 : TShortcut; -} -begin - if (KeyList.Selected = nil) and (Sender <> btnAddKey) then - begin - btnAddKey.Click; - Exit; - end; - - if KeyList.Selected = nil then Exit; - if cKeyCommand.ItemIndex < 0 then Exit; - - Cmd := Integer(cKeyCommand.Items.Objects[cKeyCommand.ItemIndex]); - - TSynEditKeyStroke(OldSelected.Data).Command:= Cmd; - - if eKeyShort1.HotKey <> 0 then - TSynEditKeyStroke(OldSelected.Data).ShortCut := eKeyShort1.HotKey; - - if eKeyShort2.HotKey <> 0 then - TSynEditKeyStroke(OldSelected.Data).ShortCut2:= eKeyShort2.HotKey; - - FillInKeystrokeInfo(TSynEditKeyStroke(OldSelected.Data), KeyList.Selected); -end; - -procedure TfmEditorOptionsDialog.btnAddKeyClick(Sender: TObject); -var Item : TListItem; -begin - if cKeyCommand.ItemIndex < 0 then Exit; - Item:= KeyList.Items.Add; - Item.Data:= FSynEdit.Keystrokes.Add; - Item.Selected:= True; - btnUpdateKeyClick(btnAddKey); -end; - -procedure TfmEditorOptionsDialog.btnRemKeyClick(Sender: TObject); -begin - if KeyList.Selected = nil then Exit; - TSynEditKeyStroke(KeyList.Selected.Data).Free; - KeyList.Selected.Delete; -end; - -procedure TfmEditorOptionsDialog.EditStrCallback(const S: string); -begin - //Add the Item - if FExtended then - cKeyCommand.Items.AddObject(S, TObject(ConvertExtendedToCommand(S))) - else cKeyCommand.Items.AddObject(S, TObject(ConvertCodeStringToCommand(S))); -end; - -procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); -var Commands: TStringList; - i : Integer; -begin -//We need to do this now because it will not have been assigned when -//create occurs - cKeyCommand.Items.Clear; - //Start the callback to add the strings - if FExtended then - GetEditorCommandExtended(EditStrCallback) - else - GetEditorCommandValues(EditStrCallBack); - //Now add in the user defined ones if they have any - if Assigned(FAllUserCommands) then - begin - Commands := TStringList.Create; - try - FAllUserCommands(Commands); - for i := 0 to Commands.Count - 1 do - if Commands.Objects[i] <> nil then - cKeyCommand.Items.AddObject(Commands[i], Commands.Objects[i]); - finally - Commands.Free; - end; - end; - - PageControl1.ActivePage := PageControl1.Pages[0]; -end; - -procedure TfmEditorOptionsDialog.KeyListEditing(Sender: TObject; - Item: TListItem; var AllowEdit: Boolean); -begin - AllowEdit:= False; -end; - - -procedure TfmEditorOptionsDialog.btnOkClick(Sender: TObject); -begin - btnUpdateKey.Click; - ModalResult:= mrOk; -end; - -procedure TfmEditorOptionsDialog.btnGutterFontClick(Sender: TObject); -begin - FontDialog.Font.Assign(lblGutterFont.Font); - if FontDialog.Execute then - begin - lblGutterFont.Font.Assign(FontDialog.Font); - lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; - end; -end; - -procedure TfmEditorOptionsDialog.cbGutterFontClick(Sender: TObject); -begin - lblGutterFont.Enabled := cbGutterFont.Checked; - btnGutterFont.Enabled := cbGutterFont.Checked; -end; - -procedure TfmEditorOptionsDialog.btnRightEdgeMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var P : TPoint; -begin - FPoppedFrom:= cpRightEdge; - P:= pRightEdgeColor.ClientToScreen(Point(-1, pRightEdgeColor.Height-1)); - btnRightEdge.BevelOuter := bvLowered; - ColorPopup.Popup(P.X, P.Y); - btnRightEdge.BevelOuter := bvNone; -end; - -procedure TfmEditorOptionsDialog.btnGutterColorMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var P : TPoint; -begin - FPoppedFrom:= cpGutter; - P:= pGutterColor.ClientToScreen(Point(-1, pGutterColor.Height-1)); - btnGutterColor.BevelOuter := bvLowered; - ColorPopup.Popup(P.X, P.Y); - btnGutterColor.BevelOuter := bvNone; -end; - -procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( - AKey: TSynEditKeystroke; AItem: TListItem); -var TmpString: String; -begin - with AKey do - begin - if Command >= ecUserFirst then - begin - TmpString := 'User Command'; - if Assigned(GetUserCommandNames) then - GetUserCommandNames(Command, TmpString); - end else begin - if FExtended then - TmpString := ConvertCodeStringToExtended(EditorCommandToCodeString(Command)) - else TmpString := EditorCommandToCodeString(Command); - end; - - AItem.Caption:= TmpString; - AItem.SubItems.Clear; - - TmpString := ''; - if Shortcut <> 0 then - TmpString := ShortCutToText(ShortCut); - - if (TmpString <> '') and (Shortcut2 <> 0) then - TmpString := TmpString + ' ' + ShortCutToText(ShortCut2); - - AItem.SubItems.Add(TmpString); - end; -end; - -procedure TfmEditorOptionsDialog.cKeyCommandKeyUp(Sender: TObject; - var Key: Word; Shift: TShiftState); -begin - if Key = SYNEDIT_RETURN then btnUpdateKey.Click; -end; - -procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; - Item: TListItem; Change: TItemChange; var AllowChange: Boolean); -begin -//make sure that it's saved. - if InChanging then exit; - InChanging := True; - if Visible then - begin - if (Item = OldSelected) and - ((Item.Caption <> cKeyCommand.Text) or - (TSynEditKeystroke(Item.Data).ShortCut <> eKeyShort1.HotKey) or - (TSynEditKeystroke(Item.Data).ShortCut2 <> eKeyShort2.HotKey)) then - begin - btnUpdateKeyClick(btnUpdateKey); - end; - end; - InChanging := False; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEdit.pas, released 2000-04-07. +The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of +the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +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: SynEditOptionsDialog.pas,v 1.21.2.5 2005/07/20 13:37:18 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITOPTIONSDIALOG} +unit SynEditOptionsDialog; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} + Windows, + Messages, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + ComCtrls, + CommCtrl, + Registry, + ExtCtrls, + Buttons, + {$IFDEF SYN_DELPHI_4_UP} + ImgList, + {$ENDIF} + Menus, + SynEdit, + SynEditHighlighter, + SynEditMiscClasses, + SynEditKeyCmds, + Classes, + SysUtils; + +type +{$IFNDEF SYN_DELPHI_4_UP} + TLVSelectItemEvent = procedure(Sender: TObject; Item: TListItem; + Selected: Boolean) of object; +{$ENDIF} + + TColorPopup = (cpGutter, cpRightEdge); + + TSynEditorOptionsUserCommand = procedure(AUserCommand: Integer; + var ADescription: string) of object; + + //NOTE: in order for the user commands to be recorded correctly, you must + // put the command itself in the object property. + // you can do this like so: + // + // StringList.AddObject('ecSomeCommand', TObject(ecSomeCommand)) + // + // where ecSomeCommand is the command that you want to add + + TSynEditorOptionsAllUserCommands = procedure(ACommands: TStrings) of object; + + TSynEditorOptionsContainer = class; + + TfmEditorOptionsDialog = class(TForm) + btnAddKey: TButton; + btnCancel: TButton; + btnFont: TButton; + btnGutterColor: TPanel; + btnGutterFont: TButton; + btnOk: TButton; + btnRemKey: TButton; + btnRightEdge: TPanel; + btnUpdateKey: TButton; + cbGutterFont: TCheckBox; + cInsertCaret: TComboBox; + ckAltSetsColumnMode: TCheckBox; + ckAutoIndent: TCheckBox; + ckAutoSizeMaxWidth: TCheckBox; + ckBookmarkKeys: TCheckBox; + ckBookmarkVisible: TCheckBox; + ckDisableScrollArrows: TCheckBox; + ckDragAndDropEditing: TCheckBox; + ckEnhanceEndKey: TCheckBox; + ckEnhanceHomeKey: TCheckBox; + cKeyCommand: TComboBox; + ckGroupUndo: TCheckBox; + ckGutterAutosize: TCheckBox; + ckGutterShowLeaderZeros: TCheckBox; + ckGutterShowLineNumbers: TCheckBox; + ckGutterStartAtZero: TCheckBox; + ckGutterVisible: TCheckBox; + ckHalfPageScroll: TCheckBox; + ckHideShowScrollbars: TCheckBox; + ckKeepCaretX: TCheckBox; + ckRightMouseMoves: TCheckBox; + ckScrollByOneLess: TCheckBox; + ckScrollHintFollows: TCheckBox; + ckScrollPastEOF: TCheckBox; + ckScrollPastEOL: TCheckBox; + ckShowScrollHint: TCheckBox; + ckShowSpecialChars: TCheckBox; + ckSmartTabDelete: TCheckBox; + ckSmartTabs: TCheckBox; + ckTabIndent: TCheckBox; + ckTabsToSpaces: TCheckBox; + ckTrimTrailingSpaces: TCheckBox; + ckWantTabs: TCheckBox; + ColorDialog: TColorDialog; + ColorPopup: TPopupMenu; + cOverwriteCaret: TComboBox; + Display: TTabSheet; + eLineSpacing: TEdit; + eRightEdge: TEdit; + eTabWidth: TEdit; + FontDialog: TFontDialog; + gbBookmarks: TGroupBox; + gbCaret: TGroupBox; + gbEditorFont: TGroupBox; + gbGutter: TGroupBox; + gbKeyStrokes: TGroupBox; + gbLineSpacing: TGroupBox; + gbOptions: TGroupBox; + gbRightEdge: TGroupBox; + Image1: TImage; + Image2: TImage; + ImageList: TImageList; + KeyList: TListView; + Keystrokes: TTabSheet; + lblCommand: TLabel; + lblEdgeColor: TLabel; + lblEdgeColumn: TLabel; + lblExtraLines: TLabel; + lblFont: TLabel; + lblGutterColor: TLabel; + lblGutterFont: TLabel; + lblInsertCaret: TLabel; + lblKeystroke: TLabel; + lblKeystroke2: TLabel; + lblOverwriteCaret: TLabel; + lblTabWidth: TLabel; + Menu2: TMenuItem; + mnu3dDarkShadow: TMenuItem; + mnu3DLight: TMenuItem; + mnuActiveBorder: TMenuItem; + mnuActiveCaption: TMenuItem; + mnuApplicationWorkspace: TMenuItem; + mnuBackground: TMenuItem; + mnuButtonFace: TMenuItem; + mnuButtonShadow: TMenuItem; + mnuButtonText: TMenuItem; + mnuCaptionText: TMenuItem; + mnuGrayText: TMenuItem; + mnuHighlight: TMenuItem; + mnuHighlight2: TMenuItem; + mnuHighlightText: TMenuItem; + mnuInactiveBorder: TMenuItem; + mnuInactiveCaption: TMenuItem; + mnuInactiveCaptionText: TMenuItem; + mnuInfoTipBackground: TMenuItem; + mnuInfoTipText: TMenuItem; + mnuMenu: TMenuItem; + mnuNone: TMenuItem; + mnuScrollBar: TMenuItem; + mnuWindow: TMenuItem; + mnuWindowFrame: TMenuItem; + mnuWindowText: TMenuItem; + Options: TTabSheet; + PageControl: TPageControl; + pnlGutterBack: TPanel; + pnlGutterColor: TPanel; + pnlCommands: TPanel; + pnlEditorFont: TPanel; + pnlGutterFontDisplay: TPanel; + pnlRightEdgeBack: TPanel; + pnlRightEdgeColor: TPanel; + procedure PopupMenuClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure pnlGutterColorClick(Sender: TObject); + procedure pnlRightEdgeColorClick(Sender: TObject); + procedure btnFontClick(Sender: TObject); + procedure KeyListSelectItem(Sender: TObject; Item: TListItem; + Selected: Boolean); + procedure btnUpdateKeyClick(Sender: TObject); + procedure btnAddKeyClick(Sender: TObject); + procedure btnRemKeyClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure KeyListEditing(Sender: TObject; Item: TListItem; + var AllowEdit: Boolean); + procedure btnOkClick(Sender: TObject); + procedure btnGutterFontClick(Sender: TObject); + procedure cbGutterFontClick(Sender: TObject); + procedure btnRightEdgeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure btnGutterColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure cKeyCommandExit(Sender: TObject); + procedure cKeyCommandKeyPress(Sender: TObject; var Key: Char); + procedure cKeyCommandKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure KeyListChanging(Sender: TObject; Item: TListItem; + Change: TItemChange; var AllowChange: Boolean); + private + FSynEdit: TSynEditorOptionsContainer; + FPoppedFrom : TColorPopup; + FUserCommand: TSynEditorOptionsUserCommand; + FAllUserCommands: TSynEditorOptionsAllUserCommands; + + FOldSelected: TListItem; + FInChanging: Boolean; + FExtended: Boolean; + + {$IFNDEF SYN_COMPILER_4_UP} + FOldWndProc: TWndMethod; + procedure OverridingWndProc(var Message: TMessage); + {$ENDIF} + + function GetColor(Item : TMenuItem) : TColor; + procedure GetData; + procedure PutData; + procedure EditStrCallback(const S: string); + procedure FillInKeystrokeInfo(AKey: TSynEditKeystroke; AItem: TListItem); + public + eKeyShort2: TSynHotKey; + eKeyShort1: TSynHotKey; + {$IFNDEF SYN_DELPHI_4_UP} + FOnSelectItem: TLVSelectItemEvent; + {$ENDIF} + + function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + property GetUserCommandNames: TSynEditorOptionsUserCommand read FUserCommand + write FUserCommand; + property GetAllUserCommands: TSynEditorOptionsAllUserCommands + read FAllUserCommands + write FAllUserCommands; + property UseExtendedStrings: Boolean read FExtended write FExtended; + end; + + TSynEditOptionsDialog = class(TComponent) + private + FForm: TfmEditorOptionsDialog; + function GetUserCommandNames: TSynEditorOptionsUserCommand; + procedure SetUserCommandNames( + const Value: TSynEditorOptionsUserCommand); + function GetUserCommands: TSynEditorOptionsAllUserCommands; + procedure SetUserCommands( + const Value: TSynEditorOptionsAllUserCommands); + function GetExtended: Boolean; + procedure SetExtended(const Value: Boolean); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + property Form: TfmEditorOptionsDialog read FForm; + published + property GetUserCommand: TSynEditorOptionsUserCommand + read GetUserCommandNames + write SetUserCommandNames; + property GetAllUserCommands: TSynEditorOptionsAllUserCommands + read GetUserCommands + write SetUserCommands; + property UseExtendedStrings: Boolean read GetExtended write SetExtended; + end; + + //This class is assignable to a SynEdit without modifying key properties that affect function + TSynEditorOptionsContainer = class(TComponent) + private + FHideSelection: Boolean; + FWantTabs: Boolean; + FMaxUndo: Integer; + FExtraLineSpacing: Integer; + FTabWidth: Integer; + FMaxScrollWidth: Integer; + FRightEdge: Integer; + FSelectedColor: TSynSelectedColor; + FRightEdgeColor: TColor; + FFont: TFont; + FBookmarks: TSynBookMarkOpt; + FOverwriteCaret: TSynEditCaretType; + FInsertCaret: TSynEditCaretType; + FKeystrokes: TSynEditKeyStrokes; + FOptions: TSynEditorOptions; + FSynGutter: TSynGutter; + FColor: TColor; + procedure SetBookMarks(const Value: TSynBookMarkOpt); + procedure SetFont(const Value: TFont); + procedure SetKeystrokes(const Value: TSynEditKeyStrokes); + procedure SetOptions(const Value: TSynEditorOptions); + procedure SetSynGutter(const Value: TSynGutter); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Assign(Source : TPersistent); override; + procedure AssignTo(Dest : TPersistent); override; + published + property Options : TSynEditorOptions read FOptions write SetOptions; + property BookMarkOptions : TSynBookMarkOpt read FBookmarks write SetBookMarks; + property Color : TColor read FColor write FColor; + property Font : TFont read FFont write SetFont; + property ExtraLineSpacing : Integer read FExtraLineSpacing write FExtraLineSpacing; + property Gutter : TSynGutter read FSynGutter write SetSynGutter; + property RightEdge : Integer read FRightEdge write FRightEdge; + property RightEdgeColor : TColor read FRightEdgeColor write FRightEdgeColor; + property WantTabs : Boolean read FWantTabs write FWantTabs; + property InsertCaret : TSynEditCaretType read FInsertCaret write FInsertCaret; + property OverwriteCaret : TSynEditCaretType read FOverwriteCaret write FOverwriteCaret; + property HideSelection : Boolean read FHideSelection write FHideSelection; + property MaxScrollWidth : Integer read FMaxScrollWidth write FMaxScrollWidth; + property MaxUndo : Integer read FMaxUndo write FMaxUndo; + property SelectedColor : TSynSelectedColor read FSelectedColor write FSelectedColor; + property TabWidth : Integer read FTabWidth write FTabWidth; + property Keystrokes : TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + end; + +implementation + +{$R *.dfm} + +uses + SynEditKeyConst; + +{ TSynEditOptionsDialog } + +constructor TSynEditOptionsDialog.create(AOwner: TComponent); +begin + inherited; + FForm := TfmEditorOptionsDialog.Create(Self); +end; + +destructor TSynEditOptionsDialog.destroy; +begin + FForm.Free; + inherited; +end; + +function TSynEditOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +begin + Result := FForm.Execute(EditOptions); +end; + +function TSynEditOptionsDialog.GetUserCommands: TSynEditorOptionsAllUserCommands; +begin + Result := FForm.GetAllUserCommands; +end; + +function TSynEditOptionsDialog.GetUserCommandNames: TSynEditorOptionsUserCommand; +begin + Result := FForm.GetUserCommandNames +end; + +procedure TSynEditOptionsDialog.SetUserCommands( + const Value: TSynEditorOptionsAllUserCommands); +begin + FForm.GetAllUserCommands := Value; +end; + +procedure TSynEditOptionsDialog.SetUserCommandNames( + const Value: TSynEditorOptionsUserCommand); +begin + FForm.GetUserCommandNames := Value; +end; + +function TSynEditOptionsDialog.GetExtended: Boolean; +begin + Result := FForm.UseExtendedStrings; +end; + +procedure TSynEditOptionsDialog.SetExtended(const Value: Boolean); +begin + FForm.UseExtendedStrings := Value; +end; + +{ TSynEditorOptionsContainer } + +procedure TSynEditorOptionsContainer.Assign(Source: TPersistent); +begin + if Assigned(Source) and (Source is TCustomSynEdit) then + begin + Self.Font.Assign(TCustomSynEdit(Source).Font); + Self.BookmarkOptions.Assign(TCustomSynEdit(Source).BookmarkOptions); + Self.Gutter.Assign(TCustomSynEdit(Source).Gutter); + Self.Keystrokes.Assign(TCustomSynEdit(Source).Keystrokes); + Self.SelectedColor.Assign(TCustomSynEdit(Source).SelectedColor); + + Self.Color := TCustomSynEdit(Source).Color; + Self.Options := TCustomSynEdit(Source).Options; + Self.ExtraLineSpacing := TCustomSynEdit(Source).ExtraLineSpacing; + Self.HideSelection := TCustomSynEdit(Source).HideSelection; + Self.InsertCaret := TCustomSynEdit(Source).InsertCaret; + Self.OverwriteCaret := TCustomSynEdit(Source).OverwriteCaret; + Self.MaxScrollWidth := TCustomSynEdit(Source).MaxScrollWidth; + Self.MaxUndo := TCustomSynEdit(Source).MaxUndo; + Self.RightEdge := TCustomSynEdit(Source).RightEdge; + Self.RightEdgeColor := TCustomSynEdit(Source).RightEdgeColor; + Self.TabWidth := TCustomSynEdit(Source).TabWidth; + Self.WantTabs := TCustomSynEdit(Source).WantTabs; + end else + inherited; +end; + +procedure TSynEditorOptionsContainer.AssignTo(Dest: TPersistent); +begin + if Assigned(Dest) and (Dest is TCustomSynEdit) then + begin + TCustomSynEdit(Dest).Font.Assign(Self.Font); + TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); + TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); + TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); + TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); + + TCustomSynEdit(Dest).Color := Self.Color; + TCustomSynEdit(Dest).Options := Self.Options; + TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; + TCustomSynEdit(Dest).HideSelection := Self.HideSelection; + TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; + TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; + TCustomSynEdit(Dest).MaxScrollWidth := Self.MaxScrollWidth; + TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; + TCustomSynEdit(Dest).RightEdge := Self.RightEdge; + TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; + TCustomSynEdit(Dest).TabWidth := Self.TabWidth; + TCustomSynEdit(Dest).WantTabs := Self.WantTabs; + end else + inherited; +end; + +constructor TSynEditorOptionsContainer.create(AOwner: TComponent); +begin + inherited; + FBookmarks := TSynBookMarkOpt.Create(Self); + FKeystrokes := TSynEditKeyStrokes.Create(Self); + FSynGutter := TSynGutter.Create; + FSelectedColor := TSynSelectedColor.Create; + FSelectedColor.Foreground := clHighlightText; + FSelectedColor.Background := clHighlight; + FFont := TFont.Create; + FFont.Name := 'Courier New'; + FFont.Size := 8; + Color := clWindow; + Keystrokes.ResetDefaults; + Options := [eoAutoIndent,eoDragDropEditing,eoDropFiles,eoScrollPastEol, + eoShowScrollHint,eoSmartTabs,eoAltSetsColumnMode, eoTabsToSpaces,eoTrimTrailingSpaces, eoKeepCaretX]; + ExtraLineSpacing := 0; + HideSelection := False; + InsertCaret := ctVerticalLine; + OverwriteCaret := ctBlock; + MaxScrollWidth := 1024; + MaxUndo := 1024; + RightEdge := 80; + RightEdgeColor := clSilver; + TabWidth := 8; + WantTabs := True; +end; + +destructor TSynEditorOptionsContainer.destroy; +begin + FBookMarks.Free; + FKeyStrokes.Free; + FSynGutter.Free; + FSelectedColor.Free; + FFont.Free; + inherited; +end; + +procedure TSynEditorOptionsContainer.SetBookMarks( + const Value: TSynBookMarkOpt); +begin + FBookmarks.Assign(Value); +end; + +procedure TSynEditorOptionsContainer.SetFont(const Value: TFont); +begin + FFont.Assign(Value); +end; + +procedure TSynEditorOptionsContainer.SetKeystrokes( + const Value: TSynEditKeyStrokes); +begin + FKeystrokes.Assign(Value); +end; + +procedure TSynEditorOptionsContainer.SetOptions( + const Value: TSynEditorOptions); +begin + FOptions := Value; +end; + +procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); +begin + FSynGutter.Assign(Value); +end; + +{ TfmEditorOptionsDialog } + +function TfmEditorOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +begin + if (EditOptions = nil) then + begin + Result := False; + Exit; + end; + //Assign the Containers + FSynEdit := EditOptions; + //Get Data + GetData; + //Show the form + Result := Showmodal = mrOk; + //PutData + if Result then PutData; +end; + + +procedure TfmEditorOptionsDialog.GetData; +var I : Integer; + Item : TListItem; +begin + //Gutter + ckGutterVisible.Checked := FSynEdit.Gutter.Visible; + ckGutterAutosize.Checked := FSynEdit.Gutter.AutoSize; + ckGutterShowLineNumbers.Checked := FSynEdit.Gutter.ShowLineNumbers; + ckGutterShowLeaderZeros.Checked := FSynEdit.Gutter.LeadingZeros; + ckGutterStartAtZero.Checked := FSynEdit.Gutter.ZeroStart; + cbGutterFont.Checked := FSynEdit.Gutter.UseFontStyle; + pnlGutterColor.Color := FSynEdit.Gutter.Color; + lblGutterFont.Font.Assign(FSynEdit.Gutter.Font); + lblGutterFont.Caption := lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; + //Right Edge + eRightEdge.Text := IntToStr(FSynEdit.RightEdge); + pnlRightEdgeColor.Color := FSynEdit.RightEdgeColor; + //Line Spacing + eLineSpacing.Text := IntToStr(FSynEdit.ExtraLineSpacing); + eTabWidth.Text := IntToStr(FSynEdit.TabWidth); + //Bookmarks + ckBookmarkKeys.Checked := FSynEdit.BookMarkOptions.EnableKeys; + ckBookmarkVisible.Checked := FSynEdit.BookMarkOptions.GlyphsVisible; + //Font + lblFont.Font.Assign(FSynEdit.Font); + lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + //Options + ckAutoIndent.Checked := eoAutoIndent in FSynEdit.Options; + ckAutoSizeMaxWidth.Checked := eoAutoSizeMaxScrollWidth in FSynEdit.Options; + ckDragAndDropEditing.Checked := eoDragDropEditing in FSynEdit.Options; + ckWantTabs.Checked := FSynEdit.WantTabs; + ckSmartTabs.Checked := eoSmartTabs in FSynEdit.Options; + ckAltSetsColumnMode.Checked := eoAltSetsColumnMode in FSynEdit.Options; + ckHalfPageScroll.Checked := eoHalfPageScroll in FSynEdit.Options; + ckScrollByOneLess.Checked := eoScrollByOneLess in FSynEdit.Options; + ckScrollPastEOF.Checked := eoScrollPastEof in FSynEdit.Options; + ckScrollPastEOL.Checked := eoScrollPastEol in FSynEdit.Options; + ckShowScrollHint.Checked := eoShowScrollHint in FSynEdit.Options; + ckTabsToSpaces.Checked := eoTabsToSpaces in FSynEdit.Options; + ckTrimTrailingSpaces.Checked := eoTrimTrailingSpaces in FSynEdit.Options; + ckKeepCaretX.Checked := eoKeepCaretX in FSynEdit.Options; + ckSmartTabDelete.Checked := eoSmartTabDelete in FSynEdit.Options; + ckRightMouseMoves.Checked := eoRightMouseMovesCursor in FSynEdit.Options; + ckEnhanceHomeKey.Checked := eoEnhanceHomeKey in FSynEdit.Options; + ckEnhanceEndKey.Checked := eoEnhanceEndKey in FSynEdit.Options; + ckGroupUndo.Checked := eoGroupUndo in FSynEdit.Options; + ckTabIndent.Checked := eoTabIndent in FSynEdit.Options; + ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.Options; + ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.Options; + ckShowSpecialChars.Checked := eoShowSpecialChars in FSynEdit.Options; + + //Caret + cInsertCaret.ItemIndex := ord(FSynEdit.InsertCaret); + cOverwriteCaret.ItemIndex := ord(FSynEdit.OverwriteCaret); + + + KeyList.Items.BeginUpdate; + try + KeyList.Items.Clear; + for I := 0 to FSynEdit.Keystrokes.Count-1 do + begin + Item := KeyList.Items.Add; + FillInKeystrokeInfo(FSynEdit.Keystrokes.Items[I], Item); + Item.Data := FSynEdit.Keystrokes.Items[I]; + end; + if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected := True; + finally + KeyList.Items.EndUpdate; + end; +end; + +procedure TfmEditorOptionsDialog.PutData; +var + vOptions: TSynEditorOptions; + + procedure SetFlag(aOption: TSynEditorOption; aValue: Boolean); + begin + if aValue then + Include(vOptions, aOption) + else + Exclude(vOptions, aOption); + end; + +begin + //Gutter + FSynEdit.Gutter.Visible := ckGutterVisible.Checked; + FSynEdit.Gutter.AutoSize := ckGutterAutosize.Checked; + FSynEdit.Gutter.ShowLineNumbers := ckGutterShowLineNumbers.Checked; + FSynEdit.Gutter.LeadingZeros := ckGutterShowLeaderZeros.Checked; + FSynEdit.Gutter.ZeroStart := ckGutterStartAtZero.Checked; + FSynEdit.Gutter.Color := pnlGutterColor.Color; + FSynEdit.Gutter.UseFontStyle := cbGutterFont.Checked; + FSynEdit.Gutter.Font.Assign(lblGutterFont.Font); + //Right Edge + FSynEdit.RightEdge := StrToIntDef(eRightEdge.Text, 80); + FSynEdit.RightEdgeColor := pnlRightEdgeColor.Color; + //Line Spacing + FSynEdit.ExtraLineSpacing := StrToIntDef(eLineSpacing.Text, 0); + FSynEdit.TabWidth := StrToIntDef(eTabWidth.Text, 8); + //Bookmarks + FSynEdit.BookMarkOptions.EnableKeys := ckBookmarkKeys.Checked; + FSynEdit.BookMarkOptions.GlyphsVisible := ckBookmarkVisible.Checked; + //Font + FSynEdit.Font.Assign(lblFont.Font); + //Options + FSynEdit.WantTabs := ckWantTabs.Checked; + vOptions := FSynEdit.Options; //Keep old values for unsupported options + SetFlag(eoAutoIndent, ckAutoIndent.Checked); + SetFlag(eoAutoSizeMaxScrollWidth, ckAutoSizeMaxWidth.Checked); + SetFlag(eoDragDropEditing, ckDragAndDropEditing.Checked); + SetFlag(eoSmartTabs, ckSmartTabs.Checked); + SetFlag(eoAltSetsColumnMode, ckAltSetsColumnMode.Checked); + SetFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); + SetFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); + SetFlag(eoScrollPastEof, ckScrollPastEOF.Checked); + SetFlag(eoScrollPastEol, ckScrollPastEOL.Checked); + SetFlag(eoShowScrollHint, ckShowScrollHint.Checked); + SetFlag(eoTabIndent, ckTabIndent.Checked); + SetFlag(eoTabsToSpaces, ckTabsToSpaces.Checked); + SetFlag(eoTrimTrailingSpaces, ckTrimTrailingSpaces.Checked); + SetFlag(eoKeepCaretX, ckKeepCaretX.Checked); + SetFlag(eoSmartTabDelete, ckSmartTabDelete.Checked); + SetFlag(eoRightMouseMovesCursor, ckRightMouseMoves.Checked); + SetFlag(eoEnhanceHomeKey, ckEnhanceHomeKey.Checked); + SetFlag(eoEnhanceEndKey, ckEnhanceEndKey.Checked); + SetFlag(eoGroupUndo, ckGroupUndo.Checked); + SetFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); + SetFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); + SetFlag(eoShowSpecialChars, ckShowSpecialChars.Checked); + FSynEdit.Options := vOptions; + //Caret + FSynEdit.InsertCaret := TSynEditCaretType(cInsertCaret.ItemIndex); + FSynEdit.OverwriteCaret := TSynEditCaretType(cOverwriteCaret.ItemIndex); +end; + +function TfmEditorOptionsDialog.GetColor(Item: TMenuItem): TColor; +begin + if (Item.Tag = -1) or (Item.Tag > 24) then + Result := clNone + else + Result := TColor(Byte(Item.Tag) or $80000000); +end; + +procedure TfmEditorOptionsDialog.PopupMenuClick(Sender: TObject); +var C : TColor; +begin + C := GetColor(TMenuItem(Sender)); + //Set the color based on where it was "popped from" + if (FPoppedFrom = cpGutter) then + pnlGutterColor.Color := C + else if (FPoppedFrom = cpRightEdge) then + pnlRightEdgeColor.Color := C; +end; + +procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); +var I : Integer; + C : TColor; + B : TBitmap; +begin + {$IFDEF SYN_COMPILER_4_UP} + KeyList.OnSelectItem := KeyListSelectItem; + {$ELSE} + FOldWndProc := KeyList.WindowProc; + KeyList.WindowProc := OverridingWndProc; + FOnSelectItem := KeyListSelectItem; + {$ENDIF} + + FInChanging := False; + B := TBitmap.Create; + try + B.Width := 16; + B.Height := 16; + //Loop through and create colored images + for I := 0 to ColorPopup.Items.Count-1 do + begin + if ColorPopup.Items[I].Tag = -1 then Continue; + C := GetColor(ColorPopup.Items[I]); + B.Canvas.Brush.Color := C; + B.Canvas.Brush.Style := bsSolid; + B.Canvas.Pen.Style := psSolid; + B.Canvas.Pen.Color := clBlack; + B.Canvas.Rectangle(0,0,16,16); + ImageList.Add(B, nil); +{$IFDEF SYN_COMPILER_4_UP} + ColorPopup.Items[I].ImageIndex := ColorPopup.Items[I].Tag; +{$ENDIF} + end; + finally + B.Free; + end; + + eKeyShort1 := TSynHotKey.Create(Self); + with eKeyShort1 do + begin + Parent := gbKeystrokes; + Left := 120; + Top := 55; + Width := 185; + Height := 21; + HotKey := 0; + InvalidKeys := []; + Modifiers := []; + TabOrder := 1; + end; + + eKeyShort2 := TSynHotKey.Create(Self); + with eKeyShort2 do + begin + Parent := gbKeystrokes; + Left := 120; + Top := 87; + Width := 185; + Height := 21; + HotKey := 0; + InvalidKeys := []; + Modifiers := []; + TabOrder := 2; + end; +end; + +procedure TfmEditorOptionsDialog.pnlGutterColorClick(Sender: TObject); +begin + ColorDialog.Color := pnlGutterColor.Color; + if (ColorDialog.Execute) then + pnlGutterColor.Color := ColorDialog.Color; +end; + +procedure TfmEditorOptionsDialog.pnlRightEdgeColorClick(Sender: TObject); +begin + ColorDialog.Color := pnlRightEdgeColor.Color; + if (ColorDialog.Execute) then + pnlRightEdgeColor.Color := ColorDialog.Color; +end; + +procedure TfmEditorOptionsDialog.btnFontClick(Sender: TObject); +begin + FontDialog.Font.Assign(lblFont.Font); + if FontDialog.Execute then + begin + lblFont.Font.Assign(FontDialog.Font); + lblFont.Caption := lblFont.Font.Name; + lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + end; +end; + +procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; + Item: TListItem; Selected: Boolean); +begin + if KeyList.Selected = nil then Exit; + cKeyCommand.Text := KeyList.Selected.Caption; + cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(KeyList.Selected.Caption); + eKeyShort1.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut; + eKeyShort2.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut2; + FOldSelected := Item; +end; + +procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); +var Cmd : Integer; +{ KeyLoc : Integer; + TmpCommand : string; + OldShortcut : TShortcut; + OldShortcut2 : TShortcut; +} +begin + if (KeyList.Selected = nil) and (Sender <> btnAddKey) then + begin + btnAddKey.Click; + Exit; + end; + + if KeyList.Selected = nil then Exit; + if cKeyCommand.ItemIndex < 0 then Exit; + + Cmd := Integer(cKeyCommand.Items.Objects[cKeyCommand.ItemIndex]); + + TSynEditKeyStroke(FOldSelected.Data).Command := Cmd; + + if eKeyShort1.HotKey <> 0 then + TSynEditKeyStroke(FOldSelected.Data).ShortCut := eKeyShort1.HotKey; + + if eKeyShort2.HotKey <> 0 then + TSynEditKeyStroke(FOldSelected.Data).ShortCut2 := eKeyShort2.HotKey; + + FillInKeystrokeInfo(TSynEditKeyStroke(FOldSelected.Data), KeyList.Selected); +end; + +procedure TfmEditorOptionsDialog.btnAddKeyClick(Sender: TObject); +var Item : TListItem; +begin + Item := KeyList.Items.Add; + Item.Data := FSynEdit.Keystrokes.Add; + Item.Selected := True; + btnUpdateKeyClick(btnAddKey); +end; + +procedure TfmEditorOptionsDialog.btnRemKeyClick(Sender: TObject); +begin + if KeyList.Selected = nil then Exit; + TSynEditKeyStroke(KeyList.Selected.Data).Free; + KeyList.Selected.Delete; +end; + +procedure TfmEditorOptionsDialog.EditStrCallback(const S: string); +begin + //Add the Item + if FExtended then + cKeyCommand.Items.AddObject(S, TObject(ConvertExtendedToCommand(S))) + else cKeyCommand.Items.AddObject(S, TObject(ConvertCodeStringToCommand(S))); +end; + +procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); +var Commands: TStringList; + i : Integer; +begin +//We need to do this now because it will not have been assigned when +//create occurs + cKeyCommand.Items.Clear; + //Start the callback to add the strings + if FExtended then + GetEditorCommandExtended(EditStrCallback) + else + GetEditorCommandValues(EditStrCallBack); + //Now add in the user defined ones if they have any + if Assigned(FAllUserCommands) then + begin + Commands := TStringList.Create; + try + FAllUserCommands(Commands); + for i := 0 to Commands.Count - 1 do + if Commands.Objects[i] <> nil then + cKeyCommand.Items.AddObject(Commands[i], Commands.Objects[i]); + finally + Commands.Free; + end; + end; + + PageControl.ActivePage := PageControl.Pages[0]; +end; + +procedure TfmEditorOptionsDialog.KeyListEditing(Sender: TObject; + Item: TListItem; var AllowEdit: Boolean); +begin + AllowEdit := False; +end; + + +procedure TfmEditorOptionsDialog.btnOkClick(Sender: TObject); +begin + btnUpdateKey.Click; + ModalResult := mrOk; +end; + +procedure TfmEditorOptionsDialog.btnGutterFontClick(Sender: TObject); +begin + FontDialog.Font.Assign(lblGutterFont.Font); + if FontDialog.Execute then + begin + lblGutterFont.Font.Assign(FontDialog.Font); + lblGutterFont.Caption := lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; + end; +end; + +procedure TfmEditorOptionsDialog.cbGutterFontClick(Sender: TObject); +begin + lblGutterFont.Enabled := cbGutterFont.Checked; + btnGutterFont.Enabled := cbGutterFont.Checked; +end; + +procedure TfmEditorOptionsDialog.btnRightEdgeMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var P : TPoint; +begin + FPoppedFrom := cpRightEdge; + P := pnlRightEdgeColor.ClientToScreen(Point(-1, pnlRightEdgeColor.Height - 1)); + btnRightEdge.BevelOuter := bvLowered; + ColorPopup.Popup(P.X, P.Y); + btnRightEdge.BevelOuter := bvNone; +end; + +procedure TfmEditorOptionsDialog.btnGutterColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var P : TPoint; +begin + FPoppedFrom := cpGutter; + P := pnlGutterColor.ClientToScreen(Point(-1, pnlGutterColor.Height - 1)); + btnGutterColor.BevelOuter := bvLowered; + ColorPopup.Popup(P.X, P.Y); + btnGutterColor.BevelOuter := bvNone; +end; + +procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( + AKey: TSynEditKeystroke; AItem: TListItem); +var TmpString: String; +begin + with AKey do + begin + if Command >= ecUserFirst then + begin + TmpString := 'User Command'; + if Assigned(GetUserCommandNames) then + GetUserCommandNames(Command, TmpString); + end else begin + if FExtended then + TmpString := ConvertCodeStringToExtended(EditorCommandToCodeString(Command)) + else TmpString := EditorCommandToCodeString(Command); + end; + + AItem.Caption := TmpString; + AItem.SubItems.Clear; + + TmpString := ''; + if Shortcut <> 0 then + TmpString := ShortCutToText(ShortCut); + + if (TmpString <> '') and (Shortcut2 <> 0) then + TmpString := TmpString + ' ' + ShortCutToText(ShortCut2); + + AItem.SubItems.Add(TmpString); + + end; + +end; + +procedure TfmEditorOptionsDialog.cKeyCommandExit(Sender: TObject); +VAR TmpIndex : Integer; +begin + TmpIndex := cKeyCommand.Items.IndexOf(cKeyCommand.Text); + if TmpIndex = -1 then + begin + if FExtended then + cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(ConvertCodeStringToExtended('ecNone')) + else cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf('ecNone'); + end else cKeyCommand.ItemIndex := TmpIndex; //need to force it incase they just typed something in + +end; + +procedure TfmEditorOptionsDialog.cKeyCommandKeyPress(Sender: TObject; + var Key: Char); +var WorkStr : string; + i : Integer; +begin +//This would be better if componentized, but oh well... + WorkStr := Uppercase(Copy(cKeyCommand.Text, 1, cKeyCommand.SelStart) + Key); + i := 0; + while i < cKeyCommand.Items.Count do + begin + if pos(WorkStr, Uppercase(cKeyCommand.Items[i])) = 1 then + begin + cKeyCommand.Text := cKeyCommand.Items[i]; + cKeyCommand.SelStart := length(WorkStr); + cKeyCommand.SelLength := Length(cKeyCommand.Text) - cKeyCommand.SelStart; + Key := #0; + Break; + end + else + Inc(i); + end; + +end; + +procedure TfmEditorOptionsDialog.cKeyCommandKeyUp(Sender: TObject; + var Key: Word; Shift: TShiftState); +begin + if Key = SYNEDIT_RETURN then btnUpdateKey.Click; +end; + +procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; + Item: TListItem; Change: TItemChange; var AllowChange: Boolean); +begin +//make sure that it's saved. + if FInChanging then Exit; + FInChanging := True; + if Visible then + begin + if (Item = FOldSelected) and + ((Item.Caption <> cKeyCommand.Text) or + (TSynEditKeystroke(Item.Data).ShortCut <> eKeyShort1.HotKey) or + (TSynEditKeystroke(Item.Data).ShortCut2 <> eKeyShort2.HotKey)) then + begin + btnUpdateKeyClick(btnUpdateKey); + end; + end; + FInChanging := False; +end; + +{$IFNDEF SYN_COMPILER_4_UP} +procedure TfmEditorOptionsDialog.OverridingWndProc(var Message: TMessage); +var + Item: TListItem; +begin + FOldWndProc(Message); + + if Message.Msg = CN_NOTIFY then + with TWMNotify(Message) do + if NMHdr.code = LVN_ITEMCHANGED then + with PNMListView(NMHdr)^ do + begin + Item := KeyList.Items[iItem]; + if Assigned(FOnSelectItem) and (uChanged = LVIF_STATE) then + begin + if (uOldState and LVIS_SELECTED <> 0) and + (uNewState and LVIS_SELECTED = 0) then + FOnSelectItem(Self, Item, False) + else if (uOldState and LVIS_SELECTED = 0) and + (uNewState and LVIS_SELECTED <> 0) then + FOnSelectItem(Self, Item, True); + end; + end; +end; +{$ENDIF} + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditPlugins.pas b/Source/VCL/SynEdit/Source/SynEditPlugins.pas index 63c7d271..dfb40504 100644 --- a/Source/VCL/SynEdit/Source/SynEditPlugins.pas +++ b/Source/VCL/SynEdit/Source/SynEditPlugins.pas @@ -1,555 +1,559 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPlugins.pas, released 2001-10-17. - -Author of this file is Flávio Etrusco. -Portions created by Flávio Etrusco are Copyright 2001 Flávio Etrusco. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPlugins.pas,v 1.8.2.2 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditPlugins; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Menus, - SynEdit, - SynEditTypes, - SynEditKeyCmds, - SynUnicode, - Classes; - -type - TAbstractSynPlugin = class(TComponent) - private - procedure SetEditor(const Value: TCustomSynEdit); - function GetEditors(aIndex: integer): TCustomSynEdit; - function GetEditor: TCustomSynEdit; - function GetEditorCount: integer; - protected - fEditors: TList; - procedure Notification(aComponent: TComponent; - aOperation: TOperation); override; - procedure DoAddEditor(aEditor: TCustomSynEdit); virtual; - procedure DoRemoveEditor(aEditor: TCustomSynEdit); virtual; - function AddEditor(aEditor: TCustomSynEdit): integer; - function RemoveEditor(aEditor: TCustomSynEdit): integer; - public - destructor Destroy; override; - property Editors[aIndex: integer]: TCustomSynEdit read GetEditors; - property EditorCount: integer read GetEditorCount; - published - property Editor: TCustomSynEdit read GetEditor write SetEditor; - end; - - TAbstractSynHookerPlugin = class(TAbstractSynPlugin) - protected - procedure HookEditor(aEditor: TCustomSynEdit; aCommandID: TSynEditorCommand; - aOldShortCut, aNewShortCut: TShortCut); - procedure UnHookEditor(aEditor: TCustomSynEdit; - aCommandID: TSynEditorCommand; aShortCut: TShortCut); - procedure OnCommand(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: pointer; HandlerData: pointer); virtual; abstract; - end; - - TPluginState = (psNone, psExecuting, psAccepting, psCancelling); - - TAbstractSynSingleHookPlugin = class(TAbstractSynHookerPlugin) - private - fCommandID: TSynEditorCommand; - function IsShortCutStored: Boolean; - procedure SetShortCut(const Value: TShortCut); - protected - fState: TPluginState; - fCurrentEditor: TCustomSynEdit; - fShortCut: TShortCut; - class function DefaultShortCut: TShortCut; virtual; - procedure DoAddEditor(aEditor: TCustomSynEdit); override; - procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; - {} - procedure DoExecute; virtual; abstract; - procedure DoAccept; virtual; abstract; - procedure DoCancel; virtual; abstract; - public - constructor Create(aOwner: TComponent); override; - destructor Destroy; override; - property CommandID: TSynEditorCommand read fCommandID; - property CurrentEditor: TCustomSynEdit read fCurrentEditor; - function Executing: boolean; - procedure Execute(aEditor: TCustomSynEdit); - procedure Accept; - procedure Cancel; - published - property ShortCut: TShortCut read fShortCut write SetShortCut - stored IsShortCutStored; - end; - - { use TAbstractSynCompletion for non-visual completion } - - TAbstractSynCompletion = class(TAbstractSynSingleHookPlugin) - protected - fCurrentString: string; - protected - procedure SetCurrentString(const Value: string); virtual; - procedure OnCommand(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: pointer; HandlerData: pointer); override; - procedure DoExecute; override; - procedure DoAccept; override; - procedure DoCancel; override; - function GetCurrentEditorString: string; virtual; - public - procedure AddEditor(aEditor: TCustomSynEdit); - property CurrentString: string read fCurrentString write SetCurrentString; - end; - -function NewPluginCommand: TSynEditorCommand; -procedure ReleasePluginCommand(aCmd: TSynEditorCommand); - -implementation - -uses - Types, - Forms, - SynEditMiscProcs, - SynEditStrConst, - SysUtils; - -const - ecPluginBase = 64000; - -var - gCurrentCommand: integer = ecPluginBase; - -function NewPluginCommand: TSynEditorCommand; -begin - Result := gCurrentCommand; - Inc(gCurrentCommand); -end; - -procedure ReleasePluginCommand(aCmd: TSynEditorCommand); -begin - if aCmd = Pred(gCurrentCommand) then - gCurrentCommand := aCmd; -end; - -{ TAbstractSynPlugin } - -function TAbstractSynPlugin.AddEditor(aEditor: TCustomSynEdit): integer; -begin - if fEditors = nil then - begin - fEditors := TList.Create; - end - else - if fEditors.IndexOf(aEditor) >= 0 then - begin - Result := -1; - Exit; - end; - aEditor.FreeNotification(Self); - Result := fEditors.Add(aEditor); - DoAddEditor(aEditor); -end; - -destructor TAbstractSynPlugin.Destroy; -begin - { RemoveEditor will free fEditors when it reaches count = 0} - while Assigned(fEditors) do - RemoveEditor(Editors[0]); - inherited; -end; - -procedure TAbstractSynPlugin.Notification(aComponent: TComponent; - aOperation: TOperation); -begin - inherited; - if aOperation = opRemove then - begin - if (aComponent = Editor) or (aComponent is TCustomSynEdit) then - RemoveEditor(TCustomSynEdit(aComponent)); - end; -end; - -procedure TAbstractSynPlugin.DoAddEditor(aEditor: TCustomSynEdit); -begin - -end; - -procedure TAbstractSynPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); -begin - -end; - -function TAbstractSynPlugin.RemoveEditor(aEditor: TCustomSynEdit): integer; -begin - if fEditors = nil then - begin - Result := -1; - Exit; - end; - Result := fEditors.Remove(aEditor); - //aEditor.RemoveFreeNotification(Self); - if fEditors.Count = 0 then - begin - fEditors.Free; - fEditors := nil; - end; - if Result >= 0 then - DoRemoveEditor(aEditor); -end; - -procedure TAbstractSynPlugin.SetEditor(const Value: TCustomSynEdit); -var - iEditor: TCustomSynEdit; -begin - iEditor := Editor; - if iEditor <> Value then - try - if (iEditor <> nil) and (fEditors.Count = 1) then - RemoveEditor(iEditor); - if Value <> nil then - AddEditor(Value); - except - if [csDesigning] * ComponentState = [csDesigning] then - Application.HandleException(Self) - else - raise; - end; -end; - -function TAbstractSynPlugin.GetEditors(aIndex: integer): TCustomSynEdit; -begin - Result := TCustomSynEdit(fEditors[aIndex]); -end; - -function TAbstractSynPlugin.GetEditor: TCustomSynEdit; -begin - if fEditors <> nil then - Result := fEditors[0] - else - Result := nil; -end; - -function TAbstractSynPlugin.GetEditorCount: integer; -begin - if fEditors <> nil then - Result := fEditors.Count - else - Result := 0; -end; - -{ TAbstractSynHookerPlugin } - -procedure TAbstractSynHookerPlugin.HookEditor(aEditor: TCustomSynEdit; - aCommandID: TSynEditorCommand; aOldShortCut, aNewShortCut: TShortCut); -var - iIndex: integer; - iKeystroke: TSynEditKeyStroke; -begin - Assert(aNewShortCut <> 0); - { shortcurts aren't created while in design-time } - if [csDesigning] * ComponentState = [csDesigning] then - begin - if TSynEdit(aEditor).Keystrokes.FindShortcut(aNewShortCut) >= 0 then - raise ESynKeyError.Create(SYNS_EDuplicateShortCut) - else - Exit; - end; - { tries to update old Keystroke } - if aOldShortCut <> 0 then - begin - iIndex := TSynEdit(aEditor).Keystrokes.FindShortcut(aOldShortCut); - if (iIndex >= 0) then - begin - iKeystroke := TSynEdit(aEditor).Keystrokes[iIndex]; - if iKeystroke.Command = aCommandID then - begin - iKeystroke.ShortCut := aNewShortCut; - Exit; - end; - end; - end; - { new Keystroke } - iKeystroke := TSynEdit(aEditor).Keystrokes.Add; - try - iKeystroke.ShortCut := aNewShortCut; - except - iKeystroke.Free; - raise; - end; - iKeystroke.Command := aCommandID; - aEditor.RegisterCommandHandler(OnCommand, Self); -end; - -procedure TAbstractSynHookerPlugin.UnHookEditor(aEditor: TCustomSynEdit; - aCommandID: TSynEditorCommand; aShortCut: TShortCut); -var - iIndex: integer; -begin - aEditor.UnregisterCommandHandler(OnCommand); - iIndex := TSynEdit(aEditor).Keystrokes.FindShortcut(aShortCut); - if (iIndex >= 0) and - (TSynEdit(aEditor).Keystrokes[iIndex].Command = aCommandID) then - TSynEdit(aEditor).Keystrokes[iIndex].Free; -end; - -{ TAbstractSynHookerPlugin } - -procedure TAbstractSynSingleHookPlugin.Accept; -begin - fState := psAccepting; - try - DoAccept; - finally - fCurrentEditor := nil; - fState := psNone; - end; -end; - -procedure TAbstractSynSingleHookPlugin.Cancel; -begin - fState := psCancelling; - try - DoCancel; - finally - fCurrentEditor := nil; - fState := psNone; - end; -end; - -constructor TAbstractSynSingleHookPlugin.Create(aOwner: TComponent); -begin - inherited; - fCommandID := NewPluginCommand; - fShortCut := DefaultShortCut; -end; - -class function TAbstractSynSingleHookPlugin.DefaultShortCut: TShortCut; -begin - Result := 0; -end; - -destructor TAbstractSynSingleHookPlugin.Destroy; -begin - if Executing then - Cancel; - ReleasePluginCommand(CommandID); - inherited; -end; - -procedure TAbstractSynSingleHookPlugin.DoAddEditor( - aEditor: TCustomSynEdit); -begin - if ShortCut <> 0 then - HookEditor(aEditor, CommandID, 0, ShortCut); -end; - -procedure TAbstractSynSingleHookPlugin.Execute(aEditor: TCustomSynEdit); -begin - if Executing then - Cancel; - Assert(fCurrentEditor = nil); - fCurrentEditor := aEditor; - Assert(fState = psNone); - fState := psExecuting; - try - DoExecute; - except - Cancel; - raise; - end; -end; - -function TAbstractSynSingleHookPlugin.Executing: boolean; -begin - Result := fState = psExecuting; -end; - -function TAbstractSynSingleHookPlugin.IsShortCutStored: Boolean; -begin - Result := fShortCut <> DefaultShortCut; -end; - -procedure TAbstractSynSingleHookPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); -begin - if ShortCut <> 0 then - UnHookEditor(aEditor, CommandID, ShortCut); - if Executing and (CurrentEditor = aEditor) then - Cancel; -end; - -procedure TAbstractSynSingleHookPlugin.SetShortCut(const Value: TShortCut); -var - cEditor: integer; -begin - if fShortCut <> Value then - begin - if Assigned(fEditors) then - if Value <> 0 then - begin - for cEditor := 0 to fEditors.Count -1 do - HookEditor(Editors[cEditor], CommandID, fShortCut, Value); - end - else - begin - for cEditor := 0 to fEditors.Count -1 do - UnHookEditor(Editors[cEditor], CommandID, fShortCut); - end; - fShortCut := Value; - end; -end; - -{ TAbstractSynCompletion } - -function TAbstractSynCompletion.GetCurrentEditorString: string; -var - S: string; - Col: integer; -begin - S := CurrentEditor.LineText; - if (CurrentEditor.CaretX > 1) and - (CurrentEditor.CaretX - 1 <= Length(S)) then - begin - for Col := CurrentEditor.CaretX - 1 downto 1 do - if not CurrentEditor.IsIdentChar(S[Col])then - break; - Result := Copy(S, Col + 1, CurrentEditor.CaretX - Col - 1); - end; -end; - -procedure TAbstractSynCompletion.DoAccept; -begin - fCurrentString := ''; -end; - -procedure TAbstractSynCompletion.DoCancel; -begin - fCurrentString := ''; -end; - -procedure TAbstractSynCompletion.DoExecute; -begin - CurrentString := GetCurrentEditorString; -end; - -procedure TAbstractSynCompletion.OnCommand(Sender: TObject; - AfterProcessing: boolean; var Handled: boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data, - HandlerData: Pointer); -var - S: string; -begin - if not Executing then - begin - if (Command = CommandID) then - begin - Execute(Sender as TCustomSynEdit); - Handled := True; - end; - end - else { Executing } - if Sender = CurrentEditor then - begin - if not AfterProcessing then - begin - case Command of - ecChar: - if aChar = #27 then - begin - Cancel; - Handled := True; - end - else - begin - if not(CurrentEditor.IsIdentChar(aChar)) then - Accept; - {don't handle the char} - end; - ecLineBreak: - begin - Accept; - Handled := True; - end; - ecLeft, ecSelLeft: - if CurrentString = '' then - Handled := True; - ecDeleteLastChar: - if CurrentString = '' then - Handled := True; - ecTab: - Accept; - ecDeleteChar, - ecRight, ecSelRight, - ecLostFocus, ecGotFocus: - ; {processed on AfterProcessing} - else - Cancel; - end; - end - else { AfterProcessing } - case Command of - ecLostFocus, ecGotFocus, - ecDeleteChar: - ; - ecDeleteLastChar, - ecLeft, ecSelLeft, - ecChar: - CurrentString := GetCurrentEditorString; - ecRight, ecSelRight: begin - S := GetCurrentEditorString; - if S = '' then - Cancel - else - CurrentString := S; - end; - else - if CurrentString <> GetCurrentEditorString then - Cancel; - end; - end; {endif Sender = CurrentEditor} -end; - -procedure TAbstractSynCompletion.SetCurrentString(const Value: string); -begin - fCurrentString := Value; -end; - -procedure TAbstractSynCompletion.AddEditor(aEditor: TCustomSynEdit); -begin - inherited AddEditor(aEditor); -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPlugins.pas, released 2001-10-17. + +Author of this file is Flávio Etrusco. +Portions created by Flávio Etrusco are Copyright 2001 Flávio Etrusco. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPlugins.pas,v 1.8.2.2 2008/09/14 16:24:58 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPLUGINS} +unit SynEditPlugins; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} + Windows, + Menus, + SynEdit, + SynEditKeyCmds, + SynUnicode, + Classes; + +type + TAbstractSynPlugin = class(TComponent) + private + procedure SetEditor(const Value: TCustomSynEdit); + function GetEditors(aIndex: Integer): TCustomSynEdit; + function GetEditor: TCustomSynEdit; + function GetEditorCount: Integer; + protected + FEditors: TList; + procedure Notification(aComponent: TComponent; + aOperation: TOperation); override; + procedure DoAddEditor(aEditor: TCustomSynEdit); virtual; + procedure DoRemoveEditor(aEditor: TCustomSynEdit); virtual; + function AddEditor(aEditor: TCustomSynEdit): Integer; + function RemoveEditor(aEditor: TCustomSynEdit): Integer; + public + destructor Destroy; override; + property Editors[aIndex: Integer]: TCustomSynEdit read GetEditors; + property EditorCount: Integer read GetEditorCount; + published + property Editor: TCustomSynEdit read GetEditor write SetEditor; + end; + + TAbstractSynHookerPlugin = class(TAbstractSynPlugin) + protected + procedure HookEditor(aEditor: TCustomSynEdit; aCommandID: TSynEditorCommand; + aOldShortCut, aNewShortCut: TShortCut); + procedure UnHookEditor(aEditor: TCustomSynEdit; + aCommandID: TSynEditorCommand; aShortCut: TShortCut); + procedure OnCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); virtual; abstract; + end; + + TPluginState = (psNone, psExecuting, psAccepting, psCancelling); + + TAbstractSynSingleHookPlugin = class(TAbstractSynHookerPlugin) + private + fCommandID: TSynEditorCommand; + function IsShortCutStored: Boolean; + procedure SetShortCut(const Value: TShortCut); + protected + FState: TPluginState; + fCurrentEditor: TCustomSynEdit; + FShortCut: TShortCut; + class function DefaultShortCut: TShortCut; virtual; + procedure DoAddEditor(aEditor: TCustomSynEdit); override; + procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; + {} + procedure DoExecute; virtual; abstract; + procedure DoAccept; virtual; abstract; + procedure DoCancel; virtual; abstract; + public + constructor Create(aOwner: TComponent); override; + destructor Destroy; override; + property CommandID: TSynEditorCommand read fCommandID; + property CurrentEditor: TCustomSynEdit read fCurrentEditor; + function Executing: Boolean; + procedure Execute(aEditor: TCustomSynEdit); + procedure Accept; + procedure Cancel; + published + property ShortCut: TShortCut read FShortCut write SetShortCut + stored IsShortCutStored; + end; + + { use TAbstractSynCompletion for non-visual completion } + + TAbstractSynCompletion = class(TAbstractSynSingleHookPlugin) + protected + fCurrentString: UnicodeString; + protected + procedure SetCurrentString(const Value: UnicodeString); virtual; + procedure OnCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data, HandlerData: Pointer); override; + procedure DoExecute; override; + procedure DoAccept; override; + procedure DoCancel; override; + function GetCurrentEditorString: UnicodeString; virtual; + public + procedure AddEditor(aEditor: TCustomSynEdit); + property CurrentString: UnicodeString read fCurrentString write SetCurrentString; + end; + +function NewPluginCommand: TSynEditorCommand; +procedure ReleasePluginCommand(aCmd: TSynEditorCommand); + +implementation + +uses + Forms, + SynEditTypes, + SynEditMiscProcs, + SynEditStrConst, + SysUtils; + +const + ecPluginBase = 64000; + +var + gCurrentCommand: Integer = ecPluginBase; + +function NewPluginCommand: TSynEditorCommand; +begin + Result := gCurrentCommand; + Inc(gCurrentCommand); +end; + +procedure ReleasePluginCommand(aCmd: TSynEditorCommand); +begin + if aCmd = Pred(gCurrentCommand) then + gCurrentCommand := aCmd; +end; + +{ TAbstractSynPlugin } + +function TAbstractSynPlugin.AddEditor(aEditor: TCustomSynEdit): Integer; +begin + if FEditors = nil then + begin + FEditors := TList.Create; + end + else + if FEditors.IndexOf(aEditor) >= 0 then + begin + Result := -1; + Exit; + end; + aEditor.FreeNotification(Self); + Result := FEditors.Add(aEditor); + DoAddEditor(aEditor); +end; + +destructor TAbstractSynPlugin.Destroy; +begin + { RemoveEditor will free FEditors when it reaches count = 0} + while Assigned(FEditors) do + RemoveEditor(Editors[0]); + inherited; +end; + +procedure TAbstractSynPlugin.Notification(aComponent: TComponent; + aOperation: TOperation); +begin + inherited; + if aOperation = opRemove then + begin + if (aComponent = Editor) or (aComponent is TCustomSynEdit) then + RemoveEditor(TCustomSynEdit(aComponent)); + end; +end; + +procedure TAbstractSynPlugin.DoAddEditor(aEditor: TCustomSynEdit); +begin + +end; + +procedure TAbstractSynPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); +begin + +end; + +function TAbstractSynPlugin.RemoveEditor(aEditor: TCustomSynEdit): Integer; +begin + if FEditors = nil then + begin + Result := -1; + Exit; + end; + Result := FEditors.Remove(aEditor); + //aEditor.RemoveFreeNotification(Self); + if FEditors.Count = 0 then + begin + FEditors.Free; + FEditors := nil; + end; + if Result >= 0 then + DoRemoveEditor(aEditor); +end; + +procedure TAbstractSynPlugin.SetEditor(const Value: TCustomSynEdit); +var + iEditor: TCustomSynEdit; +begin + iEditor := Editor; + if iEditor <> Value then + try + if (iEditor <> nil) and (FEditors.Count = 1) then + RemoveEditor(iEditor); + if Value <> nil then + AddEditor(Value); + except + if [csDesigning] * ComponentState = [csDesigning] then + Application.HandleException(Self) + else + raise; + end; +end; + +function TAbstractSynPlugin.GetEditors(aIndex: Integer): TCustomSynEdit; +begin + Result := TCustomSynEdit(FEditors[aIndex]); +end; + +function TAbstractSynPlugin.GetEditor: TCustomSynEdit; +begin + if FEditors <> nil then + Result := FEditors[0] + else + Result := nil; +end; + +function TAbstractSynPlugin.GetEditorCount: Integer; +begin + if FEditors <> nil then + Result := FEditors.Count + else + Result := 0; +end; + +{ TAbstractSynHookerPlugin } + +procedure TAbstractSynHookerPlugin.HookEditor(aEditor: TCustomSynEdit; + aCommandID: TSynEditorCommand; aOldShortCut, aNewShortCut: TShortCut); +var + iIndex: Integer; + iKeystroke: TSynEditKeyStroke; +begin + Assert(aNewShortCut <> 0); + { shortcurts aren't created while in design-time } + if [csDesigning] * ComponentState = [csDesigning] then + begin + if TSynEdit(aEditor).Keystrokes.FindShortcut(aNewShortCut) >= 0 then + raise ESynKeyError.Create(SYNS_EDuplicateShortCut) + else + Exit; + end; + { tries to update old Keystroke } + if aOldShortCut <> 0 then + begin + iIndex := TSynEdit(aEditor).Keystrokes.FindShortcut(aOldShortCut); + if (iIndex >= 0) then + begin + iKeystroke := TSynEdit(aEditor).Keystrokes[iIndex]; + if iKeystroke.Command = aCommandID then + begin + iKeystroke.ShortCut := aNewShortCut; + Exit; + end; + end; + end; + { new Keystroke } + iKeystroke := TSynEdit(aEditor).Keystrokes.Add; + try + iKeystroke.ShortCut := aNewShortCut; + except + iKeystroke.Free; + raise; + end; + iKeystroke.Command := aCommandID; + aEditor.RegisterCommandHandler(OnCommand, Self); +end; + +procedure TAbstractSynHookerPlugin.UnHookEditor(aEditor: TCustomSynEdit; + aCommandID: TSynEditorCommand; aShortCut: TShortCut); +var + iIndex: Integer; +begin + aEditor.UnregisterCommandHandler(OnCommand); + iIndex := TSynEdit(aEditor).Keystrokes.FindShortcut(aShortCut); + if (iIndex >= 0) and + (TSynEdit(aEditor).Keystrokes[iIndex].Command = aCommandID) then + TSynEdit(aEditor).Keystrokes[iIndex].Free; +end; + +{ TAbstractSynHookerPlugin } + +procedure TAbstractSynSingleHookPlugin.Accept; +begin + FState := psAccepting; + try + DoAccept; + finally + fCurrentEditor := nil; + FState := psNone; + end; +end; + +procedure TAbstractSynSingleHookPlugin.Cancel; +begin + FState := psCancelling; + try + DoCancel; + finally + fCurrentEditor := nil; + FState := psNone; + end; +end; + +constructor TAbstractSynSingleHookPlugin.Create(aOwner: TComponent); +begin + inherited; + fCommandID := NewPluginCommand; + FShortCut := DefaultShortCut; +end; + +class function TAbstractSynSingleHookPlugin.DefaultShortCut: TShortCut; +begin + Result := 0; +end; + +destructor TAbstractSynSingleHookPlugin.Destroy; +begin + if Executing then + Cancel; + ReleasePluginCommand(CommandID); + inherited; +end; + +procedure TAbstractSynSingleHookPlugin.DoAddEditor( + aEditor: TCustomSynEdit); +begin + if ShortCut <> 0 then + HookEditor(aEditor, CommandID, 0, ShortCut); +end; + +procedure TAbstractSynSingleHookPlugin.Execute(aEditor: TCustomSynEdit); +begin + if Executing then + Cancel; + Assert(fCurrentEditor = nil); + fCurrentEditor := aEditor; + Assert(FState = psNone); + FState := psExecuting; + try + DoExecute; + except + Cancel; + raise; + end; +end; + +function TAbstractSynSingleHookPlugin.Executing: Boolean; +begin + Result := FState = psExecuting; +end; + +function TAbstractSynSingleHookPlugin.IsShortCutStored: Boolean; +begin + Result := FShortCut <> DefaultShortCut; +end; + +procedure TAbstractSynSingleHookPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); +begin + if ShortCut <> 0 then + UnHookEditor(aEditor, CommandID, ShortCut); + if Executing and (CurrentEditor = aEditor) then + Cancel; +end; + +procedure TAbstractSynSingleHookPlugin.SetShortCut(const Value: TShortCut); +var + cEditor: Integer; +begin + if FShortCut <> Value then + begin + if Assigned(FEditors) then + if Value <> 0 then + begin + for cEditor := 0 to FEditors.Count -1 do + HookEditor(Editors[cEditor], CommandID, FShortCut, Value); + end + else + begin + for cEditor := 0 to FEditors.Count -1 do + UnHookEditor(Editors[cEditor], CommandID, FShortCut); + end; + FShortCut := Value; + end; +end; + +{ TAbstractSynCompletion } + +function TAbstractSynCompletion.GetCurrentEditorString: UnicodeString; +var + S: UnicodeString; + Col: Integer; +begin + S := CurrentEditor.LineText; + if (CurrentEditor.CaretX > 1) and + (CurrentEditor.CaretX - 1 <= Length(S)) then + begin + for Col := CurrentEditor.CaretX - 1 downto 1 do + if not CurrentEditor.IsIdentChar(S[Col])then + Break; + Result := Copy(S, Col + 1, CurrentEditor.CaretX - Col - 1); + end; +end; + +procedure TAbstractSynCompletion.DoAccept; +begin + fCurrentString := ''; +end; + +procedure TAbstractSynCompletion.DoCancel; +begin + fCurrentString := ''; +end; + +procedure TAbstractSynCompletion.DoExecute; +begin + CurrentString := GetCurrentEditorString; +end; + +procedure TAbstractSynCompletion.OnCommand(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data, + HandlerData: Pointer); +var + S: UnicodeString; +begin + if not Executing then + begin + if (Command = CommandID) then + begin + Execute(Sender as TCustomSynEdit); + Handled := True; + end; + end + else { Executing } + if Sender = CurrentEditor then + begin + if not AfterProcessing then + begin + case Command of + ecChar: + if aChar = #27 then + begin + Cancel; + Handled := True; + end + else + begin + if not(CurrentEditor.IsIdentChar(aChar)) then + Accept; + {don't handle the char} + end; + ecLineBreak: + begin + Accept; + Handled := True; + end; + ecLeft, ecSelLeft: + if CurrentString = '' then + Handled := True; + ecDeleteLastChar: + if CurrentString = '' then + Handled := True; + ecTab: + Accept; + ecDeleteChar, + ecRight, ecSelRight, + ecLostFocus, ecGotFocus: + ; {processed on AfterProcessing} + else + Cancel; + end; + end + else { AfterProcessing } + case Command of + ecLostFocus, ecGotFocus, + ecDeleteChar: + ; + ecDeleteLastChar, + ecLeft, ecSelLeft, + ecChar: + CurrentString := GetCurrentEditorString; + ecRight, ecSelRight: begin + S := GetCurrentEditorString; + if S = '' then + Cancel + else + CurrentString := S; + end; + else + if CurrentString <> GetCurrentEditorString then + Cancel; + end; + end; {endif Sender = CurrentEditor} +end; + +procedure TAbstractSynCompletion.SetCurrentString(const Value: UnicodeString); +begin + fCurrentString := Value; +end; + +procedure TAbstractSynCompletion.AddEditor(aEditor: TCustomSynEdit); +begin + inherited AddEditor(aEditor); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditPrint.pas b/Source/VCL/SynEdit/Source/SynEditPrint.pas index d8800f35..4f69680c 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrint.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrint.pas @@ -1,1081 +1,1087 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrint.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrint.pas,v 1.34.2.12 2008/09/23 14:02:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - Wrapping across page boundaries is not supported --------------------------------------------------------------------------------} - -{------------------------------------------------------------------------------- -CONTENTS: - Print controller component. - Allows setting margins, headers and footers. - - Design time properties: - Header : Class property to set properties for headers - - see CSynEditHeaderFooter.pas - Footer : Class property to set properties for footers - - see CSynEditHeaderFooter.pas - Margins : Class property to set properties for margins - - see CSynEditPrintMargins.pas - Lines : The lines that should be printed (see also SynEdit the - property below) - Font : The font the lines should be printed in (see also SynEdit - the property below) - Title : A title - can be referenced in headers/footers by using the - $TITLE$ macro - Wrap : Wrap text to margins - Highlight : Highlight text - Colors : Print in colors - LineNumbers : Print line numbers - LineOffset : Value added to linenumbers when printing - PageOffset : Value added to pagenumbers when printing - OnPrintLine : Fired when a line is printed - OnPrintStatus : Fired at Beginning, End and when a new page is started - Highlighter : The highlighter used for highlighting the text (see also the - SynEdit property below) - LineNumbersInMargin : If true line numbers are printed in the left margin, - else left margin is increased by width of line - number text. - SelectedOnly : Print only the selected Area - Run-time properties: - DocTitle : Used to display the document name in the print queue monitor - PrinterInfo : Read only. Returns info on printer (used internally) - PageCount : Returns the total number of pages; - SynEdit : By setting SynEdit to a specific TSynEdit component, the - properties Lines, Font and Highlighter are automatically - set to the corresponding values of the TSynEdit component - Run-time methods: - UpdatePages : Used internally by the TSynEditPrintPreview component - PrintToCanvas : Used internally by the TSynEditPrintPreview component - Print : Prints the contents of the Lines property - PrintRange(StartPage,EndPage) : Prints the specified page-range (both inclusive) --------------------------------------------------------------------------------} - -unit SynEditPrint; - -{$M+} -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - Printers, - SynEdit, - SynEditTypes, - SynEditPrintTypes, - SynEditPrintHeaderFooter, - SynEditPrinterInfo, - SynEditPrintMargins, - SynEditMiscProcs, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TPageLine = class - public - FirstLine: Integer; - end; - //The actual print controller object - TSynEditPrint = class(TComponent) - private - FCopies: Integer; - FFooter: TFooter; - FHeader: THeader; - FLines: TStrings; - FMargins: TSynEditPrintMargins; - FPageCount: Integer; - FFont: TFont; - FTitle: string; - FDocTitle: string; - FPrinterInfo: TSynEditPrinterInfo; - FPages: TList; - FCanvas: TCanvas; - FCharWidth: Integer; - FMaxLeftChar: Integer; - FWrap: Boolean; - FOnPrintLine: TPrintLineEvent; - FOnPrintStatus: TPrintStatusEvent; - FYPos: Integer; - FLineHeight: Integer; - FHighlight: Boolean; - FColors: Boolean; - FHighlighter: TSynCustomHighlighter; - FOldFont: TFont; - FSynOK: Boolean; - FLineNumbers: Boolean; - FLineNumber: Integer; - FLineOffset: Integer; - FAbort: Boolean; - FPrinting: Boolean; - FDefaultBG: TColor; - FPageOffset: Integer; - FRangesOK: Boolean; - FMaxWidth: integer; - FMaxCol: Integer; - FPagesCounted: Boolean; - FLineNumbersInMargin: Boolean; - FTabWidth: integer; - fFontColor: TColor; - fSelectedOnly: Boolean; - fSelAvail: Boolean; - fSelMode: TSynSelectionMode; - fBlockBegin: TBufferCoord; - fBlockEnd: TBufferCoord; - FETODist: PIntArray; - procedure CalcPages; - procedure SetLines(const Value: TStrings); - procedure SetFont(const Value: TFont); - procedure SetCharWidth(const Value: Integer); - procedure SetMaxLeftChar(const Value: Integer); - procedure PrintPage(Num: Integer); - procedure WriteLine(const Text: string); - procedure WriteLineNumber; - procedure HandleWrap(const Text: string; MaxWidth: Integer); - procedure TextOut(const Text: string; AList: TList); - procedure SetHighlighter(const Value: TSynCustomHighlighter); - procedure RestoreCurrentFont; - procedure SaveCurrentFont; - procedure SetPixelsPrInch; - procedure InitPrint; - procedure InitRanges; - function GetPageCount: Integer; - procedure SetSynEdit(const Value: TCustomSynEdit); - procedure SetFooter(const Value: TFooter); - procedure SetHeader(const Value: THeader); - procedure SetMargins(const Value: TSynEditPrintMargins); - function ClipLineToRect(S: string; R: TRect): string; - function ExpandAtWideGlyphs(const S: string): string; - protected - procedure DefineProperties(Filer: TFiler); override; - property MaxLeftChar: Integer read FMaxLeftChar write SetMaxLeftChar; - property CharWidth: Integer read FCharWidth write SetCharWidth; - procedure PrintStatus(Status: TSynPrintStatus; PageNumber: integer; - var Abort: boolean); virtual; - procedure PrintLine(LineNumber, PageNumber: Integer); virtual; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure UpdatePages(ACanvas: TCanvas); - procedure PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); - procedure Print; - procedure PrintRange(StartPage, EndPage: Integer); - property PrinterInfo: TSynEditPrinterInfo read FPrinterInfo; - property PageCount: Integer read GetPageCount; - property SynEdit: TCustomSynEdit write SetSynEdit; - - procedure LoadFromStream(AStream: TStream); - procedure SaveToStream(AStream: TStream); - published - property Copies: integer read FCopies write FCopies; - property Header: THeader read FHeader write SetHeader; - property Footer: TFooter read FFooter write SetFooter; - property Margins: TSynEditPrintMargins read FMargins write SetMargins; - property Lines: TStrings read FLines write SetLines; - property Font: TFont read FFont write SetFont; - property Title: string read FTitle write FTitle; - property DocTitle: string read FDocTitle write FDocTitle; - property Wrap: Boolean read FWrap write FWrap default True; - property Highlight: Boolean read FHighlight write FHighlight default True; - property SelectedOnly: Boolean read FSelectedOnly write FSelectedOnly - default False; - property Colors: Boolean read FColors write FColors default False; - property LineNumbers: Boolean read FLineNumbers write FLineNumbers - default False; - property LineOffset: Integer read FLineOffset write FLineOffset default 0; - property PageOffset: Integer read FPageOffset write FPageOffset default 0; - property OnPrintLine: TPrintLineEvent read FOnPrintLine write FOnPrintLine; - property OnPrintStatus: TPrintStatusEvent read FOnPrintStatus - write FOnPrintStatus; - property Highlighter: TSynCustomHighlighter read FHighlighter - write SetHighlighter; - property LineNumbersInMargin: Boolean read FLineNumbersInMargin - write FLineNumbersInMargin default False; - property TabWidth: integer read fTabWidth write fTabWidth; - property Color: TColor read fDefaultBG write fDefaultBG; - end; - -implementation - -uses - Math, UITypes; - -{ TSynEditPrint } - -constructor TSynEditPrint.Create(AOwner: TComponent); -begin - inherited; - FCopies := 1; - FFooter := TFooter.Create; - FHeader := THeader.Create; - FLines := TStringList.Create; - FMargins := TSynEditPrintMargins.Create; - FPrinterInfo := TSynEditPrinterInfo.Create; - FFont := TFont.Create; - FOldFont := TFont.Create; - MaxLeftChar := 1024; - FWrap := True; - FHighlight := True; - FColors := False; - FLineNumbers := False; - FLineOffset := 0; - FPageOffset := 0; - FLineNumbersInMargin := False; - FPages := TList.Create; - FTabWidth := 8; - FDefaultBG := clWhite; -end; - -destructor TSynEditPrint.Destroy; -var - i: Integer; -begin - FFooter.Free; - FHeader.Free; - FLines.Free; - FMargins.Free; - FPrinterInfo.Free; - FFont.Free; - FOldFont.Free; - for i := 0 to FPages.Count - 1 do - TPageLine(FPages[i]).Free; - FPages.Free; - FreeMem(FETODist); - inherited; -end; - -procedure TSynEditPrint.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -procedure TSynEditPrint.SetLines(const Value: TStrings); -var - i, j: Integer; - ConvertTabsProc: TConvertTabsProc; - TmpString: string; -begin - ConvertTabsProc := GetBestConvertTabsProc(FTabWidth); - with FLines do - begin - BeginUpdate; - try - Clear; - for i := 0 to Value.Count - 1 do - begin - TmpString := ConvertTabsProc(Value[i], FTabWidth); - j := Pos(#9, TmpString); - While j > 0 do - begin - TmpString[j] := ' '; - j := Pos(#9, TmpString); - end; - Add(TmpString); - end; - finally - EndUpdate; - end; - end; - FRangesOK := False; - FPagesCounted := False; -end; - -procedure TSynEditPrint.SetFont(const Value: TFont); -begin - FFont.Assign(Value); - FPagesCounted := False; -end; - -procedure TSynEditPrint.SetCharWidth(const Value: Integer); -begin - FCharWidth := Value; -end; - -procedure TSynEditPrint.SetMaxLeftChar(const Value: Integer); -begin - FMaxLeftChar := Value; -end; - -procedure TSynEditPrint.SetHighlighter(const Value: TSynCustomHighlighter); -begin - FHighlighter := Value; - FRangesOK := False; - FPagesCounted := False; -end; - -// Inserts filling chars into a string containing chars that display as glyphs -// wider than an average glyph. (This is often the case with Asian glyphs, which -// are usually wider than latin glpyhs) -// This is only to simplify paint-operations and has nothing to do with -// multi-byte chars. -function TSynEditPrint.ExpandAtWideGlyphs(const S: string): string; -var - i, j, CountOfAvgGlyphs: Integer; -begin - FCanvas.Font := Font; - - j := 0; - SetLength(Result, Length(S) * 2); // speed improvement - for i := 1 to Length(S) do - begin - inc(j); - // Introduce a small tolerance Issue 54 - CountOfAvgGlyphs := Ceil(FCanvas.TextWidth(S[i]) / fCharWidth - 0.04); - - if j + CountOfAvgGlyphs > Length(Result) then - SetLength(Result, Length(Result) + 128); - - // insert CountOfAvgGlyphs filling chars - while CountOfAvgGlyphs > 1 do - begin - Result[j] := FillerChar; - inc(j); - dec(CountOfAvgGlyphs); - end; - - Result[j] := S[i]; - end; - - SetLength(Result, j); -end; - -procedure TSynEditPrint.InitPrint; -{ Initialize Font.PixelsPerInch, Character widths, Margins, Total Page count, - headers and footers} -var - TmpSize: Integer; - TmpTextMetrics: TTextMetric; -begin -// FDefaultBG := FCanvas.Brush.Color; - fFontColor := FFont.Color; - FCanvas.Font.Assign(FFont); - if not FPrinting then - begin - SetPixelsPrInch; - TmpSize := FCanvas.Font.Size; - FCanvas.Font.PixelsPerInch := FFont.PixelsPerInch; - FCanvas.Font.Size := TmpSize; - end; - // Calculate TextMetrics with the (probably) most wider text styles so text is - // never clipped (although potentially wasting space) - FCanvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut]; - GetTextMetrics(FCanvas.Handle, TmpTextMetrics); - CharWidth := TmpTextMetrics.tmAveCharWidth; - FLineHeight := TmpTextMetrics.tmHeight + TmpTextMetrics.tmExternalLeading; - FCanvas.Font.Style := FFont.Style; - FMargins.InitPage(FCanvas, 1, FPrinterInfo, FLineNumbers, FLineNumbersInMargin, - FLines.Count - 1 + FLineOffset); - CalcPages; - FHeader.InitPrint(FCanvas, FPageCount, FTitle, FMargins); - FFooter.InitPrint(FCanvas, FPageCount, FTitle, FMargins); - FSynOK := Highlight and Assigned(FHighLighter) and (FLines.Count > 0); -end; - -procedure TSynEditPrint.SetPixelsPrInch; -var - TmpSize: Integer; -begin - FHeader.SetPixPrInch(FPrinterInfo.YPixPrInch); - FFooter.SetPixPrInch(FPrinterInfo.YPixPrInch); - //This should be necessary - else size would be changed... - TmpSize := FFont.Size; - FFont.PixelsPerInch := FPrinterInfo.YPixPrInch; - FFont.Size := TmpSize; -end; - -procedure TSynEditPrint.InitRanges; -//Initialize ranges in Highlighter -var - i: Integer; -begin - if not FRangesOK and Assigned(FHighlighter) and (Lines.Count > 0) then - begin - FHighlighter.ResetRange; - FLines.Objects[0] := fHighlighter.GetRange; - i := 1; - while i < Lines.Count do - begin - FHighlighter.SetLine(FLines[i - 1], i - 1); - FHighlighter.NextToEol; - FLines.Objects[i] := FHighlighter.GetRange; - Inc(i); - end; - FRangesOK := True; - end; -end; - -// Calculates the total number of pages -procedure TSynEditPrint.CalcPages; -var - AStr, Text: string; - StrWidth: Integer; - i, j: Integer; - AList: TList; - YPos: Integer; - PageLine: TPageLine; - - //Counts the number of lines a line is wrapped to - procedure CountWrapped; - var - j: Integer; - begin - for j := 0 to AList.Count - 1 do - YPos := YPos + FLineHeight; - end; - -var - iStartLine, iEndLine: integer; - iSelStart, iSelLen: integer; -begin - InitRanges; - for i := 0 to FPages.Count - 1 do - TPageLine(FPages[i]).Free; - FPages.Clear; - FMaxWidth := FMargins.PRight - FMargins.PLeft; - AStr := ''; - FMaxCol := 0; - while FCanvas.TextWidth(AStr) < FMaxWidth do - begin - AStr := AStr + 'W'; - FMaxCol := FMaxCol + 1; - end; - FMaxCol := FMaxCol - 1; - {FTestString is used to Calculate MaxWidth when prewiewing and printing - - else the length is not calculated correctly when prewiewing and the - zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY???} -// fTestString := StringofChar('W', FMaxCol); - AStr := StringofChar('W', FMaxCol); - FMaxWidth := FCanvas.TextWidth(AStr); - FPageCount := 1; - PageLine := TPageLine.Create; - PageLine.FirstLine := 0; - FPages.Add(PageLine); - YPos := FMargins.PTop; - if SelectedOnly then - begin - iStartLine := fBlockBegin.Line -1; - iEndLine := fBlockEnd.Line -1; - end - else begin - iStartLine := 0; - iEndLine := Lines.Count -1; - end; - for i := iStartLine to iEndLine do - begin - if not fSelectedOnly or (fSelMode = smLine) then - Text := Lines[i] - else - begin - if (fSelMode = smColumn) or (i = fBlockBegin.Line -1) then - iSelStart := fBlockBegin.Char - else - iSelStart := 1; - if (fSelMode = smColumn) or (i = fBlockEnd.Line -1) then - iSelLen := fBlockEnd.Char - iSelStart - else - iSelLen := MaxInt; - Text := Copy( Lines[i], iSelStart, iSelLen ); - end; - {if new page then increase FPageCount and save the top-line number in - FPages} - if YPos + FLineHeight > FMargins.PBottom then - begin - YPos := FMargins.PTop; - FPageCount := FPageCount + 1; - PageLine := TPageLine.Create; - PageLine.FirstLine := i; - FPages.Add(PageLine); - end; - StrWidth := FCanvas.TextWidth(Text); - {Check for wrap} - if Wrap and (StrWidth > FMaxWidth) then begin - AList := TList.Create; - if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then - CountWrapped - else - begin - {If WrapTextToList didn't succed with the first set of breakchars - then try this one:} - if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then - CountWrapped - else - begin - {If WrapTextToList didn't succed at all, then do it the - primitive way} - while Length(Text) > 0 do - begin - AStr := Copy(Text, 1, FMaxCol); - Delete(Text, 1, FMaxCol); - if Length(Text) > 0 then - YPos := YPos + FLineHeight; - end; - end; - end; - for j := 0 to AList.Count - 1 do - TWrapPos(AList[j]).Free; - AList.Free; - end; - YPos := YPos + FLineHeight; - end; - FPagesCounted := True; -end; - -{ Writes the line number. FMargins. PLeft is the position of the left margin - (which is automatically incremented by the length of the linenumber text, if - the linenumbers should not be placed in the margin) } -procedure TSynEditPrint.WriteLineNumber; -var - AStr: string; -begin - SaveCurrentFont; - AStr := IntToStr(FLineNumber + FLineOffset) + ': '; - FCanvas.Brush.Color := FDefaultBG; - FCanvas.Font.Style := []; - FCanvas.Font.Color := clBlack; - FCanvas.TextOut(FMargins.PLeft - FCanvas.TextWidth(AStr), FYPos, AStr); - RestoreCurrentFont; -end; - -procedure TSynEditPrint.HandleWrap(const Text: string; MaxWidth: Integer); -var - AStr: string; - AList: TList; - j: Integer; - - procedure WrapPrimitive; - var - i: Integer; - WrapPos: TWrapPos; - begin - i := 1; - while i <= Length(Text) do - begin - AStr := ''; - while (Length(AStr) < FMaxCol) and (i <= Length(Text)) do - begin - AStr := AStr + Text[i]; - i := i + 1; - end; - WrapPos := TWrapPos.Create; - WrapPos.Index := i - 1; - AList.Add(WrapPos); - if (Length(AStr) - i) <= FMaxCol then - Break; - end; - end; - -begin - AStr := ''; - //First try to break the string at the following chars: - AList := TList.Create; - if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then - TextOut(Text, AList) - else - begin - //Then try to break the string at the following chars: - if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then - TextOut(Text, AList) - else - begin - WrapPrimitive; - TextOut(Text, AList) - end; - end; - for j := 0 to AList.Count - 1 do - TWrapPos(Alist[j]).Free; - AList.Free; -end; - -procedure TSynEditPrint.SaveCurrentFont; -begin - FOldFont.Assign(FCanvas.Font); -end; - -procedure TSynEditPrint.RestoreCurrentFont; -begin - FCanvas.Font.Assign(FOldFont); -end; - -function TSynEditPrint.ClipLineToRect(S: string; R: TRect): string; -begin - while FCanvas.TextWidth(S) > FMaxWidth do - SetLength(S, Length(S) - 1); - - Result := S; -end; - -//Does the actual printing -procedure TSynEditPrint.TextOut(const Text: string; AList: TList); -var - Token: string; - TokenPos: Integer; - Attr: TSynHighlighterAttributes; - AColor: TColor; - TokenStart: Integer; - LCount: Integer; - Handled: Boolean; - aStr: string; - i, WrapPos, OldWrapPos: Integer; - Lines: TStringList; - ClipRect: TRect; - sLine, sLineExpandedAtWideGlyphs: string; - ExpandedPos: Integer; - - procedure InitETODist(CharWidth: Integer; const Text: string); - var - Size: TSize; - i: Integer; - begin - ReallocMem(FETODist, Length(Text) * SizeOf(Integer)); - for i := 0 to Length(Text) - 1 do - begin - Size := GetTextSize(FCanvas.Handle, @Text[i + 1], 1); - // Introduce a small tolerance (#54) - FETODist[i] := Ceil(Size.cx / CharWidth - 0.04) * CharWidth; - end; - end; - - procedure ClippedTextOut(X, Y: Integer; Text: string); - begin - Text := ClipLineToRect(Text, ClipRect); - InitETODist(FCharWidth, Text); - Windows.ExtTextOutW(FCanvas.Handle, X, Y, 0, nil, PWideChar(Text), - Length(Text), PInteger(FETODist)); - end; - - procedure SplitToken; - var - AStr: string; - Last: Integer; - FirstPos: Integer; - TokenEnd: Integer; - begin - Last := TokenPos; - FirstPos := TokenPos; - TokenEnd := TokenPos + Length(Token); - while (LCount < AList.Count) and (TokenEnd > TWrapPos(AList[LCount]).Index) do - begin - AStr := Copy(Text, Last + 1, TWrapPos(AList[LCount]).Index - Last); - Last := TWrapPos(AList[LCount]).Index; - ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); - FirstPos := 0; - LCount := LCount + 1; - FYPos := FYPos + FLineHeight; - end; - AStr := Copy(Text, Last + 1, TokenEnd - Last); - ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); - //Ready for next token: - TokenStart := TokenPos + Length(Token) - Length(AStr); - end; -begin - with FMargins do - ClipRect := Rect(PLeft, PTop, PRight, PBottom); - - if FSynOK then - begin - SaveCurrentFont; - FHighlighter.SetRange(FLines.Objects[FLineNumber - 1]); - sLine := Text; - sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); - FHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, FLineNumber); - - Token := ''; - TokenStart := 0; - LCount := 0; - while not FHighLighter.GetEol do - begin - Token := FHighLighter.GetToken; - TokenPos := FHighLighter.GetTokenPos; - Attr := FHighLighter.GetTokenAttribute; - if Assigned(Attr) then - begin - FCanvas.Font.Style := Attr.Style; - if FColors then - begin - AColor := Attr.Foreground; - if AColor = clNone then - AColor := FFont.Color; - FCanvas.Font.Color := AColor; - AColor := Attr.Background; - if AColor = clNone then - AColor := FDefaultBG; - FCanvas.Brush.Color := AColor; - end - else - begin - FCanvas.Font.Color := fFontColor; - FCanvas.Brush.Color := FDefaultBG; - end; - end - else - begin - FCanvas.Font.Color := fFontColor; - FCanvas.Brush.Color := FDefaultBG; - end; - Handled := False; - if Assigned(AList) then - begin - if (LCount < AList.Count) then - begin - //Split between tokens: - if (TokenPos >= TWrapPos(AList[LCount]).Index) then - begin - LCount := LCount + 1; - TokenStart := TokenPos; - FYPos := FYPos + FLineHeight; - end - else - begin - //Split in the middle of a token: - if (TokenPos + Length(Token) > TWrapPos(AList[LCount]).Index) then begin - Handled := True; - SplitToken; - end; - end; - end; - end; - if not Handled then - begin - ExpandedPos := FHighLighter.PosToExpandedPos(TokenPos - TokenStart); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, Token); - end; - FHighLighter.Next; - end; - RestoreCurrentFont; - end - else - begin - Lines := TStringList.Create; - try - OldWrapPos := 0; - if Assigned(AList) then - for i := 0 to AList.Count - 1 do - begin - WrapPos := TWrapPos(AList[i]).Index; - if i = 0 then - AStr := Copy(Text, 1, WrapPos) - else - AStr := Copy(Text, OldWrapPos + 1, WrapPos - OldWrapPos); - Lines.Add(AStr); - OldWrapPos := WrapPos; - end; - if Length(Text) > 0 then - Lines.Add(Copy(Text, OldWrapPos + 1, MaxInt)); - - for i := 0 to Lines.Count - 1 do - begin - ClippedTextOut(FMargins.PLeft, FYPos, Lines[i]); - if i < Lines.Count - 1 then - FYPos := FYPos + FLineHeight; - end; - finally - Lines.Free; - end - end -end; - -procedure TSynEditPrint.WriteLine(const Text: string); -var - StrWidth: Integer; -begin - if FLineNumbers then WriteLineNumber; - StrWidth := FCanvas.TextWidth(Text); - {Note that MaxWidth is calculated, using FTestString found in CalcPages - - else the length is not calculated correctly when prewiewing and the - zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY??? - } - if Wrap and (StrWidth > FMaxWidth) then - HandleWrap(Text, FMaxWidth) - else - TextOut(Text, nil); - FYPos := FYPos + FLineHeight; -end; - -procedure TSynEditPrint.PrintPage(Num: Integer); -//Prints a page -var - i, iEnd: Integer; - iSelStart, iSelLen: integer; -begin - PrintStatus(psNewPage, Num, FAbort); - if not FAbort then - begin - FCanvas.Brush.Color := Color; - with FMargins do - FCanvas.FillRect(Rect(PLeft, PTop, PRight, PBottom)); - FMargins.InitPage(FCanvas, Num, FPrinterInfo, FLineNumbers, - FLineNumbersInMargin, FLines.Count - 1 + FLineOffset); - FHeader.Print(FCanvas, Num + FPageOffset); - if FPages.Count > 0 then - begin - FYPos := FMargins.PTop; - if Num = FPageCount then - iEnd := FLines.Count - 1 - else - iEnd := TPageLine(FPages[Num]).FirstLine - 1; - for i := TPageLine(FPages[Num - 1]).FirstLine to iEnd do - begin - FLineNumber := i + 1; - if (not fSelectedOnly or ((i >= fBlockBegin.Line - 1) and (i <= fBlockEnd.Line - 1))) then begin - if (not fSelectedOnly or (fSelMode = smLine)) then - WriteLine(Lines[i]) - else - begin - if (fSelMode = smColumn) or (i = fBlockBegin.Line -1) then - iSelStart := fBlockBegin.Char - else - iSelStart := 1; - if (fSelMode = smColumn) or (i = fBlockEnd.Line -1) then - iSelLen := fBlockEnd.Char - iSelStart - else - iSelLen := MaxInt; - WriteLine( Copy( Lines[i], iSelStart, iSelLen ) ); - end; - PrintLine(i + 1, Num); - end; - end; - end; - FFooter.Print(FCanvas, Num + FPageOffset); - end; -end; - -procedure TSynEditPrint.UpdatePages(ACanvas: TCanvas); -//Update pages (called explicitly by preview component) -begin - FCanvas := ACanvas; - FPrinterInfo.UpdatePrinter; - InitPrint; -end; - -procedure TSynEditPrint.PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); -//Print to specified canvas. Used by preview component -begin - FAbort := False; - FPrinting := False; - FCanvas := ACanvas; - PrintPage(PageNumber); -end; - -procedure TSynEditPrint.Print; -begin - PrintRange(1, -1); -end; - -procedure TSynEditPrint.PrintRange(StartPage, EndPage: Integer); -//Prints the pages in the specified range -var - i, ii: Integer; -begin - if fSelectedOnly and not fSelAvail then - exit; - - FPrinting := True; - FAbort := False; - // The next part sets the document title that is used by the printer queue. - if FDocTitle <> '' then - Printer.Title := FDocTitle - else - Printer.Title := FTitle; - Printer.BeginDoc; - PrintStatus(psBegin, StartPage, FAbort); - UpdatePages(Printer.Canvas); - - for ii:=1 to Copies do - begin - i := StartPage; - if EndPage < 0 then - EndPage := FPageCount; - while (i <= EndPage) and (not FAbort) do begin - PrintPage(i); - if ((i < EndPage) or (ii 0 then - begin - TmpCanvas.Handle := DC; - UpdatePages(TmpCanvas); - TmpCanvas.Handle := 0; - Result := FPageCount; - FPagesCounted := True; - end; - finally - ReleaseDC(0, DC); - end; - finally - TmpCanvas.Free; - end; - end; -end; - -procedure TSynEditPrint.SetSynEdit(const Value: TCustomSynEdit); -begin -// Lines := Value.Lines; - HighLighter := Value.Highlighter; - Font := Value.Font; - FTabWidth := Value.TabWidth; - Lines := Value.Lines; - fSelAvail := Value.SelAvail; - fBlockBegin := Value.BlockBegin; - fBlockEnd := Value.BlockEnd; - fSelMode := Value.SelectionMode; -end; - -procedure TSynEditPrint.LoadFromStream(AStream: TStream); -var - Len, BufferSize: Integer; - Buffer: PWideChar; -begin - FHeader.LoadFromStream(AStream); - FFooter.LoadFromStream(AStream); - FMargins.LoadFromStream(AStream); - with AStream do - begin - Read(Len, sizeof(Len)); - BufferSize := Len * sizeof(WideChar); - GetMem(Buffer, BufferSize + sizeof(WideChar)); - try - Read(Buffer^, BufferSize); - Buffer[BufferSize div sizeof(WideChar)] := #0; - FTitle := Buffer; - finally - FreeMem(Buffer); - end; - Read(Len, sizeof(Len)); - BufferSize := Len * sizeof(WideChar); - GetMem(Buffer, BufferSize + sizeof(WideChar)); - try - Read(Buffer^, BufferSize); - Buffer[BufferSize div sizeof(WideChar)] := #0; - FDocTitle := Buffer; - finally - FreeMem(Buffer); - end; - Read(FWrap, SizeOf(FWrap)); - Read(FHighlight, SizeOf(FHighlight)); - Read(FColors, SizeOf(FColors)); - Read(FLineNumbers, SizeOf(FLineNumbers)); - Read(FLineOffset, SizeOf(FLineOffset)); - Read(FPageOffset, SizeOf(FPageOffset)); - end; -end; - -procedure TSynEditPrint.SaveToStream(AStream: TStream); -var - aLen: Integer; -begin - FHeader.SaveToStream(AStream); - FFooter.SaveToStream(AStream); - FMargins.SaveToStream(AStream); - with AStream do - begin - aLen := Length(FTitle); - Write(aLen, SizeOf(aLen)); - Write(PWideChar(FTitle)^, aLen * sizeof(WideChar)); - aLen := Length(FDocTitle); - Write(aLen, SizeOf(aLen)); - Write(PWideChar(FDocTitle)^, aLen * sizeof(WideChar)); - Write(FWrap, SizeOf(FWrap)); - Write(FHighlight, SizeOf(FHighlight)); - Write(FColors, SizeOf(FColors)); - Write(FLineNumbers, SizeOf(FLineNumbers)); - Write(FLineOffset, SizeOf(FLineOffset)); - Write(FPageOffset, SizeOf(FPageOffset)); - end; -end; - -procedure TSynEditPrint.SetFooter(const Value: TFooter); -begin - FFooter.Assign(Value); -end; - -procedure TSynEditPrint.SetHeader(const Value: THeader); -begin - FHeader.Assign(Value); -end; - -procedure TSynEditPrint.SetMargins(const Value: TSynEditPrintMargins); -begin - FMargins.Assign(Value); -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrint.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrint.pas,v 1.34.2.12 2008/09/23 14:02:08 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + Wrapping across page boundaries is not supported +-------------------------------------------------------------------------------} + +{------------------------------------------------------------------------------- +CONTENTS: + Print controller component. + Allows setting margins, headers and footers. + + Design time properties: + Header : Class property to set properties for headers - + see CSynEditHeaderFooter.pas + Footer : Class property to set properties for footers - + see CSynEditHeaderFooter.pas + Margins : Class property to set properties for margins - + see CSynEditPrintMargins.pas + Lines : The lines that should be printed (see also SynEdit the + property below) + Font : The font the lines should be printed in (see also SynEdit + the property below) + Title : A title - can be referenced in headers/footers by using the + $TITLE$ macro + Wrap : Wrap text to margins + Highlight : Highlight text + Colors : Print in colors + LineNumbers : Print line numbers + LineOffset : Value added to linenumbers when printing + PageOffset : Value added to pagenumbers when printing + OnPrintLine : Fired when a line is printed + OnPrintStatus : Fired at Beginning, End and when a new page is started + Highlighter : The highlighter used for highlighting the text (see also the + SynEdit property below) + LineNumbersInMargin : If true line numbers are printed in the left margin, + else left margin is increased by width of line + number text. + SelectedOnly : Print only the selected Area + Run-time properties: + DocTitle : Used to display the document name in the print queue monitor + PrinterInfo : Read only. Returns info on printer (used internally) + PageCount : Returns the total number of pages; + SynEdit : By setting SynEdit to a specific TSynEdit component, the + properties Lines, Font and Highlighter are automatically + set to the corresponding values of the TSynEdit component + Run-time methods: + UpdatePages : Used internally by the TSynEditPrintPreview component + PrintToCanvas : Used internally by the TSynEditPrintPreview component + Print : Prints the contents of the Lines property + PrintRange(StartPage,EndPage) : Prints the specified page-range (both inclusive) +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINT} +unit SynEditPrint; +{$ENDIF} + +{$M+} +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} + Windows, + Graphics, + Printers, + SynEdit, + SynEditTypes, + SynEditPrintTypes, + SynEditPrintHeaderFooter, + SynEditPrinterInfo, + SynEditPrintMargins, + SynEditMiscProcs, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TPageLine = class + public + FirstLine: Integer; + end; + //The actual print controller object + TSynEditPrint = class(TComponent) + private + FCopies: Integer; + FFooter: TFooter; + FHeader: THeader; + FLines: TUnicodeStrings; + FMargins: TSynEditPrintMargins; + FPageCount: Integer; + FFont: TFont; + FTitle: UnicodeString; + FDocTitle: UnicodeString; + FPrinterInfo: TSynEditPrinterInfo; + FPages: TList; + FCanvas: TCanvas; + FCharWidth: Integer; + FMaxLeftChar: Integer; + FWrap: Boolean; + FOnPrintLine: TPrintLineEvent; + FOnPrintStatus: TPrintStatusEvent; + FYPos: Integer; + FLineHeight: Integer; + FHighlight: Boolean; + FColors: Boolean; + FHighlighter: TSynCustomHighlighter; + FOldFont: TFont; + FSynOK: Boolean; + FLineNumbers: Boolean; + FLineNumber: Integer; + FLineOffset: Integer; + FAbort: Boolean; + FPrinting: Boolean; + FDefaultBG: TColor; + FPageOffset: Integer; + FRangesOK: Boolean; + FMaxWidth: Integer; + FMaxCol: Integer; + FPagesCounted: Boolean; + FLineNumbersInMargin: Boolean; + FTabWidth: Integer; + FFontColor: TColor; + FSelectedOnly: Boolean; + FSelAvail: Boolean; + FSelMode: TSynSelectionMode; + FBlockBegin: TBufferCoord; + FBlockEnd: TBufferCoord; + FETODist: PIntArray; + procedure CalcPages; + procedure PrintPage(Num: Integer); + procedure WriteLine(const Text: UnicodeString); + procedure WriteLineNumber; + procedure HandleWrap(const Text: UnicodeString; MaxWidth: Integer); + procedure TextOut(const Text: UnicodeString; AList: TList); + procedure RestoreCurrentFont; + procedure SaveCurrentFont; + procedure SetPixelsPrInch; + procedure InitPrint; + procedure InitRanges; + function GetPageCount: Integer; + procedure SetSynEdit(const Value: TCustomSynEdit); + procedure SetFooter(const Value: TFooter); + procedure SetHeader(const Value: THeader); + procedure SetMargins(const Value: TSynEditPrintMargins); + procedure SetHighlighter(const Value: TSynCustomHighlighter); + procedure SetLines(const Value: TUnicodeStrings); + procedure SetFont(const Value: TFont); + procedure SetCharWidth(const Value: Integer); + procedure SetMaxLeftChar(const Value: Integer); + function ClipLineToRect(S: UnicodeString; R: TRect): UnicodeString; + function ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; + protected + procedure DefineProperties(Filer: TFiler); override; + property MaxLeftChar: Integer read FMaxLeftChar write SetMaxLeftChar; + property CharWidth: Integer read FCharWidth write SetCharWidth; + procedure PrintStatus(Status: TSynPrintStatus; PageNumber: Integer; + var Abort: Boolean); virtual; + procedure PrintLine(LineNumber, PageNumber: Integer); virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure UpdatePages(ACanvas: TCanvas); + procedure PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); + procedure Print; + procedure PrintRange(StartPage, EndPage: Integer); + property PrinterInfo: TSynEditPrinterInfo read FPrinterInfo; + property PageCount: Integer read GetPageCount; + property SynEdit: TCustomSynEdit write SetSynEdit; + + procedure LoadFromStream(AStream: TStream); + procedure SaveToStream(AStream: TStream); + published + property Copies: Integer read FCopies write FCopies; + property Header: THeader read FHeader write SetHeader; + property Footer: TFooter read FFooter write SetFooter; + property Margins: TSynEditPrintMargins read FMargins write SetMargins; + property Lines: TUnicodeStrings read FLines write SetLines; + property Font: TFont read FFont write SetFont; + property Title: UnicodeString read FTitle write FTitle; + property DocTitle: UnicodeString read FDocTitle write FDocTitle; + property Wrap: Boolean read FWrap write FWrap default True; + property Highlight: Boolean read FHighlight write FHighlight default True; + property SelectedOnly: Boolean read FSelectedOnly write FSelectedOnly + default False; + property Colors: Boolean read FColors write FColors default False; + property LineNumbers: Boolean read FLineNumbers write FLineNumbers + default False; + property LineOffset: Integer read FLineOffset write FLineOffset default 0; + property PageOffset: Integer read FPageOffset write FPageOffset default 0; + property OnPrintLine: TPrintLineEvent read FOnPrintLine write FOnPrintLine; + property OnPrintStatus: TPrintStatusEvent read FOnPrintStatus + write FOnPrintStatus; + property Highlighter: TSynCustomHighlighter read FHighlighter + write SetHighlighter; + property LineNumbersInMargin: Boolean read FLineNumbersInMargin + write FLineNumbersInMargin default False; + property TabWidth: Integer read fTabWidth write fTabWidth; + property Color: TColor read fDefaultBG write fDefaultBG; + end; + +implementation + +uses + Math; + +{ TSynEditPrint } + +constructor TSynEditPrint.Create(AOwner: TComponent); +begin + inherited; + FCopies := 1; + FFooter := TFooter.Create; + FHeader := THeader.Create; + FLines := TUnicodeStringList.Create; + FMargins := TSynEditPrintMargins.Create; + FPrinterInfo := TSynEditPrinterInfo.Create; + FFont := TFont.Create; + FOldFont := TFont.Create; + MaxLeftChar := 1024; + FWrap := True; + FHighlight := True; + FColors := False; + FLineNumbers := False; + FLineOffset := 0; + FPageOffset := 0; + FLineNumbersInMargin := False; + FPages := TList.Create; + FTabWidth := 8; + FDefaultBG := clWhite; +end; + +destructor TSynEditPrint.Destroy; +var + i: Integer; +begin + FFooter.Free; + FHeader.Free; + FLines.Free; + FMargins.Free; + FPrinterInfo.Free; + FFont.Free; + FOldFont.Free; + for i := 0 to FPages.Count - 1 do + TPageLine(FPages[i]).Free; + FPages.Free; + FreeMem(FETODist); + inherited; +end; + +procedure TSynEditPrint.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +procedure TSynEditPrint.SetLines(const Value: TUnicodeStrings); +var + i, j: Integer; + ConvertTabsProc: TConvertTabsProc; + TmpString: UnicodeString; +begin + ConvertTabsProc := GetBestConvertTabsProc(FTabWidth); + with FLines do + begin + BeginUpdate; + try + Clear; + for i := 0 to Value.Count - 1 do + begin + TmpString := ConvertTabsProc(Value[i], FTabWidth); + j := Pos(#9, TmpString); + while j > 0 do + begin + TmpString[j] := ' '; + j := Pos(#9, TmpString); + end; + Add(TmpString); + end; + finally + EndUpdate; + end; + end; + FRangesOK := False; + FPagesCounted := False; +end; + +procedure TSynEditPrint.SetFont(const Value: TFont); +begin + FFont.Assign(Value); + FPagesCounted := False; +end; + +procedure TSynEditPrint.SetCharWidth(const Value: Integer); +begin + FCharWidth := Value; +end; + +procedure TSynEditPrint.SetMaxLeftChar(const Value: Integer); +begin + FMaxLeftChar := Value; +end; + +procedure TSynEditPrint.SetHighlighter(const Value: TSynCustomHighlighter); +begin + FHighlighter := Value; + FRangesOK := False; + FPagesCounted := False; +end; + +// Inserts filling chars into a string containing chars that display as glyphs +// wider than an average glyph. (This is often the case with Asian glyphs, which +// are usually wider than latin glpyhs) +// This is only to simplify paint-operations and has nothing to do with +// multi-byte chars. +function TSynEditPrint.ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; +var + i, j, CountOfAvgGlyphs: Integer; +begin + FCanvas.Font := Font; + + j := 0; + SetLength(Result, Length(S) * 2); // speed improvement + for i := 1 to Length(S) do + begin + Inc(j); + CountOfAvgGlyphs := Ceil(TextWidth(FCanvas, S[i]) / fCharWidth); + + if j + CountOfAvgGlyphs > Length(Result) then + SetLength(Result, Length(Result) + 128); + + // insert CountOfAvgGlyphs filling chars + while CountOfAvgGlyphs > 1 do + begin + Result[j] := FillerChar; + Inc(j); + Dec(CountOfAvgGlyphs); + end; + + Result[j] := S[i]; + end; + + SetLength(Result, j); +end; + +procedure TSynEditPrint.InitPrint; +{ Initialize Font.PixelsPerInch, Character widths, Margins, Total Page count, + headers and footers} +var + TmpSize: Integer; + TmpTextMetrics: TTextMetric; +begin +// FDefaultBG := FCanvas.Brush.Color; + FFontColor := FFont.Color; + FCanvas.Font.Assign(FFont); + if not FPrinting then + begin + SetPixelsPrInch; + TmpSize := FCanvas.Font.Size; + FCanvas.Font.PixelsPerInch := FFont.PixelsPerInch; + FCanvas.Font.Size := TmpSize; + end; + // Calculate TextMetrics with the (probably) most wider text styles so text is + // never clipped (although potentially wasting space) + FCanvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut]; + GetTextMetrics(FCanvas.Handle, TmpTextMetrics); + CharWidth := TmpTextMetrics.tmAveCharWidth; + FLineHeight := TmpTextMetrics.tmHeight + TmpTextMetrics.tmExternalLeading; + FCanvas.Font.Style := FFont.Style; + FMargins.InitPage(FCanvas, 1, FPrinterInfo, FLineNumbers, FLineNumbersInMargin, + FLines.Count - 1 + FLineOffset); + CalcPages; + FHeader.InitPrint(FCanvas, FPageCount, FTitle, FMargins); + FFooter.InitPrint(FCanvas, FPageCount, FTitle, FMargins); + FSynOK := Highlight and Assigned(FHighlighter) and (FLines.Count > 0); +end; + +procedure TSynEditPrint.SetPixelsPrInch; +var + TmpSize: Integer; +begin + FHeader.SetPixPrInch(FPrinterInfo.YPixPrInch); + FFooter.SetPixPrInch(FPrinterInfo.YPixPrInch); + //This should be necessary - else size would be changed... + TmpSize := FFont.Size; + FFont.PixelsPerInch := FPrinterInfo.YPixPrInch; + FFont.Size := TmpSize; +end; + +procedure TSynEditPrint.InitRanges; +//Initialize ranges in Highlighter +var + i: Integer; +begin + if not FRangesOK and Assigned(FHighlighter) and (Lines.Count > 0) then + begin + FHighlighter.ResetRange; + FLines.Objects[0] := FHighlighter.GetRange; + i := 1; + while i < Lines.Count do + begin + FHighlighter.SetLine(FLines[i - 1], i - 1); + FHighlighter.NextToEol; + FLines.Objects[i] := FHighlighter.GetRange; + Inc(i); + end; + FRangesOK := True; + end; +end; + +// Calculates the total number of pages +procedure TSynEditPrint.CalcPages; +var + AStr, Text: UnicodeString; + StrWidth: Integer; + i, j: Integer; + AList: TList; + YPos: Integer; + PageLine: TPageLine; + + //Counts the number of lines a line is wrapped to + procedure CountWrapped; + var + j: Integer; + begin + for j := 0 to AList.Count - 1 do + YPos := YPos + FLineHeight; + end; + +var + iStartLine, iEndLine: Integer; + iSelStart, iSelLen: Integer; +begin + InitRanges; + for i := 0 to FPages.Count - 1 do + TPageLine(FPages[i]).Free; + FPages.Clear; + FMaxWidth := FMargins.PRight - FMargins.PLeft; + AStr := ''; + FMaxCol := 0; + while TextWidth(FCanvas, AStr) < FMaxWidth do + begin + AStr := AStr + 'W'; + FMaxCol := FMaxCol + 1; + end; + FMaxCol := FMaxCol - 1; + {FTestString is used to Calculate MaxWidth when prewiewing and printing - + else the length is not calculated correctly when prewiewing and the + zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY???} +// fTestString := UnicodeStringOfChar('W', FMaxCol); + AStr := UnicodeStringOfChar('W', FMaxCol); + FMaxWidth := TextWidth(FCanvas, AStr); + FPageCount := 1; + PageLine := TPageLine.Create; + PageLine.FirstLine := 0; + FPages.Add(PageLine); + YPos := FMargins.PTop; + if SelectedOnly then + begin + iStartLine := FBlockBegin.Line -1; + iEndLine := FBlockEnd.Line -1; + end + else begin + iStartLine := 0; + iEndLine := Lines.Count -1; + end; + for i := iStartLine to iEndLine do + begin + if not FSelectedOnly or (FSelMode = smLine) then + Text := Lines[i] + else + begin + if (FSelMode = smColumn) or (i = FBlockBegin.Line -1) then + iSelStart := FBlockBegin.Char + else + iSelStart := 1; + if (FSelMode = smColumn) or (i = FBlockEnd.Line -1) then + iSelLen := FBlockEnd.Char - iSelStart + else + iSelLen := MaxInt; + Text := Copy( Lines[i], iSelStart, iSelLen ); + end; + {if new page then increase FPageCount and save the top-line number in + FPages} + if YPos + FLineHeight > FMargins.PBottom then + begin + YPos := FMargins.PTop; + FPageCount := FPageCount + 1; + PageLine := TPageLine.Create; + PageLine.FirstLine := i; + FPages.Add(PageLine); + end; + StrWidth := TextWidth(FCanvas, Text); + {Check for wrap} + if Wrap and (StrWidth > FMaxWidth) then begin + AList := TList.Create; + if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then + CountWrapped + else + begin + {If WrapTextToList didn't succed with the first set of breakchars + then try this one:} + if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then + CountWrapped + else + begin + {If WrapTextToList didn't succed at all, then do it the + primitive way} + while Length(Text) > 0 do + begin + AStr := Copy(Text, 1, FMaxCol); + Delete(Text, 1, FMaxCol); + if Length(Text) > 0 then + YPos := YPos + FLineHeight; + end; + end; + end; + for j := 0 to AList.Count - 1 do + TWrapPos(AList[j]).Free; + AList.Free; + end; + YPos := YPos + FLineHeight; + end; + FPagesCounted := True; +end; + +{ Writes the line number. FMargins. PLeft is the position of the left margin + (which is automatically incremented by the length of the linenumber text, if + the linenumbers should not be placed in the margin) } +procedure TSynEditPrint.WriteLineNumber; +var + AStr: UnicodeString; +begin + SaveCurrentFont; + AStr := IntToStr(FLineNumber + FLineOffset) + ': '; + FCanvas.Brush.Color := FDefaultBG; + FCanvas.Font.Style := []; + FCanvas.Font.Color := clBlack; + SynUnicode.TextOut(FCanvas, FMargins.PLeft - TextWidth(FCanvas, AStr), FYPos, AStr); + RestoreCurrentFont; +end; + +procedure TSynEditPrint.HandleWrap(const Text: UnicodeString; MaxWidth: Integer); +var + AStr: UnicodeString; + AList: TList; + j: Integer; + + procedure WrapPrimitive; + var + i: Integer; + WrapPos: TWrapPos; + begin + i := 1; + while i <= Length(Text) do + begin + AStr := ''; + while (Length(AStr) < FMaxCol) and (i <= Length(Text)) do + begin + AStr := AStr + Text[i]; + i := i + 1; + end; + WrapPos := TWrapPos.Create; + WrapPos.Index := i - 1; + AList.Add(WrapPos); + if (Length(AStr) - i) <= FMaxCol then + Break; + end; + end; + +begin + AStr := ''; + //First try to break the string at the following chars: + AList := TList.Create; + if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then + TextOut(Text, AList) + else + begin + //Then try to break the string at the following chars: + if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then + TextOut(Text, AList) + else + begin + WrapPrimitive; + TextOut(Text, AList) + end; + end; + for j := 0 to AList.Count - 1 do + TWrapPos(Alist[j]).Free; + AList.Free; +end; + +procedure TSynEditPrint.SaveCurrentFont; +begin + FOldFont.Assign(FCanvas.Font); +end; + +procedure TSynEditPrint.RestoreCurrentFont; +begin + FCanvas.Font.Assign(FOldFont); +end; + +function TSynEditPrint.ClipLineToRect(S: UnicodeString; R: TRect): UnicodeString; +begin + while TextWidth(FCanvas, S) > FMaxWidth do + SetLength(S, Length(S) - 1); + + Result := S; +end; + +//Does the actual printing +procedure TSynEditPrint.TextOut(const Text: UnicodeString; AList: TList); +var + Token: UnicodeString; + TokenPos: Integer; + Attr: TSynHighlighterAttributes; + AColor: TColor; + TokenStart: Integer; + LCount: Integer; + Handled: Boolean; + aStr: UnicodeString; + i, WrapPos, OldWrapPos: Integer; + Lines: TUnicodeStringList; + ClipRect: TRect; + sLine, sLineExpandedAtWideGlyphs: UnicodeString; + ExpandedPos: Integer; + + procedure InitETODist(CharWidth: Integer; const Text: UnicodeString); + var + Size: TSize; + i: Integer; + begin + ReallocMem(FETODist, Length(Text) * SizeOf(Integer)); + for i := 0 to Length(Text) - 1 do + begin + Size := GetTextSize(FCanvas.Handle, @Text[i + 1], 1); + FETODist[i] := Ceil(Size.cx / CharWidth) * CharWidth; + end; + end; + + procedure ClippedTextOut(X, Y: Integer; Text: UnicodeString); + begin + Text := ClipLineToRect(Text, ClipRect); + InitETODist(FCharWidth, Text); + Windows.ExtTextOutW(FCanvas.Handle, X, Y, 0, nil, PWideChar(Text), + Length(Text), PInteger(FETODist)); + end; + + procedure SplitToken; + var + AStr: UnicodeString; + Last: Integer; + FirstPos: Integer; + TokenEnd: Integer; + begin + Last := TokenPos; + FirstPos := TokenPos; + TokenEnd := TokenPos + Length(Token); + while (LCount < AList.Count) and (TokenEnd > TWrapPos(AList[LCount]).Index) do + begin + AStr := Copy(Text, Last + 1, TWrapPos(AList[LCount]).Index - Last); + Last := TWrapPos(AList[LCount]).Index; + ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); + ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); + FirstPos := 0; + LCount := LCount + 1; + FYPos := FYPos + FLineHeight; + end; + AStr := Copy(Text, Last + 1, TokenEnd - Last); + ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); + ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); + //Ready for next token: + TokenStart := TokenPos + Length(Token) - Length(AStr); + end; +begin + with FMargins do + ClipRect := Rect(PLeft, PTop, PRight, PBottom); + + if FSynOK then + begin + SaveCurrentFont; + FHighlighter.SetRange(FLines.Objects[FLineNumber - 1]); + sLine := Text; + sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); + FHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, FLineNumber); + + Token := ''; + TokenStart := 0; + LCount := 0; + while not FHighlighter.GetEol do + begin + Token := FHighlighter.GetToken; + TokenPos := FHighlighter.GetTokenPos; + Attr := FHighlighter.GetTokenAttribute; + if Assigned(Attr) then + begin + FCanvas.Font.Style := Attr.Style; + if FColors then + begin + AColor := Attr.Foreground; + if AColor = clNone then + AColor := FFont.Color; + FCanvas.Font.Color := AColor; + AColor := Attr.Background; + if AColor = clNone then + AColor := FDefaultBG; + FCanvas.Brush.Color := AColor; + end + else + begin + FCanvas.Font.Color := FFontColor; + FCanvas.Brush.Color := FDefaultBG; + end; + end + else + begin + FCanvas.Font.Color := FFontColor; + FCanvas.Brush.Color := FDefaultBG; + end; + Handled := False; + if Assigned(AList) then + begin + if (LCount < AList.Count) then + begin + //Split between tokens: + if (TokenPos >= TWrapPos(AList[LCount]).Index) then + begin + LCount := LCount + 1; + TokenStart := TokenPos; + FYPos := FYPos + FLineHeight; + end + else + begin + //Split in the middle of a token: + if (TokenPos + Length(Token) > TWrapPos(AList[LCount]).Index) then begin + Handled := True; + SplitToken; + end; + end; + end; + end; + if not Handled then + begin + ExpandedPos := FHighlighter.PosToExpandedPos(TokenPos - TokenStart); + ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, Token); + end; + FHighlighter.Next; + end; + RestoreCurrentFont; + end + else + begin + Lines := TUnicodeStringList.Create; + try + OldWrapPos := 0; + if Assigned(AList) then + for i := 0 to AList.Count - 1 do + begin + WrapPos := TWrapPos(AList[i]).Index; + if i = 0 then + AStr := Copy(Text, 1, WrapPos) + else + AStr := Copy(Text, OldWrapPos + 1, WrapPos - OldWrapPos); + Lines.Add(AStr); + OldWrapPos := WrapPos; + end; + if Length(Text) > 0 then + Lines.Add(Copy(Text, OldWrapPos + 1, MaxInt)); + + for i := 0 to Lines.Count - 1 do + begin + ClippedTextOut(FMargins.PLeft, FYPos, Lines[i]); + if i < Lines.Count - 1 then + FYPos := FYPos + FLineHeight; + end; + finally + Lines.Free; + end + end +end; + +procedure TSynEditPrint.WriteLine(const Text: UnicodeString); +var + StrWidth: Integer; +begin + if FLineNumbers then WriteLineNumber; + StrWidth := TextWidth(FCanvas, Text); + {Note that MaxWidth is calculated, using FTestString found in CalcPages - + else the length is not calculated correctly when prewiewing and the + zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY??? + } + if Wrap and (StrWidth > FMaxWidth) then + HandleWrap(Text, FMaxWidth) + else + TextOut(Text, nil); + FYPos := FYPos + FLineHeight; +end; + +procedure TSynEditPrint.PrintPage(Num: Integer); +//Prints a page +var + i, iEnd: Integer; + iSelStart, iSelLen: Integer; +begin + PrintStatus(psNewPage, Num, FAbort); + if not FAbort then + begin + FCanvas.Brush.Color := Color; + with FMargins do + FCanvas.FillRect(Rect(PLeft, PTop, PRight, PBottom)); + FMargins.InitPage(FCanvas, Num, FPrinterInfo, FLineNumbers, + FLineNumbersInMargin, FLines.Count - 1 + FLineOffset); + FHeader.Print(FCanvas, Num + FPageOffset); + if FPages.Count > 0 then + begin + FYPos := FMargins.PTop; + if Num = FPageCount then + iEnd := FLines.Count - 1 + else + iEnd := TPageLine(FPages[Num]).FirstLine - 1; + for i := TPageLine(FPages[Num - 1]).FirstLine to iEnd do + begin + FLineNumber := i + 1; + if (not FSelectedOnly or ((i >= FBlockBegin.Line - 1) and (i <= FBlockEnd.Line - 1))) then begin + if (not FSelectedOnly or (FSelMode = smLine)) then + WriteLine(Lines[i]) + else + begin + if (FSelMode = smColumn) or (i = FBlockBegin.Line -1) then + iSelStart := FBlockBegin.Char + else + iSelStart := 1; + if (FSelMode = smColumn) or (i = FBlockEnd.Line -1) then + iSelLen := FBlockEnd.Char - iSelStart + else + iSelLen := MaxInt; + WriteLine( Copy( Lines[i], iSelStart, iSelLen ) ); + end; + PrintLine(i + 1, Num); + end; + end; + end; + FFooter.Print(FCanvas, Num + FPageOffset); + end; +end; + +procedure TSynEditPrint.UpdatePages(ACanvas: TCanvas); +//Update pages (called explicitly by preview component) +begin + FCanvas := ACanvas; + FPrinterInfo.UpdatePrinter; + InitPrint; +end; + +procedure TSynEditPrint.PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); +//Print to specified canvas. Used by preview component +begin + FAbort := False; + FPrinting := False; + FCanvas := ACanvas; + PrintPage(PageNumber); +end; + +procedure TSynEditPrint.Print; +begin + PrintRange(1, -1); +end; + +procedure TSynEditPrint.PrintRange(StartPage, EndPage: Integer); +//Prints the pages in the specified range +var + i, ii: Integer; +begin + if FSelectedOnly and not FSelAvail then + Exit; + + FPrinting := True; + FAbort := False; + // The next part sets the document title that is used by the printer queue. + if FDocTitle <> '' then + Printer.Title := FDocTitle + else + Printer.Title := FTitle; + Printer.BeginDoc; + PrintStatus(psBegin, StartPage, FAbort); + UpdatePages(Printer.Canvas); + + for ii:=1 to Copies do + begin + i := StartPage; + if EndPage < 0 then + EndPage := FPageCount; + while (i <= EndPage) and (not FAbort) do begin + PrintPage(i); + if ((i < EndPage) or (ii 0 then + begin + TmpCanvas.Handle := DC; + UpdatePages(TmpCanvas); + TmpCanvas.Handle := 0; + Result := FPageCount; + FPagesCounted := True; + end; + finally + ReleaseDC(0, DC); + end; + finally + TmpCanvas.Free; + end; + end; +end; + +procedure TSynEditPrint.SetSynEdit(const Value: TCustomSynEdit); +begin +// Lines := Value.Lines; + HighLighter := Value.Highlighter; + Font := Value.Font; + FTabWidth := Value.TabWidth; + Lines := Value.Lines; + FSelAvail := Value.SelAvail; + FBlockBegin := Value.BlockBegin; + FBlockEnd := Value.BlockEnd; + FSelMode := Value.SelectionMode; +end; + +procedure TSynEditPrint.LoadFromStream(AStream: TStream); +var + Len, BufferSize: Integer; + Buffer: PWideChar; +begin + FHeader.LoadFromStream(AStream); + FFooter.LoadFromStream(AStream); + FMargins.LoadFromStream(AStream); + with AStream do + begin + Read(Len, sizeof(Len)); + BufferSize := Len * sizeof(WideChar); + GetMem(Buffer, BufferSize + sizeof(WideChar)); + try + Read(Buffer^, BufferSize); + Buffer[BufferSize div sizeof(WideChar)] := #0; + FTitle := Buffer; + finally + FreeMem(Buffer); + end; + Read(Len, sizeof(Len)); + BufferSize := Len * sizeof(WideChar); + GetMem(Buffer, BufferSize + sizeof(WideChar)); + try + Read(Buffer^, BufferSize); + Buffer[BufferSize div sizeof(WideChar)] := #0; + FDocTitle := Buffer; + finally + FreeMem(Buffer); + end; + Read(FWrap, SizeOf(FWrap)); + Read(FHighlight, SizeOf(FHighlight)); + Read(FColors, SizeOf(FColors)); + Read(FLineNumbers, SizeOf(FLineNumbers)); + Read(FLineOffset, SizeOf(FLineOffset)); + Read(FPageOffset, SizeOf(FPageOffset)); + end; +end; + +procedure TSynEditPrint.SaveToStream(AStream: TStream); +var + aLen: Integer; +begin + FHeader.SaveToStream(AStream); + FFooter.SaveToStream(AStream); + FMargins.SaveToStream(AStream); + with AStream do + begin + aLen := Length(FTitle); + Write(aLen, SizeOf(aLen)); + Write(PWideChar(FTitle)^, aLen * sizeof(WideChar)); + aLen := Length(FDocTitle); + Write(aLen, SizeOf(aLen)); + Write(PWideChar(FDocTitle)^, aLen * sizeof(WideChar)); + Write(FWrap, SizeOf(FWrap)); + Write(FHighlight, SizeOf(FHighlight)); + Write(FColors, SizeOf(FColors)); + Write(FLineNumbers, SizeOf(FLineNumbers)); + Write(FLineOffset, SizeOf(FLineOffset)); + Write(FPageOffset, SizeOf(FPageOffset)); + end; +end; + +procedure TSynEditPrint.SetFooter(const Value: TFooter); +begin + FFooter.Assign(Value); +end; + +procedure TSynEditPrint.SetHeader(const Value: THeader); +begin + FHeader.Assign(Value); +end; + +procedure TSynEditPrint.SetMargins(const Value: TSynEditPrintMargins); +begin + FMargins.Assign(Value); +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPrintHeaderFooter.pas b/Source/VCL/SynEdit/Source/SynEditPrintHeaderFooter.pas index 8899bfee..09c4c264 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintHeaderFooter.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrintHeaderFooter.pas @@ -1,978 +1,1016 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrintHeaderFooter.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -Portions written by Michael Hieke are copyright 2000 Michael Hieke. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrintHeaderFooter.pas,v 1.10.2.7 2008/09/23 14:02:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Classes handling info about headers and footers. - - THeaderFooterItem: - Class handling an item in a header or footer. An item has a text,Font, - LineNumber and Alignment (i.e. two items can be on the same line but have - different fonts). Used internally. - - THeaderFooter: - Collection of THeaderFooterItem's - Design-time properties: - FrameTypes : Frame around header or footer - can be any combination of: - ftLine : Line under header or line above footer - ftBox : Box around header or footer - ftShaded : Filled box (without frame) around header or footer. - ShadedColor : Fill color if ftShaded is in FrameTypes - LineColor : Color of line or box if ftLine or ftBox is in FrameTypes - DefaultFont : Default font for THeaderFooterItem's. This can be used to - set the header/footer font once for all items. - RomanNumbers : Print page numbers as Roman numbers. - MirrorPosition : Mirror position of left/right aligned THeaderFooterItem's - Can be used when printing 2-sided. - Run-time methods: - function Add(Text: string; Font: TFont; - Alignment: TAlignment; - LineNumber: Integer) : Integer; - Add a THeaderFooterItem. If Font is nil or not specified then DefaultFont - is used. Returned value is the index of the added item. - The Text parameter can contain the following macros: - $PAGECOUNT$ : Print total number of pages - $PAGENUM$ : Print current page number - $TITLE$ : Print the title - $DATE$ : Print the date - $TIME$ : Print the time - $DATETIME$ : Print the date and then the time - $TIMEDATE$ : Print the time and then the date - procedure Delete(Index : Integer); - Delete THeaderFooterItem with index Index. - procedure Clear; - Clear all THeaderFooterItems. - function Count : Integer; - Returns number of THeaderFooterItems. - function Get(Index : Integer) : THeaderFooterItem; - Returns THeaderFooterItem with Index. - procedure SetPixPrInch(Value : Integer); - Corrects the PixPerInch property of fonts. Used internally by - TSynEditPrint. - procedure InitPrint(ACanvas : TCanvas;NumPages : Integer; Title : string; - Margins : TSynEditPrintMargins); - Prepares the header or footer for printing. Used internally by - TSynEditPrint. - procedure Print(ACanvas : TCanvas; PageNum : Integer = 0); - Prints the header or footer. Used internally by TSynEditPrint. - --------------------------------------------------------------------------------} - -unit SynEditPrintHeaderFooter; -{$M+} - -{$I SynEdit.inc} - -interface - -uses - Windows, - SynEditPrintTypes, - SynEditPrintMargins, - SynUnicode, - Graphics, - Classes, - SysUtils; - -type - //An item in a header or footer. An item has a text,Font,LineNumber and - //Alignment (i.e. two items can be on the same line but have different - //fonts). - THeaderFooterItem = class - private - FText: string; - FFont: TFont; - FLineNumber: Integer; - FAlignment: TAlignment; - {Used to store the original Index when the item was added - the index - might change when the list is sorted} - FIndex: Integer; - function GetAsString: string; - procedure SetAsString(const Value: string); - procedure SetFont(const Value: TFont); - public - constructor Create; - destructor Destroy; override; - function GetText(NumPages, PageNum: Integer; Roman: Boolean; - Title, ATime, ADate: string): string; - procedure LoadFromStream(AStream: TStream); - procedure SaveToStream(AStream: TStream); - public - property Alignment: TAlignment read FAlignment write FAlignment; - property AsString: string read GetAsString write SetAsString; - property Font: TFont read FFont write SetFont; - property LineNumber: Integer read FLineNumber write FLineNumber; - property Text: string read FText write FText; - end; - - THeaderFooterType = (hftHeader, hftFooter); - - //Used internally to calculate line height and font-base-line for header and - //footer - TLineInfo = class - public - LineHeight: Integer; - MaxBaseDist: Integer; - end; - - //The header/footer class - THeaderFooter = class(TPersistent) - private - FType: THeaderFooterType; // Indicates if header or footer - FFrameTypes: TFrameTypes; - FShadedColor: TColor; - FLineColor: TColor; - FItems: TList; - FDefaultFont: TFont; - FDate, FTime: string; - FNumPages: Integer; - FTitle: string; - FMargins: TSynEditPrintMargins; - FFrameHeight: Integer; - FOldPen: TPen; - FOldBrush: TBrush; - FOldFont: TFont; - FRomanNumbers: Boolean; - FLineInfo: TList; - FLineCount: Integer; - FMirrorPosition: Boolean; - procedure SetDefaultFont(const Value: TFont); - procedure DrawFrame(ACanvas: TCanvas); - procedure CalcHeight(ACanvas: TCanvas); - procedure SaveFontPenBrush(ACanvas: TCanvas); - procedure RestoreFontPenBrush(ACanvas: TCanvas); - function GetAsString: string; - procedure SetAsString(const Value: string); - public - constructor Create; - destructor Destroy; override; - function Add(Text: string; Font: TFont; Alignment: TAlignment; - LineNumber: Integer): Integer; - procedure Delete(Index: Integer); - procedure Clear; - function Count: Integer; - function Get(Index: Integer): THeaderFooterItem; - procedure SetPixPrInch(Value: Integer); - procedure InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: string; - Margins: TSynEditPrintMargins); - procedure Print(ACanvas: TCanvas; PageNum: Integer); - procedure Assign(Source: TPersistent); override; - procedure FixLines; - property AsString: string read GetAsString write SetAsString; - procedure LoadFromStream(AStream: TStream); - procedure SaveToStream(AStream: TStream); - published - property FrameTypes: TFrameTypes read FFrameTypes write FFrameTypes - default [ftLine]; - property ShadedColor: TColor read FShadedColor write FShadedColor - default clSilver; - property LineColor: TColor read FLineColor write FLineColor default clBlack; - property DefaultFont: TFont read FDefaultFont write SetDefaultFont; - property RomanNumbers: Boolean read FRomanNumbers write FRomanNumbers - default False; - property MirrorPosition: Boolean read FMirrorPosition write FMirrorPosition - default False; - end; - - //The header and footer - does nothing but set the value of FType in - //THeaderFooter - THeader = class(THeaderFooter) - public - constructor Create; - end; - - TFooter = class(THeaderFooter) - public - constructor Create; - end; - -implementation - -uses - UITypes, - Math, - SynEditMiscProcs; - -// Helper routine for AsString processing. -function GetFirstEl(var Value: string; Delim: WideChar): string; -var - p: Integer; -begin - p := Pos(Delim, Value); - if p = 0 then - p := Length(Value) + 1; - Result := Copy(Value, 1, p - 1); - Delete(Value, 1, p); -end; - - -{ THeaderFooterItem } - -constructor THeaderFooterItem.Create; -begin - inherited; - FFont := TFont.Create; -end; - -destructor THeaderFooterItem.Destroy; -begin - inherited; - FFont.Free; -end; - -// Returns string representation of THeaderFooterItem to alleviate storing -// items into external storage (registry, ini file). -function THeaderFooterItem.GetAsString: string; -begin - Result := - EncodeString(FText) + '/' + - IntToStr(FFont.Charset) + '/' + - IntToStr(FFont.Color) + '/' + - IntToStr(FFont.Height) + '/' + - EncodeString(FFont.Name) + '/' + - IntToStr(Ord(FFont.Pitch)) + '/' + - IntToStr(FFont.PixelsPerInch) + '/' + - IntToStr(FFont.Size) + '/' + - IntToStr(byte(FFont.Style)) + '/' + - IntToStr(FLineNumber) + '/' + - IntToStr(Ord(FAlignment)); -end; - - -{ This is basically copied from original SynEditPrint.pas. Returns the - header/footer text with macros expanded } -function THeaderFooterItem.GetText(NumPages, PageNum: Integer; - Roman: Boolean; Title, ATime, ADate: string): string; -var - Len, Start, Run: Integer; - AStr: string; - - procedure DoAppend(AText: string); - begin - Result := Result + AText; - end; - procedure TryAppend(var First: Integer; After: Integer); - begin - if After > First then - begin - DoAppend(Copy(AStr, First, After - First)); - First := After; - end; - end; - function TryExecuteMacro: Boolean; - var - Macro: string; - begin - Result := True; - Macro := SysUtils.AnsiUpperCase(Copy(FText, Start, Run - Start + 1)); - if Macro = '$PAGENUM$' then - begin - if Roman then - DoAppend(IntToRoman(PageNum)) - else - DoAppend(IntToStr(PageNum)); - Exit; - end; - if Macro = '$PAGECOUNT$' then - begin - if Roman then - DoAppend(IntToRoman(NumPages)) - else - DoAppend(IntToStr(NumPages)); - Exit; - end; - if Macro = '$TITLE$' then - begin - DoAppend(Title); - Exit; - end; - if Macro = '$DATE$' then - begin - DoAppend(ADate); - Exit; - end; - if Macro = '$TIME$' then - begin - DoAppend(ATime); - Exit; - end; - if Macro = '$DATETIME$' then - begin - DoAppend(ADate + ' ' + ATime); - Exit; - end; - if Macro = '$TIMEDATE$' then - begin - DoAppend(ATime + ' ' + ADate); - Exit; - end; - Result := False; - end; - -begin - Result := ''; - AStr := FText; - if Trim(AStr) = '' then - Exit; - // parse the line - Len := Length(AStr); - if Len > 0 then - begin - // start with left-aligned text - Start := 1; - Run := 1; - while Run <= Len do - begin - // test for embedded macro - if AStr[Run] = '$' then - begin - TryAppend(Start, Run); - Inc(Run); - // search for next '$' which could mark the end of a macro - while Run <= Len do begin - if AStr[Run] = '$' then - begin - // if this is a macro execute it and skip the chars from output - if TryExecuteMacro then - begin - Inc(Run); // also the '$' - Start := Run; - break; - end - else - begin - // this '$' might again be the start of a macro - TryAppend(Start, Run); - Inc(Run); //ek 2001-08-02 - end; - end - else - Inc(Run); - end; - end - else - Inc(Run); - end; - TryAppend(Start, Run); - end; -end; - -procedure THeaderFooterItem.LoadFromStream(AStream: TStream); -var - aCharset: TFontCharset; - aColor: TColor; - aHeight: Integer; - aName: TFontName; - aPitch: TFontPitch; - aSize: Integer; - aStyle: TFontStyles; - Len, BufferSize: Integer; - Buffer: Pointer; -begin - with AStream do - begin - Read(Len, sizeof(Len)); - BufferSize := Len * sizeof(WideChar); - GetMem(Buffer, BufferSize + sizeof(WideChar)); - try - Read(Buffer^, BufferSize); - PWideChar(Buffer)[BufferSize div sizeof(WideChar)] := #0; - FText := PWideChar(Buffer); - finally - FreeMem(Buffer); - end; - Read(FLineNumber, sizeof(FLineNumber)); - // font - Read(aCharset, sizeof(aCharset)); - Read(aColor, sizeof(aColor)); - Read(aHeight, sizeof(aHeight)); - Read(BufferSize, sizeof(BufferSize)); - GetMem(Buffer, BufferSize + 1); - try - Read(Buffer^, BufferSize); - PAnsiChar(Buffer)[BufferSize div sizeof(AnsiChar)] := #0; - aName := string(PAnsiChar(Buffer)); - finally - FreeMem(Buffer); - end; - Read(aPitch, sizeof(aPitch)); - Read(aSize, sizeof(aSize)); - Read(aStyle, sizeof(aStyle)); - FFont.Charset := aCharset; - FFont.Color := aColor; - FFont.Height := aHeight; - FFont.Name := aName; - FFont.Pitch := aPitch; - FFont.Size := aSize; - FFont.Style := aStyle; - Read(FAlignment, sizeof(FAlignment)); - end; -end; - -procedure THeaderFooterItem.SaveToStream(AStream: TStream); -var - aCharset: TFontCharset; - aColor: TColor; - aHeight: Integer; - aName: TFontName; - aPitch: TFontPitch; - aSize: Integer; - aStyle: TFontStyles; - aLen: Integer; -begin - with AStream do - begin - aLen := Length(FText); - Write(aLen, sizeof(aLen)); - Write(PWideChar(FText)^, aLen * sizeof(WideChar)); - Write(FLineNumber, sizeof(FLineNumber)); - // font - aCharset := FFont.Charset; - aColor := FFont.Color; - aHeight := FFont.Height; - aName := FFont.Name; - aPitch := FFont.Pitch; - aSize := FFont.Size; - aStyle := FFont.Style; - Write(aCharset, SizeOf(aCharset)); - Write(aColor, SizeOf(aColor)); - Write(aHeight, SizeOf(aHeight)); - aLen := Length(aName); - Write(aLen, SizeOf(aLen)); - Write(PAnsiChar(AnsiString(aName))^, aLen); - Write(aPitch, SizeOf(aPitch)); - Write(aSize, SizeOf(aSize)); - Write(aStyle, SizeOf(aStyle)); - Write(FAlignment, SizeOf(FAlignment)); - end; -end; - -procedure THeaderFooterItem.SetAsString(const Value: string); -var - s: string; - sty: TFontStyles; -begin - s := Value; - FText := DecodeString(GetFirstEl(s, '/')); - FFont.Charset := StrToIntDef(GetFirstEl(s, '/'), 0); - FFont.Color := StrToIntDef(GetFirstEl(s, '/'), 0); - FFont.Height := StrToIntDef(GetFirstEl(s, '/'), 0); - FFont.Name := DecodeString(GetFirstEl(s, '/')); - FFont.Pitch := TFontPitch(StrToIntDef(GetFirstEl(s, '/'), 0)); - FFont.PixelsPerInch := StrToIntDef(GetFirstEl(s, '/'), 0); - FFont.Size := StrToIntDef(GetFirstEl(s, '/'), 0); - byte(sty) := StrToIntDef(GetFirstEl(s, '/'), 0); - FFont.Style := sty; - FLineNumber := StrToIntDef(GetFirstEl(s, '/'), 0); - FAlignment := TAlignment(StrToIntDef(GetFirstEl(s, '/'), 0)); -end; - -procedure THeaderFooterItem.SetFont(const Value: TFont); -begin - FFont.Assign(Value); -end; - -{ THeaderFooter } - -constructor THeaderFooter.Create; -begin - inherited; - FFrameTypes := [ftLine]; - FShadedColor := clSilver; - FLineColor := clBlack; - FItems := TList.Create; - FDefaultFont := TFont.Create; - FOldPen := TPen.Create; - FOldBrush := TBrush.Create; - FOldFont := TFont.Create; - FRomanNumbers := False; - FMirrorPosition := False; - FLineInfo := TList.Create; - with FDefaultFont do - begin - Name := 'Arial'; - Size := 10; - Color := clBlack; - end; -end; - -destructor THeaderFooter.Destroy; -var - i: Integer; -begin - Clear; - FItems.Free; - FDefaultFont.Free; - FOldPen.Free; - FOldBrush.Free; - FOldFont.Free; - for i := 0 to FLineInfo.Count - 1 do - TLineInfo(FLineInfo[i]).Free; - FLineInfo.Free; - inherited; -end; - -function THeaderFooter.Add(Text: string; Font: TFont; - Alignment: TAlignment; LineNumber: Integer): Integer; -var - AItem: THeaderFooterItem; -begin - AItem := THeaderFooterItem.Create; - if Font = nil then - AItem.Font := FDefaultFont - else - AItem.Font := Font; - AItem.Alignment := Alignment; - AItem.LineNumber := LineNumber; - AItem.FIndex := FItems.Add(AItem); - AItem.Text := Text; - Result := AItem.FIndex; -end; - -procedure THeaderFooter.Delete(Index: Integer); -var - i: Integer; -begin - for i := 0 to FItems.Count - 1 do - begin - if THeaderFooterItem(FItems[i]).FIndex = Index then - begin - FItems.Delete(i); - Break; - end; - end; -end; - -procedure THeaderFooter.Clear; -var - i: Integer; -begin - for i := 0 to FItems.Count - 1 do - THeaderFooterItem(FItems[i]).Free; - FItems.Clear; -end; - -procedure THeaderFooter.SetDefaultFont(const Value: TFont); -begin - FDefaultFont.Assign(Value); -end; - -{ Counts number of lines in header/footer and changes the line-number so they - start with 1 (the user might add header/footer items starting at line 2) } -procedure THeaderFooter.FixLines; -var - i, CurLine: Integer; - LineInfo: TLineInfo; -begin - for i := 0 to FLineInfo.Count - 1 do - TLineInfo(FLineInfo[i]).Free; - FLineInfo.Clear; - CurLine := 0; - FLineCount := 0; - for i := 0 to FItems.Count - 1 do - begin - if THeaderFooterItem(FItems[i]).LineNumber <> CurLine then - begin - CurLine := THeaderFooterItem(FItems[i]).LineNumber; - FLineCount := FLineCount + 1; - LineInfo := TLineInfo.Create; - FLineInfo.Add(LineInfo); - end; - THeaderFooterItem(FItems[i]).LineNumber := FLineCount; - end; -end; - -{ Calculates the hight of the header/footer, finds the line height for each line - and calculates the font baseline where text is to be written } -procedure THeaderFooter.CalcHeight(ACanvas: TCanvas); -var - i, CurLine: Integer; - AItem: THeaderFooterItem; - FOrgHeight: Integer; - TextMetric: TTextMetric; -begin - FFrameHeight := -1; - if FItems.Count <= 0 then Exit; - - CurLine := 1; - FFrameHeight := 0; - FOrgHeight := FFrameHeight; - for i := 0 to FItems.Count - 1 do - begin - AItem := THeaderFooterItem(FItems[i]); - if AItem.LineNumber <> CurLine then - begin - CurLine := AItem.LineNumber; - FOrgHeight := FFrameHeight; - end; - ACanvas.Font.Assign(AItem.Font); - GetTextMetrics(ACanvas.Handle, TextMetric); - with TLineInfo(FLineInfo[CurLine - 1]), TextMetric do - begin - LineHeight := Max(LineHeight, ACanvas.TextHeight('W')); - MaxBaseDist := Max(MaxBaseDist, tmHeight - tmDescent); - end; - FFrameHeight := Max(FFrameHeight, FOrgHeight + ACanvas.TextHeight('W')); - end; - FFrameHeight := FFrameHeight + 2 * FMargins.PHFInternalMargin; -end; - -function CompareItems(Item1, Item2: Pointer): Integer; -//Used to sort header/footer items -begin - Result := THeaderFooterItem(Item1).LineNumber - THeaderFooterItem(Item2).LineNumber; - if Result = 0 then - Result := Integer(Item1) - Integer(Item2); -end; - -procedure THeaderFooter.SetPixPrInch(Value: Integer); -var - i, TmpSize: Integer; - AFont: TFont; -begin - for i := 0 to FItems.Count - 1 do - begin - AFont := THeaderFooterItem(FItems[i]).Font; - TmpSize := AFont.Size; - AFont.PixelsPerInch := Value; - AFont.Size := TmpSize; - end; -end; - -procedure THeaderFooter.InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: string; - Margins: TSynEditPrintMargins); -begin - SaveFontPenBrush(ACanvas); - FDate := DateToStr(Now); - FTime := TimeToStr(Now); - FNumPages := NumPages; - FMargins := Margins; - FTitle := Title; - FItems.Sort(CompareItems); - FixLines; - CalcHeight(ACanvas); - RestoreFontPenBrush(ACanvas); -end; - -procedure THeaderFooter.SaveFontPenBrush(ACanvas: TCanvas); -begin - FOldFont.Assign(ACanvas.Font); - FOldPen.Assign(ACanvas.Pen); - FOldBrush.Assign(ACanvas.Brush); -end; - -procedure THeaderFooter.RestoreFontPenBrush(ACanvas: TCanvas); -begin - ACanvas.Font.Assign(FOldFont); - ACanvas.Pen.Assign(FOldPen); - ACanvas.Brush.Assign(FOldBrush); -end; - -procedure THeaderFooter.DrawFrame(ACanvas: TCanvas); -//Draws frame around header/footer -begin - if (FrameTypes = []) then Exit; - with ACanvas, FMargins do begin - Pen.Color := LineColor; - Brush.Color := ShadedColor; - if ftShaded in FrameTypes then - Brush.Style := bsSolid - else - Brush.Style := bsClear; - if ftBox in FrameTypes then - Pen.Style := psSolid - else - Pen.Style := psClear; - if FrameTypes * [ftBox, ftShaded] <> [] then begin - if FType = hftHeader then - Rectangle(PLeft, PHeader - FFrameHeight, PRight, PHeader) - else - Rectangle(PLeft, PFooter, PRight, PFooter + FFrameHeight); - end; - if ftLine in FrameTypes then begin - Pen.Style := psSolid; - if FType = hftHeader then begin - MoveTo(PLeft, PHeader); - LineTo(PRight, PHeader); - end - else begin - MoveTo(PLeft, PFooter); - LineTo(PRight, PFooter); - end - end; - end; -end; - -procedure THeaderFooter.Print(ACanvas: TCanvas; PageNum: Integer); -var - i, X, Y, CurLine: Integer; - AStr: string; - AItem: THeaderFooterItem; - OldAlign: UINT; - TheAlignment: TAlignment; -begin - if (FFrameHeight <= 0) then Exit; // No header/footer - SaveFontPenBrush(ACanvas); - DrawFrame(ACanvas); - ACanvas.Brush.Style := bsClear; - if FType = hftHeader then - Y := FMargins.PHeader - FFrameHeight - else - Y := FMargins.PFooter; - Y := Y + FMargins.PHFInternalMargin; // Add the specified internal margin - - CurLine := 1; - for i := 0 to FItems.Count - 1 do - begin - AItem := THeaderFooterItem(FItems[i]); - ACanvas.Font := AItem.Font; - if AItem.LineNumber <> CurLine then - begin - Y := Y + TLineInfo(FLineInfo[CurLine - 1]).LineHeight; - CurLine := AItem.LineNumber; - end; - AStr := AItem.GetText(FNumPages, PageNum, FRomanNumbers, FTitle, FTime, FDate); - //Find the alignment of the header/footer item - check for MirrorPosition - TheAlignment := AItem.Alignment; - if MirrorPosition and ((PageNum mod 2) = 0) then - begin - case AItem.Alignment of - taRightJustify: TheAlignment := taLeftJustify; - taLeftJustify: TheAlignment := taRightJustify; - end; - end; - //Find X-position of text - with FMargins do begin - X := PLeftHFTextIndent; - case TheAlignment of - taRightJustify: X := PRightHFTextIndent - ACanvas.TextWidth(AStr); - taCenter: X := (PLeftHFTextIndent + PRightHFTextIndent - ACanvas.TextWidth(AStr)) div 2; - end; - end; - {Aligning at base line - Fonts can have different size in headers and footers} - OldAlign := SetTextAlign(ACanvas.Handle, TA_BASELINE); - ExtTextOutW(ACanvas.Handle, X, Y + TLineInfo(FLineInfo[CurLine - 1]).MaxBaseDist, - 0, nil, PWideChar(AStr), Length(AStr), nil); - SetTextAlign(ACanvas.Handle, OldAlign); - end; - RestoreFontPenBrush(ACanvas); -end; - -procedure THeaderFooter.Assign(Source: TPersistent); -var - Src: THeaderFooter; - i: Integer; -begin - if (Source <> nil) and (Source is THeaderFooter) then begin - Src := THeaderFooter(Source); - Clear; - FType := Src.FType; - FFrameTypes := Src.FFrameTypes; - FShadedColor := Src.FShadedColor; - FLineColor := Src.FLineColor; - for i := 0 to Src.FItems.Count - 1 do begin - with THeaderFooterItem(Src.FItems[i]) do - Add(Text, Font, Alignment, LineNumber); - end; - FDefaultFont.Assign(Src.FDefaultFont); - FRomanNumbers := Src.FRomanNumbers; - FMirrorPosition := Src.FMirrorPosition; - end else - inherited Assign(Source); -end; - -function THeaderFooter.Count: Integer; -begin - Result := FItems.Count; -end; - -function THeaderFooter.Get(Index: Integer): THeaderFooterItem; -begin - Result := THeaderFooterItem(FItems[Index]); -end; - -function THeaderFooter.GetAsString: string; -var - i: integer; -begin - FixLines; - Result := ''; - for i := 0 to FItems.Count - 1 do begin - if Result <> '' then Result := Result + '/'; - Result := Result + EncodeString(THeaderFooterItem(FItems[i]).AsString); - end; //for -end; - -procedure THeaderFooter.SetAsString(const Value: string); -var - item: THeaderFooterItem; - s: string; -begin - Clear; - item := THeaderFooterItem.Create; - try - s := Value; - while s <> '' do - begin - item.AsString := DecodeString(GetFirstEl(s, '/')); - Add(item.Text, item.Font, item.Alignment, item.LineNumber); - end; - finally - item.Free; - end; -end; - -procedure THeaderFooter.LoadFromStream(AStream: TStream); -var - Num, i: Integer; - aCharset: TFontCharset; - aColor: TColor; - aHeight: Integer; - aName: TFontName; - aPitch: TFontPitch; - aSize: Integer; - aStyle: TFontStyles; - bufSize: Integer; - buffer: PAnsiChar; -begin - with AStream do begin - // read header/footer properties first - Read(FFrameTypes, SizeOf(FFrameTypes)); - Read(FShadedColor, SizeOf(FShadedColor)); - Read(FLineColor, SizeOf(FLineColor)); - Read(FRomanNumbers, SizeOf(FRomanNumbers)); - Read(FMirrorPosition, SizeOf(FMirrorPosition)); - // font - Read(aCharset, SizeOf(aCharset)); - Read(aColor, SizeOf(aColor)); - Read(aHeight, SizeOf(aHeight)); - Read(bufSize, SizeOf(bufSize)); - GetMem(buffer, bufSize+1); - try - Read(buffer^, bufSize); - buffer[bufSize] := #0; - aName := string(buffer); - finally - FreeMem(buffer); - end; - Read(aPitch, SizeOf(aPitch)); - Read(aSize, SizeOf(aSize)); - Read(aStyle, SizeOf(aStyle)); - FDefaultFont.Charset := aCharset; - FDefaultFont.Color := aColor; - FDefaultFont.Height := aHeight; - FDefaultFont.Name := aName; - FDefaultFont.Pitch := aPitch; - FDefaultFont.Size := aSize; - FDefaultFont.Style := aStyle; - // now read in the items - Read(Num, SizeOf(Num)); - while Num > 0 do - begin - // load headerfooter items from stream - i := Add('', nil, taLeftJustify, 1); - Get(i).LoadFromStream(AStream); - Dec(Num); - end; - end; -end; - -procedure THeaderFooter.SaveToStream(AStream: TStream); -var - i, Num: integer; - aCharset: TFontCharset; - aColor: TColor; - aHeight: Integer; - aName: TFontName; - aPitch: TFontPitch; - aSize: Integer; - aStyle: TFontStyles; - aLen : integer; -begin - with AStream do begin - // write the header/footer properties first - Write(FFrameTypes, SizeOf(FFrameTypes)); - Write(FShadedColor, SizeOf(FShadedColor)); - Write(FLineColor, SizeOf(FLineColor)); - Write(FRomanNumbers, SizeOf(FRomanNumbers)); - Write(FMirrorPosition, SizeOf(FMirrorPosition)); - // font - aCharset := FDefaultFont.Charset; - aColor := FDefaultFont.Color; - aHeight := FDefaultFont.Height; - aName := FDefaultFont.Name; - aPitch := FDefaultFont.Pitch; - aSize := FDefaultFont.Size; - aStyle := FDefaultFont.Style; - Write(aCharset, SizeOf(aCharset)); - Write(aColor, SizeOf(aColor)); - Write(aHeight, SizeOf(aHeight)); - aLen := Length(aName); - Write(aLen, SizeOf(aLen)); - Write(PAnsiChar(AnsiString(aName))^, Length(aName)); - Write(aPitch, SizeOf(aPitch)); - Write(aSize, SizeOf(aSize)); - Write(aStyle, SizeOf(aStyle)); - - // now write the items - Num := Count; - Write(Num, SizeOf(Num)); - for i := 0 to Num - 1 do - Get(i).SaveToStream(AStream); - end; -end; - -{ THeader } - -constructor THeader.Create; -begin - inherited; - FType := hftHeader; -end; - -{ TFooter } - -constructor TFooter.Create; -begin - inherited; - FType := hftFooter; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrintHeaderFooter.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +Portions written by Michael Hieke are copyright 2000 Michael Hieke. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrintHeaderFooter.pas,v 1.10.2.7 2008/09/23 14:02:08 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Classes handling info about headers and footers. + + THeaderFooterItem: + Class handling an item in a header or footer. An item has a text,Font, + LineNumber and Alignment (i.e. two items can be on the same line but have + different fonts). Used internally. + + THeaderFooter: + Collection of THeaderFooterItem's + Design-time properties: + FrameTypes : Frame around header or footer - can be any combination of: + ftLine : Line under header or line above footer + ftBox : Box around header or footer + ftShaded : Filled box (without frame) around header or footer. + ShadedColor : Fill color if ftShaded is in FrameTypes + LineColor : Color of line or box if ftLine or ftBox is in FrameTypes + DefaultFont : Default font for THeaderFooterItem's. This can be used to + set the header/footer font once for all items. + RomanNumbers : Print page numbers as Roman numbers. + MirrorPosition : Mirror position of left/right aligned THeaderFooterItem's + Can be used when printing 2-sided. + Run-time methods: + function Add(Text: UnicodeString; Font: TFont; + Alignment: TAlignment; + LineNumber: Integer) : Integer; + Add a THeaderFooterItem. If Font is nil or not specified then DefaultFont + is used. Returned value is the index of the added item. + The Text parameter can contain the following macros: + $PAGECOUNT$ : Print total number of pages + $PAGENUM$ : Print current page number + $TITLE$ : Print the title + $DATE$ : Print the date + $TIME$ : Print the time + $DATETIME$ : Print the date and then the time + $TIMEDATE$ : Print the time and then the date + procedure Delete(Index : Integer); + Delete THeaderFooterItem with index Index. + procedure Clear; + Clear all THeaderFooterItems. + function Count : Integer; + Returns number of THeaderFooterItems. + function Get(Index : Integer) : THeaderFooterItem; + Returns THeaderFooterItem with Index. + procedure SetPixPrInch(Value : Integer); + Corrects the PixPerInch property of fonts. Used internally by + TSynEditPrint. + procedure InitPrint(ACanvas : TCanvas;NumPages : Integer; Title : UnicodeString; + Margins : TSynEditPrintMargins); + Prepares the header or footer for printing. Used internally by + TSynEditPrint. + procedure Print(ACanvas : TCanvas; PageNum : Integer = 0); + Prints the header or footer. Used internally by TSynEditPrint. + +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINTHEADERFOOTER} +unit SynEditPrintHeaderFooter; +{$ENDIF} +{$M+} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} + Windows, + SynEditPrintTypes, + SynEditPrintMargins, + SynUnicode, + Graphics, + Classes, + SysUtils; + +type + //An item in a header or footer. An item has a text,Font,LineNumber and + //Alignment (i.e. two items can be on the same line but have different + //fonts). + THeaderFooterItem = class + private + FText: UnicodeString; + FFont: TFont; + FLineNumber: Integer; + FAlignment: TAlignment; + {Used to store the original Index when the item was added - the index + might change when the list is sorted} + FIndex: Integer; + function GetAsString: UnicodeString; + procedure SetAsString(const Value: UnicodeString); + procedure SetFont(const Value: TFont); + public + constructor Create; + destructor Destroy; override; + function GetText(NumPages, PageNum: Integer; Roman: Boolean; + Title, ATime, ADate: UnicodeString): UnicodeString; + procedure LoadFromStream(AStream: TStream); + procedure SaveToStream(AStream: TStream); + public + property Alignment: TAlignment read FAlignment write FAlignment; + property AsString: UnicodeString read GetAsString write SetAsString; + property Font: TFont read FFont write SetFont; + property LineNumber: Integer read FLineNumber write FLineNumber; + property Text: UnicodeString read FText write FText; + end; + + THeaderFooterType = (hftHeader, hftFooter); + + //Used internally to calculate line height and font-base-line for header and + //footer + TLineInfo = class + public + LineHeight: Integer; + MaxBaseDist: Integer; + end; + + //The header/footer class + THeaderFooter = class(TPersistent) + private + FType: THeaderFooterType; // Indicates if header or footer + FFrameTypes: TFrameTypes; + FShadedColor: TColor; + FLineColor: TColor; + FItems: TList; + FDefaultFont: TFont; + FDate, FTime: UnicodeString; + FNumPages: Integer; + FTitle: UnicodeString; + FMargins: TSynEditPrintMargins; + FFrameHeight: Integer; + FOldPen: TPen; + FOldBrush: TBrush; + FOldFont: TFont; + FRomanNumbers: Boolean; + FLineInfo: TList; + FLineCount: Integer; + FMirrorPosition: Boolean; + procedure SetDefaultFont(const Value: TFont); + procedure DrawFrame(ACanvas: TCanvas); + procedure CalcHeight(ACanvas: TCanvas); + procedure SaveFontPenBrush(ACanvas: TCanvas); + procedure RestoreFontPenBrush(ACanvas: TCanvas); + function GetAsString: UnicodeString; + procedure SetAsString(const Value: UnicodeString); + public + constructor Create; + destructor Destroy; override; + function Add(Text: UnicodeString; Font: TFont; Alignment: TAlignment; + LineNumber: Integer): Integer; + procedure Delete(Index: Integer); + procedure Clear; + function Count: Integer; + function Get(Index: Integer): THeaderFooterItem; + procedure SetPixPrInch(Value: Integer); + procedure InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: UnicodeString; + Margins: TSynEditPrintMargins); + procedure Print(ACanvas: TCanvas; PageNum: Integer); + procedure Assign(Source: TPersistent); override; + procedure FixLines; + property AsString: UnicodeString read GetAsString write SetAsString; + procedure LoadFromStream(AStream: TStream); + procedure SaveToStream(AStream: TStream); + published + property FrameTypes: TFrameTypes read FFrameTypes write FFrameTypes + default [ftLine]; + property ShadedColor: TColor read FShadedColor write FShadedColor + default clSilver; + property LineColor: TColor read FLineColor write FLineColor default clBlack; + property DefaultFont: TFont read FDefaultFont write SetDefaultFont; + property RomanNumbers: Boolean read FRomanNumbers write FRomanNumbers + default False; + property MirrorPosition: Boolean read FMirrorPosition write FMirrorPosition + default False; + end; + + //The header and footer - does nothing but set the value of FType in + //THeaderFooter + THeader = class(THeaderFooter) + public + constructor Create; + end; + + TFooter = class(THeaderFooter) + public + constructor Create; + end; + + {$IFNDEF SYN_COMPILER_3_UP} + TFontCharSet = 0..255; + {$ENDIF} + +implementation + +uses +{$IFDEF SYN_COMPILER_4_UP} + Math, +{$ENDIF} + SynEditMiscProcs; + +// Helper routine for AsString processing. +function GetFirstEl(var Value: UnicodeString; Delim: WideChar): UnicodeString; +var + p: Integer; +begin + p := Pos(Delim, Value); + if p = 0 then + p := Length(Value) + 1; + Result := Copy(Value, 1, p - 1); + Delete(Value, 1, p); +end; + + +{ THeaderFooterItem } + +constructor THeaderFooterItem.Create; +begin + inherited; + FFont := TFont.Create; +end; + +destructor THeaderFooterItem.Destroy; +begin + inherited; + FFont.Free; +end; + +// Returns string representation of THeaderFooterItem to alleviate storing +// items into external storage (registry, ini file). +function THeaderFooterItem.GetAsString: UnicodeString; +begin + Result := + EncodeString(FText) + '/' + +{$IFDEF SYN_COMPILER_3_UP} + IntToStr(FFont.Charset) + '/' + +{$ELSE} + IntToStr(DEFAULT_CHARSET)+'/' + +{$ENDIF} + IntToStr(FFont.Color) + '/' + + IntToStr(FFont.Height) + '/' + + EncodeString(FFont.Name) + '/' + + IntToStr(Ord(FFont.Pitch)) + '/' + + IntToStr(FFont.PixelsPerInch) + '/' + + IntToStr(FFont.Size) + '/' + + IntToStr(byte(FFont.Style)) + '/' + + IntToStr(FLineNumber) + '/' + + IntToStr(Ord(FAlignment)); +end; + + +{ This is basically copied from original SynEditPrint.pas. Returns the + header/footer text with macros expanded } +function THeaderFooterItem.GetText(NumPages, PageNum: Integer; + Roman: Boolean; Title, ATime, ADate: UnicodeString): UnicodeString; +var + Len, Start, Run: Integer; + AStr: UnicodeString; + + procedure DoAppend(AText: UnicodeString); + begin + Result := Result + AText; + end; + procedure TryAppend(var First: Integer; After: Integer); + begin + if After > First then + begin + DoAppend(Copy(AStr, First, After - First)); + First := After; + end; + end; + function TryExecuteMacro: Boolean; + var + Macro: UnicodeString; + begin + Result := True; + Macro := SynWideUpperCase(Copy(FText, Start, Run - Start + 1)); + if Macro = '$PAGENUM$' then + begin + if Roman then + DoAppend(IntToRoman(PageNum)) + else + DoAppend(IntToStr(PageNum)); + Exit; + end; + if Macro = '$PAGECOUNT$' then + begin + if Roman then + DoAppend(IntToRoman(NumPages)) + else + DoAppend(IntToStr(NumPages)); + Exit; + end; + if Macro = '$TITLE$' then + begin + DoAppend(Title); + Exit; + end; + if Macro = '$DATE$' then + begin + DoAppend(ADate); + Exit; + end; + if Macro = '$TIME$' then + begin + DoAppend(ATime); + Exit; + end; + if Macro = '$DATETIME$' then + begin + DoAppend(ADate + ' ' + ATime); + Exit; + end; + if Macro = '$TIMEDATE$' then + begin + DoAppend(ATime + ' ' + ADate); + Exit; + end; + Result := False; + end; + +begin + Result := ''; + AStr := FText; + if WideTrim(AStr) = '' then + Exit; + // parse the line + Len := Length(AStr); + if Len > 0 then + begin + // start with left-aligned text + Start := 1; + Run := 1; + while Run <= Len do + begin + // test for embedded macro + if AStr[Run] = '$' then + begin + TryAppend(Start, Run); + Inc(Run); + // search for next '$' which could mark the end of a macro + while Run <= Len do begin + if AStr[Run] = '$' then + begin + // if this is a macro execute it and skip the chars from output + if TryExecuteMacro then + begin + Inc(Run); // also the '$' + Start := Run; + Break; + end + else + begin + // this '$' might again be the start of a macro + TryAppend(Start, Run); + Inc(Run); //ek 2001-08-02 + end; + end + else + Inc(Run); + end; + end + else + Inc(Run); + end; + TryAppend(Start, Run); + end; +end; + +procedure THeaderFooterItem.LoadFromStream(AStream: TStream); +var + aCharset: TFontCharset; + aColor: TColor; + aHeight: Integer; + aName: TFontName; + aPitch: TFontPitch; + aSize: Integer; + aStyle: TFontStyles; + Len, BufferSize: Integer; + Buffer: Pointer; +begin + with AStream do + begin + Read(Len, sizeof(Len)); + BufferSize := Len * sizeof(WideChar); + GetMem(Buffer, BufferSize + sizeof(WideChar)); + try + Read(Buffer^, BufferSize); + PWideChar(Buffer)[BufferSize div sizeof(WideChar)] := #0; + FText := PWideChar(Buffer); + finally + FreeMem(Buffer); + end; + Read(FLineNumber, sizeof(FLineNumber)); + // font + Read(aCharset, sizeof(aCharset)); + Read(aColor, sizeof(aColor)); + Read(aHeight, sizeof(aHeight)); + Read(BufferSize, sizeof(BufferSize)); + GetMem(Buffer, BufferSize + 1); + try + Read(Buffer^, BufferSize); + PAnsiChar(Buffer)[BufferSize div sizeof(AnsiChar)] := #0; + aName := string(PAnsiChar(Buffer)); + finally + FreeMem(Buffer); + end; + Read(aPitch, sizeof(aPitch)); + Read(aSize, sizeof(aSize)); + Read(aStyle, sizeof(aStyle)); + {$IFDEF SYN_COMPILER_3_UP} + FFont.Charset := aCharset; + {$ENDIF} + FFont.Color := aColor; + FFont.Height := aHeight; + FFont.Name := aName; + FFont.Pitch := aPitch; + FFont.Size := aSize; + FFont.Style := aStyle; + Read(FAlignment, sizeof(FAlignment)); + end; +end; + +procedure THeaderFooterItem.SaveToStream(AStream: TStream); +var + aCharset: TFontCharset; + aColor: TColor; + aHeight: Integer; + aName: TFontName; + aPitch: TFontPitch; + aSize: Integer; + aStyle: TFontStyles; + aLen: Integer; +begin + with AStream do + begin + aLen := Length(FText); + Write(aLen, sizeof(aLen)); + Write(PWideChar(FText)^, aLen * sizeof(WideChar)); + Write(FLineNumber, sizeof(FLineNumber)); + // font + {$IFDEF SYN_COMPILER_3_UP} + aCharset := FFont.Charset; + {$ELSE} + aCharset := DEFAULT_CHARSET; + {$ENDIF} + aColor := FFont.Color; + aHeight := FFont.Height; + aName := FFont.Name; + aPitch := FFont.Pitch; + aSize := FFont.Size; + aStyle := FFont.Style; + Write(aCharset, SizeOf(aCharset)); + Write(aColor, SizeOf(aColor)); + Write(aHeight, SizeOf(aHeight)); + aLen := Length(aName); + Write(aLen, SizeOf(aLen)); + {$IFDEF SYN_COMPILER_2} // In D2 TFontName is a ShortString + Write(PAnsiChar(@aName[1])^, aLen); // D2 cannot convert ShortStrings to PAnsiChar + {$ELSE} + Write(PAnsiChar(AnsiString(aName))^, aLen); + {$ENDIF} + Write(aPitch, SizeOf(aPitch)); + Write(aSize, SizeOf(aSize)); + Write(aStyle, SizeOf(aStyle)); + Write(FAlignment, SizeOf(FAlignment)); + end; +end; + +procedure THeaderFooterItem.SetAsString(const Value: UnicodeString); +var + s: UnicodeString; + sty: TFontStyles; +begin + s := Value; + FText := DecodeString(GetFirstEl(s, '/')); +{$IFDEF SYN_COMPILER_3_UP} + FFont.Charset := StrToIntDef(GetFirstEl(s, '/'), 0); +{$ELSE} + GetFirstEl(s, '/'); +{$ENDIF} + FFont.Color := StrToIntDef(GetFirstEl(s, '/'), 0); + FFont.Height := StrToIntDef(GetFirstEl(s, '/'), 0); + FFont.Name := DecodeString(GetFirstEl(s, '/')); + FFont.Pitch := TFontPitch(StrToIntDef(GetFirstEl(s, '/'), 0)); + FFont.PixelsPerInch := StrToIntDef(GetFirstEl(s, '/'), 0); + FFont.Size := StrToIntDef(GetFirstEl(s, '/'), 0); + byte(sty) := StrToIntDef(GetFirstEl(s, '/'), 0); + FFont.Style := sty; + FLineNumber := StrToIntDef(GetFirstEl(s, '/'), 0); + FAlignment := TAlignment(StrToIntDef(GetFirstEl(s, '/'), 0)); +end; + +procedure THeaderFooterItem.SetFont(const Value: TFont); +begin + FFont.Assign(Value); +end; + +{ THeaderFooter } + +constructor THeaderFooter.Create; +begin + inherited; + FFrameTypes := [ftLine]; + FShadedColor := clSilver; + FLineColor := clBlack; + FItems := TList.Create; + FDefaultFont := TFont.Create; + FOldPen := TPen.Create; + FOldBrush := TBrush.Create; + FOldFont := TFont.Create; + FRomanNumbers := False; + FMirrorPosition := False; + FLineInfo := TList.Create; + with FDefaultFont do + begin + Name := 'Arial'; + Size := 10; + Color := clBlack; + end; +end; + +destructor THeaderFooter.Destroy; +var + i: Integer; +begin + Clear; + FItems.Free; + FDefaultFont.Free; + FOldPen.Free; + FOldBrush.Free; + FOldFont.Free; + for i := 0 to FLineInfo.Count - 1 do + TLineInfo(FLineInfo[i]).Free; + FLineInfo.Free; + inherited; +end; + +function THeaderFooter.Add(Text: UnicodeString; Font: TFont; + Alignment: TAlignment; LineNumber: Integer): Integer; +var + AItem: THeaderFooterItem; +begin + AItem := THeaderFooterItem.Create; + if Font = nil then + AItem.Font := FDefaultFont + else + AItem.Font := Font; + AItem.Alignment := Alignment; + AItem.LineNumber := LineNumber; + AItem.FIndex := FItems.Add(AItem); + AItem.Text := Text; + Result := AItem.FIndex; +end; + +procedure THeaderFooter.Delete(Index: Integer); +var + i: Integer; +begin + for i := 0 to FItems.Count - 1 do + begin + if THeaderFooterItem(FItems[i]).FIndex = Index then + begin + FItems.Delete(i); + Break; + end; + end; +end; + +procedure THeaderFooter.Clear; +var + i: Integer; +begin + for i := 0 to FItems.Count - 1 do + THeaderFooterItem(FItems[i]).Free; + FItems.Clear; +end; + +procedure THeaderFooter.SetDefaultFont(const Value: TFont); +begin + FDefaultFont.Assign(Value); +end; + +{ Counts number of lines in header/footer and changes the line-number so they + start with 1 (the user might add header/footer items starting at line 2) } +procedure THeaderFooter.FixLines; +var + i, CurLine: Integer; + LineInfo: TLineInfo; +begin + for i := 0 to FLineInfo.Count - 1 do + TLineInfo(FLineInfo[i]).Free; + FLineInfo.Clear; + CurLine := 0; + FLineCount := 0; + for i := 0 to FItems.Count - 1 do + begin + if THeaderFooterItem(FItems[i]).LineNumber <> CurLine then + begin + CurLine := THeaderFooterItem(FItems[i]).LineNumber; + FLineCount := FLineCount + 1; + LineInfo := TLineInfo.Create; + FLineInfo.Add(LineInfo); + end; + THeaderFooterItem(FItems[i]).LineNumber := FLineCount; + end; +end; + +{ Calculates the hight of the header/footer, finds the line height for each line + and calculates the font baseline where text is to be written } +procedure THeaderFooter.CalcHeight(ACanvas: TCanvas); +var + i, CurLine: Integer; + AItem: THeaderFooterItem; + FOrgHeight: Integer; + TextMetric: TTextMetric; +begin + FFrameHeight := -1; + if FItems.Count <= 0 then Exit; + + CurLine := 1; + FFrameHeight := 0; + FOrgHeight := FFrameHeight; + for i := 0 to FItems.Count - 1 do + begin + AItem := THeaderFooterItem(FItems[i]); + if AItem.LineNumber <> CurLine then + begin + CurLine := AItem.LineNumber; + FOrgHeight := FFrameHeight; + end; + ACanvas.Font.Assign(AItem.Font); + GetTextMetrics(ACanvas.Handle, TextMetric); + with TLineInfo(FLineInfo[CurLine - 1]), TextMetric do + begin + LineHeight := Max(LineHeight, TextHeight(ACanvas, 'W')); + MaxBaseDist := Max(MaxBaseDist, tmHeight - tmDescent); + end; + FFrameHeight := Max(FFrameHeight, FOrgHeight + TextHeight(ACanvas, 'W')); + end; + FFrameHeight := FFrameHeight + 2 * FMargins.PHFInternalMargin; +end; + +function CompareItems(Item1, Item2: Pointer): Integer; +//Used to sort header/footer items +begin + Result := THeaderFooterItem(Item1).LineNumber - THeaderFooterItem(Item2).LineNumber; + if Result = 0 then + Result := Integer(Item1) - Integer(Item2); +end; + +procedure THeaderFooter.SetPixPrInch(Value: Integer); +var + i, TmpSize: Integer; + AFont: TFont; +begin + for i := 0 to FItems.Count - 1 do + begin + AFont := THeaderFooterItem(FItems[i]).Font; + TmpSize := AFont.Size; + AFont.PixelsPerInch := Value; + AFont.Size := TmpSize; + end; +end; + +procedure THeaderFooter.InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: UnicodeString; + Margins: TSynEditPrintMargins); +begin + SaveFontPenBrush(ACanvas); + FDate := DateToStr(Now); + FTime := TimeToStr(Now); + FNumPages := NumPages; + FMargins := Margins; + FTitle := Title; + FItems.Sort(CompareItems); + FixLines; + CalcHeight(ACanvas); + RestoreFontPenBrush(ACanvas); +end; + +procedure THeaderFooter.SaveFontPenBrush(ACanvas: TCanvas); +begin + FOldFont.Assign(ACanvas.Font); + FOldPen.Assign(ACanvas.Pen); + FOldBrush.Assign(ACanvas.Brush); +end; + +procedure THeaderFooter.RestoreFontPenBrush(ACanvas: TCanvas); +begin + ACanvas.Font.Assign(FOldFont); + ACanvas.Pen.Assign(FOldPen); + ACanvas.Brush.Assign(FOldBrush); +end; + +procedure THeaderFooter.DrawFrame(ACanvas: TCanvas); +//Draws frame around header/footer +begin + if (FrameTypes = []) then Exit; + with ACanvas, FMargins do begin + Pen.Color := LineColor; + Brush.Color := ShadedColor; + if ftShaded in FrameTypes then + Brush.Style := bsSolid + else + Brush.Style := bsClear; + if ftBox in FrameTypes then + Pen.Style := psSolid + else + Pen.Style := psClear; + if FrameTypes * [ftBox, ftShaded] <> [] then begin + if FType = hftHeader then + Rectangle(PLeft, PHeader - FFrameHeight, PRight, PHeader) + else + Rectangle(PLeft, PFooter, PRight, PFooter + FFrameHeight); + end; + if ftLine in FrameTypes then begin + Pen.Style := psSolid; + if FType = hftHeader then begin + MoveTo(PLeft, PHeader); + LineTo(PRight, PHeader); + end + else begin + MoveTo(PLeft, PFooter); + LineTo(PRight, PFooter); + end + end; + end; +end; + +procedure THeaderFooter.Print(ACanvas: TCanvas; PageNum: Integer); +var + i, X, Y, CurLine: Integer; + AStr: UnicodeString; + AItem: THeaderFooterItem; + OldAlign: UINT; + TheAlignment: TAlignment; +begin + if (FFrameHeight <= 0) then Exit; // No header/footer + SaveFontPenBrush(ACanvas); + DrawFrame(ACanvas); + ACanvas.Brush.Style := bsClear; + if FType = hftHeader then + Y := FMargins.PHeader - FFrameHeight + else + Y := FMargins.PFooter; + Y := Y + FMargins.PHFInternalMargin; // Add the specified internal margin + + CurLine := 1; + for i := 0 to FItems.Count - 1 do + begin + AItem := THeaderFooterItem(FItems[i]); + ACanvas.Font := AItem.Font; + if AItem.LineNumber <> CurLine then + begin + Y := Y + TLineInfo(FLineInfo[CurLine - 1]).LineHeight; + CurLine := AItem.LineNumber; + end; + AStr := AItem.GetText(FNumPages, PageNum, FRomanNumbers, FTitle, FTime, FDate); + //Find the alignment of the header/footer item - check for MirrorPosition + TheAlignment := AItem.Alignment; + if MirrorPosition and ((PageNum mod 2) = 0) then + begin + case AItem.Alignment of + taRightJustify: TheAlignment := taLeftJustify; + taLeftJustify: TheAlignment := taRightJustify; + end; + end; + //Find X-position of text + with FMargins do begin + X := PLeftHFTextIndent; + case TheAlignment of + taRightJustify: X := PRightHFTextIndent - TextWidth(ACanvas, AStr); + taCenter: X := (PLeftHFTextIndent + PRightHFTextIndent - TextWidth(ACanvas, AStr)) div 2; + end; + end; + {Aligning at base line - Fonts can have different size in headers and footers} + OldAlign := SetTextAlign(ACanvas.Handle, TA_BASELINE); + ExtTextOutW(ACanvas.Handle, X, Y + TLineInfo(FLineInfo[CurLine - 1]).MaxBaseDist, + 0, nil, PWideChar(AStr), Length(AStr), nil); + SetTextAlign(ACanvas.Handle, OldAlign); + end; + RestoreFontPenBrush(ACanvas); +end; + +procedure THeaderFooter.Assign(Source: TPersistent); +var + Src: THeaderFooter; + i: Integer; +begin + if (Source <> nil) and (Source is THeaderFooter) then begin + Src := THeaderFooter(Source); + Clear; + FType := Src.FType; + FFrameTypes := Src.FFrameTypes; + FShadedColor := Src.FShadedColor; + FLineColor := Src.FLineColor; + for i := 0 to Src.FItems.Count - 1 do begin + with THeaderFooterItem(Src.FItems[i]) do + Add(Text, Font, Alignment, LineNumber); + end; + FDefaultFont.Assign(Src.FDefaultFont); + FRomanNumbers := Src.FRomanNumbers; + FMirrorPosition := Src.FMirrorPosition; + end else + inherited Assign(Source); +end; + +function THeaderFooter.Count: Integer; +begin + Result := FItems.Count; +end; + +function THeaderFooter.Get(Index: Integer): THeaderFooterItem; +begin + Result := THeaderFooterItem(FItems[Index]); +end; + +function THeaderFooter.GetAsString: UnicodeString; +var + i: Integer; +begin + FixLines; + Result := ''; + for i := 0 to FItems.Count - 1 do begin + if Result <> '' then Result := Result + '/'; + Result := Result + EncodeString(THeaderFooterItem(FItems[i]).AsString); + end; //for +end; + +procedure THeaderFooter.SetAsString(const Value: UnicodeString); +var + item: THeaderFooterItem; + s: UnicodeString; +begin + Clear; + item := THeaderFooterItem.Create; + try + s := Value; + while s <> '' do + begin + item.AsString := DecodeString(GetFirstEl(s, '/')); + Add(item.Text, item.Font, item.Alignment, item.LineNumber); + end; + finally + item.Free; + end; +end; + +procedure THeaderFooter.LoadFromStream(AStream: TStream); +var + Num, i: Integer; + aCharset: TFontCharset; + aColor: TColor; + aHeight: Integer; + aName: TFontName; + aPitch: TFontPitch; + aSize: Integer; + aStyle: TFontStyles; + bufSize: Integer; + buffer: PAnsiChar; +begin + with AStream do begin + // read header/footer properties first + Read(FFrameTypes, SizeOf(FFrameTypes)); + Read(FShadedColor, SizeOf(FShadedColor)); + Read(FLineColor, SizeOf(FLineColor)); + Read(FRomanNumbers, SizeOf(FRomanNumbers)); + Read(FMirrorPosition, SizeOf(FMirrorPosition)); + // font + Read(aCharset, SizeOf(aCharset)); + Read(aColor, SizeOf(aColor)); + Read(aHeight, SizeOf(aHeight)); + Read(bufSize, SizeOf(bufSize)); + GetMem(buffer, bufSize+1); + try + Read(buffer^, bufSize); + buffer[bufSize] := #0; + aName := string(buffer); + finally + FreeMem(buffer); + end; + Read(aPitch, SizeOf(aPitch)); + Read(aSize, SizeOf(aSize)); + Read(aStyle, SizeOf(aStyle)); + {$IFDEF SYN_COMPILER_3_UP} + FDefaultFont.Charset := aCharset; + {$ENDIF} + FDefaultFont.Color := aColor; + FDefaultFont.Height := aHeight; + FDefaultFont.Name := aName; + FDefaultFont.Pitch := aPitch; + FDefaultFont.Size := aSize; + FDefaultFont.Style := aStyle; + // now read in the items + Read(Num, SizeOf(Num)); + while Num > 0 do + begin + // load headerfooter items from stream + i := Add('', nil, taLeftJustify, 1); + Get(i).LoadFromStream(AStream); + Dec(Num); + end; + end; +end; + +procedure THeaderFooter.SaveToStream(AStream: TStream); +var + i, Num: Integer; + aCharset: TFontCharset; + aColor: TColor; + aHeight: Integer; + aName: TFontName; + aPitch: TFontPitch; + aSize: Integer; + aStyle: TFontStyles; + aLen : Integer; +begin + with AStream do begin + // write the header/footer properties first + Write(FFrameTypes, SizeOf(FFrameTypes)); + Write(FShadedColor, SizeOf(FShadedColor)); + Write(FLineColor, SizeOf(FLineColor)); + Write(FRomanNumbers, SizeOf(FRomanNumbers)); + Write(FMirrorPosition, SizeOf(FMirrorPosition)); + // font + {$IFDEF SYN_COMPILER_3_UP} + aCharset := FDefaultFont.Charset; + {$ELSE} + aCharSet := DEFAULT_CHARSET; + {$ENDIF} + aColor := FDefaultFont.Color; + aHeight := FDefaultFont.Height; + aName := FDefaultFont.Name; + aPitch := FDefaultFont.Pitch; + aSize := FDefaultFont.Size; + aStyle := FDefaultFont.Style; + Write(aCharset, SizeOf(aCharset)); + Write(aColor, SizeOf(aColor)); + Write(aHeight, SizeOf(aHeight)); + aLen := Length(aName); + Write(aLen, SizeOf(aLen)); + {$IFDEF SYN_COMPILER_2} // In D2 TFontName is a ShortString + Write(PAnsiChar(@aName[1])^, Length(aName)); // D2 cannot convert ShortStrings to PAnsiChar + {$ELSE} + Write(PAnsiChar(AnsiString(aName))^, Length(aName)); + {$ENDIF} + Write(aPitch, SizeOf(aPitch)); + Write(aSize, SizeOf(aSize)); + Write(aStyle, SizeOf(aStyle)); + + // now write the items + Num := Count; + Write(Num, SizeOf(Num)); + for i := 0 to Num - 1 do + Get(i).SaveToStream(AStream); + end; +end; + +{ THeader } + +constructor THeader.Create; +begin + inherited; + FType := hftHeader; +end; + +{ TFooter } + +constructor TFooter.Create; +begin + inherited; + FType := hftFooter; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPrintMargins.pas b/Source/VCL/SynEdit/Source/SynEditPrintMargins.pas index 378f3d42..73bf4f73 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintMargins.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrintMargins.pas @@ -1,430 +1,432 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrintMargins.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrintMargins.pas,v 1.5.2.2 2006/05/21 11:59:34 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Class handling all sizes involded when printing. - - Design-time properties - UnitSystem : The units used to specify sizes in. Internally is allways used mm. - Left : Distance from left edge of paper to text. - Right : Distance from right edge of paper to text. - Top : Distance from top edge of paper to top of text. - Bottom : Distance from bottom edge of paper to bottom of text. - Gutter : Binding gutter - added to right margin (or left if 2-sided) - Header : Distance from top edge of paper to line below header. - Footer : Distance from bottom edge of paper to line above footer. - LeftHFTextIndent : Distance from left margin to first left-aligned character - in header or footer - RightHFTextIndent : Distance from right margin to last right-aligned character - in header or footer - HFInternalMargin : Internal margin between top-line and text in header and - footer AND between bottom-line and text in header and - footer. - MirrorMargins : Set if margins should be mirrored (i.e. when printing - 2-sided). - - Run-time properties - PLeft : Left position of text in device units (pixels) - this is the left - margin minus the left unprintable distance (+ gutter). - PRight : Right position of text in device units (pixels) - calculated form - left. - PTop : Top position of text in device units (pixels) - this is the top - margin minus the top unprintable distance. - PBottom : Bottom position of text in device units (pixels) - calculated form - top. - PGutter : Binding gutter in device units (pixels) - PHeader : Header in device units (pixels) - PFooter : Footer in device units (pixels) - calculated from top - PLeftHFTextIndent : Left position of text in header and footer in device - units (pixels). Calculated as Left margin + LeftHFTextIndent - PRightHFTextIndent : Right position of text in header and footer in device - units (pixels). Calculated from left - PHFInternalMargin : Internal margin in device units (pixels). - - Run-time methods - InitPage : Called by TSynEditPrint class to initialize margins. - Assign : Assign values from another TSynEditPrintMargins object. - --------------------------------------------------------------------------------} - -unit SynEditPrintMargins; -{$M+} - -{$I SynEdit.inc } - -interface - -uses - Graphics, - SynEditPrintTypes, - SynEditPrinterInfo, - SynUnicode, - Classes, - SysUtils; - -type - //Margins class - sorting out dimensions of printable area - TSynEditPrintMargins = class(TPersistent) - private - FLeft, // Distance from left edge of paper to text - FRight, // Distance from right edge of paper to text - FTop, // Distance from top edge of paper to top of text - FBottom: Double; // Distance from bottom edge of paper to bottom of text - FHeader, // Distance from top edge of paper to line below header - FFooter: Double; // Distance from bottom edge of paper to line above footer - FLeftHFTextIndent: Double; // Distance from left margin to first left-aligned character - // in header or footer - FRightHFTextIndent: Double; // Distance from right margin to last right-aligned character - // in header or footer - FHFInternalMargin: Double; // Internal margin between top-line and text in header and - // footer AND between bottom-line and text in header and - // footer - FGutter: Double; // Binding gutter - added to right margin (or left if 2-sided) - FMirrorMargins: Boolean; // Set if margins should be mirrored (i.e. when printing - // 2-sided) - FUnitSystem: TUnitSystem; // The units used to specify sizes in. - // Internally is allways used mm - function ConvertTo(Value: Double): Double; - function ConvertFrom(Value: Double): Double; - function GetBottom: Double; - function GetFooter: Double; - function GetGutter: Double; - function GetHeader: Double; - function GetLeft: Double; - function GetRight: Double; - function GetTop: Double; - function GetLeftHFTextIndent: Double; - function GetRightHFTextIndent: Double; - function GetHFInternalMargin: Double; - procedure SetBottom(const Value: Double); - procedure SetFooter(const Value: Double); - procedure SetGutter(const Value: Double); - procedure SetHeader(const Value: Double); - procedure SetLeft(const Value: Double); - procedure SetRight(const Value: Double); - procedure SetTop(const Value: Double); - procedure SetLeftHFTextIndent(const Value: Double); - procedure SetRightHFTextIndent(const Value: Double); - procedure SetHFInternalMargin(const Value: Double); - public - { When initpage has been called, the following values will reflect the - margins in paper units. Note that all values are calculated from - left or top of paper (i.e. PRight is distance from left margin) } - - PLeft, // Left position of text in device units (pixels) - this is the left - // margin minus the left unprintable distance (+ gutter) - PRight, // Right position of text in device units (pixels) - calculated form - // left - PTop, // Top position of text in device units (pixels) - this is the top - // margin minus the top unprintable distance - PBottom: Integer; // Bottom position of text in device units (pixels) - - // calculated form top - PHeader, // Header in device units (pixels) - PFooter: Integer; // Footer in device units (pixels) - calculated from top - PLeftHFTextIndent: Integer; // Left position of text in header and footer in device - // units (pixels). Calculated as Left margin + LeftHFTextIndent - PRightHFTextIndent: Integer; // Right position of text in header and footer in device - // units (pixels). Calculated from left - PHFInternalMargin: Integer; // Internal margin in device units (pixels) - PGutter: Integer; // Binding gutter in device units (pixels) - constructor Create; - procedure InitPage(ACanvas: TCanvas; PageNum: Integer; - PrinterInfo: TSynEditPrinterInfo; LineNumbers, - LineNumbersInMargin: Boolean; MaxLineNum: Integer); - procedure Assign(Source: TPersistent); override; - procedure LoadFromStream(AStream: TStream); - procedure SaveToStream(AStream: TStream); - published - property UnitSystem: TUnitSystem read FUnitSystem write FUnitSystem - default usMM; - property Left: Double read GetLeft write SetLeft; - property Right: Double read GetRight write SetRight; - property Top: Double read GetTop write SetTop; - property Bottom: Double read GetBottom write SetBottom; - property Header: Double read GetHeader write SetHeader; - property Footer: Double read GetFooter write SetFooter; - property LeftHFTextIndent: Double read GetLeftHFTextIndent - write SetLeftHFTextIndent; - property RightHFTextIndent: Double read GetRightHFTextIndent - write SetRightHFTextIndent; - property HFInternalMargin: Double read GetHFInternalMargin - write SetHFInternalMargin; - property Gutter: Double read GetGutter write SetGutter; - property MirrorMargins: Boolean read FMirrorMargins write FMirrorMargins; - end; - -implementation - -{ TSynEditPrintMargins } -const - mmPrInch = 25.4; - mmPrCm = 10; - -constructor TSynEditPrintMargins.Create; -begin - inherited; - FUnitSystem := usMM; - FLeft := DefLeft; - FRight := DefRight; - FTop := DefTop; - FBottom := DefBottom; - FHeader := DefHeader; - FFooter := DefFooter; - FLeftHFTextIndent := DefLeftHFTextIndent; - FRightHFTextIndent := DefRightHFTextIndent; - FHFInternalMargin := DefHFInternalMargin; - FGutter := DefGutter; - FMirrorMargins := False; -end; - -function TSynEditPrintMargins.ConvertTo(Value: Double): Double; -{Convert Value to mm} -begin - case FUnitSystem of - usCM: Result := Value * mmPrCm; - usInch: Result := Value * mmPrInch; - muThousandthsOfInches: Result := mmPrInch * Value / 1000; - else - Result := Value; - end; -end; - -function TSynEditPrintMargins.ConvertFrom(Value: Double): Double; -{Convert from mm to selected UnitSystem} -begin - case FUnitSystem of - usCM: Result := Value / mmPrCm; - usInch: Result := Value / mmPrInch; - muThousandthsOfInches: Result := 1000 * Value / mmPrInch; - else - Result := Value; - end; -end; - -function TSynEditPrintMargins.GetBottom: Double; -begin - Result := ConvertFrom(FBottom); -end; - -function TSynEditPrintMargins.GetFooter: Double; -begin - Result := ConvertFrom(FFooter); -end; - -function TSynEditPrintMargins.GetGutter: Double; -begin - Result := ConvertFrom(FGutter); -end; - -function TSynEditPrintMargins.GetHeader: Double; -begin - Result := ConvertFrom(FHeader); -end; - -function TSynEditPrintMargins.GetLeft: Double; -begin - Result := ConvertFrom(FLeft); -end; - -function TSynEditPrintMargins.GetRight: Double; -begin - Result := ConvertFrom(FRight); -end; - -function TSynEditPrintMargins.GetTop: Double; -begin - Result := ConvertFrom(FTop); -end; - -function TSynEditPrintMargins.GetLeftHFTextIndent: Double; -begin - Result := ConvertFrom(FLeftHFTextIndent); -end; - -function TSynEditPrintMargins.GetRightHFTextIndent: Double; -begin - Result := ConvertFrom(FRightHFTextIndent); -end; - -function TSynEditPrintMargins.GetHFInternalMargin: Double; -begin - Result := ConvertFrom(FHFInternalMargin); -end; - -procedure TSynEditPrintMargins.SetBottom(const Value: Double); -begin - FBottom := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetFooter(const Value: Double); -begin - FFooter := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetGutter(const Value: Double); -begin - FGutter := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetHeader(const Value: Double); -begin - FHeader := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetLeft(const Value: Double); -begin - FLeft := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetRight(const Value: Double); -begin - FRight := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetTop(const Value: Double); -begin - FTop := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetLeftHFTextIndent(const Value: Double); -begin - FLeftHFTextIndent := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetRightHFTextIndent(const Value: Double); -begin - FRightHFTextIndent := ConvertTo(Value); -end; - -procedure TSynEditPrintMargins.SetHFInternalMargin(const Value: Double); -begin - FHFInternalMargin := ConvertTo(Value); -end; - -// ----------------------------------------------------------------------------- -// Called by TSynEditPrint class to initialize margins -procedure TSynEditPrintMargins.InitPage(ACanvas: TCanvas; PageNum: Integer; - PrinterInfo: TSynEditPrinterInfo; LineNumbers, LineNumbersInMargin: Boolean; - MaxLineNum: Integer); -//Calculate the P... values -begin - if FMirrorMargins and ((PageNum mod 2) = 0) then - begin - PLeft := PrinterInfo.PixFromLeft(FRight); - PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FLeft + FGutter); - end - else begin - PLeft := PrinterInfo.PixFromLeft(FLeft + FGutter); - PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FRight); - end; - if LineNumbers and (not LineNumbersInMargin) then - PLeft := PLeft + ACanvas.TextWidth(IntToStr(MaxLineNum) + ': '); - PTop := PrinterInfo.PixFromTop(FTop); - PBottom := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FBottom); - PHeader := PrinterInfo.PixFromTop(FHeader); - PFooter := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FFooter); - PHFInternalMargin := Round(PrinterInfo.YPixPrmm * FHFInternalMargin); - PGutter := Round(PrinterInfo.XPixPrmm * FGutter); - PRightHFTextIndent := PRight - Round(PrinterInfo.XPixPrmm * FRightHFTextIndent); - PLeftHFTextIndent := PLeft + Round(PrinterInfo.XPixPrmm * FLeftHFTextIndent); -end; - -// ----------------------------------------------------------------------------- -// Assign values from another TSynEditPrintMargins object -procedure TSynEditPrintMargins.Assign(Source: TPersistent); -var - Src: TSynEditPrintMargins; -begin - if (Source <> nil) and (Source is TSynEditPrintMargins) then begin - Src := TSynEditPrintMargins(Source); - FLeft := Src.FLeft; - FRight := Src.FRight; - FTop := Src.FTop; - FBottom := Src.FBottom; - FHeader := Src.FHeader; - FFooter := Src.FFooter; - FLeftHFTextIndent := Src.FLeftHFTextIndent; - FRightHFTextIndent := Src.FRightHFTextIndent; - FHFInternalMargin := Src.FHFInternalMargin; - FGutter := Src.FGutter; - FMirrorMargins := Src.FMirrorMargins; - FUnitSystem := Src.FUnitSystem; - end else - inherited; -end; - -procedure TSynEditPrintMargins.LoadFromStream(AStream: TStream); -begin - // we read all our values in MM - with AStream do begin - Read(FUnitSystem, SizeOf(FUnitSystem)); - Read(FLeft, SizeOf(FLeft)); - Read(FRight, SizeOf(FRight)); - Read(FTop, SizeOf(FTop)); - Read(FBottom, SizeOf(FBottom)); - Read(FHeader, SizeOf(FHeader)); - Read(FFooter, SizeOf(FFooter)); - Read(FLeftHFTextIndent, SizeOf(FLeftHFTextIndent)); - Read(FRightHFTextIndent, SizeOf(FRightHFTextIndent)); - Read(FHFInternalMargin, SizeOf(FHFInternalMargin)); - Read(FGutter, SizeOf(FGutter)); - Read(FMirrorMargins, SizeOf(FMirrorMargins)); - end; -end; - -procedure TSynEditPrintMargins.SaveToStream(AStream: TStream); -begin - // we always write our values in MM - with AStream do begin - Write(FUnitSystem, SizeOf(FUnitSystem)); - Write(FLeft, SizeOf(FLeft)); - Write(FRight, SizeOf(FRight)); - Write(FTop, SizeOf(FTop)); - Write(FBottom, SizeOf(FBottom)); - Write(FHeader, SizeOf(FHeader)); - Write(FFooter, SizeOf(FFooter)); - Write(FLeftHFTextIndent, SizeOf(FLeftHFTextIndent)); - Write(FRightHFTextIndent, SizeOf(FRightHFTextIndent)); - Write(FHFInternalMargin, SizeOf(FHFInternalMargin)); - Write(FGutter, SizeOf(FGutter)); - Write(FMirrorMargins, SizeOf(FMirrorMargins)); - end; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrintMargins.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrintMargins.pas,v 1.5.2.2 2006/05/21 11:59:34 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Class handling all sizes involded when printing. + + Design-time properties + UnitSystem : The units used to specify sizes in. Internally is allways used mm. + Left : Distance from left edge of paper to text. + Right : Distance from right edge of paper to text. + Top : Distance from top edge of paper to top of text. + Bottom : Distance from bottom edge of paper to bottom of text. + Gutter : Binding gutter - added to right margin (or left if 2-sided) + Header : Distance from top edge of paper to line below header. + Footer : Distance from bottom edge of paper to line above footer. + LeftHFTextIndent : Distance from left margin to first left-aligned character + in header or footer + RightHFTextIndent : Distance from right margin to last right-aligned character + in header or footer + HFInternalMargin : Internal margin between top-line and text in header and + footer AND between bottom-line and text in header and + footer. + MirrorMargins : Set if margins should be mirrored (i.e. when printing + 2-sided). + + Run-time properties + PLeft : Left position of text in device units (pixels) - this is the left + margin minus the left unprintable distance (+ gutter). + PRight : Right position of text in device units (pixels) - calculated form + left. + PTop : Top position of text in device units (pixels) - this is the top + margin minus the top unprintable distance. + PBottom : Bottom position of text in device units (pixels) - calculated form + top. + PGutter : Binding gutter in device units (pixels) + PHeader : Header in device units (pixels) + PFooter : Footer in device units (pixels) - calculated from top + PLeftHFTextIndent : Left position of text in header and footer in device + units (pixels). Calculated as Left margin + LeftHFTextIndent + PRightHFTextIndent : Right position of text in header and footer in device + units (pixels). Calculated from left + PHFInternalMargin : Internal margin in device units (pixels). + + Run-time methods + InitPage : Called by TSynEditPrint class to initialize margins. + Assign : Assign values from another TSynEditPrintMargins object. + +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINTMARGINS} +unit SynEditPrintMargins; +{$ENDIF} +{$M+} + +{$I SynEdit.inc } + +interface + +uses + Graphics, + SynEditPrintTypes, + SynEditPrinterInfo, + SynUnicode, + Classes, + SysUtils; + +type + //Margins class - sorting out dimensions of printable area + TSynEditPrintMargins = class(TPersistent) + private + FLeft, // Distance from left edge of paper to text + FRight, // Distance from right edge of paper to text + FTop, // Distance from top edge of paper to top of text + FBottom: Double; // Distance from bottom edge of paper to bottom of text + FHeader, // Distance from top edge of paper to line below header + FFooter: Double; // Distance from bottom edge of paper to line above footer + FLeftHFTextIndent: Double; // Distance from left margin to first left-aligned character + // in header or footer + FRightHFTextIndent: Double; // Distance from right margin to last right-aligned character + // in header or footer + FHFInternalMargin: Double; // Internal margin between top-line and text in header and + // footer AND between bottom-line and text in header and + // footer + FGutter: Double; // Binding gutter - added to right margin (or left if 2-sided) + FMirrorMargins: Boolean; // Set if margins should be mirrored (i.e. when printing + // 2-sided) + FUnitSystem: TUnitSystem; // The units used to specify sizes in. + // Internally is allways used mm + function ConvertTo(Value: Double): Double; + function ConvertFrom(Value: Double): Double; + function GetBottom: Double; + function GetFooter: Double; + function GetGutter: Double; + function GetHeader: Double; + function GetLeft: Double; + function GetRight: Double; + function GetTop: Double; + function GetLeftHFTextIndent: Double; + function GetRightHFTextIndent: Double; + function GetHFInternalMargin: Double; + procedure SetBottom(const Value: Double); + procedure SetFooter(const Value: Double); + procedure SetGutter(const Value: Double); + procedure SetHeader(const Value: Double); + procedure SetLeft(const Value: Double); + procedure SetRight(const Value: Double); + procedure SetTop(const Value: Double); + procedure SetLeftHFTextIndent(const Value: Double); + procedure SetRightHFTextIndent(const Value: Double); + procedure SetHFInternalMargin(const Value: Double); + public + { When initpage has been called, the following values will reflect the + margins in paper units. Note that all values are calculated from + left or top of paper (i.e. PRight is distance from left margin) } + + PLeft, // Left position of text in device units (pixels) - this is the left + // margin minus the left unprintable distance (+ gutter) + PRight, // Right position of text in device units (pixels) - calculated form + // left + PTop, // Top position of text in device units (pixels) - this is the top + // margin minus the top unprintable distance + PBottom: Integer; // Bottom position of text in device units (pixels) - + // calculated form top + PHeader, // Header in device units (pixels) + PFooter: Integer; // Footer in device units (pixels) - calculated from top + PLeftHFTextIndent: Integer; // Left position of text in header and footer in device + // units (pixels). Calculated as Left margin + LeftHFTextIndent + PRightHFTextIndent: Integer; // Right position of text in header and footer in device + // units (pixels). Calculated from left + PHFInternalMargin: Integer; // Internal margin in device units (pixels) + PGutter: Integer; // Binding gutter in device units (pixels) + constructor Create; + procedure InitPage(ACanvas: TCanvas; PageNum: Integer; + PrinterInfo: TSynEditPrinterInfo; LineNumbers, + LineNumbersInMargin: Boolean; MaxLineNum: Integer); + procedure Assign(Source: TPersistent); override; + procedure LoadFromStream(AStream: TStream); + procedure SaveToStream(AStream: TStream); + published + property UnitSystem: TUnitSystem read FUnitSystem write FUnitSystem + default usMM; + property Left: Double read GetLeft write SetLeft; + property Right: Double read GetRight write SetRight; + property Top: Double read GetTop write SetTop; + property Bottom: Double read GetBottom write SetBottom; + property Header: Double read GetHeader write SetHeader; + property Footer: Double read GetFooter write SetFooter; + property LeftHFTextIndent: Double read GetLeftHFTextIndent + write SetLeftHFTextIndent; + property RightHFTextIndent: Double read GetRightHFTextIndent + write SetRightHFTextIndent; + property HFInternalMargin: Double read GetHFInternalMargin + write SetHFInternalMargin; + property Gutter: Double read GetGutter write SetGutter; + property MirrorMargins: Boolean read FMirrorMargins write FMirrorMargins; + end; + +implementation + +{ TSynEditPrintMargins } +const + mmPrInch = 25.4; + mmPrCm = 10; + +constructor TSynEditPrintMargins.Create; +begin + inherited; + FUnitSystem := usMM; + FLeft := DefLeft; + FRight := DefRight; + FTop := DefTop; + FBottom := DefBottom; + FHeader := DefHeader; + FFooter := DefFooter; + FLeftHFTextIndent := DefLeftHFTextIndent; + FRightHFTextIndent := DefRightHFTextIndent; + FHFInternalMargin := DefHFInternalMargin; + FGutter := DefGutter; + FMirrorMargins := False; +end; + +function TSynEditPrintMargins.ConvertTo(Value: Double): Double; +{Convert Value to mm} +begin + case FUnitSystem of + usCM: Result := Value * mmPrCm; + usInch: Result := Value * mmPrInch; + muThousandthsOfInches: Result := mmPrInch * Value / 1000; + else + Result := Value; + end; +end; + +function TSynEditPrintMargins.ConvertFrom(Value: Double): Double; +{Convert from mm to selected UnitSystem} +begin + case FUnitSystem of + usCM: Result := Value / mmPrCm; + usInch: Result := Value / mmPrInch; + muThousandthsOfInches: Result := 1000 * Value / mmPrInch; + else + Result := Value; + end; +end; + +function TSynEditPrintMargins.GetBottom: Double; +begin + Result := ConvertFrom(FBottom); +end; + +function TSynEditPrintMargins.GetFooter: Double; +begin + Result := ConvertFrom(FFooter); +end; + +function TSynEditPrintMargins.GetGutter: Double; +begin + Result := ConvertFrom(FGutter); +end; + +function TSynEditPrintMargins.GetHeader: Double; +begin + Result := ConvertFrom(FHeader); +end; + +function TSynEditPrintMargins.GetLeft: Double; +begin + Result := ConvertFrom(FLeft); +end; + +function TSynEditPrintMargins.GetRight: Double; +begin + Result := ConvertFrom(FRight); +end; + +function TSynEditPrintMargins.GetTop: Double; +begin + Result := ConvertFrom(FTop); +end; + +function TSynEditPrintMargins.GetLeftHFTextIndent: Double; +begin + Result := ConvertFrom(FLeftHFTextIndent); +end; + +function TSynEditPrintMargins.GetRightHFTextIndent: Double; +begin + Result := ConvertFrom(FRightHFTextIndent); +end; + +function TSynEditPrintMargins.GetHFInternalMargin: Double; +begin + Result := ConvertFrom(FHFInternalMargin); +end; + +procedure TSynEditPrintMargins.SetBottom(const Value: Double); +begin + FBottom := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetFooter(const Value: Double); +begin + FFooter := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetGutter(const Value: Double); +begin + FGutter := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetHeader(const Value: Double); +begin + FHeader := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetLeft(const Value: Double); +begin + FLeft := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetRight(const Value: Double); +begin + FRight := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetTop(const Value: Double); +begin + FTop := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetLeftHFTextIndent(const Value: Double); +begin + FLeftHFTextIndent := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetRightHFTextIndent(const Value: Double); +begin + FRightHFTextIndent := ConvertTo(Value); +end; + +procedure TSynEditPrintMargins.SetHFInternalMargin(const Value: Double); +begin + FHFInternalMargin := ConvertTo(Value); +end; + +// ----------------------------------------------------------------------------- +// Called by TSynEditPrint class to initialize margins +procedure TSynEditPrintMargins.InitPage(ACanvas: TCanvas; PageNum: Integer; + PrinterInfo: TSynEditPrinterInfo; LineNumbers, LineNumbersInMargin: Boolean; + MaxLineNum: Integer); +//Calculate the P... values +begin + if FMirrorMargins and ((PageNum mod 2) = 0) then + begin + PLeft := PrinterInfo.PixFromLeft(FRight); + PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FLeft + FGutter); + end + else begin + PLeft := PrinterInfo.PixFromLeft(FLeft + FGutter); + PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FRight); + end; + if LineNumbers and (not LineNumbersInMargin) then + PLeft := PLeft + TextWidth(ACanvas, IntToStr(MaxLineNum) + ': '); + PTop := PrinterInfo.PixFromTop(FTop); + PBottom := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FBottom); + PHeader := PrinterInfo.PixFromTop(FHeader); + PFooter := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FFooter); + PHFInternalMargin := Round(PrinterInfo.YPixPrmm * FHFInternalMargin); + PGutter := Round(PrinterInfo.XPixPrmm * FGutter); + PRightHFTextIndent := PRight - Round(PrinterInfo.XPixPrmm * FRightHFTextIndent); + PLeftHFTextIndent := PLeft + Round(PrinterInfo.XPixPrmm * FLeftHFTextIndent); +end; + +// ----------------------------------------------------------------------------- +// Assign values from another TSynEditPrintMargins object +procedure TSynEditPrintMargins.Assign(Source: TPersistent); +var + Src: TSynEditPrintMargins; +begin + if (Source <> nil) and (Source is TSynEditPrintMargins) then begin + Src := TSynEditPrintMargins(Source); + FLeft := Src.FLeft; + FRight := Src.FRight; + FTop := Src.FTop; + FBottom := Src.FBottom; + FHeader := Src.FHeader; + FFooter := Src.FFooter; + FLeftHFTextIndent := Src.FLeftHFTextIndent; + FRightHFTextIndent := Src.FRightHFTextIndent; + FHFInternalMargin := Src.FHFInternalMargin; + FGutter := Src.FGutter; + FMirrorMargins := Src.FMirrorMargins; + FUnitSystem := Src.FUnitSystem; + end else + inherited; +end; + +procedure TSynEditPrintMargins.LoadFromStream(AStream: TStream); +begin + // we read all our values in MM + with AStream do begin + Read(FUnitSystem, SizeOf(FUnitSystem)); + Read(FLeft, SizeOf(FLeft)); + Read(FRight, SizeOf(FRight)); + Read(FTop, SizeOf(FTop)); + Read(FBottom, SizeOf(FBottom)); + Read(FHeader, SizeOf(FHeader)); + Read(FFooter, SizeOf(FFooter)); + Read(FLeftHFTextIndent, SizeOf(FLeftHFTextIndent)); + Read(FRightHFTextIndent, SizeOf(FRightHFTextIndent)); + Read(FHFInternalMargin, SizeOf(FHFInternalMargin)); + Read(FGutter, SizeOf(FGutter)); + Read(FMirrorMargins, SizeOf(FMirrorMargins)); + end; +end; + +procedure TSynEditPrintMargins.SaveToStream(AStream: TStream); +begin + // we always write our values in MM + with AStream do begin + Write(FUnitSystem, SizeOf(FUnitSystem)); + Write(FLeft, SizeOf(FLeft)); + Write(FRight, SizeOf(FRight)); + Write(FTop, SizeOf(FTop)); + Write(FBottom, SizeOf(FBottom)); + Write(FHeader, SizeOf(FHeader)); + Write(FFooter, SizeOf(FFooter)); + Write(FLeftHFTextIndent, SizeOf(FLeftHFTextIndent)); + Write(FRightHFTextIndent, SizeOf(FRightHFTextIndent)); + Write(FHFInternalMargin, SizeOf(FHFInternalMargin)); + Write(FGutter, SizeOf(FGutter)); + Write(FMirrorMargins, SizeOf(FMirrorMargins)); + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.dfm b/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.dfm index 2e22ea82..2e79cb0b 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.dfm +++ b/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.dfm @@ -1,1240 +1,1241 @@ -object SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg - Left = 244 - Top = 189 - ActiveControl = CBUnits - BorderStyle = bsDialog - Caption = 'Margins' - ClientHeight = 344 - ClientWidth = 506 - ParentFont = True - Position = poScreenCenter - OnCreate = FormCreate - OnDestroy = FormDestroy - PixelsPerInch = 96 - TextHeight = 13 - object Image1: TImage - Left = 275 - Top = 10 - Width = 223 - Height = 292 - AutoSize = True - Picture.Data = { - 07544269746D617036800000424D36800000000000007600000028000000DF00 - 0000240100000100040000000000C07F00000000000000000000100000001000 - 0000000000000000800000800000008080008000000080008000808000008080 - 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0F00FF0FF0FF0F - F0F0000F0FFFF00F000F0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FF0FF000FF0F0FF0FF0FF0F0FF0F0FFFF0F0FFFFF00F0FFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF000FF0F0FF0FF0F - F0FF000F0FFFF0F0000FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FF0F0F00FF0F0FF0FF0FF0FFFF0F0FFFF0F0FF0FF00F0FFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00FF0F00FF00000000 - 0FF0000F0FFF000F00FF0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FF00FF0FFFFFFFFFFFFFFFFFFFFF0FFFF0FFFFFFFFFF0FFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0FFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF00000000000000000000000000000000000000000000000000000 - 000000000000000000000000000000000000000000000000000000000000FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000F - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF00000F - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF0000FF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFF99FF9FF9FF99F99FF9F - F9FF99F99FF90F9FF99F99F99FF9FF99F99F99FF9FF900000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFF99F99FF9FF9FF99F99FF9FF9FF99F99099FF9FF99F99F99FF9F - F99F99F99FF9FF9FF99F99FF9FF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFF0FF - F0FF000F0000FF000FF000F0FFFF00FF000F0FF000FFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FFF0F0FFFF0FF0F0FF0F0FFFF0FFFF0FF0 - FFFFF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF - F0F0000FF000F0FF0F0000F0FFFF0FF0000FF00F0FFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFFFF00000F0FF0FFFF0F0FF0F0FF0F0FFFF0FF0 - FF0FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FF - F0FF00FF0000FF000FF00FF000F000FF00FF0FF000FFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF9F0FFF0FFFFFFFFFFFFFF0FFFFFFFFFFF0FFF - FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00000 - 00FF000FF000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFF0000F - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF - F0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFF0FFF0F0FFF0FF0F0FF0F0FFFF0FFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0000F0 - 00F0FF0F0000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0FFFFFFFFFF000000 - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFF00000F0FF0FFF0F0FF0F0FF0F0FFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFF0FFFFFFFFFF000000FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00F00 - 00FF000FF00FF000FFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFF0000000 - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFF - FFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFF00000FFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFF0FFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF - FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 000000000000000000000000000000000000000000000000000000000000FFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000000FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF00F0FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFF9FFFFFFFFFFFFFFF9FFFF - FFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - F0000000FFFFFFFFFFFFFFFFFFF9FFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFF00000 - 000000F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - F00000000FF9FFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFF9FFFFFFFFFFFFFFF9FFFF - F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000F000FF000FF0FFF0F0FFFFFF0F - FF000F0FF000FF0F0FF0FF000FF000F0FF0F00FFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF - FF0FFF0FFFFF00FFF0FFF0F0FFFFFF0FF0FFFFF00F0FFF0F0FF0F0FF0F0FFFF0 - FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFF0FFF0000FF00FFF0FFF0F0FFFFFF0F - F0000FF00F0FFF0F0FF0F0FF0F0000F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FF0FFF0FF0FF00FFF00000F000FFFF0FF0FF0FF00F0FFF0F0FF0F0FF0F0FF0F0 - FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFF0FFFF00FF0000FF0FFF0F0FFFFFF0F - FF00FF0FF000FF0F000FFF000FF00FF000F000FFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF - FF0FFFFFFFFF00FFF0FFF0F0FFFFFF0FFFFFFFFFFF0FFF0FFFFFFFFF0FFFFFFF - FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0FFF0F0000F0000 - 0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF000F0FFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFF0F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 - 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF - FFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF - 000F0FF000FF000FF000FFFF000FF0FF0F0FF0F000F0FF0FF000FFFFF0F0FF0F - 00F0FF0FFF0FF0FF0F0F0FF0FFF00FF0FFF000FF000FFFF0FF0FF00000F0FFF0 - 00F0F0FF0F000FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00F0FF0F0FFFF0FF0FFFF0FF0F0FF - 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 - FF0FFFF0FF0FFFF0FF0FF00FF0F0FF0FF0F0F0FF0FFFF0FFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00F - F00F0F0FF0F0000F0FF0FFFF0FF0F0FF0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F - 0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0FF0000F0FF0FFFF0FF0FF0F000F0FF0F - F0F0F0FF0FF00FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FFF0F0FF0F0FF0F0FF0FFFF0FF0F0FF - 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 - FF0FF0F0FF0FFFF0FF0FF0FFF0F0FF0FF0F0F0FF0F0FFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - F0000FF000FF00FFF000FFFF000FF0000F000F0000F000FFF000FFFF0F0F0F00 - 00F000FFFF000000FF0F000000F00FF000F00FFF000FFFF000000F0000F000F0 - 00F0F000FFF000FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFF - FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF - FFFF0FFFF0FFFFFFFFF0FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFF0F - FFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000090000000000000000 - 000000000000000000000000000000000000000000000000000000000000FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFF000FFF00FF0000FF00FF0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0 - FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFF000FFF00FF00F00F00FF0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0000F0FF0F0F0FF0FF0F0FF0 - FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFF0FF0FF00F00000FF00FF000000FFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0000F0FF0F0FF0F0FF0F0FF0FF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0F0FFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFF0FF0FF00F000000F00FF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0FF0FFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 - 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 - 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF00000F - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0FF00FFFF00000FF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0 - FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FF0FF0FF0FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF0F000F - FF00FFF0FF0FF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFF0F000FF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF00FFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0000000FFF9FFFF0000F - FF00FFFFFFFFFFF9FFF0000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFF0FF00FFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFF00FF00FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0FF00FFFFF0000FF9FFFFFFFFF0FFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF00FF00FFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0F00000FFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0 - FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFF0F00000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFF0FFF9FFFF00000FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000F0FFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF000FFFF9FFFF0FFFF - FF00FFFFF00000F9FFFFFF000FFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFF000F0FFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFF0F0F0FFF9FFF000000FF00FFFFF0FFFFF9FFFFF0F0F0FFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F0F0FFF9FFFF0FFF0 - FF00FFFF000000F9FFFFF0F0F0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFF000000FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFF00F0FFF9FFF000000FF00FFFFF0FFF0F9FFFFFF00F0FFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFF0 - FF00FFFF000000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFF0FFFFFFF9FFFFFFFFFFF00FFFFF0FFF0F9FFFFF0FFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFFF000F - FF00FFFFFFFFFFF9FFFF000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFF0F0FFFFFFF9FFFF0F0F0FF00FFFFFF000FF9FFF0000000FFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0000FFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFF0F0F0 - FF00FFFFF0F0F0F9FFFFF0FFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFF0000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFF0FFF0FFF9FFFFF00F0FF00FFFFF0F0F0F9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFF00F0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFF000000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFF00000FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0FFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFF - FF00FFFFF00000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFFFF00FFFFF0FFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFF0FFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 - 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 - 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF - FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 - 0000000000000000000000900000000000000000000000000000000000000000 - 000000000000000000000000000000000000000000000000000000000000FFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0000FF000FF00 - 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFF0FFFF0000FF000FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF000F0FF0F000 - 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFF0FFFFF000F0FF0F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0000FF000FF00 - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFF0FF0F0000FF000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF - 0FF000F0FF0FFFF0FF0FF000F0FF0FF0000FFF000F0FFF000FF000FFFFFFFFFF - FFFFFFFFFFFF000FF0FF0FF000FFF0FF000F0FF0FFFF0FF0FF000F0FF0FF0F00 - 0FFF000F0FFF000F000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F00FFFF0FF0FFFF0FF0F0FF0F0FF0FF0 - 0FF0F0FFFF0FF0FFFF0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FFFFF0F00 - FFFF0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FFFF0FF0FFF0FF0FFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0 - F00000F0FF0FFFF0FF0F0FF0F0FF0FF00FF0F0000F0FF0000F0FF0FFFFFFFFFF - FFFFFFFFFFF0FFF0F0FF0F0000FF0F00000F0FF0FFFF0FF0F0FF0F0FF0FF0F0F - F0F0000F0FF00000FF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFF00000F0F00FF0F0FF0FFFF0FF0F0FF0F0FF0FF0 - 0FF0F0FF0F0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FF0FF0F00 - FF0F0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FF0F0FF0FF00FF0FFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0F - FF000FF000FFFFF000FF0FF0F000000F000FFF00FF000F00FFF000FFFFFFFFFF - FFFFFFFFFFF0FFF0F000FFF00FF0FFF000FF000FFFFF000FF0FF0F000000FF00 - 0FFF00FF000F00FF000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF - FFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F - FFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFF0} - end - object Label1: TLabel - Left = 10 - Top = 44 - Width = 21 - Height = 13 - Caption = 'Left:' - end - object Label2: TLabel - Left = 10 - Top = 69 - Width = 28 - Height = 13 - Caption = 'Right:' - end - object Label3: TLabel - Left = 10 - Top = 94 - Width = 22 - Height = 13 - Caption = 'Top:' - end - object Label4: TLabel - Left = 10 - Top = 119 - Width = 36 - Height = 13 - Caption = 'Bottom:' - end - object Label5: TLabel - Left = 10 - Top = 14 - Width = 27 - Height = 13 - Caption = 'Units:' - end - object Label6: TLabel - Left = 10 - Top = 174 - Width = 38 - Height = 13 - Caption = 'Header:' - end - object Label7: TLabel - Left = 10 - Top = 199 - Width = 33 - Height = 13 - Caption = 'Footer:' - end - object Label8: TLabel - Left = 10 - Top = 224 - Width = 84 - Height = 13 - Caption = 'HFInternalMargin:' - end - object Label9: TLabel - Left = 10 - Top = 249 - Width = 86 - Height = 13 - Caption = 'LeftHFTextIndent:' - end - object Label10: TLabel - Left = 10 - Top = 274 - Width = 93 - Height = 13 - Caption = 'RightHFTextIndent:' - end - object Label11: TLabel - Left = 10 - Top = 144 - Width = 29 - Height = 13 - Caption = 'Gutter' - end - object OKBtn: TButton - Left = 344 - Top = 310 - Width = 75 - Height = 25 - Caption = 'OK' - Default = True - ModalResult = 1 - TabOrder = 12 - end - object CancelBtn: TButton - Left = 424 - Top = 310 - Width = 75 - Height = 25 - Cancel = True - Caption = 'Cancel' - ModalResult = 2 - TabOrder = 13 - end - object CBMirrorMargins: TCheckBox - Left = 10 - Top = 300 - Width = 97 - Height = 17 - Caption = 'Mirror margins' - TabOrder = 11 - end - object EditLeft: TEdit - Left = 110 - Top = 40 - Width = 151 - Height = 21 - TabOrder = 1 - end - object EditRight: TEdit - Left = 110 - Top = 65 - Width = 151 - Height = 21 - TabOrder = 2 - end - object EditTop: TEdit - Left = 110 - Top = 90 - Width = 151 - Height = 21 - TabOrder = 3 - end - object EditBottom: TEdit - Left = 110 - Top = 115 - Width = 151 - Height = 21 - TabOrder = 4 - end - object EditGutter: TEdit - Left = 110 - Top = 140 - Width = 151 - Height = 21 - TabOrder = 5 - end - object EditHeader: TEdit - Left = 110 - Top = 170 - Width = 151 - Height = 21 - TabOrder = 6 - end - object EditFooter: TEdit - Left = 110 - Top = 195 - Width = 151 - Height = 21 - TabOrder = 7 - end - object EditHFInternalMargin: TEdit - Left = 110 - Top = 220 - Width = 151 - Height = 21 - TabOrder = 8 - end - object EditLeftHFTextIndent: TEdit - Left = 110 - Top = 245 - Width = 151 - Height = 21 - TabOrder = 9 - end - object EditRightHFTextIndent: TEdit - Left = 110 - Top = 270 - Width = 151 - Height = 21 - TabOrder = 10 - end - object CBUnits: TComboBox - Left = 110 - Top = 10 - Width = 151 - Height = 21 - Style = csDropDownList - ItemHeight = 13 - Items.Strings = ( - 'mm' - 'cm' - 'Inches' - 'Thousandths Of Inches') - TabOrder = 0 - OnChange = CBUnitsChange - end -end +object SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg + Left = 244 + Top = 189 + ActiveControl = CBUnits + BorderStyle = bsDialog + Caption = 'Margins' + ClientHeight = 344 + ClientWidth = 506 + Color = clBtnFace + ParentFont = True + OldCreateOrder = True + Position = poScreenCenter + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object Image1: TImage + Left = 275 + Top = 10 + Width = 223 + Height = 292 + AutoSize = True + Picture.Data = { + 07544269746D617036800000424D36800000000000007600000028000000DF00 + 0000240100000100040000000000C07F00000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0F00FF0FF0FF0F + F0F0000F0FFFF00F000F0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF0FF000FF0F0FF0FF0FF0F0FF0F0FFFF0F0FFFFF00F0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF000FF0F0FF0FF0F + F0FF000F0FFFF0F0000FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF0F0F00FF0F0FF0FF0FF0FFFF0F0FFFF0F0FF0FF00F0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00FF0F00FF00000000 + 0FF0000F0FFF000F00FF0FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FF00FF0FFFFFFFFFFFFFFFFFFFFF0FFFF0FFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFF0FFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF00000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF00000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFF0000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFF99FF9FF9FF99F99FF9F + F9FF99F99FF90F9FF99F99F99FF9FF99F99F99FF9FF900000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFF99F99FF9FF9FF99F99FF9FF9FF99F99099FF9FF99F99F99FF9F + F99F99F99FF9FF9FF99F99FF9FF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFF0FF + F0FF000F0000FF000FF000F0FFFF00FF000F0FF000FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FFF0F0FFFF0FF0F0FF0F0FFFF0FFFF0FF0 + FFFFF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF + F0F0000FF000F0FF0F0000F0FFFF0FF0000FF00F0FFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFF00000F0FF0FFFF0F0FF0F0FF0F0FFFF0FF0 + FF0FF00F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF000FF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9F0FF + F0FF00FF0000FF000FF00FF000F000FF00FF0FF000FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9F0FFF0FFFFFFFFFFFFFF0FFFFFFFFFFF0FFF + FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00000 + 00FF000FF000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFF0000F + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF + F0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF0FFF0F0FFF0FF0F0FF0F0FFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0000F0 + 00F0FF0F0000F0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0FFFFFFFFFF000000 + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF00000F0FF0FFF0F0FF0F0FF0F0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFF0FFFFFFFFFF000000FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FF00F00 + 00FF000FF00FF000FFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFF0000000 + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFF + FFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0FF0FFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFF0000000FFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFF00000FFFFFFFFF0FFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFF0FFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF00F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF00000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFF9FFFFFFFFFFFFFFF9FFFF + FFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F0000000FFFFFFFFFFFFFFFFFFF9FFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFF00000 + 000000F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F00000000FF9FFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FFFFF9FFFFFFFFFFFFFFF9FFFF + F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000F000FF000FF0FFF0F0FFFFFF0F + FF000F0FF000FF0F0FF0FF000FF000F0FF0F00FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFF + FF0FFF0FFFFF00FFF0FFF0F0FFFFFF0FF0FFFFF00F0FFF0F0FF0F0FF0F0FFFF0 + FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFF0FFF0000FF00FFF0FFF0F0FFFFFF0F + F0000FF00F0FFF0F0FF0F0FF0F0000F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FF0FFF0FF0FF00FFF00000F000FFFF0FF0FF0FF00F0FFF0F0FF0F0FF0F0FF0F0 + FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFF0FFFF00FF0000FF0FFF0F0FFFFFF0F + FF00FF0FF000FF0F000FFF000FF00FF000F000FFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFF + FF0FFFFFFFFF00FFF0FFF0F0FFFFFF0FFFFFFFFFFF0FFF0FFFFFFFFF0FFFFFFF + FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0FFF0F0000F0000 + 0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFF9FFFFFFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0F0F0FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF000F0FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFF0F0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFF0F00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF0000FFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF + 000F0FF000FF000FF000FFFF000FF0FF0F0FF0F000F0FF0FF000FFFFF0F0FF0F + 00F0FF0FFF0FF0FF0F0F0FF0FFF00FF0FFF000FF000FFFF0FF0FF00000F0FFF0 + 00F0F0FF0F000FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF00F0FF0F0FFFF0FF0FFFF0FF0F0FF + 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 + FF0FFFF0FF0FFFF0FF0FF00FF0F0FF0FF0F0F0FF0FFFF0FFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF00F + F00F0F0FF0F0000F0FF0FFFF0FF0F0FF0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F + 0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0FF0000F0FF0FFFF0FF0FF0F000F0FF0F + F0F0F0FF0FF00FFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FFF0F0FF0F0FF0F0FF0FFFF0FF0F0FF + 0F0FF0F0F0F0FF0F0FF0FFFF0F0F0F0F0FF0FF0FFF0FF0FF0F0F0FF0FF0FF0F0 + FF0FF0F0FF0FFFF0FF0FF0FFF0F0FF0FF0F0F0FF0F0FFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + F0000FF000FF00FFF000FFFF000FF0000F000F0000F000FFF000FFFF0F0F0F00 + 00F000FFFF000000FF0F000000F00FF000F00FFF000FFFF000000F0000F000F0 + 00F0F000FFF000FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFF0FFFFFFFFF0FFFFFFFFFFFF + FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF + FFFF0FFFF0FFFFFFFFF0FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFF0F + FFF0FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000090000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF000FFF00FF0000FF00FF0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0 + FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF000FFF00FF00F00F00FF0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF0FF0F0FF0F0F0FF0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0000F0FF0F0F0FF0FF0F0FF0 + FF0FFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF0FF0F0FF0F0FF0F0FF0F0FF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF0FF0FF00F00000FF00FF000000FFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0000F0FF0F0FF0F0FF0F0FF0FF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0F0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF0FF0FF00F000000F00FF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFF0FF0FFFFFF0FF0FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 + 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 + 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF00000F + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0FF00FFFF00000FF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FF0FFFFF0 + FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FF0FF0FF0FF00FFF0FFFFF0F9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFF0F000F + FF00FFF0FF0FF0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0FF0FFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFF0F000FF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0FF0FFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0FF00FFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0000000FFF9FFFF0000F + FF00FFFFFFFFFFF9FFF0000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0FF00FFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFF00FF00FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0FF00FFFFF0000FF9FFFFFFFFF0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF00FF00FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF0F00000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0FFF9FFFFFFFF0 + FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFF0F00000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFF0FFF9FFFF00000FF00FFFFFFFFF0F9FFFFFFFFF0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF000F0FFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFF000FFFF9FFFF0FFFF + FF00FFFFF00000F9FFFFFF000FFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFF000F0FFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0F0F0FFF9FFF000000FF00FFFFF0FFFFF9FFFFF0F0F0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFF0F0FFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F0F0FFF9FFFF0FFF0 + FF00FFFF000000F9FFFFF0F0F0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFF0FFF0F0FFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF000000FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFF00F0FFF9FFF000000FF00FFFFF0FFF0F9FFFFFF00F0FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFF0 + FF00FFFF000000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFF0000000FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0FFFFFFF9FFFFFFFFFFF00FFFFF0FFF0F9FFFFF0FFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0000000FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFFF000F + FF00FFFFFFFFFFF9FFFF000000FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFF0F0FFFFFFF9FFFF0F0F0FF00FFFFFF000FF9FFF0000000FFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFF0000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF000000FFF9FFFF0F0F0 + FF00FFFFF0F0F0F9FFFFF0FFF0FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFF0000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFF0FFF0FFF9FFFFF00F0FF00FFFFF0F0F0F9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF000000FFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFF00F0F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFF000000FFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFF0FFF0FFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFF00000FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFF0FFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFF + FF00FFFFF00000F9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFF0FFFFFF00FFFFF0FFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFF0FFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFF0FFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000 + 000000000FFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFF00 + 00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFF0FF0F0FF0FFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFF0FFFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FF0F0FF0FFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFF00FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFF00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFFFF00FFFFFFFFFFF9FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9FFFFFFFFF + FF00FFFFFFFFFFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000900000000000000000000000000000000000000000 + 000000000000000000000000000000000000000000000000000000000000FFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0000FF000FF00 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FFFF0000FF000FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0FF0F0FF0F0FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF000F0FF0F000 + 0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FFFFF000F0FF0F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF0F0FF0F0FF0FFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0F0000FF000FF00 + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0FF0F0000FF000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FF0FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF + 0FF000F0FF0FFFF0FF0FF000F0FF0FF0000FFF000F0FFF000FF000FFFFFFFFFF + FFFFFFFFFFFF000FF0FF0FF000FFF0FF000F0FF0FFFF0FF0FF000F0FF0FF0F00 + 0FFF000F0FFF000F000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0F00FFFF0FF0FFFF0FF0F0FF0F0FF0FF0 + 0FF0F0FFFF0FF0FFFF0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FFFFF0F00 + FFFF0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FFFF0FF0FFF0FF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFF0 + F00000F0FF0FFFF0FF0F0FF0F0FF0FF00FF0F0000F0FF0000F0FF0FFFFFFFFFF + FFFFFFFFFFF0FFF0F0FF0F0000FF0F00000F0FF0FFFF0FF0F0FF0F0FF0FF0F0F + F0F0000F0FF00000FF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF00000F0F00FF0F0FF0FFFF0FF0F0FF0F0FF0FF0 + 0FF0F0FF0F0FF0FF0F0FF0FFFFFFFFFFFFFFFFFFFFF0FFF0F0FF0F0FF0FF0F00 + FF0F0FF0FFFF0FF0F0FF0F0FF0FF0F0FF0F0FF0F0FF0FF00FF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFF0F + FF000FF000FFFFF000FF0FF0F000000F000FFF00FF000F00FFF000FFFFFFFFFF + FFFFFFFFFFF0FFF0F000FFF00FF0FFF000FF000FFFFF000FF0FF0F000000FF00 + 0FFF00FF000F00FF000FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000FF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFF0FFFFFFFFFF + FFFFFFFFFFF0FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F + FFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFF0} + end + object LabelLeft: TLabel + Left = 10 + Top = 44 + Width = 23 + Height = 13 + Caption = 'Left:' + end + object LabelRight: TLabel + Left = 10 + Top = 69 + Width = 29 + Height = 13 + Caption = 'Right:' + end + object LabelTop: TLabel + Left = 10 + Top = 94 + Width = 22 + Height = 13 + Caption = 'Top:' + end + object LabelBottom: TLabel + Left = 10 + Top = 119 + Width = 38 + Height = 13 + Caption = 'Bottom:' + end + object LabelUnits: TLabel + Left = 10 + Top = 14 + Width = 28 + Height = 13 + Caption = 'Units:' + end + object LabelHeader: TLabel + Left = 10 + Top = 174 + Width = 39 + Height = 13 + Caption = 'Header:' + end + object LabelFooter: TLabel + Left = 10 + Top = 199 + Width = 36 + Height = 13 + Caption = 'Footer:' + end + object LabelInternalMargin: TLabel + Left = 10 + Top = 224 + Width = 87 + Height = 13 + Caption = 'HFInternalMargin:' + end + object LabelLeftIndent: TLabel + Left = 10 + Top = 249 + Width = 90 + Height = 13 + Caption = 'LeftHFTextIndent:' + end + object LabelRightIndent: TLabel + Left = 10 + Top = 274 + Width = 96 + Height = 13 + Caption = 'RightHFTextIndent:' + end + object LabelGutter: TLabel + Left = 10 + Top = 144 + Width = 31 + Height = 13 + Caption = 'Gutter' + end + object OKBtn: TButton + Left = 344 + Top = 310 + Width = 75 + Height = 25 + Caption = 'OK' + Default = True + ModalResult = 1 + TabOrder = 12 + end + object CancelBtn: TButton + Left = 424 + Top = 310 + Width = 75 + Height = 25 + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 13 + end + object CBMirrorMargins: TCheckBox + Left = 10 + Top = 300 + Width = 97 + Height = 17 + Caption = 'Mirror margins' + TabOrder = 11 + end + object EditLeft: TEdit + Left = 110 + Top = 40 + Width = 151 + Height = 21 + TabOrder = 1 + end + object EditRight: TEdit + Left = 110 + Top = 65 + Width = 151 + Height = 21 + TabOrder = 2 + end + object EditTop: TEdit + Left = 110 + Top = 90 + Width = 151 + Height = 21 + TabOrder = 3 + end + object EditBottom: TEdit + Left = 110 + Top = 115 + Width = 151 + Height = 21 + TabOrder = 4 + end + object EditGutter: TEdit + Left = 110 + Top = 140 + Width = 151 + Height = 21 + TabOrder = 5 + end + object EditHeader: TEdit + Left = 110 + Top = 170 + Width = 151 + Height = 21 + TabOrder = 6 + end + object EditFooter: TEdit + Left = 110 + Top = 195 + Width = 151 + Height = 21 + TabOrder = 7 + end + object EditHFInternalMargin: TEdit + Left = 110 + Top = 220 + Width = 151 + Height = 21 + TabOrder = 8 + end + object EditLeftHFTextIndent: TEdit + Left = 110 + Top = 245 + Width = 151 + Height = 21 + TabOrder = 9 + end + object EditRightHFTextIndent: TEdit + Left = 110 + Top = 270 + Width = 151 + Height = 21 + TabOrder = 10 + end + object CBUnits: TComboBox + Left = 110 + Top = 10 + Width = 151 + Height = 21 + Style = csDropDownList + TabOrder = 0 + OnChange = CBUnitsChange + Items.Strings = ( + 'mm' + 'cm' + 'Inches' + 'Thousandths Of Inches') + end +end diff --git a/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.pas b/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.pas index 1ca05e3d..4fb7aa4d 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrintMarginsDialog.pas @@ -1,187 +1,188 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrintMarginsDialog.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrintMarginsDialog.pas,v 1.5.2.1 2004/08/31 12:55:18 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Property editor for TSynEditPrintMargins - nothing fancy, it only displays - a picture that can help with understanding the different values. --------------------------------------------------------------------------------} - -unit SynEditPrintMarginsDialog; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - Forms, - Controls, - StdCtrls, - Buttons, - ExtCtrls, - Dialogs, - SynEditPrint, - SynEditPrintTypes, - SynEditPrintMargins, - SysUtils, - Classes; - -type - TSynEditPrintMarginsDlg = class(TForm) - OKBtn: TButton; - CancelBtn: TButton; - Image1: TImage; - Label1: TLabel; - Label2: TLabel; - Label3: TLabel; - Label4: TLabel; - Label5: TLabel; - Label6: TLabel; - Label7: TLabel; - Label8: TLabel; - Label9: TLabel; - CBMirrorMargins: TCheckBox; - Label10: TLabel; - Label11: TLabel; - EditLeft: TEdit; - EditRight: TEdit; - EditTop: TEdit; - EditBottom: TEdit; - EditGutter: TEdit; - EditHeader: TEdit; - EditFooter: TEdit; - EditHFInternalMargin: TEdit; - EditLeftHFTextIndent: TEdit; - EditRightHFTextIndent: TEdit; - CBUnits: TComboBox; - procedure FormCreate(Sender: TObject); - procedure FormDestroy(Sender: TObject); - procedure CBUnitsChange(Sender: TObject); - private - { Private declarations } - FMargins: TSynEditPrintMargins; - FInternalCall: Boolean; - public - { Public declarations } - procedure SetMargins(SynEditMargins: TSynEditPrintMargins); - procedure GetMargins(SynEditMargins: TSynEditPrintMargins); - end; - -implementation - -{$R *.dfm} - -uses - UITypes; - -{ TSynEditPrintMarginsDlg } - -procedure TSynEditPrintMarginsDlg.FormCreate(Sender: TObject); -begin - FMargins := TSynEditPrintMargins.Create; - FInternalCall := False; -end; - -procedure TSynEditPrintMarginsDlg.FormDestroy(Sender: TObject); -begin - FMargins.Free; -end; - -procedure TSynEditPrintMarginsDlg.GetMargins( - SynEditMargins: TSynEditPrintMargins); -var - CurEdit: TEdit; - function StringToFloat(Edit: TEdit): Double; - begin - CurEdit := Edit; - Result := StrToFloat(Edit.Text); - end; -begin - with SynEditMargins do begin - if not FInternalCall then - UnitSystem := TUnitSystem(CBUnits.ItemIndex); - try - Left := StringToFloat(EditLeft); - Right := StringToFloat(EditRight); - Top := StringToFloat(EditTop); - Bottom := StringToFloat(EditBottom); - Gutter := StringToFloat(EditGutter); - Header := StringToFloat(EditHeader); - Footer := StringToFloat(EditFooter); - LeftHFTextIndent := StringToFloat(EditLeftHFTextIndent); - RightHFTextIndent := StringToFloat(EditRightHFTextIndent); - HFInternalMargin := StringToFloat(EditHFInternalMargin); - except - MessageDlg('Invalid number!', mtError, [mbOk], 0); - CurEdit.SetFocus; - end; - MirrorMargins := CBMirrorMargins.Checked; - end; -end; - -procedure TSynEditPrintMarginsDlg.SetMargins( - SynEditMargins: TSynEditPrintMargins); -begin - with SynEditMargins do begin - CBUnits.ItemIndex := Ord(UnitSystem); - EditLeft.Text := FloatToStr(Left); - EditRight.Text := FloatToStr(Right); - EditTop.Text := FloatToStr(Top); - EditBottom.Text := FloatToStr(Bottom); - EditGutter.Text := FloatToStr(Gutter); - EditHeader.Text := FloatToStr(Header); - EditFooter.Text := FloatToStr(Footer); - EditLeftHFTextIndent.Text := FloatToStr(LeftHFTextIndent); - EditRightHFTextIndent.Text := FloatToStr(RightHFTextIndent); - EditHFInternalMargin.Text := FloatToStr(HFInternalMargin); - CBMirrorMargins.Checked := MirrorMargins; - end; -end; - -procedure TSynEditPrintMarginsDlg.CBUnitsChange(Sender: TObject); -begin - FInternalCall := True; - GetMargins(FMargins); - FInternalCall := False; - FMargins.UnitSystem := TUnitSystem(CBUnits.ItemIndex); - SetMargins(FMargins); -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrintMarginsDialog.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrintMarginsDialog.pas,v 1.5.2.1 2004/08/31 12:55:18 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Property editor for TSynEditPrintMargins - nothing fancy, it only displays + a picture that can help with understanding the different values. +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINTMARGINSDIALOG} +unit SynEditPrintMarginsDialog; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} + Windows, + Graphics, + Forms, + Controls, + StdCtrls, + Buttons, + ExtCtrls, + Dialogs, + SynEditPrint, + SynEditPrintTypes, + SynEditPrintMargins, + SysUtils, + Classes; + +type + TSynEditPrintMarginsDlg = class(TForm) + OKBtn: TButton; + CancelBtn: TButton; + Image1: TImage; + LabelLeft: TLabel; + LabelRight: TLabel; + LabelTop: TLabel; + LabelBottom: TLabel; + LabelUnits: TLabel; + LabelHeader: TLabel; + LabelFooter: TLabel; + LabelInternalMargin: TLabel; + LabelLeftIndent: TLabel; + CBMirrorMargins: TCheckBox; + LabelRightIndent: TLabel; + LabelGutter: TLabel; + EditLeft: TEdit; + EditRight: TEdit; + EditTop: TEdit; + EditBottom: TEdit; + EditGutter: TEdit; + EditHeader: TEdit; + EditFooter: TEdit; + EditHFInternalMargin: TEdit; + EditLeftHFTextIndent: TEdit; + EditRightHFTextIndent: TEdit; + CBUnits: TComboBox; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure CBUnitsChange(Sender: TObject); + private + { Private declarations } + FMargins: TSynEditPrintMargins; + FInternalCall: Boolean; + public + { Public declarations } + procedure SetMargins(SynEditMargins: TSynEditPrintMargins); + procedure GetMargins(SynEditMargins: TSynEditPrintMargins); + end; + +implementation + +{$R *.dfm} + +{ TSynEditPrintMarginsDlg } + +procedure TSynEditPrintMarginsDlg.FormCreate(Sender: TObject); +begin + FMargins := TSynEditPrintMargins.Create; + FInternalCall := False; +end; + +procedure TSynEditPrintMarginsDlg.FormDestroy(Sender: TObject); +begin + FMargins.Free; +end; + +procedure TSynEditPrintMarginsDlg.GetMargins( + SynEditMargins: TSynEditPrintMargins); +var + CurEdit: TEdit; + function StringToFloat(Edit: TEdit): Double; + begin + CurEdit := Edit; + Result := StrToFloat(Edit.Text); + end; +begin + with SynEditMargins do begin + if not FInternalCall then + UnitSystem := TUnitSystem(CBUnits.ItemIndex); + try + Left := StringToFloat(EditLeft); + Right := StringToFloat(EditRight); + Top := StringToFloat(EditTop); + Bottom := StringToFloat(EditBottom); + Gutter := StringToFloat(EditGutter); + Header := StringToFloat(EditHeader); + Footer := StringToFloat(EditFooter); + LeftHFTextIndent := StringToFloat(EditLeftHFTextIndent); + RightHFTextIndent := StringToFloat(EditRightHFTextIndent); + HFInternalMargin := StringToFloat(EditHFInternalMargin); + except + MessageDlg('Invalid number!', mtError, [mbOk], 0); + CurEdit.SetFocus; + end; + MirrorMargins := CBMirrorMargins.Checked; + end; +end; + +procedure TSynEditPrintMarginsDlg.SetMargins( + SynEditMargins: TSynEditPrintMargins); +begin + with SynEditMargins do begin + CBUnits.ItemIndex := Ord(UnitSystem); + EditLeft.Text := FloatToStr(Left); + EditRight.Text := FloatToStr(Right); + EditTop.Text := FloatToStr(Top); + EditBottom.Text := FloatToStr(Bottom); + EditGutter.Text := FloatToStr(Gutter); + EditHeader.Text := FloatToStr(Header); + EditFooter.Text := FloatToStr(Footer); + EditLeftHFTextIndent.Text := FloatToStr(LeftHFTextIndent); + EditRightHFTextIndent.Text := FloatToStr(RightHFTextIndent); + EditHFInternalMargin.Text := FloatToStr(HFInternalMargin); + CBMirrorMargins.Checked := MirrorMargins; + end; +end; + +procedure TSynEditPrintMarginsDlg.CBUnitsChange(Sender: TObject); +begin + FInternalCall := True; + GetMargins(FMargins); + FInternalCall := False; + FMargins.UnitSystem := TUnitSystem(CBUnits.ItemIndex); + SetMargins(FMargins); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditPrintPreview.pas b/Source/VCL/SynEdit/Source/SynEditPrintPreview.pas index ac989378..5fdfc6b0 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintPreview.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrintPreview.pas @@ -1,764 +1,805 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrintPreview.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -Portions written by Michael Hieke are copyright 2000 Michael Hieke. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrintPreview.pas,v 1.18.2.2 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Print preview component. Allmost identical to code developed by Michael Hieke. - It is important to call UpdatePreview whenever things change (i.e. just - before the preview is shown, and when the printer is changed) --------------------------------------------------------------------------------} - -unit SynEditPrintPreview; - -{$I SynEdit.inc} - -{$M+} -interface - -uses - Themes, - Windows, - Controls, - Messages, - Graphics, - Forms, - SynEditPrint, - Classes, - SysUtils; - -type -//Event raised when page is changed in preview - TPreviewPageEvent = procedure(Sender: TObject; PageNumber: Integer) of object; - TSynPreviewScale = (pscWholePage, pscPageWidth, pscUserScaled); - - TSynEditPrintPreview = class(TCustomControl) - protected - FBorderStyle: TBorderStyle; - FSynEditPrint: TSynEditPrint; - FScaleMode: TSynPreviewScale; - FScalePercent: Integer; - // these are in pixels ( = screen device units) - FVirtualSize: TPoint; - FVirtualOffset: TPoint; - FPageSize: TPoint; - FScrollPosition: TPoint; - FPageBG: TColor; - FPageNumber: Integer; - FShowScrollHint: Boolean; - FOnPreviewPage: TPreviewPageEvent; - FOnScaleChange: TNotifyEvent; // JD 2002-01-9 - FWheelAccumulator: Integer; - procedure SetBorderStyle(Value: TBorderStyle); - procedure SetPageBG(Value: TColor); - procedure SetSynEditPrint(Value: TSynEditPrint); - procedure SetScaleMode(Value: TSynPreviewScale); - procedure SetScalePercent(Value: Integer); - private - procedure WMEraseBkgnd(var Msg: TWMEraseBkgnd); message WM_ERASEBKGND; - procedure WMHScroll(var Msg: TWMHScroll); message WM_HSCROLL; - procedure WMSize(var Msg: TWMSize); message WM_SIZE; - procedure WMVScroll(var Msg: TWMVScroll); message WM_VSCROLL; - procedure WMMouseWheel(var Message: TWMMouseWheel); message WM_MOUSEWHEEL; - procedure PaintPaper; - function GetPageCount: Integer; - protected - procedure CreateParams(var Params: TCreateParams); override; - function GetPageHeightFromWidth(AWidth: Integer): Integer; - function GetPageHeight100Percent: Integer; - function GetPageWidthFromHeight(AHeight: Integer): Integer; - function GetPageWidth100Percent: Integer; - procedure Notification(AComponent: TComponent; Operation: TOperation); override; - procedure ScrollHorzFor(Value: Integer); - procedure ScrollHorzTo(Value: Integer); virtual; - procedure ScrollVertFor(Value: Integer); - procedure ScrollVertTo(Value: Integer); virtual; - procedure UpdateScrollbars; virtual; - procedure SizeChanged; virtual; - public - constructor Create(AOwner: TComponent); override; - procedure Paint; override; - procedure UpdatePreview; - procedure NextPage; - procedure PreviousPage; - procedure FirstPage; - procedure LastPage; - procedure Print; - property PageNumber: Integer read FPageNumber; - property PageCount: Integer read GetPageCount; - published - property Align default alClient; - property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle - default bsSingle; - property Color default clAppWorkspace; - property Cursor; - property PageBGColor: TColor read FPageBG write SetPageBG default clWhite; - property PopupMenu; // JD 2002-01-9 - property SynEditPrint: TSynEditPrint read FSynEditPrint - write SetSynEditPrint; - property ScaleMode: TSynPreviewScale read FScaleMode write SetScaleMode - default pscUserScaled; - property ScalePercent: Integer read FScalePercent write SetScalePercent - default 100; - property Visible default True; - property ShowScrollHint: Boolean read FShowScrollHint write FShowScrollHint - default True; - property OnClick; - property OnMouseDown; - property OnMouseUp; - property OnPreviewPage: TPreviewPageEvent read FOnPreviewPage - write FOnPreviewPage; - property OnScaleChange: TNotifyEvent read FOnScaleChange // JD 2002-01-9 - write FOnScaleChange; // JD 2002-01-9 - end; - -implementation - -uses - Types, SynEditStrConst; - -const - MARGIN_X = 12; // margin width left and right of page - MARGIN_Y = 12; // margin height above and below page - SHADOW_SIZE = 2; // page shadow width - -{ TSynEditPrintPreview } - -constructor TSynEditPrintPreview.Create(AOwner: TComponent); -begin - inherited; - ControlStyle := ControlStyle + [csNeedsBorderPaint]; - FBorderStyle := bsSingle; - FScaleMode := pscUserScaled; - FScalePercent := 100; - FPageBG := clWhite; - Width := 200; - Height := 120; - ParentColor := False; - Color := clAppWorkspace; - Visible := True; - FPageNumber := 1; - FShowScrollHint := True; - Align := alClient; - FWheelAccumulator := 0; -end; - -procedure TSynEditPrintPreview.CreateParams(var Params: TCreateParams); -const - BorderStyles: array[TBorderStyle] of DWord = (0, WS_BORDER); -begin - inherited; - with Params do begin - Style := Style or WS_HSCROLL or WS_VSCROLL or BorderStyles[FBorderStyle] - or WS_CLIPCHILDREN; - if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then begin - Style := Style and not WS_BORDER; - ExStyle := ExStyle or WS_EX_CLIENTEDGE; - end; - end; -end; - -function TSynEditPrintPreview.GetPageHeightFromWidth(AWidth: Integer): Integer; -begin - if Assigned(FSynEditPrint) then begin - with FSynEditPrint.PrinterInfo do - Result := MulDiv(AWidth, PhysicalHeight, PhysicalWidth); - end - else - Result := MulDiv(AWidth, 141, 100); // fake A4 size -end; - -function TSynEditPrintPreview.GetPageWidthFromHeight(AHeight: Integer): Integer; -begin - if Assigned(FSynEditPrint) then begin - with FSynEditPrint.PrinterInfo do - Result := MulDiv(AHeight, PhysicalWidth, PhysicalHeight); - end - else - Result := MulDiv(AHeight, 100, 141); // fake A4 size -end; - -function TSynEditPrintPreview.GetPageHeight100Percent: Integer; -var - DC: HDC; - ScreenDPI: Integer; -begin - Result := 0; - DC := GetDC(0); - ScreenDPI := GetDeviceCaps(DC, LogPixelsY); - ReleaseDC(0, DC); - if Assigned(FSynEditPrint) then - with FSynEditPrint.PrinterInfo do - Result := MulDiv(PhysicalHeight, ScreenDPI, YPixPrInch); -end; - -function TSynEditPrintPreview.GetPageWidth100Percent: Integer; -var - DC: HDC; - ScreenDPI: Integer; -begin - Result := 0; - DC := GetDC(0); - ScreenDPI := GetDeviceCaps(DC, LogPixelsX); - ReleaseDC(0, DC); - if Assigned(FSynEditPrint) then - with FSynEditPrint.PrinterInfo do - Result := MulDiv(PhysicalWidth, ScreenDPI, XPixPrInch); -end; - -procedure TSynEditPrintPreview.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited; - if (Operation = opRemove) and (AComponent = FSynEditPrint) then - SynEditPrint := nil; -end; - -procedure TSynEditPrintPreview.PaintPaper; -var - rcClip, rcPaper: TRect; - rgnPaper: HRGN; - i: Integer; -begin - with Canvas do begin - // we work in MM_TEXT mapping mode here... - rcClip := ClipRect; - if IsRectEmpty(rcClip) then Exit; - Brush.Color := Self.Color; - Brush.Style := bsSolid; - Pen.Color := clBlack; - Pen.Width := 1; - Pen.Style := psSolid; - if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then begin - FillRect(rcClip); - Brush.Color := FPageBG; - Rectangle(MARGIN_X, MARGIN_Y, MARGIN_X + 30, MARGIN_Y + 43); - Exit; - end; - // fill background around paper - with rcPaper do begin - Left := FVirtualOffset.X + FScrollPosition.X; - if ScaleMode = pscWholePage then - Top := FVirtualOffset.Y - else - Top := FVirtualOffset.Y + FScrollPosition.Y; - Right := Left + FPageSize.X; - Bottom := Top + FPageSize.Y; - rgnPaper := CreateRectRgn(Left, Top, Right + 1, Bottom + 1); - end; - if (NULLREGION <> ExtSelectClipRgn(Handle, rgnPaper, RGN_DIFF)) then - FillRect(rcClip); - // paper shadow - Brush.Color := clDkGray; - with rcPaper do begin - for i := 1 to SHADOW_SIZE do - PolyLine([Point(Left + i, Bottom + i), Point(Right + i, Bottom + i), - Point(Right + i, Top + i)]); - end; - // paint paper background - SelectClipRgn(Handle, rgnPaper); - Brush.Color := FPageBG; - with rcPaper do - Rectangle(Left, Top, Right + 1, Bottom + 1); - DeleteObject(rgnPaper); - end; -end; - -procedure TSynEditPrintPreview.Paint; -var - ptOrgScreen: TPoint; -begin - with Canvas do begin - PaintPaper; - if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then - Exit; - // paint the contents, clipped to the area inside of the print margins - // correct scaling for output: - - SetMapMode(Handle, MM_ANISOTROPIC); - // compute the logical point (0, 0) in screen pixels - with FSynEditPrint.PrinterInfo do - begin - SetWindowExtEx(Handle, PhysicalWidth, PhysicalHeight, nil); - SetViewPortExtEx(Handle, FPageSize.X, FPageSize.Y, nil); - ptOrgScreen.X := MulDiv(LeftGutter, FPageSize.X, PhysicalWidth); - ptOrgScreen.Y := MulDiv(TopGutter, FPageSize.Y, PhysicalHeight); - Inc(ptOrgScreen.X, FVirtualOffset.X + FScrollPosition.X); - if ScaleMode = pscWholePage then - Inc(ptOrgScreen.Y, FVirtualOffset.Y) - else - Inc(ptOrgScreen.Y, FVirtualOffset.Y + FScrollPosition.Y); - SetViewPortOrgEx(Handle, ptOrgScreen.X, ptOrgScreen.Y, nil); - // clip the output to the print margins - IntersectClipRect(Handle, 0, 0, PrintableWidth, PrintableHeight); - end; - FSynEditPrint.PrintToCanvas(Canvas, FPageNumber); - end; -end; - -procedure TSynEditPrintPreview.ScrollHorzFor(Value: Integer); -begin - ScrollHorzTo(FScrollPosition.X + Value); -end; - -procedure TSynEditPrintPreview.ScrollHorzTo(Value: Integer); -var - nW, n: Integer; -begin - nW := ClientWidth; - n := nW - FVirtualSize.X; - if (Value < n) then Value := n; - if (Value > 0) then Value := 0; - if (Value <> FScrollPosition.X) then - begin - n := Value - FScrollPosition.X; - FScrollPosition.X := Value; - UpdateScrollbars; - if (Abs(n) > nW div 2) then - Invalidate - else - begin - ScrollWindow(Handle, n, 0, nil, nil); - Update; - end; - end; -end; - -procedure TSynEditPrintPreview.ScrollVertFor(Value: Integer); -begin - ScrollVertTo(FScrollPosition.Y + Value); -end; - -procedure TSynEditPrintPreview.ScrollVertTo(Value: Integer); -var - nH, n: Integer; -begin - nH := ClientHeight; - n := nH - FVirtualSize.Y; - if (Value < n) then Value := n; - if (Value > 0) then Value := 0; - if (Value <> FScrollPosition.Y) then - begin - n := Value - FScrollPosition.Y; - FScrollPosition.Y := Value; - UpdateScrollbars; - if (Abs(n) > nH div 2) then - Invalidate - else - begin - ScrollWindow(Handle, 0, n, nil, nil); - Update; - end; - end; -end; - -procedure TSynEditPrintPreview.SizeChanged; -var - nWDef: Integer; -begin - if not (HandleAllocated and Assigned(FSynEditPrint)) then Exit; - // compute paper size - case fScaleMode of - pscWholePage: begin - FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; - FPageSize.Y := ClientHeight - 2 * MARGIN_Y - SHADOW_SIZE; - nWDef := GetPageWidthFromHeight(FPageSize.Y); - if (nWDef < FPageSize.X) then - FPageSize.X := nWDef - else - FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); - end; - pscPageWidth: begin - FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; - FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); - end; - pscUserScaled: begin - FPageSize.X := MulDiv(GetPageWidth100Percent, fScalePercent, 100); - FPageSize.Y := MulDiv(GetPageHeight100Percent, fScalePercent, 100); - end; - end; - FVirtualSize.X := FPageSize.X + 2 * MARGIN_X + SHADOW_SIZE; - FVirtualSize.Y := FPageSize.Y + 2 * MARGIN_Y + SHADOW_SIZE; - FVirtualOffset.X := MARGIN_X; - if (FVirtualSize.X < ClientWidth) then - Inc(FVirtualOffset.X, (ClientWidth - FVirtualSize.X) div 2); - FVirtualOffset.Y := MARGIN_Y; - if (FVirtualSize.Y < ClientHeight) then - Inc(FVirtualOffset.Y, (ClientHeight - FVirtualSize.Y) div 2); - UpdateScrollbars; -// TODO - FScrollPosition.X := 0; - FScrollPosition.Y := 0; -end; - - -procedure TSynEditPrintPreview.UpdateScrollbars; -var - si: TScrollInfo; -begin - FillChar(si, SizeOf(TScrollInfo), 0); - si.cbSize := SizeOf(TScrollInfo); - si.fMask := SIF_ALL; - case FScaleMode of - pscWholePage: begin - // hide horizontal scrollbar - ShowScrollbar(Handle, SB_HORZ, False); - // show vertical scrollbar, enable if more than one page - si.fMask := si.fMask or SIF_DISABLENOSCROLL; - si.nMin := 1; - if Assigned(FSynEditPrint) then begin - si.nMax := FSynEditPrint.PageCount; - si.nPos := FPageNumber; - end - else begin - si.nMax := 1; - si.nPos := 1; - end; - si.nPage := 1; - SetScrollInfo(Handle, SB_VERT, si, True); - end; - pscPageWidth: begin - // hide horizontal scrollbar - ShowScrollbar(Handle, SB_HORZ, False); - // show vertical scrollbar - si.fMask := si.fMask or SIF_DISABLENOSCROLL; - si.nMax := FVirtualSize.Y; - si.nPos := -FScrollPosition.Y; - si.nPage := ClientHeight; - SetScrollInfo(Handle, SB_VERT, si, True); - end; - pscUserScaled: begin - ShowScrollbar(Handle, SB_HORZ, True); - ShowScrollbar(Handle, SB_VERT, True); - si.fMask := si.fMask or SIF_DISABLENOSCROLL; - // show horizontal scrollbar - si.nMax := FVirtualSize.X; - si.nPos := -FScrollPosition.X; - si.nPage := ClientWidth; - SetScrollInfo(Handle, SB_HORZ, si, True); - // show vertical scrollbar - si.nMax := FVirtualSize.Y; - si.nPos := -FScrollPosition.Y; - si.nPage := ClientHeight; - SetScrollInfo(Handle, SB_VERT, si, True); - end; - end; -end; - -procedure TSynEditPrintPreview.SetBorderStyle(Value: TBorderStyle); -begin - if (Value <> FBorderStyle) then - begin - FBorderStyle := Value; - RecreateWnd; - end; -end; - -procedure TSynEditPrintPreview.SetPageBG(Value: TColor); -begin - if (FPageBG <> Value) then - begin - FPageBG := Value; - Invalidate; - end; -end; - -procedure TSynEditPrintPreview.SetSynEditPrint(Value: TSynEditPrint); -begin - if (FSynEditPrint <> Value) then - begin - FSynEditPrint := Value; - if Assigned(FSynEditPrint) then - FSynEditPrint.FreeNotification(Self); - end; -end; - -procedure TSynEditPrintPreview.SetScaleMode(Value: TSynPreviewScale); -begin - if (FScaleMode <> Value) then begin - FScaleMode := Value; - FScrollPosition := Point(0, 0); - SizeChanged; - if Assigned(FOnScaleChange) then // JD 2002-01-9 - FOnScaleChange(Self); // JD 2002-01-9 - Invalidate; - end; -end; - -procedure TSynEditPrintPreview.SetScalePercent(Value: Integer); -begin - if (FScalePercent <> Value) then begin - FScaleMode := pscUserScaled; - FScrollPosition := Point(0, 0); - FScalePercent := Value; - SizeChanged; - Invalidate; - end else - ScaleMode := pscUserScaled; - if Assigned(FOnScaleChange) then // JD 2002-01-9 - FOnScaleChange(Self); // JD 2002-01-9 -end; - -procedure TSynEditPrintPreview.WMEraseBkgnd(var Msg: TWMEraseBkgnd); -begin - Msg.Result := 1; -end; - -procedure TSynEditPrintPreview.WMHScroll(var Msg: TWMHScroll); -var - nW: Integer; -begin - if (FScaleMode <> pscWholePage) then begin - nW := ClientWidth; - case Msg.ScrollCode of - SB_TOP: ScrollHorzTo(0); - SB_BOTTOM: ScrollHorzTo(-FVirtualSize.X); - SB_LINEDOWN: ScrollHorzFor(-(nW div 10)); - SB_LINEUP: ScrollHorzFor(nW div 10); - SB_PAGEDOWN: ScrollHorzFor(-(nW div 2)); - SB_PAGEUP: ScrollHorzFor(nW div 2); - SB_THUMBPOSITION, SB_THUMBTRACK: ScrollHorzTo(-Msg.Pos); - end; - end; -end; - -procedure TSynEditPrintPreview.WMSize(var Msg: TWMSize); -begin - inherited; - if not (csDesigning in ComponentState) then SizeChanged; -end; - -var - ScrollHintWnd: THintWindow; - -function GetScrollHint: THintWindow; -begin - if ScrollHintWnd = nil then begin - ScrollHintWnd := HintWindowClass.Create(Application); - ScrollHintWnd.Visible := FALSE; - end; - Result := ScrollHintWnd; -end; - -procedure TSynEditPrintPreview.WMVScroll(var Msg: TWMVScroll); -var - nH: Integer; - s: string; - rc: TRect; - pt: TPoint; - ScrollHint: THintWindow; -begin - if (FScaleMode = pscWholePage) then begin - if Assigned(FSynEditPrint) then - case Msg.ScrollCode of - SB_TOP: FPageNumber := 1; - SB_BOTTOM: FPageNumber := FSynEditPrint.PageCount; - SB_LINEDOWN, SB_PAGEDOWN: begin - FPageNumber := FPageNumber + 1; - if FPageNumber > FSynEditPrint.PageCount then - FPageNumber := FSynEditPrint.PageCount; - end; - SB_LINEUP, SB_PAGEUP: begin - FPageNumber := FPageNumber - 1; - if FPageNumber < 1 then - FPageNumber := 1; - end; - SB_THUMBPOSITION, SB_THUMBTRACK: begin - FPageNumber := Msg.Pos; - //Showing hint window - principle copied from SynEdit.pas - if FShowScrollHint then begin - ScrollHint := GetScrollHint; - if not ScrollHint.Visible then begin - ScrollHint.Color := Application.HintColor; - ScrollHint.Visible := TRUE; - end; - s := Format(SYNS_PreviewScrollInfoFmt, [FPageNumber]); - rc := ScrollHint.CalcHintRect(200, s, nil); - pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); - OffsetRect(rc, pt.x, pt.y); - ScrollHint.ActivateHint(rc, s); - SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0); - ScrollHint.Update; - end; - end; - SB_ENDSCROLL: begin - if FShowScrollHint then - begin - ScrollHint := GetScrollHint; - ScrollHint.Visible := False; - ShowWindow(ScrollHint.Handle, SW_HIDE); - end; - end; - end; - {Updating scroll position and redrawing} - FScrollPosition.Y := -(FPageNumber - 1); - UpdateScrollbars; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); - Invalidate; - end - else begin - nH := ClientHeight; - case Msg.ScrollCode of - SB_TOP: ScrollVertTo(0); - SB_BOTTOM: ScrollVertTo(-FVirtualSize.Y); - SB_LINEDOWN: ScrollVertFor(-(nH div 10)); - SB_LINEUP: ScrollVertFor(nH div 10); - SB_PAGEDOWN: ScrollVertFor(-(nH div 2)); - SB_PAGEUP: ScrollVertFor(nH div 2); - SB_THUMBPOSITION, SB_THUMBTRACK: ScrollVertTo(-Msg.Pos); - end; - end; -end; - -procedure TSynEditPrintPreview.WMMouseWheel(var Message: TWMMouseWheel); -var - bCtrl: Boolean; - - procedure MouseWheelUp; - begin - if bCtrl and (fPageNumber > 1) then - PreviousPage - else - ScrollVertFor(WHEEL_DELTA); - end; - - procedure MouseWheelDown; - begin - if bCtrl and (fPageNumber < PageCount) then - NextPage - else - ScrollVertFor(-WHEEL_DELTA); - end; - -var - MousePos: TPoint; - IsNeg: Boolean; -begin - { Find modifiers } - bCtrl := GetKeyState(VK_CONTROL) < 0; - - { Find mouse pos and increment accumulator } - MousePos:= SmallPointToPoint(Message.Pos); - Inc(FWheelAccumulator, Message.WheelDelta); - - { Do actions while accumulated is bigger than delta } - while Abs(FWheelAccumulator) >= WHEEL_DELTA do - begin - IsNeg := FWheelAccumulator < 0; - FWheelAccumulator := Abs(FWheelAccumulator) - WHEEL_DELTA; - if IsNeg then - begin - if FWheelAccumulator <> 0 then FWheelAccumulator := -FWheelAccumulator; - MouseWheelDown; - end - else - MouseWheelUp; - end; -end; - -procedure TSynEditPrintPreview.UpdatePreview; -var - OldScale: Integer; - OldMode: TSynPreviewScale; -begin - OldScale := ScalePercent; - OldMode := ScaleMode; - ScalePercent := 100; - if Assigned(FSynEditPrint) then - FSynEditPrint.UpdatePages(Canvas); - SizeChanged; - Invalidate; - ScaleMode := OldMode; - if ScaleMode = pscUserScaled then - ScalePercent := OldScale; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); -end; - -procedure TSynEditPrintPreview.FirstPage; -begin - FPageNumber := 1; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); - Invalidate; -end; - -procedure TSynEditPrintPreview.LastPage; -begin - if Assigned(FSynEditPrint) then - FPageNumber := FSynEditPrint.PageCount; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); - Invalidate; -end; - -procedure TSynEditPrintPreview.NextPage; -begin - FPageNumber := FPageNumber + 1; - if Assigned(FSynEditPrint) and (FPageNumber > FSynEditPrint.PageCount) then - FPageNumber := FSynEditPrint.PageCount; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); - Invalidate; -end; - -procedure TSynEditPrintPreview.PreviousPage; -begin - FPageNumber := FPageNumber - 1; - if Assigned(FSynEditPrint) and (FPageNumber < 1) then - FPageNumber := 1; - if Assigned(FOnPreviewPage) then - FOnPreviewPage(Self, FPageNumber); - Invalidate; -end; - -procedure TSynEditPrintPreview.Print; -begin - if Assigned(FSynEditPrint) then begin - FSynEditPrint.Print; - UpdatePreview; - end; -end; - -function TSynEditPrintPreview.GetPageCount: Integer; -begin - Result := SynEditPrint.PageCount; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrintPreview.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +Portions written by Michael Hieke are copyright 2000 Michael Hieke. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrintPreview.pas,v 1.18.2.2 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Print preview component. Allmost identical to code developed by Michael Hieke. + It is important to call UpdatePreview whenever things change (i.e. just + before the preview is shown, and when the printer is changed) +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINTPREVIEW} +unit SynEditPrintPreview; +{$ENDIF} + +{$I SynEdit.inc} + +{$M+} +interface + +uses + {$IFDEF SYN_COMPILER_7} + Themes, + {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} + Windows, + Controls, + Messages, + Graphics, + Forms, + SynEditPrint, + Classes, + SysUtils; + +type +//Event raised when page is changed in preview + TPreviewPageEvent = procedure(Sender: TObject; PageNumber: Integer) of object; + TSynPreviewScale = (pscWholePage, pscPageWidth, pscUserScaled); + + {$IFNDEF SYN_COMPILER_4_UP} + TWMMouseWheel = record + Msg: Cardinal; + Keys: SmallInt; + WheelDelta: SmallInt; + case Integer of + 0: ( + XPos: Smallint; + YPos: Smallint); + 1: ( + Pos: TSmallPoint; + Result: Longint); + end; + {$ENDIF} + + TSynEditPrintPreview = class(TCustomControl) + protected + FBorderStyle: TBorderStyle; + FSynEditPrint: TSynEditPrint; + FScaleMode: TSynPreviewScale; + FScalePercent: Integer; + // these are in pixels ( = screen device units) + FVirtualSize: TPoint; + FVirtualOffset: TPoint; + FPageSize: TPoint; + FScrollPosition: TPoint; + FPageBG: TColor; + FPageNumber: Integer; + FShowScrollHint: Boolean; + FOnPreviewPage: TPreviewPageEvent; + FOnScaleChange: TNotifyEvent; // JD 2002-01-9 + FWheelAccumulator: Integer; + procedure SetBorderStyle(Value: TBorderStyle); + procedure SetPageBG(Value: TColor); + procedure SetSynEditPrint(Value: TSynEditPrint); + procedure SetScaleMode(Value: TSynPreviewScale); + procedure SetScalePercent(Value: Integer); + private + procedure WMEraseBkgnd(var Msg: TWMEraseBkgnd); message WM_ERASEBKGND; + procedure WMHScroll(var Msg: TWMHScroll); message WM_HSCROLL; + procedure WMSize(var Msg: TWMSize); message WM_SIZE; + procedure WMVScroll(var Msg: TWMVScroll); message WM_VSCROLL; + procedure WMMouseWheel(var Message: TWMMouseWheel); message + {$IFDEF SYN_COMPILER_3_UP} WM_MOUSEWHEEL {$ELSE} $020A {$ENDIF}; + procedure PaintPaper; + function GetPageCount: Integer; + protected + procedure CreateParams(var Params: TCreateParams); override; + function GetPageHeightFromWidth(AWidth: Integer): Integer; + function GetPageHeight100Percent: Integer; + function GetPageWidthFromHeight(AHeight: Integer): Integer; + function GetPageWidth100Percent: Integer; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure ScrollHorzFor(Value: Integer); + procedure ScrollHorzTo(Value: Integer); virtual; + procedure ScrollVertFor(Value: Integer); + procedure ScrollVertTo(Value: Integer); virtual; + procedure UpdateScrollbars; virtual; + procedure SizeChanged; virtual; + public + constructor Create(AOwner: TComponent); override; + procedure Paint; override; + procedure UpdatePreview; + procedure NextPage; + procedure PreviousPage; + procedure FirstPage; + procedure LastPage; + procedure Print; + property PageNumber: Integer read FPageNumber; + property PageCount: Integer read GetPageCount; + published + property Align default alClient; + property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle + default bsSingle; + property Color default clAppWorkspace; + property Cursor; + property PageBGColor: TColor read FPageBG write SetPageBG default clWhite; + property PopupMenu; // JD 2002-01-9 + property SynEditPrint: TSynEditPrint read FSynEditPrint + write SetSynEditPrint; + property ScaleMode: TSynPreviewScale read FScaleMode write SetScaleMode + default pscUserScaled; + property ScalePercent: Integer read FScalePercent write SetScalePercent + default 100; + property Visible default True; + property ShowScrollHint: Boolean read FShowScrollHint write FShowScrollHint + default True; + property OnClick; + property OnMouseDown; + property OnMouseUp; + property OnPreviewPage: TPreviewPageEvent read FOnPreviewPage + write FOnPreviewPage; + property OnScaleChange: TNotifyEvent read FOnScaleChange // JD 2002-01-9 + write FOnScaleChange; // JD 2002-01-9 + end; + +implementation + +uses + SynEditStrConst; + +const + MARGIN_X = 12; // margin width left and right of page + MARGIN_Y = 12; // margin height above and below page + SHADOW_SIZE = 2; // page shadow width + +{ TSynEditPrintPreview } + +constructor TSynEditPrintPreview.Create(AOwner: TComponent); +begin + inherited; +{$IFDEF SYN_COMPILER_7_UP} + ControlStyle := ControlStyle + [csNeedsBorderPaint]; +{$ENDIF} + FBorderStyle := bsSingle; + FScaleMode := pscUserScaled; + FScalePercent := 100; + FPageBG := clWhite; + Width := 200; + Height := 120; + ParentColor := False; + Color := clAppWorkspace; + Visible := True; + FPageNumber := 1; + FShowScrollHint := True; + Align := alClient; + FWheelAccumulator := 0; +end; + +procedure TSynEditPrintPreview.CreateParams(var Params: TCreateParams); +const + BorderStyles: array[TBorderStyle] of DWord = (0, WS_BORDER); +begin + inherited; + with Params do begin + Style := Style or WS_HSCROLL or WS_VSCROLL or BorderStyles[FBorderStyle] + or WS_CLIPCHILDREN; + if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then begin + Style := Style and not WS_BORDER; + ExStyle := ExStyle or WS_EX_CLIENTEDGE; + end; + end; +end; + +function TSynEditPrintPreview.GetPageHeightFromWidth(AWidth: Integer): Integer; +begin + if Assigned(FSynEditPrint) then begin + with FSynEditPrint.PrinterInfo do + Result := MulDiv(AWidth, PhysicalHeight, PhysicalWidth); + end + else + Result := MulDiv(AWidth, 141, 100); // fake A4 size +end; + +function TSynEditPrintPreview.GetPageWidthFromHeight(AHeight: Integer): Integer; +begin + if Assigned(FSynEditPrint) then begin + with FSynEditPrint.PrinterInfo do + Result := MulDiv(AHeight, PhysicalWidth, PhysicalHeight); + end + else + Result := MulDiv(AHeight, 100, 141); // fake A4 size +end; + +function TSynEditPrintPreview.GetPageHeight100Percent: Integer; +var + DC: HDC; + ScreenDPI: Integer; +begin + Result := 0; + DC := GetDC(0); + ScreenDPI := GetDeviceCaps(DC, LogPixelsY); + ReleaseDC(0, DC); + if Assigned(FSynEditPrint) then + with FSynEditPrint.PrinterInfo do + Result := MulDiv(PhysicalHeight, ScreenDPI, YPixPrInch); +end; + +function TSynEditPrintPreview.GetPageWidth100Percent: Integer; +var + DC: HDC; + ScreenDPI: Integer; +begin + Result := 0; + DC := GetDC(0); + ScreenDPI := GetDeviceCaps(DC, LogPixelsX); + ReleaseDC(0, DC); + if Assigned(FSynEditPrint) then + with FSynEditPrint.PrinterInfo do + Result := MulDiv(PhysicalWidth, ScreenDPI, XPixPrInch); +end; + +procedure TSynEditPrintPreview.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and (AComponent = FSynEditPrint) then + SynEditPrint := nil; +end; + +procedure TSynEditPrintPreview.PaintPaper; +var + rcClip, rcPaper: TRect; + rgnPaper: HRGN; + i: Integer; +begin + with Canvas do begin + // we work in MM_TEXT mapping mode here... + rcClip := ClipRect; + if IsRectEmpty(rcClip) then Exit; + Brush.Color := Self.Color; + Brush.Style := bsSolid; + Pen.Color := clBlack; + Pen.Width := 1; + Pen.Style := psSolid; + if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then begin + FillRect(rcClip); + Brush.Color := FPageBG; + Rectangle(MARGIN_X, MARGIN_Y, MARGIN_X + 30, MARGIN_Y + 43); + Exit; + end; + // fill background around paper + with rcPaper do begin + Left := FVirtualOffset.X + FScrollPosition.X; + if ScaleMode = pscWholePage then + Top := FVirtualOffset.Y + else + Top := FVirtualOffset.Y + FScrollPosition.Y; + Right := Left + FPageSize.X; + Bottom := Top + FPageSize.Y; + rgnPaper := CreateRectRgn(Left, Top, Right + 1, Bottom + 1); + end; + if (NULLREGION <> ExtSelectClipRgn(Handle, rgnPaper, RGN_DIFF)) then + FillRect(rcClip); + + // paper shadow + Brush.Color := clDkGray; + with rcPaper do begin + for i := 1 to SHADOW_SIZE do + PolyLine([Point(Left + i, Bottom + i), Point(Right + i, Bottom + i), + Point(Right + i, Top + i)]); + end; + // paint paper background + + SelectClipRgn(Handle, rgnPaper); + Brush.Color := FPageBG; + with rcPaper do + Rectangle(Left, Top, Right + 1, Bottom + 1); + DeleteObject(rgnPaper); + end; +end; + +procedure TSynEditPrintPreview.Paint; +var + ptOrgScreen: TPoint; +begin + with Canvas do begin + PaintPaper; + if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then + Exit; + // paint the contents, clipped to the area inside of the print margins + // correct scaling for output: + + SetMapMode(Handle, MM_ANISOTROPIC); + // compute the logical point (0, 0) in screen pixels + with FSynEditPrint.PrinterInfo do + begin + SetWindowExtEx(Handle, PhysicalWidth, PhysicalHeight, nil); + SetViewPortExtEx(Handle, FPageSize.X, FPageSize.Y, nil); + ptOrgScreen.X := MulDiv(LeftGutter, FPageSize.X, PhysicalWidth); + ptOrgScreen.Y := MulDiv(TopGutter, FPageSize.Y, PhysicalHeight); + Inc(ptOrgScreen.X, FVirtualOffset.X + FScrollPosition.X); + if ScaleMode = pscWholePage then + Inc(ptOrgScreen.Y, FVirtualOffset.Y) + else + Inc(ptOrgScreen.Y, FVirtualOffset.Y + FScrollPosition.Y); + SetViewPortOrgEx(Handle, ptOrgScreen.X, ptOrgScreen.Y, nil); + // clip the output to the print margins + IntersectClipRect(Handle, 0, 0, PrintableWidth, PrintableHeight); + end; + FSynEditPrint.PrintToCanvas(Canvas, FPageNumber); + end; +end; + +procedure TSynEditPrintPreview.ScrollHorzFor(Value: Integer); +begin + ScrollHorzTo(FScrollPosition.X + Value); +end; + +procedure TSynEditPrintPreview.ScrollHorzTo(Value: Integer); +var + nW, n: Integer; +begin + nW := ClientWidth; + n := nW - FVirtualSize.X; + if (Value < n) then Value := n; + if (Value > 0) then Value := 0; + if (Value <> FScrollPosition.X) then + begin + n := Value - FScrollPosition.X; + FScrollPosition.X := Value; + UpdateScrollbars; + if (Abs(n) > nW div 2) then + Invalidate + else + begin + ScrollWindow(Handle, n, 0, nil, nil); + Update; + end; + end; +end; + +procedure TSynEditPrintPreview.ScrollVertFor(Value: Integer); +begin + ScrollVertTo(FScrollPosition.Y + Value); +end; + +procedure TSynEditPrintPreview.ScrollVertTo(Value: Integer); +var + nH, n: Integer; +begin + nH := ClientHeight; + n := nH - FVirtualSize.Y; + if (Value < n) then Value := n; + if (Value > 0) then Value := 0; + if (Value <> FScrollPosition.Y) then + begin + n := Value - FScrollPosition.Y; + FScrollPosition.Y := Value; + UpdateScrollbars; + if (Abs(n) > nH div 2) then + Invalidate + else + begin + ScrollWindow(Handle, 0, n, nil, nil); + Update; + end; + end; +end; + +procedure TSynEditPrintPreview.SizeChanged; +var + nWDef: Integer; +begin + if not (HandleAllocated and Assigned(FSynEditPrint)) then Exit; + // compute paper size + case fScaleMode of + pscWholePage: begin + FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; + FPageSize.Y := ClientHeight - 2 * MARGIN_Y - SHADOW_SIZE; + nWDef := GetPageWidthFromHeight(FPageSize.Y); + if (nWDef < FPageSize.X) then + FPageSize.X := nWDef + else + FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); + end; + pscPageWidth: begin + FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; + FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); + end; + pscUserScaled: begin + FPageSize.X := MulDiv(GetPageWidth100Percent, fScalePercent, 100); + FPageSize.Y := MulDiv(GetPageHeight100Percent, fScalePercent, 100); + end; + end; + FVirtualSize.X := FPageSize.X + 2 * MARGIN_X + SHADOW_SIZE; + FVirtualSize.Y := FPageSize.Y + 2 * MARGIN_Y + SHADOW_SIZE; + FVirtualOffset.X := MARGIN_X; + if (FVirtualSize.X < ClientWidth) then + Inc(FVirtualOffset.X, (ClientWidth - FVirtualSize.X) div 2); + FVirtualOffset.Y := MARGIN_Y; + if (FVirtualSize.Y < ClientHeight) then + Inc(FVirtualOffset.Y, (ClientHeight - FVirtualSize.Y) div 2); + UpdateScrollbars; +// TODO + FScrollPosition.X := 0; + FScrollPosition.Y := 0; +end; + + +procedure TSynEditPrintPreview.UpdateScrollbars; +var + si: TScrollInfo; +begin + FillChar(si, SizeOf(TScrollInfo), 0); + si.cbSize := SizeOf(TScrollInfo); + si.fMask := SIF_ALL; + case FScaleMode of + pscWholePage: begin + // hide horizontal scrollbar + ShowScrollbar(Handle, SB_HORZ, False); + // show vertical scrollbar, enable if more than one page + si.fMask := si.fMask or SIF_DISABLENOSCROLL; + si.nMin := 1; + if Assigned(FSynEditPrint) then begin + si.nMax := FSynEditPrint.PageCount; + si.nPos := FPageNumber; + end + else begin + si.nMax := 1; + si.nPos := 1; + end; + si.nPage := 1; + SetScrollInfo(Handle, SB_VERT, si, True); + end; + pscPageWidth: begin + // hide horizontal scrollbar + ShowScrollbar(Handle, SB_HORZ, False); + // show vertical scrollbar + si.fMask := si.fMask or SIF_DISABLENOSCROLL; + si.nMax := FVirtualSize.Y; + si.nPos := -FScrollPosition.Y; + si.nPage := ClientHeight; + SetScrollInfo(Handle, SB_VERT, si, True); + end; + pscUserScaled: begin + ShowScrollbar(Handle, SB_HORZ, True); + ShowScrollbar(Handle, SB_VERT, True); + si.fMask := si.fMask or SIF_DISABLENOSCROLL; + // show horizontal scrollbar + si.nMax := FVirtualSize.X; + si.nPos := -FScrollPosition.X; + si.nPage := ClientWidth; + SetScrollInfo(Handle, SB_HORZ, si, True); + // show vertical scrollbar + si.nMax := FVirtualSize.Y; + si.nPos := -FScrollPosition.Y; + si.nPage := ClientHeight; + SetScrollInfo(Handle, SB_VERT, si, True); + end; + end; +end; + +procedure TSynEditPrintPreview.SetBorderStyle(Value: TBorderStyle); +begin + if (Value <> FBorderStyle) then + begin + FBorderStyle := Value; + RecreateWnd; + end; +end; + +procedure TSynEditPrintPreview.SetPageBG(Value: TColor); +begin + if (FPageBG <> Value) then + begin + FPageBG := Value; + Invalidate; + end; +end; + +procedure TSynEditPrintPreview.SetSynEditPrint(Value: TSynEditPrint); +begin + if (FSynEditPrint <> Value) then + begin + FSynEditPrint := Value; + if Assigned(FSynEditPrint) then + FSynEditPrint.FreeNotification(Self); + end; +end; + +procedure TSynEditPrintPreview.SetScaleMode(Value: TSynPreviewScale); +begin + if (FScaleMode <> Value) then begin + FScaleMode := Value; + FScrollPosition := Point(0, 0); + SizeChanged; + if Assigned(FOnScaleChange) then + FOnScaleChange(Self); + Invalidate; + end; +end; + +procedure TSynEditPrintPreview.SetScalePercent(Value: Integer); +begin + if (FScalePercent <> Value) then begin + FScaleMode := pscUserScaled; + FScrollPosition := Point(0, 0); + FScalePercent := Value; + SizeChanged; + Invalidate; + end else + ScaleMode := pscUserScaled; + if Assigned(FOnScaleChange) then + FOnScaleChange(Self); +end; + +procedure TSynEditPrintPreview.WMEraseBkgnd(var Msg: TWMEraseBkgnd); +begin + Msg.Result := 1; +end; + +procedure TSynEditPrintPreview.WMHScroll(var Msg: TWMHScroll); +var + nW: Integer; +begin + if (FScaleMode <> pscWholePage) then begin + nW := ClientWidth; + case Msg.ScrollCode of + SB_TOP: ScrollHorzTo(0); + SB_BOTTOM: ScrollHorzTo(-FVirtualSize.X); + SB_LINEDOWN: ScrollHorzFor(-(nW div 10)); + SB_LINEUP: ScrollHorzFor(nW div 10); + SB_PAGEDOWN: ScrollHorzFor(-(nW div 2)); + SB_PAGEUP: ScrollHorzFor(nW div 2); + SB_THUMBPOSITION, SB_THUMBTRACK: ScrollHorzTo(-Msg.Pos); + end; + end; +end; + +procedure TSynEditPrintPreview.WMSize(var Msg: TWMSize); +begin + inherited; + if not (csDesigning in ComponentState) then SizeChanged; +end; + +var + ScrollHintWnd: THintWindow; + +function GetScrollHint: THintWindow; +begin + if ScrollHintWnd = nil then begin + ScrollHintWnd := HintWindowClass.Create(Application); + ScrollHintWnd.Visible := FALSE; + end; + Result := ScrollHintWnd; +end; + +procedure TSynEditPrintPreview.WMVScroll(var Msg: TWMVScroll); +var + nH: Integer; + s: string; + rc: TRect; + pt: TPoint; + ScrollHint: THintWindow; +begin + if (FScaleMode = pscWholePage) then begin + if Assigned(FSynEditPrint) then + case Msg.ScrollCode of + SB_TOP: FPageNumber := 1; + SB_BOTTOM: FPageNumber := FSynEditPrint.PageCount; + SB_LINEDOWN, SB_PAGEDOWN: begin + FPageNumber := FPageNumber + 1; + if FPageNumber > FSynEditPrint.PageCount then + FPageNumber := FSynEditPrint.PageCount; + end; + SB_LINEUP, SB_PAGEUP: begin + FPageNumber := FPageNumber - 1; + if FPageNumber < 1 then + FPageNumber := 1; + end; + SB_THUMBPOSITION, SB_THUMBTRACK: begin + FPageNumber := Msg.Pos; + //Showing hint window - principle copied from SynEdit.pas + if FShowScrollHint then begin + ScrollHint := GetScrollHint; + if not ScrollHint.Visible then begin + ScrollHint.Color := Application.HintColor; + ScrollHint.Visible := TRUE; + end; + s := Format(SYNS_PreviewScrollInfoFmt, [FPageNumber]); +{$IFDEF SYN_COMPILER_3_UP} + rc := ScrollHint.CalcHintRect(200, s, nil); +{$ELSE} + rc := Rect(0, 0, TextWidth(ScrollHint.Canvas, s) + 6, + TextHeight(ScrollHint.Canvas, s) + 4); +{$ENDIF} + pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); + OffsetRect(rc, pt.x, pt.y); + ScrollHint.ActivateHint(rc, s); +{$IFDEF SYN_COMPILER_3} + SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0); +{$ENDIF} +{$IFNDEF SYN_COMPILER_3_UP} + ScrollHint.Invalidate; +{$ENDIF} + ScrollHint.Update; + end; + end; + SB_ENDSCROLL: begin + if FShowScrollHint then + begin + ScrollHint := GetScrollHint; + ScrollHint.Visible := False; + ShowWindow(ScrollHint.Handle, SW_HIDE); + end; + end; + end; + {Updating scroll position and redrawing} + FScrollPosition.Y := -(FPageNumber - 1); + UpdateScrollbars; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); + Invalidate; + end + else begin + nH := ClientHeight; + case Msg.ScrollCode of + SB_TOP: ScrollVertTo(0); + SB_BOTTOM: ScrollVertTo(-FVirtualSize.Y); + SB_LINEDOWN: ScrollVertFor(-(nH div 10)); + SB_LINEUP: ScrollVertFor(nH div 10); + SB_PAGEDOWN: ScrollVertFor(-(nH div 2)); + SB_PAGEUP: ScrollVertFor(nH div 2); + SB_THUMBPOSITION, SB_THUMBTRACK: ScrollVertTo(-Msg.Pos); + end; + end; +end; + +procedure TSynEditPrintPreview.WMMouseWheel(var Message: TWMMouseWheel); +{$IFNDEF SYN_COMPILER_3_UP} +const + WHEEL_DELTA = 120; +{$ENDIF} +var + bCtrl: Boolean; + + procedure MouseWheelUp; + begin + if bCtrl and (fPageNumber > 1) then + PreviousPage + else + ScrollVertFor(WHEEL_DELTA); + end; + + procedure MouseWheelDown; + begin + if bCtrl and (fPageNumber < PageCount) then + NextPage + else + ScrollVertFor(-WHEEL_DELTA); + end; + +var + MousePos: TPoint; + IsNeg: Boolean; +begin + { Find modifiers } + bCtrl := GetKeyState(VK_CONTROL) < 0; + + { Find mouse pos and increment accumulator } + MousePos:= SmallPointToPoint(Message.Pos); + Inc(FWheelAccumulator, Message.WheelDelta); + + { Do actions while accumulated is bigger than delta } + while Abs(FWheelAccumulator) >= WHEEL_DELTA do + begin + IsNeg := FWheelAccumulator < 0; + FWheelAccumulator := Abs(FWheelAccumulator) - WHEEL_DELTA; + if IsNeg then + begin + if FWheelAccumulator <> 0 then FWheelAccumulator := -FWheelAccumulator; + MouseWheelDown; + end + else + MouseWheelUp; + end; +end; + +procedure TSynEditPrintPreview.UpdatePreview; +var + OldScale: Integer; + OldMode: TSynPreviewScale; +begin + OldScale := ScalePercent; + OldMode := ScaleMode; + ScalePercent := 100; + if Assigned(FSynEditPrint) then + FSynEditPrint.UpdatePages(Canvas); + SizeChanged; + Invalidate; + ScaleMode := OldMode; + if ScaleMode = pscUserScaled then + ScalePercent := OldScale; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); +end; + +procedure TSynEditPrintPreview.FirstPage; +begin + FPageNumber := 1; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); + Invalidate; +end; + +procedure TSynEditPrintPreview.LastPage; +begin + if Assigned(FSynEditPrint) then + FPageNumber := FSynEditPrint.PageCount; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); + Invalidate; +end; + +procedure TSynEditPrintPreview.NextPage; +begin + FPageNumber := FPageNumber + 1; + if Assigned(FSynEditPrint) and (FPageNumber > FSynEditPrint.PageCount) then + FPageNumber := FSynEditPrint.PageCount; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); + Invalidate; +end; + +procedure TSynEditPrintPreview.PreviousPage; +begin + FPageNumber := FPageNumber - 1; + if Assigned(FSynEditPrint) and (FPageNumber < 1) then + FPageNumber := 1; + if Assigned(FOnPreviewPage) then + FOnPreviewPage(Self, FPageNumber); + Invalidate; +end; + +procedure TSynEditPrintPreview.Print; +begin + if Assigned(FSynEditPrint) then begin + FSynEditPrint.Print; + UpdatePreview; + end; +end; + +function TSynEditPrintPreview.GetPageCount: Integer; +begin + Result := SynEditPrint.PageCount; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditPrintTypes.pas b/Source/VCL/SynEdit/Source/SynEditPrintTypes.pas index ddb58613..6737c645 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrintTypes.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrintTypes.pas @@ -1,216 +1,219 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrintTypes.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrintTypes.pas,v 1.4.2.3 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - Wrapping across page boundaries is not supported --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Misc types and procedures used in printing and previewing --------------------------------------------------------------------------------} - - -unit SynEditPrintTypes; - -interface - -uses - SynUnicode, Classes, SysUtils; - -const - DefLeft = 25; //Default left margin [mm] - DefRight = 15; //Default right margin [mm] - DefTop = 25; //Default top margin [mm] - DefBottom = 25; //Default bottom margin [mm] - DefHeader = 15; //Default margin from top of paper to bottom of header [mm] - DefFooter = 15; //Default margin from top of footer to bottom of paper [mm] - DefLeftHFTextIndent = 2; //Default Header/footer indent from left margin [mm] - DefRightHFTextIndent = 2; //Default Header/footer indent from right margin [mm] - DefHFInternalMargin = 0.5; //Default Internal margin between Header/footer text and lines [mm] - DefGutter = 0; //Default Binding gutter - added to left or right margin [mm] -type -//Frame around header/footer - TFrameType = (ftLine, ftBox, ftShaded); - TFrameTypes = set of TFrameType; -//Margin units (internally is allways used [mm]) - TUnitSystem = (usMM, usCM, usInch, muThousandthsOfInches); -//Print status events - TSynPrintStatus = (psBegin, psNewPage, psEnd); - TPrintStatusEvent = procedure(Sender: TObject; Status: TSynPrintStatus; - PageNumber: Integer; var Abort: Boolean) of object; -//Event raised when a line is printed (can be used to generate Table of Contents) - TPrintLineEvent = procedure(Sender: TObject; LineNumber, PageNumber: Integer) of object; -type - TWrapPos = class - public - Index: Integer; - end; - -function IntToRoman(Value: Integer): string; - -// TODO: BreakChars is ANSI only but SynEditPrint only uses Ansi chars and should be rewritten to use WordWrap of SynEdit anyway -function WrapTextEx(const Line: string; BreakChars: TSysCharSet; - MaxCol: Integer; AList: TList): Boolean; - -implementation - -//Returns wrapping positions in AList. -function WrapTextEx(const Line: string; BreakChars: TSysCharSet; - MaxCol: Integer; AList: TList): Boolean; -var - WrapPos: TWrapPos; - Pos, PreviousPos: Integer; - Found: Boolean; -begin - if Length(Line) <= MaxCol then - begin - Result := True; - Exit; - end; - - Result := False; - Pos := 1; - PreviousPos := 0; - WrapPos := TWrapPos.Create; - while Pos <= Length(Line) do - begin - Found := (Pos - PreviousPos > MaxCol) and (WrapPos.Index <> 0); - if not Found and (Line[Pos] <= High(Char)) and CharInSet(Char(Line[Pos]), BreakChars) then // We found a possible break - WrapPos.Index := Pos; - - if Found then - begin - Result := True; - AList.Add(WrapPos); - PreviousPos := WrapPos.Index; - - // If more wraps needed and not end of line then a new wrap is created - if ((Length(Line) - PreviousPos) > MaxCol) and (Pos < Length(Line)) then - WrapPos := TWrapPos.Create - else - Break; - end; - Pos := Pos + 1; - end; - - if (AList.Count = 0) or (AList.Last <> WrapPos) then - WrapPos.Free; -end; - -//Integer to Roman - copied from SWAG -function IntToRoman(Value: Integer): string; -begin - Result := ''; - while Value >= 1000 do begin - Result := Result + 'M'; - Value := Value - 1000; - end; - - if Value >= 900 then - begin - Result := Result + 'CM'; - Value := Value - 900; - end; - - while Value >= 500 do - begin - Result := Result + 'D'; - Value := Value - 500; - end; - - if Value >= 400 then - begin - Result := Result + 'CD'; - Value := Value - 400; - end; - - while Value >= 100 do - begin - Result := Result + 'C'; - Value := Value - 100; - end; - - if Value >= 90 then - begin - Result := Result + 'XC'; - Value := Value - 90; - end; - - while Value >= 50 do - begin - Result := Result + 'L'; - Value := Value - 50; - end; - - if Value >= 40 then - begin - Result := Result + 'XL'; - Value := Value - 40; - end; - - while Value >= 10 do - begin - Result := Result + 'X'; - Value := Value - 10; - end; - - if Value >= 9 then - begin - Result := Result + 'IX'; - Value := Value - 9; - end; - - while Value >= 5 do - begin - Result := Result + 'V'; - Value := Value - 5; - end; - - if Value >= 4 then - begin - Result := Result + 'IV'; - Value := Value - 4; - end; - - while Value > 0 do - begin - Result := Result + 'I'; - Dec(Value); - end; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrintTypes.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrintTypes.pas,v 1.4.2.3 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + Wrapping across page boundaries is not supported +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Misc types and procedures used in printing and previewing +-------------------------------------------------------------------------------} + + +{$IFNDEF QSYNEDITPRINTTYPES} +unit SynEditPrintTypes; +{$ENDIF} + +interface + +uses + SynUnicode, + Classes, SysUtils; + +const + DefLeft = 25; //Default left margin [mm] + DefRight = 15; //Default right margin [mm] + DefTop = 25; //Default top margin [mm] + DefBottom = 25; //Default bottom margin [mm] + DefHeader = 15; //Default margin from top of paper to bottom of header [mm] + DefFooter = 15; //Default margin from top of footer to bottom of paper [mm] + DefLeftHFTextIndent = 2; //Default Header/footer indent from left margin [mm] + DefRightHFTextIndent = 2; //Default Header/footer indent from right margin [mm] + DefHFInternalMargin = 0.5; //Default Internal margin between Header/footer text and lines [mm] + DefGutter = 0; //Default Binding gutter - added to left or right margin [mm] +type +//Frame around header/footer + TFrameType = (ftLine, ftBox, ftShaded); + TFrameTypes = set of TFrameType; +//Margin units (internally is allways used [mm]) + TUnitSystem = (usMM, usCM, usInch, muThousandthsOfInches); +//Print status events + TSynPrintStatus = (psBegin, psNewPage, psEnd); + TPrintStatusEvent = procedure(Sender: TObject; Status: TSynPrintStatus; + PageNumber: Integer; var Abort: Boolean) of object; +//Event raised when a line is printed (can be used to generate Table of Contents) + TPrintLineEvent = procedure(Sender: TObject; LineNumber, PageNumber: Integer) of object; +type + TWrapPos = class + public + Index: Integer; + end; + +function IntToRoman(Value: Integer): string; + +// TODO: BreakChars is ANSI only but SynEditPrint only uses Ansi chars and should be rewritten to use WordWrap of SynEdit anyway +function WrapTextEx(const Line: UnicodeString; BreakChars: TSysCharSet; + MaxCol: Integer; AList: TList): Boolean; + +implementation + +//Returns wrapping positions in AList. +function WrapTextEx(const Line: UnicodeString; BreakChars: TSysCharSet; + MaxCol: Integer; AList: TList): Boolean; +var + WrapPos: TWrapPos; + Pos, PreviousPos: Integer; + Found: Boolean; +begin + if Length(Line) <= MaxCol then + begin + Result := True; + Exit; + end; + + Result := False; + Pos := 1; + PreviousPos := 0; + WrapPos := TWrapPos.Create; + while Pos <= Length(Line) do + begin + Found := (Pos - PreviousPos > MaxCol) and (WrapPos.Index <> 0); + if not Found and (Line[Pos] <= High(Char)) and CharInSet(Char(Line[Pos]), BreakChars) then // We found a possible break + WrapPos.Index := Pos; + + if Found then + begin + Result := True; + AList.Add(WrapPos); + PreviousPos := WrapPos.Index; + + // If more wraps needed and not end of line then a new wrap is created + if ((Length(Line) - PreviousPos) > MaxCol) and (Pos < Length(Line)) then + WrapPos := TWrapPos.Create + else + Break; + end; + Pos := Pos + 1; + end; + + if (AList.Count = 0) or (AList.Last <> WrapPos) then + WrapPos.Free; +end; + +//Integer to Roman - copied from SWAG +function IntToRoman(Value: Integer): string; +begin + Result := ''; + while Value >= 1000 do begin + Result := Result + 'M'; + Value := Value - 1000; + end; + + if Value >= 900 then + begin + Result := Result + 'CM'; + Value := Value - 900; + end; + + while Value >= 500 do + begin + Result := Result + 'D'; + Value := Value - 500; + end; + + if Value >= 400 then + begin + Result := Result + 'CD'; + Value := Value - 400; + end; + + while Value >= 100 do + begin + Result := Result + 'C'; + Value := Value - 100; + end; + + if Value >= 90 then + begin + Result := Result + 'XC'; + Value := Value - 90; + end; + + while Value >= 50 do + begin + Result := Result + 'L'; + Value := Value - 50; + end; + + if Value >= 40 then + begin + Result := Result + 'XL'; + Value := Value - 40; + end; + + while Value >= 10 do + begin + Result := Result + 'X'; + Value := Value - 10; + end; + + if Value >= 9 then + begin + Result := Result + 'IX'; + Value := Value - 9; + end; + + while Value >= 5 do + begin + Result := Result + 'V'; + Value := Value - 5; + end; + + if Value >= 4 then + begin + Result := Result + 'IV'; + Value := Value - 4; + end; + + while Value > 0 do + begin + Result := Result + 'I'; + Dec(Value); + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPrinterInfo.pas b/Source/VCL/SynEdit/Source/SynEditPrinterInfo.pas index e22beced..b784f146 100644 --- a/Source/VCL/SynEdit/Source/SynEditPrinterInfo.pas +++ b/Source/VCL/SynEdit/Source/SynEditPrinterInfo.pas @@ -1,261 +1,263 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPrinterInfo.pas, released 2000-06-01. - -The Initial Author of the Original Code is Morten J. Skovrup. -Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditPrinterInfo.pas,v 1.4.2.2 2005/10/18 01:43:23 etrusco Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - - -{------------------------------------------------------------------------------- -CONTENTS: - Class retrieving info about selected printer and paper size. --------------------------------------------------------------------------------} - -unit SynEditPrinterInfo; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Printers; - -type - //Printer info class - getting dimensions of paper - TSynEditPrinterInfo = class - private - FPhysicalWidth: Integer; - FPhysicalHeight: Integer; - FPrintableWidth: Integer; - FPrintableHeight: Integer; - FLeftGutter: Integer; - FRightGutter: Integer; - FTopGutter: Integer; - FBottomGutter: Integer; - FXPixPrInch: Integer; - FYPixPrInch: Integer; - FXPixPrmm: Single; - FYPixPrmm: Single; - FIsUpdated: Boolean; - procedure FillDefault; - function GetBottomGutter: Integer; - function GetLeftGutter: Integer; - function GetPhysicalHeight: Integer; - function GetPhysicalWidth: Integer; - function GetPrintableHeight: Integer; - function GetPrintableWidth: Integer; - function GetRightGutter: Integer; - function GetTopGutter: Integer; - function GetXPixPrInch: Integer; - function GetYPixPrInch: Integer; - function GetXPixPrmm: Single; - function GetYPixPrmm: Single; - public - procedure UpdatePrinter; - function PixFromLeft(mmValue: Double): Integer; - function PixFromRight(mmValue: Double): Integer; - function PixFromTop(mmValue: Double): Integer; - function PixFromBottom(mmValue: Double): Integer; - property PhysicalWidth: Integer read GetPhysicalWidth; - property PhysicalHeight: Integer read GetPhysicalHeight; - property PrintableWidth: Integer read GetPrintableWidth; - property PrintableHeight: Integer read GetPrintableHeight; - property LeftGutter: Integer read GetLeftGutter; - property RightGutter: Integer read GetRightGutter; - property TopGutter: Integer read GetTopGutter; - property BottomGutter: Integer read GetBottomGutter; - property XPixPrInch: Integer read GetXPixPrInch; - property YPixPrInch: Integer read GetYPixPrInch; - property XPixPrmm: Single read GetXPixPrmm; - property YPixPrmm: Single read GetYPixPrmm; - end; - -implementation - -{ TSynEditPrinterInfo } - -function TSynEditPrinterInfo.PixFromBottom(mmValue: Double): Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := Round(mmValue * FYPixPrmm - FBottomGutter); -end; - -function TSynEditPrinterInfo.PixFromLeft(mmValue: Double): Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := Round(mmValue * FXPixPrmm - FLeftGutter); -end; - -function TSynEditPrinterInfo.PixFromRight(mmValue: Double): Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := Round(mmValue * FXPixPrmm - FRightGutter); -end; - -function TSynEditPrinterInfo.PixFromTop(mmValue: Double): Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := Round(mmValue * FYPixPrmm - FTopGutter); -end; - -procedure TSynEditPrinterInfo.FillDefault; -{In case of no printers installed this information is used - (I think it's taken from a HP LaserJet III with A4 paper)} -begin - FPhysicalWidth := 2481; - FPhysicalHeight := 3507; - FPrintableWidth := 2358; - FPrintableHeight := 3407; - FLeftGutter := 65; - FRightGutter := 58; - FTopGutter := 50; - FBottomGutter := 50; - FXPixPrInch := 300; - FYPixPrInch := 300; - FXPixPrmm := FXPixPrInch / 25.4; - FYPixPrmm := FYPixPrInch / 25.4; -end; - -function TSynEditPrinterInfo.GetBottomGutter: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FBottomGutter; -end; - -function TSynEditPrinterInfo.GetLeftGutter: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FLeftGutter; -end; - -function TSynEditPrinterInfo.GetPhysicalHeight: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FPhysicalHeight; -end; - -function TSynEditPrinterInfo.GetPhysicalWidth: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FPhysicalWidth; -end; - -function TSynEditPrinterInfo.GetPrintableHeight: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FPrintableHeight; -end; - -function TSynEditPrinterInfo.GetPrintableWidth: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FPrintableWidth; -end; - -function TSynEditPrinterInfo.GetRightGutter: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FRightGutter; -end; - -function TSynEditPrinterInfo.GetTopGutter: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FTopGutter; -end; - -function TSynEditPrinterInfo.GetXPixPrInch: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FXPixPrInch; -end; - -function TSynEditPrinterInfo.GetXPixPrmm: Single; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FXPixPrmm; -end; - -function TSynEditPrinterInfo.GetYPixPrInch: Integer; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FYPixPrInch; -end; - -function TSynEditPrinterInfo.GetYPixPrmm: Single; -begin - if not FIsUpdated then - UpdatePrinter; - Result := FYPixPrmm; -end; - -procedure TSynEditPrinterInfo.UpdatePrinter; -begin - FIsUpdated := True; - Printer.Refresh; - if Printer.Printers.Count <= 0 then - begin - FillDefault; - Exit; - end; - FPhysicalWidth := GetDeviceCaps(Printer.Handle, Windows.PhysicalWidth); - FPhysicalHeight := GetDeviceCaps(Printer.Handle, Windows.PhysicalHeight); - FPrintableWidth := Printer.PageWidth; {or GetDeviceCaps(Printer.Handle, HorzRes);} - FPrintableHeight := Printer.PageHeight; {or GetDeviceCaps(Printer.Handle, VertRes);} - FLeftGutter := GetDeviceCaps(Printer.Handle, PhysicalOffsetX); - FTopGutter := GetDeviceCaps(Printer.Handle, PhysicalOffsetY); - FRightGutter := FPhysicalWidth - FPrintableWidth - FLeftGutter; - FBottomGutter := FPhysicalHeight - FPrintableHeight - FTopGutter; - FXPixPrInch := GetDeviceCaps(Printer.Handle, LogPixelsX); - FYPixPrInch := GetDeviceCaps(Printer.Handle, LogPixelsY); - FXPixPrmm := FXPixPrInch / 25.4; - FYPixPrmm := FYPixPrInch / 25.4; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPrinterInfo.pas, released 2000-06-01. + +The Initial Author of the Original Code is Morten J. Skovrup. +Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditPrinterInfo.pas,v 1.4.2.2 2005/10/18 01:43:23 etrusco Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + + +{------------------------------------------------------------------------------- +CONTENTS: + Class retrieving info about selected printer and paper size. +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPRINTERINFO} +unit SynEditPrinterInfo; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + Printers; + +type + //Printer info class - getting dimensions of paper + TSynEditPrinterInfo = class + private + FPhysicalWidth: Integer; + FPhysicalHeight: Integer; + FPrintableWidth: Integer; + FPrintableHeight: Integer; + FLeftGutter: Integer; + FRightGutter: Integer; + FTopGutter: Integer; + FBottomGutter: Integer; + FXPixPrInch: Integer; + FYPixPrInch: Integer; + FXPixPrmm: Single; + FYPixPrmm: Single; + FIsUpdated: Boolean; + procedure FillDefault; + function GetBottomGutter: Integer; + function GetLeftGutter: Integer; + function GetPhysicalHeight: Integer; + function GetPhysicalWidth: Integer; + function GetPrintableHeight: Integer; + function GetPrintableWidth: Integer; + function GetRightGutter: Integer; + function GetTopGutter: Integer; + function GetXPixPrInch: Integer; + function GetYPixPrInch: Integer; + function GetXPixPrmm: Single; + function GetYPixPrmm: Single; + public + procedure UpdatePrinter; + function PixFromLeft(mmValue: Double): Integer; + function PixFromRight(mmValue: Double): Integer; + function PixFromTop(mmValue: Double): Integer; + function PixFromBottom(mmValue: Double): Integer; + property PhysicalWidth: Integer read GetPhysicalWidth; + property PhysicalHeight: Integer read GetPhysicalHeight; + property PrintableWidth: Integer read GetPrintableWidth; + property PrintableHeight: Integer read GetPrintableHeight; + property LeftGutter: Integer read GetLeftGutter; + property RightGutter: Integer read GetRightGutter; + property TopGutter: Integer read GetTopGutter; + property BottomGutter: Integer read GetBottomGutter; + property XPixPrInch: Integer read GetXPixPrInch; + property YPixPrInch: Integer read GetYPixPrInch; + property XPixPrmm: Single read GetXPixPrmm; + property YPixPrmm: Single read GetYPixPrmm; + end; + +implementation + +{ TSynEditPrinterInfo } + +function TSynEditPrinterInfo.PixFromBottom(mmValue: Double): Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := Round(mmValue * FYPixPrmm - FBottomGutter); +end; + +function TSynEditPrinterInfo.PixFromLeft(mmValue: Double): Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := Round(mmValue * FXPixPrmm - FLeftGutter); +end; + +function TSynEditPrinterInfo.PixFromRight(mmValue: Double): Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := Round(mmValue * FXPixPrmm - FRightGutter); +end; + +function TSynEditPrinterInfo.PixFromTop(mmValue: Double): Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := Round(mmValue * FYPixPrmm - FTopGutter); +end; + +procedure TSynEditPrinterInfo.FillDefault; +{In case of no printers installed this information is used + (I think it's taken from a HP LaserJet III with A4 paper)} +begin + FPhysicalWidth := 2481; + FPhysicalHeight := 3507; + FPrintableWidth := 2358; + FPrintableHeight := 3407; + FLeftGutter := 65; + FRightGutter := 58; + FTopGutter := 50; + FBottomGutter := 50; + FXPixPrInch := 300; + FYPixPrInch := 300; + FXPixPrmm := FXPixPrInch / 25.4; + FYPixPrmm := FYPixPrInch / 25.4; +end; + +function TSynEditPrinterInfo.GetBottomGutter: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FBottomGutter; +end; + +function TSynEditPrinterInfo.GetLeftGutter: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FLeftGutter; +end; + +function TSynEditPrinterInfo.GetPhysicalHeight: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FPhysicalHeight; +end; + +function TSynEditPrinterInfo.GetPhysicalWidth: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FPhysicalWidth; +end; + +function TSynEditPrinterInfo.GetPrintableHeight: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FPrintableHeight; +end; + +function TSynEditPrinterInfo.GetPrintableWidth: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FPrintableWidth; +end; + +function TSynEditPrinterInfo.GetRightGutter: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FRightGutter; +end; + +function TSynEditPrinterInfo.GetTopGutter: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FTopGutter; +end; + +function TSynEditPrinterInfo.GetXPixPrInch: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FXPixPrInch; +end; + +function TSynEditPrinterInfo.GetXPixPrmm: Single; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FXPixPrmm; +end; + +function TSynEditPrinterInfo.GetYPixPrInch: Integer; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FYPixPrInch; +end; + +function TSynEditPrinterInfo.GetYPixPrmm: Single; +begin + if not FIsUpdated then + UpdatePrinter; + Result := FYPixPrmm; +end; + +procedure TSynEditPrinterInfo.UpdatePrinter; +begin + FIsUpdated := True; + Printer.Refresh; + if Printer.Printers.Count <= 0 then + begin + FillDefault; + Exit; + end; + FPhysicalWidth := GetDeviceCaps(Printer.Handle, Windows.PhysicalWidth); + FPhysicalHeight := GetDeviceCaps(Printer.Handle, Windows.PhysicalHeight); + FPrintableWidth := Printer.PageWidth; {or GetDeviceCaps(Printer.Handle, HorzRes);} + FPrintableHeight := Printer.PageHeight; {or GetDeviceCaps(Printer.Handle, VertRes);} + FLeftGutter := GetDeviceCaps(Printer.Handle, PhysicalOffsetX); + FTopGutter := GetDeviceCaps(Printer.Handle, PhysicalOffsetY); + FRightGutter := FPhysicalWidth - FPrintableWidth - FLeftGutter; + FBottomGutter := FPhysicalHeight - FPrintableHeight - FTopGutter; + FXPixPrInch := GetDeviceCaps(Printer.Handle, LogPixelsX); + FYPixPrInch := GetDeviceCaps(Printer.Handle, LogPixelsY); + FXPixPrmm := FXPixPrInch / 25.4; + FYPixPrmm := FYPixPrInch / 25.4; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPropertyReg.pas b/Source/VCL/SynEdit/Source/SynEditPropertyReg.pas index 92e92018..78ab90bb 100644 --- a/Source/VCL/SynEdit/Source/SynEditPropertyReg.pas +++ b/Source/VCL/SynEdit/Source/SynEditPropertyReg.pas @@ -1,304 +1,404 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPropertyReg.pas, released 2000-04-07. -The Original Code is based on mwEditPropertyReg.pas, part of the -mwEdit component suite. -Unicode translation by Maël Hörz. -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: SynEditPropertyReg.pas,v 1.17.2.6 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditPropertyReg; - -{$I SynEdit.inc} - -interface - -uses - DesignIntf, - DesignEditors, - VCLEditors, - StrEdit, - SynUnicode, - Classes; - -type - TSynEditFontProperty = class(TFontProperty) - public - procedure Edit; override; - end; - - TSynEditCommandProperty = class(TIntegerProperty) - public - procedure Edit; override; - function GetAttributes: TPropertyAttributes; override; - function GetValue: string; override; - procedure GetValues(Proc: TGetStrProc); override; - procedure SetValue(const Value: string); override; - end; - - TSynEditKeystrokesProperty = class(TClassProperty) - public - procedure Edit; override; - function GetAttributes: TPropertyAttributes; override; - end; - - TSynEditPrintMarginsProperty = class(TClassProperty) - public - procedure Edit; override; - function GetAttributes: TPropertyAttributes; override; - end; - - TAutoCorrectionProperty = class(TPropertyEditor) - public - procedure Edit; override; - function GetAttributes: TPropertyAttributes; override; - function GetValue:string; override; - end; - - TSynAutoCorrectComponentEditor = class(TDefaultEditor) - procedure Edit; override; - procedure ExecuteVerb(Index: Integer); override; - function GetVerb(Index: Integer): string; override; - function GetVerbCount: Integer; override; - end; - -procedure Register; - -implementation - -uses - Dialogs, - Forms, - Graphics, - Controls, - SynEditTypes, - SynEditKeyCmds, - SynEditKeyCmdsEditor, - SynEdit, - SynEditPrint, - SynEditPrintMargins, - SynEditPrintMarginsDialog, - SynCompletionProposal, - SynMacroRecorder, - SynAutoCorrect, - SynAutoCorrectEditor, - SysUtils; - -{ TSynEditFontProperty } - -procedure TSynEditFontProperty.Edit; -const - { context ids for the Font editor } - hcDFontEditor = 25000; -var - FontDialog: TFontDialog; -begin - FontDialog := TFontDialog.Create(Application); - try - FontDialog.Font := TFont(GetOrdValue); - FontDialog.HelpContext := hcDFontEditor; - FontDialog.Options := FontDialog.Options + [fdShowHelp, fdForceFontExist, - fdFixedPitchOnly]; - if FontDialog.Execute then - SetOrdValue(NativeInt(FontDialog.Font)); - finally - FontDialog.Free; - end; -end; - -{ TSynEditCommandProperty } - -procedure TSynEditCommandProperty.Edit; -begin - ShowMessage('I''m thinking that this will show a dialog that has a list'#13#10+ - 'of all editor commands and a description of them to choose from.'); -end; - -function TSynEditCommandProperty.GetAttributes: TPropertyAttributes; -begin - Result := [paMultiSelect, paDialog, paValueList, paRevertable]; -end; - -function TSynEditCommandProperty.GetValue: string; -begin - Result := EditorCommandToCodeString(TSynEditorCommand(GetOrdValue)); -end; - -procedure TSynEditCommandProperty.GetValues(Proc: TGetStrProc); -begin - GetEditorCommandValues(Proc); -end; - -procedure TSynEditCommandProperty.SetValue(const Value: string); -var - NewValue: Integer; -begin - if IdentToEditorCommand(Value, NewValue) then - SetOrdValue(NewValue) - else - inherited SetValue(Value); -end; - -{ TSynEditKeystrokesProperty } - -procedure TSynEditKeystrokesProperty.Edit; -var - Dlg: TSynEditKeystrokesEditorForm; -begin - Application.CreateForm(TSynEditKeystrokesEditorForm, Dlg); - try - Dlg.Caption := Self.GetName; - Dlg.Keystrokes := TSynEditKeystrokes(GetOrdValue); - if Dlg.ShowModal = mrOk then - begin - { SetOrdValue will operate on all selected propertiy values } - SetOrdValue(NativeInt(Dlg.Keystrokes)); - Modified; - end; - finally - Dlg.Free; - end; -end; - -function TSynEditKeystrokesProperty.GetAttributes: TPropertyAttributes; -begin - Result := [paDialog, paReadOnly]; -end; - -{ TSynEditPrintMarginsProperty } - -procedure TSynEditPrintMarginsProperty.Edit; -var - SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg; -begin - SynEditPrintMarginsDlg := TSynEditPrintMarginsDlg.Create(nil); - try - SynEditPrintMarginsDlg.SetMargins(TSynEditPrintMargins(GetOrdValue)); - if SynEditPrintMarginsDlg.ShowModal = mrOk then - SynEditPrintMarginsDlg.GetMargins(TSynEditPrintMargins(GetOrdValue)); - finally - SynEditPrintMarginsDlg.Free; - end; -end; - -function TSynEditPrintMarginsProperty.GetAttributes: TPropertyAttributes; -begin - Result := [paDialog, paSubProperties, paReadOnly, paSortList]; -end; - -procedure TSynAutoCorrectComponentEditor.Edit; -var - frmAutoCorrectEditor: TfrmAutoCorrectEditor; -begin - frmAutoCorrectEditor := TfrmAutoCorrectEditor.Create(Application); - try - frmAutoCorrectEditor.SynAutoCorrect := TSynAutoCorrect(Component); - frmAutoCorrectEditor.ShowModal; - finally - frmAutoCorrectEditor.Free; - end; - Designer.Modified; -end; - -procedure TSynAutoCorrectComponentEditor.ExecuteVerb(Index: Integer); -begin - case Index of - 0: Edit; - end; -end; - -function TSynAutoCorrectComponentEditor.GetVerb(Index: Integer): string; -begin - case Index of - 0: Result := '&Edit...'; - end; -end; - -function TSynAutoCorrectComponentEditor.GetVerbCount: Integer; -begin - Result := 1; -end; - -procedure TAutoCorrectionProperty.Edit; -var - frmAutoCorrectEditor: TfrmAutoCorrectEditor; -begin - frmAutoCorrectEditor := TfrmAutoCorrectEditor.Create(Application); - try - frmAutoCorrectEditor.SynAutoCorrect := TSynAutoCorrect(GetComponent(0)); - frmAutoCorrectEditor.ShowModal; - finally - frmAutoCorrectEditor.Free; - end; - Designer.Modified; -end; - -function TAutoCorrectionProperty.GetAttributes: TPropertyAttributes; -begin - GetAttributes := [paDialog, paReadOnly]; -end; - -function TAutoCorrectionProperty.GetValue: string; -begin - GetValue := '(AutoCorrections)'; -end; - - -{ Register } - -procedure Register; -begin - RegisterPropertyEditor(TypeInfo(WideChar), nil, - '', TCharProperty); - RegisterPropertyEditor(TypeInfo(TStrings), nil, - '', TStringListProperty); - - RegisterPropertyEditor(TypeInfo(TFont), TCustomSynEdit, - 'Font', TSynEditFontProperty); - RegisterPropertyEditor(TypeInfo(TSynEditorCommand), nil, - '', TSynEditCommandProperty); - RegisterPropertyEditor(TypeInfo(TSynEditKeystrokes), nil, - '', TSynEditKeystrokesProperty); - RegisterPropertyEditor(TypeInfo(TSynEditPrintMargins), TPersistent, - '', TSynEditPrintMarginsProperty); - RegisterPropertyEditor(TypeInfo(TStrings), TSynAutoCorrect, - 'Items', TAutoCorrectionProperty); - RegisterComponentEditor(TSynAutoCorrect, TSynAutoCorrectComponentEditor); - RegisterPropertyEditor(TypeInfo(TShortCut), TSynCompletionProposal, '', - TShortCutProperty); - RegisterPropertyEditor(TypeInfo(TShortCut), TSynAutoComplete, '', - TShortCutProperty); - RegisterPropertyEditor(TypeInfo(TShortCut), TSynMacroRecorder, '', - TShortCutProperty); -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPropertyReg.pas, released 2000-04-07. +The Original Code is based on mwEditPropertyReg.pas, part of the +mwEdit component suite. +Unicode translation by Maël Hörz. +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: SynEditPropertyReg.pas,v 1.17.2.6 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITPROPERTYREG} +unit SynEditPropertyReg; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses +{$IFDEF SYN_COMPILER_6_UP} + DesignIntf, + DesignEditors, + VCLEditors, + StrEdit, +{$ELSE} + DsgnIntf, + StrEdit, +{$ENDIF} + SynUnicode, +{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} + TntClasses, + TntStrEdit_Design, +{$ENDIF} + Classes; + +type +{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} + // Wrapper around TUnicodeStringListProperty to enable the TNT property editor to + // handle TUnicodeStrings + TSynUnicodeStringListProperty = class(TWideStringListProperty) + private + FUnicodeStrings: TUnicodeStrings; + FTntStrings: TTntStrings; + protected + function GetStrings: TTntStrings; override; + procedure SetStrings(const Value: TTntStrings); override; + public +{$IFDEF SYN_COMPILER_6_UP} + constructor Create(const ADesigner: IDesigner; APropCount: Integer); override; +{$ELSE} + constructor Create(const ADesigner: IFormDesigner; APropCount: Integer); override; +{$ENDIF} + destructor Destroy; override; + end; +{$ENDIF} + + TSynEditFontProperty = class(TFontProperty) + public + procedure Edit; override; + end; + + TSynEditCommandProperty = class(TIntegerProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + function GetValue: string; override; + procedure GetValues(Proc: TGetStrProc); override; + procedure SetValue(const Value: string); override; + end; + + TSynEditKeystrokesProperty = class(TClassProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + end; + + TSynEditPrintMarginsProperty = class(TClassProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + end; + + TAutoCorrectionProperty = class(TPropertyEditor) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + function GetValue: string; override; + end; + + TSynAutoCorrectComponentEditor = class(TDefaultEditor) + procedure Edit; override; + procedure ExecuteVerb(Index: Integer); override; + function GetVerb(Index: Integer): string; override; + function GetVerbCount: Integer; override; + end; + +procedure Register; + +implementation + +uses + Dialogs, + Forms, + Graphics, + Controls, + SynEditKeyCmds, + SynEditKeyCmdsEditor, + SynEdit, + SynEditPrint, + SynEditPrintMargins, + SynEditPrintMarginsDialog, + SynCompletionProposal, + SynMacroRecorder, + SynAutoCorrect, + SynAutoCorrectEditor, + SysUtils; + +{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} + +{ TSynUnicodeStringListProperty } + +{$IFDEF SYN_COMPILER_6_UP} +constructor TSynUnicodeStringListProperty.Create(const ADesigner: IDesigner; APropCount: Integer); +{$ELSE} +constructor TSynUnicodeStringListProperty.Create(const ADesigner: IFormDesigner; APropCount: Integer); +{$ENDIF} +begin + inherited; + FUnicodeStrings := TUnicodeStringList.Create; + FTntStrings := TTntStringList.Create; +end; + +destructor TSynUnicodeStringListProperty.Destroy; +begin + FTntStrings.Free; + FUnicodeStrings.Free; + inherited; +end; + +function TSynUnicodeStringListProperty.GetStrings: TTntStrings; +var + UnicodeStrings: TUnicodeStrings; + i: Integer; +begin + UnicodeStrings := TUnicodeStrings(GetOrdValue); + + FTntStrings.Clear; + FTntStrings.BeginUpdate; + try + for i := 0 to UnicodeStrings.Count - 1 do + FTntStrings.AddObject(UnicodeStrings[i], UnicodeStrings.Objects[i]); + finally + FTntStrings.EndUpdate; + end; + Result := FTntStrings; +end; + +procedure TSynUnicodeStringListProperty.SetStrings(const Value: TTntStrings); +var + i: Integer; +begin + FUnicodeStrings.Clear; + FUnicodeStrings.BeginUpdate; + try + for i := 0 to Value.Count - 1 do + FUnicodeStrings.AddObject(Value[I], Value.Objects[I]); + finally + FUnicodeStrings.EndUpdate; + end; + SetOrdValue(Longint(FUnicodeStrings)); +end; +{$ENDIF} + + +{ TSynEditFontProperty } + +procedure TSynEditFontProperty.Edit; +const + { context ids for the Font editor } + hcDFontEditor = 25000; +var + FontDialog: TFontDialog; +begin + FontDialog := TFontDialog.Create(Application); + try + FontDialog.Font := TFont(GetOrdValue); + FontDialog.HelpContext := hcDFontEditor; + FontDialog.Options := FontDialog.Options + [fdShowHelp, fdForceFontExist, + fdFixedPitchOnly]; + if FontDialog.Execute then + SetOrdValue(Longint(FontDialog.Font)); + finally + FontDialog.Free; + end; +end; + +{ TSynEditCommandProperty } + +procedure TSynEditCommandProperty.Edit; +begin + ShowMessage('I''m thinking that this will show a dialog that has a list'#13#10+ + 'of all editor commands and a description of them to choose from.'); +end; + +function TSynEditCommandProperty.GetAttributes: TPropertyAttributes; +begin + Result := [paMultiSelect, paDialog, paValueList, paRevertable]; +end; + +function TSynEditCommandProperty.GetValue: string; +begin + Result := EditorCommandToCodeString(TSynEditorCommand(GetOrdValue)); +end; + +procedure TSynEditCommandProperty.GetValues(Proc: TGetStrProc); +begin + GetEditorCommandValues(Proc); +end; + +procedure TSynEditCommandProperty.SetValue(const Value: string); +var + NewValue: longint; +begin + if IdentToEditorCommand(Value, NewValue) then + SetOrdValue(NewValue) + else + inherited SetValue(Value); +end; + +{ TSynEditKeystrokesProperty } + +procedure TSynEditKeystrokesProperty.Edit; +var + Dlg: TSynEditKeystrokesEditorForm; +begin + Application.CreateForm(TSynEditKeystrokesEditorForm, Dlg); + try + Dlg.Caption := Self.GetName; + Dlg.Keystrokes := TSynEditKeystrokes(GetOrdValue); + if Dlg.ShowModal = mrOk then + begin + { SetOrdValue will operate on all selected propertiy values } + SetOrdValue(Longint(Dlg.Keystrokes)); + Modified; + end; + finally + Dlg.Free; + end; +end; + +function TSynEditKeystrokesProperty.GetAttributes: TPropertyAttributes; +begin + Result := [paDialog, paReadOnly]; +end; + +{ TSynEditPrintMarginsProperty } + +procedure TSynEditPrintMarginsProperty.Edit; +var + SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg; +begin + SynEditPrintMarginsDlg := TSynEditPrintMarginsDlg.Create(nil); + try + SynEditPrintMarginsDlg.SetMargins(TSynEditPrintMargins(GetOrdValue)); + if SynEditPrintMarginsDlg.ShowModal = mrOk then + SynEditPrintMarginsDlg.GetMargins(TSynEditPrintMargins(GetOrdValue)); + finally + SynEditPrintMarginsDlg.Free; + end; +end; + +function TSynEditPrintMarginsProperty.GetAttributes: TPropertyAttributes; +begin + Result := [paDialog, paSubProperties, paReadOnly, paSortList]; +end; + +procedure TSynAutoCorrectComponentEditor.Edit; +var + frmAutoCorrectEditor: TfrmAutoCorrectEditor; +begin + frmAutoCorrectEditor := TfrmAutoCorrectEditor.Create(Application); + try + frmAutoCorrectEditor.SynAutoCorrect := TSynAutoCorrect(Component); + frmAutoCorrectEditor.ShowModal; + finally + frmAutoCorrectEditor.Free; + end; + Designer.Modified; +end; + +procedure TSynAutoCorrectComponentEditor.ExecuteVerb(Index: Integer); +begin + case Index of + 0: Edit; + end; +end; + +function TSynAutoCorrectComponentEditor.GetVerb(Index: Integer): string; +begin + case Index of + 0: Result := '&Edit...'; + end; +end; + +function TSynAutoCorrectComponentEditor.GetVerbCount: Integer; +begin + Result := 1; +end; + +procedure TAutoCorrectionProperty.Edit; +var + frmAutoCorrectEditor: TfrmAutoCorrectEditor; +begin + frmAutoCorrectEditor := TfrmAutoCorrectEditor.Create(Application); + try + frmAutoCorrectEditor.SynAutoCorrect := TSynAutoCorrect(GetComponent(0)); + frmAutoCorrectEditor.ShowModal; + finally + frmAutoCorrectEditor.Free; + end; + Designer.Modified; +end; + +function TAutoCorrectionProperty.GetAttributes: TPropertyAttributes; +begin + GetAttributes := [paDialog, paReadOnly]; +end; + +function TAutoCorrectionProperty.GetValue: string; +begin + GetValue := '(AutoCorrections)'; +end; + + +{ Register } + +procedure Register; +begin +// TODO: Delphi 2005 has native Unicode property editors, we should use them (but I don't have D2005 to test) +{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} + // Troy Wolbrink added my (Maël Hörz) WideChar property editor to + // TntUnicodeStringProperty_Design.pas. + // As it is registered there, no need to do it a second time here. + // However as he uses TTntStrings and we use TUnicodeStrings, we need + // a wrapper to do the "translation". + RegisterPropertyEditor(TypeInfo(TUnicodeStrings), nil, + '', TSynUnicodeStringListProperty); +{$ELSE} + RegisterPropertyEditor(TypeInfo(WideChar), nil, + '', TCharProperty); + RegisterPropertyEditor(TypeInfo(TUnicodeStrings), nil, + '', TStringListProperty); +{$ENDIF} + + RegisterPropertyEditor(TypeInfo(TFont), TCustomSynEdit, + 'Font', TSynEditFontProperty); + RegisterPropertyEditor(TypeInfo(TSynEditorCommand), nil, + '', TSynEditCommandProperty); + RegisterPropertyEditor(TypeInfo(TSynEditKeystrokes), nil, + '', TSynEditKeystrokesProperty); + RegisterPropertyEditor(TypeInfo(TSynEditPrintMargins), TPersistent, + '', TSynEditPrintMarginsProperty); + RegisterPropertyEditor(TypeInfo(TStrings), TSynAutoCorrect, + 'Items', TAutoCorrectionProperty); + RegisterComponentEditor(TSynAutoCorrect, TSynAutoCorrectComponentEditor); + {$IFDEF SYN_DELPHI_6_UP} // TODO: shouldn't that be COMPILER_6_UP instead? + RegisterPropertyEditor(TypeInfo(TShortCut), TSynCompletionProposal, '', + TShortCutProperty); + RegisterPropertyEditor(TypeInfo(TShortCut), TSynAutoComplete, '', + TShortCutProperty); + RegisterPropertyEditor(TypeInfo(TShortCut), TSynMacroRecorder, '', + TShortCutProperty); + {$ENDIF} +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditPythonBehaviour.pas b/Source/VCL/SynEdit/Source/SynEditPythonBehaviour.pas index b35f2cb5..8627b99c 100644 --- a/Source/VCL/SynEdit/Source/SynEditPythonBehaviour.pas +++ b/Source/VCL/SynEdit/Source/SynEditPythonBehaviour.pas @@ -1,125 +1,130 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditPythonBehaviour.pas, released 2000-06-23. -The Original Code is based on odPythonBehaviour.pas by Olivier Deckmyn, part -of the mwEdit component suite. -Unicode translation by Maël Hörz. - -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: SynEditPythonBehaviour.pas,v 1.5.2.3 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a component which implements editing rules to apply to a Python source file) -@author(Olivier Deckmyn, converted to SynEdit by David Muir ) -@created(1999-10-17) -@lastmod(May 19, 2000) -The SynEditPythonBehaviour unit provides a simple component implements editing rules to apply -to a python source file. Python has a unusual way to mark blocks (like begin/end in pascal) : it -uses indentation. So the rule is after a ":" and a line break, we have to indent once. -} -unit SynEditPythonBehaviour; - -{$I SynEdit.inc} - -interface - -uses - Windows, Messages, Graphics, Controls, Forms, Dialogs, SynEdit, SynEditKeyCmds, - SynUnicode, SysUtils, Classes, SynEditTypes; - -type - TSynEditPythonBehaviour = class(TComponent) - private - FEditor: TSynEdit; - fIndent: integer; - protected - procedure SetEditor(Value: TSynEdit); virtual; - procedure doProcessUserCommand(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; - var AChar: WideChar; Data: Pointer; HandlerData: Pointer); virtual; - public - constructor Create(aOwner: TComponent); override; - published - property Editor: TSynEdit read FEditor write SetEditor; - property Indent: integer read fIndent write fIndent default 4; - end; - -implementation - -uses - SynEditStrConst; - -procedure TSynEditPythonBehaviour.SetEditor(Value: TSynEdit); -begin - if FEditor <> Value then - begin - if (Editor <> nil) and not (csDesigning in ComponentState) then - Editor.UnregisterCommandHandler(doProcessUserCommand); - // Set the new editor - FEditor := Value; - if (Editor <> nil) and not (csDesigning in ComponentState) then - Editor.RegisterCommandHandler(doProcessUserCommand, nil); - end; -end; - -procedure TSynEditPythonBehaviour.doProcessUserCommand(Sender: TObject; - AfterProcessing: boolean; var Handled: boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer; - HandlerData: pointer); -var - iEditor: TCustomSynEdit; - iPrevLine: string; - cSpace: integer; -begin - if (Command = ecLineBreak) and AfterProcessing then - begin - iEditor := Sender as TCustomSynEdit; - { CaretY should never be lesser than 2 right after ecLineBreak, so there's - no need for a check } - iPrevLine := TrimRight(iEditor.Lines[iEditor.CaretY - 2]); - if (iPrevLine <> '') and (iPrevLine[Length(iPrevLine)] = ':') then - begin - iEditor.UndoList.BeginBlock; - try - for cSpace := 1 to Indent do - iEditor.ExecuteCommand(ecChar, #32, nil); - finally - iEditor.UndoList.EndBlock; - end; - end; - end; -end; - -constructor TSynEditPythonBehaviour.Create(aOwner: TComponent); -begin - inherited Create(AOwner); - fIndent := 4; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditPythonBehaviour.pas, released 2000-06-23. +The Original Code is based on odPythonBehaviour.pas by Olivier Deckmyn, part +of the mwEdit component suite. +Unicode translation by Maël Hörz. + +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: SynEditPythonBehaviour.pas,v 1.5.2.3 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a component which implements editing rules to apply to a Python source file) +@author(Olivier Deckmyn, converted to SynEdit by David Muir ) +@created(1999-10-17) +@lastmod(May 19, 2000) +The SynEditPythonBehaviour unit provides a simple component implements editing rules to apply +to a python source file. Python has a unusual way to mark blocks (like begin/end in pascal) : it +uses indentation. So the rule is after a ":" and a line break, we have to indent once. +} +{$IFNDEF QSYNEDITPYTHONBEHAVIOUR} +unit SynEditPythonBehaviour; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, Graphics, Controls, Forms, Dialogs, + SynEdit, + SynEditKeyCmds, + SynUnicode, + SysUtils, + Classes; + +type + TSynEditPythonBehaviour = class(TComponent) + private + FEditor: TSynEdit; + FIndent: Integer; + protected + procedure SetEditor(Value: TSynEdit); virtual; + procedure doProcessUserCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; + var AChar: WideChar; Data: Pointer; HandlerData: Pointer); virtual; + public + constructor Create(aOwner: TComponent); override; + published + property Editor: TSynEdit read FEditor write SetEditor; + property Indent: Integer read FIndent write FIndent default 4; + end; + +implementation + +uses + SynEditStrConst; + +procedure TSynEditPythonBehaviour.SetEditor(Value: TSynEdit); +begin + if FEditor <> Value then + begin + if (Editor <> nil) and not (csDesigning in ComponentState) then + Editor.UnregisterCommandHandler(doProcessUserCommand); + // Set the new editor + FEditor := Value; + if (Editor <> nil) and not (csDesigning in ComponentState) then + Editor.RegisterCommandHandler(doProcessUserCommand, nil); + end; +end; + +procedure TSynEditPythonBehaviour.doProcessUserCommand(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer; + HandlerData: Pointer); +var + iEditor: TCustomSynEdit; + iPrevLine: UnicodeString; + cSpace: Integer; +begin + if (Command = ecLineBreak) and AfterProcessing then + begin + iEditor := Sender as TCustomSynEdit; + { CaretY should never be lesser than 2 right after ecLineBreak, so there's + no need for a check } + iPrevLine := WideTrimRight(iEditor.Lines[iEditor.CaretY - 2]); + if (iPrevLine <> '') and (iPrevLine[Length(iPrevLine)] = ':') then + begin + iEditor.UndoList.BeginBlock; + try + for cSpace := 1 to Indent do + iEditor.ExecuteCommand(ecChar, #32, nil); + finally + iEditor.UndoList.EndBlock; + end; + end; + end; +end; + +constructor TSynEditPythonBehaviour.Create(aOwner: TComponent); +begin + inherited Create(AOwner); + FIndent := 4; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditReg.dcr b/Source/VCL/SynEdit/Source/SynEditReg.dcr index e9907999..b5f15015 100644 Binary files a/Source/VCL/SynEdit/Source/SynEditReg.dcr and b/Source/VCL/SynEdit/Source/SynEditReg.dcr differ diff --git a/Source/VCL/SynEdit/Source/SynEditReg.pas b/Source/VCL/SynEdit/Source/SynEditReg.pas index ad239bf4..6b054cfe 100644 --- a/Source/VCL/SynEdit/Source/SynEditReg.pas +++ b/Source/VCL/SynEdit/Source/SynEditReg.pas @@ -1,186 +1,212 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditReg.pas, released 2000-04-07. -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: SynEditReg.pas,v 1.33.2.2 2004/10/18 15:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditReg; - -{$I SynEdit.inc} - -interface - -uses - // SynEdit components - SynEdit, - SynDBEdit, - SynEditStrConst, - SynEditHighlighter, - SynEditMiscClasses, - SynEditPlugins, - SynEditExport, - SynExportHTML, - SynExportRTF, - SynExportTeX, - SynHighlighterMulti, - SynCompletionProposal, - SynEditPythonBehaviour, - SynEditPrint, - SynEditPrintPreview, - SynMacroRecorder, - SynAutoCorrect, - SynEditSearch, - SynEditRegexSearch, - SynHighlighterManager, - SynEditOptionsDialog, - SynHighlighterADSP21xx, - SynHighlighterAsm, - SynHighlighterAWK, - SynHighlighterBaan, - SynHighlighterBat, - SynHighlighterCAC, - SynHighlighterCache, - SynHighlighterCobol, - SynHighlighterCpp, - SynHighlighterCS, - SynHighlighterCss, - SynHighlighterDfm, - SynHighlighterDml, - SynHighlighterDOT, - SynHighlighterDWS, - SynHighlighterEiffel, - SynHighlighterFortran, - SynHighlighterFoxpro, - SynHighlighterGalaxy, - SynHighlighterGeneral, - SynHighlighterHaskell, - SynHighlighterHC11, - SynHighlighterHP48, - SynHighlighterHtml, - SynHighlighterIni, - SynHighlighterInno, - SynHighlighterJava, - SynHighlighterJScript, - SynHighlighterJSON, - SynHighlighterKix, - SynHighlighterModelica, - SynHighlighterM3, - SynHighlighterPas, - SynHighlighterPerl, - SynHighlighterPHP, - SynHighlighterProgress, - SynHighlighterPython, - SynHighlighterRC, - SynHighlighterRuby, - SynHighlighterSml, - SynHighlighterSQL, - SynHighlighterTclTk, - SynHighlighterTeX, - SynHighlighterUNIXShellScript, - SynHighlighterURI, - SynHighlighterVB, - SynHighlighterVBScript, - SynHighlighterVrml97, - SynHighlighterGWS, - SynHighlighterCPM, - SynHighlighterSDD, - SynHighlighterXML, - SynHighlighterMsg, - SynHighlighterIDL, - SynHighlighterUnreal, - SynHighlighterST, - SynHighlighterLDraw, - SynURIOpener, - Classes; - -procedure Register; - -implementation - -procedure Register; -begin -// SynEdit main components - RegisterComponents(SYNS_ComponentsPage, [TSynEdit]); - - RegisterComponents(SYNS_ComponentsPage, [TDBSynEdit]); - - GroupDescendentsWith(TSynCustomHighlighter, TSynEdit); - GroupDescendentsWith(TSynEditSearchCustom, TSynEdit); - GroupDescendentsWith(TSynCustomExporter, TSynEdit); - GroupDescendentsWith(TSynMultiSyn, TSynEdit); - GroupDescendentsWith(TSynBaseCompletionProposal, TSynEdit); - GroupDescendentsWith(TSynAutoComplete, TSynEdit); - GroupDescendentsWith(TAbstractSynPlugin, TSynEdit); - GroupDescendentsWith(TCustomSynAutoCorrect, TSynEdit); - GroupDescendentsWith(TSynEditPrint, TSynEdit); - GroupDescendentsWith(TSynEditPrintPreview, TSynEdit); - GroupDescendentsWith(TSynEditPythonBehaviour, TSynEdit); - GroupDescendentsWith(TSynHighlighterManager, TSynEdit); - GroupDescendentsWith(TSynEditOptionsDialog, TSynEdit); - GroupDescendentsWith(TSynURIOpener, TSynEdit); - -// SynEdit extra components - RegisterComponents(SYNS_ComponentsPage, [TSynExporterHTML, TSynExporterRTF, - TSynExporterTeX, TSynEditPythonBehaviour, TSynMultiSyn, - TSynCompletionProposal, TSynAutoComplete, TSynMacroRecorder, - TSynEditPrint, TSynEditPrintPreview, TSynAutoCorrect, - TSynEditSearch, TSynEditRegexSearch, TSynEditOptionsDialog, TSynURIOpener]); - RegisterComponents(SYNS_ComponentsPage, [TSynHighlighterManager]); - -// SynEdit highlighters - RegisterComponents(SYNS_HighlightersPage, [ - //classic - TSynCppSyn, TSynEiffelSyn, TSynFortranSyn, TSynGeneralSyn, TSynJavaSyn, - TSynM3Syn, TSynPasSyn, TSynVBSyn, TSynCobolSyn, TSynCSSyn, - // internet - TSynCssSyn, TSynHTMLSyn, TSynJScriptSyn, TSynPHPSyn, TSynVBScriptSyn, - TSynXMLSyn, TSynJSONSyn, TSynVrml97Syn, - //interpreted - TSynAWKSyn, TSynBATSyn, - TSynDWSSyn, - TSynKixSyn, TSynPerlSyn, TSynPythonSyn, - TSynTclTkSyn, TSynGWScriptSyn, TSynRubySyn, TSynUNIXShellScriptSyn, - //database - TSynCACSyn, TSynCacheSyn, TSynFoxproSyn, TSynSQLSyn, TSynSDDSyn, - //assembler - TSynADSP21xxSyn, TSynAsmSyn, TSynHC11Syn, TSynHP48Syn, TSynSTSyn, - //data modeling - TSynDmlSyn, TSynModelicaSyn, TSynSMLSyn, - //data - TSynDfmSyn, TSynIniSyn, TSynInnoSyn, - // other - TSynBaanSyn, TSynGalaxySyn, TSynProgressSyn, TSynMsgSyn, - TSynIdlSyn, TSynUnrealSyn, TSynCPMSyn, TSynTeXSyn, - TSynHaskellSyn, TSynLDRSyn, TSynURISyn, TSynDOTSyn, TSynRCSyn - ]); -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditReg.pas, released 2000-04-07. +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: SynEditReg.pas,v 1.33.2.2 2004/10/18 15:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynEditReg; + +{$I SynEdit.inc} + +interface + +uses + // SynEdit components + SynEdit, + SynMemo, + SynEditDocumentManager, + {$IFNDEF SYN_DELPHI_PE} + SynDBEdit, + {$ENDIF} + SynEditStrConst, + SynEditHighlighter, + SynEditMiscClasses, + SynEditPlugins, + SynEditExport, + SynExportHTML, + SynExportRTF, + SynExportTeX, + SynHighlighterMulti, + SynCompletionProposal, + SynEditPythonBehaviour, + SynEditPrint, + SynEditPrintPreview, + SynMacroRecorder, + SynAutoCorrect, + SynEditSearch, + SynEditRegexSearch, + {$IFDEF SYN_COMPILER_4_UP} + SynHighlighterManager, + {$ENDIF} + SynEditOptionsDialog, + SynHighlighterADSP21xx, + SynHighlighterAsm, + SynHighlighterAWK, + SynHighlighterBaan, + SynHighlighterBat, + SynHighlighterCAC, + SynHighlighterCache, + SynHighlighterCobol, + SynHighlighterCpp, + SynHighlighterCS, + SynHighlighterCss, + SynHighlighterDfm, + SynHighlighterDml, + SynHighlighterDOT, + {$ifdef SYN_DELPHI_2010_UP} + SynHighlighterAsmMASM, + {$endif} + {$ifdef SYN_DELPHI_2009_UP} + SynHighlighterDWS, + {$endif} + SynHighlighterECMAScript, + SynHighlighterEiffel, + SynHighlighterFortran, + SynHighlighterFoxpro, + SynHighlighterGalaxy, + SynHighlighterGeneral, + SynHighlighterGo, + SynHighlighterGLSL, + SynHighlighterHaskell, + SynHighlighterHC11, + SynHighlighterHP48, + SynHighlighterHtml, + SynHighlighterIni, + SynHighlighterInno, + SynHighlighterJava, + SynHighlighterJScript, + SynHighlighterJSON, + SynHighlighterKix, + SynHighlighterModelica, + SynHighlighterM3, + SynHighlighterPas, + SynHighlighterPerl, + SynHighlighterPHP, + SynHighlighterProgress, + SynHighlighterPython, + SynHighlighterRC, + SynHighlighterRuby, + SynHighlighterSml, + SynHighlighterSQL, + SynHighlighterTclTk, + SynHighlighterTeX, + SynHighlighterUNIXShellScript, + SynHighlighterURI, + SynHighlighterVB, + SynHighlighterVBScript, + SynHighlighterVrml97, + SynHighlighterGWS, + SynHighlighterCPM, + SynHighlighterSDD, + SynHighlighterXML, + SynHighlighterMsg, + SynHighlighterIDL, + SynHighlighterUnreal, + SynHighlighterST, + SynHighlighterLDraw, + SynURIOpener, + Classes; + +procedure Register; + +implementation + +procedure Register; +begin +// SynEdit main components + RegisterComponents(SYNS_ComponentsPage, [TSynEdit, TSynMemo]); + +{$IFNDEF SYN_DELPHI_PE} + RegisterComponents(SYNS_ComponentsPage, [TDBSynEdit]); +{$ENDIF} + +{$IFDEF SYN_COMPILER_6_UP} + GroupDescendentsWith(TSynCustomHighlighter, TSynEdit); + GroupDescendentsWith(TSynEditSearchCustom, TSynEdit); + GroupDescendentsWith(TSynCustomExporter, TSynEdit); + GroupDescendentsWith(TSynMultiSyn, TSynEdit); + GroupDescendentsWith(TSynBaseCompletionProposal, TSynEdit); + GroupDescendentsWith(TSynAutoComplete, TSynEdit); + GroupDescendentsWith(TAbstractSynPlugin, TSynEdit); + GroupDescendentsWith(TCustomSynAutoCorrect, TSynEdit); + GroupDescendentsWith(TSynEditPrint, TSynEdit); + GroupDescendentsWith(TSynEditPrintPreview, TSynEdit); + GroupDescendentsWith(TSynEditPythonBehaviour, TSynEdit); + GroupDescendentsWith(TSynHighlighterManager, TSynEdit); + GroupDescendentsWith(TSynEditOptionsDialog, TSynEdit); + GroupDescendentsWith(TSynURIOpener, TSynEdit); +{$ENDIF} + +// SynEdit extra components + RegisterComponents(SYNS_ComponentsPage, [TSynExporterHTML, TSynExporterRTF, + TSynExporterTeX, TSynEditPythonBehaviour, TSynMultiSyn, + TSynCompletionProposal, TSynAutoComplete, TSynMacroRecorder, + TSynEditPrint, TSynEditPrintPreview, TSynAutoCorrect, + TSynEditSearch, TSynEditRegexSearch, TSynEditOptionsDialog, TSynURIOpener, + TSynEditDocumentManager]); +{$IFDEF SYN_COMPILER_4_UP} + RegisterComponents(SYNS_ComponentsPage, [TSynHighlighterManager]); +{$ENDIF} + +// SynEdit highlighters + RegisterComponents(SYNS_HighlightersPage, [ + //classic + TSynCppSyn, TSynEiffelSyn, TSynFortranSyn, TSynGeneralSyn, TSynJavaSyn, + TSynM3Syn, TSynPasSyn, TSynVBSyn, TSynCobolSyn, TSynCSSyn, TSynGoSyn, + // internet + TSynCssSyn, TSynHTMLSyn, TSynJScriptSyn, TSynPHPSyn, TSynVBScriptSyn, + TSynXMLSyn, TSynJSONSyn, TSynVrml97Syn, TSynECMAScriptSyn, + //interpreted + TSynAWKSyn, TSynBATSyn, + {$ifdef SYN_DELPHI_2009_UP} + TSynDWSSyn, + {$endif} + TSynKixSyn, TSynPerlSyn, TSynPythonSyn, TSynGLSLSyn, + TSynTclTkSyn, TSynGWScriptSyn, TSynRubySyn, TSynUNIXShellScriptSyn, + //database + TSynCACSyn, TSynCacheSyn, TSynFoxproSyn, TSynSQLSyn, TSynSDDSyn, + //assembler + TSynADSP21xxSyn, TSynAsmSyn, TSynHC11Syn, TSynHP48Syn, TSynSTSyn, + {$ifdef SYN_DELPHI_2010_UP} + TSynAsmMASMSyn, + {$endif} + //data modeling + TSynDmlSyn, TSynModelicaSyn, TSynSMLSyn, + //data + TSynDfmSyn, TSynIniSyn, TSynInnoSyn, + // other + TSynBaanSyn, TSynGalaxySyn, TSynProgressSyn, TSynMsgSyn, + TSynIdlSyn, TSynUnrealSyn, TSynCPMSyn, TSynTeXSyn, + TSynHaskellSyn, TSynLDRSyn, TSynURISyn, TSynDOTSyn, TSynRCSyn + ]); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditRegexSearch.pas b/Source/VCL/SynEdit/Source/SynEditRegexSearch.pas index 72fd5d96..a8a3dd7d 100644 --- a/Source/VCL/SynEdit/Source/SynEditRegexSearch.pas +++ b/Source/VCL/SynEdit/Source/SynEditRegexSearch.pas @@ -1,160 +1,156 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditRegexSearch.pas, released 2002-07-26. - -Original Code by Eduardo Mauro, Gerald Nunn and Flávio Etrusco. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditRegexSearch.pas,v 1.5.2.2 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditRegexSearch; - -{$I SynEdit.inc} - -interface - -uses - SynEditTypes, - RegularExpressions, - RegularExpressionsCore, - SynEditMiscClasses, - SynUnicode, - Classes; - -type - TSynEditRegexSearch = class(TSynEditSearchCustom) - private - RegEx : TRegEx; - fMatchCollection: TMatchCollection; - fOptions : TRegExOptions; - fPattern: String; - protected - function GetPattern: string; override; - procedure SetPattern(const Value: string); override; - procedure SetOptions(const Value: TSynSearchOptions); override; - function GetLength(Index: Integer): Integer; override; - function GetResult(Index: Integer): Integer; override; - function GetResultCount: Integer; override; - public - constructor Create(AOwner: TComponent); override; - function FindAll(const NewText: string): Integer; override; - function Replace(const aOccurrence, aReplacement: string): string; override; - end; - - ESynRegEx = ERegularExpressionError; - -implementation - -uses - RegularExpressionsAPI, - Consts; - - -type - { TPerlRegExHelper } - - TPerlRegExHelper = class helper for TPerlRegEx - procedure SetAdditionalPCREOptions(PCREOptions : Integer); - end; - -procedure TPerlRegExHelper.SetAdditionalPCREOptions(PCREOptions: Integer); -begin - with Self do FPCREOptions := FPCREOptions or PCREOptions; -end; - -type - TRegExHelper = record helper for TRegEx - public - procedure SetAdditionalPCREOptions(PCREOptions : Integer); - end; - -procedure TRegExHelper.SetAdditionalPCREOptions(PCREOptions: Integer); -begin - with Self do FRegEx.SetAdditionalPCREOptions(PCREOptions); -end; - -{ TSynEditRegexSearch } - -constructor TSynEditRegexSearch.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fOptions := [roNotEmpty]; -end; - -function TSynEditRegexSearch.FindAll(const NewText: string): Integer; -begin - fMatchCollection := RegEx.Matches(NewText); - Result := fMatchCollection.Count; -end; - -function TSynEditRegexSearch.Replace(const aOccurrence, aReplacement: string): string; -begin - Result := RegEx.Replace(aOccurrence, aReplacement); -end; - -function TSynEditRegexSearch.GetLength(Index: Integer): Integer; -begin - Result := fMatchCollection[Index].Length; -end; - -function TSynEditRegexSearch.GetPattern: string; -begin - Result := fPattern; -end; - -function TSynEditRegexSearch.GetResult(Index: Integer): Integer; -begin - Result := fMatchCollection[Index].Index; -end; - -function TSynEditRegexSearch.GetResultCount: Integer; -begin - Result := fMatchCollection.Count; -end; - -procedure TSynEditRegexSearch.SetOptions(const Value: TSynSearchOptions); -begin - if ssoMatchCase in Value then - fOptions := [roNotEmpty] - else - fOptions := [roNotEmpty, roIgnoreCase]; - RegEx := TRegEx.Create(fPattern, fOptions); - RegEx.SetAdditionalPCREOptions(PCRE_UCP); -end; - -procedure TSynEditRegexSearch.SetPattern(const Value: string); -begin - fPattern := Value; - RegEx := TRegEx.Create(fPattern, fOptions); - RegEx.SetAdditionalPCREOptions(PCRE_UCP); -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditRegexSearch.pas, released 2002-07-26. + +Original Code by Eduardo Mauro, Gerald Nunn and Flávio Etrusco. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditRegexSearch.pas,v 1.5.2.2 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITREGEXSEARCH} +unit SynEditRegexSearch; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + SynEditTypes, + SynRegExpr, + SynEditMiscClasses, + SynUnicode, + Classes; + +type + TSynEditRegexSearch = class(TSynEditSearchCustom) + private + FRegex: TRegExpr; + FPositions: TList; + fLengths: TList; + protected + function GetPattern: UnicodeString; override; + procedure SetPattern(const Value: UnicodeString); override; + procedure SetOptions(const Value: TSynSearchOptions); override; + function GetLength(Index: Integer): Integer; override; + function GetResult(Index: Integer): Integer; override; + function GetResultCount: Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function FindAll(const NewText: UnicodeString): Integer; override; + function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; + end; + +implementation + +uses + Consts; + +{ TSynEditRegexSearch } + +constructor TSynEditRegexSearch.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FRegex := TRegExpr.Create; + FPositions := TList.Create; + fLengths := TList.Create; +end; + +destructor TSynEditRegexSearch.Destroy; +begin + inherited; + FRegex.Free; + FPositions.Free; + fLengths.Free; +end; + +function TSynEditRegexSearch.FindAll(const NewText: UnicodeString): Integer; + + procedure AddResult(const aPos, aLength: Integer); + begin + FPositions.Add(Pointer(aPos)); + fLengths.Add(Pointer(aLength)); + end; + +begin + FPositions.Clear; + fLengths.Clear; + if FRegex.Exec(NewText) then + begin + AddResult(FRegex.MatchPos[0], FRegex.MatchLen[0]); + Result := 1; + while FRegex.ExecNext do + begin + AddResult(FRegex.MatchPos[0], FRegex.MatchLen[0]); + Inc(Result); + end; + end + else + Result := 0; +end; + +function TSynEditRegexSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; +begin + Result := FRegex.Replace(aOccurrence, aReplacement, True); +end; + +function TSynEditRegexSearch.GetLength(Index: Integer): Integer; +begin + Result := Integer(fLengths[Index]); +end; + +function TSynEditRegexSearch.GetPattern: UnicodeString; +begin + Result := FRegex.Expression; +end; + +function TSynEditRegexSearch.GetResult(Index: Integer): Integer; +begin + Result := Integer(FPositions[Index]); +end; + +function TSynEditRegexSearch.GetResultCount: Integer; +begin + Result := FPositions.Count; +end; + +procedure TSynEditRegexSearch.SetOptions(const Value: TSynSearchOptions); +begin + FRegex.ModifierI := not(ssoMatchCase in Value); +end; + +procedure TSynEditRegexSearch.SetPattern(const Value: UnicodeString); +begin + FRegex.Expression := Value; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditSearch.pas b/Source/VCL/SynEdit/Source/SynEditSearch.pas index 421fbe58..4d2613b6 100644 --- a/Source/VCL/SynEdit/Source/SynEditSearch.pas +++ b/Source/VCL/SynEdit/Source/SynEditSearch.pas @@ -1,303 +1,308 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditSearch.pas, released 2000-04-07. - -The Original Code is based on the mwEditSearch.pas file from the mwEdit -component suite by Martin Waldenburg and other developers. -Portions created by Martin Waldenburg are Copyright 1999 Martin Waldenburg. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditSearch.pas,v 1.12.2.6 2009/09/29 00:16:46 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditSearch; - -{$I SynEdit.inc} - -interface - -uses - SynEditTypes, - SynEditMiscClasses, - SynUnicode, - Classes; - -type - TSynEditSearch = class(TSynEditSearchCustom) - private - Run: PWideChar; - Origin: PWideChar; - TheEnd: PWideChar; - Pat, CasedPat: string; - fCount: Integer; - fTextLen: Integer; - Look_At: Integer; - PatLen, PatLenSucc: Integer; - Shift: array[WideChar] of Integer; - fCaseSensitive: Boolean; - fWhole: Boolean; - fResults: TList; - fShiftInitialized: Boolean; - FTextToSearch: string; - function GetFinished: Boolean; - procedure InitShiftTable; - procedure SetCaseSensitive(const Value: Boolean); - protected - function TestWholeWord: Boolean; - procedure SetPattern(const Value: string); override; - function GetPattern: string; override; - function GetLength(Index: Integer): Integer; override; - function GetResult(Index: Integer): Integer; override; - function GetResultCount: Integer; override; - procedure SetOptions(const Value: TSynSearchOptions); override; - public - constructor Create(aOwner: TComponent); override; - destructor Destroy; override; - function FindAll(const NewText: string): Integer; override; - function Replace(const aOccurrence, aReplacement: string): string; override; - function FindFirst(const NewText: string): Integer; - procedure FixResults(First, Delta: Integer); - function Next: Integer; - property Count: Integer read fCount write fCount; - property Finished: Boolean read GetFinished; - property Pattern read CasedPat; - property CaseSensitive: Boolean read fCaseSensitive write SetCaseSensitive; - property Whole: Boolean read fWhole write fWhole; - end; - -implementation - -uses - Windows, - SysUtils; - -constructor TSynEditSearch.Create(aOwner: TComponent); -begin - inherited; - fResults := TList.Create; -end; - -function TSynEditSearch.GetFinished: Boolean; -begin - Result := (Run >= TheEnd) or (PatLen >= fTextLen); -end; - -function TSynEditSearch.GetResult(Index: Integer): Integer; -begin - Result := 0; - if (Index >= 0) and (Index < fResults.Count) then - Result := Integer(fResults[Index]); -end; - -function TSynEditSearch.GetResultCount: Integer; -begin - Result := fResults.Count; -end; - -procedure TSynEditSearch.FixResults(First, Delta: Integer); -var - i: Integer; -begin - if (Delta <> 0) and (fResults.Count > 0) then begin - i := Pred(fResults.Count); - while i >= 0 do begin - if Integer(fResults[i]) <= First then break; - fResults[i] := pointer(Integer(fResults[i]) - Delta); - Dec(i); - end; - end; -end; - -procedure TSynEditSearch.InitShiftTable; -var - C: WideChar; - I: Integer; -begin - PatLen := Length(Pat); - if Patlen = 0 then raise Exception.Create('Pattern is empty'); - PatLenSucc := PatLen + 1; - Look_At := 1; - for C := Low(WideChar) to High(WideChar) do Shift[C] := PatLenSucc; - for I := 1 to PatLen do Shift[Pat[I]] := PatLenSucc - I; - while Look_at < PatLen do - begin - if Pat[PatLen] = Pat[PatLen - Look_at] then break; - inc(Look_at); - end; - fShiftInitialized := True; -end; - -// TODO: would be more intelligent to use IsWordBreakChar for SynEdit -function IsWordBreakChar(C: WideChar): Boolean; -begin - case C of - #0..#32, '.', ',', ';', ':', '"', '''', '´', '`', '°', '^', '!', '?', '&', - '$', '@', '§', '%', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', - '-', '=', '+', '*', '/', '\', '|': - Result := True; - else - Result := False; - end; -end; - -function TSynEditSearch.TestWholeWord: Boolean; -var - Test: PWideChar; -begin - Test := Run - PatLen; - - Result := ((Test < Origin) or IsWordBreakChar(Test[0])) and - ((Run >= TheEnd) or IsWordBreakChar(Run[1])); -end; - -function TSynEditSearch.Next: Integer; -var - I: Integer; - J: PWideChar; -begin - Result := 0; - inc(Run, PatLen); - while Run < TheEnd do - begin - if Pat[Patlen] <> Run^ then - inc(Run, Shift[(Run + 1)^]) - else - begin - J := Run - PatLen + 1; - I := 1; - while Pat[I] = J^ do - begin - if I = PatLen then - begin - if fWhole and not TestWholeWord then break; - inc(fCount); - Result := Run - Origin - Patlen + 2; - exit; - end; - inc(I); - inc(J); - end; - Inc(Run, Look_At); - if Run >= TheEnd then - break; - Inc(Run, Shift[Run^] - 1); - end; - end; -end; - -destructor TSynEditSearch.Destroy; -begin - fResults.Free; - inherited Destroy; -end; - -procedure TSynEditSearch.SetPattern(const Value: string); -begin - if Pat <> Value then - begin - CasedPat := Value; - if CaseSensitive then - Pat := CasedPat - else - Pat := SysUtils.AnsiLowerCase(CasedPat); - fShiftInitialized := False; - end; - fCount := 0; -end; - -procedure TSynEditSearch.SetCaseSensitive(const Value: Boolean); -begin - if fCaseSensitive <> Value then - begin - fCaseSensitive := Value; - if fCaseSensitive then - Pat := CasedPat - else - Pat := SysUtils.AnsiLowerCase(CasedPat); - fShiftInitialized := False; - end; -end; - -function TSynEditSearch.FindAll(const NewText: string): Integer; -var - Found: Integer; -begin - // never shrink Capacity - fResults.Count := 0; - Found := FindFirst(NewText); - while Found > 0 do - begin - fResults.Add(Pointer(Found)); - Found := Next; - end; - Result := fResults.Count; -end; - -function TSynEditSearch.Replace(const aOccurrence, aReplacement: string): string; -begin - Result := aReplacement; -end; - -function TSynEditSearch.FindFirst(const NewText: string): Integer; -begin - if not fShiftInitialized then - InitShiftTable; - Result := 0; - fTextLen := Length(NewText); - if fTextLen >= PatLen then - begin - if CaseSensitive then - FTextToSearch := NewText - else - FTextToSearch := SysUtils.AnsiLowerCase(NewText); - Origin := PWideChar(FTextToSearch); - TheEnd := Origin + fTextLen; - Run := (Origin - 1); - Result := Next; - end; -end; - -function TSynEditSearch.GetLength(Index: Integer): Integer; -begin - Result := PatLen; -end; - -function TSynEditSearch.GetPattern: string; -begin - Result := CasedPat; -end; - -procedure TSynEditSearch.SetOptions(const Value: TSynSearchOptions); -begin - CaseSensitive := ssoMatchCase in Value; - Whole := ssoWholeWord in Value; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditSearch.pas, released 2000-04-07. + +The Original Code is based on the mwEditSearch.pas file from the mwEdit +component suite by Martin Waldenburg and other developers. +Portions created by Martin Waldenburg are Copyright 1999 Martin Waldenburg. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditSearch.pas,v 1.12.2.6 2009/09/29 00:16:46 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITSEARCH} +unit SynEditSearch; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + SynEditTypes, + SynEditMiscClasses, + SynUnicode, + Classes; + +type + TSynEditSearch = class(TSynEditSearchCustom) + private + Run: PWideChar; + FOrigin: PWideChar; + FTheEnd: PWideChar; + FPat, FCasedPat: UnicodeString; + FCount: Integer; + FTextLen: Integer; + FLookAt: Integer; + FPatLen, FPatLenSucc: Integer; + FShift: array[WideChar] of Integer; + FCaseSensitive: Boolean; + FWhole: Boolean; + FResults: TList; + FShiftInitialized: Boolean; + FTextToSearch: UnicodeString; + function GetFinished: Boolean; + procedure InitShiftTable; + procedure SetCaseSensitive(const Value: Boolean); + protected + function TestWholeWord: Boolean; + procedure SetPattern(const Value: UnicodeString); override; + function GetPattern: UnicodeString; override; + function GetLength(Index: Integer): Integer; override; + function GetResult(Index: Integer): Integer; override; + function GetResultCount: Integer; override; + procedure SetOptions(const Value: TSynSearchOptions); override; + public + constructor Create(aOwner: TComponent); override; + destructor Destroy; override; + + function FindAll(const NewText: UnicodeString): Integer; override; + function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; + function FindFirst(const NewText: UnicodeString): Integer; + procedure FixResults(First, Delta: Integer); + function Next: Integer; + + property Count: Integer read FCount write FCount; + property Finished: Boolean read GetFinished; + property Pattern read FCasedPat; + property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive; + property Whole: Boolean read FWhole write FWhole; + end; + +implementation + +uses + Windows, + SysUtils; + +constructor TSynEditSearch.Create(aOwner: TComponent); +begin + inherited; + FResults := TList.Create; +end; + +function TSynEditSearch.GetFinished: Boolean; +begin + Result := (Run >= FTheEnd) or (FPatLen >= FTextLen); +end; + +function TSynEditSearch.GetResult(Index: Integer): Integer; +begin + Result := 0; + if (Index >= 0) and (Index < FResults.Count) then + Result := Integer(FResults[Index]); +end; + +function TSynEditSearch.GetResultCount: Integer; +begin + Result := FResults.Count; +end; + +procedure TSynEditSearch.FixResults(First, Delta: Integer); +var + i: Integer; +begin + if (Delta <> 0) and (FResults.Count > 0) then begin + i := Pred(FResults.Count); + while i >= 0 do begin + if Integer(FResults[i]) <= First then Break; + FResults[i] := Pointer(Integer(FResults[i]) - Delta); + Dec(i); + end; + end; +end; + +procedure TSynEditSearch.InitShiftTable; +var + C: WideChar; + I: Integer; +begin + FPatLen := Length(FPat); + if FPatLen = 0 then raise Exception.Create('Pattern is empty'); + FPatLenSucc := FPatLen + 1; + FLookAt := 1; + for C := Low(WideChar) to High(WideChar) do FShift[C] := FPatLenSucc; + for I := 1 to FPatLen do FShift[FPat[I]] := FPatLenSucc - I; + while FLookAt < FPatLen do + begin + if FPat[FPatLen] = FPat[FPatLen - FLookAt] then Break; + Inc(FLookAt); + end; + FShiftInitialized := True; +end; + +// TODO: would be more intelligent to use IsWordBreakChar for SynEdit +function IsWordBreakChar(C: WideChar): Boolean; +begin + case C of + #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), WideChar(#$0060), + WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', '#', + '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', '/', + '\', '|': + Result := True; + else + Result := False; + end; +end; + +function TSynEditSearch.TestWholeWord: Boolean; +var + Test: PWideChar; +begin + Test := Run - FPatLen; + + Result := ((Test < FOrigin) or IsWordBreakChar(Test[0])) and + ((Run >= FTheEnd) or IsWordBreakChar(Run[1])); +end; + +function TSynEditSearch.Next: Integer; +var + I: Integer; + J: PWideChar; +begin + Result := 0; + Inc(Run, FPatLen); + while Run < FTheEnd do + begin + if FPat[FPatLen] <> Run^ then + Inc(Run, FShift[(Run + 1)^]) + else + begin + J := Run - FPatLen + 1; + I := 1; + while FPat[I] = J^ do + begin + if I = FPatLen then + begin + if FWhole and not TestWholeWord then Break; + Inc(FCount); + Result := Run - FOrigin - FPatLen + 2; + Exit; + end; + Inc(I); + Inc(J); + end; + Inc(Run, FLookAt); + if Run >= FTheEnd then + Break; + Inc(Run, FShift[Run^] - 1); + end; + end; +end; + +destructor TSynEditSearch.Destroy; +begin + FResults.Free; + inherited Destroy; +end; + +procedure TSynEditSearch.SetPattern(const Value: UnicodeString); +begin + if FPat <> Value then + begin + FCasedPat := Value; + if CaseSensitive then + FPat := FCasedPat + else + FPat := SynWideLowerCase(FCasedPat); + FShiftInitialized := False; + end; + FCount := 0; +end; + +procedure TSynEditSearch.SetCaseSensitive(const Value: Boolean); +begin + if FCaseSensitive <> Value then + begin + FCaseSensitive := Value; + if FCaseSensitive then + FPat := FCasedPat + else + FPat := SynWideLowerCase(FCasedPat); + FShiftInitialized := False; + end; +end; + +function TSynEditSearch.FindAll(const NewText: UnicodeString): Integer; +var + Found: Integer; +begin + // never shrink Capacity + FResults.Count := 0; + Found := FindFirst(NewText); + while Found > 0 do + begin + FResults.Add(Pointer(Found)); + Found := Next; + end; + Result := FResults.Count; +end; + +function TSynEditSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; +begin + Result := aReplacement; +end; + +function TSynEditSearch.FindFirst(const NewText: UnicodeString): Integer; +begin + if not FShiftInitialized then + InitShiftTable; + Result := 0; + FTextLen := Length(NewText); + if FTextLen >= FPatLen then + begin + if CaseSensitive then + FTextToSearch := NewText + else + FTextToSearch := SynWideLowerCase(NewText); + FOrigin := PWideChar(FTextToSearch); + FTheEnd := FOrigin + FTextLen; + Run := (FOrigin - 1); + Result := Next; + end; +end; + +function TSynEditSearch.GetLength(Index: Integer): Integer; +begin + Result := FPatLen; +end; + +function TSynEditSearch.GetPattern: UnicodeString; +begin + Result := FCasedPat; +end; + +procedure TSynEditSearch.SetOptions(const Value: TSynSearchOptions); +begin + CaseSensitive := ssoMatchCase in Value; + Whole := ssoWholeWord in Value; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditStrConst.pas b/Source/VCL/SynEdit/Source/SynEditStrConst.pas index 0406c677..441e6e9b 100644 --- a/Source/VCL/SynEdit/Source/SynEditStrConst.pas +++ b/Source/VCL/SynEdit/Source/SynEditStrConst.pas @@ -1,561 +1,577 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditStrConst.pas, released 2000-04-07. -The Original Code is based on mwLocalStr.pas by Michael Hieke, part of the -mwEdit component suite. -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: SynEditStrConst.pas,v 1.41.2.5 2009/01/06 16:26:01 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditStrConst; - -{$I SynEdit.inc} - -interface - -// NOTE: this is design-time stuff, so no need to have it in stringtables -const - SYNS_ComponentsPage = 'SynEdit'; - SYNS_HighlightersPage = 'SynEdit Highlighters'; - -// NOTE: the following constants are used to store information to the registry, -// INI files or XML files. For maximum compatibility only the chars -// 'A'..'Z', 'a'..'z', '0'..'9', '_' and '-' are allowed! -// -// If you want translated/"pretty"/more detailed descriptions use the -// resourcestrings, i.e. the "friendly" versions below. - -// constant names for highlighter attributes -// -// -const - SYNS_AttrAreaAIdentifier = 'Area_A_Identifier'; - SYNS_AttrArrowHead = 'ArrowHead'; - SYNS_AttrAsm = 'Asm'; - SYNS_AttrAsmComment = 'AsmComment'; - SYNS_AttrAsmKey = 'AsmKey'; - SYNS_AttrAssembler = 'Assembler'; - SYNS_AttrAttribute = 'Attribute'; - SYNS_AttrAttributeName = 'AttributeName'; - SYNS_AttrAttributeValue = 'AttributeValue'; - SYNS_AttrBasicTypes = 'BasicTypes'; - SYNS_AttrBlock = 'Block'; - SYNS_AttrBoolean = 'Booleanvalue'; - SYNS_AttrBrackets = 'Brackets'; - SYNS_AttrCDATASection = 'CDATA-Section'; - SYNS_AttrCharacter = 'Character'; - SYNS_AttrClass = 'Class'; - SYNS_AttrColor = 'ColorValue'; - SYNS_AttrConstant = 'Constant'; - SYNS_AttrComment = 'Comment'; - SYNS_AttrCondition = 'Condition'; - SYNS_AttrConditionalComment = 'ConditionalComment'; - SYNS_AttrConsoleOutput = 'ConsoleOutput'; - SYNS_AttrDataType = 'DataType'; - SYNS_AttrDebugLines = 'DebuggingLines'; - SYNS_AttrDefaultPackage = 'DefaultPackages'; - SYNS_AttrDelimitedIdentifier = 'DelimitedIdentifier'; - SYNS_AttrDir = 'Direction'; - SYNS_AttrDirections = 'Directions'; - SYNS_AttrDirective = 'Directive'; - SYNS_AttrDOCTYPESection = 'DOCTYPE-Section'; - SYNS_AttrDocumentation = 'Documentation'; - SYNS_AttrElementName = 'ElementName'; - SYNS_AttrEmbedSQL = 'EmbeddedSQL'; - SYNS_AttrEmbedText = 'EmbeddedText'; - SYNS_AttrEntityReference = 'EntityReference'; - SYNS_AttrEscapeAmpersand = 'EscapeAmpersand'; - SYNS_AttrEvent = 'Event'; - SYNS_AttrException = 'Exception'; - SYNS_AttrFirstTri = 'FirstTri'; - SYNS_AttrFloat = 'Float'; - SYNS_AttrForm = 'Form'; - SYNS_AttrFourthTri = 'FourthTri'; - SYNS_AttrFunction = 'Function'; - SYNS_AttrHexadecimal = 'Hexadecimal'; - SYNS_AttrIcon = 'IconReference'; - SYNS_AttrIdentifier = 'Identifier'; - SYNS_AttrIllegalChar = 'IllegalChar'; - SYNS_AttrInclude = 'Include'; - SYNS_AttrIndicator = 'IndicatorArea'; - SYNS_AttrIndirect = 'Indirect'; - SYNS_AttrInstructions = 'Instructions'; - SYNS_AttrInvalidSymbol = 'InvalidSymbol'; - SYNS_AttrInternalFunction = 'InternalFunction'; - SYNS_AttrKey = 'Key'; - SYNS_AttrLabel = 'Label'; - SYNS_AttrLace = 'Lace'; - SYNS_AttrLine = 'Line'; - SYNS_AttrMacro = 'Macro'; - SYNS_AttrMarker = 'Marker'; - SYNS_AttrMathMode = 'MathMode'; - SYNS_AttrMessage = 'Message'; - SYNS_AttrMiscellaneous = 'Miscellaneous'; - SYNS_AttrNamespaceAttrName = 'NamespaceAttributeName'; - SYNS_AttrNamespaceAttrValue = 'NamespaceAttributeValue'; - SYNS_AttrNonReservedKeyword = 'NonreservedKeyword'; - SYNS_AttrNull = 'Null'; - SYNS_AttrNumber = 'Number'; - SYNS_AttrOctal = 'Octal'; - SYNS_AttrOperator = 'Operator'; - SYNS_AttrOperatorAndSymbols = 'OperatorAndSymbols'; - SYNS_AttrOpLine = 'OpLine'; - SYNS_AttrOptions = 'Options'; - SYNS_AttrPath = 'PathName'; - SYNS_AttrPLSQL = 'PLSQL-ReservedWord'; - SYNS_AttrPragma = 'Pragma'; - SYNS_AttrPredefined = 'Predefined'; - SYNS_AttrPreprocessor = 'Preprocessor'; - SYNS_AttrProcessingInstr = 'ProcessingInstruction'; - SYNS_AttrProcName = 'ProcName'; - SYNS_AttrProperty = 'Property'; - SYNS_AttrQuad = 'Quad'; - SYNS_AttrQualifier = 'Qualifier'; - SYNS_AttrRegister = 'Register'; - SYNS_AttrReservedWord = 'ReservedWord'; - SYNS_AttrResultValue = 'ResultValue'; - SYNS_AttrRoundBracket = 'RoundBracket'; - SYNS_AttrRpl = 'Rpl'; - SYNS_AttrRplKey = 'Rpl-Key'; - SYNS_AttrRplComment = 'Rpl-Comment'; - SYNS_AttrSASM = 'SASM'; - SYNS_AttrSASMComment = 'SASM-Comment'; - SYNS_AttrSASMKey = 'SASM-Key'; - SYNS_AttrSecondReservedWord = 'SecondReservedWord'; - SYNS_AttrSecondTri = 'SecondTri'; - SYNS_AttrSection = 'Section'; - SYNS_AttrSequence = 'SequenceNumberArea'; - SYNS_AttrShape = 'Shape'; - SYNS_AttrSingleString = 'SingleQuotedString'; - SYNS_AttrSpace = 'Space'; - SYNS_AttrSpecialVariable = 'SpecialVariable'; - SYNS_AttrSQLKey = 'SQL-Keyword'; - SYNS_AttrSQLPlus = 'SQLPlus-Command'; - SYNS_AttrSquareBracket = 'SquareBracket'; - SYNS_AttrString = 'String'; - SYNS_AttrSymbol = 'Symbol'; - SYNS_AttrSyntaxError = 'SyntaxError'; - SYNS_AttrSystem = 'SystemFunctionsAndVariables'; - SYNS_AttrSystemValue = 'SystemValue'; - SYNS_AttrTagArea = 'TagArea'; - SYNS_AttrTableName = 'TableName'; - SYNS_AttrTerminator = 'Terminator'; - SYNS_AttrTeXCommand = 'TeX-Command'; - SYNS_AttrText = 'Text'; - SYNS_AttrTextMathMode = 'TextInMathMode'; - SYNS_AttrThirdTri = 'ThirdTri'; - SYNS_AttrTixKeyWords = 'Tix-Keywords'; - SYNS_AttrTriangle = 'Triangle'; - SYNS_AttrUndefinedProperty = 'UndefinedProperty'; - SYNS_AttrUnknownWord = 'UnknownWord'; - SYNS_AttrURI = 'URI'; - SYNS_AttrUser = 'UserFunctionsAndVariables'; - SYNS_AttrUserFunction = 'UserFunctions'; - SYNS_AttrValue = 'Value'; - SYNS_AttrVariable = 'Variable'; - SYNS_AttrVisitedURI = 'VisitedURI'; - SYNS_AttrVrmlAppearance = 'Vrml_Appearance'; - SYNS_AttrVrmlAttribute = 'Vrml_Attribute'; - SYNS_AttrVrmlDefinition = 'Vrml_Definition'; - SYNS_AttrVrmlEvent = 'Vrml_Event'; - SYNS_AttrVrmlGrouping = 'Vrml_Grouping'; - SYNS_AttrVrmlInterpolator = 'Vrml_Interpolator'; - SYNS_AttrVrmlLight = 'Vrml_Light'; - SYNS_AttrVrmlNode = 'Vrml_Node'; - SYNS_AttrVrmlParameter = 'Vrml_Parameter'; - SYNS_AttrVrmlProto = 'Vrml_Proto'; - SYNS_AttrVrmlSensor = 'Vrml_Sensor'; - SYNS_AttrVrmlShape = 'Vrml_Shape'; - SYNS_AttrVrmlShape_Hint = 'Vrml_Shape_Hint'; - SYNS_AttrVrmlTime_dependent = 'Vrml_Time_dependent'; - SYNS_AttrVrmlViewpoint = 'Vrml_Viewpoint'; - SYNS_AttrVrmlWorldInfo = 'Vrml_WorldInfo'; - SYNS_AttrWhitespace = 'Whitespace'; - SYNS_AttrWidgetWords = 'Widget-Keywords'; - SYNS_AttrX3DDocType = 'X3DDocType'; - SYNS_AttrX3DHeader = 'X3DHeader'; - - // constant language names - SYNS_LangHP48 = 'HP48'; - SYNS_LangCAClipper = 'CA-Clipper'; - SYNS_LangCPM = 'COAS_Product_Manager_Report'; - SYNS_LangCPP = 'CandCPlusPlus'; - SYNS_LangCS = 'CSharp'; - SYNS_LangJava = 'Java'; - SYNS_LangPerl = 'Perl'; - SYNS_LangBatch = 'MS-DOS_Batch'; - SYNS_LangDfm = 'BorlandForms'; - SYNS_LangAWK = 'AWK'; - SYNS_LangCORBAIDL = 'CORBA_IDL'; - SYNS_LangHTML = 'HTML'; - SYNS_LangVBSScript = 'MS-VBScript'; - SYNS_LangGalaxy = 'Galaxy'; - SYNS_LangGeneral = 'General'; - SYNS_LangPascal = 'ObjectPascal'; - SYNS_LangX86Asm = 'x86Assembly'; - SYNS_LangPython = 'Python'; - SYNS_LangTclTk = 'TclTk'; - SYNS_LangSQL = 'SQL'; - SYNS_LangGembase = 'Gembase'; - SYNS_LangINI = 'INI'; - SYNS_LangSML = 'StandardML'; - SYNS_LangVisualBASIC = 'VisualBasic'; - SYNS_LangADSP21xx = 'ADSP21xx'; - SYNS_LangPHP = 'PHP'; - SYNS_LangSybaseSQL = 'SybaseSQL'; - SYNS_LangGeneralMulti = 'General_Multi-Highlighter'; - SYNS_LangCache = 'CacheObjectScript'; - SYNS_LangCSS = 'CascadingStyleSheet'; - SYNS_LangJScript = 'JavaScript'; - SYNS_LangJSON = 'JSON'; - SYNS_LangKIX = 'KiXtart'; - SYNS_LangBaan = 'Baan_4GL'; - SYNS_LangFoxpro = 'Foxpro'; - SYNS_LangFortran = 'Fortran'; - SYNS_Lang68HC11 = '68HC11_Assembler'; - SYNS_LangProgress = 'Progress'; - SYNS_LangInno = 'InnoSetupScript'; - SYNS_LangModelica = 'Modelica'; - SYNS_LangModula3 = 'Modula3'; - SYNS_LangSDD = 'SemantaDataDictionary'; - SYNS_LangXML = 'XML'; - SYNS_LangGWS = 'GW-TEL'; - SYNS_LangSynGenMsgfiles = 'SynGen_Msg'; - SYNS_LangUnreal = 'Unreal'; - SYNS_LangST = 'StructuredText'; - SYNS_LangCOBOL = 'COBOL'; - SYNS_LangTeX = 'TeX'; - SYNS_LangRC = 'Resource'; - SYNS_LangRuby = 'Ruby'; - SYNS_LangNameUNIXShellScript = 'UNIXShellScript'; - SYNS_LangHaskell = 'Haskell'; - SYNS_LangDOT = 'DOT_Graph_Drawing_Description_language'; - SYNS_LangEiffel = 'Eiffel'; - SYNS_LangLDraw = 'LEGO_LDraw'; - SYNS_LangLLVMIR = 'LLVM IR'; - SYNS_LangUnknown = ''; - SYNS_LangURI = 'URI'; - SYNS_LangVrml97 = 'Vrml97'; - -resourcestring - SYNS_NoSearchEngineError = 'No search engine has been assigned'; - - SYNS_Untitled = 'Untitled'; - - // Friendly names for highlighter attributes - SYNS_FriendlyAttrAreaAIdentifier = 'Area A Identifier'; - SYNS_FriendlyAttrArrowHead = 'ArrowHead'; - SYNS_FriendlyAttrAsm = 'Asm'; - SYNS_FriendlyAttrAsmComment = 'Asm Comment'; - SYNS_FriendlyAttrAsmKey = 'Asm Key'; - SYNS_FriendlyAttrAssembler = 'Assembler'; - SYNS_FriendlyAttrAttribute = 'Attribute'; - SYNS_FriendlyAttrAttributeName = 'Attribute Name'; - SYNS_FriendlyAttrAttributeValue = 'Attribute Value'; - SYNS_FriendlyAttrBasicTypes = 'Basic Types'; - SYNS_FriendlyAttrBlock = 'Block'; - SYNS_FriendlyAttrBoolean = 'Boolean value'; - SYNS_FriendlyAttrBrackets = 'Brackets'; - SYNS_FriendlyAttrCDATASection = 'CDATA Section'; - SYNS_FriendlyAttrCharacter = 'Character'; - SYNS_FriendlyAttrClass = 'Class'; - SYNS_FriendlyAttrColor = 'Color Value'; - SYNS_FriendlyAttrComment = 'Comment'; - SYNS_FriendlyAttrCondition = 'Condition'; - SYNS_FriendlyAttrConditionalComment = 'Conditional Comment'; - SYNS_FriendlyAttrConsoleOutput = 'Console output'; - SYNS_FriendlyAttrConstant = 'Constant'; - SYNS_FriendlyAttrDataType = 'Data Type'; - SYNS_FriendlyAttrDebugLines = 'Debugging Lines'; - SYNS_FriendlyAttrDefaultPackage = 'Default Packages'; - SYNS_FriendlyAttrDelimitedIdentifier = 'Delimited Identifier'; - SYNS_FriendlyAttrDir = 'Direction'; - SYNS_FriendlyAttrDirections = 'Directions'; - SYNS_FriendlyAttrDirective = 'Directive'; - SYNS_FriendlyAttrDOCTYPESection = 'DOCTYPE Section'; - SYNS_FriendlyAttrDocumentation = 'Documentation'; - SYNS_FriendlyAttrElementName = 'Element Name'; - SYNS_FriendlyAttrEmbedSQL = 'Embedded SQL'; - SYNS_FriendlyAttrEmbedText = 'Embedded Text'; - SYNS_FriendlyAttrEntityReference = 'Entity Reference'; - SYNS_FriendlyAttrEscapeAmpersand = 'Escape Ampersand'; - SYNS_FriendlyAttrEvent = 'Event'; - SYNS_FriendlyAttrException = 'Exception'; - SYNS_FriendlyAttrFirstTri = 'FirstTri'; - SYNS_FriendlyAttrFloat = 'Float'; - SYNS_FriendlyAttrForm = 'Form'; - SYNS_FriendlyAttrFourthTri = 'FourthTri'; - SYNS_FriendlyAttrFunction = 'Function'; - SYNS_FriendlyAttrHexadecimal = 'Hexadecimal'; - SYNS_FriendlyAttrIcon = 'Icon Reference'; - SYNS_FriendlyAttrIdentifier = 'Identifier'; - SYNS_FriendlyAttrIllegalChar = 'Illegal Char'; - SYNS_FriendlyAttrInclude = 'Include'; - SYNS_FriendlyAttrIndicator = 'Indicator Area'; - SYNS_FriendlyAttrIndirect = 'Indirect'; - SYNS_FriendlyAttrInstructions = 'Instructions'; - SYNS_FriendlyAttrInternalFunction = 'Internal Function'; - SYNS_FriendlyAttrInvalidSymbol = 'Invalid Symbol'; - SYNS_FriendlyAttrKey = 'Key'; - SYNS_FriendlyAttrLabel = 'Label'; - SYNS_FriendlyAttrLace = 'Lace'; - SYNS_FriendlyAttrLine = 'Line'; - SYNS_FriendlyAttrMacro = 'Macro'; - SYNS_FriendlyAttrMarker = 'Marker'; - SYNS_FriendlyAttrMathMode = 'Math Mode'; - SYNS_FriendlyAttrMessage = 'Message'; - SYNS_FriendlyAttrMiscellaneous = 'Miscellaneous'; - SYNS_FriendlyAttrNamespaceAttrName = 'Namespace Attribute Name'; - SYNS_FriendlyAttrNamespaceAttrValue = 'Namespace Attribute Value'; - SYNS_FriendlyAttrNonReservedKeyword = 'Non-reserved Keyword'; - SYNS_FriendlyAttrNull = 'Null'; - SYNS_FriendlyAttrNumber = 'Number'; - SYNS_FriendlyAttrOctal = 'Octal'; - SYNS_FriendlyAttrOperator = 'Operator'; - SYNS_FriendlyAttrOperatorAndSymbols = 'Operator And Symbols'; - SYNS_FriendlyAttrOpLine = 'OpLine'; - SYNS_FriendlyAttrOptions = 'Options'; - SYNS_FriendlyAttrPath = 'Pathname'; - SYNS_FriendlyAttrPLSQL = 'PL/SQL Reserved Word'; - SYNS_FriendlyAttrPragma = 'Pragma'; - SYNS_FriendlyAttrPredefined = 'Predefined'; - SYNS_FriendlyAttrPreprocessor = 'Preprocessor'; - SYNS_FriendlyAttrProcessingInstr = 'Processing Instruction'; - SYNS_FriendlyAttrProcName = 'Procedure name'; - SYNS_FriendlyAttrProperty = 'Property'; - SYNS_FriendlyAttrQuad = 'Quad'; - SYNS_FriendlyAttrQualifier = 'Qualifier'; - SYNS_FriendlyAttrRegister = 'Register'; - SYNS_FriendlyAttrReservedWord = 'Reserved Word'; - SYNS_FriendlyAttrResultValue = 'Result Value'; - SYNS_FriendlyAttrRoundBracket = 'Round Bracket'; - SYNS_FriendlyAttrRpl = 'Rpl'; - SYNS_FriendlyAttrRplKey = 'Rpl Key'; - SYNS_FriendlyAttrRplComment = 'Rpl Comment'; - SYNS_FriendlyAttrSASM = 'SASM'; - SYNS_FriendlyAttrSASMComment = 'SASM Comment'; - SYNS_FriendlyAttrSASMKey = 'SASM Key'; - SYNS_FriendlyAttrSecondReservedWord = 'Second Reserved Word'; - SYNS_FriendlyAttrSecondTri = 'SecondTri'; - SYNS_FriendlyAttrSection = 'Section'; - SYNS_FriendlyAttrSequence = 'Sequence Number Area'; - SYNS_FriendlyAttrShape = 'Shape'; - SYNS_FriendlyAttrSingleString = 'Single Quoted String'; - SYNS_FriendlyAttrSpace = 'Space'; - SYNS_FriendlyAttrSpecialVariable = 'Special Variable'; - SYNS_FriendlyAttrSQLKey = 'SQL Keyword'; - SYNS_FriendlyAttrSQLPlus = 'SQL*Plus Command'; - SYNS_FriendlyAttrSquareBracket = 'Square Bracket'; - SYNS_FriendlyAttrString = 'String'; - SYNS_FriendlyAttrSymbol = 'Symbol'; - SYNS_FriendlyAttrSyntaxError = 'Syntax Error'; - SYNS_FriendlyAttrSystem = 'System Functions and Variables'; - SYNS_FriendlyAttrSystemValue = 'System Value'; - SYNS_FriendlyAttrTagArea = 'Tag Area'; - SYNS_FriendlyAttrTableName = 'Table Name'; - SYNS_FriendlyAttrTerminator = 'Terminator'; - SYNS_FriendlyAttrTeXCommand = 'TeX Command'; - SYNS_FriendlyAttrText = 'Text'; - SYNS_FriendlyAttrTextMathMode = 'Text in Math Mode'; - SYNS_FriendlyAttrThirdTri = 'ThirdTri'; - SYNS_FriendlyAttrTixKeyWords = 'Tix Keywords'; - SYNS_FriendlyAttrTriangle = 'Triangle'; - SYNS_FriendlyAttrUndefinedProperty = 'Undefined Property'; - SYNS_FriendlyAttrUnknownWord = 'Unknown Word'; - SYNS_FriendlyAttrURI = 'URI'; - SYNS_FriendlyAttrUser = 'User Functions and Variables'; - SYNS_FriendlyAttrUserFunction = 'User Functions'; - SYNS_FriendlyAttrValue = 'Value'; - SYNS_FriendlyAttrVariable = 'Variable'; - SYNS_FriendlyAttrVisitedURI = 'Visited URI'; - SYNS_FriendlyAttrVrmlAppearance = 'Vrml_Appearance'; - SYNS_FriendlyAttrVrmlAttribute = 'Vrml_Attribute'; - SYNS_FriendlyAttrVrmlDefinition = 'Vrml_Definition'; - SYNS_FriendlyAttrVrmlEvent = 'Vrml_Event'; - SYNS_FriendlyAttrVrmlGrouping = 'Vrml_Grouping'; - SYNS_FriendlyAttrVrmlInterpolator = 'Vrml_Interpolator'; - SYNS_FriendlyAttrVrmlLight = 'Vrml_Light'; - SYNS_FriendlyAttrVrmlNode = 'Vrml_Node'; - SYNS_FriendlyAttrVrmlParameter = 'Vrml_Parameter'; - SYNS_FriendlyAttrVrmlProto = 'Vrml_Proto'; - SYNS_FriendlyAttrVrmlSensor = 'Vrml_Sensor'; - SYNS_FriendlyAttrVrmlShape = 'Vrml_Shape'; - SYNS_FriendlyAttrVrmlShape_Hint = 'Vrml_Shape_Hint'; - SYNS_FriendlyAttrVrmlTime_dependent = 'Vrml_Time_dependent'; - SYNS_FriendlyAttrVrmlViewpoint = 'Vrml_Viewpoint'; - SYNS_FriendlyAttrVrmlWorldInfo = 'Vrml_WorldInfo'; - SYNS_FriendlyAttrWhitespace = 'Whitespace'; - SYNS_FriendlyAttrWidgetWords = 'Widget Keywords'; - SYNS_FriendlyAttrX3DDocType = 'X3DDocType'; - SYNS_FriendlyAttrX3DHeader = 'X3DHeader'; - - // names of exporter output formats - SYNS_ExporterFormatHTML = 'HTML'; - SYNS_ExporterFormatRTF = 'RTF'; - SYNS_ExporterFormatTeX = 'TeX'; - - // TCustomSynEdit scroll hint window caption - SYNS_ScrollInfoFmt = '%d - %d'; - SYNS_ScrollInfoFmtTop = 'Top Line: %d'; - // TSynEditPrintPreview page number - SYNS_PreviewScrollInfoFmt = 'Page: %d'; - - // strings for property editors etc - SYNS_EDuplicateShortcut = 'Shortcut already exists'; - SYNS_ShortcutNone = ''; - SYNS_DuplicateShortcutMsg = 'The keystroke "%s" is already assigned ' + - 'to another editor command. (%s)'; - SYNS_DuplicateShortcutMsg2 = 'The keystroke "%s" is already assigned ' + - 'to another editor command.'#13#10'The ' + - 'shortcut for this item has not been changed.'; - - // Filters used for open/save dialog - SYNS_FilterPascal = 'Pascal Files (*.pas;*.pp;*.dpr;*.dpk;*.inc)|*.pas;*.pp;*.dpr;*.dpk;*.inc'; - SYNS_FilterHP48 = 'HP48 Files (*.s;*.sou;*.a;*.hp)|*.s;*.sou;*.a;*.hp'; - SYNS_FilterCAClipper = 'CA-Clipper Files (*.prg;*.ch;*.inc)|*.prg;*.ch;*.inc'; - SYNS_FilterCORBAIDL = 'CORBA IDL Files (*.idl)|*.idl'; - SYNS_FilterCPM = 'CPM Reports (*.rdf;*.rif;*.rmf;*.rxf)|*.rdf;*.rif;*.rmf;*.rxf'; - SYNS_FilterCPP = 'C/C++ Files (*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu)|*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu'; - SYNS_FilterCS = 'C# Files (*.cs)|*.cs'; - SYNS_FilterDWS = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc'; - SYNS_FilterJava = 'Java Files (*.java)|*.java'; - SYNS_FilterPerl = 'Perl Files (*.pl;*.pm;*.cgi)|*.pl;*.pm;*.cgi'; - SYNS_FilterAWK = 'AWK Scripts (*.awk)|*.awk'; - SYNS_FilterHTML = 'HTML Documents (*.htm;*.html)|*.htm;*.html'; - SYNS_FilterVBScript = 'VBScript Files (*.vbs)|*.vbs'; - SYNS_FilterGalaxy = 'Galaxy Files (*.gtv;*.galrep;*.txt)|*.gtv;*.galrep;*.txt'; - SYNS_FilterPython = 'Python Files (*.py)|*.py'; - SYNS_FilterSQL = 'SQL Files (*.sql)|*.sql'; - SYNS_FilterTclTk = 'Tcl/Tk Files (*.tcl)|*.tcl'; - SYNS_FilterRTF = 'Rich Text Format Documents (*.rtf)|*.rtf'; - SYNS_FilterBatch = 'MS-DOS Batch Files (*.bat;*.cmd)|*.bat;*.cmd'; - SYNS_FilterDFM = 'Borland Form Files (*.dfm;*.xfm)|*.dfm;*.xfm'; - SYNS_FilterX86Assembly = 'x86 Assembly Files (*.asm)|*.asm'; - SYNS_FilterGembase = 'GEMBASE Files (*.dml;*.gem)|*.dml;*.gem'; - SYNS_FilterINI = 'INI Files (*.ini)|*.ini'; - SYNS_FilterSML = 'Standard ML Files (*.sml)|*.sml'; - SYNS_FilterVisualBASIC = 'Visual Basic Files (*.bas)|*.bas'; - SYNS_FilterADSP21xx = 'DSP Files (*.dsp;*.inc)|*.dsp;*.inc'; - SYNS_FilterPHP = 'PHP Files (*.php;*.php3;*.phtml;*.inc)|*.php;*.php3;*.phtml;*.inc'; - SYNS_FilterCache = 'Cache Files (*.mac;*.inc;*.int)|*.mac;*.inc;*.int'; - SYNS_FilterCSS = 'Cascading Stylesheets (*.css)|*.css'; - SYNS_FilterJScript = 'Javascript Files (*.js)|*.js'; - SYNS_FilterJSON = 'JSON Files (*.json)|*.json'; - SYNS_FilterKIX = 'KiXtart Scripts (*.kix)|*.kix'; - SYNS_FilterBaan = 'Baan 4GL Files (*.cln)|*.cln'; - SYNS_FilterFoxpro = 'Foxpro Files (*.prg)|*.prg'; - SYNS_FilterFortran = 'Fortran Files (*.for)|*.for'; - SYNS_FilterAsm68HC11 = '68HC11 Assembler Files (*.hc11;*.asm;*.asc)|*.hc11;*.asm;*.asc'; - SYNS_FilterProgress = 'Progress Files (*.w;*.p;*.i)|*.w;*.p;*.i'; - SYNS_FilterInno = 'Inno Setup Scripts (*.iss)|*.iss'; - SYNS_FilterModelica = 'Modelica Files (*.mo)|*.mo'; - SYNS_FilterModula3 = 'Modula-3 Files (*.m3)|*.m3'; - SYNS_FilterSDD = 'Semanta DD Files (*.sdd)|*.sdd'; - SYNS_FilterXML = 'XML Files (*.xml;*.xsd;*.xsl;*.xslt;*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'; - SYNS_FilterGWS = 'GW-TEL Scripts (*.gws)|*.gws'; - SYNS_FilterSynGenMsgfiles = 'Msg Files (*.msg)|*.msg'; - SYNS_FilterST = 'Structured Text Files (*.st)|*.st'; - SYNS_FilterCOBOL = 'COBOL Files (*.cbl;*.cob)|*.cbl;*.cob'; - SYNS_FilterTeX = 'TeX Files (*.tex)|*.tex'; - SYNS_FilterRC = 'Resource Files (*.rc)|*.rc'; - SYNS_FilterRuby = 'Ruby Files (*.rb;*.rbw)|*.rb;*.rbw'; - SYNS_FilterUNIXShellScript = 'UNIX Shell Scripts (*.sh)|*.sh'; - SYNS_FilterHaskell = 'Haskell Files (*.hs;*.lhs)|*.hs;*.lhs'; - SYNS_FilterDOT = 'DOT Graph Drawing Description (*.dot)|*.dot'; - SYNS_FilterEiffel = 'Eiffel (*.e;*.ace)|*.e;*.ace'; - SYNS_FilterLDraw = 'LEGO LDraw Files (*.ldr)|*.ldr'; - SYNS_FilterLLVMIR = 'LLVM IR files (*.ll)|*.ll'; - SYNS_FilterURI = 'All Files (*.*)|*.*'; - SYNS_FilterVrml97 = 'Vrml97/X3D World (*.wrl;*.wrml;*.vrl;*.vrml;*.x3d)|*.wrl;*.wrml;*.vrl;*.vrml;*.x3d'; - - // friendly language names - SYNS_FriendlyLangHP48 = 'HP48'; - SYNS_FriendlyLangCAClipper = 'CA-Clipper'; - SYNS_FriendlyLangCPM = 'COAS Product Manager Report'; - SYNS_FriendlyLangCPP = 'C/C++'; - SYNS_FriendlyLangCS = 'C#'; - SYNS_FriendlyLangJava = 'Java'; - SYNS_FriendlyLangPerl = 'Perl'; - SYNS_FriendlyLangBatch = 'MS-DOS Batch'; - SYNS_FriendlyLangDfm = 'Borland Forms'; - SYNS_FriendlyLangAWK = 'AWK'; - SYNS_FriendlyLangCORBAIDL = 'CORBA IDL'; - SYNS_FriendlyLangHTML = 'HTML'; - SYNS_FriendlyLangVBSScript = 'MS VBScript'; - SYNS_FriendlyLangGalaxy = 'Galaxy'; - SYNS_FriendlyLangGeneral = 'General'; - SYNS_FriendlyLangPascal = 'Object Pascal'; - SYNS_FriendlyLangX86Asm = 'x86 Assembly'; - SYNS_FriendlyLangPython = 'Python'; - SYNS_FriendlyLangTclTk = 'Tcl/Tk'; - SYNS_FriendlyLangSQL = 'SQL'; - SYNS_FriendlyLangGembase = 'Gembase'; - SYNS_FriendlyLangINI = 'INI'; - SYNS_FriendlyLangSML = 'Standard ML'; - SYNS_FriendlyLangVisualBASIC = 'Visual Basic'; - SYNS_FriendlyLangADSP21xx = 'ADSP21xx'; - SYNS_FriendlyLangPHP = 'PHP'; - SYNS_FriendlyLangSybaseSQL = 'Sybase SQL'; - SYNS_FriendlyLangGeneralMulti = 'General Multi-Highlighter'; - SYNS_FriendlyLangCache = 'Cache Object Script'; - SYNS_FriendlyLangCSS = 'Cascading Style Sheet'; - SYNS_FriendlyLangJScript = 'JavaScript'; - SYNS_FriendlyLangJSON = 'JSON'; - SYNS_FriendlyLangKIX = 'KiXtart'; - SYNS_FriendlyLangBaan = 'Baan 4GL'; - SYNS_FriendlyLangFoxpro = 'Foxpro'; - SYNS_FriendlyLangFortran = 'Fortran'; - SYNS_FriendlyLang68HC11 = '68HC11 Assembler'; - SYNS_FriendlyLangProgress = 'Progress'; - SYNS_FriendlyLangInno = 'Inno Setup Script'; - SYNS_FriendlyLangModelica = 'Modelica'; - SYNS_FriendlyLangModula3 = 'Modula 3'; - SYNS_FriendlyLangSDD = 'Semanta Data Dictionary'; - SYNS_FriendlyLangXML = 'XML'; - SYNS_FriendlyLangGWS = 'GW-TEL'; - SYNS_FriendlyLangSynGenMsgfiles = 'SynGen Msg'; - SYNS_FriendlyLangUnreal = 'Unreal'; - SYNS_FriendlyLangST = 'Structured Text'; - SYNS_FriendlyLangCOBOL = 'COBOL'; - SYNS_FriendlyLangTeX = 'TeX'; - SYNS_FriendlyLangRC = 'Resource'; - SYNS_FriendlyLangRuby = 'Ruby'; - SYNS_FriendlyLangNameUNIXShellScript = 'UNIX Shell Script'; - SYNS_FriendlyLangHaskell = 'Haskell'; - SYNS_FriendlyLangDOT = 'DOT Graph Drawing Description language'; - SYNS_FriendlyLangEiffel = 'Eiffel'; - SYNS_FriendlyLangLDraw = 'LEGO LDraw'; - SYNS_FriendlyLangLLVMIR = 'LLVM Intermediate Representation'; - SYNS_FriendlyLangUnknown = ''; - SYNS_FriendlyLangURI = 'URI'; - SYNS_FriendlyLangVrml97 = 'Vrml97'; - -implementation - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditStrConst.pas, released 2000-04-07. +The Original Code is based on mwLocalStr.pas by Michael Hieke, part of the +mwEdit component suite. +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: SynEditStrConst.pas,v 1.41.2.5 2009/01/06 16:26:01 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynEditStrConst; + +{$I SynEdit.inc} + +interface + +// NOTE: this is design-time stuff, so no need to have it in stringtables +const + SYNS_ComponentsPage = 'SynEdit'; + SYNS_HighlightersPage = 'SynEdit Highlighters'; + +// NOTE: the following constants are used to store information to the registry, +// INI files or XML files. For maximum compatibility only the chars +// 'A'..'Z', 'a'..'z', '0'..'9', '_' and '-' are allowed! +// +// If you want translated/"pretty"/more detailed descriptions use the +// resourcestrings, i.e. the "friendly" versions below. + +// constant names for highlighter attributes +// +// +const + SYNS_AttrAreaAIdentifier = 'Area_A_Identifier'; + SYNS_AttrArrowHead = 'ArrowHead'; + SYNS_AttrAsm = 'Asm'; + SYNS_AttrAsmComment = 'AsmComment'; + SYNS_AttrAsmKey = 'AsmKey'; + SYNS_AttrAssembler = 'Assembler'; + SYNS_AttrAtRules = 'AtRules'; + SYNS_AttrAttribute = 'Attribute'; + SYNS_AttrAttributeName = 'AttributeName'; + SYNS_AttrAttributeValue = 'AttributeValue'; + SYNS_AttrBasicTypes = 'BasicTypes'; + SYNS_AttrBlock = 'Block'; + SYNS_AttrBoolean = 'Booleanvalue'; + SYNS_AttrBrackets = 'Brackets'; + SYNS_AttrCDATASection = 'CDATA-Section'; + SYNS_AttrCharacter = 'Character'; + SYNS_AttrClass = 'Class'; + SYNS_AttrColor = 'ColorValue'; + SYNS_AttrConstant = 'Constant'; + SYNS_AttrComment = 'Comment'; + SYNS_AttrCondition = 'Condition'; + SYNS_AttrConditionalComment = 'ConditionalComment'; + SYNS_AttrConsoleOutput = 'ConsoleOutput'; + SYNS_AttrDataType = 'DataType'; + SYNS_AttrDebugLines = 'DebuggingLines'; + SYNS_AttrDefaultPackage = 'DefaultPackages'; + SYNS_AttrDelimitedIdentifier = 'DelimitedIdentifier'; + SYNS_AttrDir = 'Direction'; + SYNS_AttrDirections = 'Directions'; + SYNS_AttrDirective = 'Directive'; + SYNS_AttrDOCTYPESection = 'DOCTYPE-Section'; + SYNS_AttrDocumentation = 'Documentation'; + SYNS_AttrElementName = 'ElementName'; + SYNS_AttrEmbedSQL = 'EmbeddedSQL'; + SYNS_AttrEmbedText = 'EmbeddedText'; + SYNS_AttrEntityReference = 'EntityReference'; + SYNS_AttrEscapeAmpersand = 'EscapeAmpersand'; + SYNS_AttrEvent = 'Event'; + SYNS_AttrException = 'Exception'; + SYNS_AttrFirstTri = 'FirstTri'; + SYNS_AttrFloat = 'Float'; + SYNS_AttrForm = 'Form'; + SYNS_AttrFourthTri = 'FourthTri'; + SYNS_AttrFunction = 'Function'; + SYNS_AttrHexadecimal = 'Hexadecimal'; + SYNS_AttrIcon = 'IconReference'; + SYNS_AttrIdentifier = 'Identifier'; + SYNS_AttrIllegalChar = 'IllegalChar'; + SYNS_AttrInclude = 'Include'; + SYNS_AttrIndicator = 'IndicatorArea'; + SYNS_AttrIndirect = 'Indirect'; + SYNS_AttrInstructions = 'Instructions'; + SYNS_AttrInvalidSymbol = 'InvalidSymbol'; + SYNS_AttrInterfaceQualifier = 'InterfaceQualifier'; + SYNS_AttrInternalFunction = 'InternalFunction'; + SYNS_AttrKey = 'Key'; + SYNS_AttrLabel = 'Label'; + SYNS_AttrLace = 'Lace'; + SYNS_AttrLine = 'Line'; + SYNS_AttrMacro = 'Macro'; + SYNS_AttrMarker = 'Marker'; + SYNS_AttrMathMode = 'MathMode'; + SYNS_AttrMessage = 'Message'; + SYNS_AttrMiscellaneous = 'Miscellaneous'; + SYNS_AttrNamespaceAttrName = 'NamespaceAttributeName'; + SYNS_AttrNamespaceAttrValue = 'NamespaceAttributeValue'; + SYNS_AttrNonReservedKeyword = 'NonreservedKeyword'; + SYNS_AttrNull = 'Null'; + SYNS_AttrNumber = 'Number'; + SYNS_AttrOctal = 'Octal'; + SYNS_AttrOperator = 'Operator'; + SYNS_AttrOperatorAndSymbols = 'OperatorAndSymbols'; + SYNS_AttrOpLine = 'OpLine'; + SYNS_AttrOptions = 'Options'; + SYNS_AttrPath = 'PathName'; + SYNS_AttrPLSQL = 'PLSQL-ReservedWord'; + SYNS_AttrPragma = 'Pragma'; + SYNS_AttrPredefined = 'Predefined'; + SYNS_AttrPreprocessor = 'Preprocessor'; + SYNS_AttrProcessingInstr = 'ProcessingInstruction'; + SYNS_AttrProcName = 'ProcName'; + SYNS_AttrProperty = 'Property'; + SYNS_AttrQuad = 'Quad'; + SYNS_AttrQualifier = 'Qualifier'; + SYNS_AttrRegister = 'Register'; + SYNS_AttrReservedWord = 'ReservedWord'; + SYNS_AttrResultValue = 'ResultValue'; + SYNS_AttrRoundBracket = 'RoundBracket'; + SYNS_AttrRpl = 'Rpl'; + SYNS_AttrRplKey = 'Rpl-Key'; + SYNS_AttrRplComment = 'Rpl-Comment'; + SYNS_AttrSASM = 'SASM'; + SYNS_AttrSASMComment = 'SASM-Comment'; + SYNS_AttrSASMKey = 'SASM-Key'; + SYNS_AttrSecondReservedWord = 'SecondReservedWord'; + SYNS_AttrSecondTri = 'SecondTri'; + SYNS_AttrSection = 'Section'; + SYNS_AttrSequence = 'SequenceNumberArea'; + SYNS_AttrShape = 'Shape'; + SYNS_AttrSingleString = 'SingleQuotedString'; + SYNS_AttrSpace = 'Space'; + SYNS_AttrSpecialVariable = 'SpecialVariable'; + SYNS_AttrSQLKey = 'SQL-Keyword'; + SYNS_AttrSQLPlus = 'SQLPlus-Command'; + SYNS_AttrSquareBracket = 'SquareBracket'; + SYNS_AttrString = 'String'; + SYNS_AttrSymbol = 'Symbol'; + SYNS_AttrSyntaxError = 'SyntaxError'; + SYNS_AttrSystem = 'SystemFunctionsAndVariables'; + SYNS_AttrSystemValue = 'SystemValue'; + SYNS_AttrTagArea = 'TagArea'; + SYNS_AttrTableName = 'TableName'; + SYNS_AttrTerminator = 'Terminator'; + SYNS_AttrTeXCommand = 'TeX-Command'; + SYNS_AttrText = 'Text'; + SYNS_AttrTextMathMode = 'TextInMathMode'; + SYNS_AttrThirdTri = 'ThirdTri'; + SYNS_AttrTixKeyWords = 'Tix-Keywords'; + SYNS_AttrTriangle = 'Triangle'; + SYNS_AttrUndefinedProperty = 'UndefinedProperty'; + SYNS_AttrUnknownWord = 'UnknownWord'; + SYNS_AttrURI = 'URI'; + SYNS_AttrUser = 'UserFunctionsAndVariables'; + SYNS_AttrUserFunction = 'UserFunctions'; + SYNS_AttrValue = 'Value'; + SYNS_AttrVariable = 'Variable'; + SYNS_AttrVisitedURI = 'VisitedURI'; + SYNS_AttrVrmlAppearance = 'Vrml_Appearance'; + SYNS_AttrVrmlAttribute = 'Vrml_Attribute'; + SYNS_AttrVrmlDefinition = 'Vrml_Definition'; + SYNS_AttrVrmlEvent = 'Vrml_Event'; + SYNS_AttrVrmlGrouping = 'Vrml_Grouping'; + SYNS_AttrVrmlInterpolator = 'Vrml_Interpolator'; + SYNS_AttrVrmlLight = 'Vrml_Light'; + SYNS_AttrVrmlNode = 'Vrml_Node'; + SYNS_AttrVrmlParameter = 'Vrml_Parameter'; + SYNS_AttrVrmlProto = 'Vrml_Proto'; + SYNS_AttrVrmlSensor = 'Vrml_Sensor'; + SYNS_AttrVrmlShape = 'Vrml_Shape'; + SYNS_AttrVrmlShape_Hint = 'Vrml_Shape_Hint'; + SYNS_AttrVrmlTime_dependent = 'Vrml_Time_dependent'; + SYNS_AttrVrmlViewpoint = 'Vrml_Viewpoint'; + SYNS_AttrVrmlWorldInfo = 'Vrml_WorldInfo'; + SYNS_AttrWhitespace = 'Whitespace'; + SYNS_AttrWidgetWords = 'Widget-Keywords'; + SYNS_AttrX3DDocType = 'X3DDocType'; + SYNS_AttrX3DHeader = 'X3DHeader'; + + // constant language names + SYNS_Lang68HC11 = '68HC11_Assembler'; + SYNS_LangADSP21xx = 'ADSP21xx'; + SYNS_LangAWK = 'AWK'; + SYNS_LangBaan = 'Baan_4GL'; + SYNS_LangBatch = 'MS-DOS_Batch'; + SYNS_LangCache = 'CacheObjectScript'; + SYNS_LangCAClipper = 'CA-Clipper'; + SYNS_LangCOBOL = 'COBOL'; + SYNS_LangCORBAIDL = 'CORBA_IDL'; + SYNS_LangCPM = 'COAS_Product_Manager_Report'; + SYNS_LangCPP = 'CandCPlusPlus'; + SYNS_LangCS = 'CSharp'; + SYNS_LangCSS = 'CascadingStyleSheet'; + SYNS_LangDfm = 'BorlandForms'; + SYNS_LangDOT = 'DOT_Graph_Drawing_Description_language'; + SYNS_LangECMAScript = 'ECMAScript'; + SYNS_LangEiffel = 'Eiffel'; + SYNS_LangFortran = 'Fortran'; + SYNS_LangFoxpro = 'Foxpro'; + SYNS_LangGalaxy = 'Galaxy'; + SYNS_LangGembase = 'Gembase'; + SYNS_LangGeneral = 'General'; + SYNS_LangGeneralMulti = 'General_Multi-Highlighter'; + SYNS_LangGLSL = 'OpenGL Shader Language'; + SYNS_LangGo = 'Go'; + SYNS_LangGWS = 'GW-TEL'; + SYNS_LangHaskell = 'Haskell'; + SYNS_LangHP48 = 'HP48'; + SYNS_LangHTML = 'HTML'; + SYNS_LangINI = 'INI'; + SYNS_LangInno = 'InnoSetupScript'; + SYNS_LangJava = 'Java'; + SYNS_LangJScript = 'JavaScript'; + SYNS_LangJSON = 'JSON'; + SYNS_LangKIX = 'KiXtart'; + SYNS_LangLDraw = 'LEGO_LDraw'; + SYNS_LangLLVMIR = 'LLVM IR'; + SYNS_LangMASM = 'x86Assembly MASM'; + SYNS_LangModelica = 'Modelica'; + SYNS_LangModula3 = 'Modula3'; + SYNS_LangNameUNIXShellScript = 'UNIXShellScript'; + SYNS_LangPascal = 'ObjectPascal'; + SYNS_LangPerl = 'Perl'; + SYNS_LangPHP = 'PHP'; + SYNS_LangProgress = 'Progress'; + SYNS_LangPython = 'Python'; + SYNS_LangRC = 'Resource'; + SYNS_LangRuby = 'Ruby'; + SYNS_LangSDD = 'SemantaDataDictionary'; + SYNS_LangSML = 'StandardML'; + SYNS_LangSQL = 'SQL'; + SYNS_LangST = 'StructuredText'; + SYNS_LangSybaseSQL = 'SybaseSQL'; + SYNS_LangSynGenMsgfiles = 'SynGen_Msg'; + SYNS_LangTclTk = 'TclTk'; + SYNS_LangTeX = 'TeX'; + SYNS_LangUnknown = ''; + SYNS_LangUnreal = 'Unreal'; + SYNS_LangURI = 'URI'; + SYNS_LangVBSScript = 'MS-VBScript'; + SYNS_LangVisualBASIC = 'VisualBasic'; + SYNS_LangVrml97 = 'Vrml97'; + SYNS_LangX86Asm = 'x86Assembly'; + SYNS_LangXML = 'XML'; + +resourcestring + SYNS_NoSearchEngineError = 'No search engine has been assigned'; + + SYNS_Untitled = 'Untitled'; + + // Friendly names for highlighter attributes + SYNS_FriendlyAttrAreaAIdentifier = 'Area A Identifier'; + SYNS_FriendlyAttrArrowHead = 'ArrowHead'; + SYNS_FriendlyAttrAsm = 'Asm'; + SYNS_FriendlyAttrAsmComment = 'Asm Comment'; + SYNS_FriendlyAttrAsmKey = 'Asm Key'; + SYNS_FriendlyAttrAssembler = 'Assembler'; + SYNS_FriendlyAttrAtRules = '@-Rules'; + SYNS_FriendlyAttrAttribute = 'Attribute'; + SYNS_FriendlyAttrAttributeName = 'Attribute Name'; + SYNS_FriendlyAttrAttributeValue = 'Attribute Value'; + SYNS_FriendlyAttrBasicTypes = 'Basic Types'; + SYNS_FriendlyAttrBlock = 'Block'; + SYNS_FriendlyAttrBoolean = 'Boolean value'; + SYNS_FriendlyAttrBrackets = 'Brackets'; + SYNS_FriendlyAttrCDATASection = 'CDATA Section'; + SYNS_FriendlyAttrCharacter = 'Character'; + SYNS_FriendlyAttrClass = 'Class'; + SYNS_FriendlyAttrColor = 'Color Value'; + SYNS_FriendlyAttrComment = 'Comment'; + SYNS_FriendlyAttrCondition = 'Condition'; + SYNS_FriendlyAttrConditionalComment = 'Conditional Comment'; + SYNS_FriendlyAttrConsoleOutput = 'Console output'; + SYNS_FriendlyAttrConstant = 'Constant'; + SYNS_FriendlyAttrDataType = 'Data Type'; + SYNS_FriendlyAttrDebugLines = 'Debugging Lines'; + SYNS_FriendlyAttrDefaultPackage = 'Default Packages'; + SYNS_FriendlyAttrDelimitedIdentifier = 'Delimited Identifier'; + SYNS_FriendlyAttrDir = 'Direction'; + SYNS_FriendlyAttrDirections = 'Directions'; + SYNS_FriendlyAttrDirective = 'Directive'; + SYNS_FriendlyAttrDOCTYPESection = 'DOCTYPE Section'; + SYNS_FriendlyAttrDocumentation = 'Documentation'; + SYNS_FriendlyAttrElementName = 'Element Name'; + SYNS_FriendlyAttrEmbedSQL = 'Embedded SQL'; + SYNS_FriendlyAttrEmbedText = 'Embedded Text'; + SYNS_FriendlyAttrEntityReference = 'Entity Reference'; + SYNS_FriendlyAttrEscapeAmpersand = 'Escape Ampersand'; + SYNS_FriendlyAttrEvent = 'Event'; + SYNS_FriendlyAttrException = 'Exception'; + SYNS_FriendlyAttrFirstTri = 'FirstTri'; + SYNS_FriendlyAttrFloat = 'Float'; + SYNS_FriendlyAttrForm = 'Form'; + SYNS_FriendlyAttrFourthTri = 'FourthTri'; + SYNS_FriendlyAttrFunction = 'Function'; + SYNS_FriendlyAttrHexadecimal = 'Hexadecimal'; + SYNS_FriendlyAttrIcon = 'Icon Reference'; + SYNS_FriendlyAttrIdentifier = 'Identifier'; + SYNS_FriendlyAttrIllegalChar = 'Illegal Char'; + SYNS_FriendlyAttrInclude = 'Include'; + SYNS_FriendlyAttrIndicator = 'Indicator Area'; + SYNS_FriendlyAttrIndirect = 'Indirect'; + SYNS_FriendlyAttrInstructions = 'Instructions'; + SYNS_FriendlyAttrInterfaceQualifier = 'Interface Qualifier'; + SYNS_FriendlyAttrInternalFunction = 'Internal Function'; + SYNS_FriendlyAttrInvalidSymbol = 'Invalid Symbol'; + SYNS_FriendlyAttrKey = 'Key'; + SYNS_FriendlyAttrLabel = 'Label'; + SYNS_FriendlyAttrLace = 'Lace'; + SYNS_FriendlyAttrLine = 'Line'; + SYNS_FriendlyAttrMacro = 'Macro'; + SYNS_FriendlyAttrMarker = 'Marker'; + SYNS_FriendlyAttrMathMode = 'Math Mode'; + SYNS_FriendlyAttrMessage = 'Message'; + SYNS_FriendlyAttrMiscellaneous = 'Miscellaneous'; + SYNS_FriendlyAttrNamespaceAttrName = 'Namespace Attribute Name'; + SYNS_FriendlyAttrNamespaceAttrValue = 'Namespace Attribute Value'; + SYNS_FriendlyAttrNonReservedKeyword = 'Non-reserved Keyword'; + SYNS_FriendlyAttrNull = 'Null'; + SYNS_FriendlyAttrNumber = 'Number'; + SYNS_FriendlyAttrOctal = 'Octal'; + SYNS_FriendlyAttrOperator = 'Operator'; + SYNS_FriendlyAttrOperatorAndSymbols = 'Operator And Symbols'; + SYNS_FriendlyAttrOpLine = 'OpLine'; + SYNS_FriendlyAttrOptions = 'Options'; + SYNS_FriendlyAttrPath = 'Pathname'; + SYNS_FriendlyAttrPLSQL = 'PL/SQL Reserved Word'; + SYNS_FriendlyAttrPragma = 'Pragma'; + SYNS_FriendlyAttrPredefined = 'Predefined'; + SYNS_FriendlyAttrPreprocessor = 'Preprocessor'; + SYNS_FriendlyAttrProcessingInstr = 'Processing Instruction'; + SYNS_FriendlyAttrProcName = 'Procedure name'; + SYNS_FriendlyAttrProperty = 'Property'; + SYNS_FriendlyAttrQuad = 'Quad'; + SYNS_FriendlyAttrQualifier = 'Qualifier'; + SYNS_FriendlyAttrRegister = 'Register'; + SYNS_FriendlyAttrReservedWord = 'Reserved Word'; + SYNS_FriendlyAttrResultValue = 'Result Value'; + SYNS_FriendlyAttrRoundBracket = 'Round Bracket'; + SYNS_FriendlyAttrRpl = 'Rpl'; + SYNS_FriendlyAttrRplKey = 'Rpl Key'; + SYNS_FriendlyAttrRplComment = 'Rpl Comment'; + SYNS_FriendlyAttrSASM = 'SASM'; + SYNS_FriendlyAttrSASMComment = 'SASM Comment'; + SYNS_FriendlyAttrSASMKey = 'SASM Key'; + SYNS_FriendlyAttrSecondReservedWord = 'Second Reserved Word'; + SYNS_FriendlyAttrSecondTri = 'SecondTri'; + SYNS_FriendlyAttrSection = 'Section'; + SYNS_FriendlyAttrSequence = 'Sequence Number Area'; + SYNS_FriendlyAttrShape = 'Shape'; + SYNS_FriendlyAttrSingleString = 'Single Quoted String'; + SYNS_FriendlyAttrSpace = 'Space'; + SYNS_FriendlyAttrSpecialVariable = 'Special Variable'; + SYNS_FriendlyAttrSQLKey = 'SQL Keyword'; + SYNS_FriendlyAttrSQLPlus = 'SQL*Plus Command'; + SYNS_FriendlyAttrSquareBracket = 'Square Bracket'; + SYNS_FriendlyAttrString = 'String'; + SYNS_FriendlyAttrSymbol = 'Symbol'; + SYNS_FriendlyAttrSyntaxError = 'Syntax Error'; + SYNS_FriendlyAttrSystem = 'System Functions and Variables'; + SYNS_FriendlyAttrSystemValue = 'System Value'; + SYNS_FriendlyAttrTagArea = 'Tag Area'; + SYNS_FriendlyAttrTableName = 'Table Name'; + SYNS_FriendlyAttrTerminator = 'Terminator'; + SYNS_FriendlyAttrTeXCommand = 'TeX Command'; + SYNS_FriendlyAttrText = 'Text'; + SYNS_FriendlyAttrTextMathMode = 'Text in Math Mode'; + SYNS_FriendlyAttrThirdTri = 'ThirdTri'; + SYNS_FriendlyAttrTixKeyWords = 'Tix Keywords'; + SYNS_FriendlyAttrTriangle = 'Triangle'; + SYNS_FriendlyAttrUndefinedProperty = 'Undefined Property'; + SYNS_FriendlyAttrUnknownWord = 'Unknown Word'; + SYNS_FriendlyAttrURI = 'URI'; + SYNS_FriendlyAttrUser = 'User Functions and Variables'; + SYNS_FriendlyAttrUserFunction = 'User Functions'; + SYNS_FriendlyAttrValue = 'Value'; + SYNS_FriendlyAttrVariable = 'Variable'; + SYNS_FriendlyAttrVisitedURI = 'Visited URI'; + SYNS_FriendlyAttrVrmlAppearance = 'Vrml_Appearance'; + SYNS_FriendlyAttrVrmlAttribute = 'Vrml_Attribute'; + SYNS_FriendlyAttrVrmlDefinition = 'Vrml_Definition'; + SYNS_FriendlyAttrVrmlEvent = 'Vrml_Event'; + SYNS_FriendlyAttrVrmlGrouping = 'Vrml_Grouping'; + SYNS_FriendlyAttrVrmlInterpolator = 'Vrml_Interpolator'; + SYNS_FriendlyAttrVrmlLight = 'Vrml_Light'; + SYNS_FriendlyAttrVrmlNode = 'Vrml_Node'; + SYNS_FriendlyAttrVrmlParameter = 'Vrml_Parameter'; + SYNS_FriendlyAttrVrmlProto = 'Vrml_Proto'; + SYNS_FriendlyAttrVrmlSensor = 'Vrml_Sensor'; + SYNS_FriendlyAttrVrmlShape = 'Vrml_Shape'; + SYNS_FriendlyAttrVrmlShape_Hint = 'Vrml_Shape_Hint'; + SYNS_FriendlyAttrVrmlTime_dependent = 'Vrml_Time_dependent'; + SYNS_FriendlyAttrVrmlViewpoint = 'Vrml_Viewpoint'; + SYNS_FriendlyAttrVrmlWorldInfo = 'Vrml_WorldInfo'; + SYNS_FriendlyAttrWhitespace = 'Whitespace'; + SYNS_FriendlyAttrWidgetWords = 'Widget Keywords'; + SYNS_FriendlyAttrX3DDocType = 'X3DDocType'; + SYNS_FriendlyAttrX3DHeader = 'X3DHeader'; + + // names of exporter output formats + SYNS_ExporterFormatHTML = 'HTML'; + SYNS_ExporterFormatRTF = 'RTF'; + SYNS_ExporterFormatTeX = 'TeX'; + + // TCustomSynEdit scroll hint window caption + SYNS_ScrollInfoFmt = '%d - %d'; + SYNS_ScrollInfoFmtTop = 'Top Line: %d'; + // TSynEditPrintPreview page number + SYNS_PreviewScrollInfoFmt = 'Page: %d'; + + // strings for property editors etc + SYNS_EDuplicateShortcut = 'Shortcut already exists'; + SYNS_ShortcutNone = ''; + SYNS_DuplicateShortcutMsg = 'The keystroke "%s" is already assigned ' + + 'to another editor command. (%s)'; + SYNS_DuplicateShortcutMsg2 = 'The keystroke "%s" is already assigned ' + + 'to another editor command.'#13#10'The ' + + 'shortcut for this item has not been changed.'; + + // Filters used for open/save dialog + SYNS_FilterADSP21xx = 'DSP Files (*.dsp;*.inc)|*.dsp;*.inc'; + SYNS_FilterAsm68HC11 = '68HC11 Assembler Files (*.hc11;*.asm;*.asc)|*.hc11;*.asm;*.asc'; + SYNS_FilterAWK = 'AWK Scripts (*.awk)|*.awk'; + SYNS_FilterBaan = 'Baan 4GL Files (*.cln)|*.cln'; + SYNS_FilterBatch = 'MS-DOS Batch Files (*.bat;*.cmd)|*.bat;*.cmd'; + SYNS_FilterCache = 'Cache Files (*.mac;*.inc;*.int)|*.mac;*.inc;*.int'; + SYNS_FilterCAClipper = 'CA-Clipper Files (*.prg;*.ch;*.inc)|*.prg;*.ch;*.inc'; + SYNS_FilterCOBOL = 'COBOL Files (*.cbl;*.cob)|*.cbl;*.cob'; + SYNS_FilterCORBAIDL = 'CORBA IDL Files (*.idl)|*.idl'; + SYNS_FilterCPM = 'CPM Reports (*.rdf;*.rif;*.rmf;*.rxf)|*.rdf;*.rif;*.rmf;*.rxf'; + SYNS_FilterCPP = 'C/C++ Files (*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu)|*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu'; + SYNS_FilterCS = 'C# Files (*.cs)|*.cs'; + SYNS_FilterCSS = 'Cascading Stylesheets (*.css)|*.css'; + SYNS_FilterDFM = 'Borland Form Files (*.dfm;*.xfm)|*.dfm;*.xfm'; + SYNS_FilterDOT = 'DOT Graph Drawing Description (*.dot)|*.dot'; + SYNS_FilterDWS = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc'; + SYNS_FilterEcmaScript = 'Javascript Files (*.js)|*.js'; + SYNS_FilterEiffel = 'Eiffel (*.e;*.ace)|*.e;*.ace'; + SYNS_FilterFortran = 'Fortran Files (*.for)|*.for'; + SYNS_FilterFoxpro = 'Foxpro Files (*.prg)|*.prg'; + SYNS_FilterGalaxy = 'Galaxy Files (*.gtv;*.galrep;*.txt)|*.gtv;*.galrep;*.txt'; + SYNS_FilterGembase = 'GEMBASE Files (*.dml;*.gem)|*.dml;*.gem'; + SYNS_FilterGo = 'Go files (*.go)|*.go'; + SYNS_FilterGLSL = 'GLSL files (*.glsl)|*.glsl'; + SYNS_FilterGWS = 'GW-TEL Scripts (*.gws)|*.gws'; + SYNS_FilterHaskell = 'Haskell Files (*.hs;*.lhs)|*.hs;*.lhs'; + SYNS_FilterHP48 = 'HP48 Files (*.s;*.sou;*.a;*.hp)|*.s;*.sou;*.a;*.hp'; + SYNS_FilterHTML = 'HTML Documents (*.htm;*.html)|*.htm;*.html'; + SYNS_FilterINI = 'INI Files (*.ini)|*.ini'; + SYNS_FilterInno = 'Inno Setup Scripts (*.iss)|*.iss'; + SYNS_FilterJava = 'Java Files (*.java)|*.java'; + SYNS_FilterJScript = 'Javascript Files (*.js)|*.js'; + SYNS_FilterJSON = 'JSON Files (*.json)|*.json'; + SYNS_FilterKIX = 'KiXtart Scripts (*.kix)|*.kix'; + SYNS_FilterLDraw = 'LEGO LDraw Files (*.ldr)|*.ldr'; + SYNS_FilterLLVMIR = 'LLVM IR files (*.ll)|*.ll'; + SYNS_FilterModelica = 'Modelica Files (*.mo)|*.mo'; + SYNS_FilterModula3 = 'Modula-3 Files (*.m3)|*.m3'; + SYNS_FilterPascal = 'Pascal Files (*.pas;*.pp;*.dpr;*.dpk;*.inc)|*.pas;*.pp;*.dpr;*.dpk;*.inc'; + SYNS_FilterPerl = 'Perl Files (*.pl;*.pm;*.cgi)|*.pl;*.pm;*.cgi'; + SYNS_FilterPHP = 'PHP Files (*.php;*.php3;*.phtml;*.inc)|*.php;*.php3;*.phtml;*.inc'; + SYNS_FilterProgress = 'Progress Files (*.w;*.p;*.i)|*.w;*.p;*.i'; + SYNS_FilterPython = 'Python Files (*.py)|*.py'; + SYNS_FilterRC = 'Resource Files (*.rc)|*.rc'; + SYNS_FilterRTF = 'Rich Text Format Documents (*.rtf)|*.rtf'; + SYNS_FilterRuby = 'Ruby Files (*.rb;*.rbw)|*.rb;*.rbw'; + SYNS_FilterSDD = 'Semanta DD Files (*.sdd)|*.sdd'; + SYNS_FilterSML = 'Standard ML Files (*.sml)|*.sml'; + SYNS_FilterSQL = 'SQL Files (*.sql)|*.sql'; + SYNS_FilterST = 'Structured Text Files (*.st)|*.st'; + SYNS_FilterSynGenMsgfiles = 'Msg Files (*.msg)|*.msg'; + SYNS_FilterTclTk = 'Tcl/Tk Files (*.tcl)|*.tcl'; + SYNS_FilterTeX = 'TeX Files (*.tex)|*.tex'; + SYNS_FilterUNIXShellScript = 'UNIX Shell Scripts (*.sh)|*.sh'; + SYNS_FilterURI = 'All Files (*.*)|*.*'; + SYNS_FilterVBScript = 'VBScript Files (*.vbs)|*.vbs'; + SYNS_FilterVisualBASIC = 'Visual Basic Files (*.bas)|*.bas'; + SYNS_FilterVrml97 = 'Vrml97/X3D World (*.wrl;*.wrml;*.vrl;*.vrml;*.x3d)|*.wrl;*.wrml;*.vrl;*.vrml;*.x3d'; + SYNS_FilterX86Assembly = 'x86 Assembly Files (*.asm)|*.asm'; + SYNS_FilterXML = 'XML Files (*.xml;*.xsd;*.xsl;*.xslt;*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'; + + // friendly language names + SYNS_FriendlyLang68HC11 = '68HC11 Assembler'; + SYNS_FriendlyLangADSP21xx = 'ADSP21xx'; + SYNS_FriendlyLangAWK = 'AWK'; + SYNS_FriendlyLangBaan = 'Baan 4GL'; + SYNS_FriendlyLangBatch = 'MS-DOS Batch'; + SYNS_FriendlyLangCache = 'Cache Object Script'; + SYNS_FriendlyLangCAClipper = 'CA-Clipper'; + SYNS_FriendlyLangCOBOL = 'COBOL'; + SYNS_FriendlyLangCORBAIDL = 'CORBA IDL'; + SYNS_FriendlyLangCPM = 'COAS Product Manager Report'; + SYNS_FriendlyLangCPP = 'C/C++'; + SYNS_FriendlyLangCS = 'C#'; + SYNS_FriendlyLangCSS = 'Cascading Style Sheet'; + SYNS_FriendlyLangDfm = 'Borland Forms'; + SYNS_FriendlyLangDOT = 'DOT Graph Drawing Description language'; + SYNS_FriendlyLangEcmaScript = 'ECMA Script'; + SYNS_FriendlyLangEiffel = 'Eiffel'; + SYNS_FriendlyLangFortran = 'Fortran'; + SYNS_FriendlyLangFoxpro = 'Foxpro'; + SYNS_FriendlyLangGalaxy = 'Galaxy'; + SYNS_FriendlyLangGembase = 'Gembase'; + SYNS_FriendlyLangGeneral = 'General'; + SYNS_FriendlyLangGeneralMulti = 'General Multi-Highlighter'; + SYNS_FriendlyLangGo = 'Go'; + SYNS_FriendlyLangGLSL = 'GLSL'; + SYNS_FriendlyLangGWS = 'GW-TEL'; + SYNS_FriendlyLangHaskell = 'Haskell'; + SYNS_FriendlyLangHP48 = 'HP48'; + SYNS_FriendlyLangHTML = 'HTML'; + SYNS_FriendlyLangINI = 'INI'; + SYNS_FriendlyLangInno = 'Inno Setup Script'; + SYNS_FriendlyLangJava = 'Java'; + SYNS_FriendlyLangJavaScript = 'JavaScript'; + SYNS_FriendlyLangJScript = 'JavaScript'; + SYNS_FriendlyLangJSON = 'JSON'; + SYNS_FriendlyLangKIX = 'KiXtart'; + SYNS_FriendlyLangLDraw = 'LEGO LDraw'; + SYNS_FriendlyLangLLVMIR = 'LLVM Intermediate Representation'; + SYNS_FriendlyLangMASM = 'x86 Assembly MASM'; + SYNS_FriendlyLangModelica = 'Modelica'; + SYNS_FriendlyLangModula3 = 'Modula 3'; + SYNS_FriendlyLangNameUNIXShellScript = 'UNIX Shell Script'; + SYNS_FriendlyLangPascal = 'Object Pascal'; + SYNS_FriendlyLangPerl = 'Perl'; + SYNS_FriendlyLangPHP = 'PHP'; + SYNS_FriendlyLangProgress = 'Progress'; + SYNS_FriendlyLangPython = 'Python'; + SYNS_FriendlyLangRC = 'Resource'; + SYNS_FriendlyLangRuby = 'Ruby'; + SYNS_FriendlyLangSDD = 'Semanta Data Dictionary'; + SYNS_FriendlyLangSML = 'Standard ML'; + SYNS_FriendlyLangSQL = 'SQL'; + SYNS_FriendlyLangST = 'Structured Text'; + SYNS_FriendlyLangSybaseSQL = 'Sybase SQL'; + SYNS_FriendlyLangSynGenMsgfiles = 'SynGen Msg'; + SYNS_FriendlyLangTclTk = 'Tcl/Tk'; + SYNS_FriendlyLangTeX = 'TeX'; + SYNS_FriendlyLangUnknown = ''; + SYNS_FriendlyLangUnreal = 'Unreal'; + SYNS_FriendlyLangURI = 'URI'; + SYNS_FriendlyLangVBSScript = 'MS VBScript'; + SYNS_FriendlyLangVisualBASIC = 'Visual Basic'; + SYNS_FriendlyLangVrml97 = 'Vrml97'; + SYNS_FriendlyLangX86Asm = 'x86 Assembly'; + SYNS_FriendlyLangXML = 'XML'; + +implementation + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditTextBuffer.pas b/Source/VCL/SynEdit/Source/SynEditTextBuffer.pas index 5a5671a6..b42a93a9 100644 --- a/Source/VCL/SynEdit/Source/SynEditTextBuffer.pas +++ b/Source/VCL/SynEdit/Source/SynEditTextBuffer.pas @@ -1,1223 +1,1397 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditTextBuffer.pas, released 2000-04-07. -The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, -part of the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -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. - -Known Issues: --------------------------------------------------------------------------------} -//todo: Avoid calculating expanded string unncessarily (just calculate expandedLength instead). - -unit SynEditTextBuffer; - -{$I SynEdit.inc} - -interface - -uses - Windows, - SynEditTypes, - SynEditMiscProcs, - SynUnicode, - Classes, - SysUtils, - Graphics; - -type - TSynEditRange = pointer; - - TSynEditStringFlag = (sfHasTabs, sfHasNoTabs, sfExpandedLengthUnknown); - TSynEditStringFlags = set of TSynEditStringFlag; - - PSynEditStringRec = ^TSynEditStringRec; - TSynEditStringRec = record - FString: string; - fObject: TObject; - fRange: TSynEditRange; - fExpandedLength: Integer; - fCharIndex : Integer; - fFlags: TSynEditStringFlags; - end; - - TSynEditTwoWideChars = record - One, Two : WideChar; - end; - PSynEditTwoWideChars = ^TSynEditTwoWideChars; - -const - SynEditStringRecSize = SizeOf(TSynEditStringRec); - MaxSynEditStrings = MaxInt div SynEditStringRecSize; - - NullRange = TSynEditRange(-1); - -type - PSynEditStringRecList = ^TSynEditStringRecList; - TSynEditStringRecList = array[0..MaxSynEditStrings - 1] of TSynEditStringRec; - - TStringListChangeEvent = procedure(Sender: TObject; Index: Integer; - Count: integer) of object; - - TExpandAtWideGlyphsFunc = function (const S: string): string of object; - - TSynEditStringList = class(TStrings) - private - fList: PSynEditStringRecList; - fCount: integer; - fCapacity: integer; - fFileFormat: TSynEditFileFormat; - fConvertTabsProc: TConvertTabsProcEx; - fIndexOfLongestLine: integer; - fTabWidth: integer; - fExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc; - fCharIndexesAreValid : Boolean; - fDetectUTF8: Boolean; - fUTF8CheckLen: Integer; - fOnChange: TNotifyEvent; - fOnChanging: TNotifyEvent; - fOnCleared: TNotifyEvent; - fOnDeleted: TStringListChangeEvent; - fOnInserted: TStringListChangeEvent; - fOnPutted: TStringListChangeEvent; - fOnInfoLoss: TSynInfoLossEvent; - function ExpandString(Index: integer): string; - function GetExpandedString(Index: integer): string; - function GetExpandedStringLength(Index: integer): integer; - function GetLengthOfLongestLine: Integer; - function GetRange(Index: integer): TSynEditRange; - procedure Grow; - procedure InsertItem(Index: integer; const S: string); - procedure PutRange(Index: integer; ARange: TSynEditRange); - protected - function Get(Index: Integer): string; override; - function GetCapacity: integer; override; - function GetCount: integer; override; - function GetObject(Index: integer): TObject; override; - procedure Put(Index: integer; const S: string); override; - procedure PutObject(Index: integer; AObject: TObject); override; - procedure SetCapacity(NewCapacity: integer); override; - procedure SetTabWidth(Value: integer); - procedure SetUpdateState(Updating: Boolean); override; - procedure UpdateCharIndexes; - public - constructor Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); - destructor Destroy; override; - function Add(const S: string): integer; override; - procedure AddStrings(Strings: TStrings); override; - procedure Clear; override; - procedure Delete(Index: integer); override; - procedure DeleteLines(Index, NumLines: integer); - procedure Exchange(Index1, Index2: integer); override; - procedure Insert(Index: integer; const S: string); override; - procedure InsertLines(Index, NumLines: integer); - procedure InsertStrings(Index: integer; NewStrings: TStrings); - procedure InsertText(Index: integer; NewText: string); - procedure LoadFromStream(Stream: TStream; Encoding: TEncoding); override; - procedure SaveToStream(Stream: TStream; Encoding: TEncoding); override; - function GetSeparatedText(Separators: string): string; - procedure FontChanged; - function LineCharLength(Index : Integer) : Integer; - function LineCharIndex(Index : Integer) : Integer; - procedure SetTextAndFileFormat(const Value: string); - procedure SetEncoding(const Value: TEncoding); override; - - property FileFormat: TSynEditFileFormat read fFileFormat write fFileFormat; - property ExpandedStrings[Index: integer]: string read GetExpandedString; - property ExpandedStringLengths[Index: integer]: integer read GetExpandedStringLength; - property LengthOfLongestLine: Integer read GetLengthOfLongestLine; - property Ranges[Index: integer]: TSynEditRange read GetRange write PutRange; - property TabWidth: integer read fTabWidth write SetTabWidth; - property UTF8CheckLen: Integer read fUTF8CheckLen write fUTF8CheckLen; - property DetectUTF8: Boolean read fDetectUTF8 write fDetectUTF8; - property OnChange: TNotifyEvent read fOnChange write fOnChange; - property OnChanging: TNotifyEvent read fOnChanging write fOnChanging; - property OnCleared: TNotifyEvent read fOnCleared write fOnCleared; - property OnDeleted: TStringListChangeEvent read fOnDeleted write fOnDeleted; - property OnInserted: TStringListChangeEvent read fOnInserted - write fOnInserted; - property OnPutted: TStringListChangeEvent read fOnPutted write fOnPutted; - property OnInfoLoss: TSynInfoLossEvent read fOnInfoLoss write fOnInfoLoss; - end; - - ESynEditStringList = class(Exception); - - // Note: several undo entries can be chained together via the ChangeNumber - // see also TCustomSynEdit.[Begin|End]UndoBlock methods - TSynChangeReason = (crInsert, - crDelete, crSilentDelete, - crLineBreak, crIndent, crUnindent, - crAutoCompleteBegin, crAutoCompleteEnd, - crPasteBegin, crPasteEnd, // for pasting, since it might do a lot of operations - crSpecialBegin, crSpecialEnd, - crCaret, // just restore the Caret, allowing better Undo behavior - crSelection, // restore Selection - crNothing, // can be used to break group undo - crGroupBreak, - crDeleteAll, - crWhiteSpaceAdd // for undo/redo of adding a character past EOL and repositioning the caret - ); - - TSynEditUndoItem = class(TPersistent) - protected - fChangeReason: TSynChangeReason; - fChangeSelMode: TSynSelectionMode; - fChangeStartPos: TBufferCoord; - fChangeEndPos: TBufferCoord; - fChangeStr: string; - fChangeNumber: integer; - public - procedure Assign(Source: TPersistent); override; - property ChangeReason: TSynChangeReason read fChangeReason; - property ChangeSelMode: TSynSelectionMode read fChangeSelMode; - property ChangeStartPos: TBufferCoord read fChangeStartPos; - property ChangeEndPos: TBufferCoord read fChangeEndPos; - property ChangeStr: string read fChangeStr; - property ChangeNumber: integer read fChangeNumber; - end; - - TSynEditUndoList = class(TPersistent) - protected - fBlockChangeNumber: integer; - fBlockCount: integer; - fFullUndoImposible: boolean; - fItems: TList; - fLockCount: integer; - fMaxUndoActions: integer; - fNextChangeNumber: integer; - fInitialChangeNumber: integer; - fInsideRedo: boolean; - fOnAddedUndo: TNotifyEvent; - procedure EnsureMaxEntries; - function GetCanUndo: boolean; - function GetItemCount: integer; - procedure SetMaxUndoActions(Value: integer); - procedure SetInitialState(const Value: boolean); - function GetInitialState: boolean; - function GetItems(Index: Integer): TSynEditUndoItem; - procedure SetItems(Index: Integer; const Value: TSynEditUndoItem); - public - constructor Create; - destructor Destroy; override; - procedure AddChange(AReason: TSynChangeReason; const AStart, AEnd: TBufferCoord; - const ChangeText: string; SelMode: TSynSelectionMode); - procedure BeginBlock; - procedure Clear; - procedure EndBlock; - procedure Lock; - function PeekItem: TSynEditUndoItem; - function PopItem: TSynEditUndoItem; - procedure PushItem(Item: TSynEditUndoItem); - procedure Unlock; - function LastChangeReason: TSynChangeReason; - public - procedure Assign(Source: TPersistent); override; - procedure AddGroupBreak; - procedure DeleteItem(AIndex: Integer); - property BlockChangeNumber: integer read fBlockChangeNumber - write fBlockChangeNumber; - property CanUndo: boolean read GetCanUndo; - property FullUndoImpossible: boolean read fFullUndoImposible; - property InitialState: boolean read GetInitialState write SetInitialState; - property Items[Index: Integer]: TSynEditUndoItem read GetItems write SetItems; - property ItemCount: integer read GetItemCount; - property BlockCount: integer read fBlockCount; - property MaxUndoActions: integer read fMaxUndoActions - write SetMaxUndoActions; - property InsideRedo: boolean read fInsideRedo write fInsideRedo; - property OnAddedUndo: TNotifyEvent read fOnAddedUndo write fOnAddedUndo; - end; - -implementation - -resourcestring - SListIndexOutOfBounds = 'Invalid stringlist index %d'; - SInvalidCapacity = 'Stringlist capacity cannot be smaller than count'; - -{ TSynEditStringList } - -procedure ListIndexOutOfBounds(Index: integer); -begin - raise ESynEditStringList.CreateFmt(SListIndexOutOfBounds, [Index]); -end; - -constructor TSynEditStringList.Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); -begin - inherited Create; - fExpandAtWideGlyphsFunc := AExpandAtWideGlyphsFunc; - fFileFormat := sffDos; - fIndexOfLongestLine := -1; - TabWidth := 8; - fUTF8CheckLen := -1; - Options := Options - [soWriteBOM, soTrailingLineBreak]; - fDetectUTF8 := True; -end; - -destructor TSynEditStringList.Destroy; -begin - fOnChange := nil; - fOnChanging := nil; - inherited Destroy; - if fCount <> 0 then - Finalize(fList^[0], fCount); - fCount := 0; - SetCapacity(0); -end; - -function TSynEditStringList.Add(const S: string): integer; -begin - BeginUpdate; - Result := fCount; - InsertItem(Result, S); - if Assigned(OnInserted) then - OnInserted(Self, Result, 1); - EndUpdate; -end; - -procedure TSynEditStringList.AddStrings(Strings: TStrings); -var - i, FirstAdded: integer; -begin - if Strings.Count > 0 then begin - fIndexOfLongestLine := -1; - BeginUpdate; - try - i := fCount + Strings.Count; - if i > fCapacity then - SetCapacity((i + 15) and (not 15)); - FirstAdded := fCount; - for i := 0 to Strings.Count - 1 do begin - with fList^[fCount] do begin - Pointer(fString) := nil; - fString := Strings[i]; - fObject := Strings.Objects[i]; - fRange := NullRange; - fExpandedLength := -1; - fFlags := [sfExpandedLengthUnknown]; - end; - Inc(fCount); - end; - if Assigned(OnInserted) then - OnInserted(Self, FirstAdded, Strings.Count); - finally - EndUpdate; - end; - end; -end; - -procedure TSynEditStringList.SetEncoding(const Value: TEncoding); -begin - inherited; -end; - -procedure TSynEditStringList.Clear; -begin - if fCount <> 0 then begin - BeginUpdate; - Finalize(fList^[0], fCount); - fCount := 0; - SetCapacity(0); - if Assigned(fOnCleared) then - fOnCleared(Self); - EndUpdate; - end; - fIndexOfLongestLine := -1; -end; - -procedure TSynEditStringList.Delete(Index: integer); -begin - if (Index < 0) or (Index >= fCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - Finalize(fList^[Index]); - Dec(fCount); - if Index < fCount then begin - System.Move(fList^[Index + 1], fList^[Index], - (fCount - Index) * SynEditStringRecSize); - end; - fIndexOfLongestLine := -1; - if Assigned(fOnDeleted) then - fOnDeleted( Self, Index, 1 ); - EndUpdate; -end; - -procedure TSynEditStringList.DeleteLines(Index, NumLines: Integer); -var - LinesAfter: integer; -begin - if NumLines > 0 then begin - if (Index < 0) or (Index >= fCount) then - ListIndexOutOfBounds(Index); - LinesAfter := fCount - (Index + NumLines); - if LinesAfter < 0 then - NumLines := fCount - Index; - Finalize(fList^[Index], NumLines); - - if LinesAfter > 0 then begin - BeginUpdate; - try - System.Move(fList^[Index + NumLines], fList^[Index], - LinesAfter * SynEditStringRecSize); - finally - EndUpdate; - end; - end; - Dec(fCount, NumLines); - if Assigned(fOnDeleted) then - fOnDeleted( Self, Index, NumLines ); - end; -end; - -procedure TSynEditStringList.Exchange(Index1, Index2: integer); -var - Temp: TSynEditStringRec; -begin - if (Index1 < 0) or (Index1 >= fCount) then - ListIndexOutOfBounds(Index1); - if (Index2 < 0) or (Index2 >= fCount) then - ListIndexOutOfBounds(Index2); - BeginUpdate; - Temp := fList^[Index1]; - fList^[Index1] := fList^[Index2]; - fList^[Index2] := Temp; - if fIndexOfLongestLine = Index1 then - fIndexOfLongestLine := Index2 - else if fIndexOfLongestLine = Index2 then - fIndexOfLongestLine := Index1; - EndUpdate; -end; - -function TSynEditStringList.ExpandString(Index: integer): string; -var - HasTabs: Boolean; -begin - with fList^[Index] do - if Length(FString) = 0 then - begin - Result := ''; - Exclude(fFlags, sfExpandedLengthUnknown); - Exclude(fFlags, sfHasTabs); - Include(fFlags, sfHasNoTabs); - fExpandedLength := 0; - end - else - begin - Result := fConvertTabsProc(fstring, fTabWidth, HasTabs); - fExpandedLength := Length(fExpandAtWideGlyphsFunc(Result)); - Exclude(fFlags, sfExpandedLengthUnknown); - Exclude(fFlags, sfHasTabs); - Exclude(fFlags, sfHasNoTabs); - if HasTabs then - Include(fFlags, sfHasTabs) - else - Include(fFlags, sfHasNoTabs); - end; -end; - -function TSynEditStringList.Get(Index: integer): string; -begin - if Cardinal(Index)= 0) and (Index < fCount) then - begin - if sfHasNoTabs in fList^[Index].fFlags then - Result := Get(Index) - else - Result := ExpandString(Index); - end else - Result := ''; -end; - -function TSynEditStringList.GetExpandedStringLength(Index: integer): integer; -begin - if (Index >= 0) and (Index < fCount) then - begin - if sfExpandedLengthUnknown in fList^[Index].fFlags then - Result := Length( ExpandedStrings[index] ) - else - Result := fList^[Index].fExpandedLength; - end - else - Result := 0; -end; - -function TSynEditStringList.GetLengthOfLongestLine: Integer; -var - i, MaxLen: Integer; - PRec: PSynEditStringRec; -begin - if fIndexOfLongestLine < 0 then - begin - MaxLen := 0; - if fCount > 0 then - begin - PRec := @fList^[0]; - for i := 0 to fCount - 1 do - begin - if sfExpandedLengthUnknown in PRec^.fFlags then - ExpandString(i); - if PRec^.fExpandedLength > MaxLen then - begin - MaxLen := PRec^.fExpandedLength; - fIndexOfLongestLine := i; - end; - Inc(PRec); - end; - end; - end; - if (fIndexOfLongestLine >= 0) and (fIndexOfLongestLine < fCount) then - Result := fList^[fIndexOfLongestLine].fExpandedLength - else - Result := 0; -end; - -function TSynEditStringList.GetObject(Index: integer): TObject; -begin - if (Index >= 0) and (Index < fCount) then - Result := fList^[Index].fObject - else - Result := nil; -end; - -function TSynEditStringList.GetRange(Index: integer): TSynEditRange; -begin - if (Index >= 0) and (Index < fCount) then - Result := fList^[Index].fRange - else - Result := nil; -end; - -function TSynEditStringList.GetSeparatedText(Separators: string): string; -{Optimized by Eric Grange} -var - I, L, Size, LineBreakSize: Integer; - P, PLineBreak: PChar; - PRec: PSynEditStringRec; -begin - if fCount = 0 then begin - Result := ''; - exit; - end; - LineBreakSize := Length(Separators); - PLineBreak := Pointer(Separators); - - // compute buffer size - Size := (fCount-1) * LineBreakSize - + LineCharIndex( fCount-1 ) - + Length( fList^[fCount-1].FString ); - SetLength(Result, Size); - - P := Pointer(Result); - PRec := @fList^[0]; - - // handle 1st line separately (to avoid trailing line break) - L := Length(PRec.FString); - if L <> 0 then - begin - System.Move(Pointer(PRec.FString)^, P^, L * SizeOf(Char)); - Inc(P, L); - end; - Inc(PRec); - - for I := 1 to fCount-1 do - begin - case LineBreakSize of - 0 : ; - 1 : begin - P^ := PLineBreak^; - Inc(P); - end; - 2 : begin - PSynEditTwoWideChars(P)^ := PSynEditTwoWideChars(PLineBreak)^; - Inc(P, 2); - end; - else - System.Move(PLineBreak^, P^, LineBreakSize * SizeOf(Char)); - Inc(P, LineBreakSize); - end; - if Pointer( PRec.FString ) <> nil then - begin - L := Length(PRec.FString); - System.Move(Pointer(PRec.FString)^, P^, L * SizeOf(Char)); - Inc(P, L); - end; - Inc(PRec); - end; -end; - -procedure TSynEditStringList.Grow; -var - Delta: Integer; -begin - if fCapacity > 64 then - Delta := fCapacity div 4 - else - Delta := 16; - SetCapacity(fCapacity + Delta); -end; - -procedure TSynEditStringList.Insert(Index: integer; const S: string); -begin - if (Index < 0) or (Index > fCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - InsertItem(Index, S); - if Assigned(fOnInserted) then - fOnInserted( Self, Index, 1 ); - EndUpdate; -end; - -procedure TSynEditStringList.InsertItem(Index: Integer; const S: string); -begin - BeginUpdate; - if fCount = fCapacity then - Grow; - if Index < fCount then - begin - System.Move(fList^[Index], fList^[Index + 1], - (fCount - Index) * SynEditStringRecSize); - end; - fIndexOfLongestLine := -1; - with fList^[Index] do - begin - Pointer(fString) := nil; - fString := S; - fObject := nil; - fRange := NullRange; - fExpandedLength := -1; - fFlags := [sfExpandedLengthUnknown]; - end; - Inc(fCount); - EndUpdate; -end; - -procedure TSynEditStringList.InsertLines(Index, NumLines: Integer); -var - c_Line: Integer; -begin - if (Index < 0) or (Index > fCount) then - ListIndexOutOfBounds(Index); - if NumLines > 0 then - begin - BeginUpdate; - try - SetCapacity(fCount + NumLines); - if Index < fCount then - begin - System.Move(fList^[Index], fList^[Index + NumLines], - (fCount - Index) * SynEditStringRecSize); - end; - for c_Line := Index to Index + NumLines -1 do - with fList^[c_Line] do - begin - Pointer(fString) := nil; - fObject := nil; - fRange := NullRange; - fExpandedLength := -1; - fFlags := [sfExpandedLengthUnknown]; - end; - Inc(fCount, NumLines); - if Assigned(OnInserted) then - OnInserted(Self, Index, NumLines); - finally - EndUpdate; - end; - end; -end; - -procedure TSynEditStringList.InsertStrings(Index: integer; - NewStrings: TStrings); -var - i, Cnt: integer; -begin - Cnt := NewStrings.Count; - if Cnt = 0 then exit; - - BeginUpdate; - try - InsertLines(Index, Cnt); - for i := 0 to Cnt - 1 do - Strings[Index + i] := NewStrings[i]; - finally - EndUpdate; - end; -end; - -procedure TSynEditStringList.InsertText(Index: integer; - NewText: string); -var - TmpStringList: TStringList; -begin - if NewText = '' then exit; - - TmpStringList := TStringList.Create; - try - TmpStringList.Text := NewText; - InsertStrings(Index, TmpStringList); - finally - TmpStringList.Free; - end; -end; - -procedure TSynEditStringList.LoadFromStream(Stream: TStream; Encoding: TEncoding); -var - Size: Integer; - Buffer: TBytes; -begin - BeginUpdate; - try - Size := Stream.Size - Stream.Position; - SetLength(Buffer, Size); - Stream.Read(Buffer, 0, Size); - Size := TEncoding.GetBufferEncoding(Buffer, Encoding, DefaultEncoding); - WriteBOM := Size > 0; // Keep WriteBom in case the stream is saved - // If the encoding is ANSI and DetectUtf8 is True try to Detect UTF8 - if (Encoding = TEncoding.ANSI) and DetectUTF8 and IsUTF8(Buffer, Size) then - Encoding := TEncoding.UTF8; - SetEncoding(Encoding); // Keep Encoding in case the stream is saved - SetTextAndFileFormat(Encoding.GetString(Buffer, Size, Length(Buffer) - Size)); - finally - EndUpdate; - end; -end; - -procedure TSynEditStringList.SaveToStream(Stream: TStream; Encoding: TEncoding); -Var - Cancel: Boolean; - OldLineBreak: string; - S: string; - Buffer, Preamble: TBytes; -begin - if Encoding = nil then - Encoding := DefaultEncoding; - - OldLineBreak := LineBreak; - try - LineBreak := LineBreakFromFileFormat(fFileFormat); - S := GetTextStr; - finally - LineBreak := OldLineBreak; - end; - - Cancel := False; - if (Encoding = TEncoding.ANSI) and Assigned(fOnInfoLoss) and not IsAnsiOnly(S) then - begin - fOnInfoLoss(Encoding, Cancel); - if Cancel then - Exit; - if Encoding <> TEncoding.ANSI then - SetEncoding(Encoding); - end; - - Buffer := Encoding.GetBytes(S); - if WriteBOM then - begin - Preamble := Encoding.GetPreamble; - if Length(Preamble) > 0 then - Stream.WriteBuffer(Preamble, Length(Preamble)); - end; - Stream.WriteBuffer(Buffer, Length(Buffer)); -end; - -procedure TSynEditStringList.Put(Index: integer; const S: string); -begin - if (Index = 0) and (fCount = 0) or (fCount = Index) then - Add(S) - else begin - if Cardinal(Index)>=Cardinal(fCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - fIndexOfLongestLine := -1; - with fList^[Index] do begin - Include(fFlags, sfExpandedLengthUnknown); - Exclude(fFlags, sfHasTabs); - Exclude(fFlags, sfHasNoTabs); - fString := S; - end; - if Assigned(fOnPutted) then - fOnPutted( Self, Index, 1 ); - EndUpdate; - end; -end; - -procedure TSynEditStringList.PutObject(Index: integer; AObject: TObject); -begin - if Cardinal(Index)>=Cardinal(fCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - fList^[Index].fObject := AObject; - EndUpdate; -end; - -procedure TSynEditStringList.PutRange(Index: integer; ARange: TSynEditRange); -begin - if Cardinal(Index)>=Cardinal(fCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - fList^[Index].fRange := ARange; - EndUpdate; -end; - -procedure TSynEditStringList.SetCapacity(NewCapacity: integer); -begin - if NewCapacity < Count then - EListError.Create( SInvalidCapacity ); - ReallocMem(fList, NewCapacity * SynEditStringRecSize); - fCapacity := NewCapacity; -end; - -procedure TSynEditStringList.SetTabWidth(Value: integer); -var - i: integer; -begin - if Value <> fTabWidth then begin - fTabWidth := Value; - fConvertTabsProc := GetBestConvertTabsProcEx(fTabWidth); - fIndexOfLongestLine := -1; - for i := 0 to fCount - 1 do - with fList^[i] do begin - fExpandedLength := -1; - Exclude(fFlags, sfHasNoTabs); - Include(fFlags, sfExpandedLengthUnknown); - end; - end; -end; - -procedure TSynEditStringList.SetTextAndFileFormat(const Value: string); -var - S: string; - Size: Integer; - P, Start, Pmax: PWideChar; - fCR, fLF, fLINESEPARATOR: Boolean; -begin - fLINESEPARATOR := False; - fCR := False; - fLF := False; - BeginUpdate; - try - Clear; - P := Pointer(Value); - if P <> nil then - begin - Size := Length(Value); - Pmax := @Value[Size]; - while (P <= Pmax) do - begin - Start := P; - while not (Ord(P^) in [0, $A, $D]) and (P^ <> WideLineSeparator) do - begin - Inc(P); - end; - if P<>Start then - begin - SetString(S, Start, P - Start); - InsertItem(fCount, S); - end else InsertItem(fCount, ''); - if P^ = WideLineSeparator then - begin - fLINESEPARATOR := True; - Inc(P); - end; - if P^ = WideCR then - begin - fCR := True; - Inc(P); - end; - if P^ = WideLF then - begin - fLF := True; - Inc(P); - end; - end; - // keep the old format of the file - if not TrailingLineBreak and - (CharInSet(Value[Size], [#10, #13]) or (Value[Size] = WideLineSeparator)) - then - InsertItem(fCount, ''); - end; - if Assigned(OnInserted) and (fCount > 0) then - OnInserted(Self, 0, fCount); - finally - EndUpdate; - end; - if fLINESEPARATOR then - FileFormat := sffUnicode - else if fCR and not fLF then - FileFormat := sffMac - else if fLF and not fCR then - FileFormat := sffUnix - else - FileFormat := sffDos; -end; - -procedure TSynEditStringList.SetUpdateState(Updating: Boolean); -begin - fCharIndexesAreValid:=False; - if Updating then begin - if Assigned(fOnChanging) then - fOnChanging(Self); - end else begin - if Assigned(fOnChange) then - fOnChange(Self); - end; -end; - -procedure TSynEditStringList.FontChanged; -var - i: Integer; -begin - fIndexOfLongestLine := -1; - for i := 0 to fCount - 1 do - with fList^[i] do - begin - fExpandedLength := -1; - Exclude(fFlags, sfHasNoTabs); - Include(fFlags, sfExpandedLengthUnknown); - end; -end; - -{ TSynEditUndoItem } - -procedure TSynEditUndoItem.Assign(Source: TPersistent); -begin - if (Source is TSynEditUndoItem) then - begin - fChangeReason:=TSynEditUndoItem(Source).fChangeReason; - fChangeSelMode:=TSynEditUndoItem(Source).fChangeSelMode; - fChangeStartPos:=TSynEditUndoItem(Source).fChangeStartPos; - fChangeEndPos:=TSynEditUndoItem(Source).fChangeEndPos; - fChangeStr:=TSynEditUndoItem(Source).fChangeStr; - fChangeNumber:=TSynEditUndoItem(Source).fChangeNumber; - end - else - inherited Assign(Source); -end; - - -{ TSynEditUndoList } - -constructor TSynEditUndoList.Create; -begin - inherited Create; - fItems := TList.Create; - fMaxUndoActions := 1024; - fNextChangeNumber := 1; - fInsideRedo := False; -end; - -destructor TSynEditUndoList.Destroy; -begin - Clear; - fItems.Free; - inherited Destroy; -end; - -procedure TSynEditUndoList.Assign(Source: TPersistent); -var - i: Integer; - UndoItem: TSynEditUndoItem; -begin - if (Source is TSynEditUndoList) then - begin - Clear; - for i:=0 to TSynEditUndoList(Source).fItems.Count-1 do - begin - UndoItem:=TSynEditUndoItem.Create; - UndoItem.Assign(TSynEditUndoList(Source).fItems[i]); - fItems.Add(UndoItem); - end; - fBlockChangeNumber:=TSynEditUndoList(Source).fBlockChangeNumber; - fBlockCount:=TSynEditUndoList(Source).fBlockCount; - fFullUndoImposible:=TSynEditUndoList(Source).fFullUndoImposible; - fLockCount:=TSynEditUndoList(Source).fLockCount; - fMaxUndoActions:=TSynEditUndoList(Source).fMaxUndoActions; - fNextChangeNumber:=TSynEditUndoList(Source).fNextChangeNumber; - fInsideRedo:=TSynEditUndoList(Source).fInsideRedo; - end - else - inherited Assign(Source); -end; - -procedure TSynEditUndoList.AddChange(AReason: TSynChangeReason; const AStart, - AEnd: TBufferCoord; const ChangeText: string; SelMode: TSynSelectionMode); -var - NewItem: TSynEditUndoItem; -begin - if fLockCount = 0 then begin - NewItem := TSynEditUndoItem.Create; - try - with NewItem do begin - fChangeReason := AReason; - fChangeSelMode := SelMode; - fChangeStartPos := AStart; - fChangeEndPos := AEnd; - fChangeStr := ChangeText; - if fBlockChangeNumber <> 0 then - fChangeNumber := fBlockChangeNumber - else begin - fChangeNumber := fNextChangeNumber; - if fBlockCount = 0 then begin - Inc(fNextChangeNumber); - if fNextChangeNumber = 0 then - Inc(fNextChangeNumber); - end; - end; - end; - PushItem(NewItem); - except - NewItem.Free; - raise; - end; - end; -end; - -procedure TSynEditUndoList.BeginBlock; -begin - Inc(fBlockCount); - fBlockChangeNumber := fNextChangeNumber; -end; - -procedure TSynEditUndoList.Clear; -var - i: integer; -begin - for i := 0 to fItems.Count - 1 do - TSynEditUndoItem(fItems[i]).Free; - fItems.Clear; - fFullUndoImposible := False; -end; - -procedure TSynEditUndoList.EndBlock; -var - iBlockID: integer; -begin - if fBlockCount > 0 then begin - Dec(fBlockCount); - if fBlockCount = 0 then begin - iBlockID := fBlockChangeNumber; - fBlockChangeNumber := 0; - Inc(fNextChangeNumber); - if fNextChangeNumber = 0 then - Inc(fNextChangeNumber); - if (fItems.Count > 0) and (PeekItem.ChangeNumber = iBlockID) and - Assigned(OnAddedUndo) then - begin - OnAddedUndo( Self ); - end; - end; - end; -end; - -procedure TSynEditUndoList.EnsureMaxEntries; -var - Item: TSynEditUndoItem; -begin - if fItems.Count > fMaxUndoActions then - begin - fFullUndoImposible := True; - while fItems.Count > fMaxUndoActions do begin - Item := fItems[0]; - Item.Free; - fItems.Delete(0); - end; - end; -end; - -function TSynEditUndoList.GetCanUndo: boolean; -begin - Result := fItems.Count > 0; -end; - -function TSynEditUndoList.GetItemCount: integer; -begin - Result := fItems.Count; -end; - -procedure TSynEditUndoList.Lock; -begin - Inc(fLockCount); -end; - -function TSynEditUndoList.PeekItem: TSynEditUndoItem; -var - iLast: integer; -begin - Result := nil; - iLast := fItems.Count - 1; - if iLast >= 0 then - Result := fItems[iLast]; -end; - -function TSynEditUndoList.PopItem: TSynEditUndoItem; -var - iLast: integer; -begin - Result := nil; - iLast := fItems.Count - 1; - if iLast >= 0 then begin - Result := fItems[iLast]; - fItems.Delete(iLast); - end; -end; - -procedure TSynEditUndoList.PushItem(Item: TSynEditUndoItem); -begin - if Assigned(Item) then begin - fItems.Add(Item); - EnsureMaxEntries; - if (Item.ChangeReason <> crGroupBreak) and Assigned(OnAddedUndo) then - OnAddedUndo(Self); - end; -end; - -procedure TSynEditUndoList.SetMaxUndoActions(Value: integer); -begin - if Value < 0 then - Value := 0; - if Value <> fMaxUndoActions then begin - fMaxUndoActions := Value; - EnsureMaxEntries; - end; -end; - -procedure TSynEditUndoList.Unlock; -begin - if fLockCount > 0 then - Dec(fLockCount); -end; - -function TSynEditUndoList.LastChangeReason: TSynChangeReason; -begin - if fItems.Count = 0 then - result := crNothing - else - result := TSynEditUndoItem(fItems[fItems.Count - 1]).fChangeReason; -end; - -procedure TSynEditUndoList.AddGroupBreak; -var - vDummy: TBufferCoord; -begin - //Add the GroupBreak even if ItemCount = 0. Since items are stored in - //reverse order in TCustomSynEdit.fRedoList, a GroupBreak could be lost. - if LastChangeReason <> crGroupBreak then - begin - AddChange(crGroupBreak, vDummy, vDummy, '', smNormal); - end; -end; - -procedure TSynEditUndoList.SetInitialState(const Value: boolean); -begin - if Value then - begin - if ItemCount = 0 then - fInitialChangeNumber := 0 - else - fInitialChangeNumber := PeekItem.ChangeNumber; - end - else - if ItemCount = 0 then - begin - if fInitialChangeNumber = 0 then - fInitialChangeNumber := -1; - end - else if PeekItem.ChangeNumber = fInitialChangeNumber then - fInitialChangeNumber := -1; -end; - -function TSynEditUndoList.GetInitialState: boolean; -begin - if ItemCount = 0 then - Result := fInitialChangeNumber = 0 - else - Result := PeekItem.ChangeNumber = fInitialChangeNumber; -end; - -function TSynEditUndoList.GetItems(Index: Integer): TSynEditUndoItem; -begin - Result := TSynEditUndoItem(fItems[Index]); -end; - -procedure TSynEditUndoList.SetItems(Index: Integer; - const Value: TSynEditUndoItem); -begin - fItems[Index] := Value; -end; - -procedure TSynEditUndoList.DeleteItem(AIndex: Integer); -begin - TSynEditUndoItem(fItems[AIndex]).Free; - fItems.Delete(AIndex); -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditTextBuffer.pas, released 2000-04-07. +The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, +part of the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +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: SynEditTextBuffer.pas,v 1.14 2011/12/28 09:24:20 Egg Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +//todo: Avoid calculating expanded string unncessarily (just calculate expandedLength instead). + +{$IFNDEF QSYNEDITTEXTBUFFER} +unit SynEditTextBuffer; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + Windows, + SynEditTypes, + SynEditMiscProcs, + SynUnicode, + Classes, + SysUtils, + Graphics; + +type + TSynEditRange = Pointer; + + TSynEditStringFlag = (sfHasTabs, sfHasNoTabs, sfExpandedLengthUnknown, + sfModified, sfSaved); + TSynEditStringFlags = set of TSynEditStringFlag; + + PSynEditStringRec = ^TSynEditStringRec; + TSynEditStringRec = record + {$IFDEF OWN_UnicodeString_MEMMGR} + FString: PWideChar; // "array of WideChar"; + {$ELSE} + FString: UnicodeString; + {$ENDIF OWN_UnicodeString_MEMMGR} + FObject: TObject; + FRange: TSynEditRange; + FExpandedLength: Integer; + fCharIndex : Integer; + FFlags: TSynEditStringFlags; + end; + + TSynEditTwoWideChars = record + One, Two : WideChar; + end; + PSynEditTwoWideChars = ^TSynEditTwoWideChars; + +const + SynEditStringRecSize = SizeOf(TSynEditStringRec); + MaxSynEditStrings = MaxInt div SynEditStringRecSize; + + NullRange = TSynEditRange(-1); + +type + PSynEditStringRecList = ^TSynEditStringRecList; + TSynEditStringRecList = array[0..MaxSynEditStrings - 1] of TSynEditStringRec; + + TStringListChangeEvent = procedure(Sender: TObject; Index: Integer; + Count: Integer) of object; + + TExpandAtWideGlyphsFunc = function (const S: UnicodeString): UnicodeString of object; + + TSynEditFileFormat = (sffDos, sffUnix, sffMac, sffUnicode); // DOS: CRLF, UNIX: LF, Mac: CR, Unicode: LINE SEPARATOR + + TSynEditModification = (smOriginal, smModified, smSaved); + + TSynEditStringList = class(TUnicodeStrings) + private + FList: PSynEditStringRecList; + FCount: Integer; + FCapacity: Integer; + FFileFormat: TSynEditFileFormat; + FAppendNewLineAtEOF: Boolean; + FConvertTabsProc: TConvertTabsProcEx; + FIndexOfLongestLine: Integer; + FTabWidth: Integer; + FExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc; + FCharIndexesAreValid : Boolean; + FOnChange: TNotifyEvent; + FOnChanging: TNotifyEvent; + FOnCleared: TNotifyEvent; + FOnDeleted: TStringListChangeEvent; + FOnInserted: TStringListChangeEvent; + FOnPutted: TStringListChangeEvent; + function ExpandString(Index: Integer): UnicodeString; + function GetExpandedString(Index: Integer): UnicodeString; + function GetExpandedStringLength(Index: Integer): Integer; + function GetLengthOfLongestLine: Integer; + function GetRange(Index: Integer): TSynEditRange; + function GetModification(Index: Integer): TSynEditModification; + procedure Grow; + procedure InsertItem(Index: Integer; const S: UnicodeString); + procedure PutRange(Index: Integer; ARange: TSynEditRange); + procedure SetFileFormat(const Value: TSynEditFileFormat); + {$IFDEF OWN_UnicodeString_MEMMGR} + procedure SetListString(Index: Integer; const S: UnicodeString); + {$ENDIF OWN_UnicodeString_MEMMGR} + protected + FStreaming: Boolean; + function Get(Index: Integer): UnicodeString; override; + function GetCapacity: Integer; + {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} + function GetCount: Integer; override; + function GetObject(Index: Integer): TObject; override; + function GetTextStr: UnicodeString; override; + procedure Put(Index: Integer; const S: UnicodeString); override; + procedure PutObject(Index: Integer; AObject: TObject); override; + procedure SetCapacity(NewCapacity: Integer); + {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} + procedure SetTabWidth(Value: Integer); + procedure SetUpdateState(Updating: Boolean); override; + procedure UpdateCharIndexes; + public + constructor Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); + destructor Destroy; override; + function Add(const S: UnicodeString): Integer; override; + procedure AddStrings(Strings: TUnicodeStrings); override; + procedure Clear; override; + procedure Delete(Index: Integer); override; + procedure DeleteLines(Index, NumLines: Integer); + procedure Exchange(Index1, Index2: Integer); override; + procedure Insert(Index: Integer; const S: UnicodeString); override; + procedure InsertLines(Index, NumLines: Integer); + procedure InsertStrings(Index: Integer; NewStrings: TUnicodeStrings); + procedure InsertText(Index: Integer; NewText: UnicodeString); +{$IFDEF UNICODE} + procedure SaveToStream(Stream: TStream; Encoding: TEncoding); override; + function GetSeparatedText(Separators: UnicodeString): UnicodeString; +{$ELSE} + procedure SaveToStream(Stream: TStream; WithBOM: Boolean = True); override; +{$ENDIF} + procedure SetTextStr(const Value: UnicodeString); override; + procedure LoadFromStream(Stream: TStream); override; + procedure FontChanged; + function LineCharLength(Index : Integer) : Integer; + function LineCharIndex(Index : Integer) : Integer; + + procedure MarkModifiedLinesAsSaved; + procedure ResetModificationIndicator; + + property AppendNewLineAtEOF: Boolean read FAppendNewLineAtEOF write FAppendNewLineAtEOF; + + property FileFormat: TSynEditFileFormat read FFileFormat write SetFileFormat; + property ExpandedStrings[Index: Integer]: UnicodeString read GetExpandedString; + property ExpandedStringLengths[Index: Integer]: Integer read GetExpandedStringLength; + property LengthOfLongestLine: Integer read GetLengthOfLongestLine; + property Ranges[Index: Integer]: TSynEditRange read GetRange write PutRange; + property Modification[Index: Integer]: TSynEditModification read GetModification; + property TabWidth: Integer read FTabWidth write SetTabWidth; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; + property OnCleared: TNotifyEvent read FOnCleared write FOnCleared; + property OnDeleted: TStringListChangeEvent read FOnDeleted write FOnDeleted; + property OnInserted: TStringListChangeEvent read FOnInserted + write FOnInserted; + property OnPutted: TStringListChangeEvent read FOnPutted write FOnPutted; + end; + + ESynEditStringList = class(Exception); + + TSynChangeReason = (crInsert, crPaste, crDragDropInsert, + // Note: several undo entries can be chained together via the ChangeNumber + // see also TCustomSynEdit.[Begin|End]UndoBlock methods + crDeleteAfterCursor, crDelete, + crLineBreak, crIndent, crUnindent, + crSilentDelete, crSilentDeleteAfterCursor, + crAutoCompleteBegin, crAutoCompleteEnd, + crPasteBegin, crPasteEnd, // for pasting, since it might do a lot of operations + crSpecial1Begin, crSpecial1End, + crSpecial2Begin, crSpecial2End, + crCaret, // just restore the Caret, allowing better Undo behavior + crSelection, // restore Selection + crNothing, + crGroupBreak, + crDeleteAll, + crWhiteSpaceAdd // for undo/redo of adding a character past EOL and repositioning the caret + ); + + TSynEditUndoItem = class(TPersistent) + protected + FChangeReason: TSynChangeReason; + FChangeSelMode: TSynSelectionMode; + FChangeStartPos: TBufferCoord; + FChangeEndPos: TBufferCoord; + FChangeStr: UnicodeString; + FChangeNumber: Integer; + public + procedure Assign(Source: TPersistent); override; + property ChangeReason: TSynChangeReason read FChangeReason; + property ChangeSelMode: TSynSelectionMode read FChangeSelMode; + property ChangeStartPos: TBufferCoord read FChangeStartPos; + property ChangeEndPos: TBufferCoord read FChangeEndPos; + property ChangeStr: UnicodeString read FChangeStr; + property ChangeNumber: Integer read FChangeNumber; + end; + + TSynEditUndoList = class(TPersistent) + protected + FBlockChangeNumber: Integer; + FBlockCount: Integer; + FFullUndoImposible: Boolean; + FItems: TList; + FLockCount: Integer; + FMaxUndoActions: Integer; + FNextChangeNumber: Integer; + FInitialChangeNumber: Integer; + FInsideRedo: Boolean; + FOnAddedUndo: TNotifyEvent; + procedure EnsureMaxEntries; + function GetCanUndo: Boolean; + function GetItemCount: Integer; + procedure SetMaxUndoActions(Value: Integer); + procedure SetInitialState(const Value: Boolean); + function GetInitialState: Boolean; + function GetItems(Index: Integer): TSynEditUndoItem; + procedure SetItems(Index: Integer; const Value: TSynEditUndoItem); + public + constructor Create; + destructor Destroy; override; + procedure AddChange(AReason: TSynChangeReason; const AStart, AEnd: TBufferCoord; + const ChangeText: UnicodeString; SelMode: TSynSelectionMode); + procedure BeginBlock; + procedure Clear; + procedure EndBlock; + procedure Lock; + function PeekItem: TSynEditUndoItem; + function PopItem: TSynEditUndoItem; + procedure PushItem(Item: TSynEditUndoItem); + procedure Unlock; + function LastChangeReason: TSynChangeReason; + public + procedure Assign(Source: TPersistent); override; + procedure AddGroupBreak; + procedure DeleteItem(AIndex: Integer); + property BlockChangeNumber: Integer read FBlockChangeNumber + write FBlockChangeNumber; + property CanUndo: Boolean read GetCanUndo; + property FullUndoImpossible: Boolean read FFullUndoImposible; + property InitialState: Boolean read GetInitialState write SetInitialState; + property Items[Index: Integer]: TSynEditUndoItem read GetItems write SetItems; + property ItemCount: Integer read GetItemCount; + property BlockCount: Integer read FBlockCount; + property MaxUndoActions: Integer read FMaxUndoActions + write SetMaxUndoActions; + property InsideRedo: Boolean read FInsideRedo write FInsideRedo; + property OnAddedUndo: TNotifyEvent read FOnAddedUndo write FOnAddedUndo; + end; + +implementation + +{$IFDEF SYN_COMPILER_3_UP} +resourcestring +{$ELSE} +const +{$ENDIF} + SListIndexOutOfBounds = 'Invalid stringlist index %d'; + SInvalidCapacity = 'Stringlist capacity cannot be smaller than count'; + +{ TSynEditStringList } + +procedure ListIndexOutOfBounds(Index: Integer); +begin + raise ESynEditStringList.CreateFmt(SListIndexOutOfBounds, [Index]); +end; + +constructor TSynEditStringList.Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); +begin + inherited Create; + FExpandAtWideGlyphsFunc := AExpandAtWideGlyphsFunc; + SetFileFormat(sffDos); + FIndexOfLongestLine := -1; + TabWidth := 8; +end; + +destructor TSynEditStringList.Destroy; +begin + FOnChange := nil; + FOnChanging := nil; + inherited Destroy; + {$IFDEF OWN_UnicodeString_MEMMGR} + FOnCleared := nil; + Clear; + {$ELSE} + if FCount <> 0 then + Finalize(FList^[0], FCount); + FCount := 0; + SetCapacity(0); + {$ENDIF OWN_UnicodeString_MEMMGR} +end; + +function TSynEditStringList.Add(const S: UnicodeString): Integer; +begin + BeginUpdate; + Result := FCount; + InsertItem(Result, S); + if Assigned(OnInserted) then + OnInserted(Self, Result, 1); + EndUpdate; +end; + +procedure TSynEditStringList.AddStrings(Strings: TUnicodeStrings); +var + i, FirstAdded: Integer; +begin + if Strings.Count > 0 then begin + FIndexOfLongestLine := -1; + BeginUpdate; + try + i := FCount + Strings.Count; + if i > FCapacity then + SetCapacity((i + 15) and (not 15)); + FirstAdded := FCount; + for i := 0 to Strings.Count - 1 do begin + with FList^[FCount] do begin + Pointer(FString) := nil; + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(FCount, Strings[i]); + {$ELSE} + FString := Strings[i]; + {$ENDIF OWN_UnicodeString_MEMMGR} + FObject := Strings.Objects[i]; + FRange := NullRange; + FExpandedLength := -1; + FFlags := [sfExpandedLengthUnknown]; + end; + Inc(FCount); + end; + if Assigned(OnInserted) then + OnInserted(Self, FirstAdded, Strings.Count); + finally + EndUpdate; + end; + end; +end; + +procedure TSynEditStringList.Clear; +{$IFDEF OWN_UnicodeString_MEMMGR} +var + I: Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if FCount <> 0 then begin + BeginUpdate; + {$IFDEF OWN_UnicodeString_MEMMGR} + for I := 0 to FCount - 1 do + with FList[I] do + if TDynWideCharArray(FString) <> nil then + TDynWideCharArray(FString) := nil; + {$ELSE} + Finalize(FList^[0], FCount); + {$ENDIF OWN_UnicodeString_MEMMGR} + FCount := 0; + SetCapacity(0); + if Assigned(FOnCleared) then + FOnCleared(Self); + EndUpdate; + end; + FIndexOfLongestLine := -1; +end; + +procedure TSynEditStringList.Delete(Index: Integer); +begin + if (Index < 0) or (Index >= FCount) then + ListIndexOutOfBounds(Index); + BeginUpdate; + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, ''); + {$ELSE} + Finalize(FList^[Index]); + {$ENDIF OWN_UnicodeString_MEMMGR} + Dec(FCount); + if Index < FCount then begin + System.Move(FList^[Index + 1], FList^[Index], + (FCount - Index) * SynEditStringRecSize); + {$IFDEF OWN_UnicodeString_MEMMGR} + Pointer(FList[FCount].FString) := nil; // avoid freeing the string, the address is now used in another element + {$ENDIF OWN_UnicodeString_MEMMGR} + end; + FIndexOfLongestLine := -1; + if Assigned(FOnDeleted) then + FOnDeleted( Self, Index, 1 ); + EndUpdate; +end; + +procedure TSynEditStringList.DeleteLines(Index, NumLines: Integer); +var + LinesAfter: Integer; +{$IFDEF OWN_UnicodeString_MEMMGR} + I: Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if NumLines > 0 then begin + if (Index < 0) or (Index >= FCount) then + ListIndexOutOfBounds(Index); + LinesAfter := FCount - (Index + NumLines); + if LinesAfter < 0 then + NumLines := FCount - Index; + {$IFDEF OWN_UnicodeString_MEMMGR} + for I := Index to Index + NumLines - 1 do + with FList[I] do + if TDynWideCharArray(FString) <> nil then + TDynWideCharArray(FString) := nil; + {$ELSE} + Finalize(FList^[Index], NumLines); + {$ENDIF OWN_UnicodeString_MEMMGR} + + if LinesAfter > 0 then begin + BeginUpdate; + try + System.Move(FList^[Index + NumLines], FList^[Index], + LinesAfter * SynEditStringRecSize); + finally + EndUpdate; + end; + end; + Dec(FCount, NumLines); + if Assigned(FOnDeleted) then + FOnDeleted( Self, Index, NumLines ); + end; +end; + +procedure TSynEditStringList.Exchange(Index1, Index2: Integer); +var + Temp: TSynEditStringRec; +begin + if (Index1 < 0) or (Index1 >= FCount) then + ListIndexOutOfBounds(Index1); + if (Index2 < 0) or (Index2 >= FCount) then + ListIndexOutOfBounds(Index2); + BeginUpdate; + Temp := FList^[Index1]; + FList^[Index1] := FList^[Index2]; + FList^[Index2] := Temp; + if FIndexOfLongestLine = Index1 then + FIndexOfLongestLine := Index2 + else if FIndexOfLongestLine = Index2 then + FIndexOfLongestLine := Index1; + EndUpdate; +end; + +function TSynEditStringList.ExpandString(Index: Integer): UnicodeString; +var + HasTabs: Boolean; +begin + with FList^[Index] do + {$IFDEF OWN_UnicodeString_MEMMGR} + if Length(TDynWideCharArray(FString)) = 0 then + {$ELSE} + if Length(FString) = 0 then + {$ENDIF} + begin + Result := ''; + Exclude(FFlags, sfExpandedLengthUnknown); + Exclude(FFlags, sfHasTabs); + Include(FFlags, sfHasNoTabs); + FExpandedLength := 0; + end + else + begin + Result := FConvertTabsProc(FString, FTabWidth, HasTabs); + FExpandedLength := Length(FExpandAtWideGlyphsFunc(Result)); + Exclude(FFlags, sfExpandedLengthUnknown); + Exclude(FFlags, sfHasTabs); + Exclude(FFlags, sfHasNoTabs); + if HasTabs then + Include(FFlags, sfHasTabs) + else + Include(FFlags, sfHasNoTabs); + end; +end; + +function TSynEditStringList.Get(Index: Integer): UnicodeString; +{$IFDEF OWN_UnicodeString_MEMMGR} +var + Len: Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if Cardinal(Index) 0 then + begin + SetLength(Result, Len - 1); // exclude #0 + if Result <> '' then + System.Move(FString^, Result[1], Len * SizeOf(WideChar)); + end + else + Result := ''; + end + {$ELSE} + Result := FList^[Index].FString + {$ENDIF OWN_UnicodeString_MEMMGR} + else + Result := ''; +end; + +procedure TSynEditStringList.UpdateCharIndexes; +var + i, n : Integer; + p : PSynEditStringRec; +begin + FCharIndexesAreValid:=True; + if FCount=0 then Exit; + p:=@FList^[0]; + n:=0; + for i:=1 to FCount do begin + p.fCharIndex:=n; + Inc(n, Length(p.FString)); + Inc(p); + end; +end; + +function TSynEditStringList.LineCharLength(Index : Integer) : Integer; +begin + if Cardinal(Index)= 0) and (Index < FCount) then + begin + if sfHasNoTabs in FList^[Index].FFlags then + Result := Get(Index) + else + Result := ExpandString(Index); + end else + Result := ''; +end; + +function TSynEditStringList.GetExpandedStringLength(Index: Integer): Integer; +begin + if (Index >= 0) and (Index < FCount) then + begin + if sfExpandedLengthUnknown in FList^[Index].FFlags then + Result := Length( ExpandedStrings[index] ) + else + Result := FList^[Index].FExpandedLength; + end + else + Result := 0; +end; + +function TSynEditStringList.GetLengthOfLongestLine: Integer; +var + i, MaxLen: Integer; + PRec: PSynEditStringRec; +begin + if FIndexOfLongestLine < 0 then + begin + MaxLen := 0; + if FCount > 0 then + begin + PRec := @FList^[0]; + for i := 0 to FCount - 1 do + begin + if sfExpandedLengthUnknown in PRec^.FFlags then + ExpandString(i); + if PRec^.FExpandedLength > MaxLen then + begin + MaxLen := PRec^.FExpandedLength; + FIndexOfLongestLine := i; + end; + Inc(PRec); + end; + end; + end; + if (FIndexOfLongestLine >= 0) and (FIndexOfLongestLine < FCount) then + Result := FList^[FIndexOfLongestLine].FExpandedLength + else + Result := 0; +end; + +function TSynEditStringList.GetModification( + Index: Integer): TSynEditModification; +begin + Result := smOriginal; + if (Index >= 0) and (Index < FCount) then + if sfSaved in FList^[Index].FFlags then + Result := smSaved + else + if sfModified in FList^[Index].FFlags then + Result := smModified; +end; + +function TSynEditStringList.GetObject(Index: Integer): TObject; +begin + if (Index >= 0) and (Index < FCount) then + Result := FList^[Index].FObject + else + Result := nil; +end; + +function TSynEditStringList.GetRange(Index: Integer): TSynEditRange; +begin + if (Index >= 0) and (Index < FCount) then + Result := FList^[Index].FRange + else + Result := nil; +end; + +{$IFDEF UNICODE} +function TSynEditStringList.GetSeparatedText(Separators: UnicodeString): UnicodeString; +{Optimized by Eric Grange} +var + I, L, Size, LineBreakSize: Integer; + P, PLineBreak: PChar; + PRec: PSynEditStringRec; +begin + if FCount = 0 then + begin + Result := ''; + Exit; + end; + LineBreakSize := Length(Separators); + PLineBreak := Pointer(Separators); + + // compute buffer size + Size := (FCount - 1) * LineBreakSize + + LineCharIndex( FCount - 1 ) + + Length( FList^[FCount - 1].FString ); + SetLength(Result, Size); + + P := Pointer(Result); + PRec := @FList^[0]; + + // handle 1st line separately (to avoid trailing line break) + L := Length(PRec.FString); + if L <> 0 then + begin + System.Move(Pointer(PRec.FString)^, P^, L * SizeOf(Char)); + Inc(P, L); + end; + Inc(PRec); + + for I := 1 to FCount-1 do + begin + case LineBreakSize of + 0 : ; + 1 : begin + P^ := PLineBreak^; + Inc(P); + end; + 2 : begin + PSynEditTwoWideChars(P)^ := PSynEditTwoWideChars(PLineBreak)^; + Inc(P, 2); + end; + else + System.Move(PLineBreak^, P^, LineBreakSize * SizeOf(Char)); + Inc(P, LineBreakSize); + end; + if Pointer( PRec.FString ) <> nil then + begin + L := Length(PRec.FString); + System.Move(Pointer(PRec.FString)^, P^, L * SizeOf(Char)); + Inc(P, L); + end; + Inc(PRec); + end; +end; +{$ENDIF} + +function TSynEditStringList.GetTextStr: UnicodeString; +var + LB: UnicodeString; +begin + if not FStreaming then + begin + Result := GetSeparatedText(sLineBreak); + end + else + begin + case FileFormat of + sffDos: + LB := WideCRLF; + sffUnix: + LB := WideLF; + sffMac: + LB := WideCR; + sffUnicode: + LB := WideLineSeparator; + end; + Result := GetSeparatedText(LB); + if AppendNewLineAtEOF then + Result := Result + LB; + end; +end; + +procedure TSynEditStringList.Grow; +var + Delta: Integer; +begin + if FCapacity > 64 then + Delta := FCapacity div 4 + else + Delta := 16; + SetCapacity(FCapacity + Delta); +end; + +procedure TSynEditStringList.Insert(Index: Integer; const S: UnicodeString); +begin + if (Index < 0) or (Index > FCount) then + ListIndexOutOfBounds(Index); + BeginUpdate; + InsertItem(Index, S); + if Assigned(FOnInserted) then + FOnInserted( Self, Index, 1 ); + EndUpdate; +end; + +procedure TSynEditStringList.InsertItem(Index: Integer; const S: UnicodeString); +begin + BeginUpdate; + if FCount = FCapacity then + Grow; + if Index < FCount then + begin + System.Move(FList^[Index], FList^[Index + 1], + (FCount - Index) * SynEditStringRecSize); + end; + FIndexOfLongestLine := -1; + with FList^[Index] do + begin + Pointer(FString) := nil; + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, S); + {$ELSE} + FString := S; + {$ENDIF OWN_UnicodeString_MEMMGR} + FObject := nil; + FRange := NullRange; + FExpandedLength := -1; + FFlags := [sfExpandedLengthUnknown]; + Include(FFlags, sfModified); + end; + Inc(FCount); + EndUpdate; +end; + +procedure TSynEditStringList.InsertLines(Index, NumLines: Integer); +var + c_Line: Integer; +begin + if (Index < 0) or (Index > FCount) then + ListIndexOutOfBounds(Index); + if NumLines > 0 then + begin + BeginUpdate; + try + SetCapacity(FCount + NumLines); + if Index < FCount then + begin + System.Move(FList^[Index], FList^[Index + NumLines], + (FCount - Index) * SynEditStringRecSize); + end; + for c_Line := Index to Index + NumLines -1 do + with FList^[c_Line] do + begin + Pointer(FString) := nil; + FObject := nil; + FRange := NullRange; + FExpandedLength := -1; + FFlags := [sfExpandedLengthUnknown]; + end; + Inc(FCount, NumLines); + if Assigned(OnInserted) then + OnInserted(Self, Index, NumLines); + finally + EndUpdate; + end; + end; +end; + +procedure TSynEditStringList.InsertStrings(Index: Integer; + NewStrings: TUnicodeStrings); +var + i, Cnt: Integer; +begin + Cnt := NewStrings.Count; + if Cnt = 0 then Exit; + + BeginUpdate; + try + InsertLines(Index, Cnt); + for i := 0 to Cnt - 1 do + Strings[Index + i] := NewStrings[i]; + finally + EndUpdate; + end; +end; + +procedure TSynEditStringList.InsertText(Index: Integer; + NewText: UnicodeString); +var + TmpStringList: TUnicodeStringList; +begin + if NewText = '' then Exit; + + TmpStringList := TUnicodeStringList.Create; + try + TmpStringList.Text := NewText; + InsertStrings(Index, TmpStringList); + finally + TmpStringList.Free; + end; +end; + +procedure TSynEditStringList.LoadFromStream(Stream: TStream); +begin + FStreaming := True; + inherited; + FStreaming := False; + ResetModificationIndicator; +end; + +procedure TSynEditStringList.MarkModifiedLinesAsSaved; +var + Index: Integer; +begin + for Index := 0 to FCount - 1 do + if sfModified in FList^[Index].FFlags then + Include(FList^[Index].FFlags, sfSaved); +end; + +procedure TSynEditStringList.ResetModificationIndicator; +var + Index: Integer; +begin + for Index := 0 to FCount - 1 do + begin + Exclude(FList^[Index].FFlags, sfModified); + Exclude(FList^[Index].FFlags, sfSaved); + end; +end; + +{$IFDEF UNICODE} +procedure TSynEditStringList.SaveToStream(Stream: TStream; Encoding: TEncoding); +begin + FStreaming := True; + inherited; + FStreaming := False; +end; +{$ELSE} +procedure TSynEditStringList.SaveToStream(Stream: TStream; WithBOM: Boolean); +begin + FStreaming := True; + inherited; + FStreaming := False; +end; +{$ENDIF} + +procedure TSynEditStringList.Put(Index: Integer; const S: UnicodeString); +begin + if (Index = 0) and (FCount = 0) or (FCount = Index) then + Add(S) + else begin + if Cardinal(Index)>=Cardinal(FCount) then + ListIndexOutOfBounds(Index); + BeginUpdate; + FIndexOfLongestLine := -1; + with FList^[Index] do begin + Include(FFlags, sfExpandedLengthUnknown); + Exclude(FFlags, sfHasTabs); + Exclude(FFlags, sfHasNoTabs); + Include(FFlags, sfModified); + Exclude(FFlags, sfSaved); + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, S); + {$ELSE} + FString := S; + {$ENDIF OWN_UnicodeString_MEMMGR} + end; + if Assigned(FOnPutted) then + FOnPutted( Self, Index, 1 ); + EndUpdate; + end; +end; + +procedure TSynEditStringList.PutObject(Index: Integer; AObject: TObject); +begin + if Cardinal(Index)>=Cardinal(FCount) then + ListIndexOutOfBounds(Index); + BeginUpdate; + FList^[Index].FObject := AObject; + EndUpdate; +end; + +procedure TSynEditStringList.PutRange(Index: Integer; ARange: TSynEditRange); +begin + if Cardinal(Index)>=Cardinal(FCount) then + ListIndexOutOfBounds(Index); + BeginUpdate; + FList^[Index].FRange := ARange; + EndUpdate; +end; + +procedure TSynEditStringList.SetCapacity(NewCapacity: Integer); +{$IFDEF OWN_UnicodeString_MEMMGR} +var + I : Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if NewCapacity < Count then + EListError.Create( SInvalidCapacity ); + ReallocMem(FList, NewCapacity * SynEditStringRecSize); + {$IFDEF OWN_UnicodeString_MEMMGR} + for I := FCount to NewCapacity - 1 do + Pointer(FList[I].FString) := nil; // so that it does not get freed + {$ENDIF OWN_UnicodeString_MEMMGR} + FCapacity := NewCapacity; +end; + +procedure TSynEditStringList.SetFileFormat(const Value: TSynEditFileFormat); +begin + FFileFormat := Value; +{$IFDEF UNICODE} + case FileFormat of + sffDos: + LineBreak := WideCRLF; + sffUnix: + LineBreak := WideLF; + sffMac: + LineBreak := WideCR; + sffUnicode: + LineBreak := WideLineSeparator; + end; +{$ENDIF} +end; + +{$IFDEF OWN_UnicodeString_MEMMGR} +procedure TSynEditStringList.SetListString(Index: Integer; const S: UnicodeString); +var + Len: Integer; + A: TDynWideCharArray; +begin + with FList[Index] do + begin + Pointer(A) := TDynWideCharArray(FString); + if A <> nil then + A := nil; // free memory + + Len := Length(S); + if Len > 0 then + begin + SetLength(A, Len + 1); // include #0 + System.Move(S[1], A[0], Len * SizeOf(WideChar)); + A[Len] := #0; + end; + + FString := PWideChar(A); + Pointer(A) := nil; // do not release the array on procedure Exit + end; +end; +{$ENDIF OWN_UnicodeString_MEMMGR} + +procedure TSynEditStringList.SetTabWidth(Value: Integer); +var + i: Integer; +begin + if Value <> FTabWidth then begin + FTabWidth := Value; + FConvertTabsProc := GetBestConvertTabsProcEx(FTabWidth); + FIndexOfLongestLine := -1; + for i := 0 to FCount - 1 do + with FList^[i] do begin + FExpandedLength := -1; + Exclude(FFlags, sfHasNoTabs); + Include(FFlags, sfExpandedLengthUnknown); + end; + end; +end; + +procedure TSynEditStringList.SetTextStr(const Value: UnicodeString); +var + S: UnicodeString; + Size: Integer; + P, Start, Pmax: PWideChar; + fCR, fLF, fLINESEPARATOR: Boolean; +begin + fLINESEPARATOR := False; + fCR := False; + fLF := False; + BeginUpdate; + try + Clear; + P := Pointer(Value); + if P <> nil then + begin + Size := Length(Value); + Pmax := @Value[Size]; + while (P <= Pmax) do + begin + Start := P; + while (P^ <> WideCR) and (P^ <> WideLF) and (P^ <> WideLineSeparator) and (P <= Pmax) do + begin + Inc(P); + end; + if P<>Start then + begin + SetString(S, Start, P - Start); + InsertItem(FCount, S); + end else InsertItem(FCount, ''); + if P^ = WideLineSeparator then + begin + fLINESEPARATOR := True; + Inc(P); + end; + if P^ = WideCR then + begin + fCR := True; + Inc(P); + end; + if P^ = WideLF then + begin + fLF := True; + Inc(P); + end; + end; + // keep the old format of the file + if not AppendNewLineAtEOF and + (CharInSet(Value[Size], [#10, #13]) or (Value[Size] = WideLineSeparator)) + then + InsertItem(FCount, ''); + end; + if Assigned(OnInserted) and (FCount > 0) then + OnInserted(Self, 0, FCount); + finally + EndUpdate; + end; + if fLINESEPARATOR then + FileFormat := sffUnicode + else if fCR and not fLF then + FileFormat := sffMac + else if fLF and not fCR then + FileFormat := sffUnix + else + FileFormat := sffDos; +end; + +procedure TSynEditStringList.SetUpdateState(Updating: Boolean); +begin + FCharIndexesAreValid:=False; + if Updating then begin + if Assigned(FOnChanging) then + FOnChanging(Self); + end else begin + if Assigned(FOnChange) then + FOnChange(Self); + end; +end; + +procedure TSynEditStringList.FontChanged; +var + i: Integer; +begin + FIndexOfLongestLine := -1; + for i := 0 to FCount - 1 do + with FList^[i] do + begin + FExpandedLength := -1; + Exclude(FFlags, sfHasNoTabs); + Include(FFlags, sfExpandedLengthUnknown); + end; +end; + +{ TSynEditUndoItem } + +procedure TSynEditUndoItem.Assign(Source: TPersistent); +begin + if (Source is TSynEditUndoItem) then + begin + FChangeReason:=TSynEditUndoItem(Source).FChangeReason; + FChangeSelMode:=TSynEditUndoItem(Source).FChangeSelMode; + FChangeStartPos:=TSynEditUndoItem(Source).FChangeStartPos; + FChangeEndPos:=TSynEditUndoItem(Source).FChangeEndPos; + FChangeStr:=TSynEditUndoItem(Source).FChangeStr; + FChangeNumber:=TSynEditUndoItem(Source).FChangeNumber; + end + else + inherited Assign(Source); +end; + + +{ TSynEditUndoList } + +constructor TSynEditUndoList.Create; +begin + inherited Create; + FItems := TList.Create; + FMaxUndoActions := 1024; + FNextChangeNumber := 1; + FInsideRedo := False; +end; + +destructor TSynEditUndoList.Destroy; +begin + Clear; + FItems.Free; + inherited Destroy; +end; + +procedure TSynEditUndoList.Assign(Source: TPersistent); +var + i: Integer; + UndoItem: TSynEditUndoItem; +begin + if (Source is TSynEditUndoList) then + begin + Clear; + for i:=0 to TSynEditUndoList(Source).FItems.Count-1 do + begin + UndoItem:=TSynEditUndoItem.Create; + UndoItem.Assign(TSynEditUndoList(Source).FItems[i]); + FItems.Add(UndoItem); + end; + FBlockChangeNumber:=TSynEditUndoList(Source).FBlockChangeNumber; + FBlockCount:=TSynEditUndoList(Source).FBlockCount; + FFullUndoImposible:=TSynEditUndoList(Source).FFullUndoImposible; + FLockCount:=TSynEditUndoList(Source).FLockCount; + FMaxUndoActions:=TSynEditUndoList(Source).FMaxUndoActions; + FNextChangeNumber:=TSynEditUndoList(Source).FNextChangeNumber; + FInsideRedo:=TSynEditUndoList(Source).FInsideRedo; + end + else + inherited Assign(Source); +end; + +procedure TSynEditUndoList.AddChange(AReason: TSynChangeReason; const AStart, + AEnd: TBufferCoord; const ChangeText: UnicodeString; SelMode: TSynSelectionMode); +var + NewItem: TSynEditUndoItem; +begin + if FLockCount = 0 then begin + NewItem := TSynEditUndoItem.Create; + try + with NewItem do begin + FChangeReason := AReason; + FChangeSelMode := SelMode; + FChangeStartPos := AStart; + FChangeEndPos := AEnd; + FChangeStr := ChangeText; + if FBlockChangeNumber <> 0 then + FChangeNumber := FBlockChangeNumber + else begin + FChangeNumber := FNextChangeNumber; + if FBlockCount = 0 then begin + Inc(FNextChangeNumber); + if FNextChangeNumber = 0 then + Inc(FNextChangeNumber); + end; + end; + end; + PushItem(NewItem); + except + NewItem.Free; + raise; + end; + end; +end; + +procedure TSynEditUndoList.BeginBlock; +begin + Inc(FBlockCount); + FBlockChangeNumber := FNextChangeNumber; +end; + +procedure TSynEditUndoList.Clear; +var + i: Integer; +begin + for i := 0 to FItems.Count - 1 do + TSynEditUndoItem(FItems[i]).Free; + FItems.Clear; + FFullUndoImposible := False; +end; + +procedure TSynEditUndoList.EndBlock; +var + iBlockID: Integer; +begin + if FBlockCount > 0 then begin + Dec(FBlockCount); + if FBlockCount = 0 then begin + iBlockID := FBlockChangeNumber; + FBlockChangeNumber := 0; + Inc(FNextChangeNumber); + if FNextChangeNumber = 0 then + Inc(FNextChangeNumber); + if (FItems.Count > 0) and (PeekItem.ChangeNumber = iBlockID) and + Assigned(OnAddedUndo) then + begin + OnAddedUndo( Self ); + end; + end; + end; +end; + +procedure TSynEditUndoList.EnsureMaxEntries; +var + Item: TSynEditUndoItem; +begin + if FItems.Count > FMaxUndoActions then + begin + FFullUndoImposible := True; + while FItems.Count > FMaxUndoActions do begin + Item := FItems[0]; + Item.Free; + FItems.Delete(0); + end; + end; +end; + +function TSynEditUndoList.GetCanUndo: Boolean; +begin + Result := FItems.Count > 0; +end; + +function TSynEditUndoList.GetItemCount: Integer; +begin + Result := FItems.Count; +end; + +procedure TSynEditUndoList.Lock; +begin + Inc(FLockCount); +end; + +function TSynEditUndoList.PeekItem: TSynEditUndoItem; +var + iLast: Integer; +begin + Result := nil; + iLast := FItems.Count - 1; + if iLast >= 0 then + Result := FItems[iLast]; +end; + +function TSynEditUndoList.PopItem: TSynEditUndoItem; +var + iLast: Integer; +begin + Result := nil; + iLast := FItems.Count - 1; + if iLast >= 0 then begin + Result := FItems[iLast]; + FItems.Delete(iLast); + end; +end; + +procedure TSynEditUndoList.PushItem(Item: TSynEditUndoItem); +begin + if Assigned(Item) then begin + FItems.Add(Item); + EnsureMaxEntries; + if (Item.ChangeReason <> crGroupBreak) and Assigned(OnAddedUndo) then + OnAddedUndo(Self); + end; +end; + +procedure TSynEditUndoList.SetMaxUndoActions(Value: Integer); +begin + if Value < 0 then + Value := 0; + if Value <> FMaxUndoActions then begin + FMaxUndoActions := Value; + EnsureMaxEntries; + end; +end; + +procedure TSynEditUndoList.Unlock; +begin + if FLockCount > 0 then + Dec(FLockCount); +end; + +function TSynEditUndoList.LastChangeReason: TSynChangeReason; +begin + if FItems.Count = 0 then + Result := crNothing + else + Result := TSynEditUndoItem(FItems[FItems.Count - 1]).FChangeReason; +end; + +procedure TSynEditUndoList.AddGroupBreak; +var + vDummy: TBufferCoord; +begin + //Add the GroupBreak even if ItemCount = 0. Since items are stored in + //reverse order in TCustomSynEdit.fRedoList, a GroupBreak could be lost. + if LastChangeReason <> crGroupBreak then + begin + AddChange(crGroupBreak, vDummy, vDummy, '', smNormal); + end; +end; + +procedure TSynEditUndoList.SetInitialState(const Value: Boolean); +begin + if Value then + begin + if ItemCount = 0 then + FInitialChangeNumber := 0 + else + FInitialChangeNumber := PeekItem.ChangeNumber; + end + else + if ItemCount = 0 then + begin + if FInitialChangeNumber = 0 then + FInitialChangeNumber := -1; + end + else if PeekItem.ChangeNumber = FInitialChangeNumber then + FInitialChangeNumber := -1; +end; + +function TSynEditUndoList.GetInitialState: Boolean; +begin + if ItemCount = 0 then + Result := FInitialChangeNumber = 0 + else + Result := PeekItem.ChangeNumber = FInitialChangeNumber; +end; + +function TSynEditUndoList.GetItems(Index: Integer): TSynEditUndoItem; +begin + Result := TSynEditUndoItem(FItems[Index]); +end; + +procedure TSynEditUndoList.SetItems(Index: Integer; + const Value: TSynEditUndoItem); +begin + FItems[Index] := Value; +end; + +procedure TSynEditUndoList.DeleteItem(AIndex: Integer); +begin + TSynEditUndoItem(FItems[AIndex]).Free; + FItems.Delete(AIndex); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditTypes.pas b/Source/VCL/SynEdit/Source/SynEditTypes.pas index e0650894..ba7130cd 100644 --- a/Source/VCL/SynEdit/Source/SynEditTypes.pas +++ b/Source/VCL/SynEdit/Source/SynEditTypes.pas @@ -1,277 +1,149 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditTypes.pas, released 2000-04-07. -The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, -part of the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -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. - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditTypes; - -{$I SynEdit.inc} - -interface - -uses - Types, - Math, - {$IF CompilerVersion <= 32} - Controls, - {$IFEND} - SysUtils; - -const -// These might need to be localized depending on the characterset because they might be -// interpreted as valid ident characters. - SynTabGlyph = WideChar($2192); //'->' - SynSoftBreakGlyph = WideChar($00AC); //'¬' - SynLineBreakGlyph = WideChar($00B6); //'¶' - SynSpaceGlyph = WideChar($2219); //'·' - -type - ESynError = class(Exception); - - // DOS: CRLF, UNIX: LF, Mac: CR, Unicode: LINE SEPARATOR - TSynEditFileFormat = (sffDos, sffUnix, sffMac, sffUnicode); - - TSynSearchOption = (ssoMatchCase, ssoWholeWord, ssoBackwards, - ssoEntireScope, ssoSelectedOnly, ssoReplace, ssoReplaceAll, ssoPrompt); - TSynSearchOptions = set of TSynSearchOption; - - TCategoryMethod = function(AChar: WideChar): Boolean of object; - - TSynEditorCommand = type word; - - THookedCommandEvent = procedure(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: pointer; HandlerData: pointer) of object; - - TSynInfoLossEvent = procedure (var Encoding: TEncoding; Cancel: Boolean) of object; - - PSynSelectionMode = ^TSynSelectionMode; - TSynSelectionMode = (smNormal, smLine, smColumn); - - TBufferCoord = record - Char: integer; - Line: integer; - class operator Equal(a, b: TBufferCoord): Boolean; - class operator NotEqual(a, b: TBufferCoord): Boolean; - class operator LessThan(a, b: TBufferCoord): Boolean; - class operator LessThanOrEqual(a, b: TBufferCoord): Boolean; - class operator GreaterThan(a, b: TBufferCoord): Boolean; - class operator GreaterThanOrEqual(a, b: TBufferCoord): Boolean; - class function Min(a, b: TBufferCoord): TBufferCoord; static; - class function Max(a, b: TBufferCoord): TBufferCoord; static; - end; - - TDisplayCoord = record - Column: integer; - Row: integer; - class operator Equal(a, b: TDisplayCoord): Boolean; - class operator NotEqual(a, b: TDisplayCoord): Boolean; - class operator LessThan(a, b: TDisplayCoord): Boolean; - class operator LessThanOrEqual(a, b: TDisplayCoord): Boolean; - class operator GreaterThan(a, b: TDisplayCoord): Boolean; - class operator GreaterThanOrEqual(a, b: TDisplayCoord): Boolean; - class function Min(a, b: TDisplayCoord): TDisplayCoord; static; - class function Max(a, b: TDisplayCoord): TDisplayCoord; static; - end; - - (* Helper methods for TControl - for backwward compatibility *) - {$IF CompilerVersion <= 32} - TControlHelper = class helper for TControl - public - function CurrentPPI: Integer; - function FCurrentPPI: Integer; - end; - {$IFEND} - - -function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; -function BufferCoord(AChar, ALine: Integer): TBufferCoord; -function LineBreakFromFileFormat(FileFormat: TSynEditFileFormat): string; - -implementation -Uses - SynUnicode; - -function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; -begin - Result.Column := AColumn; - Result.Row := ARow; -end; - -function BufferCoord(AChar, ALine: Integer): TBufferCoord; -begin - Result.Char := AChar; - Result.Line := ALine; -end; - -{ TBufferCoord } - -class operator TBufferCoord.Equal(a, b: TBufferCoord): Boolean; -begin - Result := (a.Char = b.Char) and (a.Line = b.Line); -end; - -class operator TBufferCoord.GreaterThan(a, b: TBufferCoord): Boolean; -begin - Result := (b.Line < a.Line) - or ((b.Line = a.Line) and (b.Char < a.Char)) -end; - -class operator TBufferCoord.GreaterThanOrEqual(a, b: TBufferCoord): Boolean; -begin - Result := (b.Line < a.Line) - or ((b.Line = a.Line) and (b.Char <= a.Char)) -end; - -class operator TBufferCoord.LessThan(a, b: TBufferCoord): Boolean; -begin - Result := (b.Line > a.Line) - or ((b.Line = a.Line) and (b.Char > a.Char)) -end; - -class operator TBufferCoord.LessThanOrEqual(a, b: TBufferCoord): Boolean; -begin - Result := (b.Line > a.Line) - or ((b.Line = a.Line) and (b.Char >= a.Char)) -end; - -class function TBufferCoord.Max(a, b: TBufferCoord): TBufferCoord; -begin - if (b.Line < a.Line) - or ((b.Line = a.Line) and (b.Char < a.Char)) - then - Result := a - else - Result := b; -end; - -class function TBufferCoord.Min(a, b: TBufferCoord): TBufferCoord; -begin - if (b.Line < a.Line) - or ((b.Line = a.Line) and (b.Char < a.Char)) - then - Result := b - else - Result := a; -end; - -class operator TBufferCoord.NotEqual(a, b: TBufferCoord): Boolean; -begin - Result := (a.Char <> b.Char) or (a.Line <> b.Line); -end; - -{ TDisplayCoord } - -class operator TDisplayCoord.Equal(a, b: TDisplayCoord): Boolean; -begin - Result := (a.Row = b.Row) and (a.Column = b.Column); -end; - -class operator TDisplayCoord.GreaterThan(a, b: TDisplayCoord): Boolean; -begin - Result := (b.Row < a.Row) - or ((b.Row = a.Row) and (b.Column < a.Column)) -end; - -class operator TDisplayCoord.GreaterThanOrEqual(a, b: TDisplayCoord): Boolean; -begin - Result := (b.Row < a.Row) - or ((b.Row = a.Row) and (b.Column <= a.Column)) -end; - -class operator TDisplayCoord.LessThan(a, b: TDisplayCoord): Boolean; -begin - Result := (b.Row > a.Row) - or ((b.Row = a.Row) and (b.Column > a.Column)) -end; - -class operator TDisplayCoord.LessThanOrEqual(a, b: TDisplayCoord): Boolean; -begin - Result := (b.Row > a.Row) - or ((b.Row = a.Row) and (b.Column >= a.Column)) -end; - -class function TDisplayCoord.Max(a, b: TDisplayCoord): TDisplayCoord; -begin - if (b.Row < a.Row) - or ((b.Row = a.Row) and (b.Column < a.Column)) - then - Result := a - else - Result := b; -end; - -class function TDisplayCoord.Min(a, b: TDisplayCoord): TDisplayCoord; -begin - if (b.Row < a.Row) - or ((b.Row = a.Row) and (b.Column < a.Column)) - then - Result := b - else - Result := a; -end; - -class operator TDisplayCoord.NotEqual(a, b: TDisplayCoord): Boolean; -begin - Result := (a.Row <> b.Row) or (a.Column <> b.Column); -end; - -function LineBreakFromFileFormat(FileFormat: TSynEditFileFormat): string; -begin - case FileFormat of - sffDos: Result := WideCRLF; - sffUnix: Result := WideLF; - sffMac: Result := WideCR; - sffUnicode: Result := WideLineSeparator; - end; -end; - -{$IF CompilerVersion <= 32} -{ TControlHelper } - -function TControlHelper.CurrentPPI: Integer; -begin - Result := Screen.PixelsPerInch; -end; - -function TControlHelper.FCurrentPPI: Integer; -begin - Result := Screen.PixelsPerInch; -end; -{$IFEND} - - - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditTypes.pas, released 2000-04-07. +The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, +part of the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +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: SynEditTypes.pas,v 1.13.2.2 2012/09/17 14:17:25 CodehunterWorks Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITTYPES} +unit SynEditTypes; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + SysUtils; + +const +// These might need to be localized depending on the characterset because they might be +// interpreted as valid ident characters. + SynTabGlyph = WideChar($2192); //'->' + SynSoftBreakGlyph = WideChar($00AC); //'¬' + SynLineBreakGlyph = WideChar($00B6); //'¶' + SynSpaceGlyph = WideChar($2219); //'·' + +type + ESynError = class(Exception); + + TSynSearchOption = (ssoMatchCase, ssoWholeWord, ssoBackwards, + ssoEntireScope, ssoSelectedOnly, ssoReplace, ssoReplaceAll, ssoPrompt); + TSynSearchOptions = set of TSynSearchOption; + + TCategoryMethod = function(AChar: WideChar): Boolean of object; + + TKeyPressWEvent = procedure(Sender: TObject; var Key: WideChar) of object; + + PSynSelectionMode = ^TSynSelectionMode; + TSynSelectionMode = (smNormal, smLine, smColumn); + + PBorlandSelectionMode = ^TBorlandSelectionMode; + TBorlandSelectionMode = ( + bsmInclusive, // selects inclusive blocks. Borland IDE shortcut: Ctrl+O+I + bsmLine, // selects line blocks. Borland IDE shortcut: Ctrl+O+L + bsmColumn, // selects column blocks. Borland IDE shortcut: Ctrl+O+C + bsmNormal // selects normal Block. Borland IDE shortcut: Ctrl+O+K + ); + + //todo: better field names. CharIndex and LineIndex? + TBufferCoord = record + Char: Integer; + Line: Integer; + {$IFDEF SYN_COMPILER_10_UP} + class operator Equal(a, b: TBufferCoord): Boolean; + {$ENDIF} + end; + + // Codehunter patch: added TBufferBlock + TBufferBlock = record + BeginLine, BeginChar: Integer; + EndLine, EndChar: Integer; + {$IFDEF SYN_COMPILER_10_UP} + class operator Equal(a, b: TBufferBlock): Boolean; + {$ENDIF} + end; + + TDisplayCoord = record + Column: Integer; + Row: Integer; + {$IFDEF SYN_COMPILER_10_UP} + class operator Equal(a, b: TDisplayCoord): Boolean; + {$ENDIF} + end; + +function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; +function BufferCoord(AChar, ALine: Integer): TBufferCoord; + +implementation + +function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; +begin + Result.Column := AColumn; + Result.Row := ARow; +end; + +function BufferCoord(AChar, ALine: Integer): TBufferCoord; +begin + Result.Char := AChar; + Result.Line := ALine; +end; + +{$IFDEF SYN_COMPILER_10_UP} + +{ TBufferCoord } + +class operator TBufferCoord.Equal(a, b: TBufferCoord): Boolean; +begin + Result := (a.Char = b.Char) and (a.Line = b.Line); +end; + +{ TBufferBlock } + +class operator TBufferBlock.Equal(a, b: TBufferBlock): Boolean; +begin + Result := (a.BeginLine = b.BeginLine) and (a.BeginChar = b.BeginChar) and + (a.EndLine = b.EndLine) and (a.EndChar = b.EndChar); +end; + +{ TDisplayCoord } + +class operator TDisplayCoord.Equal(a, b: TDisplayCoord): Boolean; +begin + Result := (a.Row = b.Row) and (a.Column = b.Column); +end; + +{$ENDIF} + +end. diff --git a/Source/VCL/SynEdit/Source/SynEditWildcardSearch.pas b/Source/VCL/SynEdit/Source/SynEditWildcardSearch.pas index 5952e628..36e5e7b2 100644 --- a/Source/VCL/SynEdit/Source/SynEditWildcardSearch.pas +++ b/Source/VCL/SynEdit/Source/SynEditWildcardSearch.pas @@ -1,145 +1,148 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynEditWildcardSearch.pas, released 2003-06-21. - -The original author of this file is Michael Elsdoerfer. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynEditWildcardSearch.pas,v 1.2.2.2 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynEditWildcardSearch; - -{$I SynEdit.inc} - -interface - -uses - SynEdit, - SynEditTypes, - SynEditRegexSearch, - Classes; - -type - TSynEditWildcardSearch = class(TSynEditRegexSearch) - private - fPattern: UnicodeString; - protected - function GetPattern: UnicodeString; override; - procedure SetPattern(const Value: UnicodeString); override; - procedure SetOptions(const Value: TSynSearchOptions); override; - function GetLength(Index: Integer): Integer; override; - function GetResult(Index: Integer): Integer; override; - function GetResultCount: Integer; override; - // Converts the Wildcard to a regular expression - function WildCardToRegExpr(AWildCard: UnicodeString): UnicodeString; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function FindAll(const NewText: UnicodeString): Integer; override; - function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; //slm 11/29/02 - end; - -implementation - -uses - Consts; - -{ TSynEditWildcardSearch } - -constructor TSynEditWildcardSearch.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fPattern := ''; -end; - -destructor TSynEditWildcardSearch.Destroy; -begin - inherited; -end; - -function TSynEditWildcardSearch.FindAll(const NewText: UnicodeString): integer; -begin - Result := inherited FindAll(NewText); -end; - -function TSynEditWildcardSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; -begin - Result := inherited Replace(aOccurrence, aReplacement); -end; - -function TSynEditWildcardSearch.GetLength(Index: Integer): Integer; -begin - Result := inherited GetLength(Index); -end; - -function TSynEditWildcardSearch.GetPattern: UnicodeString; -begin - Result := fPattern; -end; - -function TSynEditWildcardSearch.GetResult(Index: integer): integer; -begin - Result := inherited GetResult(Index); -end; - -function TSynEditWildcardSearch.GetResultCount: integer; -begin - Result := inherited GetResultCount; -end; - -procedure TSynEditWildcardSearch.SetOptions(const Value: TSynSearchOptions); -begin - inherited; -end; - -procedure TSynEditWildcardSearch.SetPattern(const Value: UnicodeString); -begin - fPattern := Value; - // Convert into a real regular expression and assign it - inherited SetPattern(WildCardToRegExpr(Value)); -end; - -function TSynEditWildcardSearch.WildCardToRegExpr( - AWildCard: UnicodeString): UnicodeString; -var - i: Integer; -begin - Result := ''; - - for i := 1 to Length(AWildCard) do - case AWildCard[i] of - '*': Result := Result + '.*'; - '?': Result := Result + '.?'; - else Result := Result + AWildCard[i]; - end; -end; - -end. - +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynEditWildcardSearch.pas, released 2003-06-21. + +The original author of this file is Michael Elsdoerfer. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynEditWildcardSearch.pas,v 1.2.2.2 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNEDITWILDCARDSEARCH} +unit SynEditWildcardSearch; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + SynEdit, + SynEditTypes, + SynRegExpr, + SynEditRegexSearch, + Classes; + +type + TSynEditWildcardSearch = class(TSynEditRegexSearch) + private + fPattern: UnicodeString; + protected + function GetPattern: UnicodeString; override; + procedure SetPattern(const Value: UnicodeString); override; + procedure SetOptions(const Value: TSynSearchOptions); override; + function GetLength(Index: Integer): Integer; override; + function GetResult(Index: Integer): Integer; override; + function GetResultCount: Integer; override; + // Converts the Wildcard to a regular expression + function WildCardToRegExpr(AWildCard: UnicodeString): UnicodeString; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function FindAll(const NewText: UnicodeString): Integer; override; + function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; //slm 11/29/02 + end; + +implementation + +uses + Consts; + +{ TSynEditWildcardSearch } + +constructor TSynEditWildcardSearch.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FPattern := ''; +end; + +destructor TSynEditWildcardSearch.Destroy; +begin + inherited; +end; + +function TSynEditWildcardSearch.FindAll(const NewText: UnicodeString): integer; +begin + Result := inherited FindAll(NewText); +end; + +function TSynEditWildcardSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; +begin + Result := inherited Replace(aOccurrence, aReplacement); +end; + +function TSynEditWildcardSearch.GetLength(Index: Integer): Integer; +begin + Result := inherited GetLength(Index); +end; + +function TSynEditWildcardSearch.GetPattern: UnicodeString; +begin + Result := fPattern; +end; + +function TSynEditWildcardSearch.GetResult(Index: integer): integer; +begin + Result := inherited GetResult(Index); +end; + +function TSynEditWildcardSearch.GetResultCount: integer; +begin + Result := inherited GetResultCount; +end; + +procedure TSynEditWildcardSearch.SetOptions(const Value: TSynSearchOptions); +begin + inherited; +end; + +procedure TSynEditWildcardSearch.SetPattern(const Value: UnicodeString); +begin + FPattern := Value; + // Convert into a real regular expression and assign it + inherited SetPattern(WildCardToRegExpr(Value)); +end; + +function TSynEditWildcardSearch.WildCardToRegExpr( + AWildCard: UnicodeString): UnicodeString; +var + i: Integer; +begin + Result := ''; + + for i := 1 to Length(AWildCard) do + case AWildCard[i] of + '*': Result := Result + '.*'; + '?': Result := Result + '.?'; + else Result := Result + AWildCard[i]; + end; +end; + +end. + diff --git a/Source/VCL/SynEdit/Source/SynEditWordWrap.pas b/Source/VCL/SynEdit/Source/SynEditWordWrap.pas index dd87e637..f2d26cfa 100644 --- a/Source/VCL/SynEdit/Source/SynEditWordWrap.pas +++ b/Source/VCL/SynEdit/Source/SynEditWordWrap.pas @@ -1,588 +1,637 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is SynEditWordWrap.pas by Flávio Etrusco, released 2003-12-11. -Unicode translation by Maël Hörz. -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: SynEditWordWrap.pas,v 1.8.2.6 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -//todo: Use a single implementation of ReWrapLines that takes starting line and number of lines to rewrap -//todo: Tweak code to try finding better wrapping points. Some support by the highlighters will be needed, probably. -//todo: Document the code -//todo: The length of the last Row of a Line could be calculated from the Line length instead of being stored. This would be only useful when most of the lines aren't wrapped. - -unit SynEditWordWrap; - -{$I SynEdit.inc} - -interface - -uses - SynEditTypes, - SynEditTextBuffer, - SynEdit, - SysUtils, - Classes; - -const - MaxIndex = MaxInt div 16; - -type - TLineIndex = 0..MaxIndex; - TRowIndex = 0..MaxIndex; - TRowLength = word; - - TRowIndexArray = array [TLineIndex] of TRowIndex; - PRowIndexArray = ^TRowIndexArray; - - TRowLengthArray = array [TRowIndex] of TRowLength; - PRowLengthArray = ^TRowLengthArray; - - // For clarity, I'll refer to buffer coordinates as 'Line' and - // 'Char' and to display (wrapped) coordinates as 'Row' and 'Column'. - - // fLineOffsets[n] is the index of the first row of the [n+1]th line. - // e.g. Starting row of first line (0) is 0. Starting row of second line (1) - // is fLineOffsets[0]. Clear? - - TSynWordWrapPlugin = class(TInterfacedObject, ISynEditBufferPlugin) - private - fLineOffsets: PRowIndexArray; - fRowLengths: PRowLengthArray; - fLineCapacity: integer; - fRowCapacity: integer; - fLineCount: integer; - - fEditor: TCustomSynEdit; - fMinRowLength: TRowLength; - fMaxRowLength: TRowLength; - procedure GrowLines(aMinSize: integer); - procedure MoveLines(aStart: TLineIndex; aMoveBy: integer); - procedure GrowRows(aMinSize: integer); - procedure MoveRows(aStart: TRowIndex; aMoveBy: integer); - procedure SetEmpty; - protected - procedure WrapLines; - function ReWrapLine(aIndex: TLineIndex): integer; - procedure TrimArrays; - property LineOffsets: PRowIndexArray read fLineOffsets; - property RowLengths: PRowLengthArray read fRowLengths; - property Editor: TCustomSynEdit read fEditor; - public - constructor Create(aOwner: TCustomSynEdit); - destructor Destroy; override; - property LineCount: integer read fLineCount; - { ISynEditBufferPlugin } - function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; - function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; - function RowCount: integer; - function GetRowLength(aRow: integer): integer; - function LinesInserted(aIndex: integer; aCount: integer): integer; - function LinesDeleted(aIndex: integer; aCount: integer): integer; - function LinesPutted(aIndex: integer; aCount: integer): integer; - procedure Reset; - procedure DisplayChanged; - end; - -implementation - -uses - SynUnicode, - RTLConsts, - SynEditMiscProcs, - Math; - -{ TSynWordWrapPlugin } - -function TSynWordWrapPlugin.BufferToDisplayPos( - const aPos: TBufferCoord): TDisplayCoord; -var - vStartRow: integer; // first row of the line - cRow: integer; - vRowLen: integer; -begin - Assert(aPos.Char > 0); - Assert(aPos.Line > 0); - if LineCount < aPos.Line then - begin - // beyond EOF - Result.Column := aPos.Char; - Result.Row := RowCount + (aPos.Line - LineCount); - Exit; - end; - if aPos.Line = 1 then - vStartRow := 0 - else - vStartRow := fLineOffsets[aPos.Line - 2]; - vRowLen := 0; - for cRow := vStartRow to fLineOffsets[aPos.Line - 1] - 1 do - begin - Inc(vRowLen, fRowLengths[cRow]); - if aPos.Char <= vRowLen then - begin - Result.Column := aPos.Char - vRowLen + fRowLengths[cRow]; - Result.Row := cRow + 1; - Exit; - end; - end; - // beyond EOL - Result.Column := aPos.Char - vRowLen + fRowLengths[fLineOffsets[aPos.Line - 1] - 1]; - Result.Row := fLineOffsets[aPos.Line - 1]; -end; - -constructor TSynWordWrapPlugin.Create(aOwner: TCustomSynEdit); -begin - inherited Create; // just to work as reminder in case I revert it to a TComponent... - if aOwner = nil then - raise Exception.Create( 'Owner of TSynWordWrapPlugin must be a TCustomSynEdit' ); - fEditor := aOwner; - Reset; -end; - -destructor TSynWordWrapPlugin.Destroy; -begin - inherited; - FreeMem(fLineOffsets); - FreeMem(fRowLengths); -end; - -procedure TSynWordWrapPlugin.DisplayChanged; -begin - if Editor.CharsInWindow <> fMaxRowLength then - Reset; -end; - -function TSynWordWrapPlugin.DisplayToBufferPos( - const aPos: TDisplayCoord): TBufferCoord; -var - cLine: integer; - cRow: integer; -begin - Assert(aPos.Column > 0); - Assert(aPos.Row > 0); - if aPos.Row > RowCount then - begin - // beyond EOF - Result.Char := aPos.Column; - Result.Line := aPos.Row - RowCount + LineCount; - Exit; - end; - //todo: use a binary search or something smarter - for cLine := LineCount - 2 downto 0 do - if aPos.Row > fLineOffsets[cLine] then - begin - Result.Line := cLine + 2; - if aPos.Row = fLineOffsets[cLine + 1] then //last row of line - Result.Char := Min(aPos.Column, fMaxRowLength + 1) - else - Result.Char := Min(aPos.Column, fRowLengths[aPos.Row - 1] + 1); - for cRow := fLineOffsets[cLine] to aPos.Row - 2 do - Inc(Result.Char, fRowLengths[cRow]); - Exit; - end; - // first line - Result.Line := 1; - if aPos.Row = fLineOffsets[0] then //last row of line - Result.Char := Min(aPos.Column, fMaxRowLength + 1) - else - Result.Char := Min(aPos.Column, fRowLengths[aPos.Row - 1] + 1); - for cRow := 0 to aPos.Row - 2 do - Inc(Result.Char, fRowLengths[cRow]); -end; - -function TSynWordWrapPlugin.GetRowLength(aRow: integer): integer; -// aRow is 1-based... -begin - if (aRow <= 0) or (aRow > RowCount) then - TList.Error(SListIndexError, aRow); - Result := fRowLengths[aRow - 1]; -end; - -procedure TSynWordWrapPlugin.GrowLines(aMinSize: integer); -const - vStepSize = 256; -begin - if aMinSize <= 0 then - aMinSize := 1; - - if aMinSize > fLineCapacity then - begin - aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); - ReallocMem(fLineOffsets, aMinSize * SizeOf(TRowIndex)); - fLineCapacity := aMinSize; - end; -end; - -procedure TSynWordWrapPlugin.GrowRows(aMinSize: integer); -const - vStepSize = 512; -begin - if aMinSize <= 0 then - aMinSize := 1; - if aMinSize > fRowCapacity then - begin - aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); - ReallocMem(fRowLengths, aMinSize * SizeOf(TRowLength)); - fRowCapacity := aMinSize; - end; -end; - -function TSynWordWrapPlugin.LinesDeleted(aIndex: integer; aCount: integer): integer; -var - vStartRow: integer; - vEndRow: integer; - cLine: integer; -begin - if fMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; - Assert(aIndex >= 0); - Assert(aCount >= 1); - Assert(aIndex + aCount <= LineCount); - - if aIndex = 0 then - vStartRow := 0 - else - vStartRow := fLineOffsets[aIndex - 1]; - vEndRow := fLineOffsets[aIndex + aCount - 1]; - Result := vEndRow - vStartRow; - // resize fRowLengths - if vEndRow < RowCount then - MoveRows(vEndRow, -Result); - // resize fLineOffsets - MoveLines(aIndex + aCount, -aCount); - Dec(fLineCount, aCount); - // update offsets - for cLine := aIndex to LineCount - 1 do - Dec(fLineOffsets[cLine], Result); -end; - -function TSynWordWrapPlugin.LinesInserted(aIndex: integer; aCount: integer): integer; -var - vPrevOffset: TRowIndex; - cLine: integer; -begin - if fMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; - Assert(aIndex >= 0); - Assert(aCount >= 1); - Assert(aIndex <= LineCount); - // resize fLineOffsets - GrowLines(LineCount + aCount); - if aIndex < LineCount then // no need for MoveLines if inserting at LineCount (TSynEditStringList.Add) - begin - Inc(fLineCount, aCount); // fLineCount must be updated before calling MoveLines() - MoveLines(aIndex, aCount); - end - else - Inc(fLineCount, aCount); - // set offset to same as previous line (i.e. the line has 0 rows) - if aIndex = 0 then - vPrevOffset := 0 - else - vPrevOffset := fLineOffsets[aIndex - 1]; - for cLine := aIndex to aIndex + aCount - 1 do - fLineOffsets[cLine] := vPrevOffset; - // Rewrap - Result := 0; - for cLine := aIndex to aIndex + aCount - 1 do - Inc(Result, ReWrapLine(cLine)); -end; - -function TSynWordWrapPlugin.LinesPutted(aIndex: integer; aCount: integer): integer; -var - cLine: integer; -begin - if fMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; - Assert(aIndex >= 0); - Assert(aCount >= 1); - Assert(aIndex + aCount <= LineCount); - // Rewrap - Result := 0; - for cLine := aIndex to aIndex + aCount - 1 do - Inc(Result, ReWrapLine(cLine)); -end; - -procedure TSynWordWrapPlugin.MoveLines(aStart: TLineIndex; aMoveBy: integer); -var - vMoveCount: integer; -begin - Assert(aMoveBy <> 0); - Assert(aStart + aMoveBy >= 0); - Assert(aStart + aMoveBy < LineCount); - vMoveCount := LineCount - aStart; - if aMoveBy > 0 then - Dec(vMoveCount, aMoveBy); - Move(fLineOffsets[aStart], fLineOffsets[aStart + aMoveBy], - vMoveCount * SizeOf(TRowIndex)); -end; - -procedure TSynWordWrapPlugin.MoveRows(aStart: TRowIndex; aMoveBy: integer); -var - vMoveCount: integer; -begin - Assert(aMoveBy <> 0); - Assert(aStart + aMoveBy >= 0); - Assert(aStart + aMoveBy < RowCount); - vMoveCount := RowCount - aStart; - if aMoveBy > 0 then - Dec(vMoveCount, aMoveBy); - Move(fRowLengths[aStart], fRowLengths[aStart + aMoveBy], - vMoveCount * SizeOf(TRowLength)); -end; - -procedure TSynWordWrapPlugin.Reset; -begin - Assert(Editor.CharsInWindow >= 0); - - fMaxRowLength := Editor.CharsInWindow; - fMinRowLength := Editor.CharsInWindow - (Editor.CharsInWindow div 3); - - if fMinRowLength <= 0 then - fMinRowLength := 1; - - WrapLines; -end; - -function TSynWordWrapPlugin.ReWrapLine(aIndex: TLineIndex): integer; -// Returns RowCount delta (how many wrapped lines were added or removed by this change). -var - vMaxNewRows: Cardinal; - vLine: string; - vLineRowCount: Integer; //numbers of rows parsed in this line - vTempRowLengths: PRowLengthArray; - vRowBegin: PWideChar; - vLineEnd: PWideChar; - vRowEnd: PWideChar; - vRunner: PWideChar; - vRowMinEnd: PWideChar; - vLastVisibleChar: PWideChar; - - vStartRow: Integer; // first row of the line - vOldNextRow: Integer; // first row of the next line, before the change - cLine: Integer; - - p : PRowIndexArray; -begin - // ****** First parse the new string using an auxiliar array ***** - vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[aIndex]; - vLine := Editor.ExpandAtWideGlyphs(vLine); - // Pre-allocate a buffer for rowlengths - at least one row - vMaxNewRows := Max(((Length(vLine) - 1) div fMinRowLength) + 1, 1); - vTempRowLengths := AllocMem(vMaxNewRows * SizeOf(TRowLength)); - try - vLineRowCount := 0; - vRowBegin := PWideChar(vLine); - vRowEnd := vRowBegin + fMaxRowLength; - vLineEnd := vRowBegin + Length(vLine); - while vRowEnd < vLineEnd do - begin - vRowMinEnd := vRowBegin + fMinRowLength; - vRunner := vRowEnd - 1; - while vRunner > vRowMinEnd do - begin - if Editor.IsWordBreakChar(vRunner^) then - begin - vRowEnd := vRunner + 1; - break; - end; - Dec(vRunner); - end; - // do not cut wide glyphs in half - if vRowEnd > vRowBegin then - begin - vLastVisibleChar := vRowEnd - 1; - while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do - dec(vLastVisibleChar); - vRowEnd := vLastVisibleChar + 1; - end; - - // Finally store the rowlength - vTempRowLengths[vLineRowCount] := vRowEnd - vRowBegin; - - Inc(vLineRowCount); - vRowBegin := vRowEnd; - Inc(vRowEnd, fMaxRowLength); - end; //endwhile vRowEnd < vLineEnd - if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then - begin - vTempRowLengths[vLineRowCount] := vLineEnd - vRowBegin; - Inc(vLineRowCount); - end; - - // ****** Then updates the main arrays ****** - if aIndex = 0 then - vStartRow := 0 - else - vStartRow := fLineOffsets[aIndex - 1]; - vOldNextRow := fLineOffsets[aIndex]; - Result := vLineRowCount - (vOldNextRow - vStartRow); - if Result <> 0 then - begin - // MoveRows depends on RowCount, so we need some special processing... - if Result > 0 then - begin - // ...if growing, update offsets (and thus RowCount) before rowlengths - GrowRows(RowCount + Result); - if Result = 1 then begin - // EG: this makes Schlemiel run twice as fast, but doesn't solve - // the algorithmic issue if someone can spend some time looking - // at the big picture... there are huge speedups to be made by - // eliminating this loop - p:=fLineOffsets; - for cLine := aIndex to LineCount - 1 do - Inc(p[cLine]) - end else begin - p:=fLineOffsets; - for cLine := aIndex to LineCount - 1 do - Inc(p[cLine], Result); - end; - if vOldNextRow < RowCount - Result then - MoveRows(vOldNextRow, Result); - end - else - begin - // ...if shrinking, update offsets after rowlengths - if vOldNextRow < RowCount then - MoveRows(vOldNextRow, Result); - for cLine := aIndex to LineCount - 1 do - Inc(fLineOffsets[cLine], Result); - end; - end; - Move(vTempRowLengths[0], fRowLengths[vStartRow], vLineRowCount * SizeOf(TRowLength)); - finally - FreeMem(vTempRowLengths); - end; -end; - -procedure TSynWordWrapPlugin.WrapLines; -var - cRow: Integer; - cLine: Integer; - vLine: string; - vMaxNewRows: Integer; - vRowBegin: PWideChar; - vLineEnd: PWideChar; - vRowEnd: PWideChar; - vRunner: PWideChar; - vRowMinEnd: PWideChar; - vLastVisibleChar: PWideChar; -begin - if (Editor.Lines.Count = 0) or (fMaxRowLength <= 0) then - begin - SetEmpty; - Exit; - end; - - GrowLines(Editor.Lines.Count); - GrowRows(Editor.Lines.Count); - - cRow := 0; - for cLine := 0 to Editor.Lines.Count - 1 do - begin - vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[cLine]; - vLine := Editor.ExpandAtWideGlyphs(vLine); - - vMaxNewRows := ((Length(vLine) - 1) div fMinRowLength) + 1; - GrowRows(cRow + vMaxNewRows); - - vRowBegin := PWideChar(vLine); - vRowEnd := vRowBegin + fMaxRowLength; - vLineEnd := vRowBegin + Length(vLine); - while vRowEnd < vLineEnd do - begin - vRowMinEnd := vRowBegin + fMinRowLength; - vRunner := vRowEnd - 1; - while vRunner > vRowMinEnd do - begin - if Editor.IsWordBreakChar(vRunner^) then - begin - vRowEnd := vRunner + 1; - break; - end; - Dec(vRunner); - end; - // do not cut wide glyphs in half - if vRowEnd > vRowBegin then - begin - vLastVisibleChar := vRowEnd - 1; - while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do - dec(vLastVisibleChar); - vRowEnd := vLastVisibleChar + 1; - end; - - fRowLengths[cRow] := vRowEnd - vRowBegin; - - Inc(cRow); - vRowBegin := vRowEnd; - Inc(vRowEnd, fMaxRowLength); - end; - if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then - begin - fRowLengths[cRow] := vLineEnd - vRowBegin; - Inc(cRow); - end; - fLineOffsets[cLine] := cRow; - end; - fLineCount := Editor.Lines.Count; -end; - -function TSynWordWrapPlugin.RowCount: integer; -begin - if LineCount > 0 then - Result := fLineOffsets[LineCount - 1] - else - Result := 0; -end; - -procedure TSynWordWrapPlugin.SetEmpty; -begin - fLineCount := 0; - // free unsused memory - TrimArrays; -end; - -procedure TSynWordWrapPlugin.TrimArrays; -begin - ReallocMem(fLineOffsets, LineCount * SizeOf(TRowIndex)); - fLineCapacity := LineCount; - ReallocMem(fRowLengths, RowCount * SizeOf(TRowLength)); - fRowCapacity := RowCount; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is SynEditWordWrap.pas by Flávio Etrusco, released 2003-12-11. +Unicode translation by Maël Hörz. +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: SynEditWordWrap.pas,v 1.8.2.6 2008/09/14 16:24:59 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +//todo: Use a single implementation of ReWrapLines that takes starting line and number of lines to rewrap +//todo: Tweak code to try finding better wrapping points. Some support by the highlighters will be needed, probably. +//todo: Document the code +//todo: The length of the last Row of a Line could be calculated from the Line length instead of being stored. This would be only useful when most of the lines aren't wrapped. + +{$IFNDEF QSYNEDITWORDWRAP} +unit SynEditWordWrap; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + SynEditTypes, + SynEditTextBuffer, + SynEdit, + SysUtils, + Classes; + +var + // Accumulate/hide whitespace at EOL (at end of wrapped rows, actually) + OldWhitespaceBehaviour: Boolean = False; + +const + MaxIndex = MaxInt div 16; + +type + TLineIndex = 0..MaxIndex; + TRowIndex = 0..MaxIndex; + TRowLength = Word; + + TRowIndexArray = array [TLineIndex] of TRowIndex; + PRowIndexArray = ^TRowIndexArray; + + TRowLengthArray = array [TRowIndex] of TRowLength; + PRowLengthArray = ^TRowLengthArray; + + {$IFNDEF SYN_COMPILER_4_UP} + TSysCharSet = set of Char; + {$ENDIF} + + // For clarity, I'll refer to buffer coordinates as 'Line' and + // 'Char' and to display (wrapped) coordinates as 'Row' and 'Column'. + + // FLineOffsets[n] is the index of the first row of the [n+1]th line. + // e.g. Starting row of first line (0) is 0. Starting row of second line (1) + // is FLineOffsets[0]. Clear? + + TSynWordWrapPlugin = class(TInterfacedObject, ISynEditBufferPlugin) + private + FLineOffsets: PRowIndexArray; + FRowLengths: PRowLengthArray; + FLineCapacity: Integer; + FRowCapacity: Integer; + FLineCount: Integer; + + FEditor: TCustomSynEdit; + FMinRowLength: TRowLength; + FMaxRowLength: TRowLength; + procedure GrowLines(aMinSize: Integer); + procedure MoveLines(aStart: TLineIndex; aMoveBy: Integer); + procedure GrowRows(aMinSize: Integer); + procedure MoveRows(aStart: TRowIndex; aMoveBy: Integer); + procedure SetEmpty; + protected + procedure WrapLines; + function ReWrapLine(aIndex: TLineIndex): Integer; + procedure TrimArrays; + property LineOffsets: PRowIndexArray read FLineOffsets; + property RowLengths: PRowLengthArray read FRowLengths; + property Editor: TCustomSynEdit read FEditor; + public + constructor Create(aOwner: TCustomSynEdit); + destructor Destroy; override; + property LineCount: Integer read FLineCount; + { ISynEditBufferPlugin } + function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; + function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; + function RowCount: Integer; + function GetRowLength(aRow: Integer): Integer; + function LinesInserted(aIndex: Integer; aCount: Integer): Integer; + function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; + function LinesPutted(aIndex: Integer; aCount: Integer): Integer; + procedure Reset; + procedure DisplayChanged; + end; + +implementation + +uses + SynUnicode, +{$IFDEF SYN_COMPILER_6_UP} + RTLConsts, +{$ELSE} + Consts, +{$ENDIF} +{$IFNDEF SYN_COMPILER_4_UP} + SynEditMiscProcs, +{$ENDIF} + Math; + +{ TSynWordWrapPlugin } + +function TSynWordWrapPlugin.BufferToDisplayPos( + const aPos: TBufferCoord): TDisplayCoord; +var + vStartRow: Integer; // first row of the line + cRow: Integer; + vRowLen: Integer; +begin + Assert(aPos.Char > 0); + Assert(aPos.Line > 0); + if LineCount < aPos.Line then + begin + // beyond EOF + Result.Column := aPos.Char; + Result.Row := RowCount + (aPos.Line - LineCount); + Exit; + end; + if aPos.Line = 1 then + vStartRow := 0 + else + vStartRow := FLineOffsets[aPos.Line - 2]; + vRowLen := 0; + for cRow := vStartRow to FLineOffsets[aPos.Line - 1] - 1 do + begin + Inc(vRowLen, FRowLengths[cRow]); + if aPos.Char <= vRowLen then + begin + Result.Column := aPos.Char - vRowLen + FRowLengths[cRow]; + Result.Row := cRow + 1; + Exit; + end; + end; + // beyond EOL + Result.Column := aPos.Char - vRowLen + FRowLengths[FLineOffsets[aPos.Line - 1] - 1]; + Result.Row := FLineOffsets[aPos.Line - 1]; +end; + +constructor TSynWordWrapPlugin.Create(aOwner: TCustomSynEdit); +begin + inherited Create; // just to work as reminder in case I revert it to a TComponent... + if aOwner = nil then + raise Exception.Create( 'Owner of TSynWordWrapPlugin must be a TCustomSynEdit' ); + FEditor := aOwner; + Reset; +end; + +destructor TSynWordWrapPlugin.Destroy; +begin + inherited; + FreeMem(FLineOffsets); + FreeMem(FRowLengths); +end; + +procedure TSynWordWrapPlugin.DisplayChanged; +begin + if Editor.CharsInWindow <> FMaxRowLength then + Reset; +end; + +function TSynWordWrapPlugin.DisplayToBufferPos( + const aPos: TDisplayCoord): TBufferCoord; +var + cLine: Integer; + cRow: Integer; +begin + Assert(aPos.Column > 0); + Assert(aPos.Row > 0); + if aPos.Row > RowCount then + begin + // beyond EOF + Result.Char := aPos.Column; + Result.Line := aPos.Row - RowCount + LineCount; + Exit; + end; + //todo: use a binary search or something smarter + for cLine := LineCount - 2 downto 0 do + if aPos.Row > FLineOffsets[cLine] then + begin + Result.Line := cLine + 2; + if aPos.Row = FLineOffsets[cLine + 1] then //last row of line + Result.Char := Min(aPos.Column, FMaxRowLength + 1) + else + Result.Char := Min(aPos.Column, FRowLengths[aPos.Row - 1] + 1); + for cRow := FLineOffsets[cLine] to aPos.Row - 2 do + Inc(Result.Char, FRowLengths[cRow]); + Exit; + end; + // first line + Result.Line := 1; + if aPos.Row = FLineOffsets[0] then //last row of line + Result.Char := Min(aPos.Column, FMaxRowLength + 1) + else + Result.Char := Min(aPos.Column, FRowLengths[aPos.Row - 1] + 1); + for cRow := 0 to aPos.Row - 2 do + Inc(Result.Char, FRowLengths[cRow]); +end; + +function TSynWordWrapPlugin.GetRowLength(aRow: Integer): Integer; +// aRow is 1-based... +begin + if (aRow <= 0) or (aRow > RowCount) then + TList.Error(SListIndexError, aRow); + Result := FRowLengths[aRow - 1]; +end; + +procedure TSynWordWrapPlugin.GrowLines(aMinSize: Integer); +const + vStepSize = 256; +begin + Assert(aMinSize > 0); + if aMinSize > FLineCapacity then + begin + aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); + ReallocMem(FLineOffsets, aMinSize * SizeOf(TRowIndex)); + FLineCapacity := aMinSize; + end; +end; + +procedure TSynWordWrapPlugin.GrowRows(aMinSize: Integer); +const + vStepSize = 512; +begin + Assert(aMinSize > 0); + if aMinSize > FRowCapacity then + begin + aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); + ReallocMem(FRowLengths, aMinSize * SizeOf(TRowLength)); + FRowCapacity := aMinSize; + end; +end; + +function TSynWordWrapPlugin.LinesDeleted(aIndex: Integer; aCount: Integer): Integer; +var + vStartRow: Integer; + vEndRow: Integer; + cLine: Integer; +begin + if FMaxRowLength = 0 then + begin + Result := 0; + Exit; + end; + Assert(aIndex >= 0); + Assert(aCount >= 1); + Assert(aIndex + aCount <= LineCount); + + if aIndex = 0 then + vStartRow := 0 + else + vStartRow := FLineOffsets[aIndex - 1]; + vEndRow := FLineOffsets[aIndex + aCount - 1]; + Result := vEndRow - vStartRow; + // resize FRowLengths + if vEndRow < RowCount then + MoveRows(vEndRow, -Result); + // resize FLineOffsets + MoveLines(aIndex + aCount, -aCount); + Dec(FLineCount, aCount); + // update offsets + for cLine := aIndex to LineCount - 1 do + Dec(FLineOffsets[cLine], Result); +end; + +function TSynWordWrapPlugin.LinesInserted(aIndex: Integer; aCount: Integer): Integer; +var + vPrevOffset: TRowIndex; + cLine: Integer; +begin + if FMaxRowLength = 0 then + begin + Result := 0; + Exit; + end; + Assert(aIndex >= 0); + Assert(aCount >= 1); + Assert(aIndex <= LineCount); + // resize FLineOffsets + GrowLines(LineCount + aCount); + if aIndex < LineCount then // no need for MoveLines if inserting at LineCount (TSynEditStringList.Add) + begin + Inc(FLineCount, aCount); // FLineCount must be updated before calling MoveLines() + MoveLines(aIndex, aCount); + end + else + Inc(FLineCount, aCount); + // set offset to same as previous line (i.e. the line has 0 rows) + if aIndex = 0 then + vPrevOffset := 0 + else + vPrevOffset := FLineOffsets[aIndex - 1]; + for cLine := aIndex to aIndex + aCount - 1 do + FLineOffsets[cLine] := vPrevOffset; + // Rewrap + Result := 0; + for cLine := aIndex to aIndex + aCount - 1 do + Inc(Result, ReWrapLine(cLine)); +end; + +function TSynWordWrapPlugin.LinesPutted(aIndex: Integer; aCount: Integer): Integer; +var + cLine: Integer; +begin + if FMaxRowLength = 0 then + begin + Result := 0; + Exit; + end; + Assert(aIndex >= 0); + Assert(aCount >= 1); + Assert(aIndex + aCount <= LineCount); + // Rewrap + Result := 0; + for cLine := aIndex to aIndex + aCount - 1 do + Inc(Result, ReWrapLine(cLine)); +end; + +procedure TSynWordWrapPlugin.MoveLines(aStart: TLineIndex; aMoveBy: Integer); +var + vMoveCount: Integer; +begin + Assert(aMoveBy <> 0); + Assert(aStart + aMoveBy >= 0); + Assert(aStart + aMoveBy < LineCount); + vMoveCount := LineCount - aStart; + if aMoveBy > 0 then + Dec(vMoveCount, aMoveBy); + Move(FLineOffsets[aStart], FLineOffsets[aStart + aMoveBy], + vMoveCount * SizeOf(TRowIndex)); +end; + +procedure TSynWordWrapPlugin.MoveRows(aStart: TRowIndex; aMoveBy: Integer); +var + vMoveCount: Integer; +begin + Assert(aMoveBy <> 0); + Assert(aStart + aMoveBy >= 0); + Assert(aStart + aMoveBy < RowCount); + vMoveCount := RowCount - aStart; + if aMoveBy > 0 then + Dec(vMoveCount, aMoveBy); + Move(FRowLengths[aStart], FRowLengths[aStart + aMoveBy], + vMoveCount * SizeOf(TRowLength)); +end; + +procedure TSynWordWrapPlugin.Reset; +begin + Assert(Editor.CharsInWindow >= 0); + + FMaxRowLength := Min(Editor.MaxScrollWidth, Editor.CharsInWindow); // see github issue #129 + FMinRowLength := Editor.CharsInWindow - (Editor.CharsInWindow div 3); + + if FMinRowLength <= 0 then + FMinRowLength := 1; + + WrapLines; +end; + +function TSynWordWrapPlugin.ReWrapLine(aIndex: TLineIndex): Integer; +// Returns RowCount delta (how many wrapped lines were added or removed by this change). +var + vMaxNewRows: Cardinal; + vLine: UnicodeString; + vLineRowCount: Integer; //numbers of rows parsed in this line + vTempRowLengths: PRowLengthArray; + vRowBegin: PWideChar; + vLineEnd: PWideChar; + vRowEnd: PWideChar; + vRunner: PWideChar; + vRowMinEnd: PWideChar; + vLastVisibleChar: PWideChar; + + vStartRow: Integer; // first row of the line + vOldNextRow: Integer; // first row of the next line, before the change + cLine: Integer; + + p : PRowIndexArray; +begin + // ****** First parse the new string using an auxiliar array ***** + vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[aIndex]; + vLine := Editor.ExpandAtWideGlyphs(vLine); + // Pre-allocate a buffer for rowlengths + vMaxNewRows := ((Length(vLine) - 1) div FMinRowLength) + 1; + vTempRowLengths := AllocMem(vMaxNewRows * SizeOf(TRowLength)); + try + vLineRowCount := 0; + vRowBegin := PWideChar(vLine); + vRowEnd := vRowBegin + FMaxRowLength; + vLineEnd := vRowBegin + Length(vLine); + while vRowEnd < vLineEnd do + begin + if OldWhitespaceBehaviour and CharInSet(vRowEnd^, [#32, #9]) then + begin + repeat + Inc(vRowEnd); + until not CharInSet(vRowEnd^, [#32, #9]); + end + else + begin + vRowMinEnd := vRowBegin + FMinRowLength; + vRunner := vRowEnd; + while vRunner > vRowMinEnd do + begin + if Editor.IsWordBreakChar(vRunner^) then + begin + vRowEnd := vRunner; + Break; + end; + Dec(vRunner); + end; + end; + // Check TRowLength overflow + if OldWhitespaceBehaviour and (vRowEnd - vRowBegin > High(TRowLength)) then + begin + vRowEnd := vRowBegin + High(TRowLength); + vRowMinEnd := vRowEnd - (High(TRowLength) mod Editor.TabWidth); + while (vRowEnd^ = #9) and (vRowEnd > vRowMinEnd) do + Dec(vRowEnd); + end; + + // do not cut wide glyphs in half + if vRowEnd > vRowBegin then + begin + vLastVisibleChar := vRowEnd - 1; + while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do + Dec(vLastVisibleChar); + vRowEnd := vLastVisibleChar + 1; + end; + + // Finally store the rowlength + vTempRowLengths[vLineRowCount] := vRowEnd - vRowBegin; + + Inc(vLineRowCount); + vRowBegin := vRowEnd; + Inc(vRowEnd, FMaxRowLength); + end; //endwhile vRowEnd < vLineEnd + if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then + begin + vTempRowLengths[vLineRowCount] := vLineEnd - vRowBegin; + Inc(vLineRowCount); + end; + + // ****** Then updates the main arrays ****** + if aIndex = 0 then + vStartRow := 0 + else + vStartRow := FLineOffsets[aIndex - 1]; + vOldNextRow := FLineOffsets[aIndex]; + Result := vLineRowCount - (vOldNextRow - vStartRow); + if Result <> 0 then + begin + // MoveRows depends on RowCount, so we need some special processing... + if Result > 0 then + begin + // ...if growing, update offsets (and thus RowCount) before rowlengths + GrowRows(RowCount + Result); + if Result = 1 then begin + // EG: this makes Schlemiel run twice as fast, but doesn't solve + // the algorithmic issue if someone can spend some time looking + // at the big picture... there are huge speedups to be made by + // eliminating this loop + p:=FLineOffsets; + for cLine := aIndex to LineCount - 1 do + Inc(p[cLine]) + end else begin + p:=FLineOffsets; + for cLine := aIndex to LineCount - 1 do + Inc(p[cLine], Result); + end; + if vOldNextRow < RowCount - Result then + MoveRows(vOldNextRow, Result); + end + else + begin + // ...if shrinking, update offsets after rowlengths + if vOldNextRow < RowCount then + MoveRows(vOldNextRow, Result); + for cLine := aIndex to LineCount - 1 do + Inc(FLineOffsets[cLine], Result); + end; + end; + Move(vTempRowLengths[0], FRowLengths[vStartRow], vLineRowCount * SizeOf(TRowLength)); + finally + FreeMem(vTempRowLengths); + end; +end; + +procedure TSynWordWrapPlugin.WrapLines; +var + cRow: Integer; + cLine: Integer; + vLine: UnicodeString; + vMaxNewRows: Integer; + vRowBegin: PWideChar; + vLineEnd: PWideChar; + vRowEnd: PWideChar; + vRunner: PWideChar; + vRowMinEnd: PWideChar; + vLastVisibleChar: PWideChar; +begin + if (Editor.Lines.Count = 0) or (FMaxRowLength <= 0) then + begin + SetEmpty; + Exit; + end; + + GrowLines(Editor.Lines.Count); + GrowRows(Editor.Lines.Count); + + cRow := 0; + for cLine := 0 to Editor.Lines.Count - 1 do + begin + vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[cLine]; + vLine := Editor.ExpandAtWideGlyphs(vLine); + + vMaxNewRows := ((Length(vLine) - 1) div FMinRowLength) + 1; + GrowRows(cRow + vMaxNewRows); + + vRowBegin := PWideChar(vLine); + vRowEnd := vRowBegin + FMaxRowLength; + vLineEnd := vRowBegin + Length(vLine); + while vRowEnd < vLineEnd do + begin + if OldWhitespaceBehaviour and CharInSet(vRowEnd^, [#32, #9]) then + begin + repeat + Inc(vRowEnd); + until not CharInSet(vRowEnd^, [#32, #9]); + end + else + begin + vRowMinEnd := vRowBegin + FMinRowLength; + vRunner := vRowEnd; + while vRunner > vRowMinEnd do + begin + if Editor.IsWordBreakChar(vRunner^) then + begin + vRowEnd := vRunner; + Break; + end; + Dec(vRunner); + end; + end; + + if OldWhitespaceBehaviour and (vRowEnd - vRowBegin > High(TRowLength)) then + begin + vRowEnd := vRowBegin + High(TRowLength); + vRowMinEnd := vRowEnd - (High(TRowLength) mod Editor.TabWidth); + while (vRowEnd^ = #9) and (vRowEnd > vRowMinEnd) do + Dec(vRowEnd); + end; + + // do not cut wide glyphs in half + if vRowEnd > vRowBegin then + begin + vLastVisibleChar := vRowEnd - 1; + while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do + Dec(vLastVisibleChar); + vRowEnd := vLastVisibleChar + 1; + end; + + FRowLengths[cRow] := vRowEnd - vRowBegin; + + Inc(cRow); + vRowBegin := vRowEnd; + Inc(vRowEnd, FMaxRowLength); + end; + if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then + begin + FRowLengths[cRow] := vLineEnd - vRowBegin; + Inc(cRow); + end; + FLineOffsets[cLine] := cRow; + end; + FLineCount := Editor.Lines.Count; +end; + +function TSynWordWrapPlugin.RowCount: Integer; +begin + if LineCount > 0 then + Result := FLineOffsets[LineCount - 1] + else + Result := 0; +end; + +procedure TSynWordWrapPlugin.SetEmpty; +begin + FLineCount := 0; + // free unsused memory + TrimArrays; +end; + +procedure TSynWordWrapPlugin.TrimArrays; +begin + ReallocMem(FLineOffsets, LineCount * SizeOf(TRowIndex)); + FLineCapacity := LineCount; + ReallocMem(FRowLengths, RowCount * SizeOf(TRowLength)); + FRowCapacity := RowCount; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynExportHTML.pas b/Source/VCL/SynEdit/Source/SynExportHTML.pas index 71ab5431..8f95a39f 100644 --- a/Source/VCL/SynEdit/Source/SynExportHTML.pas +++ b/Source/VCL/SynEdit/Source/SynExportHTML.pas @@ -1,353 +1,356 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynExportHTML.pas, released 2000-04-16. - -The Original Code is partly based on the mwHTMLExport.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Portions created by Michael Hieke are Copyright 2000 Michael Hieke. -Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg. -Changes to emit XHTML 1.0 Strict complying code by Maël Hörz. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynExportHTML.pas,v 1.19.2.7 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynExportHTML; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditExport, - SynEditHighlighter, - SynUnicode, - Classes; - -type - TSynExporterHTML = class(TSynCustomExporter) - private - function AttriToCSS(Attri: TSynHighlighterAttributes; - UniqueAttriName: string): string; - function AttriToCSSCallback(Highlighter: TSynCustomHighlighter; - Attri: TSynHighlighterAttributes; UniqueAttriName: string; - Params: array of Pointer): Boolean; - function ColorToHTML(AColor: TColor): string; - function GetStyleName(Highlighter: TSynCustomHighlighter; - Attri: TSynHighlighterAttributes): string; - function MakeValidName(Name: string): string; - function StyleNameCallback(Highlighter: TSynCustomHighlighter; - Attri: TSynHighlighterAttributes; UniqueAttriName: string; - Params: array of Pointer): Boolean; - protected - fCreateHTMLFragment: boolean; - procedure FormatAfterLastAttribute; override; - procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: boolean; - FontStylesChanged: TFontStyles); override; - procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: boolean; - FontStylesChanged: TFontStyles); override; - procedure FormatBeforeFirstAttribute(BackgroundChanged, - ForegroundChanged: boolean; FontStylesChanged: TFontStyles); override; - procedure FormatNewLine; override; - function GetFooter: string; override; - function GetFormatName: string; override; - function GetHeader: string; override; - function ReplaceReservedChar(AChar: WideChar): string; override; - function UseBom: Boolean; override; - public - constructor Create(AOwner: TComponent); override; - function SupportedEncodings: TSynEncodings; override; - published - property Color; - property CreateHTMLFragment: boolean read fCreateHTMLFragment - write fCreateHTMLFragment default False; - property DefaultFilter; - property Encoding; - property Font; - property Highlighter; - property Title; - property UseBackground; - end; - -implementation - -uses - SynEditMiscProcs, - SynEditStrConst, - SynHighlighterMulti, - SysUtils; - -{ TSynExporterHTML } - -constructor TSynExporterHTML.Create(AOwner: TComponent); -const - CF_HTML = 'HTML Format'; -begin - inherited Create(AOwner); - fClipboardFormat := RegisterClipboardFormat(CF_HTML); - fDefaultFilter := SYNS_FilterHTML; - FEncoding := seUTF8; -end; - -function TSynExporterHTML.AttriToCSS(Attri: TSynHighlighterAttributes; - UniqueAttriName: string): string; -var - StyleName: string; -begin - StyleName := MakeValidName(UniqueAttriName); - - Result := '.' + StyleName + ' { '; - if UseBackground and (Attri.Background <> clNone) then - Result := Result + 'background-color: ' + ColorToHTML(Attri.Background) + '; '; - if Attri.Foreground <> clNone then - Result := Result + 'color: ' + ColorToHTML(Attri.Foreground) + '; '; - - if fsBold in Attri.Style then - Result := Result + 'font-weight: bold; '; - if fsItalic in Attri.Style then - Result := Result + 'font-style: italic; '; - if fsUnderline in Attri.Style then - Result := Result + 'text-decoration: underline; '; - if fsStrikeOut in Attri.Style then - Result := Result + 'text-decoration: line-through; '; - - Result := Result + '}'; -end; - -function TSynExporterHTML.AttriToCSSCallback(Highlighter: TSynCustomHighlighter; - Attri: TSynHighlighterAttributes; UniqueAttriName: string; - Params: array of Pointer): Boolean; -var - Styles: ^string; -begin - Styles := Params[0]; - Styles^ := Styles^ + AttriToCSS(Attri, UniqueAttriName) + #13#10; - Result := True; // we want all attributes => tell EnumHighlighterAttris to continue -end; - -function TSynExporterHTML.ColorToHTML(AColor: TColor): string; -var - RGBColor: Integer; - RGBValue: byte; -const - Digits: array[0..15] of Char = '0123456789ABCDEF'; -begin - RGBColor := ColorToRGB(AColor); - Result := '#000000'; - RGBValue := GetRValue(RGBColor); - if RGBValue > 0 then - begin - Result[2] := Digits[RGBValue shr 4]; - Result[3] := Digits[RGBValue and 15]; - end; - RGBValue := GetGValue(RGBColor); - if RGBValue > 0 then - begin - Result[4] := Digits[RGBValue shr 4]; - Result[5] := Digits[RGBValue and 15]; - end; - RGBValue := GetBValue(RGBColor); - if RGBValue > 0 then - begin - Result[6] := Digits[RGBValue shr 4]; - Result[7] := Digits[RGBValue and 15]; - end; -end; - -procedure TSynExporterHTML.FormatAfterLastAttribute; -begin - AddData(''); -end; - -procedure TSynExporterHTML.FormatAttributeDone(BackgroundChanged, - ForegroundChanged: boolean; FontStylesChanged: TFontStyles); -begin - AddData(''); -end; - -procedure TSynExporterHTML.FormatAttributeInit(BackgroundChanged, - ForegroundChanged: boolean; FontStylesChanged: TFontStyles); -var - StyleName: string; -begin - StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute); - AddData(Format('', [StyleName])); -end; - -procedure TSynExporterHTML.FormatBeforeFirstAttribute(BackgroundChanged, - ForegroundChanged: boolean; FontStylesChanged: TFontStyles); -var - StyleName: string; -begin - StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute); - AddData(Format('', [StyleName])); -end; - -procedure TSynExporterHTML.FormatNewLine; -begin - AddNewLine; -end; - -function TSynExporterHTML.GetFooter: string; -begin - Result := ''; - if fExportAsText then - Result := ''#13#10''#13#10 - else - Result := ''; - if not(fCreateHTMLFragment and fExportAsText) then - Result := Result + ''#13#10''; -end; - -function TSynExporterHTML.GetFormatName: string; -begin - Result := SYNS_ExporterFormatHTML; -end; - -function TSynExporterHTML.GetHeader: string; -const - DescriptionSize = 105; - FooterSize1 = 47; - FooterSize2 = 31; - NativeHeader = 'Version:0.9'#13#10 + - 'StartHTML:%.10d'#13#10 + - 'EndHTML:%.10d'#13#10 + - 'StartFragment:%.10d'#13#10 + - 'EndFragment:%.10d'#13#10; - HTMLAsTextHeader = ''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10; - HTMLAsTextHeader2 =''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10; - EncodingStrs: array[TSynEncoding] of string = - ('UTF-8', 'UTF-16', 'UTF-16', 'ANSI is Unsupported'); -var - EncodingStr, Styles, Header, Header2: string; -begin - EncodingStr := EncodingStrs[Encoding]; - EnumHighlighterAttris(Highlighter, True, AttriToCSSCallback, [@Styles]); - - Header := Format(HTMLAsTextHeader, [EncodingStr]); - Header := Header + '' + Title + ''#13#10 + - Format(HTMLAsTextHeader2, [EncodingStr, ColorToHtml(fFont.Color), - ColorToHTML(fBackgroundColor), Styles]); - - Result := ''; - if fExportAsText then - begin - if not fCreateHTMLFragment then - Result := Header; - - Result := Result + Format('
'#13#10'',
-      [fFont.Size, fFont.Name]);
-  end
-  else
-  begin
-    // Described in http://msdn.microsoft.com/library/sdkdoc/htmlclip/htmlclipboard.htm
-    Header2 := '
';
-    Result := Format(NativeHeader, [DescriptionSize,
-      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize1,
-      DescriptionSize + Length(Header),
-      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize2]);
-    Result := Result + Header + Header2;
-  end;
-end;
-
-function TSynExporterHTML.GetStyleName(Highlighter: TSynCustomHighlighter;
-  Attri: TSynHighlighterAttributes): string;
-begin
-  EnumHighlighterAttris(Highlighter, False, StyleNameCallback, [Attri, @Result]);
-end;
-
-function TSynExporterHTML.MakeValidName(Name: string): string;
-var
-  i: Integer;
-begin
-  Result := LowerCase(Name);
-  for i := Length(Result) downto 1 do
-    if CharInSet(Result[i], ['.', '_']) then
-      Result[i] := '-'
-    else if not CharInSet(Result[i], ['a'..'z', '0'..'9', '-']) then
-      Delete(Result, i, 1);
-end;
-
-function TSynExporterHTML.ReplaceReservedChar(AChar: WideChar): string;
-begin
-  case AChar of
-    '&': Result := '&';
-    '<': Result := '<';
-    '>': Result := '>';
-    '"': Result := '"';
-    else Result := '';
-  end
-end;
-
-function TSynExporterHTML.StyleNameCallback(Highlighter: TSynCustomHighlighter;
-    Attri: TSynHighlighterAttributes; UniqueAttriName: string;
-    Params: array of Pointer): Boolean;
-var
-  AttriToFind: TSynHighlighterAttributes;
-  StyleName: ^string;
-begin
-  AttriToFind := Params[0];
-  StyleName := Params[1];
-
-  if Attri = AttriToFind then
-  begin
-    StyleName^ := MakeValidName(UniqueAttriName);
-    Result := False; // found => inform EnumHighlighterAttris to stop searching
-  end
-  else
-    Result := True;
-end;
-
-function TSynExporterHTML.UseBom: Boolean;
-begin
-  // do not include seUTF8 as some browsers have problems with UTF-8-BOM
-  Result := Encoding in [seUTF16LE, seUTF16BE];
-end;
-
-function TSynExporterHTML.SupportedEncodings: TSynEncodings;
-begin
-  Result := [seUTF8, seUTF16LE, seUTF16BE];
-end;
-
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynExportHTML.pas, released 2000-04-16.
+
+The Original Code is partly based on the mwHTMLExport.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Michael Hieke.
+Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
+Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg.
+Changes to emit XHTML 1.0 Strict complying code by Maël Hörz.
+Unicode translation by Maël Hörz.
+All Rights Reserved.
+
+Contributors to the SynEdit project 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: SynExportHTML.pas,v 1.19.2.7 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+
+{$IFNDEF QSYNEXPORTHTML}
+unit SynExportHTML;
+{$ENDIF}
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  SynEditExport,
+  SynEditHighlighter,
+  SynUnicode,
+  Classes;
+
+type
+  TSynExporterHTML = class(TSynCustomExporter)
+  private
+    function AttriToCSS(Attri: TSynHighlighterAttributes;
+      UniqueAttriName: string): string;
+    function AttriToCSSCallback(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+      Params: array of Pointer): Boolean;
+    function ColorToHTML(AColor: TColor): string;
+    function GetStyleName(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes): string;
+    function MakeValidName(Name: string): string;
+    function StyleNameCallback(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+      Params: array of Pointer): Boolean;
+  protected
+    FCreateHTMLFragment: Boolean;
+    procedure FormatAfterLastAttribute; override;
+    procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean;
+      FontStylesChanged: TFontStyles); override;
+    procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean;
+      FontStylesChanged: TFontStyles); override;
+    procedure FormatBeforeFirstAttribute(BackgroundChanged,
+      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
+    procedure FormatNewLine; override;
+    function GetFooter: UnicodeString; override;
+    function GetFormatName: string; override;
+    function GetHeader: UnicodeString; override;
+    function ReplaceReservedChar(AChar: WideChar): UnicodeString; override;
+    function UseBom: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function SupportedEncodings: TSynEncodings; override;
+  published
+    property Color;
+    property CreateHTMLFragment: Boolean read FCreateHTMLFragment
+      write FCreateHTMLFragment default False;
+    property DefaultFilter;
+    property Encoding;
+    property Font;
+    property Highlighter;
+    property Title;
+    property UseBackground;
+  end;
+
+implementation
+
+uses
+  SynEditMiscProcs,
+  SynEditStrConst,
+  SynHighlighterMulti,
+  SysUtils;
+
+
+{ TSynExporterHTML }
+
+constructor TSynExporterHTML.Create(AOwner: TComponent);
+const
+  CF_HTML = 'HTML Format';
+begin
+  inherited Create(AOwner);
+  FClipboardFormat := RegisterClipboardFormat(CF_HTML);
+  FDefaultFilter := SYNS_FilterHTML;
+  FEncoding := seUTF8;
+end;
+
+function TSynExporterHTML.AttriToCSS(Attri: TSynHighlighterAttributes;
+  UniqueAttriName: string): string;
+var
+  StyleName: string;
+begin
+  StyleName := MakeValidName(UniqueAttriName);
+
+  Result := '.' + StyleName + ' { ';
+  if UseBackground and (Attri.Background <> clNone) then
+    Result := Result + 'background-color: ' + ColorToHTML(Attri.Background) + '; ';
+  if Attri.Foreground <> clNone then
+    Result := Result + 'color: ' + ColorToHTML(Attri.Foreground) + '; ';
+
+  if fsBold in Attri.Style then
+    Result := Result + 'font-weight: bold; ';
+  if fsItalic in Attri.Style then
+    Result := Result + 'font-style: italic; ';
+  if fsUnderline in Attri.Style then
+    Result := Result + 'text-decoration: underline; ';
+  if fsStrikeOut in Attri.Style then
+    Result := Result + 'text-decoration: line-through; ';
+
+  Result := Result + '}';
+end;
+
+function TSynExporterHTML.AttriToCSSCallback(Highlighter: TSynCustomHighlighter;
+  Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+  Params: array of Pointer): Boolean;
+var
+  Styles: ^string;
+begin
+  Styles := Params[0];
+  Styles^ := Styles^ + AttriToCSS(Attri, UniqueAttriName) + #13#10;  
+  Result := True; // we want all attributes => tell EnumHighlighterAttris to continue
+end;
+
+function TSynExporterHTML.ColorToHTML(AColor: TColor): string;
+var
+  RGBColor: longint;
+  RGBValue: byte;
+const
+  Digits: array[0..15] of Char = '0123456789ABCDEF';
+begin
+  RGBColor := ColorToRGB(AColor);
+  Result := '#000000';
+  RGBValue := GetRValue(RGBColor);
+  if RGBValue > 0 then
+  begin
+    Result[2] := Digits[RGBValue shr  4];
+    Result[3] := Digits[RGBValue and 15];
+  end;
+  RGBValue := GetGValue(RGBColor);
+  if RGBValue > 0 then
+  begin
+    Result[4] := Digits[RGBValue shr  4];
+    Result[5] := Digits[RGBValue and 15];
+  end;
+  RGBValue := GetBValue(RGBColor);
+  if RGBValue > 0 then
+  begin
+    Result[6] := Digits[RGBValue shr  4];
+    Result[7] := Digits[RGBValue and 15];
+  end;
+end;
+
+procedure TSynExporterHTML.FormatAfterLastAttribute;
+begin
+  AddData('');
+end;
+
+procedure TSynExporterHTML.FormatAttributeDone(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+begin
+  AddData('');
+end;
+
+procedure TSynExporterHTML.FormatAttributeInit(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+var
+  StyleName: string;
+begin
+  StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute);
+  AddData(Format('', [StyleName]));
+end;
+
+procedure TSynExporterHTML.FormatBeforeFirstAttribute(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+var
+  StyleName: string;
+begin
+  StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute);
+  AddData(Format('', [StyleName]));
+end;
+
+procedure TSynExporterHTML.FormatNewLine;
+begin
+  AddNewLine;
+end;
+
+function TSynExporterHTML.GetFooter: UnicodeString;
+begin
+  Result := '';
+  if fExportAsText then
+    Result := ''#13#10'
'#13#10 + else + Result := '
'; + if not(FCreateHTMLFragment and fExportAsText) then + Result := Result + ''#13#10''; +end; + +function TSynExporterHTML.GetFormatName: string; +begin + Result := SYNS_ExporterFormatHTML; +end; + +function TSynExporterHTML.GetHeader: UnicodeString; +const + DescriptionSize = 105; + FooterSize1 = 47; + FooterSize2 = 31; + NativeHeader = 'Version:0.9'#13#10 + + 'StartHTML:%.10d'#13#10 + + 'EndHTML:%.10d'#13#10 + + 'StartFragment:%.10d'#13#10 + + 'EndFragment:%.10d'#13#10; + HTMLAsTextHeader = ''#13#10 + + ''#13#10 + + ''#13#10 + + ''#13#10; + HTMLAsTextHeader2 =''#13#10 + + ''#13#10 + + ''#13#10 + + ''#13#10 + + ''#13#10; + EncodingStrs: array[TSynEncoding] of string = + ('UTF-8', 'UTF-16', 'UTF-16', 'ANSI is Unsupported'); +var + EncodingStr, Styles, Header, Header2: string; +begin + EncodingStr := EncodingStrs[Encoding]; + EnumHighlighterAttris(Highlighter, True, AttriToCSSCallback, [@Styles]); + + Header := Format(HTMLAsTextHeader, [EncodingStr]); + Header := Header + '' + Title + ''#13#10 + + Format(HTMLAsTextHeader2, [EncodingStr, ColorToHtml(fFont.Color), + ColorToHTML(fBackgroundColor), Styles]); + + Result := ''; + if fExportAsText then + begin + if not FCreateHTMLFragment then + Result := Header; + + Result := Result + Format('
'#13#10'',
+      [fFont.Size, fFont.Name]);
+  end
+  else
+  begin
+    // Described in http://msdn.microsoft.com/library/sdkdoc/htmlclip/htmlclipboard.htm
+    Header2 := '
';
+    Result := Format(NativeHeader, [DescriptionSize,
+      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize1,
+      DescriptionSize + Length(Header),
+      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize2]);
+    Result := Result + Header + Header2;
+  end;
+end;
+
+function TSynExporterHTML.GetStyleName(Highlighter: TSynCustomHighlighter;
+  Attri: TSynHighlighterAttributes): string;
+begin
+  EnumHighlighterAttris(Highlighter, False, StyleNameCallback, [Attri, @Result]);
+end;
+
+function TSynExporterHTML.MakeValidName(Name: string): string;
+var
+  i: Integer;
+begin
+  Result := LowerCase(Name);
+  for i := Length(Result) downto 1 do
+    if CharInSet(Result[i], ['.', '_']) then
+      Result[i] := '-'
+    else if not CharInSet(Result[i], ['a'..'z', '0'..'9', '-']) then
+      Delete(Result, i, 1);
+end;
+
+function TSynExporterHTML.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+begin
+  case AChar of
+    '&': Result := '&';
+    '<': Result := '<';
+    '>': Result := '>';
+    '"': Result := '"';
+    else Result := '';
+  end
+end;
+
+function TSynExporterHTML.StyleNameCallback(Highlighter: TSynCustomHighlighter;
+    Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+    Params: array of Pointer): Boolean;
+var
+  AttriToFind: TSynHighlighterAttributes;
+  StyleName: ^string;
+begin
+  AttriToFind := Params[0];
+  StyleName := Params[1];
+
+  if Attri = AttriToFind then
+  begin
+    StyleName^ := MakeValidName(UniqueAttriName);
+    Result := False; // found => inform EnumHighlighterAttris to stop searching
+  end
+  else
+    Result := True;
+end;
+
+function TSynExporterHTML.UseBom: Boolean;
+begin
+  // do not include seUTF8 as some browsers have problems with UTF-8-BOM
+  Result := Encoding in [seUTF16LE, seUTF16BE];
+end;
+
+function TSynExporterHTML.SupportedEncodings: TSynEncodings;
+begin
+  Result := [seUTF8, seUTF16LE, seUTF16BE];
+end;
+
+end.
diff --git a/Source/VCL/SynEdit/Source/SynExportRTF.pas b/Source/VCL/SynEdit/Source/SynExportRTF.pas
index 05f811e5..49c1275d 100644
--- a/Source/VCL/SynEdit/Source/SynExportRTF.pas
+++ b/Source/VCL/SynEdit/Source/SynExportRTF.pas
@@ -1,272 +1,274 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynExportRTF.pas, released 2000-04-16.
-
-The Original Code is partly based on the mwRTFExport.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Michael Hieke.
-Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
-Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit project 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: SynExportRTF.pas,v 1.10.2.3 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-
-unit SynExportRTF;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Graphics,
-  RichEdit,
-  SynEditExport,
-  SynUnicode,
-  Classes;
-
-type
-  TSynExporterRTF = class(TSynCustomExporter)
-  private
-    fAttributesChanged: Boolean;
-    fListColors: TList;
-    function ColorToRTF(AColor: TColor): string;
-    function GetColorIndex(AColor: TColor): Integer;
-  protected
-    procedure FormatAfterLastAttribute; override;
-    procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean;
-      FontStylesChanged: TFontStyles); override;
-    procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean;
-      FontStylesChanged: TFontStyles); override;
-    procedure FormatBeforeFirstAttribute(BackgroundChanged,
-      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
-    procedure FormatNewLine; override;
-    function GetFooter: string; override;
-    function GetFormatName: string; override;
-    function GetHeader: string; override;
-    function ReplaceReservedChar(AChar: WideChar): string; override;
-    function UseBom: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    procedure Clear; override;
-    function SupportedEncodings: TSynEncodings; override;
-  published
-    property Color;
-    property DefaultFilter;
-    property Encoding;
-    property Font;
-    property Highlighter;
-    property Title;
-    property UseBackground;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst,
-  SysUtils;
-
-{ TSynExporterRTF }
-
-constructor TSynExporterRTF.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  fListColors := TList.Create;
-  fDefaultFilter := SYNS_FilterRTF;
-  fClipboardFormat := RegisterClipboardFormat(CF_RTF);
-  FEncoding := seUTF8;
-end;
-
-destructor TSynExporterRTF.Destroy;
-begin
-  fListColors.Free;
-  fListColors := nil;
-  inherited Destroy;
-end;
-
-procedure TSynExporterRTF.Clear;
-begin
-  inherited Clear;
-  if Assigned(fListColors) then
-    fListColors.Clear;
-end;
-
-function TSynExporterRTF.ColorToRTF(AColor: TColor): string;
-var
-  Col: Integer;
-begin
-  Col := ColorToRGB(AColor);
-  Result := Format('\red%d\green%d\blue%d;', [GetRValue(Col), GetGValue(Col),
-    GetBValue(Col)]);
-end;
-
-procedure TSynExporterRTF.FormatAfterLastAttribute;
-begin
-  // no need to reset the font style here...
-end;
-
-procedure TSynExporterRTF.FormatAttributeDone(BackgroundChanged,
-  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
-const
-  FontTags: array[TFontStyle] of string = ('\b0', '\i0', '\ul0', '\strike0');
-var
-  AStyle: TFontStyle;
-begin
-  // nothing to do about the color, but reset the font style
-  for AStyle := Low(TFontStyle) to High(TFontStyle) do
-  begin
-    if AStyle in FontStylesChanged then
-    begin
-      fAttributesChanged := True;
-      AddData(FontTags[AStyle]);
-    end;
-  end;
-end;
-
-procedure TSynExporterRTF.FormatAttributeInit(BackgroundChanged,
-  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
-const
-  FontTags: array[TFontStyle] of string = ('\b', '\i', '\ul', '\strike');
-var
-  AStyle: TFontStyle;
-begin
-  // background color
-  if BackgroundChanged then
-  begin
-    AddData(Format('\cb%d', [GetColorIndex(fLastBG)]));
-    fAttributesChanged := True;
-  end;
-  // text color
-  if ForegroundChanged then
-  begin
-    AddData(Format('\cf%d', [GetColorIndex(fLastFG)]));
-    fAttributesChanged := True;
-  end;
-  // font styles
-  for AStyle := Low(TFontStyle) to High(TFontStyle) do
-    if AStyle in FontStylesChanged then
-    begin
-      AddData(FontTags[AStyle]);
-      fAttributesChanged := True;
-    end;
-  if fAttributesChanged then
-  begin
-    AddData(' ');
-    fAttributesChanged := False;
-  end;
-end;
-
-procedure TSynExporterRTF.FormatBeforeFirstAttribute(BackgroundChanged,
-  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
-begin
-  FormatAttributeInit(BackgroundChanged, ForegroundChanged, FontStylesChanged);
-end;
-
-procedure TSynExporterRTF.FormatNewLine;
-begin
-  AddData(#13#10'\par ');
-end;
-
-function TSynExporterRTF.GetColorIndex(AColor: TColor): Integer;
-begin
-  Result := fListColors.IndexOf(pointer(AColor));
-  if Result = -1 then
-    Result := fListColors.Add(pointer(AColor));
-end;
-
-function TSynExporterRTF.GetFooter: string;
-begin
-  Result := '}';
-end;
-
-function TSynExporterRTF.GetFormatName: string;
-begin
-  Result := SYNS_ExporterFormatRTF;
-end;
-
-function TSynExporterRTF.GetHeader: string;
-var
-  i: Integer;
-
-  function GetFontTable: string;
-  begin
-    Result := '{\fonttbl{\f0\fmodern ' + Font.Name;
-    Result := Result + ';}}'#13#10;
-  end;
-
-begin
-  Result := '{\rtf1\ansi\ansicpg1252\uc1\deff0\deftab720' + GetFontTable;
-  // all the colors
-  Result := Result + '{\colortbl';
-  for i := 0 to fListColors.Count - 1 do
-    Result := Result + ColorToRTF(TColor(fListColors[i]));
-  Result := Result + '}'#13#10;
-  // title and creator comment
-  Result := Result + '{\info{\comment Generated by the SynEdit RTF ' +
-    'exporter}'#13#10;
-  Result := Result + '{\title ' + fTitle + '}}'#13#10;
-  if fUseBackground then
-    Result := Result + { TODO: use background color } #13#10;
-  Result := Result + Format('\deflang1033\pard\plain\f0\fs%d ',
-    [2 * Font.Size]);
-end;
-
-function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): string;
-begin
-  Result := '';
-  case AChar of
-    '\': Result := '\\';
-    '{': Result := '\{';
-    '}': Result := '\}';
-  end;
-  if AChar > #127 then
-  begin
-    if AChar <= #255 then
-      Result := '\''' + LowerCase(IntToHex(Ord(AChar), 2))
-    else
-      // SmallInt type-cast is necessary because RTF
-      // uses signed 16-Bit Integer for Unicode characters
-      Result := '\u' + IntToStr(SmallInt(AChar)) + '?';
-  end;
-end;
-
-function TSynExporterRTF.SupportedEncodings: TSynEncodings;
-begin
-  Result := [seUTF8];
-end;
-
-function TSynExporterRTF.UseBom: Boolean;
-begin
-  Result := False;
-end;
-
-end.
-
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynExportRTF.pas, released 2000-04-16.
+
+The Original Code is partly based on the mwRTFExport.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Michael Hieke.
+Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
+Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg.
+Unicode translation by Maël Hörz.
+All Rights Reserved.
+
+Contributors to the SynEdit project 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: SynExportRTF.pas,v 1.10.2.3 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+
+{$IFNDEF QSYNEXPORTRTF}
+unit SynExportRTF;
+{$ENDIF}
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  RichEdit,
+  SynEditExport,
+  SynUnicode,
+  Classes;
+
+type
+  TSynExporterRTF = class(TSynCustomExporter)
+  private
+    fAttributesChanged: Boolean;
+    FListColors: TList;
+    function ColorToRTF(AColor: TColor): UnicodeString;
+    function GetColorIndex(AColor: TColor): Integer;
+  protected
+    procedure FormatAfterLastAttribute; override;
+    procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean;
+      FontStylesChanged: TFontStyles); override;
+    procedure FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean;
+      FontStylesChanged: TFontStyles); override;
+    procedure FormatBeforeFirstAttribute(BackgroundChanged,
+      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
+    procedure FormatNewLine; override;
+    function GetFooter: UnicodeString; override;
+    function GetFormatName: string; override;
+    function GetHeader: UnicodeString; override;
+    function ReplaceReservedChar(AChar: WideChar): UnicodeString; override;
+    function UseBom: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure Clear; override;
+    function SupportedEncodings: TSynEncodings; override;
+  published
+    property Color;
+    property DefaultFilter;
+    property Encoding;
+    property Font;
+    property Highlighter;
+    property Title;
+    property UseBackground;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst,
+  SysUtils;
+
+{ TSynExporterRTF }
+
+constructor TSynExporterRTF.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FListColors := TList.Create;
+  FDefaultFilter := SYNS_FilterRTF;
+  FClipboardFormat := RegisterClipboardFormat(CF_RTF);
+  FEncoding := seUTF8;
+end;
+
+destructor TSynExporterRTF.Destroy;
+begin
+  FListColors.Free;
+  FListColors := nil;
+  inherited Destroy;
+end;
+
+procedure TSynExporterRTF.Clear;
+begin
+  inherited Clear;
+  if Assigned(FListColors) then
+    FListColors.Clear;
+end;
+
+function TSynExporterRTF.ColorToRTF(AColor: TColor): UnicodeString;
+var
+  Col: Integer;
+begin
+  Col := ColorToRGB(AColor);
+  Result := Format('\red%d\green%d\blue%d;', [GetRValue(Col), GetGValue(Col),
+    GetBValue(Col)]);
+end;
+
+procedure TSynExporterRTF.FormatAfterLastAttribute;
+begin
+  // no need to reset the font style here...
+end;
+
+procedure TSynExporterRTF.FormatAttributeDone(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+const
+  FontTags: array[TFontStyle] of UnicodeString = ('\b0', '\i0', '\ul0', '\strike0');
+var
+  AStyle: TFontStyle;
+begin
+  // nothing to do about the color, but reset the font style
+  for AStyle := Low(TFontStyle) to High(TFontStyle) do
+  begin
+    if AStyle in FontStylesChanged then
+    begin
+      fAttributesChanged := True;
+      AddData(FontTags[AStyle]);
+    end;
+  end;
+end;
+
+procedure TSynExporterRTF.FormatAttributeInit(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+const
+  FontTags: array[TFontStyle] of UnicodeString = ('\b', '\i', '\ul', '\strike');
+var
+  AStyle: TFontStyle;
+begin
+  // background color
+  if BackgroundChanged then
+  begin
+    AddData(Format('\cb%d', [GetColorIndex(fLastBG)]));
+    fAttributesChanged := True;
+  end;
+  // text color
+  if ForegroundChanged then
+  begin
+    AddData(Format('\cf%d', [GetColorIndex(fLastFG)]));
+    fAttributesChanged := True;
+  end;
+  // font styles
+  for AStyle := Low(TFontStyle) to High(TFontStyle) do
+    if AStyle in FontStylesChanged then
+    begin
+      AddData(FontTags[AStyle]);
+      fAttributesChanged := True;
+    end;
+  if fAttributesChanged then
+  begin
+    AddData(' ');
+    fAttributesChanged := False;
+  end;
+end;
+
+procedure TSynExporterRTF.FormatBeforeFirstAttribute(BackgroundChanged,
+  ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
+begin
+  FormatAttributeInit(BackgroundChanged, ForegroundChanged, FontStylesChanged);
+end;
+
+procedure TSynExporterRTF.FormatNewLine;
+begin
+  AddData(#13#10'\par ');
+end;
+
+function TSynExporterRTF.GetColorIndex(AColor: TColor): Integer;
+begin
+  Result := FListColors.IndexOf(Pointer(AColor));
+  if Result = -1 then
+    Result := FListColors.Add(Pointer(AColor));
+end;
+
+function TSynExporterRTF.GetFooter: UnicodeString;
+begin
+  Result := '}';
+end;
+
+function TSynExporterRTF.GetFormatName: string;
+begin
+  Result := SYNS_ExporterFormatRTF;
+end;
+
+function TSynExporterRTF.GetHeader: UnicodeString;
+var
+  i: Integer;
+
+  function GetFontTable: UnicodeString;
+  begin
+    Result := '{\fonttbl{\f0\fmodern ' + Font.Name;
+    Result := Result + ';}}'#13#10;
+  end;
+
+begin
+  Result := '{\rtf1\ansi\ansicpg1252\uc1\deff0\deftab720' + GetFontTable;
+  // all the colors
+  Result := Result + '{\colortbl';
+  for i := 0 to FListColors.Count - 1 do
+    Result := Result + ColorToRTF(TColor(FListColors[i]));
+  Result := Result + '}'#13#10;
+  // title and creator comment
+  Result := Result + '{\info{\comment Generated by the SynEdit RTF ' +
+    'exporter}'#13#10;
+  Result := Result + '{\title ' + fTitle + '}}'#13#10;
+  if fUseBackground then
+    Result := Result + { TODO: use background color } #13#10;
+  Result := Result + Format('\deflang1033\pard\plain\f0\fs%d ',
+    [2 * Font.Size]);
+end;
+
+function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+begin
+  Result := '';
+  case AChar of
+    '\': Result := '\\';
+    '{': Result := '\{';
+    '}': Result := '\}';
+  end;
+  if Ord(AChar) > 127 then
+  begin
+    if Ord(AChar) <= 255 then
+      Result := '\''' + LowerCase(IntToHex(Ord(AChar), 2))
+    else
+      // SmallInt type-cast is necessary because RTF
+      // uses signed 16-Bit Integer for Unicode characters
+      Result := '\u' + IntToStr(SmallInt(AChar)) + '?';
+  end;
+end;
+
+function TSynExporterRTF.SupportedEncodings: TSynEncodings;
+begin
+  Result := [seUTF8];
+end;
+
+function TSynExporterRTF.UseBom: Boolean;
+begin
+  Result := False;
+end;
+
+end.
+
diff --git a/Source/VCL/SynEdit/Source/SynExportTeX.pas b/Source/VCL/SynEdit/Source/SynExportTeX.pas
index 860494b6..8739342d 100644
--- a/Source/VCL/SynEdit/Source/SynExportTeX.pas
+++ b/Source/VCL/SynEdit/Source/SynExportTeX.pas
@@ -1,403 +1,415 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynExportTeX.pas, released 2002-09-12.
-
-The Original Code is partly based on the mwHTMLExport.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Ascher Stefan.
-Portions created by Ascher Stefan are Copyright 2002 Ascher Stefan.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit project 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: SynExportTeX.pas,v 1.8.2.5 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
-- LaTeX 2e doesn't support Unicode, so this exporter doesn't either.
-  (There are solutions like the package utc.sty but still they don't allow mixing
-  of different languages like Arabic and Chinese.
-  We'll have to wait for LaTeX 3.)
--------------------------------------------------------------------------------}
-
-unit SynExportTeX;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Graphics,
-  SynEditExport,
-  SynEditHighlighter,
-  SynUnicode,
-  Classes;
-
-type
-  TSynExporterTeX = class(TSynCustomExporter)
-  private
-    fMargin: integer;
-    fLastAttri: TSynHighlighterAttributes;
-    function AttriToCommand(Attri: TSynHighlighterAttributes;
-      UniqueAttriName: string): string;
-    function AttriToCommandCallback(Highlighter: TSynCustomHighlighter;
-      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
-      Params: array of Pointer): Boolean;
-    function CommandNameCallback(Highlighter: TSynCustomHighlighter;
-      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
-      Params: array of Pointer): Boolean;
-    function GetCommandName(Highlighter: TSynCustomHighlighter;
-      Attri: TSynHighlighterAttributes): string;
-    function GetNewCommands: string;
-    function MakeValidName(Name: string): string;
-  protected
-    fCreateTeXFragment: boolean;
-    fTabWidth: integer;
-    fPageStyleEmpty: boolean;
-    
-    // overriding these abstract methods (though they are never called for this
-    // specific highlighter) to prevent abstract instance warnings
-    procedure FormatAfterLastAttribute; override;
-    procedure FormatAttributeDone(BackgroundChanged: Boolean;
-      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
-    procedure FormatAttributeInit(BackgroundChanged: Boolean;
-      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
-    procedure FormatBeforeFirstAttribute(BackgroundChanged: Boolean;
-      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
-
-    procedure FormatNewLine; override;
-    procedure FormatToken(Token: string); override;
-    function GetFooter: string; override;
-    function GetFormatName: string; override;
-    function GetHeader: string; override;
-    function ReplaceReservedChar(AChar: WideChar): string; override;
-    procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); override;
-    function UseBom: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function SupportedEncodings: TSynEncodings; override;
-  published
-    property Margin: integer read fMargin write fMargin default 2;
-    property TabWidth: integer read fTabWidth write fTabWidth default 2;
-    property Color;
-    property CreateTeXFragment: boolean read fCreateTeXFragment
-      write fCreateTeXFragment default false;
-    property PageStyleEmpty: boolean read fPageStyleEmpty write fPageStyleEmpty
-      default false;
-    property DefaultFilter;
-    property Encoding;
-    property Font;
-    property Highlighter;
-    property Title;
-    property UseBackground;
-  end;
-
-implementation
-
-uses
-  SynEditMiscProcs,
-  SynEditStrConst,
-  SysUtils;
-
-
-// DotDecSepFormat always formats with a dot as decimal separator.
-// This is necessary because LaTeX expects a dot, but VCL's Format is
-// language-dependent, i.e. with another locale set, the separator can be
-// different (for example a comma).
-function DotDecSepFormat(const Format: string; const Args: array of const): string;
-var
-  pSettings: TFormatSettings;
-begin
-  pSettings := FormatSettings;
-  pSettings.DecimalSeparator := '.';
-  Result := SysUtils.Format(Format, Args, pSettings);
-end;
-
-function ColorToTeX(AColor: TColor): string;
-const
-  f = '%1.2g';
-  f2 = '%s,%s,%s';
-var
-  RGBColor: LongWord;
-  RValue, GValue, BValue: string;
-begin
-  RGBColor := ColorToRGB(AColor);
-  RValue := DotDecSepFormat(f, [GetRValue(RGBColor) / 255]);
-  GValue := DotDecSepFormat(f, [GetGValue(RGBColor) / 255]);
-  BValue := DotDecSepFormat(f, [GetBValue(RGBColor) / 255]);
-  Result := Format(f2, [RValue, GValue, BValue]);
-end;
-
-{ TSynExporterTeX }
-
-constructor TSynExporterTeX.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  fMargin := 2;
-  fTabWidth := 2;
-  fPageStyleEmpty := false;
-  fDefaultFilter := SYNS_FilterTeX;
-  FEncoding := seAnsi;
-end;
-
-function TSynExporterTeX.AttriToCommandCallback(
-  Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes;
-  UniqueAttriName: string; Params: array of Pointer): Boolean;
-var
-  Commands: ^string;
-begin
-  Commands := Params[0];
-  Commands^ := Commands^ + AttriToCommand(Attri, UniqueAttriName) + SLineBreak;
-  Result := True; // we want all attributes => tell EnumHighlighterAttris to continue
-end;
-
-function TSynExporterTeX.AttriToCommand(Attri: TSynHighlighterAttributes;
-  UniqueAttriName: string): string;
-const
-  NewCommand    = '\newcommand{\%s}[1]{%s#1%s}';
-  SBold         = '\textbf{';
-  SItalic       = '\textit{';
-  SUnderline    = '\uln{';
-  SColor        = '\textcolor[rgb]{%s}{';
-  SBackColor    = '\colorbox[rgb]{%s}{';
-var
-  Formatting: string;
-  BracketCount: Integer;
-begin
-  BracketCount := 0;
-  with Attri do
-  begin
-    if fsBold in Style then
-    begin
-      Formatting := Formatting + SBold;
-      Inc(BracketCount);
-    end;
-    if fsItalic in Style then
-    begin
-      Formatting := Formatting + SItalic;
-      Inc(BracketCount);
-    end;
-    if fsUnderline in Style then
-    begin
-      Formatting := Formatting + SUnderline;
-      Inc(BracketCount);
-    end;
-    if (Foreground <> clBlack) and (Foreground <> clNone)  then
-    begin
-      Formatting := Formatting + Format(SColor, [ColorToTeX(Foreground)]);
-      Inc(BracketCount);
-    end;
-    if fUseBackground and (Background <> clNone) then
-    begin
-      Formatting := Formatting + Format(SBackColor, [ColorToTeX(Background)]);
-      Inc(BracketCount);
-    end;
-    Result := Format(NewCommand, [MakeValidName(UniqueAttriName), Formatting,
-      StringOfChar('}', BracketCount)])
-  end;
-end;
-
-function TSynExporterTeX.CommandNameCallback(
-  Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes;
-  UniqueAttriName: string; Params: array of Pointer): Boolean;
-var
-  AttriToFind: TSynHighlighterAttributes;
-  CommandName: ^string;
-begin
-  AttriToFind := Params[0];
-  CommandName := Params[1];
-
-  if Attri = AttriToFind then
-  begin
-    CommandName^ := MakeValidName(UniqueAttriName);
-    Result := False; // found => inform EnumHighlighterAttris to stop searching
-  end
-  else
-    Result := True;
-end;
-
-procedure TSynExporterTeX.FormatToken(Token: string);
-var
-  CommandName: string;
-begin
-  CommandName := GetCommandName(Highlighter, fLastAttri);
-  AddData('\' + CommandName + '{' + Token + '}');
-end;
-
-procedure TSynExporterTeX.FormatNewLine;
-begin
-  AddData('\\' + SLineBreak);
-end;
-
-// do nothing with these
-procedure TSynExporterTeX.FormatAfterLastAttribute;
-begin
-end;
-
-procedure TSynExporterTeX.FormatAttributeDone;
-begin
-end;
-
-procedure TSynExporterTeX.FormatAttributeInit;
-begin
-end;
-
-procedure TSynExporterTeX.FormatBeforeFirstAttribute;
-begin
-end;
-
-function TSynExporterTeX.GetCommandName(Highlighter: TSynCustomHighlighter;
-  Attri: TSynHighlighterAttributes): string;
-begin
-  EnumHighlighterAttris(Highlighter, False, CommandNameCallback, [Attri, @Result]);
-end;
-
-function TSynExporterTeX.GetFooter: string;
-begin
-  if not fCreateTeXFragment then
-    Result := SLineBreak + '\end{ttfamily}' + SLineBreak + '\end{document}'
-  else
-    Result := SLineBreak + '\end{ttfamily}';
-end;
-
-function TSynExporterTeX.GetFormatName: string;
-begin
-  Result := SYNS_ExporterFormatTeX;
-end;
-
-function TSynExporterTeX.GetHeader: string;
-const
-  TeXHeader   = '\documentclass[a4paper, %dpt]{article}' + SLineBreak +
-                '\usepackage[a4paper, margin=%dcm]{geometry}' + SLineBreak +
-                '\usepackage[T1]{fontenc}' + SLineBreak +
-                '\usepackage{color}' + SLineBreak +
-                '\usepackage{alltt}' + SLineBreak +
-                '\usepackage{times}' + SLineBreak +
-                '\usepackage{ulem}' + SLineBreak +
-                // It is recommennded to use AnsiNew on Windows
-                '\usepackage[ansinew]{inputenc}' + SLineBreak +
-                '%s' + SLineBreak; // New Commands
-  TeXHeader2  = '%% Generated by SynEdit TeX exporter' + SLineBreak + SLineBreak +
-                '\begin{document}';
-  EmptyPage   = '\pagestyle{empty}';
-  TeXDocument = '\begin{ttfamily}' + SLineBreak +
-                '\noindent' + SLineBreak;
-var
-  PageStyle: string;
-begin
-  if not fCreateTeXFragment then
-  begin
-    if fPageStyleEmpty then
-      PageStyle := SLineBreak + EmptyPage
-    else
-      PageStyle := '';
-    Result := Format(TeXHeader + SLineBreak + SLineBreak,
-      [Font.Size, fMargin, GetNewCommands]);
-    Result := Result + '\title{' + Title + '}' + SLineBreak + TeXHeader2 +
-      SLineBreak + PageStyle;
-  end;
-  Result := Result + TeXDocument;
-end;
-
-function TSynExporterTeX.GetNewCommands: string;
-const
-  FixedCommands = '%% Special Characters' + SLineBreak +
-                  '\newcommand\SPC{\hspace*{0.6em}}' + SLineBreak +
-                  '\newcommand\TAB{\hspace*{%sem}}' + SLineBreak +
-                  '\newcommand\BS{\mbox{\char 92}}' + SLineBreak +   // Backslash
-                  '\newcommand\TLD{\mbox{\char 126}}' + SLineBreak + // ~
-                  '\newcommand\CIR{\mbox{\char 94}}' + SLineBreak  + // ^
-                  '\newcommand\HYP{\mbox{\char 45}}' + SLineBreak  + // a simple -
-                  '\newcommand\QOT{\mbox{\char 34}}' + SLineBreak  + // "
-                  '\newcommand{\uln}[1]{\bgroup \markoverwith{\hbox{\_}}\ULon{{#1}}}' + SLineBreak +
-                  '%% Highlighter Attributes' + SLineBreak;
-  f = '%1.1g';
-var
-  tw: string;
-  Commands: string;
-begin
-  tw := DotDecSepFormat(f, [fTabWidth * 0.6]);
-  Result := Format(FixedCommands, [tw]);
-
-  EnumHighlighterAttris(Highlighter, True, AttriToCommandCallback, [@Commands]);
-  Result := Result + Commands;
-end;
-
-function TSynExporterTeX.MakeValidName(Name: string): string;
-var
-  i: Integer;
-begin
-  Result := Name;
-  
-  for i := Length(Result) downto 1 do
-  if CharInSet(Result[i], ['1'..'9']) then
-    Result[i] := Char(Ord('A') + Ord(Result[i]) - Ord('1'))
-  else if Result[i] = '0' then
-    Result[i] := 'Z'
-  else if not CharInSet(Result[i], ['a'..'z', 'A'..'Z']) then
-    Delete(Result, i, 1);
-end;
-
-function TSynExporterTeX.ReplaceReservedChar(AChar: WideChar): string;
-begin
-  case AChar of
-    '{': Result := '\{';
-    '}': Result := '\}';
-    '\': Result := '\BS ';
-    '~': Result := '\TLD ';
-    '^': Result := '\CIR ';
-    ' ': Result := '\SPC ';
-    #9: Result := '\TAB ';
-    '-': Result := '\HYP ';
-    '"': Result := '\QOT ';
-    '@': Result := '$@$';
-    '$': Result := '\$';
-    '&': Result := '\&';
-    '<': Result := '$<$';
-    '>': Result := '$>$';
-    '_': Result := '\_';
-    '#': Result := '\#';
-    '%': Result := '\%';
-    else Result := '';
-  end;
-end;
-
-procedure TSynExporterTeX.SetTokenAttribute(Attri: TSynHighlighterAttributes);
-begin
-  fLastAttri := Attri;
-end;
-
-function TSynExporterTeX.SupportedEncodings: TSynEncodings;
-begin
-  Result := [seAnsi];
-end;
-
-function TSynExporterTeX.UseBom: Boolean;
-begin
-  Result := False;
-end;
-
-end.
-
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynExportTeX.pas, released 2002-09-12.
+
+The Original Code is partly based on the mwHTMLExport.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Ascher Stefan.
+Portions created by Ascher Stefan are Copyright 2002 Ascher Stefan.
+Unicode translation by Maël Hörz.
+All Rights Reserved.
+
+Contributors to the SynEdit project 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: SynExportTeX.pas,v 1.8.2.5 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+- LaTeX 2e doesn't support Unicode, so this exporter doesn't either.
+  (There are solutions like the package utc.sty but still they don't allow mixing
+  of different languages like Arabic and Chinese.
+  We'll have to wait for LaTeX 3.)
+-------------------------------------------------------------------------------}
+
+{$IFNDEF QSYNEXPORTTEX}
+unit SynExportTeX;
+{$ENDIF}
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  SynEditExport,
+  SynEditHighlighter,
+  SynUnicode,
+  Classes;
+
+type
+  TSynExporterTeX = class(TSynCustomExporter)
+  private
+    FMargin: Integer;
+    FLastAttri: TSynHighlighterAttributes;
+    function AttriToCommand(Attri: TSynHighlighterAttributes;
+      UniqueAttriName: string): string;
+    function AttriToCommandCallback(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+      Params: array of Pointer): Boolean;
+    function CommandNameCallback(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes; UniqueAttriName: string;
+      Params: array of Pointer): Boolean;
+    function GetCommandName(Highlighter: TSynCustomHighlighter;
+      Attri: TSynHighlighterAttributes): string;
+    function GetNewCommands: string;
+    function MakeValidName(Name: string): string;
+  protected
+    FCreateTeXFragment: Boolean;
+    FTabWidth: Integer;
+    FPageStyleEmpty: Boolean;
+    
+    // overriding these abstract methods (though they are never called for this
+    // specific highlighter) to prevent abstract instance warnings
+    procedure FormatAfterLastAttribute; override;
+    procedure FormatAttributeDone(BackgroundChanged: Boolean;
+      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
+    procedure FormatAttributeInit(BackgroundChanged: Boolean;
+      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
+    procedure FormatBeforeFirstAttribute(BackgroundChanged: Boolean;
+      ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
+
+    procedure FormatNewLine; override;
+    procedure FormatToken(Token: UnicodeString); override;
+    function GetFooter: UnicodeString; override;
+    function GetFormatName: string; override;
+    function GetHeader: UnicodeString; override;
+    function ReplaceReservedChar(AChar: WideChar): UnicodeString; override;
+    procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); override;
+    function UseBom: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function SupportedEncodings: TSynEncodings; override;
+  published
+    property Margin: Integer read FMargin write FMargin default 2;
+    property TabWidth: Integer read FTabWidth write FTabWidth default 2;
+    property Color;
+    property CreateTeXFragment: Boolean read FCreateTeXFragment
+      write FCreateTeXFragment default false;
+    property PageStyleEmpty: Boolean read FPageStyleEmpty write FPageStyleEmpty
+      default false;
+    property DefaultFilter;
+    property Encoding;
+    property Font;
+    property Highlighter;
+    property Title;
+    property UseBackground;
+  end;
+
+implementation
+
+uses
+  SynEditMiscProcs,
+  SynEditStrConst,
+  SysUtils;
+
+
+// DotDecSepFormat always formats with a dot as decimal separator.
+// This is necessary because LaTeX expects a dot, but VCL's Format is
+// language-dependent, i.e. with another locale set, the separator can be
+// different (for example a comma).
+function DotDecSepFormat(const Format: string; const Args: array of const): string;
+var
+{$IFDEF UNICODE}
+  OldDecimalSeparator: WideChar;
+{$ELSE}
+  OldDecimalSeparator: AnsiChar;
+{$ENDIF}
+begin
+  OldDecimalSeparator := {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator;
+  {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator := '.';
+  Result := SysUtils.Format(Format, Args);
+  {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator := OldDecimalSeparator;
+end;
+
+function ColorToTeX(AColor: TColor): string;
+const
+  f = '%1.2g';
+  f2 = '%s,%s,%s';
+var
+  RGBColor: LongWord;
+  RValue, GValue, BValue: string;
+begin
+  RGBColor := ColorToRGB(AColor);
+  RValue := DotDecSepFormat(f, [GetRValue(RGBColor) / 255]);
+  GValue := DotDecSepFormat(f, [GetGValue(RGBColor) / 255]);
+  BValue := DotDecSepFormat(f, [GetBValue(RGBColor) / 255]);
+  Result := Format(f2, [RValue, GValue, BValue]);
+end;
+
+{ TSynExporterTeX }
+
+constructor TSynExporterTeX.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FMargin := 2;
+  FTabWidth := 2;
+  FPageStyleEmpty := False;
+  FDefaultFilter := SYNS_FilterTeX;
+  FEncoding := seAnsi;
+end;
+
+function TSynExporterTeX.AttriToCommandCallback(
+  Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes;
+  UniqueAttriName: string; Params: array of Pointer): Boolean;
+var
+  Commands: ^string;
+begin
+  Commands := Params[0];
+  Commands^ := Commands^ + AttriToCommand(Attri, UniqueAttriName) + SLineBreak;
+  Result := True; // we want all attributes => tell EnumHighlighterAttris to continue
+end;
+
+function TSynExporterTeX.AttriToCommand(Attri: TSynHighlighterAttributes;
+  UniqueAttriName: string): string;
+const
+  NewCommand    = '\newcommand{\%s}[1]{%s#1%s}';
+  SBold         = '\textbf{';
+  SItalic       = '\textit{';
+  SUnderline    = '\uln{';
+  SColor        = '\textcolor[rgb]{%s}{';
+  SBackColor    = '\colorbox[rgb]{%s}{';
+var
+  Formatting: string;
+  BracketCount: Integer;
+begin
+  BracketCount := 0;
+  with Attri do
+  begin
+    if fsBold in Style then
+    begin
+      Formatting := Formatting + SBold;
+      Inc(BracketCount);
+    end;
+    if fsItalic in Style then
+    begin
+      Formatting := Formatting + SItalic;
+      Inc(BracketCount);
+    end;
+    if fsUnderline in Style then
+    begin
+      Formatting := Formatting + SUnderline;
+      Inc(BracketCount);
+    end;
+    if (Foreground <> clBlack) and (Foreground <> clNone)  then
+    begin
+      Formatting := Formatting + Format(SColor, [ColorToTeX(Foreground)]);
+      Inc(BracketCount);
+    end;
+    if fUseBackground and (Background <> clNone) then
+    begin
+      Formatting := Formatting + Format(SBackColor, [ColorToTeX(Background)]);
+      Inc(BracketCount);
+    end;
+    Result := Format(NewCommand, [MakeValidName(UniqueAttriName), Formatting,
+      StringOfChar('}', BracketCount)])
+  end;
+end;
+
+function TSynExporterTeX.CommandNameCallback(
+  Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes;
+  UniqueAttriName: string; Params: array of Pointer): Boolean;
+var
+  AttriToFind: TSynHighlighterAttributes;
+  CommandName: ^string;
+begin
+  AttriToFind := Params[0];
+  CommandName := Params[1];
+
+  if Attri = AttriToFind then
+  begin
+    CommandName^ := MakeValidName(UniqueAttriName);
+    Result := False; // found => inform EnumHighlighterAttris to stop searching
+  end
+  else
+    Result := True;
+end;
+
+procedure TSynExporterTeX.FormatToken(Token: UnicodeString);
+var
+  CommandName: string;
+begin
+  CommandName := GetCommandName(Highlighter, FLastAttri);
+  AddData('\' + CommandName + '{' + Token + '}');
+end;
+
+procedure TSynExporterTeX.FormatNewLine;
+begin
+  AddData('\\' + SLineBreak);
+end;
+
+// do nothing with these
+procedure TSynExporterTeX.FormatAfterLastAttribute;
+begin
+end;
+
+procedure TSynExporterTeX.FormatAttributeDone;
+begin
+end;
+
+procedure TSynExporterTeX.FormatAttributeInit;
+begin
+end;
+
+procedure TSynExporterTeX.FormatBeforeFirstAttribute;
+begin
+end;
+
+function TSynExporterTeX.GetCommandName(Highlighter: TSynCustomHighlighter;
+  Attri: TSynHighlighterAttributes): string;
+begin
+  EnumHighlighterAttris(Highlighter, False, CommandNameCallback, [Attri, @Result]);
+end;
+
+function TSynExporterTeX.GetFooter: UnicodeString;
+begin
+  if not FCreateTeXFragment then
+    Result := SLineBreak + '\end{ttfamily}' + SLineBreak + '\end{document}'
+  else
+    Result := SLineBreak + '\end{ttfamily}';
+end;
+
+function TSynExporterTeX.GetFormatName: string;
+begin
+  Result := SYNS_ExporterFormatTeX;
+end;
+
+function TSynExporterTeX.GetHeader: UnicodeString;
+const
+  TeXHeader   = '\documentclass[a4paper, %dpt]{article}' + SLineBreak +
+                '\usepackage[a4paper, margin=%dcm]{geometry}' + SLineBreak +
+                '\usepackage[T1]{fontenc}' + SLineBreak +
+                '\usepackage{color}' + SLineBreak +
+                '\usepackage{alltt}' + SLineBreak +
+                '\usepackage{times}' + SLineBreak +
+                '\usepackage{ulem}' + SLineBreak +
+{$IFDEF WIN32}
+                // It is recommennded to use AnsiNew on Windows
+                '\usepackage[ansinew]{inputenc}' + SLineBreak +
+{$ELSE}
+                // and Latin1 on UNIX Systems, see also DE FAQ 8.5.3
+                '\usepackage[latin1]{inputenc}' + SLineBreak +
+{$ENDIF}
+                '%s' + SLineBreak; // New Commands
+  TeXHeader2  = '%% Generated by SynEdit TeX exporter' + SLineBreak + SLineBreak +
+                '\begin{document}';
+  EmptyPage   = '\pagestyle{empty}';
+  TeXDocument = '\begin{ttfamily}' + SLineBreak +
+                '\noindent' + SLineBreak;
+var
+  PageStyle: string;
+begin
+  if not FCreateTeXFragment then
+  begin
+    if FPageStyleEmpty then
+      PageStyle := SLineBreak + EmptyPage
+    else
+      PageStyle := '';
+    Result := Format(TeXHeader + SLineBreak + SLineBreak,
+      [Font.Size, FMargin, GetNewCommands]);
+    Result := Result + '\title{' + Title + '}' + SLineBreak + TeXHeader2 +
+      SLineBreak + PageStyle;
+  end;
+  Result := Result + TeXDocument;
+end;
+
+function TSynExporterTeX.GetNewCommands: string;
+const
+  FixedCommands = '%% Special Characters' + SLineBreak +
+                  '\newcommand\SPC{\hspace*{0.6em}}' + SLineBreak +
+                  '\newcommand\TAB{\hspace*{%sem}}' + SLineBreak +
+                  '\newcommand\BS{\mbox{\char 92}}' + SLineBreak +   // Backslash
+                  '\newcommand\TLD{\mbox{\char 126}}' + SLineBreak + // ~
+                  '\newcommand\CIR{\mbox{\char 94}}' + SLineBreak  + // ^
+                  '\newcommand\HYP{\mbox{\char 45}}' + SLineBreak  + // a simple -
+                  '\newcommand\QOT{\mbox{\char 34}}' + SLineBreak  + // "
+                  '\newcommand{\uln}[1]{\bgroup \markoverwith{\hbox{\_}}\ULon{{#1}}}' + SLineBreak +
+                  '%% Highlighter Attributes' + SLineBreak;
+  f = '%1.1g';
+var
+  tw: string;
+  Commands: string;
+begin
+  tw := DotDecSepFormat(f, [FTabWidth * 0.6]);
+  Result := Format(FixedCommands, [tw]);
+
+  EnumHighlighterAttris(Highlighter, True, AttriToCommandCallback, [@Commands]);
+  Result := Result + Commands;
+end;
+
+function TSynExporterTeX.MakeValidName(Name: string): string;
+var
+  i: Integer;
+begin
+  Result := Name;
+  
+  for i := Length(Result) downto 1 do
+  if CharInSet(Result[i], ['1'..'9']) then
+    Result[i] := Char(Ord('A') + Ord(Result[i]) - Ord('1'))
+  else if Result[i] = '0' then
+    Result[i] := 'Z'
+  else if not CharInSet(Result[i], ['a'..'z', 'A'..'Z']) then
+    Delete(Result, i, 1);
+end;
+
+function TSynExporterTeX.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+begin
+  case AChar of
+    '{': Result := '\{';
+    '}': Result := '\}';
+    '\': Result := '\BS ';
+    '~': Result := '\TLD ';
+    '^': Result := '\CIR ';
+    ' ': Result := '\SPC ';
+    #9: Result := '\TAB ';
+    '-': Result := '\HYP ';
+    '"': Result := '\QOT ';
+    '@': Result := '$@$';
+    '$': Result := '\$';
+    '&': Result := '\&';
+    '<': Result := '$<$';
+    '>': Result := '$>$';
+    '_': Result := '\_';
+    '#': Result := '\#';
+    '%': Result := '\%';
+    else Result := '';
+  end;
+end;
+
+procedure TSynExporterTeX.SetTokenAttribute(Attri: TSynHighlighterAttributes);
+begin
+  FLastAttri := Attri;
+end;
+
+function TSynExporterTeX.SupportedEncodings: TSynEncodings;
+begin
+  Result := [seAnsi];
+end;
+
+function TSynExporterTeX.UseBom: Boolean;
+begin
+  Result := False;
+end;
+
+end.
+
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterADSP21xx.pas b/Source/VCL/SynEdit/Source/SynHighlighterADSP21xx.pas
index d8934ce9..8d0ea515 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterADSP21xx.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterADSP21xx.pas
@@ -1,2625 +1,2643 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterADSP21xx.pas, released 2000-04-17.
-The Original Code is based on the wbADSP21xxSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Wynand Breytenbach.
-Unicode translation by Maël Hörz.
-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: SynHighlighterADSP21xx.pas,v 1.16.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a ADSP21xx highlighter for SynEdit)
-@author(Wynand Breytenbach, converted to SynEdit by David Muir )
-@created(1999)
-@lastmod(2000-06-23)
-The SynHighlighterADSP21xx unit provides a ADSP21xx DSP assembler highlighter for SynEdit.
-}
-
-unit SynHighlighterADSP21xx;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkCondition, tkIdentifier, tkKey, tkNull, tkNumber,
-    tkRegister, tkSpace, tkString, tkSymbol, tkUnknown);
-
-  TRangeState = (rsUnKnown, rsPascalComment, rsCComment, rsHexNumber,
-    rsBinaryNumber, rsInclude);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynADSP21xxSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fIdentFuncTable: array[0..820] of TIdentFuncTableFunc;
-    FTokenID: TtkTokenKind;
-    fNumberAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fRegisterAttri: TSynHighlighterAttributes;
-    fConditionAttri: TSynHighlighterAttributes;
-    fNullAttri: TSynHighlighterAttributes;
-    fUnknownAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncAbs(Index: Integer): TtkTokenKind;
-    function FuncAbstract(Index: Integer): TtkTokenKind;
-    function FuncAc(Index: Integer): TtkTokenKind;
-    function FuncAf(Index: Integer): TtkTokenKind;
-    function FuncAlt95reg(Index: Integer): TtkTokenKind;
-    function FuncAnd(Index: Integer): TtkTokenKind;
-    function FuncAr(Index: Integer): TtkTokenKind;
-    function FuncAr95sat(Index: Integer): TtkTokenKind;
-    function FuncAshift(Index: Integer): TtkTokenKind;
-    function FuncAstat(Index: Integer): TtkTokenKind;
-    function FuncAux(Index: Integer): TtkTokenKind;
-    function FuncAv(Index: Integer): TtkTokenKind;
-    function FuncAv95latch(Index: Integer): TtkTokenKind;
-    function FuncAx0(Index: Integer): TtkTokenKind;
-    function FuncAx1(Index: Integer): TtkTokenKind;
-    function FuncAy0(Index: Integer): TtkTokenKind;
-    function FuncAy1(Index: Integer): TtkTokenKind;
-    function FuncB(Index: Integer): TtkTokenKind;
-    function FuncBit95rev(Index: Integer): TtkTokenKind;
-    function FuncBm(Index: Integer): TtkTokenKind;
-    function FuncBoot(Index: Integer): TtkTokenKind;
-    function FuncBy(Index: Integer): TtkTokenKind;
-    function FuncCache(Index: Integer): TtkTokenKind;
-    function FuncCall(Index: Integer): TtkTokenKind;
-    function FuncCe(Index: Integer): TtkTokenKind;
-    function FuncCirc(Index: Integer): TtkTokenKind;
-    function FuncClear(Index: Integer): TtkTokenKind;
-    function FuncClr(Index: Integer): TtkTokenKind;
-    function FuncClrbit(Index: Integer): TtkTokenKind;
-    function FuncCntl(Index: Integer): TtkTokenKind;
-    function FuncCntr(Index: Integer): TtkTokenKind;
-    function FuncConst(Index: Integer): TtkTokenKind;
-    function FuncDefine(Index: Integer): TtkTokenKind;
-    function FuncDis(Index: Integer): TtkTokenKind;
-    function FuncDivq(Index: Integer): TtkTokenKind;
-    function FuncDivs(Index: Integer): TtkTokenKind;
-    function FuncDm(Index: Integer): TtkTokenKind;
-    function FuncDmovlay(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncEmode(Index: Integer): TtkTokenKind;
-    function FuncEna(Index: Integer): TtkTokenKind;
-    function FuncEndif(Index: Integer): TtkTokenKind;
-    function FuncEndmacro(Index: Integer): TtkTokenKind;
-    function FuncEndmod(Index: Integer): TtkTokenKind;
-    function FuncEntry(Index: Integer): TtkTokenKind;
-    function FuncEq(Index: Integer): TtkTokenKind;
-    function FuncExp(Index: Integer): TtkTokenKind;
-    function FuncExpadj(Index: Integer): TtkTokenKind;
-    function FuncExternal(Index: Integer): TtkTokenKind;
-    function FuncFl0(Index: Integer): TtkTokenKind;
-    function FuncFl1(Index: Integer): TtkTokenKind;
-    function FuncFl2(Index: Integer): TtkTokenKind;
-    function FuncFlag95in(Index: Integer): TtkTokenKind;
-    function FuncFlag95out(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncForever(Index: Integer): TtkTokenKind;
-    function FuncGe(Index: Integer): TtkTokenKind;
-    function FuncGlobal(Index: Integer): TtkTokenKind;
-    function FuncGo95mode(Index: Integer): TtkTokenKind;
-    function FuncGt(Index: Integer): TtkTokenKind;
-    function FuncH(Index: Integer): TtkTokenKind;
-    function FuncHi(Index: Integer): TtkTokenKind;
-    function FuncI0(Index: Integer): TtkTokenKind;
-    function FuncI1(Index: Integer): TtkTokenKind;
-    function FuncI2(Index: Integer): TtkTokenKind;
-    function FuncI3(Index: Integer): TtkTokenKind;
-    function FuncI4(Index: Integer): TtkTokenKind;
-    function FuncI5(Index: Integer): TtkTokenKind;
-    function FuncI6(Index: Integer): TtkTokenKind;
-    function FuncI7(Index: Integer): TtkTokenKind;
-    function FuncIcntl(Index: Integer): TtkTokenKind;
-    function FuncIdle(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncIfc(Index: Integer): TtkTokenKind;
-    function FuncIfdef(Index: Integer): TtkTokenKind;
-    function FuncIfndef(Index: Integer): TtkTokenKind;
-    function FuncImask(Index: Integer): TtkTokenKind;
-    function FuncIn(Index: Integer): TtkTokenKind;
-    function FuncInclude(Index: Integer): TtkTokenKind;
-    function FuncInit(Index: Integer): TtkTokenKind;
-    function FuncIo(Index: Integer): TtkTokenKind;
-    function FuncJump(Index: Integer): TtkTokenKind;
-    function FuncL0(Index: Integer): TtkTokenKind;
-    function FuncL1(Index: Integer): TtkTokenKind;
-    function FuncL2(Index: Integer): TtkTokenKind;
-    function FuncL3(Index: Integer): TtkTokenKind;
-    function FuncL4(Index: Integer): TtkTokenKind;
-    function FuncL5(Index: Integer): TtkTokenKind;
-    function FuncL6(Index: Integer): TtkTokenKind;
-    function FuncL7(Index: Integer): TtkTokenKind;
-    function FuncLe(Index: Integer): TtkTokenKind;
-    function FuncLo(Index: Integer): TtkTokenKind;
-    function FuncLocal(Index: Integer): TtkTokenKind;
-    function FuncLoop(Index: Integer): TtkTokenKind;
-    function FuncLshift(Index: Integer): TtkTokenKind;
-    function FuncLt(Index: Integer): TtkTokenKind;
-    function FuncM95mode(Index: Integer): TtkTokenKind;
-    function FuncM0(Index: Integer): TtkTokenKind;
-    function FuncM1(Index: Integer): TtkTokenKind;
-    function FuncM2(Index: Integer): TtkTokenKind;
-    function FuncM3(Index: Integer): TtkTokenKind;
-    function FuncM4(Index: Integer): TtkTokenKind;
-    function FuncM5(Index: Integer): TtkTokenKind;
-    function FuncM6(Index: Integer): TtkTokenKind;
-    function FuncM7(Index: Integer): TtkTokenKind;
-    function FuncMacro(Index: Integer): TtkTokenKind;
-    function FuncMf(Index: Integer): TtkTokenKind;
-    function FuncModify(Index: Integer): TtkTokenKind;
-    function FuncModule(Index: Integer): TtkTokenKind;
-    function FuncMr(Index: Integer): TtkTokenKind;
-    function FuncMr0(Index: Integer): TtkTokenKind;
-    function FuncMr1(Index: Integer): TtkTokenKind;
-    function FuncMr2(Index: Integer): TtkTokenKind;
-    function FuncMstat(Index: Integer): TtkTokenKind;
-    function FuncMv(Index: Integer): TtkTokenKind;
-    function FuncMx0(Index: Integer): TtkTokenKind;
-    function FuncMx1(Index: Integer): TtkTokenKind;
-    function FuncMy0(Index: Integer): TtkTokenKind;
-    function FuncMy1(Index: Integer): TtkTokenKind;
-    function FuncName(Index: Integer): TtkTokenKind;
-    function FuncNe(Index: Integer): TtkTokenKind;
-    function FuncNeg(Index: Integer): TtkTokenKind;
-    function FuncNewpage(Index: Integer): TtkTokenKind;
-    function FuncNop(Index: Integer): TtkTokenKind;
-    function FuncNorm(Index: Integer): TtkTokenKind;
-    function FuncNot(Index: Integer): TtkTokenKind;
-    function FuncOf(Index: Integer): TtkTokenKind;
-    function FuncOr(Index: Integer): TtkTokenKind;
-    function FuncPass(Index: Integer): TtkTokenKind;
-    function FuncPc(Index: Integer): TtkTokenKind;
-    function FuncPm(Index: Integer): TtkTokenKind;
-    function FuncPop(Index: Integer): TtkTokenKind;
-    function FuncPort(Index: Integer): TtkTokenKind;
-    function FuncPush(Index: Integer): TtkTokenKind;
-    function FuncRam(Index: Integer): TtkTokenKind;
-    function FuncRegbank(Index: Integer): TtkTokenKind;
-    function FuncReset(Index: Integer): TtkTokenKind;
-    function FuncRnd(Index: Integer): TtkTokenKind;
-    function FuncRom(Index: Integer): TtkTokenKind;
-    function FuncRti(Index: Integer): TtkTokenKind;
-    function FuncRts(Index: Integer): TtkTokenKind;
-    function FuncRx0(Index: Integer): TtkTokenKind;
-    function FuncRx1(Index: Integer): TtkTokenKind;
-    function FuncSat(Index: Integer): TtkTokenKind;
-    function FuncSb(Index: Integer): TtkTokenKind;
-    function FuncSec95reg(Index: Integer): TtkTokenKind;
-    function FuncSeg(Index: Integer): TtkTokenKind;
-    function FuncSegment(Index: Integer): TtkTokenKind;
-    function FuncSet(Index: Integer): TtkTokenKind;
-    function FuncSetbit(Index: Integer): TtkTokenKind;
-    function FuncShift(Index: Integer): TtkTokenKind;
-    function FuncShl(Index: Integer): TtkTokenKind;
-    function FuncShr(Index: Integer): TtkTokenKind;
-    function FuncSi(Index: Integer): TtkTokenKind;
-    function FuncSr(Index: Integer): TtkTokenKind;
-    function FuncSr0(Index: Integer): TtkTokenKind;
-    function FuncSr1(Index: Integer): TtkTokenKind;
-    function FuncSs(Index: Integer): TtkTokenKind;
-    function FuncSstat(Index: Integer): TtkTokenKind;
-    function FuncStatic(Index: Integer): TtkTokenKind;
-    function FuncSts(Index: Integer): TtkTokenKind;
-    function FuncSu(Index: Integer): TtkTokenKind;
-    function FuncTest(Index: Integer): TtkTokenKind;
-    function FuncTestbit(Index: Integer): TtkTokenKind;
-    function FuncTglbit(Index: Integer): TtkTokenKind;
-    function FuncTimer(Index: Integer): TtkTokenKind;
-    function FuncToggle(Index: Integer): TtkTokenKind;
-    function FuncTopofpcstack(Index: Integer): TtkTokenKind;
-    function FuncTrap(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncTx0(Index: Integer): TtkTokenKind;
-    function FuncTx1(Index: Integer): TtkTokenKind;
-    function FuncUndef(Index: Integer): TtkTokenKind;
-    function FuncUntil(Index: Integer): TtkTokenKind;
-    function FuncUs(Index: Integer): TtkTokenKind;
-    function FuncUu(Index: Integer): TtkTokenKind;
-    function FuncVar(Index: Integer): TtkTokenKind;
-    function FuncXor(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure PascalCommentProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CCommentProc;
-    procedure CRProc;
-    procedure ExclamationProc;
-    procedure IdentProc;
-    procedure IntegerProc;
-    procedure IncludeCloseProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure BinaryNumber;
-    procedure HexNumber;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetCapabilities: TSynHighlighterCapabilities; override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    function UseUserSettings(settingIndex: integer): boolean; override;
-    procedure EnumUserSettings(settings: TStrings); override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property ConditionAttri: TSynHighlighterAttributes read fConditionAttri
-      write fConditionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property RegisterAttri: TSynHighlighterAttributes read fRegisterAttri
-      write fRegisterAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-  end;
-
-implementation
-
-uses
-  Windows,
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..178] of string = (
-    'abs', 'abstract', 'ac', 'af', 'alt_reg', 'and', 'ar', 'ar_sat', 'ashift', 
-    'astat', 'aux', 'av', 'av_latch', 'ax0', 'ax1', 'ay0', 'ay1', 'b', 
-    'bit_rev', 'bm', 'boot', 'by', 'cache', 'call', 'ce', 'circ', 'clear', 
-    'clr', 'clrbit', 'cntl', 'cntr', 'const', 'define', 'dis', 'divq', 'divs', 
-    'dm', 'dmovlay', 'do', 'else', 'emode', 'ena', 'endif', 'endmacro', 
-    'endmod', 'entry', 'eq', 'exp', 'expadj', 'external', 'fl0', 'fl1', 'fl2', 
-    'flag_in', 'flag_out', 'for', 'forever', 'ge', 'global', 'go_mode', 'gt', 
-    'h', 'hi', 'i0', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'icntl', 'idle', 
-    'if', 'ifc', 'ifdef', 'ifndef', 'imask', 'in', 'include', 'init', 'io', 
-    'jump', 'l0', 'l1', 'l2', 'l3', 'l4', 'l5', 'l6', 'l7', 'le', 'lo', 'local', 
-    'loop', 'lshift', 'lt', 'm_mode', 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 
-    'm7', 'macro', 'mf', 'modify', 'module', 'mr', 'mr0', 'mr1', 'mr2', 'mstat', 
-    'mv', 'mx0', 'mx1', 'my0', 'my1', 'name', 'ne', 'neg', 'newpage', 'nop', 
-    'norm', 'not', 'of', 'or', 'pass', 'pc', 'pm', 'pop', 'port', 'push', 'ram', 
-    'regbank', 'reset', 'rnd', 'rom', 'rti', 'rts', 'rx0', 'rx1', 'sat', 'sb', 
-    'sec_reg', 'seg', 'segment', 'set', 'setbit', 'shift', 'shl', 'shr', 'si', 
-    'sr', 'sr0', 'sr1', 'ss', 'sstat', 'static', 'sts', 'su', 'test', 'testbit', 
-    'tglbit', 'timer', 'toggle', 'topofpcstack', 'trap', 'true', 'tx0', 'tx1', 
-    'undef', 'until', 'us', 'uu', 'var', 'xor' 
-  );
-
-  KeyIndices: array[0..820] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 
-    15, -1, 48, 100, 132, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, 
-    152, 93, 155, -1, -1, -1, 70, 62, -1, -1, 103, 0, -1, -1, 10, -1, -1, -1, 
-    -1, -1, -1, 171, -1, -1, -1, -1, 120, 162, -1, -1, -1, -1, -1, 82, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, -1, -1, 50, 
-    -1, -1, -1, -1, -1, -1, 72, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, 25, -1, -1, -1, 8, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 156, 83, -1, -1, -1, -1, -1, 77, 106, -1, 45, 27, 
-    -1, -1, -1, -1, -1, 7, -1, -1, 43, -1, 74, 14, 174, 73, 86, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, 111, -1, -1, 140, -1, 
-    -1, -1, 89, -1, -1, -1, -1, 127, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 116, -1, 49, -1, -1, 164, 23, -1, -1, 9, -1, -1, 
-    -1, -1, 149, -1, -1, -1, 40, -1, -1, 46, -1, 94, -1, 81, -1, 134, -1, -1, 
-    -1, -1, -1, -1, -1, 55, -1, 47, -1, -1, -1, -1, 11, -1, 135, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, 65, 142, -1, 
-    -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, 
-    -1, 18, -1, 68, 16, -1, -1, 101, 91, -1, -1, -1, 130, -1, 167, -1, -1, -1, 
-    115, -1, -1, -1, -1, 19, 158, -1, 163, -1, -1, -1, -1, -1, 104, -1, -1, -1, 
-    -1, -1, -1, -1, 39, -1, 79, 172, -1, -1, -1, -1, 41, -1, 38, 176, 80, -1, 
-    -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 
-    75, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, 
-    -1, -1, 42, -1, -1, -1, -1, -1, -1, 58, -1, -1, 136, -1, -1, -1, -1, -1, -1, 
-    177, -1, -1, -1, -1, -1, -1, -1, 57, -1, 157, 84, 21, -1, -1, -1, -1, -1, 1, 
-    -1, -1, -1, 96, 161, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, 
-    -1, -1, -1, 54, 137, -1, -1, 124, 145, -1, -1, -1, -1, -1, -1, -1, -1, 112, 
-    -1, -1, 173, -1, -1, -1, 90, -1, 125, -1, 166, -1, -1, -1, -1, 144, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, 170, -1, -1, 
-    35, -1, -1, -1, -1, -1, -1, -1, 148, -1, 44, -1, -1, -1, -1, 159, -1, -1, 
-    -1, -1, -1, 150, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, 
-    178, -1, -1, -1, 141, 60, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 66, 143, -1, -1, 99, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 37, -1, -1, 26, -1, -1, 69, -1, -1, -1, 102, -1, -1, 121, -1, 
-    -1, -1, 61, 129, 95, -1, -1, -1, 122, -1, 139, -1, -1, 36, 175, -1, -1, -1, 
-    -1, -1, 105, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 32, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, 2, -1, -1, 165, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, 92, -1, 147, 
-    -1, 131, 3, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 13, -1, -1, 85, 59, 
-    -1, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 88, -1, -1, 107, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, 
-    -1, -1, -1, -1, 113, 151, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, 34, 29, 
-    169, 126, 114, -1, -1, 22, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, 78, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, 5, 30, -1, -1, -1, -1, -1, -1, 
-    64, -1, -1, -1, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynADSP21xxSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 641 + Ord(Str^) * 282;
-    inc(Str);
-  end;
-  Result := Result mod 821;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynADSP21xxSyn.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 TSynADSP21xxSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[48] := FuncAbs;
-  fIdentFuncTable[426] := FuncAbstract;
-  fIdentFuncTable[642] := FuncAc;
-  fIdentFuncTable[667] := FuncAf;
-  fIdentFuncTable[693] := FuncAlt95reg;
-  fIdentFuncTable[806] := FuncAnd;
-  fIdentFuncTable[767] := FuncAr;
-  fIdentFuncTable[153] := FuncAr95sat;
-  fIdentFuncTable[126] := FuncAshift;
-  fIdentFuncTable[220] := FuncAstat;
-  fIdentFuncTable[51] := FuncAux;
-  fIdentFuncTable[253] := FuncAv;
-  fIdentFuncTable[99] := FuncAv95latch;
-  fIdentFuncTable[698] := FuncAx0;
-  fIdentFuncTable[159] := FuncAx1;
-  fIdentFuncTable[19] := FuncAy0;
-  fIdentFuncTable[301] := FuncAy1;
-  fIdentFuncTable[543] := FuncB;
-  fIdentFuncTable[298] := FuncBit95rev;
-  fIdentFuncTable[320] := FuncBm;
-  fIdentFuncTable[118] := FuncBoot;
-  fIdentFuncTable[420] := FuncBy;
-  fIdentFuncTable[763] := FuncCache;
-  fIdentFuncTable[217] := FuncCall;
-  fIdentFuncTable[669] := FuncCe;
-  fIdentFuncTable[122] := FuncCirc;
-  fIdentFuncTable[579] := FuncClear;
-  fIdentFuncTable[147] := FuncClr;
-  fIdentFuncTable[196] := FuncClrbit;
-  fIdentFuncTable[757] := FuncCntl;
-  fIdentFuncTable[807] := FuncCntr;
-  fIdentFuncTable[525] := FuncConst;
-  fIdentFuncTable[629] := FuncDefine;
-  fIdentFuncTable[715] := FuncDis;
-  fIdentFuncTable[756] := FuncDivq;
-  fIdentFuncTable[499] := FuncDivs;
-  fIdentFuncTable[604] := FuncDm;
-  fIdentFuncTable[576] := FuncDmovlay;
-  fIdentFuncTable[347] := FuncDo;
-  fIdentFuncTable[337] := FuncElse;
-  fIdentFuncTable[229] := FuncEmode;
-  fIdentFuncTable[345] := FuncEna;
-  fIdentFuncTable[391] := FuncEndif;
-  fIdentFuncTable[156] := FuncEndmacro;
-  fIdentFuncTable[509] := FuncEndmod;
-  fIdentFuncTable[146] := FuncEntry;
-  fIdentFuncTable[232] := FuncEq;
-  fIdentFuncTable[248] := FuncExp;
-  fIdentFuncTable[21] := FuncExpadj;
-  fIdentFuncTable[213] := FuncExternal;
-  fIdentFuncTable[91] := FuncFl0;
-  fIdentFuncTable[373] := FuncFl1;
-  fIdentFuncTable[655] := FuncFl2;
-  fIdentFuncTable[750] := FuncFlag95in;
-  fIdentFuncTable[448] := FuncFlag95out;
-  fIdentFuncTable[246] := FuncFor;
-  fIdentFuncTable[175] := FuncForever;
-  fIdentFuncTable[416] := FuncGe;
-  fIdentFuncTable[398] := FuncGlobal;
-  fIdentFuncTable[702] := FuncGo95mode;
-  fIdentFuncTable[541] := FuncGt;
-  fIdentFuncTable[593] := FuncH;
-  fIdentFuncTable[44] := FuncHi;
-  fIdentFuncTable[532] := FuncI0;
-  fIdentFuncTable[814] := FuncI1;
-  fIdentFuncTable[275] := FuncI2;
-  fIdentFuncTable[557] := FuncI3;
-  fIdentFuncTable[18] := FuncI4;
-  fIdentFuncTable[300] := FuncI5;
-  fIdentFuncTable[582] := FuncI6;
-  fIdentFuncTable[43] := FuncI7;
-  fIdentFuncTable[369] := FuncIcntl;
-  fIdentFuncTable[98] := FuncIdle;
-  fIdentFuncTable[161] := FuncIf;
-  fIdentFuncTable[158] := FuncIfc;
-  fIdentFuncTable[370] := FuncIfdef;
-  fIdentFuncTable[800] := FuncIfndef;
-  fIdentFuncTable[143] := FuncImask;
-  fIdentFuncTable[775] := FuncIn;
-  fIdentFuncTable[339] := FuncInclude;
-  fIdentFuncTable[349] := FuncInit;
-  fIdentFuncTable[236] := FuncIo;
-  fIdentFuncTable[70] := FuncJump;
-  fIdentFuncTable[137] := FuncL0;
-  fIdentFuncTable[419] := FuncL1;
-  fIdentFuncTable[701] := FuncL2;
-  fIdentFuncTable[162] := FuncL3;
-  fIdentFuncTable[444] := FuncL4;
-  fIdentFuncTable[726] := FuncL5;
-  fIdentFuncTable[187] := FuncL6;
-  fIdentFuncTable[469] := FuncL7;
-  fIdentFuncTable[305] := FuncLe;
-  fIdentFuncTable[662] := FuncLo;
-  fIdentFuncTable[38] := FuncLocal;
-  fIdentFuncTable[234] := FuncLoop;
-  fIdentFuncTable[595] := FuncLshift;
-  fIdentFuncTable[430] := FuncLt;
-  fIdentFuncTable[564] := FuncM95mode;
-  fIdentFuncTable[279] := FuncM0;
-  fIdentFuncTable[561] := FuncM1;
-  fIdentFuncTable[22] := FuncM2;
-  fIdentFuncTable[304] := FuncM3;
-  fIdentFuncTable[586] := FuncM4;
-  fIdentFuncTable[47] := FuncM5;
-  fIdentFuncTable[329] := FuncM6;
-  fIdentFuncTable[611] := FuncM7;
-  fIdentFuncTable[144] := FuncMacro;
-  fIdentFuncTable[729] := FuncMf;
-  fIdentFuncTable[617] := FuncModify;
-  fIdentFuncTable[268] := FuncModule;
-  fIdentFuncTable[8] := FuncMr;
-  fIdentFuncTable[180] := FuncMr0;
-  fIdentFuncTable[462] := FuncMr1;
-  fIdentFuncTable[744] := FuncMr2;
-  fIdentFuncTable[760] := FuncMstat;
-  fIdentFuncTable[315] := FuncMv;
-  fIdentFuncTable[211] := FuncMx0;
-  fIdentFuncTable[493] := FuncMx1;
-  fIdentFuncTable[353] := FuncMy0;
-  fIdentFuncTable[635] := FuncMy1;
-  fIdentFuncTable[63] := FuncName;
-  fIdentFuncTable[589] := FuncNe;
-  fIdentFuncTable[599] := FuncNeg;
-  fIdentFuncTable[434] := FuncNewpage;
-  fIdentFuncTable[452] := FuncNop;
-  fIdentFuncTable[471] := FuncNorm;
-  fIdentFuncTable[759] := FuncNot;
-  fIdentFuncTable[192] := FuncOf;
-  fIdentFuncTable[292] := FuncOr;
-  fIdentFuncTable[594] := FuncPass;
-  fIdentFuncTable[309] := FuncPc;
-  fIdentFuncTable[666] := FuncPm;
-  fIdentFuncTable[23] := FuncPop;
-  fIdentFuncTable[29] := FuncPort;
-  fIdentFuncTable[238] := FuncPush;
-  fIdentFuncTable[255] := FuncRam;
-  fIdentFuncTable[401] := FuncRegbank;
-  fIdentFuncTable[449] := FuncReset;
-  fIdentFuncTable[384] := FuncRnd;
-  fIdentFuncTable[601] := FuncRom;
-  fIdentFuncTable[183] := FuncRti;
-  fIdentFuncTable[540] := FuncRts;
-  fIdentFuncTable[276] := FuncRx0;
-  fIdentFuncTable[558] := FuncRx1;
-  fIdentFuncTable[478] := FuncSat;
-  fIdentFuncTable[453] := FuncSb;
-  fIdentFuncTable[705] := FuncSec95reg;
-  fIdentFuncTable[664] := FuncSeg;
-  fIdentFuncTable[507] := FuncSegment;
-  fIdentFuncTable[225] := FuncSet;
-  fIdentFuncTable[520] := FuncSetbit;
-  fIdentFuncTable[745] := FuncShift;
-  fIdentFuncTable[37] := FuncShl;
-  fIdentFuncTable[87] := FuncShr;
-  fIdentFuncTable[785] := FuncSi;
-  fIdentFuncTable[39] := FuncSr;
-  fIdentFuncTable[136] := FuncSr0;
-  fIdentFuncTable[418] := FuncSr1;
-  fIdentFuncTable[321] := FuncSs;
-  fIdentFuncTable[514] := FuncSstat;
-  fIdentFuncTable[736] := FuncStatic;
-  fIdentFuncTable[431] := FuncSts;
-  fIdentFuncTable[64] := FuncSu;
-  fIdentFuncTable[323] := FuncTest;
-  fIdentFuncTable[216] := FuncTestbit;
-  fIdentFuncTable[645] := FuncTglbit;
-  fIdentFuncTable[473] := FuncTimer;
-  fIdentFuncTable[311] := FuncToggle;
-  fIdentFuncTable[683] := FuncTopofpcstack;
-  fIdentFuncTable[758] := FuncTrap;
-  fIdentFuncTable[496] := FuncTrue;
-  fIdentFuncTable[58] := FuncTx0;
-  fIdentFuncTable[340] := FuncTx1;
-  fIdentFuncTable[465] := FuncUndef;
-  fIdentFuncTable[160] := FuncUntil;
-  fIdentFuncTable[605] := FuncUs;
-  fIdentFuncTable[348] := FuncUu;
-  fIdentFuncTable[408] := FuncVar;
-  fIdentFuncTable[536] := FuncXor;
-end;
-
-function TSynADSP21xxSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier
-end;
-
-function TSynADSP21xxSyn.FuncAbs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAbstract(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAlt95reg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAnd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAr95sat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAshift(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAstat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAux(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAv(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAv95latch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAx0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAx1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAy0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncAy1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncB(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if FLine[Run + 1] = '#' then
-    begin
-      Result := tkNumber;
-      fRange := rsBinaryNumber;
-    end
-    else
-    begin
-      Result := tkIdentifier;
-    end
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncBit95rev(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncBm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncBoot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncBy(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCache(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCall(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCirc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncClear(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncClr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncClrbit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCntl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncCntr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncConst(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDefine(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDis(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDivq(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDivs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDmovlay(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncDo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEmode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEna(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEndif(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEndmacro(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEndmod(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEntry(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncEq(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncExp(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncExpadj(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncExternal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFl0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFl1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFl2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFlag95in(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFlag95out(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncFor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncForever(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncGe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncGlobal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncGo95mode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncGt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncH(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if FLine[Run + 1] = '#' then
-    begin
-      Result := tkNumber;
-      fRange := rsHexNumber;
-    end
-    else
-    begin
-      Result := tkIdentifier;
-    end
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncHi(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI3(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI4(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI5(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI6(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncI7(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIcntl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIdle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIfc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIfdef(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIfndef(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncImask(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncInclude(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncInit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncIo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncJump(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL3(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL4(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL5(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL6(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncL7(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLocal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLoop(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLshift(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncLt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM95mode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM3(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM4(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM5(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM6(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncM7(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMacro(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncModify(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncModule(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMr0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMr1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMr2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMstat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMv(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMx0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMx1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMy0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncMy1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncName(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNeg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNewpage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNop(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNorm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncNot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncOf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncOr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPass(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPop(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPort(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncPush(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRam(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRegbank(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncReset(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRnd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRom(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRti(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRts(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRx0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncRx1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSb(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSec95reg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSeg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSegment(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSet(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSetbit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncShift(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncShl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncShr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSi(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSr0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSr1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSstat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncStatic(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSts(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncSu(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTest(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTestbit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTglbit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTimer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncToggle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTopofpcstack(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTrap(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTrue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTx0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncTx1(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkRegister
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncUndef(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncUntil(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncUs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncUu(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkCondition
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncVar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynADSP21xxSyn.FuncXor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynADSP21xxSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.ForeGround := clTeal;
-  fCommentAttri.Style:= [fsItalic];
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  fNumberAttri.ForeGround := clOlive;
-  AddAttribute(fNumberAttri);
-
-  fRegisterAttri := TSynHighlighterAttributes.Create(SYNS_AttrRegister, SYNS_FriendlyAttrRegister);
-  fRegisterAttri.ForeGround := clBlue;
-  AddAttribute(fRegisterAttri);
-
-  fConditionAttri := TSynHighlighterAttributes.Create(SYNS_AttrCondition, SYNS_FriendlyAttrCondition);
-  fConditionAttri.ForeGround := clFuchsia;
-  AddAttribute(fConditionAttri);
-
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-
-  fNullAttri := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
-  AddAttribute(fNullAttri);
-
-  fUnknownAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
-  AddAttribute(fUnknownAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-
-  InitIdent;
-  fRange := rsUnknown;
-  fDefaultFilter := SYNS_FilterADSP21xx;
-end;
-
-procedure TSynADSP21xxSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynADSP21xxSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.PascalCommentProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '}':
-        begin
-          fRange := rsUnKnown;
-          inc(Run);
-          break;
-        end;
-      #10: break;
-      #13: break;
-      else inc(Run);
-    end;
-end;
-
-procedure TSynADSP21xxSyn.CCommentProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0: begin
-          NullProc;
-          exit;
-        end;
-    #10:begin
-         LFProc;
-         exit;
-        end;
-    #13:begin
-          CRProc;
-          exit;
-        end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        begin
-          if FLine[Run+1] = '/' then
-          begin
-            fRange := rsUnknown;
-            inc(Run, 2);
-            break;
-          end
-          else
-            Inc(Run);
-        end;
-      #10: break;
-      #13: break;
-      else inc(Run);
-    end;
-end;
-
-procedure TSynADSP21xxSyn.BraceOpenProc;
-begin
-  fTokenID := tkComment;
-  fRange := rsPascalComment;
-  inc(Run);
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '}':
-        begin
-          fRange := rsUnKnown;
-          inc(Run);
-          break;
-        end;
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-
-procedure TSynADSP21xxSyn.IncludeCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynADSP21xxSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Case FLine[Run + 1] of
-    #10: inc(Run, 2);
-  else inc(Run);
-  end;
-end;
-
-procedure TSynADSP21xxSyn.ExclamationProc;
-begin
-  fTokenID := tkComment;
-  repeat
-    inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynADSP21xxSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
-    inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.IntegerProc;
-
-  function IsIntegerChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsIntegerChar do inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', 'x', 'X', '.':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynADSP21xxSyn.HexNumber;
-
-  function IsHexChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  fRange := rsUnKnown;
-  while IsHexChar do
-  begin
-    inc(Run);
-  end;
-end;
-
-procedure TSynADSP21xxSyn.BinaryNumber;
-begin
-  inc(Run);
-  fRange := rsUnKnown;
-  while CharInSet(FLine[Run], ['0'..'1']) do
-  begin
-    inc(Run);
-  end;
-  if CharInSet(FLine[Run], ['2'..'9', 'A'..'F', 'a'..'f']) then
-  begin
-    fTokenID := tkIdentifier
-  end
-  else
-    fTokenID := tkNumber;
-end;
-
-procedure TSynADSP21xxSyn.SlashProc;
-begin
-  if FLine[Run + 1] = '*' then
-  begin
-    fTokenID := tkComment;
-    fRange := rsCComment;
-    inc(Run, 2);
-    while FLine[Run] <> #0 do
-      case FLine[Run] of
-        '*':  begin
-                if FLine[Run+1] = '/' then
-                begin
-                  inc(Run, 2);
-                  fRange := rsUnknown;
-                  break;
-                end
-                else inc(Run);
-              end;
-        #10: break;
-        #13: break;
-        else inc(Run);
-      end;
-    end
-  else
-  begin
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynADSP21xxSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynADSP21xxSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynADSP21xxSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsPascalComment: PascalCommentProc;
-    rsCComment: CCommentProc;
-    rsHexNumber: HexNumber;
-    rsBinaryNumber: BinaryNumber;
-  else
-    fRange := rsUnknown;
-    case fLine[Run] of
-      #0: NullProc;
-      #10: LFProc;
-      #13: CRProc;
-      #1..#9, #11, #12, #14..#32: SpaceProc;
-      '$': IntegerProc;
-      #39: StringProc;
-      '0'..'9': NumberProc;
-      'A'..'Z', 'a'..'z', '_': IdentProc;
-      '{': BraceOpenProc;
-      '}': BraceCloseProc;
-      '/': SlashProc;
-      '>': IncludeCloseProc;
-      '!': ExclamationProc;
-      else UnknownProc;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynADSP21xxSyn.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 TSynADSP21xxSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynADSP21xxSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynADSP21xxSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-function TSynADSP21xxSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkRegister: Result := fRegisterAttri;
-    tkCondition: Result := fConditionAttri;
-    tkUnknown: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynADSP21xxSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-procedure TSynADSP21xxSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynADSP21xxSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-procedure TSynADSP21xxSyn.EnumUserSettings(settings: TStrings);
-begin
-  { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
-  begin
-    try
-      RootKey := HKEY_CURRENT_USER;
-      // we need some method to make the following statement more universal!
-      if OpenKeyReadOnly('\SOFTWARE\Wynand\DSPIDE\1.0') then
-      begin
-        try
-          GetKeyNames(settings);
-        finally
-          CloseKey;
-        end;
-      end;
-    finally
-      Free;
-    end;
-  end;
-end;
-
-function TSynADSP21xxSyn.UseUserSettings(settingIndex: integer): boolean;
-// Possible parameter values:
-//   index into TStrings returned by EnumUserSettings
-// Possible return values:
-//   true : settings were read and used
-//   false: problem reading settings or invalid version specified - old settings
-//          were preserved
-
-    function ReadDspIDESetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean;
-    begin
-      try
-        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-               '\Software\Wynand\DspIDE\1.0\Editor\Highlight',key,false);
-      except Result := false; end;
-    end;
-var
-  tmpNumberAttri    : TSynHighlighterAttributes;
-  tmpKeyAttri       : TSynHighlighterAttributes;
-  tmpSymbolAttri    : TSynHighlighterAttributes;
-  tmpCommentAttri   : TSynHighlighterAttributes;
-  tmpConditionAttri : TSynHighlighterAttributes;
-  tmpIdentifierAttri: TSynHighlighterAttributes;
-  tmpSpaceAttri     : TSynHighlighterAttributes;
-  tmpRegisterAttri  : TSynHighlighterAttributes;
-  StrLst            : TStringList;
-
-begin  // UseUserSettings
-  StrLst := TStringList.Create;
-  try
-    EnumUserSettings(StrLst);
-    if settingIndex >= StrLst.Count then
-      Result := false
-    else
-    begin
-      tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
-      tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
-      tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
-      tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
-      tmpConditionAttri := TSynHighlighterAttributes.Create('', '');
-      tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
-      tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
-      tmpRegisterAttri  := TSynHighlighterAttributes.Create('', '');
-
-      tmpNumberAttri    .Assign(fNumberAttri);
-      tmpKeyAttri       .Assign(fKeyAttri);
-      tmpSymbolAttri    .Assign(fSymbolAttri);
-      tmpCommentAttri   .Assign(fCommentAttri);
-      tmpConditionAttri .Assign(fConditionAttri);
-      tmpIdentifierAttri.Assign(fIdentifierAttri);
-      tmpSpaceAttri     .Assign(fSpaceAttri);
-      tmpRegisterAttri  .Assign(fRegisterAttri);
-      Result := ReadDspIDESetting(StrLst[settingIndex],fCommentAttri,'Comment')       and
-                ReadDspIDESetting(StrLst[settingIndex],fIdentifierAttri,'Identifier') and
-                ReadDspIDESetting(StrLst[settingIndex],fKeyAttri,'Reserved word')     and
-                ReadDspIDESetting(StrLst[settingIndex],fNumberAttri,'BinaryNumber')   and
-                ReadDspIDESetting(StrLst[settingIndex],fSpaceAttri,'Whitespace')      and
-                ReadDspIDESetting(StrLst[settingIndex],fSymbolAttri,'Symbol')         and
-                ReadDspIDESetting(StrLst[settingIndex],fConditionAttri,'Condition')   and
-                ReadDspIDESetting(StrLst[settingIndex],fRegisterAttri,'Symbol');
-      if not Result then
-      begin
-        fNumberAttri     .Assign(tmpNumberAttri);
-        fKeyAttri        .Assign(tmpKeyAttri);
-        fSymbolAttri     .Assign(tmpSymbolAttri);
-        fCommentAttri    .Assign(tmpCommentAttri);
-        fConditionAttri  .Assign(tmpConditionAttri);
-        fIdentifierAttri .Assign(tmpIdentifierAttri);
-        fSpaceAttri      .Assign(tmpSpaceAttri);
-        fConditionAttri  .Assign(tmpConditionAttri);
-        fRegisterAttri   .Assign(tmpRegisterAttri);
-      end;
-      tmpNumberAttri    .Free;
-      tmpKeyAttri       .Free;
-      tmpSymbolAttri    .Free;
-      tmpCommentAttri   .Free;
-      tmpConditionAttri .Free;
-      tmpIdentifierAttri.Free;
-      tmpSpaceAttri     .Free;
-      tmpRegisterAttri  .Free;
-    end;
-  finally StrLst.Free; end;
-end;
-
-function TSynADSP21xxSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterADSP21xx;
-end;
-
-class function TSynADSP21xxSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangADSP21xx;
-end;
-
-class function TSynADSP21xxSyn.GetCapabilities: TSynHighlighterCapabilities;
-begin
-  Result := inherited GetCapabilities + [hcUserSettings];
-end;
-
-class function TSynADSP21xxSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangADSP21xx;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynADSP21xxSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterADSP21xx.pas, released 2000-04-17.
+The Original Code is based on the wbADSP21xxSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Wynand Breytenbach.
+Unicode translation by Maël Hörz.
+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: SynHighlighterADSP21xx.pas,v 1.16.2.7 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a ADSP21xx highlighter for SynEdit)
+@author(Wynand Breytenbach, converted to SynEdit by David Muir )
+@created(1999)
+@lastmod(2000-06-23)
+The SynHighlighterADSP21xx unit provides a ADSP21xx DSP assembler highlighter for SynEdit.
+}
+
+unit SynHighlighterADSP21xx;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkCondition, tkIdentifier, tkKey, tkNull, tkNumber,
+    tkRegister, tkSpace, tkString, tkSymbol, tkUnknown);
+
+  TRangeState = (rsUnknown, rsPascalComment, rsCComment, rsHexNumber,
+    rsBinaryNumber, rsInclude);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynADSP21xxSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FIdentFuncTable: array[0..820] of TIdentFuncTableFunc;
+    FTokenId: TtkTokenKind;
+    FNumberAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FRegisterAttri: TSynHighlighterAttributes;
+    FConditionAttri: TSynHighlighterAttributes;
+    FNullAttri: TSynHighlighterAttributes;
+    FUnknownAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncAbs(Index: Integer): TtkTokenKind;
+    function FuncAbstract(Index: Integer): TtkTokenKind;
+    function FuncAc(Index: Integer): TtkTokenKind;
+    function FuncAf(Index: Integer): TtkTokenKind;
+    function FuncAlt95reg(Index: Integer): TtkTokenKind;
+    function FuncAnd(Index: Integer): TtkTokenKind;
+    function FuncAr(Index: Integer): TtkTokenKind;
+    function FuncAr95sat(Index: Integer): TtkTokenKind;
+    function FuncAshift(Index: Integer): TtkTokenKind;
+    function FuncAstat(Index: Integer): TtkTokenKind;
+    function FuncAux(Index: Integer): TtkTokenKind;
+    function FuncAv(Index: Integer): TtkTokenKind;
+    function FuncAv95latch(Index: Integer): TtkTokenKind;
+    function FuncAx0(Index: Integer): TtkTokenKind;
+    function FuncAx1(Index: Integer): TtkTokenKind;
+    function FuncAy0(Index: Integer): TtkTokenKind;
+    function FuncAy1(Index: Integer): TtkTokenKind;
+    function FuncB(Index: Integer): TtkTokenKind;
+    function FuncBit95rev(Index: Integer): TtkTokenKind;
+    function FuncBm(Index: Integer): TtkTokenKind;
+    function FuncBoot(Index: Integer): TtkTokenKind;
+    function FuncBy(Index: Integer): TtkTokenKind;
+    function FuncCache(Index: Integer): TtkTokenKind;
+    function FuncCall(Index: Integer): TtkTokenKind;
+    function FuncCe(Index: Integer): TtkTokenKind;
+    function FuncCirc(Index: Integer): TtkTokenKind;
+    function FuncClear(Index: Integer): TtkTokenKind;
+    function FuncClr(Index: Integer): TtkTokenKind;
+    function FuncClrbit(Index: Integer): TtkTokenKind;
+    function FuncCntl(Index: Integer): TtkTokenKind;
+    function FuncCntr(Index: Integer): TtkTokenKind;
+    function FuncConst(Index: Integer): TtkTokenKind;
+    function FuncDefine(Index: Integer): TtkTokenKind;
+    function FuncDis(Index: Integer): TtkTokenKind;
+    function FuncDivq(Index: Integer): TtkTokenKind;
+    function FuncDivs(Index: Integer): TtkTokenKind;
+    function FuncDm(Index: Integer): TtkTokenKind;
+    function FuncDmovlay(Index: Integer): TtkTokenKind;
+    function FuncDo(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncEmode(Index: Integer): TtkTokenKind;
+    function FuncEna(Index: Integer): TtkTokenKind;
+    function FuncEndif(Index: Integer): TtkTokenKind;
+    function FuncEndmacro(Index: Integer): TtkTokenKind;
+    function FuncEndmod(Index: Integer): TtkTokenKind;
+    function FuncEntry(Index: Integer): TtkTokenKind;
+    function FuncEq(Index: Integer): TtkTokenKind;
+    function FuncExp(Index: Integer): TtkTokenKind;
+    function FuncExpadj(Index: Integer): TtkTokenKind;
+    function FuncExternal(Index: Integer): TtkTokenKind;
+    function FuncFl0(Index: Integer): TtkTokenKind;
+    function FuncFl1(Index: Integer): TtkTokenKind;
+    function FuncFl2(Index: Integer): TtkTokenKind;
+    function FuncFlag95in(Index: Integer): TtkTokenKind;
+    function FuncFlag95out(Index: Integer): TtkTokenKind;
+    function FuncFor(Index: Integer): TtkTokenKind;
+    function FuncForever(Index: Integer): TtkTokenKind;
+    function FuncGe(Index: Integer): TtkTokenKind;
+    function FuncGlobal(Index: Integer): TtkTokenKind;
+    function FuncGo95mode(Index: Integer): TtkTokenKind;
+    function FuncGt(Index: Integer): TtkTokenKind;
+    function FuncH(Index: Integer): TtkTokenKind;
+    function FuncHi(Index: Integer): TtkTokenKind;
+    function FuncI0(Index: Integer): TtkTokenKind;
+    function FuncI1(Index: Integer): TtkTokenKind;
+    function FuncI2(Index: Integer): TtkTokenKind;
+    function FuncI3(Index: Integer): TtkTokenKind;
+    function FuncI4(Index: Integer): TtkTokenKind;
+    function FuncI5(Index: Integer): TtkTokenKind;
+    function FuncI6(Index: Integer): TtkTokenKind;
+    function FuncI7(Index: Integer): TtkTokenKind;
+    function FuncIcntl(Index: Integer): TtkTokenKind;
+    function FuncIdle(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncIfc(Index: Integer): TtkTokenKind;
+    function FuncIfdef(Index: Integer): TtkTokenKind;
+    function FuncIfndef(Index: Integer): TtkTokenKind;
+    function FuncImask(Index: Integer): TtkTokenKind;
+    function FuncIn(Index: Integer): TtkTokenKind;
+    function FuncInclude(Index: Integer): TtkTokenKind;
+    function FuncInit(Index: Integer): TtkTokenKind;
+    function FuncIo(Index: Integer): TtkTokenKind;
+    function FuncJump(Index: Integer): TtkTokenKind;
+    function FuncL0(Index: Integer): TtkTokenKind;
+    function FuncL1(Index: Integer): TtkTokenKind;
+    function FuncL2(Index: Integer): TtkTokenKind;
+    function FuncL3(Index: Integer): TtkTokenKind;
+    function FuncL4(Index: Integer): TtkTokenKind;
+    function FuncL5(Index: Integer): TtkTokenKind;
+    function FuncL6(Index: Integer): TtkTokenKind;
+    function FuncL7(Index: Integer): TtkTokenKind;
+    function FuncLe(Index: Integer): TtkTokenKind;
+    function FuncLo(Index: Integer): TtkTokenKind;
+    function FuncLocal(Index: Integer): TtkTokenKind;
+    function FuncLoop(Index: Integer): TtkTokenKind;
+    function FuncLshift(Index: Integer): TtkTokenKind;
+    function FuncLt(Index: Integer): TtkTokenKind;
+    function FuncM95mode(Index: Integer): TtkTokenKind;
+    function FuncM0(Index: Integer): TtkTokenKind;
+    function FuncM1(Index: Integer): TtkTokenKind;
+    function FuncM2(Index: Integer): TtkTokenKind;
+    function FuncM3(Index: Integer): TtkTokenKind;
+    function FuncM4(Index: Integer): TtkTokenKind;
+    function FuncM5(Index: Integer): TtkTokenKind;
+    function FuncM6(Index: Integer): TtkTokenKind;
+    function FuncM7(Index: Integer): TtkTokenKind;
+    function FuncMacro(Index: Integer): TtkTokenKind;
+    function FuncMf(Index: Integer): TtkTokenKind;
+    function FuncModify(Index: Integer): TtkTokenKind;
+    function FuncModule(Index: Integer): TtkTokenKind;
+    function FuncMr(Index: Integer): TtkTokenKind;
+    function FuncMr0(Index: Integer): TtkTokenKind;
+    function FuncMr1(Index: Integer): TtkTokenKind;
+    function FuncMr2(Index: Integer): TtkTokenKind;
+    function FuncMstat(Index: Integer): TtkTokenKind;
+    function FuncMv(Index: Integer): TtkTokenKind;
+    function FuncMx0(Index: Integer): TtkTokenKind;
+    function FuncMx1(Index: Integer): TtkTokenKind;
+    function FuncMy0(Index: Integer): TtkTokenKind;
+    function FuncMy1(Index: Integer): TtkTokenKind;
+    function FuncName(Index: Integer): TtkTokenKind;
+    function FuncNe(Index: Integer): TtkTokenKind;
+    function FuncNeg(Index: Integer): TtkTokenKind;
+    function FuncNewpage(Index: Integer): TtkTokenKind;
+    function FuncNop(Index: Integer): TtkTokenKind;
+    function FuncNorm(Index: Integer): TtkTokenKind;
+    function FuncNot(Index: Integer): TtkTokenKind;
+    function FuncOf(Index: Integer): TtkTokenKind;
+    function FuncOr(Index: Integer): TtkTokenKind;
+    function FuncPass(Index: Integer): TtkTokenKind;
+    function FuncPc(Index: Integer): TtkTokenKind;
+    function FuncPm(Index: Integer): TtkTokenKind;
+    function FuncPop(Index: Integer): TtkTokenKind;
+    function FuncPort(Index: Integer): TtkTokenKind;
+    function FuncPush(Index: Integer): TtkTokenKind;
+    function FuncRam(Index: Integer): TtkTokenKind;
+    function FuncRegbank(Index: Integer): TtkTokenKind;
+    function FuncReset(Index: Integer): TtkTokenKind;
+    function FuncRnd(Index: Integer): TtkTokenKind;
+    function FuncRom(Index: Integer): TtkTokenKind;
+    function FuncRti(Index: Integer): TtkTokenKind;
+    function FuncRts(Index: Integer): TtkTokenKind;
+    function FuncRx0(Index: Integer): TtkTokenKind;
+    function FuncRx1(Index: Integer): TtkTokenKind;
+    function FuncSat(Index: Integer): TtkTokenKind;
+    function FuncSb(Index: Integer): TtkTokenKind;
+    function FuncSec95reg(Index: Integer): TtkTokenKind;
+    function FuncSeg(Index: Integer): TtkTokenKind;
+    function FuncSegment(Index: Integer): TtkTokenKind;
+    function FuncSet(Index: Integer): TtkTokenKind;
+    function FuncSetbit(Index: Integer): TtkTokenKind;
+    function FuncShift(Index: Integer): TtkTokenKind;
+    function FuncShl(Index: Integer): TtkTokenKind;
+    function FuncShr(Index: Integer): TtkTokenKind;
+    function FuncSi(Index: Integer): TtkTokenKind;
+    function FuncSr(Index: Integer): TtkTokenKind;
+    function FuncSr0(Index: Integer): TtkTokenKind;
+    function FuncSr1(Index: Integer): TtkTokenKind;
+    function FuncSs(Index: Integer): TtkTokenKind;
+    function FuncSstat(Index: Integer): TtkTokenKind;
+    function FuncStatic(Index: Integer): TtkTokenKind;
+    function FuncSts(Index: Integer): TtkTokenKind;
+    function FuncSu(Index: Integer): TtkTokenKind;
+    function FuncTest(Index: Integer): TtkTokenKind;
+    function FuncTestbit(Index: Integer): TtkTokenKind;
+    function FuncTglbit(Index: Integer): TtkTokenKind;
+    function FuncTimer(Index: Integer): TtkTokenKind;
+    function FuncToggle(Index: Integer): TtkTokenKind;
+    function FuncTopofpcstack(Index: Integer): TtkTokenKind;
+    function FuncTrap(Index: Integer): TtkTokenKind;
+    function FuncTrue(Index: Integer): TtkTokenKind;
+    function FuncTx0(Index: Integer): TtkTokenKind;
+    function FuncTx1(Index: Integer): TtkTokenKind;
+    function FuncUndef(Index: Integer): TtkTokenKind;
+    function FuncUntil(Index: Integer): TtkTokenKind;
+    function FuncUs(Index: Integer): TtkTokenKind;
+    function FuncUu(Index: Integer): TtkTokenKind;
+    function FuncVar(Index: Integer): TtkTokenKind;
+    function FuncXor(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure PascalCommentProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CCommentProc;
+    procedure CRProc;
+    procedure ExclamationProc;
+    procedure IdentProc;
+    procedure IntegerProc;
+    procedure IncludeCloseProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure BinaryNumber;
+    procedure HexNumber;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetCapabilities: TSynHighlighterCapabilities; override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+    function UseUserSettings(settingIndex: Integer): Boolean; override;
+    procedure EnumUserSettings(settings: TStrings); override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property ConditionAttri: TSynHighlighterAttributes read FConditionAttri
+      write FConditionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property RegisterAttri: TSynHighlighterAttributes read FRegisterAttri
+      write FRegisterAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+  end;
+
+implementation
+
+uses
+  Windows,
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..178] of UnicodeString = (
+    'abs', 'abstract', 'ac', 'af', 'alt_reg', 'and', 'ar', 'ar_sat', 'ashift', 
+    'astat', 'aux', 'av', 'av_latch', 'ax0', 'ax1', 'ay0', 'ay1', 'b', 
+    'bit_rev', 'bm', 'boot', 'by', 'cache', 'call', 'ce', 'circ', 'clear', 
+    'clr', 'clrbit', 'cntl', 'cntr', 'const', 'define', 'dis', 'divq', 'divs', 
+    'dm', 'dmovlay', 'do', 'else', 'emode', 'ena', 'endif', 'endmacro', 
+    'endmod', 'entry', 'eq', 'exp', 'expadj', 'external', 'fl0', 'fl1', 'fl2', 
+    'flag_in', 'flag_out', 'for', 'forever', 'ge', 'global', 'go_mode', 'gt', 
+    'h', 'hi', 'i0', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'icntl', 'idle', 
+    'if', 'ifc', 'ifdef', 'ifndef', 'imask', 'in', 'include', 'init', 'io', 
+    'jump', 'l0', 'l1', 'l2', 'l3', 'l4', 'l5', 'l6', 'l7', 'le', 'lo', 'local', 
+    'loop', 'lshift', 'lt', 'm_mode', 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 
+    'm7', 'macro', 'mf', 'modify', 'module', 'mr', 'mr0', 'mr1', 'mr2', 'mstat', 
+    'mv', 'mx0', 'mx1', 'my0', 'my1', 'name', 'ne', 'neg', 'newpage', 'nop', 
+    'norm', 'not', 'of', 'or', 'pass', 'pc', 'pm', 'pop', 'port', 'push', 'ram', 
+    'regbank', 'reset', 'rnd', 'rom', 'rti', 'rts', 'rx0', 'rx1', 'sat', 'sb', 
+    'sec_reg', 'seg', 'segment', 'set', 'setbit', 'shift', 'shl', 'shr', 'si', 
+    'sr', 'sr0', 'sr1', 'ss', 'sstat', 'static', 'sts', 'su', 'test', 'testbit', 
+    'tglbit', 'timer', 'toggle', 'topofpcstack', 'trap', 'true', 'tx0', 'tx1', 
+    'undef', 'until', 'us', 'uu', 'var', 'xor' 
+  );
+
+  KeyIndices: array[0..820] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 
+    15, -1, 48, 100, 132, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, 
+    152, 93, 155, -1, -1, -1, 70, 62, -1, -1, 103, 0, -1, -1, 10, -1, -1, -1, 
+    -1, -1, -1, 171, -1, -1, -1, -1, 120, 162, -1, -1, -1, -1, -1, 82, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, -1, -1, 50, 
+    -1, -1, -1, -1, -1, -1, 72, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, 25, -1, -1, -1, 8, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 156, 83, -1, -1, -1, -1, -1, 77, 106, -1, 45, 27, 
+    -1, -1, -1, -1, -1, 7, -1, -1, 43, -1, 74, 14, 174, 73, 86, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, 111, -1, -1, 140, -1, 
+    -1, -1, 89, -1, -1, -1, -1, 127, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 116, -1, 49, -1, -1, 164, 23, -1, -1, 9, -1, -1, 
+    -1, -1, 149, -1, -1, -1, 40, -1, -1, 46, -1, 94, -1, 81, -1, 134, -1, -1, 
+    -1, -1, -1, -1, -1, 55, -1, 47, -1, -1, -1, -1, 11, -1, 135, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, 65, 142, -1, 
+    -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, 
+    -1, 18, -1, 68, 16, -1, -1, 101, 91, -1, -1, -1, 130, -1, 167, -1, -1, -1, 
+    115, -1, -1, -1, -1, 19, 158, -1, 163, -1, -1, -1, -1, -1, 104, -1, -1, -1, 
+    -1, -1, -1, -1, 39, -1, 79, 172, -1, -1, -1, -1, 41, -1, 38, 176, 80, -1, 
+    -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 
+    75, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, 
+    -1, -1, 42, -1, -1, -1, -1, -1, -1, 58, -1, -1, 136, -1, -1, -1, -1, -1, -1, 
+    177, -1, -1, -1, -1, -1, -1, -1, 57, -1, 157, 84, 21, -1, -1, -1, -1, -1, 1, 
+    -1, -1, -1, 96, 161, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, 
+    -1, -1, -1, 54, 137, -1, -1, 124, 145, -1, -1, -1, -1, -1, -1, -1, -1, 112, 
+    -1, -1, 173, -1, -1, -1, 90, -1, 125, -1, 166, -1, -1, -1, -1, 144, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, 170, -1, -1, 
+    35, -1, -1, -1, -1, -1, -1, -1, 148, -1, 44, -1, -1, -1, -1, 159, -1, -1, 
+    -1, -1, -1, 150, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, 
+    178, -1, -1, -1, 141, 60, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 66, 143, -1, -1, 99, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 37, -1, -1, 26, -1, -1, 69, -1, -1, -1, 102, -1, -1, 121, -1, 
+    -1, -1, 61, 129, 95, -1, -1, -1, 122, -1, 139, -1, -1, 36, 175, -1, -1, -1, 
+    -1, -1, 105, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 32, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, 2, -1, -1, 165, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, 92, -1, 147, 
+    -1, 131, 3, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 13, -1, -1, 85, 59, 
+    -1, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 88, -1, -1, 107, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, 
+    -1, -1, -1, -1, 113, 151, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, 34, 29, 
+    169, 126, 114, -1, -1, 22, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, 78, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, 5, 30, -1, -1, -1, -1, -1, -1, 
+    64, -1, -1, -1, -1, -1, -1 
+  );
+
+{$Q-}
+function TSynADSP21xxSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 641 + Ord(Str^) * 282;
+    Inc(Str);
+  end;
+  Result := Result mod 821;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynADSP21xxSyn.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 TSynADSP21xxSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[48] := FuncAbs;
+  FIdentFuncTable[426] := FuncAbstract;
+  FIdentFuncTable[642] := FuncAc;
+  FIdentFuncTable[667] := FuncAf;
+  FIdentFuncTable[693] := FuncAlt95reg;
+  FIdentFuncTable[806] := FuncAnd;
+  FIdentFuncTable[767] := FuncAr;
+  FIdentFuncTable[153] := FuncAr95sat;
+  FIdentFuncTable[126] := FuncAshift;
+  FIdentFuncTable[220] := FuncAstat;
+  FIdentFuncTable[51] := FuncAux;
+  FIdentFuncTable[253] := FuncAv;
+  FIdentFuncTable[99] := FuncAv95latch;
+  FIdentFuncTable[698] := FuncAx0;
+  FIdentFuncTable[159] := FuncAx1;
+  FIdentFuncTable[19] := FuncAy0;
+  FIdentFuncTable[301] := FuncAy1;
+  FIdentFuncTable[543] := FuncB;
+  FIdentFuncTable[298] := FuncBit95rev;
+  FIdentFuncTable[320] := FuncBm;
+  FIdentFuncTable[118] := FuncBoot;
+  FIdentFuncTable[420] := FuncBy;
+  FIdentFuncTable[763] := FuncCache;
+  FIdentFuncTable[217] := FuncCall;
+  FIdentFuncTable[669] := FuncCe;
+  FIdentFuncTable[122] := FuncCirc;
+  FIdentFuncTable[579] := FuncClear;
+  FIdentFuncTable[147] := FuncClr;
+  FIdentFuncTable[196] := FuncClrbit;
+  FIdentFuncTable[757] := FuncCntl;
+  FIdentFuncTable[807] := FuncCntr;
+  FIdentFuncTable[525] := FuncConst;
+  FIdentFuncTable[629] := FuncDefine;
+  FIdentFuncTable[715] := FuncDis;
+  FIdentFuncTable[756] := FuncDivq;
+  FIdentFuncTable[499] := FuncDivs;
+  FIdentFuncTable[604] := FuncDm;
+  FIdentFuncTable[576] := FuncDmovlay;
+  FIdentFuncTable[347] := FuncDo;
+  FIdentFuncTable[337] := FuncElse;
+  FIdentFuncTable[229] := FuncEmode;
+  FIdentFuncTable[345] := FuncEna;
+  FIdentFuncTable[391] := FuncEndif;
+  FIdentFuncTable[156] := FuncEndmacro;
+  FIdentFuncTable[509] := FuncEndmod;
+  FIdentFuncTable[146] := FuncEntry;
+  FIdentFuncTable[232] := FuncEq;
+  FIdentFuncTable[248] := FuncExp;
+  FIdentFuncTable[21] := FuncExpadj;
+  FIdentFuncTable[213] := FuncExternal;
+  FIdentFuncTable[91] := FuncFl0;
+  FIdentFuncTable[373] := FuncFl1;
+  FIdentFuncTable[655] := FuncFl2;
+  FIdentFuncTable[750] := FuncFlag95in;
+  FIdentFuncTable[448] := FuncFlag95out;
+  FIdentFuncTable[246] := FuncFor;
+  FIdentFuncTable[175] := FuncForever;
+  FIdentFuncTable[416] := FuncGe;
+  FIdentFuncTable[398] := FuncGlobal;
+  FIdentFuncTable[702] := FuncGo95mode;
+  FIdentFuncTable[541] := FuncGt;
+  FIdentFuncTable[593] := FuncH;
+  FIdentFuncTable[44] := FuncHi;
+  FIdentFuncTable[532] := FuncI0;
+  FIdentFuncTable[814] := FuncI1;
+  FIdentFuncTable[275] := FuncI2;
+  FIdentFuncTable[557] := FuncI3;
+  FIdentFuncTable[18] := FuncI4;
+  FIdentFuncTable[300] := FuncI5;
+  FIdentFuncTable[582] := FuncI6;
+  FIdentFuncTable[43] := FuncI7;
+  FIdentFuncTable[369] := FuncIcntl;
+  FIdentFuncTable[98] := FuncIdle;
+  FIdentFuncTable[161] := FuncIf;
+  FIdentFuncTable[158] := FuncIfc;
+  FIdentFuncTable[370] := FuncIfdef;
+  FIdentFuncTable[800] := FuncIfndef;
+  FIdentFuncTable[143] := FuncImask;
+  FIdentFuncTable[775] := FuncIn;
+  FIdentFuncTable[339] := FuncInclude;
+  FIdentFuncTable[349] := FuncInit;
+  FIdentFuncTable[236] := FuncIo;
+  FIdentFuncTable[70] := FuncJump;
+  FIdentFuncTable[137] := FuncL0;
+  FIdentFuncTable[419] := FuncL1;
+  FIdentFuncTable[701] := FuncL2;
+  FIdentFuncTable[162] := FuncL3;
+  FIdentFuncTable[444] := FuncL4;
+  FIdentFuncTable[726] := FuncL5;
+  FIdentFuncTable[187] := FuncL6;
+  FIdentFuncTable[469] := FuncL7;
+  FIdentFuncTable[305] := FuncLe;
+  FIdentFuncTable[662] := FuncLo;
+  FIdentFuncTable[38] := FuncLocal;
+  FIdentFuncTable[234] := FuncLoop;
+  FIdentFuncTable[595] := FuncLshift;
+  FIdentFuncTable[430] := FuncLt;
+  FIdentFuncTable[564] := FuncM95mode;
+  FIdentFuncTable[279] := FuncM0;
+  FIdentFuncTable[561] := FuncM1;
+  FIdentFuncTable[22] := FuncM2;
+  FIdentFuncTable[304] := FuncM3;
+  FIdentFuncTable[586] := FuncM4;
+  FIdentFuncTable[47] := FuncM5;
+  FIdentFuncTable[329] := FuncM6;
+  FIdentFuncTable[611] := FuncM7;
+  FIdentFuncTable[144] := FuncMacro;
+  FIdentFuncTable[729] := FuncMf;
+  FIdentFuncTable[617] := FuncModify;
+  FIdentFuncTable[268] := FuncModule;
+  FIdentFuncTable[8] := FuncMr;
+  FIdentFuncTable[180] := FuncMr0;
+  FIdentFuncTable[462] := FuncMr1;
+  FIdentFuncTable[744] := FuncMr2;
+  FIdentFuncTable[760] := FuncMstat;
+  FIdentFuncTable[315] := FuncMv;
+  FIdentFuncTable[211] := FuncMx0;
+  FIdentFuncTable[493] := FuncMx1;
+  FIdentFuncTable[353] := FuncMy0;
+  FIdentFuncTable[635] := FuncMy1;
+  FIdentFuncTable[63] := FuncName;
+  FIdentFuncTable[589] := FuncNe;
+  FIdentFuncTable[599] := FuncNeg;
+  FIdentFuncTable[434] := FuncNewpage;
+  FIdentFuncTable[452] := FuncNop;
+  FIdentFuncTable[471] := FuncNorm;
+  FIdentFuncTable[759] := FuncNot;
+  FIdentFuncTable[192] := FuncOf;
+  FIdentFuncTable[292] := FuncOr;
+  FIdentFuncTable[594] := FuncPass;
+  FIdentFuncTable[309] := FuncPc;
+  FIdentFuncTable[666] := FuncPm;
+  FIdentFuncTable[23] := FuncPop;
+  FIdentFuncTable[29] := FuncPort;
+  FIdentFuncTable[238] := FuncPush;
+  FIdentFuncTable[255] := FuncRam;
+  FIdentFuncTable[401] := FuncRegbank;
+  FIdentFuncTable[449] := FuncReset;
+  FIdentFuncTable[384] := FuncRnd;
+  FIdentFuncTable[601] := FuncRom;
+  FIdentFuncTable[183] := FuncRti;
+  FIdentFuncTable[540] := FuncRts;
+  FIdentFuncTable[276] := FuncRx0;
+  FIdentFuncTable[558] := FuncRx1;
+  FIdentFuncTable[478] := FuncSat;
+  FIdentFuncTable[453] := FuncSb;
+  FIdentFuncTable[705] := FuncSec95reg;
+  FIdentFuncTable[664] := FuncSeg;
+  FIdentFuncTable[507] := FuncSegment;
+  FIdentFuncTable[225] := FuncSet;
+  FIdentFuncTable[520] := FuncSetbit;
+  FIdentFuncTable[745] := FuncShift;
+  FIdentFuncTable[37] := FuncShl;
+  FIdentFuncTable[87] := FuncShr;
+  FIdentFuncTable[785] := FuncSi;
+  FIdentFuncTable[39] := FuncSr;
+  FIdentFuncTable[136] := FuncSr0;
+  FIdentFuncTable[418] := FuncSr1;
+  FIdentFuncTable[321] := FuncSs;
+  FIdentFuncTable[514] := FuncSstat;
+  FIdentFuncTable[736] := FuncStatic;
+  FIdentFuncTable[431] := FuncSts;
+  FIdentFuncTable[64] := FuncSu;
+  FIdentFuncTable[323] := FuncTest;
+  FIdentFuncTable[216] := FuncTestbit;
+  FIdentFuncTable[645] := FuncTglbit;
+  FIdentFuncTable[473] := FuncTimer;
+  FIdentFuncTable[311] := FuncToggle;
+  FIdentFuncTable[683] := FuncTopofpcstack;
+  FIdentFuncTable[758] := FuncTrap;
+  FIdentFuncTable[496] := FuncTrue;
+  FIdentFuncTable[58] := FuncTx0;
+  FIdentFuncTable[340] := FuncTx1;
+  FIdentFuncTable[465] := FuncUndef;
+  FIdentFuncTable[160] := FuncUntil;
+  FIdentFuncTable[605] := FuncUs;
+  FIdentFuncTable[348] := FuncUu;
+  FIdentFuncTable[408] := FuncVar;
+  FIdentFuncTable[536] := FuncXor;
+end;
+
+function TSynADSP21xxSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier
+end;
+
+function TSynADSP21xxSyn.FuncAbs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAbstract(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAlt95reg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAnd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAr95sat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAshift(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAstat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAux(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAv(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAv95latch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAx0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAx1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAy0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncAy1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncB(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if FLine[Run + 1] = '#' then
+    begin
+      Result := tkNumber;
+      FRange := rsBinaryNumber;
+    end
+    else
+    begin
+      Result := tkIdentifier;
+    end
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncBit95rev(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncBm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncBoot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncBy(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCache(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCall(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCirc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncClear(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncClr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncClrbit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCntl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncCntr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncConst(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDefine(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDis(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDivq(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDivs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDmovlay(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncDo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEmode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEna(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEndif(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEndmacro(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEndmod(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEntry(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncEq(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncExp(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncExpadj(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncExternal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFl0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFl1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFl2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFlag95in(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFlag95out(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncFor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncForever(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncGe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncGlobal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncGo95mode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncGt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncH(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if FLine[Run + 1] = '#' then
+    begin
+      Result := tkNumber;
+      FRange := rsHexNumber;
+    end
+    else
+    begin
+      Result := tkIdentifier;
+    end
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncHi(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI3(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI4(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI5(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI6(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncI7(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIcntl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIdle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIfc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIfdef(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIfndef(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncImask(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncInclude(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncInit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncIo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncJump(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL3(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL4(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL5(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL6(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncL7(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLocal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLoop(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLshift(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncLt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM95mode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM3(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM4(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM5(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM6(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncM7(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMacro(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncModify(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncModule(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMr0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMr1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMr2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMstat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMv(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMx0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMx1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMy0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncMy1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncName(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNeg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNewpage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNop(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNorm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncNot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncOf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncOr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPass(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPop(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPort(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncPush(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRam(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRegbank(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncReset(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRnd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRom(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRti(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRts(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRx0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncRx1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSb(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSec95reg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSeg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSegment(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSet(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSetbit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncShift(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncShl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncShr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSi(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSr0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSr1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSstat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncStatic(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSts(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncSu(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTest(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTestbit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTglbit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTimer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncToggle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTopofpcstack(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTrap(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTrue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTx0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncTx1(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkRegister
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncUndef(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncUntil(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncUs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncUu(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkCondition
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncVar(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynADSP21xxSyn.FuncXor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynADSP21xxSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.ForeGround := clTeal;
+  FCommentAttri.Style:= [fsItalic];
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FNumberAttri.ForeGround := clOlive;
+  AddAttribute(FNumberAttri);
+
+  FRegisterAttri := TSynHighlighterAttributes.Create(SYNS_AttrRegister, SYNS_FriendlyAttrRegister);
+  FRegisterAttri.ForeGround := clBlue;
+  AddAttribute(FRegisterAttri);
+
+  FConditionAttri := TSynHighlighterAttributes.Create(SYNS_AttrCondition, SYNS_FriendlyAttrCondition);
+  FConditionAttri.ForeGround := clFuchsia;
+  AddAttribute(FConditionAttri);
+
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FNullAttri := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
+  AddAttribute(FNullAttri);
+
+  FUnknownAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
+  AddAttribute(FUnknownAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+
+  InitIdent;
+  FRange := rsUnknown;
+  FDefaultFilter := SYNS_FilterADSP21xx;
+end;
+
+procedure TSynADSP21xxSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenId := tkSymbol;
+end;
+
+procedure TSynADSP21xxSyn.StringProc;
+begin
+  FTokenId := tkString;
+  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.PascalCommentProc;
+begin
+  FTokenId := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '}':
+        begin
+          FRange := rsUnknown;
+          Inc(Run);
+          Break;
+        end;
+      #10, #13:
+        Break;
+      else Inc(Run);
+    end;
+end;
+
+procedure TSynADSP21xxSyn.CCommentProc;
+begin
+  FTokenId := tkComment;
+  case FLine[Run] of
+    #0: 
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        begin
+          if FLine[Run+1] = '/' then
+          begin
+            FRange := rsUnknown;
+            Inc(Run, 2);
+            Break;
+          end
+          else
+            Inc(Run);
+        end;
+      #10, #13:
+        Break;
+      else
+        Inc(Run);
+    end;
+end;
+
+procedure TSynADSP21xxSyn.BraceOpenProc;
+begin
+  FTokenId := tkComment;
+  FRange := rsPascalComment;
+  Inc(Run);
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '}':
+        begin
+          FRange := rsUnknown;
+          Inc(Run);
+          Break;
+        end;
+      #10, #13:
+        Break;
+      else
+        Inc(Run);
+    end;
+end;
+
+
+procedure TSynADSP21xxSyn.IncludeCloseProc;
+begin
+  Inc(Run);
+  FTokenId := tkSymbol;
+end;
+
+procedure TSynADSP21xxSyn.CRProc;
+begin
+  FTokenId := tkSpace;
+  case FLine[Run + 1] of
+    #10: Inc(Run, 2);
+  else
+    Inc(Run);
+  end;
+end;
+
+procedure TSynADSP21xxSyn.ExclamationProc;
+begin
+  FTokenId := tkComment;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynADSP21xxSyn.IdentProc;
+begin
+  FTokenId := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.IntegerProc;
+
+  function IsIntegerChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenId := tkNumber;
+  while IsIntegerChar do Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.LFProc;
+begin
+  FTokenId := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.NullProc;
+begin
+  FTokenId := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', 'x', 'X', '.':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenId := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynADSP21xxSyn.HexNumber;
+
+  function IsHexChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenId := tkNumber;
+  FRange := rsUnknown;
+  while IsHexChar do
+  begin
+    Inc(Run);
+  end;
+end;
+
+procedure TSynADSP21xxSyn.BinaryNumber;
+begin
+  Inc(Run);
+  FRange := rsUnknown;
+  while CharInSet(FLine[Run], ['0'..'1']) do
+  begin
+    Inc(Run);
+  end;
+  if CharInSet(FLine[Run], ['2'..'9', 'A'..'F', 'a'..'f']) then
+  begin
+    FTokenId := tkIdentifier
+  end
+  else
+    FTokenId := tkNumber;
+end;
+
+procedure TSynADSP21xxSyn.SlashProc;
+begin
+  if FLine[Run + 1] = '*' then
+  begin
+    FTokenId := tkComment;
+    FRange := rsCComment;
+    Inc(Run, 2);
+    while FLine[Run] <> #0 do
+      case FLine[Run] of
+        '*':
+          begin
+            if FLine[Run+1] = '/' then
+            begin
+              Inc(Run, 2);
+              FRange := rsUnknown;
+              Break;
+            end
+            else
+              Inc(Run);
+          end;
+        #10, #13:
+          Break;
+        else
+          Inc(Run);
+      end;
+    end
+  else
+  begin
+    Inc(Run);
+    FTokenId := tkSymbol;
+  end;
+end;
+
+procedure TSynADSP21xxSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenId := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynADSP21xxSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenId := tkUnknown;
+end;
+
+procedure TSynADSP21xxSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsPascalComment: PascalCommentProc;
+    rsCComment: CCommentProc;
+    rsHexNumber: HexNumber;
+    rsBinaryNumber: BinaryNumber;
+  else
+    FRange := rsUnknown;
+    case FLine[Run] of
+      #0: NullProc;
+      #10: LFProc;
+      #13: CRProc;
+      #1..#9, #11, #12, #14..#32: SpaceProc;
+      '$': IntegerProc;
+      #39: StringProc;
+      '0'..'9': NumberProc;
+      'A'..'Z', 'a'..'z', '_': IdentProc;
+      '{': BraceOpenProc;
+      '}': BraceCloseProc;
+      '/': SlashProc;
+      '>': IncludeCloseProc;
+      '!': ExclamationProc;
+      else UnknownProc;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynADSP21xxSyn.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 TSynADSP21xxSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynADSP21xxSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenId;
+end;
+
+function TSynADSP21xxSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+function TSynADSP21xxSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkRegister: Result := FRegisterAttri;
+    tkCondition: Result := FConditionAttri;
+    tkUnknown: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynADSP21xxSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+procedure TSynADSP21xxSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynADSP21xxSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynADSP21xxSyn.EnumUserSettings(settings: TStrings);
+begin
+  { returns the user settings that exist in the registry }
+  with TBetterRegistry.Create do
+  begin
+    try
+      RootKey := HKEY_CURRENT_USER;
+      // we need some method to make the following statement more universal!
+      if OpenKeyReadOnly('\SOFTWARE\Wynand\DSPIDE\1.0') then
+      begin
+        try
+          GetKeyNames(settings);
+        finally
+          CloseKey;
+        end;
+      end;
+    finally
+      Free;
+    end;
+  end;
+end;
+
+function TSynADSP21xxSyn.UseUserSettings(settingIndex: Integer): Boolean;
+// Possible parameter values:
+//   index into TStrings returned by EnumUserSettings
+// Possible return values:
+//   true : settings were read and used
+//   False: problem reading settings or invalid version specified - old settings
+//          were preserved
+
+    function ReadDspIDESetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
+    begin
+      try
+        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
+          '\Software\Wynand\DspIDE\1.0\Editor\Highlight', key, False);
+      except
+        Result := False;
+      end;
+    end;
+var
+  tmpNumberAttri    : TSynHighlighterAttributes;
+  tmpKeyAttri       : TSynHighlighterAttributes;
+  tmpSymbolAttri    : TSynHighlighterAttributes;
+  tmpCommentAttri   : TSynHighlighterAttributes;
+  tmpConditionAttri : TSynHighlighterAttributes;
+  tmpIdentifierAttri: TSynHighlighterAttributes;
+  tmpSpaceAttri     : TSynHighlighterAttributes;
+  tmpRegisterAttri  : TSynHighlighterAttributes;
+  StrLst            : TStringList;
+
+begin  // UseUserSettings
+  StrLst := TStringList.Create;
+  try
+    EnumUserSettings(StrLst);
+    if settingIndex >= StrLst.Count then
+      Result := False
+    else
+    begin
+      tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
+      tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
+      tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
+      tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
+      tmpConditionAttri := TSynHighlighterAttributes.Create('', '');
+      tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
+      tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
+      tmpRegisterAttri  := TSynHighlighterAttributes.Create('', '');
+
+      tmpNumberAttri    .Assign(FNumberAttri);
+      tmpKeyAttri       .Assign(FKeyAttri);
+      tmpSymbolAttri    .Assign(FSymbolAttri);
+      tmpCommentAttri   .Assign(FCommentAttri);
+      tmpConditionAttri .Assign(FConditionAttri);
+      tmpIdentifierAttri.Assign(FIdentifierAttri);
+      tmpSpaceAttri     .Assign(FSpaceAttri);
+      tmpRegisterAttri  .Assign(FRegisterAttri);
+      Result :=
+        ReadDspIDESetting(StrLst[settingIndex], FCommentAttri,'Comment')       and
+        ReadDspIDESetting(StrLst[settingIndex], FIdentifierAttri,'Identifier') and
+        ReadDspIDESetting(StrLst[settingIndex], FKeyAttri,'Reserved word')     and
+        ReadDspIDESetting(StrLst[settingIndex], FNumberAttri,'BinaryNumber')   and
+        ReadDspIDESetting(StrLst[settingIndex], FSpaceAttri,'Whitespace')      and
+        ReadDspIDESetting(StrLst[settingIndex], FSymbolAttri,'Symbol')         and
+        ReadDspIDESetting(StrLst[settingIndex], FConditionAttri,'Condition')   and
+        ReadDspIDESetting(StrLst[settingIndex], FRegisterAttri,'Symbol');
+      if not Result then
+      begin
+        FNumberAttri     .Assign(tmpNumberAttri);
+        FKeyAttri        .Assign(tmpKeyAttri);
+        FSymbolAttri     .Assign(tmpSymbolAttri);
+        FCommentAttri    .Assign(tmpCommentAttri);
+        FConditionAttri  .Assign(tmpConditionAttri);
+        FIdentifierAttri .Assign(tmpIdentifierAttri);
+        FSpaceAttri      .Assign(tmpSpaceAttri);
+        FConditionAttri  .Assign(tmpConditionAttri);
+        FRegisterAttri   .Assign(tmpRegisterAttri);
+      end;
+      tmpNumberAttri    .Free;
+      tmpKeyAttri       .Free;
+      tmpSymbolAttri    .Free;
+      tmpCommentAttri   .Free;
+      tmpConditionAttri .Free;
+      tmpIdentifierAttri.Free;
+      tmpSpaceAttri     .Free;
+      tmpRegisterAttri  .Free;
+    end;
+  finally
+    StrLst.Free;
+  end;
+end;
+
+function TSynADSP21xxSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterADSP21xx;
+end;
+
+class function TSynADSP21xxSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangADSP21xx;
+end;
+
+class function TSynADSP21xxSyn.GetCapabilities: TSynHighlighterCapabilities;
+begin
+  Result := inherited GetCapabilities + [hcUserSettings];
+end;
+
+class function TSynADSP21xxSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangADSP21xx;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynADSP21xxSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterAWK.pas b/Source/VCL/SynEdit/Source/SynHighlighterAWK.pas
index 0e6c5954..6cfe3c31 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterAWK.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterAWK.pas
@@ -1,548 +1,553 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterAWK.pas, released 2000-06-18.
-The Original Code is based on the hkAWKSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Hideo Koiso.
-Unicode translation by Maël Hörz.
-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: SynHighlighterAWK.pas,v 1.10.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a AWK Script highlighter for SynEdit)
-@author(Hideo Koiso , converted to SynEdit by David Muir )
-@created(7 November 1999, converted to SynEdit April 18, 2000)
-@lastmod(June 19, 2000)
-The SynHighlighterAWK unit provides SynEdit with a AWK Script (.awk) highlighter.
-}
-
-unit SynHighlighterAWK;
-
-interface
-
-{$I SynEdit.inc}
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkInterFunc, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkSysVar, tkUnknown);
-
-  TSynAWKSyn = class(TSynCustomHighLighter)
-  private
-    AWKSyntaxList: TStringList;
-    FTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fInterFuncAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fSysVarAttri: TSynHighlighterAttributes;
-    procedure AndProc;
-    procedure CommentProc;
-    procedure CRProc;
-    procedure ExclamProc;
-    procedure FieldRefProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure MakeSyntaxList;
-    procedure MinusProc;
-    procedure NullProc;
-    procedure OpInputProc;
-    procedure OrProc;
-    procedure PlusProc;
-    procedure QuestionProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure SymbolProc;
-    procedure NumberProc;
-    procedure BraceProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property InterFuncAttri: TSynHighlighterAttributes read fInterFuncAttri
-      write fInterFuncAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property SysVarAttri: TSynHighlighterAttributes read fSysVarAttri
-      write fSysVarAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-procedure TSynAWKSyn.MakeSyntaxList;
-begin
-  with AWKSyntaxList do
-  begin
-    Sorted := True;
-
-    { *** Preferably sort and put previously. *** }
-    AddObject('ARGC', TObject(tkSysVar));
-    AddObject('ARGIND', TObject(tkSysVar)); { GNU Extention }
-    AddObject('ARGV', TObject(tkSysVar));
-    AddObject('atan2', TObject(tkInterFunc));
-    AddObject('BEGIN', TObject(tkKey));
-    AddObject('break', TObject(tkKey));
-    AddObject('close', TObject(tkInterFunc));
-    AddObject('continue', TObject(tkKey));
-    AddObject('CONVFMT', TObject(tkSysVar)); { POSIX Extention }
-    AddObject('cos', TObject(tkInterFunc));
-    AddObject('delete', TObject(tkInterFunc));
-    AddObject('do', TObject(tkKey));
-    AddObject('else', TObject(tkKey));
-    AddObject('END', TObject(tkKey));
-    AddObject('ENVIRON', TObject(tkSysVar));
-    AddObject('ERRNO', TObject(tkSysVar)); { GNU Extention }
-    AddObject('exit', TObject(tkKey));
-    AddObject('exp', TObject(tkInterFunc));
-    AddObject('FIELDWIDTH', TObject(tkSysVar)); { GNU Extention }
-    AddObject('FILENAME', TObject(tkSysVar));
-    AddObject('FNR', TObject(tkSysVar));
-    AddObject('for', TObject(tkKey));
-    AddObject('FS', TObject(tkSysVar));
-    AddObject('function', TObject(tkKey));
-    AddObject('getline', TObject(tkKey));
-    AddObject('gsub', TObject(tkInterFunc));
-    AddObject('if', TObject(tkKey));
-    AddObject('IGNORECASE', TObject(tkSysVar));
-    AddObject('index', TObject(tkInterFunc));
-    AddObject('int', TObject(tkInterFunc));
-    AddObject('jindex', TObject(tkInterFunc)); { jgawk }
-    AddObject('jlength', TObject(tkInterFunc)); { jgawk }
-    AddObject('jsubstr', TObject(tkInterFunc)); { jgawk }
-    AddObject('length', TObject(tkInterFunc));
-    AddObject('log', TObject(tkInterFunc));
-    AddObject('match', TObject(tkInterFunc));
-    AddObject('next', TObject(tkUnknown)); { & next file (GNU Extention) }
-    AddObject('NF', TObject(tkSysVar));
-    AddObject('NR', TObject(tkSysVar));
-    AddObject('OFMT', TObject(tkSysVar));
-    AddObject('OFS', TObject(tkSysVar));
-    AddObject('ORS', TObject(tkSysVar));
-    AddObject('print', TObject(tkKey));
-    AddObject('printf', TObject(tkInterFunc));
-    AddObject('rand', TObject(tkInterFunc));
-    AddObject('return', TObject(tkKey));
-    AddObject('RLENGTH', TObject(tkSysVar));
-    AddObject('RS', TObject(tkSysVar));
-    AddObject('RSTART', TObject(tkSysVar));
-    AddObject('sin', TObject(tkInterFunc));
-    AddObject('split', TObject(tkInterFunc));
-    AddObject('sprintf', TObject(tkInterFunc));
-    AddObject('sqrt', TObject(tkInterFunc));
-    AddObject('srand', TObject(tkInterFunc));
-    AddObject('strftime', TObject(tkInterFunc)); { GNU Extention }
-    AddObject('sub', TObject(tkInterFunc));
-    AddObject('SUBSEP', TObject(tkSysVar));
-    AddObject('substr', TObject(tkInterFunc));
-    AddObject('system', TObject(tkInterFunc));
-    AddObject('systime', TObject(tkInterFunc)); { GNU Extention }
-    AddObject('tolower', TObject(tkInterFunc));
-    AddObject('toupper', TObject(tkInterFunc));
-    AddObject('while', TObject(tkKey));
-  end;
-end;
-
-procedure TSynAWKSyn.BraceProc;
-begin
-  fTokenID := tkIdentifier;
-  Inc(Run);
-end;
-
-procedure TSynAWKSyn.NumberProc;
-begin
-  fTokenID := tkNumber;
-  Inc(Run);
-  while CharInSet(fLine[Run], ['0'..'9']) do
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.IdentProc;
-var
-  i: Integer;
-  idx: Integer;
-  s: string;
-begin
-  i := Run;
-  while CharInSet(fLine[i], ['a'..'z', 'A'..'Z']) do
-    Inc(i);
-  SetLength(s, i - Run);
-  StrLCopy(PWideChar(s), fLine + Run, i - Run);
-  Run := i;
-  if AWKSyntaxList.Find(s, idx) and (AWKSyntaxList.Strings[idx] = s) then
-  begin
-    fTokenID := TtkTokenKind(AWKSyntaxList.Objects[idx]);
-    if (fTokenID = tkUnKnown) then
-    begin
-      fTokenID := tkKey;
-      if (fLine[i] = ' ') then
-      begin
-        while (fLine[i] = ' ') do
-          Inc(i);
-        if (fLine[i + 0] = 'f') and
-          (fLine[i + 1] = 'i') and
-          (fLine[i + 2] = 'l') and
-          (fLine[i + 3] = 'e') and
-          CharInSet(fLine[i + 4], [#0..#32, ';']) then
-        begin
-          Run := (i + 4);
-        end;
-      end;
-    end;
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-procedure TSynAWKSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '"', #$27: StringProc; { "..." }
-    '(', ')', '[', ']': BraceProc; { (, ), [ and ] }
-    '#': CommentProc; { # ... }
-    '$': FieldRefProc; { $0 .. $9 }
-    '+': PlusProc; { +, ++ and += }
-    '-': MinusProc; { -, -- and -= }
-    '!': ExclamProc; { ! and !~ }
-    '?': QuestionProc; { ?: }
-    '|': OrProc; { || }
-    '&': AndProc; { && }
-    '*', '/', '%', '^', '<', '=', '>': OpInputProc; { *=, /=, %= ... etc. }
-    'a'..'z', 'A'..'Z': IdentProc;
-    '0'..'9': NumberProc;
-    else SymbolProc;
-  end;
-  inherited;
-end;
-
-procedure TSynAWKSyn.StringProc;
-begin
-  repeat
-    Inc(Run);
-    if (fLine[Run] = '"') and (fLine[Run - 1] <> '\') then
-    begin
-      fTokenID := tkString;
-      Inc(Run);
-      Exit;
-    end;
-  until CharInSet(fLine[Run], [#0..#31]);
-  fTokenID := tkIdentifier;
-end;
-
-procedure TSynAWKSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-  while not IsLineEnd(Run) do
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.FieldRefProc;
-
-  function IsAlphaNumChar(Run: Integer): Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'a'..'z', 'A'..'Z':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  Inc(Run);
-  if CharInSet(fLine[Run], ['0'..'9']) and not IsAlphaNumChar(Run + 1) then
-  begin
-    fTokenID := tkSymbol;
-    Inc(Run);
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-procedure TSynAWKSyn.SymbolProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynAWKSyn.PlusProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(fLine[Run], ['+', '=']) then
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.MinusProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(fLine[Run], ['-', '=']) then
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.OpInputProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if (fLine[Run] = '=') then
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.ExclamProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(fLine[Run], ['=', '~']) then
-    Inc(Run);
-end;
-
-procedure TSynAWKSyn.QuestionProc;
-begin
-  Inc(Run);
-  if (fLine[Run] = ':') then
-  begin
-    fTokenID := tkSymbol;
-    Inc(Run);
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-procedure TSynAWKSyn.OrProc;
-begin
-  Inc(Run);
-  if (fLine[Run] = '|') then
-  begin
-    fTokenID := tkSymbol;
-    Inc(Run);
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-procedure TSynAWKSyn.AndProc;
-begin
-  Inc(Run);
-  if (fLine[Run] = '&') then
-  begin
-    fTokenID := tkSymbol;
-    Inc(Run);
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-constructor TSynAWKSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Foreground := clBlue;
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fInterFuncAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
-  fInterFuncAttri.Foreground := $00408080;
-  fInterFuncAttri.Style := [fsBold];
-  AddAttribute(fInterFuncAttri);
-
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Foreground := $00FF0080;
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  fStringAttri.Foreground := clTeal;
-  AddAttribute(fStringAttri);
-
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  fSymbolAttri.Style := [fsBold];
-  AddAttribute(fSymbolAttri);
-
-  fSysVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystemValue, SYNS_FriendlyAttrSystemValue);
-  fSysVarAttri.Foreground := $000080FF;
-  fSysVarAttri.Style := [fsBold];
-  AddAttribute(fSysVarAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-
-  AWKSyntaxList := TStringList.Create;
-  MakeSyntaxList;
-
-  fDefaultFilter := SYNS_FilterAWK;
-end;
-
-destructor TSynAWKSyn.Destroy;
-begin
-  AWKSyntaxList.Free;
-
-  inherited Destroy;
-end;
-
-procedure TSynAWKSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynAWKSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynAWKSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynAWKSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-function TSynAWKSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := fCommentAttri;
-    SYN_ATTR_KEYWORD: Result := fKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynAWKSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynAWKSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynAWKSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkInterFunc: Result := fInterFuncAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkSysVar: Result := fSysVarAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynAWKSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynAWKSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterAWK;
-end;
-
-class function TSynAWKSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangAWK;
-end;
-
-class function TSynAWKSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangAWK;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynAWKSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterAWK.pas, released 2000-06-18.
+The Original Code is based on the hkAWKSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Hideo Koiso.
+Unicode translation by Maël Hörz.
+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: SynHighlighterAWK.pas,v 1.10.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a AWK Script highlighter for SynEdit)
+@author(Hideo Koiso , converted to SynEdit by David Muir )
+@created(7 November 1999, converted to SynEdit April 18, 2000)
+@lastmod(June 19, 2000)
+The SynHighlighterAWK unit provides SynEdit with a AWK Script (.awk) highlighter.
+}
+
+unit SynHighlighterAWK;
+
+interface
+
+{$I SynEdit.inc}
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkInterFunc, tkKey, tkNull,
+    tkNumber, tkSpace, tkString, tkSymbol, tkSysVar, tkUnknown);
+
+  TSynAWKSyn = class(TSynCustomHighLighter)
+  private
+    AWKSyntaxList: TUnicodeStringList;
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInterFuncAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FSysVarAttri: TSynHighlighterAttributes;
+    procedure AndProc;
+    procedure CommentProc;
+    procedure CRProc;
+    procedure ExclamProc;
+    procedure FieldRefProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure MakeSyntaxList;
+    procedure MinusProc;
+    procedure NullProc;
+    procedure OpInputProc;
+    procedure OrProc;
+    procedure PlusProc;
+    procedure QuestionProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure SymbolProc;
+    procedure NumberProc;
+    procedure BraceProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property InterFuncAttri: TSynHighlighterAttributes read FInterFuncAttri
+      write FInterFuncAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+    property SysVarAttri: TSynHighlighterAttributes read FSysVarAttri
+      write FSysVarAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+  end;
+
+implementation
+
+uses
+{$IFDEF UNICODE}
+  WideStrUtils,
+{$ENDIF}
+  SynEditStrConst;
+
+procedure TSynAWKSyn.MakeSyntaxList;
+begin
+  with AWKSyntaxList do
+  begin
+    Sorted := True;
+
+    { *** Preferably sort and put previously. *** }
+    AddObject('ARGC', TObject(tkSysVar));
+    AddObject('ARGIND', TObject(tkSysVar)); { GNU Extention }
+    AddObject('ARGV', TObject(tkSysVar));
+    AddObject('atan2', TObject(tkInterFunc));
+    AddObject('BEGIN', TObject(tkKey));
+    AddObject('break', TObject(tkKey));
+    AddObject('close', TObject(tkInterFunc));
+    AddObject('continue', TObject(tkKey));
+    AddObject('CONVFMT', TObject(tkSysVar)); { POSIX Extention }
+    AddObject('cos', TObject(tkInterFunc));
+    AddObject('delete', TObject(tkInterFunc));
+    AddObject('do', TObject(tkKey));
+    AddObject('else', TObject(tkKey));
+    AddObject('END', TObject(tkKey));
+    AddObject('ENVIRON', TObject(tkSysVar));
+    AddObject('ERRNO', TObject(tkSysVar)); { GNU Extention }
+    AddObject('exit', TObject(tkKey));
+    AddObject('exp', TObject(tkInterFunc));
+    AddObject('FIELDWIDTH', TObject(tkSysVar)); { GNU Extention }
+    AddObject('FILENAME', TObject(tkSysVar));
+    AddObject('FNR', TObject(tkSysVar));
+    AddObject('for', TObject(tkKey));
+    AddObject('FS', TObject(tkSysVar));
+    AddObject('function', TObject(tkKey));
+    AddObject('getline', TObject(tkKey));
+    AddObject('gsub', TObject(tkInterFunc));
+    AddObject('if', TObject(tkKey));
+    AddObject('IGNORECASE', TObject(tkSysVar));
+    AddObject('index', TObject(tkInterFunc));
+    AddObject('int', TObject(tkInterFunc));
+    AddObject('jindex', TObject(tkInterFunc)); { jgawk }
+    AddObject('jlength', TObject(tkInterFunc)); { jgawk }
+    AddObject('jsubstr', TObject(tkInterFunc)); { jgawk }
+    AddObject('length', TObject(tkInterFunc));
+    AddObject('log', TObject(tkInterFunc));
+    AddObject('match', TObject(tkInterFunc));
+    AddObject('next', TObject(tkUnknown)); { & next file (GNU Extention) }
+    AddObject('NF', TObject(tkSysVar));
+    AddObject('NR', TObject(tkSysVar));
+    AddObject('OFMT', TObject(tkSysVar));
+    AddObject('OFS', TObject(tkSysVar));
+    AddObject('ORS', TObject(tkSysVar));
+    AddObject('print', TObject(tkKey));
+    AddObject('printf', TObject(tkInterFunc));
+    AddObject('rand', TObject(tkInterFunc));
+    AddObject('return', TObject(tkKey));
+    AddObject('RLENGTH', TObject(tkSysVar));
+    AddObject('RS', TObject(tkSysVar));
+    AddObject('RSTART', TObject(tkSysVar));
+    AddObject('sin', TObject(tkInterFunc));
+    AddObject('split', TObject(tkInterFunc));
+    AddObject('sprintf', TObject(tkInterFunc));
+    AddObject('sqrt', TObject(tkInterFunc));
+    AddObject('srand', TObject(tkInterFunc));
+    AddObject('strftime', TObject(tkInterFunc)); { GNU Extention }
+    AddObject('sub', TObject(tkInterFunc));
+    AddObject('SUBSEP', TObject(tkSysVar));
+    AddObject('substr', TObject(tkInterFunc));
+    AddObject('system', TObject(tkInterFunc));
+    AddObject('systime', TObject(tkInterFunc)); { GNU Extention }
+    AddObject('tolower', TObject(tkInterFunc));
+    AddObject('toupper', TObject(tkInterFunc));
+    AddObject('while', TObject(tkKey));
+  end;
+end;
+
+procedure TSynAWKSyn.BraceProc;
+begin
+  FTokenID := tkIdentifier;
+  Inc(Run);
+end;
+
+procedure TSynAWKSyn.NumberProc;
+begin
+  FTokenID := tkNumber;
+  Inc(Run);
+  while CharInSet(FLine[Run], ['0'..'9']) do
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.IdentProc;
+var
+  i: Integer;
+  idx: Integer;
+  s: UnicodeString;
+begin
+  i := Run;
+  while CharInSet(FLine[i], ['a'..'z', 'A'..'Z']) do
+    Inc(i);
+  SetLength(s, i - Run);
+  WStrLCopy(PWideChar(s), FLine + Run, i - Run);
+  Run := i;
+  if AWKSyntaxList.Find(s, idx) and (AWKSyntaxList.Strings[idx] = s) then
+  begin
+    FTokenID := TtkTokenKind(AWKSyntaxList.Objects[idx]);
+    if (FTokenID = tkUnKnown) then
+    begin
+      FTokenID := tkKey;
+      if (FLine[i] = ' ') then
+      begin
+        while (FLine[i] = ' ') do
+          Inc(i);
+        if (FLine[i + 0] = 'f') and
+          (FLine[i + 1] = 'i') and
+          (FLine[i + 2] = 'l') and
+          (FLine[i + 3] = 'e') and
+          CharInSet(FLine[i + 4], [#0..#32, ';']) then
+        begin
+          Run := (i + 4);
+        end;
+      end;
+    end;
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynAWKSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+    #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    '"', #$27: StringProc; { "..." }
+    '(', ')', '[', ']': BraceProc; { (, ), [ and ] }
+    '#': CommentProc; { # ... }
+    '$': FieldRefProc; { $0 .. $9 }
+    '+': PlusProc; { +, ++ and += }
+    '-': MinusProc; { -, -- and -= }
+    '!': ExclamProc; { ! and !~ }
+    '?': QuestionProc; { ?: }
+    '|': OrProc; { || }
+    '&': AndProc; { && }
+    '*', '/', '%', '^', '<', '=', '>': OpInputProc; { *=, /=, %= ... etc. }
+    'a'..'z', 'A'..'Z': IdentProc;
+    '0'..'9': NumberProc;
+    else SymbolProc;
+  end;
+  inherited;
+end;
+
+procedure TSynAWKSyn.StringProc;
+begin
+  repeat
+    Inc(Run);
+    if (FLine[Run] = '"') and (FLine[Run - 1] <> '\') then
+    begin
+      FTokenID := tkString;
+      Inc(Run);
+      Exit;
+    end;
+  until CharInSet(FLine[Run], [#0..#31]);
+  FTokenID := tkIdentifier;
+end;
+
+procedure TSynAWKSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  while not IsLineEnd(Run) do
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.FieldRefProc;
+
+  function IsAlphaNumChar(Run: Integer): Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'a'..'z', 'A'..'Z':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  if CharInSet(FLine[Run], ['0'..'9']) and not IsAlphaNumChar(Run + 1) then
+  begin
+    FTokenID := tkSymbol;
+    Inc(Run);
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynAWKSyn.SymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynAWKSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['+', '=']) then
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['-', '=']) then
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.OpInputProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run] = '=') then
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.ExclamProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['=', '~']) then
+    Inc(Run);
+end;
+
+procedure TSynAWKSyn.QuestionProc;
+begin
+  Inc(Run);
+  if (FLine[Run] = ':') then
+  begin
+    FTokenID := tkSymbol;
+    Inc(Run);
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynAWKSyn.OrProc;
+begin
+  Inc(Run);
+  if (FLine[Run] = '|') then
+  begin
+    FTokenID := tkSymbol;
+    Inc(Run);
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynAWKSyn.AndProc;
+begin
+  Inc(Run);
+  if (FLine[Run] = '&') then
+  begin
+    FTokenID := tkSymbol;
+    Inc(Run);
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+constructor TSynAWKSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Foreground := clBlue;
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FInterFuncAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
+  FInterFuncAttri.Foreground := $00408080;
+  FInterFuncAttri.Style := [fsBold];
+  AddAttribute(FInterFuncAttri);
+
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Foreground := $00FF0080;
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  FStringAttri.Foreground := clTeal;
+  AddAttribute(FStringAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  FSymbolAttri.Style := [fsBold];
+  AddAttribute(FSymbolAttri);
+
+  FSysVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystemValue, SYNS_FriendlyAttrSystemValue);
+  FSysVarAttri.Foreground := $000080FF;
+  FSysVarAttri.Style := [fsBold];
+  AddAttribute(FSysVarAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+
+  AWKSyntaxList := TUnicodeStringList.Create;
+  MakeSyntaxList;
+
+  FDefaultFilter := SYNS_FilterAWK;
+end;
+
+destructor TSynAWKSyn.Destroy;
+begin
+  AWKSyntaxList.Free;
+
+  inherited Destroy;
+end;
+
+procedure TSynAWKSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynAWKSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynAWKSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynAWKSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+function TSynAWKSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+begin
+  case Index of
+    SYN_ATTR_COMMENT: Result := FCommentAttri;
+    SYN_ATTR_KEYWORD: Result := FKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynAWKSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynAWKSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynAWKSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkInterFunc: Result := FInterFuncAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkSysVar: Result := FSysVarAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynAWKSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynAWKSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterAWK;
+end;
+
+class function TSynAWKSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangAWK;
+end;
+
+class function TSynAWKSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangAWK;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynAWKSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterAsm.pas b/Source/VCL/SynEdit/Source/SynHighlighterAsm.pas
index d8e5428d..c2d54e3a 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterAsm.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterAsm.pas
@@ -1,485 +1,490 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterASM.pas, released 2000-04-18.
-The Original Code is based on the nhAsmSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Nick Hoddinott.
-Unicode translation by Maël Hörz.
-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: SynHighlighterAsm.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a x86 Assembler highlighter for SynEdit)
-@author(Nick Hoddinott , converted to SynEdit by David Muir )
-@created(7 November 1999, converted to SynEdit April 18, 2000)
-@lastmod(April 18, 2000)
-The SynHighlighterASM unit provides SynEdit with a x86 Assembler (.asm) highlighter.
-The highlighter supports all x86 op codes, Intel MMX and AMD 3D NOW! op codes.
-Thanks to Martin Waldenburg, Hideo Koiso.
-}
-
-unit SynHighlighterAsm;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown);
-
-type
-  TSynAsmSyn = class(TSynCustomHighlighter)
-  private
-    fTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fKeywords: TSynHashEntryList;
-    function HashKey(Str: PWideChar): Cardinal;
-    procedure CommentProc;
-    procedure CRProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure SingleQuoteStringProc;
-    procedure SymbolProc;
-    procedure UnknownProc;
-    procedure DoAddKeyword(AKeyword: string; AKind: integer);
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  Mnemonics: string =
-    'aaa,aad,aam,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,' +
-    'btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsd,cmpsw,' +
-    'cmpxchg,cwd,cwde,daa,das,dec,div,emms,enter,f2xm1,fabs,fadd,faddp,fbld,' +
-    'fbstp,fchs,fclex,fcmovb,fcmovbe,fcmove,fcmovnb,fcmovnbe,fcmovne,fcmovnu,' +
-    'fcmovu,fcom,fcomi,fcomip,fcomp,fcompp,fcos,fdecstp,fdiv,fdivp,fdivr,' +
-    'fdivrp,femms,ffree,fiadd,ficom,ficomp,fidiv,fidivr,fild,fimul,fincstp,' +
-    'finit,fist,fistp,fisub,fisubr,fld,fld1,fldcw,fldenv,fldl2e,fldl2t,fldlg2,' +
-    'fldln2,fldpi,fldz,fmul,fmulp,fnclex,fninit,fnop,fnsave,fnstcw,fnstenv,' +
-    'fnstsw,fpatan,fprem1,fptan,frndint,frstor,fsave,fscale,fsin,fsincos,' +
-    'fsqrt,fst,fstcw,fstenv,fstp,fstsw,fsub,fsubp,fsubr,fsubrp,ftst,' +
-    'fucom,fucomi,fucomip,fucomp,fucompp,fwait,fxch,fxtract,fyl2xp1,hlt,idiv,' +
-    'imul,in,inc,ins,insb,insd,insw,int,into,invd,invlpg,iret,iretd,iretw,' +
-    'ja,jae,jb,jbe,jc,jcxz,je,jecxz,jg,jge,jl,jle,jmp,jna,jnae,jnb,jnbe,jnc,' +
-    'jne,jng,jnge,jnl,jnle,jno,jnp,jns,jnz,jo,jp,jpe,jpo,js,jz,lahf,lar,lds,' +
-    'lea,leave,les,lfs,lgdt,lgs,lidt,lldt,lmsw,lock,lods,lodsb,lodsd,lodsw,' +
-    'loop,loope,loopne,loopnz,loopz,lsl,lss,ltr,mov,movd,movq, movs,movsb,' +
-    'movsd,movsw,movsx,movzx,mul,neg,nop,not,or,out,outs,outsb,outsd,outsw,' +
-    'packssdw,packsswb,packuswb,paddb,paddd,paddsb,paddsw,paddusb,paddusw,' +
-    'paddw,pand,pandn,pavgusb,pcmpeqb,pcmpeqd,pcmpeqw,pcmpgtb,pcmpgtd,pcmpgtw,' +
-    'pf2id,pfacc,pfadd,pfcmpeq,pfcmpge,pfcmpgt,pfmax,pfmin,pfmul,pfrcp,' +
-    'pfrcpit1,pfrcpit2,pfrsqit1,pfrsqrt,pfsub,pfsubr,pi2fd,pmaddwd,pmulhrw,' +
-    'pmulhw,pmullw,pop,popa,popad,popaw,popf,popfd,popfw,por,prefetch,prefetchw,' +
-    'pslld,psllq,psllw,psrad,psraw,psrld,psrlq,psrlw,psubb,psubd,psubsb,' +
-    'psubsw,psubusb,psubusw,psubw,punpckhbw,punpckhdq,punpckhwd,punpcklbw,' +
-    'punpckldq,punpcklwd,push,pusha,pushad,pushaw,pushf,pushfd,pushfw,pxor,' +
-    'rcl,rcr,rep,repe,repne,repnz,repz,ret,rol,ror,sahf,sal,sar,sbb,scas,' +
-    'scasb,scasd,scasw,seta,setae,setb,setbe,setc,sete,setg,setge,setl,setle,' +
-    'setna,setnae,setnb,setnbe,setnc,setne,setng,setnge,setnl,setnle,setno,' +
-    'setnp,setns,setnz,seto,setp,setpo,sets,setz,sgdt,shl,shld,shr,shrd,sidt,' +
-    'sldt,smsw,stc,std,sti,stos,stosb,stosd,stosw,str,sub,test,verr,verw,' +
-    'wait,wbinvd,xadd,xchg,xlat,xlatb,xor';
-
-procedure TSynAsmSyn.DoAddKeyword(AKeyword: string; AKind: integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-{$Q-}
-function TSynAsmSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 197 + Ord(Str^) * 14;
-    inc(Str);
-  end;
-  Result := Result mod 4561;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynAsmSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Entry: TSynHashEntry;
-begin
-  fToIdent := MayBe;
-  Entry := fKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > fStringLen then
-      break
-    else if Entry.KeywordLen = fStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
-end;
-
-constructor TSynAsmSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fKeywords := TSynHashEntryList.Create;
-
-  fCommentAttri       := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri    := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri           := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style     := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri        := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri         := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri        := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri        := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-
-  EnumerateKeywords(Ord(tkKey), Mnemonics, IsIdentChar, DoAddKeyword);
-  SetAttributesOnChange(DefHighlightChange);
-  fDefaultFilter      := SYNS_FilterX86Assembly;
-end;
-
-destructor TSynAsmSyn.Destroy;
-begin
-  fKeywords.Free;
-  inherited Destroy;
-end;
-
-procedure TSynAsmSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-  repeat
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynAsmSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynAsmSyn.GreaterProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-  if fLine[Run] = '=' then Inc(Run);
-end;
-
-procedure TSynAsmSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynAsmSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynAsmSyn.LowerProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-  if CharInSet(fLine[Run], ['=', '>']) then Inc(Run);
-end;
-
-procedure TSynAsmSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynAsmSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'a'..'f', 'h', 'A'..'F', 'H':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-    Inc(Run);
-end;
-
-procedure TSynAsmSyn.SlashProc;
-begin
-  Inc(Run);
-  if fLine[Run] = '/' then begin
-    fTokenID := tkComment;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run);
-  end else
-    fTokenID := tkSymbol;
-end;
-
-procedure TSynAsmSyn.SpaceProc;
-begin
-  fTokenID := tkSpace;
-  repeat
-    Inc(Run);
-  until (fLine[Run] > #32) or IsLineEnd(Run);
-end;
-
-procedure TSynAsmSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then
-    inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynAsmSyn.SingleQuoteStringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then
-    inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynAsmSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynAsmSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkIdentifier;
-end;
-
-procedure TSynAsmSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #34: StringProc;
-    #39: SingleQuoteStringProc;
-    '>': GreaterProc;
-    '<': LowerProc;
-    '/': SlashProc;
-
-    'A'..'Z', 'a'..'z', '_':
-      IdentProc;
-    '0'..'9':
-      NumberProc;
-    #1..#9, #11, #12, #14..#32:
-      SpaceProc;
-    '#', ';':
-      CommentProc;
-    '.', ':', '&', '{', '}', '=', '^', '-', '+', '(', ')', '*':
-      SymbolProc;
-    else
-      UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynAsmSyn.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 TSynAsmSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynAsmSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynAsmSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynAsmSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-class function TSynAsmSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangX86Asm;
-end;
-
-function TSynAsmSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterX86Assembly;
-end;
-
-function TSynAsmSyn.GetSampleSource: string;
-begin
-  Result := '; x86 assembly sample source'#13#10 +
-            '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
-            '    ASSUME	CS:CODE'#13#10 +
-            #13#10 +
-            '    PUSH SS'#13#10 +
-            '    POP DS'#13#10 +
-            '    MOV AX, AABBh'#13#10 +
-            '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
-            '    JMP SHORT AsmEnd'#13#10 +
-            #13#10 +
-            '  welcomeMsg DB ''Hello World'', 0'#13#10 +
-            #13#10 +
-            '  AsmEnd:'#13#10 +
-            '    MOV AX, 0'#13#10 +
-            #13#10 +
-            '  CODE	ENDS'#13#10 +
-            'END';
-end;
-
-class function TSynAsmSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangX86Asm;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynAsmSyn);
-end.
-
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterASM.pas, released 2000-04-18.
+The Original Code is based on the nhAsmSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Nick Hoddinott.
+Unicode translation by Maël Hörz.
+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: SynHighlighterAsm.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a x86 Assembler highlighter for SynEdit)
+@author(Nick Hoddinott , converted to SynEdit by David Muir )
+@created(7 November 1999, converted to SynEdit April 18, 2000)
+@lastmod(April 18, 2000)
+The SynHighlighterASM unit provides SynEdit with a x86 Assembler (.asm) highlighter.
+The highlighter supports all x86 op codes, Intel MMX and AMD 3D NOW! op codes.
+Thanks to Martin Waldenburg, Hideo Koiso.
+}
+
+unit SynHighlighterAsm;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynHighlighterHashEntries,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkString, tkSymbol, tkUnknown);
+
+type
+  TSynAsmSyn = class(TSynCustomHighlighter)
+  private
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TSynHashEntryList;
+    function HashKey(Str: PWideChar): Cardinal;
+    procedure CommentProc;
+    procedure CRProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure SingleQuoteStringProc;
+    procedure SymbolProc;
+    procedure UnknownProc;
+    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;    
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  Mnemonics: UnicodeString =
+    'aaa,aad,aam,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,' +
+    'btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsd,cmpsw,' +
+    'cmpxchg,cwd,cwde,daa,das,dec,div,emms,enter,f2xm1,fabs,fadd,faddp,fbld,' +
+    'fbstp,fchs,fclex,fcmovb,fcmovbe,fcmove,fcmovnb,fcmovnbe,fcmovne,fcmovnu,' +
+    'fcmovu,fcom,fcomi,fcomip,fcomp,fcompp,fcos,fdecstp,fdiv,fdivp,fdivr,' +
+    'fdivrp,femms,ffree,fiadd,ficom,ficomp,fidiv,fidivr,fild,fimul,fincstp,' +
+    'finit,fist,fistp,fisub,fisubr,fld,fld1,fldcw,fldenv,fldl2e,fldl2t,fldlg2,' +
+    'fldln2,fldpi,fldz,fmul,fmulp,fnclex,fninit,fnop,fnsave,fnstcw,fnstenv,' +
+    'fnstsw,fpatan,fprem1,fptan,frndint,frstor,fsave,fscale,fsin,fsincos,' +
+    'fsqrt,fst,fstcw,fstenv,fstp,fstsw,fsub,fsubp,fsubr,fsubrp,ftst,' +
+    'fucom,fucomi,fucomip,fucomp,fucompp,fwait,fxch,fxtract,fyl2xp1,hlt,idiv,' +
+    'imul,in,inc,ins,insb,insd,insw,int,into,invd,invlpg,iret,iretd,iretw,' +
+    'ja,jae,jb,jbe,jc,jcxz,je,jecxz,jg,jge,jl,jle,jmp,jna,jnae,jnb,jnbe,jnc,' +
+    'jne,jng,jnge,jnl,jnle,jno,jnp,jns,jnz,jo,jp,jpe,jpo,js,jz,lahf,lar,lds,' +
+    'lea,leave,les,lfs,lgdt,lgs,lidt,lldt,lmsw,lock,lods,lodsb,lodsd,lodsw,' +
+    'loop,loope,loopne,loopnz,loopz,lsl,lss,ltr,mov,movd,movq, movs,movsb,' +
+    'movsd,movsw,movsx,movzx,mul,neg,nop,not,or,out,outs,outsb,outsd,outsw,' +
+    'packssdw,packsswb,packuswb,paddb,paddd,paddsb,paddsw,paddusb,paddusw,' +
+    'paddw,pand,pandn,pavgusb,pcmpeqb,pcmpeqd,pcmpeqw,pcmpgtb,pcmpgtd,pcmpgtw,' +
+    'pf2id,pfacc,pfadd,pfcmpeq,pfcmpge,pfcmpgt,pfmax,pfmin,pfmul,pfrcp,' +
+    'pfrcpit1,pfrcpit2,pfrsqit1,pfrsqrt,pfsub,pfsubr,pi2fd,pmaddwd,pmulhrw,' +
+    'pmulhw,pmullw,pop,popa,popad,popaw,popf,popfd,popfw,por,prefetch,prefetchw,' +
+    'pslld,psllq,psllw,psrad,psraw,psrld,psrlq,psrlw,psubb,psubd,psubsb,' +
+    'psubsw,psubusb,psubusw,psubw,punpckhbw,punpckhdq,punpckhwd,punpcklbw,' +
+    'punpckldq,punpcklwd,push,pusha,pushad,pushaw,pushf,pushfd,pushfw,pxor,' +
+    'rcl,rcr,rep,repe,repne,repnz,repz,ret,rol,ror,sahf,sal,sar,sbb,scas,' +
+    'scasb,scasd,scasw,seta,setae,setb,setbe,setc,sete,setg,setge,setl,setle,' +
+    'setna,setnae,setnb,setnbe,setnc,setne,setng,setnge,setnl,setnle,setno,' +
+    'setnp,setns,setnz,seto,setp,setpo,sets,setz,sgdt,shl,shld,shr,shrd,sidt,' +
+    'sldt,smsw,stc,std,sti,stos,stosb,stosd,stosw,str,sub,test,verr,verw,' +
+    'wait,wbinvd,xadd,xchg,xlat,xlatb,xor';
+
+procedure TSynAsmSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+{$Q-}
+function TSynAsmSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 197 + Ord(Str^) * 14;
+    Inc(Str);
+  end;
+  Result := Result mod 4561;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynAsmSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Entry: TSynHashEntry;
+begin
+  FToIdent := MayBe;
+  Entry := FKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+  Result := tkIdentifier;
+end;
+
+constructor TSynAsmSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FKeywords := TSynHashEntryList.Create;
+
+  FCommentAttri       := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri    := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri           := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style     := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri        := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri         := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri        := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri        := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  EnumerateKeywords(Ord(tkKey), Mnemonics, IsIdentChar, DoAddKeyword);
+  SetAttributesOnChange(DefHighlightChange);
+  FDefaultFilter      := SYNS_FilterX86Assembly;
+end;
+
+destructor TSynAsmSyn.Destroy;
+begin
+  FKeywords.Free;
+  inherited Destroy;
+end;
+
+procedure TSynAsmSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynAsmSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynAsmSyn.GreaterProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  if FLine[Run] = '=' then Inc(Run);
+end;
+
+procedure TSynAsmSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynAsmSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynAsmSyn.LowerProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  if CharInSet(FLine[Run], ['=', '>']) then Inc(Run);
+end;
+
+procedure TSynAsmSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynAsmSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'a'..'f', 'h', 'A'..'F', 'H':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+    Inc(Run);
+end;
+
+procedure TSynAsmSyn.SlashProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '/' then begin
+    FTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end else
+    FTokenID := tkSymbol;
+end;
+
+procedure TSynAsmSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  repeat
+    Inc(Run);
+  until (FLine[Run] > #32) or IsLineEnd(Run);
+end;
+
+procedure TSynAsmSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then
+    Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynAsmSyn.SingleQuoteStringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then
+    Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynAsmSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynAsmSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkIdentifier;
+end;
+
+procedure TSynAsmSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    #34: StringProc;
+    #39: SingleQuoteStringProc;
+    '>': GreaterProc;
+    '<': LowerProc;
+    '/': SlashProc;
+
+    'A'..'Z', 'a'..'z', '_':
+      IdentProc;
+    '0'..'9':
+      NumberProc;
+    #1..#9, #11, #12, #14..#32:
+      SpaceProc;
+    '#', ';':
+      CommentProc;
+    '.', ':', '&', '{', '}', '=', '^', '-', '+', '(', ')', '*':
+      SymbolProc;
+    else
+      UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynAsmSyn.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 TSynAsmSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynAsmSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynAsmSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynAsmSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+class function TSynAsmSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangX86Asm;
+end;
+
+function TSynAsmSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterX86Assembly;
+end;
+
+function TSynAsmSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '; x86 assembly sample source'#13#10 +
+    '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
+    '    ASSUME	CS:CODE'#13#10 +
+    #13#10 +
+    '    PUSH SS'#13#10 +
+    '    POP DS'#13#10 +
+    '    MOV AX, AABBh'#13#10 +
+    '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
+    '    JMP SHORT AsmEnd'#13#10 +
+    #13#10 +
+    '  welcomeMsg DB ''Hello World'', 0'#13#10 +
+    #13#10 +
+    '  AsmEnd:'#13#10 +
+    '    MOV AX, 0'#13#10 +
+    #13#10 +
+    '  CODE	ENDS'#13#10 +
+    'END';
+end;
+
+class function TSynAsmSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangX86Asm;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynAsmSyn);
+{$ENDIF}
+end.
+
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterAsmMASM.pas b/Source/VCL/SynEdit/Source/SynHighlighterAsmMASM.pas
new file mode 100644
index 00000000..80cdf42a
--- /dev/null
+++ b/Source/VCL/SynEdit/Source/SynHighlighterAsmMASM.pas
@@ -0,0 +1,749 @@
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterASM.pas, released 2000-04-18.
+The Original Code is based on the nhAsmSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Nick Hoddinott.
+Unicode translation by Maël Hörz.
+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: SynHighlighterAsmMASM.pas,v 1.0 2017/02/12 tjaeger Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides Microsoft Macro Assembler (MASM) highlighter for SynEdit)
+@author(Thomas Jaeger )
+@created(February 12th, 2017)
+@lastmod(February 12th, 2017)
+The SynHighlighterASM unit provides SynEdit with a Microsoft Macro Assembler (MASM) highlighter.
+The highlighter supports all MASM features including directives and macros.
+
+May experience out of memory when compiling package. Folow instructions to
+compile externally until I move the API functions externally into JSON file.
+}
+
+unit SynHighlighterAsmMASM;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynHighlighterHashEntries,
+  SynUnicode,
+  SysUtils,
+  IOUtils,
+  SynMemo,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkString, tkSymbol, tkUnknown, tkDirectives, tkRegister, tkApi, tkInclude,
+    tkOperator);
+
+type
+  TSynAsmMASMSyn = class(TSynCustomHighlighter)
+  private
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIncludeAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TSynHashEntryList;
+    FDirectivesKeywords: TSynHashEntryList;
+    FDirectivesAttri: TSynHighlighterAttributes;
+    FRegisterKeywords: TSynHashEntryList;
+    FRegisterAttri: TSynHighlighterAttributes;
+    FApiKeywords: TSynHashEntryList;
+    FApiAttri: TSynHighlighterAttributes;
+    FOperatorKeywords: TSynHashEntryList;
+    FOperatorAttri: TSynHighlighterAttributes;
+    FApis: UnicodeString;
+    function HashKey(Str: PWideChar): Cardinal;
+    procedure CommentProc;
+    procedure CRProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure SlashProc;
+    procedure IncludeProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure SingleQuoteStringProc;
+    procedure SymbolProc;
+    procedure UnknownProc;
+    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    procedure DoAddDirectivesKeyword(AKeyword: UnicodeString; AKind: Integer);
+    procedure DoAddRegisterKeyword(AKeyword: UnicodeString; AKind: Integer);
+    procedure DoAddApiKeyword(AKeyword: UnicodeString; AKind: Integer);
+    procedure DoAddOperatorKeyword(AKeyword: UnicodeString; AKind: Integer);
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    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 DirectivesAttri: TSynHighlighterAttributes read FDirectivesAttri write FDirectivesAttri;
+    property RegisterAttri: TSynHighlighterAttributes read FRegisterAttri write FRegisterAttri;
+    property ApiAttri: TSynHighlighterAttributes read FApiAttri write FApiAttri;
+    property IncludeAttri: TSynHighlighterAttributes read FIncludeAttri write FIncludeAttri;
+    property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri write FOperatorAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  Mnemonics: UnicodeString =
+    'aaa,aad,aam,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,' +
+    'btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsd,cmpsw,' +
+    'cmpxchg,cwd,cwde,daa,das,dec,div,emms,enter,f2xm1,fabs,fadd,faddp,fbld,' +
+    'fbstp,fchs,fclex,fcmovb,fcmovbe,fcmove,fcmovnb,fcmovnbe,fcmovne,fcmovnu,' +
+    'fcmovu,fcom,fcomi,fcomip,fcomp,fcompp,fcos,fdecstp,fdiv,fdivp,fdivr,' +
+    'fdivrp,femms,ffree,fiadd,ficom,ficomp,fidiv,fidivr,fild,fimul,fincstp,' +
+    'finit,fist,fistp,fisub,fisubr,fld,fld1,fldcw,fldenv,fldl2e,fldl2t,fldlg2,' +
+    'fldln2,fldpi,fldz,fmul,fmulp,fnclex,fninit,fnop,fnsave,fnstcw,fnstenv,' +
+    'fnstsw,fpatan,fprem1,fptan,frndint,frstor,fsave,fscale,fsin,fsincos,' +
+    'fsqrt,fst,fstcw,fstenv,fstp,fstsw,fsub,fsubp,fsubr,fsubrp,ftst,' +
+    'fucom,fucomi,fucomip,fucomp,fucompp,fwait,fxch,fxtract,fyl2xp1,hlt,idiv,' +
+    'imul,in,inc,ins,insb,insd,insw,int,into,invd,invlpg,iret,iretd,iretw,' +
+    'ja,jae,jb,jbe,jc,jcxz,je,jecxz,jg,jge,jl,jle,jmp,jna,jnae,jnb,jnbe,jnc,' +
+    'jne,jng,jnge,jnl,jnle,jno,jnp,jns,jnz,jo,jp,jpe,jpo,js,jz,lahf,lar,lds,' +
+    'lea,leave,les,lfs,lgdt,lgs,lidt,lldt,lmsw,lock,lods,lodsb,lodsd,lodsw,' +
+    'loop,loope,loopne,loopnz,loopz,lsl,lss,ltr,mov,movd,movq, movs,movsb,' +
+    'movsd,movsw,movsx,movzx,mul,neg,nop,not,or,out,outs,outsb,outsd,outsw,' +
+    'packssdw,packsswb,packuswb,paddb,paddd,paddsb,paddsw,paddusb,paddusw,' +
+    'paddw,pand,pandn,pavgusb,pcmpeqb,pcmpeqd,pcmpeqw,pcmpgtb,pcmpgtd,pcmpgtw,' +
+    'pf2id,pfacc,pfadd,pfcmpeq,pfcmpge,pfcmpgt,pfmax,pfmin,pfmul,pfrcp,' +
+    'pfrcpit1,pfrcpit2,pfrsqit1,pfrsqrt,pfsub,pfsubr,pi2fd,pmaddwd,pmulhrw,' +
+    'pmulhw,pmullw,pop,popa,popad,popaw,popf,popfd,popfw,por,prefetch,prefetchw,' +
+    'pslld,psllq,psllw,psrad,psraw,psrld,psrlq,psrlw,psubb,psubd,psubsb,' +
+    'psubsw,psubusb,psubusw,psubw,punpckhbw,punpckhdq,punpckhwd,punpcklbw,' +
+    'punpckldq,punpcklwd,push,pusha,pushad,pushaw,pushf,pushfd,pushfw,pxor,' +
+    'rcl,rcr,rep,repe,repne,repnz,repz,ret,rol,ror,sahf,sal,sar,sbb,scas,' +
+    'scasb,scasd,scasw,seta,setae,setb,setbe,setc,sete,setg,setge,setl,setle,' +
+    'setna,setnae,setnb,setnbe,setnc,setne,setng,setnge,setnl,setnle,setno,' +
+    'setnp,setns,setnz,seto,setp,setpo,sets,setz,sgdt,shl,shld,shr,shrd,sidt,' +
+    'sldt,smsw,stc,std,sti,stos,stosb,stosd,stosw,str,sub,test,verr,verw,' +
+    'wait,wbinvd,xadd,xchg,xlat,xlatb,xor';
+
+  Registers: UnicodeString =
+    'ah,al,ax,bh,bl,bx,ch,cl,cs,cx,dh,di,dl,ds,dx,'+
+    'eax,ebp,ebx,ecx,edi,edx,es,esi,esp,fs,gs,ip,eip,'+
+    'rax,rcx,rdx,rbx,rsp,rbp,rsi,rdisi,ss,'+
+    'r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,'+
+    'r0D,r1D,r2D,r3D,r4D,r5D,r6D,r7D,r8D,r9D,r10D,r11D,r12D,r13D,r14D,r15D,'+
+    'r0W,r1W,r2W,r3W,r4W,r5W,r6W,r7W,r8W,r9W,r10W,r11W,r12W,r13W,r14W,r15W,'+
+    'r0L,r1L,r2L,r3L,r4L,r5L,r6L,r7L,r8L,r9L,r10L,r11L,r12L,r13L,r14L,r15L';
+
+  Operators: UnicodeString = '+,-,*,/,==,!=,>,>=,<,<=,||,&&,&,!,carry?,overflow?,'+
+                              'parity?,sign?,zero?,%,&&,abs,addr,and,dup,eq,ge,'+
+                              'gt,high,high32,highword,imagerel,le,length,lengthof,' +
+                              'low,low32,lowword,lroffset,lt,mask,mod,ne,not,offset,' +
+                              'opattr,or,ptr,seg,shl,.type,sectionrel,short,shr,' +
+                              'size,sizeof,this,type,width,xor';
+//  Operators: UnicodeString = 'abs,addr,and,dup,eq,ge,'+
+//                              'gt,high,high32,highword,imagerel,le,length,lengthof,' +
+//                              'low,low32,lowword,lroffset,lt,mask,mod,ne,not,offset,' +
+//                              'opattr,or,ptr,seg,shl,.type,sectionrel,short,shr,' +
+//                              'size,sizeof,this,type,width,xor';
+
+  Directives: UnicodeString =
+    '=,.386,.386p,.387,.486,.486p,.586,.586p,.686,.686p,alias,align,.allocstack,'+
+    '.alpha,assume,.break,byte,catstr,.code,comm,comment,.const,.continue,.cref,'+
+    '.data,.data?,db,dd,df,.dosseg,dosseg,dq,dt,dw,dword,echo,.else,else,elseif,'+
+  	'.elseif,'+
+    'elseif2,end,.endif,endm,endp,.endprolog,ends,.endw,equ,.err,.err2,.errb,'+
+    '.errdef,.errdif[[i]],.erre,.erridn[[i]],.errnb,.errndef,.errnz,even,.exit,'+
+    'exitm,extern,externdef,extrn,.fardata,.fardata?,for,forc,.fpo,fword,goto,'+
+    'group,.if,if,if2,ifb,ifdef,ifdif[[i]],ife,ifidn[[i]],ifnb,ifndef,include,'+
+    'includelib,instr,invoke,irp,irpc,.k3d,label,.lall,.lfcond,.list,.listall,'+
+    '.listif,.listmacro,.listmacroall,local,macro,mmword,.mmx,.model,name,'+
+    '.nocref,.nollist,.nolistif,.nolistmacro,offset,option,org,%out,oword,page,'+
+    'popcontext,proc,proto,public,purge,pushcontext,.pushframe,.pushreg,qword,'+
+    '.radix,real10,real4,real8,record,.repeat,repeat,rept,.safeseh,.sall,'+
+    '.savereg,.savexmm128,sbyte,sdword,segment,.seq,.setframe,.sfcond,sizestr,'+
+    'sqword,.stack,.startup,struc,struct,substr,subtitle,subttl,sword,tbyte,'+
+    'textequ,.tfcond,title,typedef,union,.until,.untilcxz,.while,while,word,'+
+    '.xall,.xcref,.xlist,.xmm,xmmword,ymmword,'+
+    'tiny,small,compact,medium,large,huge,flat,nearstack,farstack'; // .MODEL options
+
+  // Directives for Masm and Tasm
+//  ProcessorSpecification: UnicodeString =
+//    '.186,.286,.286C,.286P,.287,.386,.386C,.386P,.387,' +
+//    '.486,.486C,.486P,.586,.8086,.8087,.NO87,P186,P286,P286N,P286P,P287,P386,P386N,' +
+//    'P386P,P387,P486,P486N,P8086,P8087,PNO87';
+//
+//  GlobalControl: UnicodeString =
+//    'align,emul,ideal,jumps,largestack,masm,masm51,.msfloat,' +
+//    'multerrs,name,noemul,nojumps,nomasm51,nomulterrs,nosmart,nowarn,option,popcontext,' +
+//    'pushcontext,quirks,.radix,radix,smallstack,smart,version,warn';
+//
+//  SegmentControl: UnicodeString =
+//    '.alpha,alpha,assume,.code,codeseg,.const,const,.data,.data?,' +
+//    'dataseg,.dosseg,end,ends,.exit,exitcode,.fardata,fardata,.fardata?,group,.model,' +
+//    'model,org,segment,.seq,seq,.stack,stack,.startup,startupcode,udataseg,ufardata';
+//
+//  Procedures: UnicodeString =
+//    'arg,endp,invoke,label,local,locals,nolocals,proc,proto,uses';
+//
+//  Scope: UnicodeString =
+//    'comm,extern.externdef,extrn,global,include,includelib,publicdll,public';
+//
+//  DataAllocation: UnicodeString =
+//    'byte,db,dd,df,dp,dt,dw,dword,dq,fword,qword,real4,real8,' +
+//    'real10,sbyte,sdword,sword,tbyte,word';
+//
+//  ComplexDataTypes: UnicodeString =
+//    'align,ends,enum,even,evendata,record,struc,struct,table,' +
+//    'tblptr,typedef,union';
+//
+//  Macros: UnicodeString =
+//    'endm,exitm,for,forc,goto,irp,irpc,macro,purge,repeat,rept,textequ,while';
+//
+//  ConditionalAssembly: UnicodeString =
+//    'else,elseif,endif,if,if1,if2,ifb,ifdef,ifdif,ifdif1,ife,' +
+//    'ifidn,ifidni,ifnb,ifndef';
+//
+//  ConditionalError: UnicodeString =
+//    '.err,err,.err1,.err2,.errb,.errdef,.errdif,.errdifi,.erredifni'+
+//    'errif,errif1,errif2,errifb,errifdef,errifdif,errifdifi,errife,errifidn,errifidni,' +
+//    'errifnn,errifndef,.errnb,.errndef,.errnz';
+//
+//  ListingControl: UnicodeString =
+//    '%bin,%conds,%cref,.cref,%crefall,%crefref,%crefuref,%ctls,%depth,' +
+//    '%incl,.lall,.lfcond,%linum,%list,.list,.listall,.listif,.listmacro,.listmacroall,%macs,' +
+//    '%newpage,%noconds,%nocref,.nocref,%noctls,%noincl,%nolist,.nolist,.nolistif,.nolistmacro,' +
+//    '%nomacs,%nosyms,%notrunc,page,$pagesize,%pcnt,%poplctl,%pushlctl,.sall,.sfcond,subtitle,' +
+//    '%subttl,subttl,$syms,%tablsize,%text,.tfcond,%title,title,%trunc,.xall,.xcref,.xlist';
+//
+//  StringControl: UnicodeString = 'catstr,instr,sizestr,substr';
+//
+//  Miscellaneous: UnicodeString = '=,comment,display,echo,equ,%out';
+
+procedure TSynAsmMASMSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+procedure TSynAsmMASMSyn.DoAddDirectivesKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FDirectivesKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+procedure TSynAsmMASMSyn.DoAddRegisterKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FRegisterKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+procedure TSynAsmMASMSyn.DoAddApiKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FApiKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+procedure TSynAsmMASMSyn.DoAddOperatorKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Cardinal;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FOperatorKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+//{$Q-}
+function TSynAsmMASMSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 197 + Ord(Str^) * 14;
+    Inc(Str);
+  end;
+  Result := Result mod 4561;
+  FStringLen := Str - FToIdent;
+end;
+//{$Q+}
+
+function TSynAsmMASMSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Entry: TSynHashEntry;
+begin
+  FToIdent := MayBe;
+  Entry := FKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+
+  // THJ
+  Entry := FDirectivesKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+
+  // THJ
+  Entry := FRegisterKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+
+  // THJ
+  Entry := FApiKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+
+  Entry := FOperatorKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+
+  Result := tkIdentifier;
+end;
+
+constructor TSynAsmMASMSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FKeywords := TSynHashEntryList.Create;
+  FDirectivesKeywords := TSynHashEntryList.Create;
+  FRegisterKeywords := TSynHashEntryList.Create;
+  FApiKeywords := TSynHashEntryList.Create;
+  FOperatorKeywords := TSynHashEntryList.Create;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FNumberAttri.Foreground := clRed;
+  AddAttribute(FNumberAttri);
+
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  FDirectivesAttri   := TSynHighlighterAttributes.Create('Directives', 'Directives');
+  FDirectivesAttri.Foreground := $008CFF;
+  FDirectivesAttri.Style := [fsBold];
+  AddAttribute(FDirectivesAttri);
+
+  FRegisterAttri := TSynHighlighterAttributes.Create('Register', 'Register');
+  FRegisterAttri.Foreground := $32CD32;
+  FRegisterAttri.Style := [fsBold];
+  AddAttribute(FRegisterAttri);
+
+  FApiAttri := TSynHighlighterAttributes.Create('Api', 'Api');
+  FApiAttri.Foreground := clYellow;
+  FApiAttri.Style := [fsBold];
+  AddAttribute(FApiAttri);
+
+  FIncludeAttri := TSynHighlighterAttributes.Create('Include', 'Include');
+  FIncludeAttri.Foreground := clMoneyGreen;
+  FIncludeAttri.Style := [fsBold];
+  AddAttribute(FIncludeAttri);
+
+  FOperatorAttri := TSynHighlighterAttributes.Create('Operator', 'Operator');
+  FOperatorAttri.Foreground := clLime;
+  FOperatorAttri.Style := [fsBold];
+  AddAttribute(FOperatorAttri);
+
+  EnumerateKeywords(Ord(tkKey), Mnemonics, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkDirectives), Directives, IsIdentChar, DoAddDirectivesKeyword);
+  EnumerateKeywords(Ord(tkRegister), Registers, IsIdentChar, DoAddRegisterKeyword);
+
+  if FileExists('WinAPIInsertList.txt') then
+    FApis := TFile.ReadAllText('WinAPIInsertList.txt');
+  EnumerateKeywords(Ord(tkApi), FApis, IsIdentChar, DoAddApiKeyword);
+
+  EnumerateKeywords(Ord(tkOperator), Operators, IsIdentChar, DoAddOperatorKeyword);
+
+  SetAttributesOnChange(DefHighlightChange);
+  FDefaultFilter := SYNS_FilterX86Assembly;
+end;
+
+destructor TSynAsmMASMSyn.Destroy;
+begin
+  FKeywords.Free;
+  FDirectivesKeywords.Free;
+  FRegisterKeywords.Free;
+  FApiKeywords.Free;
+  FOperatorKeywords.Free;
+  inherited Destroy;
+end;
+
+procedure TSynAsmMASMSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynAsmMASMSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.GreaterProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  if FLine[Run] = '=' then Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.LowerProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  if CharInSet(FLine[Run], ['=', '>']) then Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'a'..'f', 'h', 'A'..'F', 'H': Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+    Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.SlashProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '/' then begin
+    FTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end else
+    FTokenID := tkSymbol;
+end;
+
+procedure TSynAsmMASMSyn.IncludeProc;
+begin
+  FTokenID := tkInclude;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynAsmMASMSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  repeat
+    Inc(Run);
+  until (FLine[Run] > #32) or IsLineEnd(Run);
+end;
+
+procedure TSynAsmMASMSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then
+    Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.SingleQuoteStringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then
+    Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynAsmMASMSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynAsmMASMSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkIdentifier;
+end;
+
+procedure TSynAsmMASMSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    #34: StringProc;
+    #39: SingleQuoteStringProc;
+    '>': GreaterProc;
+    '<': LowerProc;
+    '/': SlashProc;
+    '\': IncludeProc;
+    //'A'..'Z', 'a'..'z', '_': IdentProc;
+    'A'..'Z', 'a'..'z', '_', '.', '?', '[', ']': IdentProc;   // THJ
+    '0'..'9': NumberProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    '#', ';': CommentProc;
+    //'.', ':', '&', '{', '}', '=', '^', '-', '+', '(', ')', '*': SymbolProc;
+    ':', '&', '{', '}', '^', '-', '+', '(', ')', '*': SymbolProc;
+    else
+      UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynAsmMASMSyn.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 TSynAsmMASMSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynAsmMASMSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    tkDirectives: Result := FDirectivesAttri;
+    tkRegister: Result := FRegisterAttri;
+    tkApi: Result := FApiAttri;
+    tkInclude: Result := FIncludeAttri;
+    tkOperator: Result := FOperatorAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynAsmMASMSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynAsmMASMSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+class function TSynAsmMASMSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangMASM;
+end;
+
+function TSynAsmMASMSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterX86Assembly;
+end;
+
+function TSynAsmMASMSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '; x86 assembly sample source'#13#10 +
+            '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
+            '    ASSUME	CS:CODE'#13#10 +
+            #13#10 +
+            '    PUSH SS'#13#10 +
+            '    POP DS'#13#10 +
+            '    MOV AX, AABBh'#13#10 +
+            '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
+            '    JMP SHORT AsmEnd'#13#10 +
+            #13#10 +
+            '  welcomeMsg DB ''Hello World'', 0'#13#10 +
+            #13#10 +
+            '  AsmEnd:'#13#10 +
+            '    MOV AX, 0'#13#10 +
+            #13#10 +
+            '  CODE	ENDS'#13#10 +
+            'END';
+end;
+
+class function TSynAsmMASMSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangMASM;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynAsmMASMSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterBaan.pas b/Source/VCL/SynEdit/Source/SynHighlighterBaan.pas
index 266664cc..ca20bf31 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterBaan.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterBaan.pas
@@ -1,831 +1,839 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterBaan.pas, released 2000-04-21.
-The Original Code is based on the mwBaanSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is "riceball".
-Unicode translation by Maël Hörz.
-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: SynHighlighterBaan.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Baan syntax highlighter for SynEdit)
-@author(riceball , converted to SynEdit by Bruno Mikkelsen )
-@created(2000, converted to SynEdit 2000-04-21)
-@lastmod(2000-04-21)
-The SynHighlighterBaan unit provides SynEdit with a Baan syntax highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterBaan;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows, Messages, Controls, Graphics, Registry,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils, Classes;
-
-type
-  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
-    tkSpace, tkString, tkSymbol, tkUnknown, tkVariable);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynBaanSyn = class(TSynCustomHighlighter)
-  private
-    FTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..460] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirectiveAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fVariableAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function FuncBrp46open(Index: Integer): TtkTokenKind;
-    function FuncDate46num(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure DirectiveProc;
-    procedure EqualProc;
-    procedure ErectProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure PlusProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property DirectiveAttri: TSynHighlighterAttributes read fDirectiveAttri
-      write fDirectiveAttri;
-    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 VariableAttri: TSynHighlighterAttributes read fVariableAttri
-      write fVariableAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..112] of string = (
-    '__based', '__cdecl', '__declspe', '__except', '__export', '__far', 
-    '__fastcal', '__fortran', '__import', '__int16', '__int32', '__int64', 
-    '__int8', '__interrup', '__loadds', '__near', '__pascal', '__rtti', 
-    '__segment', '__segname', '__self', '__stdcall', '__thread', '__try', 
-    '_cdecl', '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'auto', 
-    'bool', 'break', 'brp.open', 'case', 'catch', 'cdecl', 'char', 'class', 
-    'const', 'continue', 'date.num', 'default', 'defined', 'delete', 'do', 
-    'domain', 'double', 'else', 'endif', 'endselect', 'enum', 'explicit', 
-    'export', 'extern', 'false', 'fastcall', 'finally', 'float', 'for', 
-    'friend', 'from', 'function', 'goto', 'if', 'import', 'inline', 'int', 
-    'interrupt', 'long', 'mutable', 'namespace', 'new', 'null', 'operator', 
-    'pascal', 'private', 'protected', 'public', 'register', 'reinterpr', 
-    'return', 'select', 'selectdo', 'short', 'signed', 'sizeof', 'sql.close', 
-    'static', 'static_ca', 'stdcall', 'string', 'strip$', 'struct', 'switch', 
-    'table', 'template', 'this', 'throw', 'true', 'try', 'typedef', 'typeid', 
-    'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile', 
-    'wchar_t', 'where', 'while' 
-  );
-
-  KeyIndices: array[0..460] of Integer = (
-    -1, -1, -1, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 3, 33, 26, -1, 78, -1, -1, -1, -1, -1, 5, -1, 14, -1, 27, -1, 92, -1, 
-    -1, -1, -1, 42, -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, 
-    93, 2, -1, -1, -1, 50, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, 63, -1, 94, 
-    -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, 44, -1, -1, 
-    -1, 110, -1, -1, 51, -1, -1, -1, -1, 56, -1, 32, -1, -1, 109, -1, -1, -1, 
-    -1, 16, -1, -1, -1, -1, 23, 88, -1, -1, 10, -1, -1, -1, -1, 67, -1, -1, -1, 
-    72, 81, -1, -1, -1, 82, 24, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, 64, 
-    21, 80, -1, -1, 59, 0, -1, -1, -1, 12, -1, -1, 107, -1, 36, -1, -1, -1, -1, 
-    31, -1, -1, -1, 62, -1, -1, 112, -1, -1, -1, -1, -1, -1, 7, -1, 106, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 52, 104, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 65, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 29, 28, 43, -1, 20, -1, -1, -1, 38, -1, -1, -1, -1, 
-    -1, 103, -1, 70, 87, -1, -1, -1, 85, -1, 74, -1, -1, -1, -1, -1, 35, 39, -1, 
-    -1, 97, 53, -1, -1, -1, -1, -1, -1, -1, 84, -1, 95, -1, -1, -1, -1, -1, -1, 
-    -1, 100, 98, -1, -1, -1, -1, -1, -1, -1, -1, 111, 73, -1, 47, -1, -1, -1, 
-    -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, 66, 86, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 34, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, 55, -1, 
-    -1, -1, 89, -1, 11, -1, -1, -1, 19, -1, -1, -1, -1, 90, -1, 102, 54, -1, -1, 
-    45, -1, -1, 6, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 8, 22, -1, 
-    -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, 
-    -1, -1, 71, -1, -1, -1, -1, -1, 96, 48, -1, -1, -1, -1, -1, 75, -1, 60, -1, 
-    -1, 58, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 17, 4, -1, -1, -1, -1, 
-    49, -1, -1, -1, -1, 57, -1, -1, -1, -1, 15, 91, -1, -1, 41, -1, -1, -1, 76, 
-    68, -1, -1, -1, 108, -1, -1 
-  );
-
-{$Q-}
-function TSynBaanSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 838 + Ord(Str^) * 296;
-    inc(Str);
-  end;
-  Result := Result mod 461;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynBaanSyn.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 TSynBaanSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[21] := FuncBrp46open;
-  fIdentFuncTable[449] := FuncDate46num;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynBaanSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynBaanSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-function TSynBaanSyn.FuncBrp46open(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkVariable
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBaanSyn.FuncDate46num(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkVariable
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynBaanSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective);
-  AddAttribute(fDirectiveAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  AddAttribute(fVariableAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterBaan;
-end;
-
-procedure TSynBaanSyn.AndSymbolProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '&':                               {logical and}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynBaanSyn.AtSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  inc(Run);
-end;
-
-procedure TSynBaanSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynBaanSyn.BraceOpenProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynBaanSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Case FLine[Run + 1] of
-    #10: inc(Run, 2);
-  else inc(Run);
-  end;
-end;
-
-procedure TSynBaanSyn.ColonProc;
-begin
-  Case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {colon}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.DirectiveProc;
-begin
-  fTokenID := tkDirective;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #0;
-end;
-
-procedure TSynBaanSyn.EqualProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.ErectProc;
-begin
-  inc(Run, 1);                        {Bann Comments}
-  fTokenID := tkComment;
-  while FLine[Run] <> #0 do
-  begin
-    case FLine[Run] of
-      #10, #13: break;
-    end; //case
-    inc(Run);
-  end; //while
-end;
-
-procedure TSynBaanSyn.GreaterProc;
-begin
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-          inc(Run, 3)
-        else                           {shift right}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.IdentProc;
-begin
-  fTokenID := IdentKind(fLine + Run);
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynBaanSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynBaanSyn.LowerProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-          inc(Run, 3)
-        else                           {shift left}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.MinusProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '-':                               {decrement}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '>':                               {arrow}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.ModSymbolProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {mod}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.NotSymbolProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {not}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynBaanSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynBaanSyn.PlusProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '+':                               {increment}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {division assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {division}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynBaanSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynBaanSyn.StarProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {star}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      #92:
-        if FLine[Run + 1] = #10 then inc(Run);
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynBaanSyn.TildeProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynBaanSyn.XOrSymbolProc;
-begin
-  Case FLine[Run + 1] of
-    '=':                               {xor assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {xor}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynBaanSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynBaanSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    '&': AndSymbolProc;
-    #39: AsciiCharProc;
-    '@': AtSymbolProc;
-    '}': BraceCloseProc;
-    '{': BraceOpenProc;
-    #13: CRProc;
-    ':': ColonProc;
-    ',': CommaProc;
-    '#': DirectiveProc;
-    '=': EqualProc;
-    '|': ErectProc;
-    '>': GreaterProc;
-    'A'..'Z', 'a'..'z', '_', '.', '$': IdentProc;
-    #10: LFProc;
-    '<': LowerProc;
-    '-': MinusProc;
-    '%': ModSymbolProc;
-    '!': NotSymbolProc;
-    #0: NullProc;
-    '0'..'9': NumberProc;
-    '+': PlusProc;
-    ')': RoundCloseProc;
-    '(': RoundOpenProc;
-    ';': SemiColonProc;
-    '/': SlashProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    ']': SquareCloseProc;
-    '[': SquareOpenProc;
-    '*': StarProc;
-    #34: StringProc;
-    '~': TildeProc;
-    '^': XOrSymbolProc;
-    else UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynBaanSyn.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 TSynBaanSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynBaanSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynBaanSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkDirective: Result := fDirectiveAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkVariable: Result := fVariableAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynBaanSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynBaanSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterBaan;
-end;
-
-function TSynBaanSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '.', '$', '_', '0'..'9', 'a'..'z', 'A'..'Z':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynBaanSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangBaan;
-end;
-
-class function TSynBaanSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangBaan;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynBaanSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterBaan.pas, released 2000-04-21.
+The Original Code is based on the mwBaanSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is "riceball".
+Unicode translation by Maël Hörz.
+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: SynHighlighterBaan.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Baan syntax highlighter for SynEdit)
+@author(riceball , converted to SynEdit by Bruno Mikkelsen )
+@created(2000, converted to SynEdit 2000-04-21)
+@lastmod(2000-04-21)
+The SynHighlighterBaan unit provides SynEdit with a Baan syntax highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterBaan;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows, Messages, Controls, Graphics, Registry,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils, Classes;
+
+type
+  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
+    tkSpace, tkString, tkSymbol, tkUnknown, tkVariable);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynBaanSyn = class(TSynCustomHighlighter)
+  private
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..460] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirectiveAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FVariableAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function FuncBrp46open(Index: Integer): TtkTokenKind;
+    function FuncDate46num(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure DirectiveProc;
+    procedure EqualProc;
+    procedure ErectProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure PlusProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirectiveAttri: TSynHighlighterAttributes read FDirectiveAttri
+      write FDirectiveAttri;
+    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 VariableAttri: TSynHighlighterAttributes read FVariableAttri
+      write FVariableAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..112] of UnicodeString = (
+    '__based', '__cdecl', '__declspe', '__except', '__export', '__far', 
+    '__fastcal', '__fortran', '__import', '__int16', '__int32', '__int64', 
+    '__int8', '__interrup', '__loadds', '__near', '__pascal', '__rtti', 
+    '__segment', '__segname', '__self', '__stdcall', '__thread', '__try', 
+    '_cdecl', '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'auto', 
+    'bool', 'break', 'brp.open', 'case', 'catch', 'cdecl', 'char', 'class', 
+    'const', 'continue', 'date.num', 'default', 'defined', 'delete', 'do', 
+    'domain', 'double', 'else', 'endif', 'endselect', 'enum', 'explicit', 
+    'export', 'extern', 'false', 'fastcall', 'finally', 'float', 'for', 
+    'friend', 'from', 'function', 'goto', 'if', 'import', 'inline', 'int', 
+    'interrupt', 'long', 'mutable', 'namespace', 'new', 'null', 'operator', 
+    'pascal', 'private', 'protected', 'public', 'register', 'reinterpr', 
+    'return', 'select', 'selectdo', 'short', 'signed', 'sizeof', 'sql.close', 
+    'static', 'static_ca', 'stdcall', 'string', 'strip$', 'struct', 'switch', 
+    'table', 'template', 'this', 'throw', 'true', 'try', 'typedef', 'typeid', 
+    'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile', 
+    'wchar_t', 'where', 'while' 
+  );
+
+  KeyIndices: array[0..460] of Integer = (
+    -1, -1, -1, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 3, 33, 26, -1, 78, -1, -1, -1, -1, -1, 5, -1, 14, -1, 27, -1, 92, -1, 
+    -1, -1, -1, 42, -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, 
+    93, 2, -1, -1, -1, 50, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, 63, -1, 94, 
+    -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, 44, -1, -1, 
+    -1, 110, -1, -1, 51, -1, -1, -1, -1, 56, -1, 32, -1, -1, 109, -1, -1, -1, 
+    -1, 16, -1, -1, -1, -1, 23, 88, -1, -1, 10, -1, -1, -1, -1, 67, -1, -1, -1, 
+    72, 81, -1, -1, -1, 82, 24, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, 64, 
+    21, 80, -1, -1, 59, 0, -1, -1, -1, 12, -1, -1, 107, -1, 36, -1, -1, -1, -1, 
+    31, -1, -1, -1, 62, -1, -1, 112, -1, -1, -1, -1, -1, -1, 7, -1, 106, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 52, 104, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 65, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 29, 28, 43, -1, 20, -1, -1, -1, 38, -1, -1, -1, -1, 
+    -1, 103, -1, 70, 87, -1, -1, -1, 85, -1, 74, -1, -1, -1, -1, -1, 35, 39, -1, 
+    -1, 97, 53, -1, -1, -1, -1, -1, -1, -1, 84, -1, 95, -1, -1, -1, -1, -1, -1, 
+    -1, 100, 98, -1, -1, -1, -1, -1, -1, -1, -1, 111, 73, -1, 47, -1, -1, -1, 
+    -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, 66, 86, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 34, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, 55, -1, 
+    -1, -1, 89, -1, 11, -1, -1, -1, 19, -1, -1, -1, -1, 90, -1, 102, 54, -1, -1, 
+    45, -1, -1, 6, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 8, 22, -1, 
+    -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, 
+    -1, -1, 71, -1, -1, -1, -1, -1, 96, 48, -1, -1, -1, -1, -1, 75, -1, 60, -1, 
+    -1, 58, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 17, 4, -1, -1, -1, -1, 
+    49, -1, -1, -1, -1, 57, -1, -1, -1, -1, 15, 91, -1, -1, 41, -1, -1, -1, 76, 
+    68, -1, -1, -1, 108, -1, -1 
+  );
+
+{$Q-}
+function TSynBaanSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 838 + Ord(Str^) * 296;
+    Inc(Str);
+  end;
+  Result := Result mod 461;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynBaanSyn.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 TSynBaanSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[21] := FuncBrp46open;
+  FIdentFuncTable[449] := FuncDate46num;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynBaanSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynBaanSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+function TSynBaanSyn.FuncBrp46open(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkVariable
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBaanSyn.FuncDate46num(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkVariable
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynBaanSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective);
+  AddAttribute(FDirectiveAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  AddAttribute(FVariableAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterBaan;
+end;
+
+procedure TSynBaanSyn.AndSymbolProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynBaanSyn.AtSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynBaanSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  case FLine[Run + 1] of
+    #10: Inc(Run, 2);
+  else
+    Inc(Run);
+  end;
+end;
+
+procedure TSynBaanSyn.ColonProc;
+begin
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.DirectiveProc;
+begin
+  FTokenID := tkDirective;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #0;
+end;
+
+procedure TSynBaanSyn.EqualProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.ErectProc;
+begin
+  Inc(Run, 1);                        {Bann Comments}
+  FTokenID := tkComment;
+  while FLine[Run] <> #0 do
+  begin
+    case FLine[Run] of
+      #10, #13:
+        Break;
+    end; //case
+    Inc(Run);
+  end; //while
+end;
+
+procedure TSynBaanSyn.GreaterProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+          Inc(Run, 3)
+        else                           {shift right}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.IdentProc;
+begin
+  FTokenID := IdentKind(FLine + Run);
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynBaanSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynBaanSyn.LowerProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+          Inc(Run, 3)
+        else                           {shift left}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.MinusProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '-':                               {decrement}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.ModSymbolProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.NotSymbolProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynBaanSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynBaanSyn.PlusProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {division assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {division}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynBaanSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.StarProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+      #92:
+        if FLine[Run + 1] = #10 then Inc(Run);
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynBaanSyn.TildeProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynBaanSyn.XOrSymbolProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynBaanSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynBaanSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+    '&': AndSymbolProc;
+    #39: AsciiCharProc;
+    '@': AtSymbolProc;
+    '}': BraceCloseProc;
+    '{': BraceOpenProc;
+    #13: CRProc;
+    ':': ColonProc;
+    ',': CommaProc;
+    '#': DirectiveProc;
+    '=': EqualProc;
+    '|': ErectProc;
+    '>': GreaterProc;
+    'A'..'Z', 'a'..'z', '_', '.', '$': IdentProc;
+    #10: LFProc;
+    '<': LowerProc;
+    '-': MinusProc;
+    '%': ModSymbolProc;
+    '!': NotSymbolProc;
+    #0: NullProc;
+    '0'..'9': NumberProc;
+    '+': PlusProc;
+    ')': RoundCloseProc;
+    '(': RoundOpenProc;
+    ';': SemiColonProc;
+    '/': SlashProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    ']': SquareCloseProc;
+    '[': SquareOpenProc;
+    '*': StarProc;
+    #34: StringProc;
+    '~': TildeProc;
+    '^': XOrSymbolProc;
+    else UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynBaanSyn.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 TSynBaanSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynBaanSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynBaanSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkDirective: Result := FDirectiveAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkVariable: Result := FVariableAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynBaanSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynBaanSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterBaan;
+end;
+
+function TSynBaanSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '.', '$', '_', '0'..'9', 'a'..'z', 'A'..'Z':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynBaanSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangBaan;
+end;
+
+class function TSynBaanSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangBaan;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynBaanSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterBat.pas b/Source/VCL/SynEdit/Source/SynHighlighterBat.pas
index fcc60e77..83dc21b9 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterBat.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterBat.pas
@@ -1,613 +1,616 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterBat.pas, released 2000-04-18.
-The Original Code is based on the dmBatSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is David H. Muir.
-Unicode translation by Maël Hörz.
-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: SynHighlighterBat.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a MS-DOS Batch file highlighter for SynEdit)
-@author(David Muir )
-@created(Late 1999)
-@lastmod(May 19, 2000)
-The SynHighlighterBat unit provides SynEdit with a MS-DOS Batch file (.bat) highlighter.
-The highlighter supports the formatting of keywords and parameters (batch file arguments).
-}
-
-unit SynHighlighterBat;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkUnknown, tkVariable);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynBatSyn = class(TSynCustomHighlighter)
-  private
-    fIdentFuncTable: array[0..24] of TIdentFuncTableFunc;
-    FTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fVariableAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncCall(Index: Integer): TtkTokenKind;
-    function FuncCd(Index: Integer): TtkTokenKind;
-    function FuncCls(Index: Integer): TtkTokenKind;
-    function FuncCopy(Index: Integer): TtkTokenKind;
-    function FuncDel(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncEcho(Index: Integer): TtkTokenKind;
-    function FuncErrorlevel(Index: Integer): TtkTokenKind;
-    function FuncExist(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncGoto(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncIn(Index: Integer): TtkTokenKind;
-    function FuncNot(Index: Integer): TtkTokenKind;
-    function FuncOff(Index: Integer): TtkTokenKind;
-    function FuncOn(Index: Integer): TtkTokenKind;
-    function FuncPause(Index: Integer): TtkTokenKind;
-    function FuncSet(Index: Integer): TtkTokenKind;
-    function FuncShift(Index: Integer): TtkTokenKind;
-    function FuncStart(Index: Integer): TtkTokenKind;
-    function FuncTitle(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure VariableProc;
-    procedure CRProc;
-    procedure CommentProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure REMCommentProc;
-    procedure SpaceProc;
-    procedure UnknownProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;        
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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 VariableAttri: TSynHighlighterAttributes read fVariableAttri
-      write fVariableAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..20] of string = (
-    'call', 'cd', 'cls', 'copy', 'del', 'do', 'echo', 'errorlevel', 'exist', 
-    'for', 'goto', 'if', 'in', 'not', 'off', 'on', 'pause', 'set', 'shift', 
-    'start', 'title' 
-  );
-
-  KeyIndices: array[0..24] of Integer = (
-    14, 4, -1, 6, 17, 12, 8, 18, 19, 15, -1, -1, 10, 3, 13, 0, 1, 11, 20, 7, 2, 
-    5, -1, 16, 9 
-  );
-
-{$Q-}
-function TSynBatSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 869 + Ord(Str^) * 61;
-    inc(Str);
-  end;
-  Result := Result mod 25;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynBatSyn.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 TSynBatSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-      
-  fIdentFuncTable[15] := FuncCall;
-  fIdentFuncTable[16] := FuncCd;
-  fIdentFuncTable[20] := FuncCls;
-  fIdentFuncTable[13] := FuncCopy;
-  fIdentFuncTable[1] := FuncDel;
-  fIdentFuncTable[21] := FuncDo;
-  fIdentFuncTable[3] := FuncEcho;
-  fIdentFuncTable[19] := FuncErrorlevel;
-  fIdentFuncTable[6] := FuncExist;
-  fIdentFuncTable[24] := FuncFor;
-  fIdentFuncTable[12] := FuncGoto;
-  fIdentFuncTable[17] := FuncIf;
-  fIdentFuncTable[5] := FuncIn;
-  fIdentFuncTable[14] := FuncNot;
-  fIdentFuncTable[0] := FuncOff;
-  fIdentFuncTable[9] := FuncOn;
-  fIdentFuncTable[23] := FuncPause;
-  fIdentFuncTable[4] := FuncSet;
-  fIdentFuncTable[7] := FuncShift;
-  fIdentFuncTable[8] := FuncStart;
-  fIdentFuncTable[18] := FuncTitle;
-end;
-
-function TSynBatSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier
-end;
-
-function TSynBatSyn.FuncCall(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncCd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncCls(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncCopy(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncDel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncDo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncEcho(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncErrorlevel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncExist(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncFor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncGoto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncIn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncNot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncOff(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncOn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncPause(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncSet(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncShift(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncStart(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynBatSyn.FuncTitle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynBatSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  fCommentAttri.Foreground := clNavy;
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  fNumberAttri.Foreground := clBlue;
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  fVariableAttri.Foreground := clGreen;
-  AddAttribute(fVariableAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterBatch;
-end;
-
-procedure TSynBatSyn.VariableProc;
-
-  function IsVarChar: Boolean;
-  begin
-    case fLine[Run] of
-      '_', '0'..'9', 'A'..'Z', 'a'..'z':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  fTokenID := tkVariable;
-  repeat
-    Inc(Run);
-  until not IsVarChar;
-  if fLine[Run] = '%' then
-    Inc(Run);
-end;
-
-procedure TSynBatSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if (fLine[Run] = #10) then Inc(Run);
-end;
-
-procedure TSynBatSyn.CommentProc;
-begin
-  fTokenID := tkIdentifier;
-  Inc(Run);
-  if fLine[Run] = ':' then begin
-    fTokenID := tkComment;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run);
-  end;
-end;
-
-procedure TSynBatSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  Inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynBatSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynBatSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynBatSyn.NumberProc;
-begin
-  fTokenID := tkNumber;
-  repeat
-    Inc(Run);
-  until not CharInSet(fLine[Run], ['0'..'9', '.']);
-end;
-
-procedure TSynBatSyn.REMCommentProc;
-begin
-  if CharInSet(FLine[Run + 1], ['E', 'e']) and
-    CharInSet(FLine[Run + 2], ['M', 'm']) and
-    (FLine[Run + 3] < #33) then
-  begin
-    fTokenID := tkComment;
-    Inc(Run, 3);
-    while (FLine[Run] <> #0) do begin
-      case FLine[Run] of
-        #10, #13: break;
-      end; { case }
-      Inc(Run);
-    end; { while }
-  end
-  else
-  begin
-    fTokenID := tkIdentifier;
-    IdentProc;
-  end;
-end;
-
-procedure TSynBatSyn.SpaceProc;
-begin
-  fTokenID := tkSpace;
-  repeat
-    Inc(Run);
-  until (fLine[Run] > #32) or IsLineEnd(Run);
-end;
-
-procedure TSynBatSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynBatSyn.Next;
-begin
-  fTokenPos := Run;
-
-  case fLine[Run] of
-    '%': VariableProc;
-    #13: CRProc;
-    ':': CommentProc;
-    'A'..'Q', 'S'..'Z', 'a'..'q', 's'..'z', '_': IdentProc;
-    #10: LFProc;
-    #0: NullProc;
-    '0'..'9': NumberProc;
-    'R', 'r': REMCommentProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    else
-      UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynBatSyn.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_WHITESPACE: Result := fSpaceAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynBatSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynBatSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    tkVariable: Result := fVariableAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynBatSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynBatSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynBatSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterBatch;
-end;
-
-class function TSynBatSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangBatch;
-end;
-
-function TSynBatSyn.GetSampleSource: string;
-begin
-  Result := 'rem MS-DOS batch file'#13#10 +
-            'rem'#13#10 +
-            '@echo off'#13#10 +
-            'cls'#13#10 +
-            'echo The command line is: %1 %2 %3 %4 %5'#13#10 +
-            'rem'#13#10 +
-            'rem now wait for the user ...'#13#10 +
-            'pause'#13#10 +
-            'copy c:\*.pas d:\'#13#10 +
-            'if errorlevel 1 echo Error in copy action!';
-end;
-
-class function TSynBatSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangBatch;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynBatSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterBat.pas, released 2000-04-18.
+The Original Code is based on the dmBatSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is David H. Muir.
+Unicode translation by Maël Hörz.
+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: SynHighlighterBat.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a MS-DOS Batch file highlighter for SynEdit)
+@author(David Muir )
+@created(Late 1999)
+@lastmod(May 19, 2000)
+The SynHighlighterBat unit provides SynEdit with a MS-DOS Batch file (.bat) highlighter.
+The highlighter supports the formatting of keywords and parameters (batch file arguments).
+}
+
+unit SynHighlighterBat;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkUnknown, tkVariable);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynBatSyn = class(TSynCustomHighlighter)
+  private
+    FIdentFuncTable: array[0..24] of TIdentFuncTableFunc;
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FVariableAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncCall(Index: Integer): TtkTokenKind;
+    function FuncCd(Index: Integer): TtkTokenKind;
+    function FuncCls(Index: Integer): TtkTokenKind;
+    function FuncCopy(Index: Integer): TtkTokenKind;
+    function FuncDel(Index: Integer): TtkTokenKind;
+    function FuncDo(Index: Integer): TtkTokenKind;
+    function FuncEcho(Index: Integer): TtkTokenKind;
+    function FuncErrorlevel(Index: Integer): TtkTokenKind;
+    function FuncExist(Index: Integer): TtkTokenKind;
+    function FuncFor(Index: Integer): TtkTokenKind;
+    function FuncGoto(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncIn(Index: Integer): TtkTokenKind;
+    function FuncNot(Index: Integer): TtkTokenKind;
+    function FuncOff(Index: Integer): TtkTokenKind;
+    function FuncOn(Index: Integer): TtkTokenKind;
+    function FuncPause(Index: Integer): TtkTokenKind;
+    function FuncSet(Index: Integer): TtkTokenKind;
+    function FuncShift(Index: Integer): TtkTokenKind;
+    function FuncStart(Index: Integer): TtkTokenKind;
+    function FuncTitle(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure VariableProc;
+    procedure CRProc;
+    procedure CommentProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure REMCommentProc;
+    procedure SpaceProc;
+    procedure UnknownProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;        
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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 VariableAttri: TSynHighlighterAttributes read FVariableAttri
+      write FVariableAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..20] of UnicodeString = (
+    'call', 'cd', 'cls', 'copy', 'del', 'do', 'echo', 'errorlevel', 'exist', 
+    'for', 'goto', 'if', 'in', 'not', 'off', 'on', 'pause', 'set', 'shift', 
+    'start', 'title' 
+  );
+
+  KeyIndices: array[0..24] of Integer = (
+    14, 4, -1, 6, 17, 12, 8, 18, 19, 15, -1, -1, 10, 3, 13, 0, 1, 11, 20, 7, 2, 
+    5, -1, 16, 9 
+  );
+
+{$Q-}
+function TSynBatSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 869 + Ord(Str^) * 61;
+    Inc(Str);
+  end;
+  Result := Result mod 25;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynBatSyn.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 TSynBatSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+      
+  FIdentFuncTable[15] := FuncCall;
+  FIdentFuncTable[16] := FuncCd;
+  FIdentFuncTable[20] := FuncCls;
+  FIdentFuncTable[13] := FuncCopy;
+  FIdentFuncTable[1] := FuncDel;
+  FIdentFuncTable[21] := FuncDo;
+  FIdentFuncTable[3] := FuncEcho;
+  FIdentFuncTable[19] := FuncErrorlevel;
+  FIdentFuncTable[6] := FuncExist;
+  FIdentFuncTable[24] := FuncFor;
+  FIdentFuncTable[12] := FuncGoto;
+  FIdentFuncTable[17] := FuncIf;
+  FIdentFuncTable[5] := FuncIn;
+  FIdentFuncTable[14] := FuncNot;
+  FIdentFuncTable[0] := FuncOff;
+  FIdentFuncTable[9] := FuncOn;
+  FIdentFuncTable[23] := FuncPause;
+  FIdentFuncTable[4] := FuncSet;
+  FIdentFuncTable[7] := FuncShift;
+  FIdentFuncTable[8] := FuncStart;
+  FIdentFuncTable[18] := FuncTitle;
+end;
+
+function TSynBatSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier
+end;
+
+function TSynBatSyn.FuncCall(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncCd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncCls(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncCopy(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncDel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncDo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncEcho(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncErrorlevel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncExist(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncFor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncGoto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncIn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncNot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncOff(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncOn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncPause(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncSet(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncShift(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncStart(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynBatSyn.FuncTitle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynBatSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  FCommentAttri.Foreground := clNavy;
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FNumberAttri.Foreground := clBlue;
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  FVariableAttri.Foreground := clGreen;
+  AddAttribute(FVariableAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterBatch;
+end;
+
+procedure TSynBatSyn.VariableProc;
+
+  function IsVarChar: Boolean;
+  begin
+    case FLine[Run] of
+      '_', '0'..'9', 'A'..'Z', 'a'..'z':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  FTokenID := tkVariable;
+  repeat
+    Inc(Run);
+  until not IsVarChar;
+  if FLine[Run] = '%' then
+    Inc(Run);
+end;
+
+procedure TSynBatSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if (FLine[Run] = #10) then Inc(Run);
+end;
+
+procedure TSynBatSyn.CommentProc;
+begin
+  FTokenID := tkIdentifier;
+  Inc(Run);
+  if FLine[Run] = ':' then begin
+    FTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end;
+end;
+
+procedure TSynBatSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynBatSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynBatSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynBatSyn.NumberProc;
+begin
+  FTokenID := tkNumber;
+  repeat
+    Inc(Run);
+  until not CharInSet(FLine[Run], ['0'..'9', '.']);
+end;
+
+procedure TSynBatSyn.REMCommentProc;
+begin
+  if CharInSet(FLine[Run + 1], ['E', 'e']) and
+    CharInSet(FLine[Run + 2], ['M', 'm']) and
+    (FLine[Run + 3] < #33) then
+  begin
+    FTokenID := tkComment;
+    Inc(Run, 3);
+    while (FLine[Run] <> #0) do begin
+      case FLine[Run] of
+        #10, #13:
+          Break;
+      end; { case }
+      Inc(Run);
+    end; { while }
+  end
+  else
+  begin
+    FTokenID := tkIdentifier;
+    IdentProc;
+  end;
+end;
+
+procedure TSynBatSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  repeat
+    Inc(Run);
+  until (FLine[Run] > #32) or IsLineEnd(Run);
+end;
+
+procedure TSynBatSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynBatSyn.Next;
+begin
+  FTokenPos := Run;
+
+  case FLine[Run] of
+    '%': VariableProc;
+    #13: CRProc;
+    ':': CommentProc;
+    'A'..'Q', 'S'..'Z', 'a'..'q', 's'..'z', '_': IdentProc;
+    #10: LFProc;
+    #0: NullProc;
+    '0'..'9': NumberProc;
+    'R', 'r': REMCommentProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    else
+      UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynBatSyn.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_WHITESPACE: Result := FSpaceAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynBatSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynBatSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    tkVariable: Result := FVariableAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynBatSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynBatSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynBatSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterBatch;
+end;
+
+class function TSynBatSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangBatch;
+end;
+
+function TSynBatSyn.GetSampleSource: UnicodeString;
+begin
+  Result := 'rem MS-DOS batch file'#13#10 +
+            'rem'#13#10 +
+            '@echo off'#13#10 +
+            'cls'#13#10 +
+            'echo The command line is: %1 %2 %3 %4 %5'#13#10 +
+            'rem'#13#10 +
+            'rem now wait for the user ...'#13#10 +
+            'pause'#13#10 +
+            'copy c:\*.pas d:\'#13#10 +
+            'if errorlevel 1 echo Error in copy action!';
+end;
+
+class function TSynBatSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangBatch;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynBatSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCAC.pas b/Source/VCL/SynEdit/Source/SynHighlighterCAC.pas
index 347b73dd..d111af34 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCAC.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCAC.pas
@@ -1,603 +1,605 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCAC.pas, released 2000-04-21.
-The Original Code is based on the cwCACSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Carlos Wijders.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCAC.pas,v 1.10.2.8 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a CA-Clipper syntax highlighter for SynEdit)
-@author(Carlos Wijders , converted to SynEdit by Bruno Mikkelsen )
-@created(1998-12-27, converted to SynEdit 2000-04-21)
-@lastmod(2000-06-23)
-The SynHighlighterCAC unit provides SynEdit with a CA-Clipper syntax highlighter.
-Thanks to Primoz Gabrijelcic, Andy Jeffries.
-}
-
-unit SynHighlighterCAC;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
-    tkSpace, tkString, tkOperator, tkUnknown);
-
-  TRangeState = (rsANil, rsCStyle, rsUnknown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynCACSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    fStringAttri: TSynHighlighterAttributes;
-    fOperatorAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fDirecAttri: TSynHighlighterAttributes;
-    fIdentFuncTable: array[0..708] of TIdentFuncTableFunc;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure StarProc;
-    procedure CRProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SymbolProc;
-    procedure StringProc;
-    procedure DirectiveProc;
-    procedure UnknownProc;
-    procedure CStyleProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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 OperatorAttri: TSynHighlighterAttributes read fOperatorAttri
-      write fOperatorAttri;
-    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
-      write fDirecAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..142] of string = (
-    'aadd', 'abs', 'and', 'announce', 'asc', 'at', 'average', 'begin', 'bof', 
-    'break', 'call', 'cancel', 'cdow', 'chr', 'clear', 'close', 'cmonth', 'col', 
-    'commit', 'continue', 'copy', 'count', 'create', 'ctod', 'date', 'day', 
-    'declare', 'delete', 'deleted', 'devpos', 'dir', 'display', 'dow', 'dtoc', 
-    'dtos', 'eject', 'else', 'elseif', 'empty', 'endcase', 'enddo', 'endif', 
-    'eof', 'erase', 'exit', 'exp', 'external', 'fcount', 'field', 'fieldname', 
-    'file', 'find', 'flock', 'for', 'found', 'function', 'get', 'go', 'if', 
-    'iif', 'index', 'init', 'inkey', 'input', 'int', 'join', 'keyboard', 
-    'lastrec', 'len', 'list', 'local', 'locate', 'lock', 'log', 'lower', 
-    'ltrim', 'max', 'memvar', 'min', 'month', 'not', 'note', 'or', 'pack', 
-    'parameters', 'pcol', 'pcount', 'private', 'procedure', 'prompt', 'prow', 
-    'public', 'quit', 'read', 'recall', 'reccount', 'recno', 'reindex', 
-    'release', 'rename', 'replace', 'replicate', 'request', 'restore', 'return', 
-    'rlock', 'round', 'row', 'rtrim', 'run', 'save', 'say', 'seconds', 'seek', 
-    'select', 'sequence', 'setpos', 'skip', 'sort', 'space', 'sqrt', 'static', 
-    'store', 'str', 'substr', 'sum', 'text', 'time', 'total', 'transform', 
-    'trim', 'type', 'unlock', 'update', 'upper', 'use', 'val', 'valtype', 
-    'wait', 'while', 'word', 'year', 'zap' 
-  );
-
-  KeyIndices: array[0..708] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, 87, 41, 140, 88, -1, -1, -1, 11, 
-    -1, -1, -1, 53, -1, -1, -1, -1, 54, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 110, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, 24, -1, 86, -1, 
-    -1, -1, 81, -1, -1, -1, -1, -1, 119, -1, -1, 14, -1, -1, -1, 92, -1, -1, -1, 
-    -1, -1, 77, 89, 10, 23, -1, -1, 91, 65, -1, 122, -1, -1, -1, 36, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, 27, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 120, -1, 100, 2, -1, -1, -1, -1, 75, 7, -1, -1, 
-    -1, -1, -1, -1, -1, 108, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, 50, 30, -1, 
-    -1, -1, -1, 83, 116, -1, -1, 134, -1, -1, 69, -1, -1, -1, 109, -1, 76, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 85, -1, -1, -1, 127, -1, -1, 102, 48, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, 133, 
-    -1, 57, 113, -1, -1, -1, -1, -1, -1, 43, -1, 33, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 126, -1, 132, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, 
-    58, -1, -1, -1, -1, -1, -1, 6, -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, 78, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, 98, -1, 49, 
-    123, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 15, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 5, 82, -1, -1, -1, -1, -1, 35, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, 72, 
-    -1, -1, -1, -1, -1, -1, -1, 19, 63, -1, 52, -1, -1, -1, -1, -1, 34, -1, -1, 
-    -1, -1, -1, -1, -1, 13, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, 39, -1, -1, 
-    -1, 118, -1, -1, -1, -1, -1, 121, 3, 115, -1, -1, 64, -1, -1, 60, -1, 114, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, 20, -1, -1, 
-    62, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, 22, -1, -1, -1, 
-    -1, -1, 55, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 94, 112, -1, 
-    -1, -1, -1, 59, -1, -1, 21, -1, -1, 66, -1, -1, -1, -1, -1, 107, 28, -1, -1, 
-    -1, -1, -1, -1, -1, 96, -1, -1, -1, 56, -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, 93, -1, -1, 
-    -1, -1, 9, -1, -1, -1, -1, 104, -1, -1, -1, 42, -1, -1, -1, -1, 79, 18, 70, 
-    -1, 26, 25, 32, -1, -1, 0, 37, -1, 40, -1, -1, -1, -1, 73, -1, 97, -1, -1, 
-    -1, 67, 128, -1, -1, -1, -1, -1, -1, 136, 16, 12, -1, -1, -1, -1, -1, -1, 
-    131, 117, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, 51, -1, 1, -1, 
-    -1, -1, -1, -1, 141, -1, 129, -1, 44, -1, -1, 71, -1, 61, -1, -1, -1, -1, 
-    -1, -1, -1, 101, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, 
-    139, -1, -1, -1, -1, -1, 95, -1, -1, -1, 31, -1, -1, 84, 8 
-  );
-
-{$Q-}
-function TSynCACSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 123 + Ord(Str^) * 763;
-    inc(Str);
-  end;
-  Result := Result mod 709;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCACSyn.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 TSynCACSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;  
-end;
-
-function TSynCACSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynCACSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynCACSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator);
-  AddAttribute(fOperatorAttri);
-  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(fDirecAttri);
-  InitIdent;
-  SetAttributesOnChange(DefHighlightChange);
-  fRange := rsUnknown;
-  fDefaultFilter := SYNS_FilterCAClipper;
-end;
-
-procedure TSynCACSyn.CStyleProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while fLine[Run] <> #0 do
-    case fLine[Run] of
-      '*':
-        if fLine[Run + 1] = '/' then
-        begin
-          fRange := rsUnknown;
-          inc(Run, 2);
-          break;
-        end else inc(Run);
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-procedure TSynCACSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  case FLine[Run + 1] of
-    #10: inc(Run, 2);
-  else inc(Run);
-  end;
-end;
-
-procedure TSynCACSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynCACSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynCACSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCACSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynCACSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':
-      begin
-        inc(Run, 2);
-        fTokenID := tkComment;
-        while FLine[Run] <> #0 do
-        begin
-          case FLine[Run] of
-            #10, #13: break;
-          end;
-          inc(Run);
-        end;
-      end;
-    '*':
-      begin
-        fTokenID := tkComment;
-        fRange := rsCStyle;
-        inc(Run, 2);
-        while fLine[Run] <> #0 do
-          case fLine[Run] of
-            '*':
-              if fLine[Run + 1] = '/' then
-              begin
-                fRange := rsUnknown;
-                inc(Run, 2);
-                break;
-              end else inc(Run);
-            #10: break;
-            #13: break;
-          else inc(Run);
-          end;
-      end;
-  else
-    begin
-      inc(Run);
-      fTokenID := tkOperator;
-    end;
-  end;
-end;
-
-procedure TSynCACSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynCACSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenID := tkOperator;
-end;
-
-procedure TSynCACSyn.StringProc;
-var
-  ActiveStr: WideChar;
-begin
-  fTokenID := tkString;
-  ActiveStr := FLine[Run];
-  if ((FLine[Run + 1] = #39) and (FLine[Run + 2] = #39)) or
-    ((FLine[Run + 1] = #34) and (FLine[Run + 2] = #34)) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until (FLine[Run] = ActiveStr);
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynCACSyn.DirectiveProc;
-begin
-  fTokenID := tkDirective;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      '/': if FLine[Run + 1] = '/' then break;
-      #34, #39: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #0;
-end;
-
-procedure TSynCACSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynCACSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsCStyle: CStyleProc;
-    else
-      case fLine[Run] of
-        '@': SymbolProc;
-        '&': SymbolProc;
-        '{': SymbolProc;
-        '}': SymbolProc;
-        #13: CRProc;
-        ':': SymbolProc;
-        ',': SymbolProc;
-        '#': DirectiveProc;
-        '=': SymbolProc;
-        '>': SymbolProc;
-        'A'..'Z', 'a'..'z': IdentProc;
-        '$': SymbolProc;
-        #10: LFProc;
-        '<': SymbolProc;
-        '-': SymbolProc;
-        '!': SymbolProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '+': SymbolProc;
-        '.': SymbolProc;
-        '?': SymbolProc;
-        ')': SymbolProc;
-        '(': SymbolProc;
-        ';': SymbolProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        ']': SymbolProc;
-        '[': SymbolProc;
-        '*': StarProc;
-        #39, #34: StringProc;
-        else UnknownProc;
-      end;
-  end;
-  inherited;
-end;
-
-function TSynCACSyn.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 TSynCACSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCACSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynCACSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynCACSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkDirective: Result := fDirecAttri;
-    tkOperator: Result := fOperatorAttri;
-    tkUnknown: Result := fOperatorAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynCACSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-procedure TSynCACSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynCACSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynCACSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCAClipper;
-end;
-
-class function TSynCACSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCAClipper;
-end;
-
-procedure TSynCACSyn.StarProc;
-begin
-// if Run is 0 there could be an access violation
-  if (Run = 0) or IsLineEnd(Run - 1) then
-  begin
-    fTokenID := tkComment;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run);
-  end
-  else
-  begin
-    inc(Run);
-    fTokenID := tkOperator;
-  end;
-end;
-
-class function TSynCACSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCAClipper;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCACSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCAC.pas, released 2000-04-21.
+The Original Code is based on the cwCACSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Carlos Wijders.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCAC.pas,v 1.10.2.8 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a CA-Clipper syntax highlighter for SynEdit)
+@author(Carlos Wijders , converted to SynEdit by Bruno Mikkelsen )
+@created(1998-12-27, converted to SynEdit 2000-04-21)
+@lastmod(2000-06-23)
+The SynHighlighterCAC unit provides SynEdit with a CA-Clipper syntax highlighter.
+Thanks to Primoz Gabrijelcic, Andy Jeffries.
+}
+
+unit SynHighlighterCAC;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
+    tkSpace, tkString, tkOperator, tkUnknown);
+
+  TRangeState = (rsANil, rsCStyle, rsUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynCACSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FStringAttri: TSynHighlighterAttributes;
+    FOperatorAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentFuncTable: array[0..708] of TIdentFuncTableFunc;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure StarProc;
+    procedure CRProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SymbolProc;
+    procedure StringProc;
+    procedure DirectiveProc;
+    procedure UnknownProc;
+    procedure CStyleProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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 OperatorAttri: TSynHighlighterAttributes read FOperatorAttri
+      write FOperatorAttri;
+    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..142] of UnicodeString = (
+    'aadd', 'abs', 'and', 'announce', 'asc', 'at', 'average', 'begin', 'bof', 
+    'break', 'call', 'cancel', 'cdow', 'chr', 'clear', 'close', 'cmonth', 'col', 
+    'commit', 'continue', 'copy', 'count', 'create', 'ctod', 'date', 'day', 
+    'declare', 'delete', 'deleted', 'devpos', 'dir', 'display', 'dow', 'dtoc', 
+    'dtos', 'eject', 'else', 'elseif', 'empty', 'endcase', 'enddo', 'endif', 
+    'eof', 'erase', 'exit', 'exp', 'external', 'fcount', 'field', 'fieldname', 
+    'file', 'find', 'flock', 'for', 'found', 'function', 'get', 'go', 'if', 
+    'iif', 'index', 'init', 'inkey', 'input', 'int', 'join', 'keyboard', 
+    'lastrec', 'len', 'list', 'local', 'locate', 'lock', 'log', 'lower', 
+    'ltrim', 'max', 'memvar', 'min', 'month', 'not', 'note', 'or', 'pack', 
+    'parameters', 'pcol', 'pcount', 'private', 'procedure', 'prompt', 'prow', 
+    'public', 'quit', 'read', 'recall', 'reccount', 'recno', 'reindex', 
+    'release', 'rename', 'replace', 'replicate', 'request', 'restore', 'return', 
+    'rlock', 'round', 'row', 'rtrim', 'run', 'save', 'say', 'seconds', 'seek', 
+    'select', 'sequence', 'setpos', 'skip', 'sort', 'space', 'sqrt', 'static', 
+    'store', 'str', 'substr', 'sum', 'text', 'time', 'total', 'transform', 
+    'trim', 'type', 'unlock', 'update', 'upper', 'use', 'val', 'valtype', 
+    'wait', 'while', 'word', 'year', 'zap' 
+  );
+
+  KeyIndices: array[0..708] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, 87, 41, 140, 88, -1, -1, -1, 11, 
+    -1, -1, -1, 53, -1, -1, -1, -1, 54, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 110, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, 24, -1, 86, -1, 
+    -1, -1, 81, -1, -1, -1, -1, -1, 119, -1, -1, 14, -1, -1, -1, 92, -1, -1, -1, 
+    -1, -1, 77, 89, 10, 23, -1, -1, 91, 65, -1, 122, -1, -1, -1, 36, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, 27, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 120, -1, 100, 2, -1, -1, -1, -1, 75, 7, -1, -1, 
+    -1, -1, -1, -1, -1, 108, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, 50, 30, -1, 
+    -1, -1, -1, 83, 116, -1, -1, 134, -1, -1, 69, -1, -1, -1, 109, -1, 76, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 85, -1, -1, -1, 127, -1, -1, 102, 48, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, 133, 
+    -1, 57, 113, -1, -1, -1, -1, -1, -1, 43, -1, 33, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 126, -1, 132, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, 
+    58, -1, -1, -1, -1, -1, -1, 6, -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, 78, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, 98, -1, 49, 
+    123, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 15, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 5, 82, -1, -1, -1, -1, -1, 35, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, 72, 
+    -1, -1, -1, -1, -1, -1, -1, 19, 63, -1, 52, -1, -1, -1, -1, -1, 34, -1, -1, 
+    -1, -1, -1, -1, -1, 13, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, 39, -1, -1, 
+    -1, 118, -1, -1, -1, -1, -1, 121, 3, 115, -1, -1, 64, -1, -1, 60, -1, 114, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, 20, -1, -1, 
+    62, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, 22, -1, -1, -1, 
+    -1, -1, 55, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 94, 112, -1, 
+    -1, -1, -1, 59, -1, -1, 21, -1, -1, 66, -1, -1, -1, -1, -1, 107, 28, -1, -1, 
+    -1, -1, -1, -1, -1, 96, -1, -1, -1, 56, -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, 93, -1, -1, 
+    -1, -1, 9, -1, -1, -1, -1, 104, -1, -1, -1, 42, -1, -1, -1, -1, 79, 18, 70, 
+    -1, 26, 25, 32, -1, -1, 0, 37, -1, 40, -1, -1, -1, -1, 73, -1, 97, -1, -1, 
+    -1, 67, 128, -1, -1, -1, -1, -1, -1, 136, 16, 12, -1, -1, -1, -1, -1, -1, 
+    131, 117, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, 51, -1, 1, -1, 
+    -1, -1, -1, -1, 141, -1, 129, -1, 44, -1, -1, 71, -1, 61, -1, -1, -1, -1, 
+    -1, -1, -1, 101, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, 
+    139, -1, -1, -1, -1, -1, 95, -1, -1, -1, 31, -1, -1, 84, 8 
+  );
+
+{$Q-}
+function TSynCACSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 123 + Ord(Str^) * 763;
+    Inc(Str);
+  end;
+  Result := Result mod 709;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCACSyn.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 TSynCACSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynCACSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynCACSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynCACSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator);
+  AddAttribute(FOperatorAttri);
+  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(FDirecAttri);
+  InitIdent;
+  SetAttributesOnChange(DefHighlightChange);
+  FRange := rsUnknown;
+  FDefaultFilter := SYNS_FilterCAClipper;
+end;
+
+procedure TSynCACSyn.CStyleProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          FRange := rsUnknown;
+          Inc(Run, 2);
+          Break;
+        end else Inc(Run);
+      #10: Break;
+      #13: Break;
+    else Inc(Run);
+    end;
+end;
+
+procedure TSynCACSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  case FLine[Run + 1] of
+    #10: Inc(Run, 2);
+  else Inc(Run);
+  end;
+end;
+
+procedure TSynCACSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynCACSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynCACSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCACSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'e', 'E':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynCACSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':
+      begin
+        Inc(Run, 2);
+        FTokenID := tkComment;
+        while FLine[Run] <> #0 do
+        begin
+          case FLine[Run] of
+            #10, #13: Break;
+          end;
+          Inc(Run);
+        end;
+      end;
+    '*':
+      begin
+        FTokenID := tkComment;
+        FRange := rsCStyle;
+        Inc(Run, 2);
+        while FLine[Run] <> #0 do
+          case FLine[Run] of
+            '*':
+              if FLine[Run + 1] = '/' then
+              begin
+                FRange := rsUnknown;
+                Inc(Run, 2);
+                Break;
+              end else Inc(Run);
+            #10: Break;
+            #13: Break;
+          else Inc(Run);
+          end;
+      end;
+  else
+    begin
+      Inc(Run);
+      FTokenID := tkOperator;
+    end;
+  end;
+end;
+
+procedure TSynCACSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynCACSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkOperator;
+end;
+
+procedure TSynCACSyn.StringProc;
+var
+  ActiveStr: WideChar;
+begin
+  FTokenID := tkString;
+  ActiveStr := FLine[Run];
+  if ((FLine[Run + 1] = #39) and (FLine[Run + 2] = #39)) or
+    ((FLine[Run + 1] = #34) and (FLine[Run + 2] = #34)) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+    end;
+    Inc(Run);
+  until (FLine[Run] = ActiveStr);
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynCACSyn.DirectiveProc;
+begin
+  FTokenID := tkDirective;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '/': if FLine[Run + 1] = '/' then Break;
+      #34, #39: Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #0;
+end;
+
+procedure TSynCACSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynCACSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsCStyle: CStyleProc;
+    else
+      case FLine[Run] of
+        '@': SymbolProc;
+        '&': SymbolProc;
+        '{': SymbolProc;
+        '}': SymbolProc;
+        #13: CRProc;
+        ':': SymbolProc;
+        ',': SymbolProc;
+        '#': DirectiveProc;
+        '=': SymbolProc;
+        '>': SymbolProc;
+        'A'..'Z', 'a'..'z': IdentProc;
+        '$': SymbolProc;
+        #10: LFProc;
+        '<': SymbolProc;
+        '-': SymbolProc;
+        '!': SymbolProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '+': SymbolProc;
+        '.': SymbolProc;
+        '?': SymbolProc;
+        ')': SymbolProc;
+        '(': SymbolProc;
+        ';': SymbolProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        ']': SymbolProc;
+        '[': SymbolProc;
+        '*': StarProc;
+        #39, #34: StringProc;
+        else UnknownProc;
+      end;
+  end;
+  inherited;
+end;
+
+function TSynCACSyn.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 TSynCACSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCACSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynCACSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynCACSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkDirective: Result := FDirecAttri;
+    tkOperator: Result := FOperatorAttri;
+    tkUnknown: Result := FOperatorAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynCACSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynCACSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynCACSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynCACSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCAClipper;
+end;
+
+class function TSynCACSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCAClipper;
+end;
+
+procedure TSynCACSyn.StarProc;
+begin
+// if Run is 0 there could be an access violation
+  if (Run = 0) or IsLineEnd(Run - 1) then
+  begin
+    FTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end
+  else
+  begin
+    Inc(Run);
+    FTokenID := tkOperator;
+  end;
+end;
+
+class function TSynCACSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCAClipper;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCACSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCPM.pas b/Source/VCL/SynEdit/Source/SynHighlighterCPM.pas
index de27536f..079ede1d 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCPM.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCPM.pas
@@ -1,2064 +1,2066 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCPM.pas, released 2001-08-14.
-The Initial Author of this file is Pieter Polak.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCPM.pas,v 1.16.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-
-unit SynHighlighterCPM;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-Type
-  TtkTokenKind = (
-    tkComment,
-    tkIdentifier,
-    tkKey,
-    tkNull,
-    tkSpace,
-    tkSQLKey,
-    tkString,
-    tkSymbol,
-    tkSpecialVar,
-    tkSystem,
-    tkVariable,
-    tkNumber,
-    tkUnknown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TRangeState = (rsBraceComment, rsUnKnown);
-
-type
-  TSynCPMSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fCommentLevel: Integer;
-    fTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..796] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fSQLKeyAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fSpecialVarAttri: TSynHighlighterAttributes;
-    fSystemAttri: TSynHighlighterAttributes;
-    fVariableAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncAllentities(Index: Integer): TtkTokenKind;
-    function FuncAllproducts(Index: Integer): TtkTokenKind;
-    function FuncAllproperties(Index: Integer): TtkTokenKind;
-    function FuncAllqualityproperties(Index: Integer): TtkTokenKind;
-    function FuncAllsuppliers(Index: Integer): TtkTokenKind;
-    function FuncAssign(Index: Integer): TtkTokenKind;
-    function FuncBegin(Index: Integer): TtkTokenKind;
-    function FuncBlock(Index: Integer): TtkTokenKind;
-    function FuncCase(Index: Integer): TtkTokenKind;
-    function FuncCategory(Index: Integer): TtkTokenKind;
-    function FuncCenterstr(Index: Integer): TtkTokenKind;
-    function FuncCharreplacestr(Index: Integer): TtkTokenKind;
-    function FuncCharrlenstr(Index: Integer): TtkTokenKind;
-    function FuncCharrllenstr(Index: Integer): TtkTokenKind;
-    function FuncChr(Index: Integer): TtkTokenKind;
-    function FuncClient(Index: Integer): TtkTokenKind;
-    function FuncConstants(Index: Integer): TtkTokenKind;
-    function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncCopyfile(Index: Integer): TtkTokenKind;
-    function FuncCountry(Index: Integer): TtkTokenKind;
-    function FuncDecr(Index: Integer): TtkTokenKind;
-    function FuncDefinition(Index: Integer): TtkTokenKind;
-    function FuncDistinct_execute(Index: Integer): TtkTokenKind;
-    function FuncDivide(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncEmptysheet(Index: Integer): TtkTokenKind;
-    function FuncEnd(Index: Integer): TtkTokenKind;
-    function FuncEntitycode(Index: Integer): TtkTokenKind;
-    function FuncEqualstring(Index: Integer): TtkTokenKind;
-    function FuncEqualvalue(Index: Integer): TtkTokenKind;
-    function FuncExecute(Index: Integer): TtkTokenKind;
-    function FuncFileappend(Index: Integer): TtkTokenKind;
-    function FuncFileassign(Index: Integer): TtkTokenKind;
-    function FuncFileclose(Index: Integer): TtkTokenKind;
-    function FuncFilecopy(Index: Integer): TtkTokenKind;
-    function FuncFiledate(Index: Integer): TtkTokenKind;
-    function FuncFiledelete(Index: Integer): TtkTokenKind;
-    function FuncFileend(Index: Integer): TtkTokenKind;
-    function FuncFileexists(Index: Integer): TtkTokenKind;
-    function FuncFilereadln(Index: Integer): TtkTokenKind;
-    function FuncFilereset(Index: Integer): TtkTokenKind;
-    function FuncFilerewrite(Index: Integer): TtkTokenKind;
-    function FuncFilesize(Index: Integer): TtkTokenKind;
-    function FuncFilesort(Index: Integer): TtkTokenKind;
-    function FuncFiletime(Index: Integer): TtkTokenKind;
-    function FuncFilewriteln(Index: Integer): TtkTokenKind;
-    function FuncFilterstr(Index: Integer): TtkTokenKind;
-    function FuncFirstinstance(Index: Integer): TtkTokenKind;
-    function FuncFlow(Index: Integer): TtkTokenKind;
-    function FuncFold(Index: Integer): TtkTokenKind;
-    function FuncForeign(Index: Integer): TtkTokenKind;
-    function FuncGlobalconstants(Index: Integer): TtkTokenKind;
-    function FuncGlobals(Index: Integer): TtkTokenKind;
-    function FuncGlobalvariables(Index: Integer): TtkTokenKind;
-    function FuncGroupdown(Index: Integer): TtkTokenKind;
-    function FuncGroupfooter(Index: Integer): TtkTokenKind;
-    function FuncGroupheader(Index: Integer): TtkTokenKind;
-    function FuncGroupkey(Index: Integer): TtkTokenKind;
-    function FuncGroupup(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncInclude(Index: Integer): TtkTokenKind;
-    function FuncIncr(Index: Integer): TtkTokenKind;
-    function FuncLanguage(Index: Integer): TtkTokenKind;
-    function FuncLastinstance(Index: Integer): TtkTokenKind;
-    function FuncLeftstr(Index: Integer): TtkTokenKind;
-    function FuncLength(Index: Integer): TtkTokenKind;
-    function FuncLlenstr(Index: Integer): TtkTokenKind;
-    function FuncLocal(Index: Integer): TtkTokenKind;
-    function FuncLocasestr(Index: Integer): TtkTokenKind;
-    function FuncLoop(Index: Integer): TtkTokenKind;
-    function FuncLowerlevelstoo(Index: Integer): TtkTokenKind;
-    function FuncLtrunc(Index: Integer): TtkTokenKind;
-    function FuncMatching(Index: Integer): TtkTokenKind;
-    function FuncMember(Index: Integer): TtkTokenKind;
-    function FuncMerge(Index: Integer): TtkTokenKind;
-    function FuncMessagedlg(Index: Integer): TtkTokenKind;
-    function FuncMetaflow(Index: Integer): TtkTokenKind;
-    function FuncMidstr(Index: Integer): TtkTokenKind;
-    function FuncMultiply(Index: Integer): TtkTokenKind;
-    function FuncNextinstance(Index: Integer): TtkTokenKind;
-    function FuncNextrepeatinstance(Index: Integer): TtkTokenKind;
-    function FuncOf(Index: Integer): TtkTokenKind;
-    function FuncOptions(Index: Integer): TtkTokenKind;
-    function FuncOrganisation(Index: Integer): TtkTokenKind;
-    function FuncOutput(Index: Integer): TtkTokenKind;
-    function FuncParam(Index: Integer): TtkTokenKind;
-    function FuncParent(Index: Integer): TtkTokenKind;
-    function FuncParseinc(Index: Integer): TtkTokenKind;
-    function FuncPdriver(Index: Integer): TtkTokenKind;
-    function FuncPrevinstance(Index: Integer): TtkTokenKind;
-    function FuncPrevrepeatinstance(Index: Integer): TtkTokenKind;
-    function FuncPrinter(Index: Integer): TtkTokenKind;
-    function FuncPrintfile(Index: Integer): TtkTokenKind;
-    function FuncPropertygroup(Index: Integer): TtkTokenKind;
-    function FuncRastr(Index: Integer): TtkTokenKind;
-    function FuncRaval(Index: Integer): TtkTokenKind;
-    function FuncReadinstance(Index: Integer): TtkTokenKind;
-    function FuncReadrepeatinstance(Index: Integer): TtkTokenKind;
-    function FuncRepeat(Index: Integer): TtkTokenKind;
-    function FuncRepeatcount(Index: Integer): TtkTokenKind;
-    function FuncReportlevel(Index: Integer): TtkTokenKind;
-    function FuncRightstr(Index: Integer): TtkTokenKind;
-    function FuncRlenstr(Index: Integer): TtkTokenKind;
-    function FuncRoot(Index: Integer): TtkTokenKind;
-    function FuncRound(Index: Integer): TtkTokenKind;
-    function FuncShowmessage(Index: Integer): TtkTokenKind;
-    function FuncSkipemtpty(Index: Integer): TtkTokenKind;
-    function FuncSortdown(Index: Integer): TtkTokenKind;
-    function FuncSortkey(Index: Integer): TtkTokenKind;
-    function FuncSortup(Index: Integer): TtkTokenKind;
-    function FuncSql_add(Index: Integer): TtkTokenKind;
-    function FuncSql_asfloat(Index: Integer): TtkTokenKind;
-    function FuncSql_asstring(Index: Integer): TtkTokenKind;
-    function FuncSql_create(Index: Integer): TtkTokenKind;
-    function FuncSql_dump(Index: Integer): TtkTokenKind;
-    function FuncSql_eof(Index: Integer): TtkTokenKind;
-    function FuncSql_execute(Index: Integer): TtkTokenKind;
-    function FuncSql_free(Index: Integer): TtkTokenKind;
-    function FuncSql_mladd(Index: Integer): TtkTokenKind;
-    function FuncSql_mlmultiadd(Index: Integer): TtkTokenKind;
-    function FuncSql_next(Index: Integer): TtkTokenKind;
-    function FuncSql_setvar(Index: Integer): TtkTokenKind;
-    function FuncSqr(Index: Integer): TtkTokenKind;
-    function FuncStripstr(Index: Integer): TtkTokenKind;
-    function FuncStroptions(Index: Integer): TtkTokenKind;
-    function FuncStrpos(Index: Integer): TtkTokenKind;
-    function FuncSubtract(Index: Integer): TtkTokenKind;
-    function FuncSum(Index: Integer): TtkTokenKind;
-    function FuncSupplier(Index: Integer): TtkTokenKind;
-    function FuncSuppliesofmembers(Index: Integer): TtkTokenKind;
-    function FuncThen(Index: Integer): TtkTokenKind;
-    function FuncTrunc(Index: Integer): TtkTokenKind;
-    function FuncUpcasestr(Index: Integer): TtkTokenKind;
-    function FuncUsedby(Index: Integer): TtkTokenKind;
-    function FuncV_date(Index: Integer): TtkTokenKind;
-    function FuncV_false(Index: Integer): TtkTokenKind;
-    function FuncV_nonereal(Index: Integer): TtkTokenKind;
-    function FuncV_par_language(Index: Integer): TtkTokenKind;
-    function FuncV_par_language_count(Index: Integer): TtkTokenKind;
-    function FuncV_par_language_fields(Index: Integer): TtkTokenKind;
-    function FuncV_time(Index: Integer): TtkTokenKind;
-    function FuncV_true(Index: Integer): TtkTokenKind;
-    function FuncVariables(Index: Integer): TtkTokenKind;
-    function FuncVaroptions(Index: Integer): TtkTokenKind;
-    function FuncWhile(Index: Integer): TtkTokenKind;
-    function FuncZerorlenstr(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure CRProc;
-    procedure LFProc;
-    procedure SemiColonProc;
-    procedure SymbolProc;
-    procedure NumberProc;
-    procedure BraceOpenProc;
-    procedure IdentProc;
-    procedure VariableProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure BraceCommentProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    function GetRange: Pointer; override;
-    procedure ResetRange; override;
-    procedure SetRange(Value: Pointer); override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    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 SQLKeyAttri: TSynHighlighterAttributes read fSQLKeyAttri write fSQLKeyAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
-    property SpecialVarAttri: TSynHighlighterAttributes read fSpecialVarAttri write fSpecialVarAttri;
-    property SystemAttri: TSynHighlighterAttributes read fSystemAttri write fSystemAttri;
-    property VariableAttri: TSynHighlighterAttributes read fVariableAttri write fVariableAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..145] of string = (
-    'allentities', 'allproducts', 'allproperties', 'allqualityproperties', 
-    'allsuppliers', 'assign', 'begin', 'block', 'case', 'category', 'centerstr', 
-    'charreplacestr', 'charrlenstr', 'charrllenstr', 'chr', 'client', 
-    'constants', 'continue', 'copyfile', 'country', 'decr', 'definition', 
-    'distinct_execute', 'divide', 'else', 'emptysheet', 'end', 'entitycode', 
-    'equalstring', 'equalvalue', 'execute', 'fileappend', 'fileassign', 
-    'fileclose', 'filecopy', 'filedate', 'filedelete', 'fileend', 'fileexists', 
-    'filereadln', 'filereset', 'filerewrite', 'filesize', 'filesort', 
-    'filetime', 'filewriteln', 'filterstr', 'firstinstance', 'flow', 'fold', 
-    'foreign', 'globalconstants', 'globals', 'globalvariables', 'groupdown', 
-    'groupfooter', 'groupheader', 'groupkey', 'groupup', 'if', 'include', 
-    'incr', 'language', 'lastinstance', 'leftstr', 'length', 'llenstr', 'local', 
-    'locasestr', 'loop', 'lowerlevelstoo', 'ltrunc', 'matching', 'member', 
-    'merge', 'messagedlg', 'metaflow', 'midstr', 'multiply', 'nextinstance', 
-    'nextrepeatinstance', 'of', 'options', 'organisation', 'output', 'param', 
-    'parent', 'parseinc', 'pdriver', 'previnstance', 'prevrepeatinstance', 
-    'printer', 'printfile', 'propertygroup', 'rastr', 'raval', 'readinstance', 
-    'readrepeatinstance', 'repeat', 'repeatcount', 'reportlevel', 'rightstr', 
-    'rlenstr', 'root', 'round', 'showmessage', 'skipemtpty', 'sortdown', 
-    'sortkey', 'sortup', 'sql_add', 'sql_asfloat', 'sql_asstring', 'sql_create', 
-    'sql_dump', 'sql_eof', 'sql_execute', 'sql_free', 'sql_mladd', 
-    'sql_mlmultiadd', 'sql_next', 'sql_setvar', 'sqr', 'stripstr', 'stroptions', 
-    'strpos', 'subtract', 'sum', 'supplier', 'suppliesofmembers', 'then', 
-    'trunc', 'upcasestr', 'usedby', 'v_date', 'v_false', 'v_nonereal', 
-    'v_par_language', 'v_par_language_count', 'v_par_language_fields', 'v_time', 
-    'v_true', 'variables', 'varoptions', 'while', 'zerorlenstr' 
-  );
-
-  KeyIndices: array[0..796] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, 45, -1, 26, -1, -1, -1, -1, -1, 74, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 25, 85, -1, -1, -1, 58, -1, 51, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 4, 43, 30, -1, 54, 127, -1, -1, -1, 136, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 38, -1, 32, -1, -1, -1, -1, -1, -1, 
-    -1, 133, 65, -1, 96, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, 89, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, 35, -1, -1, 5, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 75, 41, -1, -1, 36, -1, -1, -1, -1, -1, -1, 143, -1, 
-    -1, 105, -1, -1, -1, -1, -1, 86, 142, 99, -1, 131, -1, -1, -1, -1, -1, -1, 
-    8, -1, -1, -1, -1, 83, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 53, 27, -1, -1, -1, -1, -1, -1, 102, -1, -1, 
-    -1, -1, -1, -1, -1, 2, -1, -1, 28, -1, 24, 141, -1, -1, 101, -1, -1, 134, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 111, -1, 100, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 44, 135, -1, 117, -1, 77, -1, 37, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 7, -1, 
-    109, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, 113, -1, -1, 0, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 73, 34, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, 123, -1, -1, -1, -1, -1, 
-    63, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, 
-    -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, 71, 138, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 93, 110, -1, -1, 80, -1, -1, 137, -1, -1, -1, 91, -1, 60, -1, 
-    -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, 29, -1, 
-    -1, 122, -1, -1, -1, -1, 39, -1, 61, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, 
-    -1, -1, 22, 130, -1, -1, -1, -1, -1, 81, -1, 57, -1, -1, 20, 121, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, -1, 31, -1, -1, -1, -1, 
-    -1, 47, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 
-    -1, -1, 64, -1, -1, 1, -1, 118, -1, -1, -1, -1, -1, -1, 87, 49, -1, -1, -1, 
-    -1, -1, 79, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    46, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    106, -1, 97, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 40, -1, -1, 72, 70, 88, -1, 12, -1, -1, -1, -1, -1, -1, -1, 124, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 
-    -1, -1, 59, -1, -1, -1, -1, -1, 11, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, 
-    18, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 17, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 112, -1, -1, 98, -1, 116, 120, -1, 21, -1, 9, -1, 
-    -1, -1, 19, -1, -1, -1, 50, -1, -1, -1, 126, -1, -1, 55, -1, 145, -1, -1, 
-    -1, -1, 52, 139, -1, 14, -1, -1, 115, -1, -1, -1, 90, -1, -1, -1, 128, -1, 
-    -1, -1, 103, -1, -1, -1, -1, -1, 3, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynCPMSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 841 + Ord(Str^) * 268;
-    inc(Str);
-  end;
-  Result := Result mod 797;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCPMSyn.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 TSynCPMSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[314] := FuncAllentities;
-  fIdentFuncTable[528] := FuncAllproducts;
-  fIdentFuncTable[212] := FuncAllproperties;
-  fIdentFuncTable[774] := FuncAllqualityproperties;
-  fIdentFuncTable[46] := FuncAllsuppliers;
-  fIdentFuncTable[127] := FuncAssign;
-  fIdentFuncTable[462] := FuncBegin;
-  fIdentFuncTable[297] := FuncBlock;
-  fIdentFuncTable[169] := FuncCase;
-  fIdentFuncTable[728] := FuncCategory;
-  fIdentFuncTable[106] := FuncCenterstr;
-  fIdentFuncTable[663] := FuncCharreplacestr;
-  fIdentFuncTable[607] := FuncCharrlenstr;
-  fIdentFuncTable[326] := FuncCharrllenstr;
-  fIdentFuncTable[753] := FuncChr;
-  fIdentFuncTable[251] := FuncClient;
-  fIdentFuncTable[793] := FuncConstants;
-  fIdentFuncTable[694] := FuncContinue;
-  fIdentFuncTable[674] := FuncCopyfile;
-  fIdentFuncTable[732] := FuncCountry;
-  fIdentFuncTable[481] := FuncDecr;
-  fIdentFuncTable[726] := FuncDefinition;
-  fIdentFuncTable[469] := FuncDistinct_execute;
-  fIdentFuncTable[120] := FuncDivide;
-  fIdentFuncTable[217] := FuncElse;
-  fIdentFuncTable[26] := FuncEmptysheet;
-  fIdentFuncTable[10] := FuncEnd;
-  fIdentFuncTable[197] := FuncEntitycode;
-  fIdentFuncTable[215] := FuncEqualstring;
-  fIdentFuncTable[446] := FuncEqualvalue;
-  fIdentFuncTable[48] := FuncExecute;
-  fIdentFuncTable[499] := FuncFileappend;
-  fIdentFuncTable[69] := FuncFileassign;
-  fIdentFuncTable[521] := FuncFileclose;
-  fIdentFuncTable[329] := FuncFilecopy;
-  fIdentFuncTable[124] := FuncFiledate;
-  fIdentFuncTable[142] := FuncFiledelete;
-  fIdentFuncTable[273] := FuncFileend;
-  fIdentFuncTable[67] := FuncFileexists;
-  fIdentFuncTable[454] := FuncFilereadln;
-  fIdentFuncTable[600] := FuncFilereset;
-  fIdentFuncTable[139] := FuncFilerewrite;
-  fIdentFuncTable[296] := FuncFilesize;
-  fIdentFuncTable[47] := FuncFilesort;
-  fIdentFuncTable[266] := FuncFiletime;
-  fIdentFuncTable[8] := FuncFilewriteln;
-  fIdentFuncTable[561] := FuncFilterstr;
-  fIdentFuncTable[505] := FuncFirstinstance;
-  fIdentFuncTable[356] := FuncFlow;
-  fIdentFuncTable[538] := FuncFold;
-  fIdentFuncTable[736] := FuncForeign;
-  fIdentFuncTable[33] := FuncGlobalconstants;
-  fIdentFuncTable[750] := FuncGlobals;
-  fIdentFuncTable[196] := FuncGlobalvariables;
-  fIdentFuncTable[50] := FuncGroupdown;
-  fIdentFuncTable[743] := FuncGroupfooter;
-  fIdentFuncTable[66] := FuncGroupheader;
-  fIdentFuncTable[478] := FuncGroupkey;
-  fIdentFuncTable[31] := FuncGroupup;
-  fIdentFuncTable[657] := FuncIf;
-  fIdentFuncTable[427] := FuncInclude;
-  fIdentFuncTable[456] := FuncIncr;
-  fIdentFuncTable[430] := FuncLanguage;
-  fIdentFuncTable[354] := FuncLastinstance;
-  fIdentFuncTable[525] := FuncLeftstr;
-  fIdentFuncTable[78] := FuncLength;
-  fIdentFuncTable[379] := FuncLlenstr;
-  fIdentFuncTable[177] := FuncLocal;
-  fIdentFuncTable[583] := FuncLocasestr;
-  fIdentFuncTable[285] := FuncLoop;
-  fIdentFuncTable[604] := FuncLowerlevelstoo;
-  fIdentFuncTable[403] := FuncLtrunc;
-  fIdentFuncTable[603] := FuncMatching;
-  fIdentFuncTable[328] := FuncMember;
-  fIdentFuncTable[16] := FuncMerge;
-  fIdentFuncTable[138] := FuncMessagedlg;
-  fIdentFuncTable[777] := FuncMetaflow;
-  fIdentFuncTable[271] := FuncMidstr;
-  fIdentFuncTable[675] := FuncMultiply;
-  fIdentFuncTable[544] := FuncNextinstance;
-  fIdentFuncTable[418] := FuncNextrepeatinstance;
-  fIdentFuncTable[476] := FuncOf;
-  fIdentFuncTable[440] := FuncOptions;
-  fIdentFuncTable[174] := FuncOrganisation;
-  fIdentFuncTable[390] := FuncOutput;
-  fIdentFuncTable[27] := FuncParam;
-  fIdentFuncTable[158] := FuncParent;
-  fIdentFuncTable[537] := FuncParseinc;
-  fIdentFuncTable[605] := FuncPdriver;
-  fIdentFuncTable[93] := FuncPrevinstance;
-  fIdentFuncTable[760] := FuncPrevrepeatinstance;
-  fIdentFuncTable[425] := FuncPrinter;
-  fIdentFuncTable[654] := FuncPrintfile;
-  fIdentFuncTable[414] := FuncPropertygroup;
-  fIdentFuncTable[497] := FuncRastr;
-  fIdentFuncTable[395] := FuncRaval;
-  fIdentFuncTable[80] := FuncReadinstance;
-  fIdentFuncTable[581] := FuncReadrepeatinstance;
-  fIdentFuncTable[721] := FuncRepeat;
-  fIdentFuncTable[160] := FuncRepeatcount;
-  fIdentFuncTable[249] := FuncReportlevel;
-  fIdentFuncTable[221] := FuncRightstr;
-  fIdentFuncTable[204] := FuncRlenstr;
-  fIdentFuncTable[768] := FuncRoot;
-  fIdentFuncTable[666] := FuncRound;
-  fIdentFuncTable[152] := FuncShowmessage;
-  fIdentFuncTable[579] := FuncSkipemtpty;
-  fIdentFuncTable[307] := FuncSortdown;
-  fIdentFuncTable[508] := FuncSortkey;
-  fIdentFuncTable[299] := FuncSortup;
-  fIdentFuncTable[415] := FuncSql_add;
-  fIdentFuncTable[247] := FuncSql_asfloat;
-  fIdentFuncTable[718] := FuncSql_asstring;
-  fIdentFuncTable[311] := FuncSql_create;
-  fIdentFuncTable[635] := FuncSql_dump;
-  fIdentFuncTable[756] := FuncSql_eof;
-  fIdentFuncTable[723] := FuncSql_execute;
-  fIdentFuncTable[269] := FuncSql_free;
-  fIdentFuncTable[530] := FuncSql_mladd;
-  fIdentFuncTable[551] := FuncSql_mlmultiadd;
-  fIdentFuncTable[724] := FuncSql_next;
-  fIdentFuncTable[482] := FuncSql_setvar;
-  fIdentFuncTable[449] := FuncSqr;
-  fIdentFuncTable[348] := FuncStripstr;
-  fIdentFuncTable[615] := FuncStroptions;
-  fIdentFuncTable[566] := FuncStrpos;
-  fIdentFuncTable[740] := FuncSubtract;
-  fIdentFuncTable[51] := FuncSum;
-  fIdentFuncTable[764] := FuncSupplier;
-  fIdentFuncTable[696] := FuncSuppliesofmembers;
-  fIdentFuncTable[470] := FuncThen;
-  fIdentFuncTable[162] := FuncTrunc;
-  fIdentFuncTable[344] := FuncUpcasestr;
-  fIdentFuncTable[77] := FuncUsedby;
-  fIdentFuncTable[224] := FuncV_date;
-  fIdentFuncTable[267] := FuncV_false;
-  fIdentFuncTable[55] := FuncV_nonereal;
-  fIdentFuncTable[421] := FuncV_par_language;
-  fIdentFuncTable[404] := FuncV_par_language_count;
-  fIdentFuncTable[751] := FuncV_par_language_fields;
-  fIdentFuncTable[366] := FuncV_time;
-  fIdentFuncTable[218] := FuncV_true;
-  fIdentFuncTable[159] := FuncVariables;
-  fIdentFuncTable[149] := FuncVaroptions;
-  fIdentFuncTable[84] := FuncWhile;
-  fIdentFuncTable[745] := FuncZerorlenstr;
-end;
-
-function TSynCPMSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAllentities(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAllproducts(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAllproperties(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAllqualityproperties(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAllsuppliers(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncAssign(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncBegin(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncBlock(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCategory(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCenterstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCharreplacestr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCharrlenstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCharrllenstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncChr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncClient(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncConstants(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncContinue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCopyfile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncCountry(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncDecr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncDefinition(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncDistinct_execute(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncDivide(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncEmptysheet(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncEnd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncEntitycode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncEqualstring(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncEqualvalue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncExecute(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFileappend(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFileassign(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFileclose(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilecopy(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFiledate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFiledelete(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFileend(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFileexists(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilereadln(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilereset(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilerewrite(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilesize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilesort(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFiletime(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilewriteln(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFilterstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFirstinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFlow(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncFold(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncForeign(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGlobalconstants(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGlobals(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGlobalvariables(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGroupdown(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGroupfooter(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGroupheader(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGroupkey(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncGroupup(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncInclude(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncIncr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLanguage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLastinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLeftstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLength(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLlenstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLocal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLocasestr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLoop(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLowerlevelstoo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncLtrunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMatching(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMember(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMerge(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMessagedlg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMetaflow(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMidstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncMultiply(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncNextinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncNextrepeatinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncOf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncOptions(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncOrganisation(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncOutput(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncParam(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncParent(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncParseinc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPdriver(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPrevinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPrevrepeatinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPrinter(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPrintfile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncPropertygroup(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRastr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRaval(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncReadinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncReadrepeatinstance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRepeat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRepeatcount(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncReportlevel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRightstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRlenstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRoot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncRound(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncShowmessage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSkipemtpty(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSortdown(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSortkey(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSortup(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_add(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_asfloat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_asstring(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_create(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_dump(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_eof(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_execute(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_free(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_mladd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_mlmultiadd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_next(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSql_setvar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSQLKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSqr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncStripstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncStroptions(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncStrpos(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSubtract(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSum(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSupplier(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncSuppliesofmembers(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncThen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncTrunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncUpcasestr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncUsedby(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_date(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_false(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_nonereal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_par_language(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_par_language_count(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_par_language_fields(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_time(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncV_true(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSpecialVar
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncVariables(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncVaroptions(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncWhile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCPMSyn.FuncZerorlenstr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkSystem
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynCPMSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Foreground := clNavy;
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Foreground := clGreen;
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  
-  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fSQLKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrSQLKey, SYNS_FriendlyAttrSQLKey);
-  fSQLKeyAttri.ForeGround := clTeal;
-  fSQLKeyAttri.Style := [fsBold];
-  AddAttribute(fSQLKeyAttri);
-
-  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-
-  fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-
-  fSpecialVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
-  fSpecialVarAttri.Style := [fsBold];
-  AddAttribute(fSpecialVarAttri);
-
-  fSystemAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystem, SYNS_FriendlyAttrSystem);
-  fSystemAttri.Foreground := $000080FF;
-  fSystemAttri.Style := [fsBold];
-  AddAttribute(fSystemAttri);
-
-  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  fVariableAttri.Foreground := clMaroon;
-  AddAttribute(fVariableAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fRange := rsUnknown;
-  fCommentLevel := 0;
-  fDefaultFilter := SYNS_FilterCPM;
-end; { Create }
-
-procedure TSynCPMSyn.BraceOpenProc;
-begin
-  fRange := rsBraceComment;
-  BraceCommentProc;
-  fTokenID := tkComment;
-end; { BraceOpenProc }
-
-procedure TSynCPMSyn.IdentProc;
-begin
-  fTokenID := IdentKind(fLine + Run);
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
-    Inc(Run);
-end; { IdentProc }
-
-procedure TSynCPMSyn.VariableProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  if (fTokenID = tkIdentifier) then
-  begin
-    if (fLine[Run + 1] = '_') then
-      fTokenID := tkVariable
-  end;
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
-    Inc(Run);
-end; { VariableProc }
-
-procedure TSynCPMSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end; { NullProc }
-
-procedure TSynCPMSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end; { SpaceProc }
-
-procedure TSynCPMSyn.StringProc;
-begin
-  fTokenID := tkString;
-  repeat
-    Inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = '"');
-  if (fLine[Run] = '"') then
-  begin
-    Inc(Run);
-    if (fLine[Run] = '"') then
-      Inc(Run);
-  end;
-end; { StringProc }
-
-procedure TSynCPMSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end; { UnknownProc }
-
-procedure TSynCPMSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsBraceComment: BraceCommentProc;
-  else
-    case fLine[Run] of
-      #0: NullProc;
-      #10: LFProc;
-      #13: CRProc;
-      #1..#9, #11, #12, #14..#32: SpaceProc;
-      '"': StringProc;
-      '0'..'9': NumberProc;
-      'A'..'Z', 'a'..'z', '_':
-        case fLine[Run] of
-          'V', 'v', 'S', 's': VariableProc;
-          else
-            IdentProc;
-        end;
-      '{': BraceOpenProc;
-      '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~':
-      begin
-        case fLine[Run] of
-          ';': SemiColonProc;
-          else
-            SymbolProc;
-        end;
-      end;
-    else
-      UnknownProc;
-    end;
-  end;
-  inherited;
-end; { Next }
-
-function TSynCPMSyn.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; { GetDefaultAttribute }
-
-function TSynCPMSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end; { GetEol }
-
-function TSynCPMSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end; { GetTokenID }
-
-function TSynCPMSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkSQLKey: Result := fSQLKeyAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkSpecialVar: Result := fSpecialVarAttri;
-    tkSystem: Result := fSystemAttri;
-    tkVariable: Result := fVariableAttri; 
-    tkUnknown: Result := fIdentifierAttri;
-  else
-    Result := nil;
-  end;
-end; { GetTokenAttribute }
-
-function TSynCPMSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end; { GetTokenKind }
-
-class function TSynCPMSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCPM;
-end;
-
-procedure TSynCPMSyn.BraceCommentProc;
-begin
-  case fLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-  else
-    begin
-      fTokenID := tkComment;
-      repeat
-        if fLine[Run] = '{' then
-          Inc(fCommentLevel)
-        else if fLine[Run] = '}' then
-        begin
-          Dec(fCommentLevel);
-          if (fCommentLevel < 1) then
-          begin
-            Inc(Run);
-            fRange := rsUnKnown;
-            fCommentLevel := 0;
-            Break;
-          end;
-        end;
-        Inc(Run);
-      until IsLineEnd(Run);
-    end;
-  end;
-end; { BraceCommentProc }
-
-procedure TSynCPMSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
-    inc(Run);
-end; { CRProc }
-
-procedure TSynCPMSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end; { LFProc }
-
-function TSynCPMSyn.GetSampleSource: string;
-begin
-  Result := '{ COAS Product Manager report (RDF) }'#13#10 +
-            'PARAM'#13#10 +
-            '  LANGUAGE;'#13#10 +
-            '  CONTINUE;'#13#10 +
-            'END; { Param }'#13#10 +
-            #13#10 +
-            'GLOBALS'#13#10 +
-            '  LANGUAGE = LOCAL;'#13#10 +
-            'END; { Globals }'#13#10 +
-            #13#10 +
-            'DEFINITION BLOCK "MAIN"'#13#10 +
-            'VARIABLES'#13#10 +
-            '  S_Query = "";'#13#10 +
-            '  V_OraErr = -1;'#13#10 +
-            '  V_Count;'#13#10 +
-            'BEGIN'#13#10 +
-            '  ASSIGN(S_Query, "SELECT * FROM DUAL");'#13#10 +
-            '  SQL_CREATE(V_OraErr, S_Query);'#13#10 +
-            '  ASSIGN(V_Count, V_NoneReal);'#13#10 +
-            'END;';
-end; { GetSampleSource }
-
-function TSynCPMSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCPM;
-end; { IsFilterStored }
-
-procedure TSynCPMSyn.SemiColonProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-end; { SemiColonProc }
-
-procedure TSynCPMSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.': if FLine[Run + 1] = '.' then
-             Break;
-    end;
-    inc(Run);
-  end;
-end; { NumberProc }
-
-procedure TSynCPMSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end; { SymbolProc }
-
-procedure TSynCPMSyn.ResetRange;
-begin
-  inherited;
-  fRange := rsUnknown;
-  fCommentLevel := 0;
-end; { ResetRange }
-
-procedure TSynCPMSyn.SetRange(Value: Pointer);
-var
-  AValue: Integer;
-begin
-  inherited;
-  AValue := NativeInt(Value);
-  fCommentLevel := AValue div $10000;
-  fRange := TRangeState(AValue mod $10000);
-end; { SetRange }
-
-function TSynCPMSyn.GetRange: Pointer;
-begin
-  Result := Pointer((fCommentLevel * $10000) + Integer(fRange));
-end; { GetRange }
-
-class function TSynCPMSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCPM;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCPMSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCPM.pas, released 2001-08-14.
+The Initial Author of this file is Pieter Polak.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCPM.pas,v 1.16.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+-------------------------------------------------------------------------------}
+
+unit SynHighlighterCPM;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+Type
+  TtkTokenKind = (
+    tkComment,
+    tkIdentifier,
+    tkKey,
+    tkNull,
+    tkSpace,
+    tkSQLKey,
+    tkString,
+    tkSymbol,
+    tkSpecialVar,
+    tkSystem,
+    tkVariable,
+    tkNumber,
+    tkUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TRangeState = (rsBraceComment, rsUnknown);
+
+type
+  TSynCPMSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FCommentLevel: Integer;
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..796] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FSQLKeyAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FSpecialVarAttri: TSynHighlighterAttributes;
+    FSystemAttri: TSynHighlighterAttributes;
+    FVariableAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncAllentities(Index: Integer): TtkTokenKind;
+    function FuncAllproducts(Index: Integer): TtkTokenKind;
+    function FuncAllproperties(Index: Integer): TtkTokenKind;
+    function FuncAllqualityproperties(Index: Integer): TtkTokenKind;
+    function FuncAllsuppliers(Index: Integer): TtkTokenKind;
+    function FuncAssign(Index: Integer): TtkTokenKind;
+    function FuncBegin(Index: Integer): TtkTokenKind;
+    function FuncBlock(Index: Integer): TtkTokenKind;
+    function FuncCase(Index: Integer): TtkTokenKind;
+    function FuncCategory(Index: Integer): TtkTokenKind;
+    function FuncCenterstr(Index: Integer): TtkTokenKind;
+    function FuncCharreplacestr(Index: Integer): TtkTokenKind;
+    function FuncCharrlenstr(Index: Integer): TtkTokenKind;
+    function FuncCharrllenstr(Index: Integer): TtkTokenKind;
+    function FuncChr(Index: Integer): TtkTokenKind;
+    function FuncClient(Index: Integer): TtkTokenKind;
+    function FuncConstants(Index: Integer): TtkTokenKind;
+    function FuncContinue(Index: Integer): TtkTokenKind;
+    function FuncCopyfile(Index: Integer): TtkTokenKind;
+    function FuncCountry(Index: Integer): TtkTokenKind;
+    function FuncDecr(Index: Integer): TtkTokenKind;
+    function FuncDefinition(Index: Integer): TtkTokenKind;
+    function FuncDistinct_execute(Index: Integer): TtkTokenKind;
+    function FuncDivide(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncEmptysheet(Index: Integer): TtkTokenKind;
+    function FuncEnd(Index: Integer): TtkTokenKind;
+    function FuncEntitycode(Index: Integer): TtkTokenKind;
+    function FuncEqualstring(Index: Integer): TtkTokenKind;
+    function FuncEqualvalue(Index: Integer): TtkTokenKind;
+    function FuncExecute(Index: Integer): TtkTokenKind;
+    function FuncFileappend(Index: Integer): TtkTokenKind;
+    function FuncFileassign(Index: Integer): TtkTokenKind;
+    function FuncFileclose(Index: Integer): TtkTokenKind;
+    function FuncFilecopy(Index: Integer): TtkTokenKind;
+    function FuncFiledate(Index: Integer): TtkTokenKind;
+    function FuncFiledelete(Index: Integer): TtkTokenKind;
+    function FuncFileend(Index: Integer): TtkTokenKind;
+    function FuncFileexists(Index: Integer): TtkTokenKind;
+    function FuncFilereadln(Index: Integer): TtkTokenKind;
+    function FuncFilereset(Index: Integer): TtkTokenKind;
+    function FuncFilerewrite(Index: Integer): TtkTokenKind;
+    function FuncFilesize(Index: Integer): TtkTokenKind;
+    function FuncFilesort(Index: Integer): TtkTokenKind;
+    function FuncFiletime(Index: Integer): TtkTokenKind;
+    function FuncFilewriteln(Index: Integer): TtkTokenKind;
+    function FuncFilterstr(Index: Integer): TtkTokenKind;
+    function FuncFirstinstance(Index: Integer): TtkTokenKind;
+    function FuncFlow(Index: Integer): TtkTokenKind;
+    function FuncFold(Index: Integer): TtkTokenKind;
+    function FuncForeign(Index: Integer): TtkTokenKind;
+    function FuncGlobalconstants(Index: Integer): TtkTokenKind;
+    function FuncGlobals(Index: Integer): TtkTokenKind;
+    function FuncGlobalvariables(Index: Integer): TtkTokenKind;
+    function FuncGroupdown(Index: Integer): TtkTokenKind;
+    function FuncGroupfooter(Index: Integer): TtkTokenKind;
+    function FuncGroupheader(Index: Integer): TtkTokenKind;
+    function FuncGroupkey(Index: Integer): TtkTokenKind;
+    function FuncGroupup(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncInclude(Index: Integer): TtkTokenKind;
+    function FuncIncr(Index: Integer): TtkTokenKind;
+    function FuncLanguage(Index: Integer): TtkTokenKind;
+    function FuncLastinstance(Index: Integer): TtkTokenKind;
+    function FuncLeftstr(Index: Integer): TtkTokenKind;
+    function FuncLength(Index: Integer): TtkTokenKind;
+    function FuncLlenstr(Index: Integer): TtkTokenKind;
+    function FuncLocal(Index: Integer): TtkTokenKind;
+    function FuncLocasestr(Index: Integer): TtkTokenKind;
+    function FuncLoop(Index: Integer): TtkTokenKind;
+    function FuncLowerlevelstoo(Index: Integer): TtkTokenKind;
+    function FuncLtrunc(Index: Integer): TtkTokenKind;
+    function FuncMatching(Index: Integer): TtkTokenKind;
+    function FuncMember(Index: Integer): TtkTokenKind;
+    function FuncMerge(Index: Integer): TtkTokenKind;
+    function FuncMessagedlg(Index: Integer): TtkTokenKind;
+    function FuncMetaflow(Index: Integer): TtkTokenKind;
+    function FuncMidstr(Index: Integer): TtkTokenKind;
+    function FuncMultiply(Index: Integer): TtkTokenKind;
+    function FuncNextinstance(Index: Integer): TtkTokenKind;
+    function FuncNextrepeatinstance(Index: Integer): TtkTokenKind;
+    function FuncOf(Index: Integer): TtkTokenKind;
+    function FuncOptions(Index: Integer): TtkTokenKind;
+    function FuncOrganisation(Index: Integer): TtkTokenKind;
+    function FuncOutput(Index: Integer): TtkTokenKind;
+    function FuncParam(Index: Integer): TtkTokenKind;
+    function FuncParent(Index: Integer): TtkTokenKind;
+    function FuncParseinc(Index: Integer): TtkTokenKind;
+    function FuncPdriver(Index: Integer): TtkTokenKind;
+    function FuncPrevinstance(Index: Integer): TtkTokenKind;
+    function FuncPrevrepeatinstance(Index: Integer): TtkTokenKind;
+    function FuncPrinter(Index: Integer): TtkTokenKind;
+    function FuncPrintfile(Index: Integer): TtkTokenKind;
+    function FuncPropertygroup(Index: Integer): TtkTokenKind;
+    function FuncRastr(Index: Integer): TtkTokenKind;
+    function FuncRaval(Index: Integer): TtkTokenKind;
+    function FuncReadinstance(Index: Integer): TtkTokenKind;
+    function FuncReadrepeatinstance(Index: Integer): TtkTokenKind;
+    function FuncRepeat(Index: Integer): TtkTokenKind;
+    function FuncRepeatcount(Index: Integer): TtkTokenKind;
+    function FuncReportlevel(Index: Integer): TtkTokenKind;
+    function FuncRightstr(Index: Integer): TtkTokenKind;
+    function FuncRlenstr(Index: Integer): TtkTokenKind;
+    function FuncRoot(Index: Integer): TtkTokenKind;
+    function FuncRound(Index: Integer): TtkTokenKind;
+    function FuncShowmessage(Index: Integer): TtkTokenKind;
+    function FuncSkipemtpty(Index: Integer): TtkTokenKind;
+    function FuncSortdown(Index: Integer): TtkTokenKind;
+    function FuncSortkey(Index: Integer): TtkTokenKind;
+    function FuncSortup(Index: Integer): TtkTokenKind;
+    function FuncSql_add(Index: Integer): TtkTokenKind;
+    function FuncSql_asfloat(Index: Integer): TtkTokenKind;
+    function FuncSql_asstring(Index: Integer): TtkTokenKind;
+    function FuncSql_create(Index: Integer): TtkTokenKind;
+    function FuncSql_dump(Index: Integer): TtkTokenKind;
+    function FuncSql_eof(Index: Integer): TtkTokenKind;
+    function FuncSql_execute(Index: Integer): TtkTokenKind;
+    function FuncSql_free(Index: Integer): TtkTokenKind;
+    function FuncSql_mladd(Index: Integer): TtkTokenKind;
+    function FuncSql_mlmultiadd(Index: Integer): TtkTokenKind;
+    function FuncSql_next(Index: Integer): TtkTokenKind;
+    function FuncSql_setvar(Index: Integer): TtkTokenKind;
+    function FuncSqr(Index: Integer): TtkTokenKind;
+    function FuncStripstr(Index: Integer): TtkTokenKind;
+    function FuncStroptions(Index: Integer): TtkTokenKind;
+    function FuncStrpos(Index: Integer): TtkTokenKind;
+    function FuncSubtract(Index: Integer): TtkTokenKind;
+    function FuncSum(Index: Integer): TtkTokenKind;
+    function FuncSupplier(Index: Integer): TtkTokenKind;
+    function FuncSuppliesofmembers(Index: Integer): TtkTokenKind;
+    function FuncThen(Index: Integer): TtkTokenKind;
+    function FuncTrunc(Index: Integer): TtkTokenKind;
+    function FuncUpcasestr(Index: Integer): TtkTokenKind;
+    function FuncUsedby(Index: Integer): TtkTokenKind;
+    function FuncV_date(Index: Integer): TtkTokenKind;
+    function FuncV_false(Index: Integer): TtkTokenKind;
+    function FuncV_nonereal(Index: Integer): TtkTokenKind;
+    function FuncV_par_language(Index: Integer): TtkTokenKind;
+    function FuncV_par_language_count(Index: Integer): TtkTokenKind;
+    function FuncV_par_language_fields(Index: Integer): TtkTokenKind;
+    function FuncV_time(Index: Integer): TtkTokenKind;
+    function FuncV_true(Index: Integer): TtkTokenKind;
+    function FuncVariables(Index: Integer): TtkTokenKind;
+    function FuncVaroptions(Index: Integer): TtkTokenKind;
+    function FuncWhile(Index: Integer): TtkTokenKind;
+    function FuncZerorlenstr(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure CRProc;
+    procedure LFProc;
+    procedure SemiColonProc;
+    procedure SymbolProc;
+    procedure NumberProc;
+    procedure BraceOpenProc;
+    procedure IdentProc;
+    procedure VariableProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure BraceCommentProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    function GetRange: Pointer; override;
+    procedure ResetRange; override;
+    procedure SetRange(Value: Pointer); override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    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 SQLKeyAttri: TSynHighlighterAttributes read FSQLKeyAttri write FSQLKeyAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
+    property SpecialVarAttri: TSynHighlighterAttributes read FSpecialVarAttri write FSpecialVarAttri;
+    property SystemAttri: TSynHighlighterAttributes read FSystemAttri write FSystemAttri;
+    property VariableAttri: TSynHighlighterAttributes read FVariableAttri write FVariableAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..145] of UnicodeString = (
+    'allentities', 'allproducts', 'allproperties', 'allqualityproperties', 
+    'allsuppliers', 'assign', 'begin', 'block', 'case', 'category', 'centerstr', 
+    'charreplacestr', 'charrlenstr', 'charrllenstr', 'chr', 'client', 
+    'constants', 'continue', 'copyfile', 'country', 'decr', 'definition', 
+    'distinct_execute', 'divide', 'else', 'emptysheet', 'end', 'entitycode', 
+    'equalstring', 'equalvalue', 'execute', 'fileappend', 'fileassign', 
+    'fileclose', 'filecopy', 'filedate', 'filedelete', 'fileend', 'fileexists', 
+    'filereadln', 'filereset', 'filerewrite', 'filesize', 'filesort', 
+    'filetime', 'filewriteln', 'filterstr', 'firstinstance', 'flow', 'fold', 
+    'foreign', 'globalconstants', 'globals', 'globalvariables', 'groupdown', 
+    'groupfooter', 'groupheader', 'groupkey', 'groupup', 'if', 'include', 
+    'incr', 'language', 'lastinstance', 'leftstr', 'length', 'llenstr', 'local', 
+    'locasestr', 'loop', 'lowerlevelstoo', 'ltrunc', 'matching', 'member', 
+    'merge', 'messagedlg', 'metaflow', 'midstr', 'multiply', 'nextinstance', 
+    'nextrepeatinstance', 'of', 'options', 'organisation', 'output', 'param', 
+    'parent', 'parseinc', 'pdriver', 'previnstance', 'prevrepeatinstance', 
+    'printer', 'printfile', 'propertygroup', 'rastr', 'raval', 'readinstance', 
+    'readrepeatinstance', 'repeat', 'repeatcount', 'reportlevel', 'rightstr', 
+    'rlenstr', 'root', 'round', 'showmessage', 'skipemtpty', 'sortdown', 
+    'sortkey', 'sortup', 'sql_add', 'sql_asfloat', 'sql_asstring', 'sql_create', 
+    'sql_dump', 'sql_eof', 'sql_execute', 'sql_free', 'sql_mladd', 
+    'sql_mlmultiadd', 'sql_next', 'sql_setvar', 'sqr', 'stripstr', 'stroptions', 
+    'strpos', 'subtract', 'sum', 'supplier', 'suppliesofmembers', 'then', 
+    'trunc', 'upcasestr', 'usedby', 'v_date', 'v_false', 'v_nonereal', 
+    'v_par_language', 'v_par_language_count', 'v_par_language_fields', 'v_time', 
+    'v_true', 'variables', 'varoptions', 'while', 'zerorlenstr' 
+  );
+
+  KeyIndices: array[0..796] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, -1, 45, -1, 26, -1, -1, -1, -1, -1, 74, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 25, 85, -1, -1, -1, 58, -1, 51, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 4, 43, 30, -1, 54, 127, -1, -1, -1, 136, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 38, -1, 32, -1, -1, -1, -1, -1, -1, 
+    -1, 133, 65, -1, 96, -1, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, 89, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, 35, -1, -1, 5, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 75, 41, -1, -1, 36, -1, -1, -1, -1, -1, -1, 143, -1, 
+    -1, 105, -1, -1, -1, -1, -1, 86, 142, 99, -1, 131, -1, -1, -1, -1, -1, -1, 
+    8, -1, -1, -1, -1, 83, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 53, 27, -1, -1, -1, -1, -1, -1, 102, -1, -1, 
+    -1, -1, -1, -1, -1, 2, -1, -1, 28, -1, 24, 141, -1, -1, 101, -1, -1, 134, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 111, -1, 100, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 44, 135, -1, 117, -1, 77, -1, 37, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 7, -1, 
+    109, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, 113, -1, -1, 0, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 73, 34, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, 123, -1, -1, -1, -1, -1, 
+    63, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, 
+    -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, 71, 138, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 93, 110, -1, -1, 80, -1, -1, 137, -1, -1, -1, 91, -1, 60, -1, 
+    -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, 29, -1, 
+    -1, 122, -1, -1, -1, -1, 39, -1, 61, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, 
+    -1, -1, 22, 130, -1, -1, -1, -1, -1, 81, -1, 57, -1, -1, 20, 121, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, -1, 31, -1, -1, -1, -1, 
+    -1, 47, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 
+    -1, -1, 64, -1, -1, 1, -1, 118, -1, -1, -1, -1, -1, -1, 87, 49, -1, -1, -1, 
+    -1, -1, 79, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    46, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    106, -1, 97, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 40, -1, -1, 72, 70, 88, -1, 12, -1, -1, -1, -1, -1, -1, -1, 124, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 
+    -1, -1, 59, -1, -1, -1, -1, -1, 11, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, 
+    18, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 17, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 112, -1, -1, 98, -1, 116, 120, -1, 21, -1, 9, -1, 
+    -1, -1, 19, -1, -1, -1, 50, -1, -1, -1, 126, -1, -1, 55, -1, 145, -1, -1, 
+    -1, -1, 52, 139, -1, 14, -1, -1, 115, -1, -1, -1, 90, -1, -1, -1, 128, -1, 
+    -1, -1, 103, -1, -1, -1, -1, -1, 3, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1 
+  );
+
+{$Q-}
+function TSynCPMSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 841 + Ord(Str^) * 268;
+    Inc(Str);
+  end;
+  Result := Result mod 797;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCPMSyn.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 TSynCPMSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[314] := FuncAllentities;
+  FIdentFuncTable[528] := FuncAllproducts;
+  FIdentFuncTable[212] := FuncAllproperties;
+  FIdentFuncTable[774] := FuncAllqualityproperties;
+  FIdentFuncTable[46] := FuncAllsuppliers;
+  FIdentFuncTable[127] := FuncAssign;
+  FIdentFuncTable[462] := FuncBegin;
+  FIdentFuncTable[297] := FuncBlock;
+  FIdentFuncTable[169] := FuncCase;
+  FIdentFuncTable[728] := FuncCategory;
+  FIdentFuncTable[106] := FuncCenterstr;
+  FIdentFuncTable[663] := FuncCharreplacestr;
+  FIdentFuncTable[607] := FuncCharrlenstr;
+  FIdentFuncTable[326] := FuncCharrllenstr;
+  FIdentFuncTable[753] := FuncChr;
+  FIdentFuncTable[251] := FuncClient;
+  FIdentFuncTable[793] := FuncConstants;
+  FIdentFuncTable[694] := FuncContinue;
+  FIdentFuncTable[674] := FuncCopyfile;
+  FIdentFuncTable[732] := FuncCountry;
+  FIdentFuncTable[481] := FuncDecr;
+  FIdentFuncTable[726] := FuncDefinition;
+  FIdentFuncTable[469] := FuncDistinct_execute;
+  FIdentFuncTable[120] := FuncDivide;
+  FIdentFuncTable[217] := FuncElse;
+  FIdentFuncTable[26] := FuncEmptysheet;
+  FIdentFuncTable[10] := FuncEnd;
+  FIdentFuncTable[197] := FuncEntitycode;
+  FIdentFuncTable[215] := FuncEqualstring;
+  FIdentFuncTable[446] := FuncEqualvalue;
+  FIdentFuncTable[48] := FuncExecute;
+  FIdentFuncTable[499] := FuncFileappend;
+  FIdentFuncTable[69] := FuncFileassign;
+  FIdentFuncTable[521] := FuncFileclose;
+  FIdentFuncTable[329] := FuncFilecopy;
+  FIdentFuncTable[124] := FuncFiledate;
+  FIdentFuncTable[142] := FuncFiledelete;
+  FIdentFuncTable[273] := FuncFileend;
+  FIdentFuncTable[67] := FuncFileexists;
+  FIdentFuncTable[454] := FuncFilereadln;
+  FIdentFuncTable[600] := FuncFilereset;
+  FIdentFuncTable[139] := FuncFilerewrite;
+  FIdentFuncTable[296] := FuncFilesize;
+  FIdentFuncTable[47] := FuncFilesort;
+  FIdentFuncTable[266] := FuncFiletime;
+  FIdentFuncTable[8] := FuncFilewriteln;
+  FIdentFuncTable[561] := FuncFilterstr;
+  FIdentFuncTable[505] := FuncFirstinstance;
+  FIdentFuncTable[356] := FuncFlow;
+  FIdentFuncTable[538] := FuncFold;
+  FIdentFuncTable[736] := FuncForeign;
+  FIdentFuncTable[33] := FuncGlobalconstants;
+  FIdentFuncTable[750] := FuncGlobals;
+  FIdentFuncTable[196] := FuncGlobalvariables;
+  FIdentFuncTable[50] := FuncGroupdown;
+  FIdentFuncTable[743] := FuncGroupfooter;
+  FIdentFuncTable[66] := FuncGroupheader;
+  FIdentFuncTable[478] := FuncGroupkey;
+  FIdentFuncTable[31] := FuncGroupup;
+  FIdentFuncTable[657] := FuncIf;
+  FIdentFuncTable[427] := FuncInclude;
+  FIdentFuncTable[456] := FuncIncr;
+  FIdentFuncTable[430] := FuncLanguage;
+  FIdentFuncTable[354] := FuncLastinstance;
+  FIdentFuncTable[525] := FuncLeftstr;
+  FIdentFuncTable[78] := FuncLength;
+  FIdentFuncTable[379] := FuncLlenstr;
+  FIdentFuncTable[177] := FuncLocal;
+  FIdentFuncTable[583] := FuncLocasestr;
+  FIdentFuncTable[285] := FuncLoop;
+  FIdentFuncTable[604] := FuncLowerlevelstoo;
+  FIdentFuncTable[403] := FuncLtrunc;
+  FIdentFuncTable[603] := FuncMatching;
+  FIdentFuncTable[328] := FuncMember;
+  FIdentFuncTable[16] := FuncMerge;
+  FIdentFuncTable[138] := FuncMessagedlg;
+  FIdentFuncTable[777] := FuncMetaflow;
+  FIdentFuncTable[271] := FuncMidstr;
+  FIdentFuncTable[675] := FuncMultiply;
+  FIdentFuncTable[544] := FuncNextinstance;
+  FIdentFuncTable[418] := FuncNextrepeatinstance;
+  FIdentFuncTable[476] := FuncOf;
+  FIdentFuncTable[440] := FuncOptions;
+  FIdentFuncTable[174] := FuncOrganisation;
+  FIdentFuncTable[390] := FuncOutput;
+  FIdentFuncTable[27] := FuncParam;
+  FIdentFuncTable[158] := FuncParent;
+  FIdentFuncTable[537] := FuncParseinc;
+  FIdentFuncTable[605] := FuncPdriver;
+  FIdentFuncTable[93] := FuncPrevinstance;
+  FIdentFuncTable[760] := FuncPrevrepeatinstance;
+  FIdentFuncTable[425] := FuncPrinter;
+  FIdentFuncTable[654] := FuncPrintfile;
+  FIdentFuncTable[414] := FuncPropertygroup;
+  FIdentFuncTable[497] := FuncRastr;
+  FIdentFuncTable[395] := FuncRaval;
+  FIdentFuncTable[80] := FuncReadinstance;
+  FIdentFuncTable[581] := FuncReadrepeatinstance;
+  FIdentFuncTable[721] := FuncRepeat;
+  FIdentFuncTable[160] := FuncRepeatcount;
+  FIdentFuncTable[249] := FuncReportlevel;
+  FIdentFuncTable[221] := FuncRightstr;
+  FIdentFuncTable[204] := FuncRlenstr;
+  FIdentFuncTable[768] := FuncRoot;
+  FIdentFuncTable[666] := FuncRound;
+  FIdentFuncTable[152] := FuncShowmessage;
+  FIdentFuncTable[579] := FuncSkipemtpty;
+  FIdentFuncTable[307] := FuncSortdown;
+  FIdentFuncTable[508] := FuncSortkey;
+  FIdentFuncTable[299] := FuncSortup;
+  FIdentFuncTable[415] := FuncSql_add;
+  FIdentFuncTable[247] := FuncSql_asfloat;
+  FIdentFuncTable[718] := FuncSql_asstring;
+  FIdentFuncTable[311] := FuncSql_create;
+  FIdentFuncTable[635] := FuncSql_dump;
+  FIdentFuncTable[756] := FuncSql_eof;
+  FIdentFuncTable[723] := FuncSql_execute;
+  FIdentFuncTable[269] := FuncSql_free;
+  FIdentFuncTable[530] := FuncSql_mladd;
+  FIdentFuncTable[551] := FuncSql_mlmultiadd;
+  FIdentFuncTable[724] := FuncSql_next;
+  FIdentFuncTable[482] := FuncSql_setvar;
+  FIdentFuncTable[449] := FuncSqr;
+  FIdentFuncTable[348] := FuncStripstr;
+  FIdentFuncTable[615] := FuncStroptions;
+  FIdentFuncTable[566] := FuncStrpos;
+  FIdentFuncTable[740] := FuncSubtract;
+  FIdentFuncTable[51] := FuncSum;
+  FIdentFuncTable[764] := FuncSupplier;
+  FIdentFuncTable[696] := FuncSuppliesofmembers;
+  FIdentFuncTable[470] := FuncThen;
+  FIdentFuncTable[162] := FuncTrunc;
+  FIdentFuncTable[344] := FuncUpcasestr;
+  FIdentFuncTable[77] := FuncUsedby;
+  FIdentFuncTable[224] := FuncV_date;
+  FIdentFuncTable[267] := FuncV_false;
+  FIdentFuncTable[55] := FuncV_nonereal;
+  FIdentFuncTable[421] := FuncV_par_language;
+  FIdentFuncTable[404] := FuncV_par_language_count;
+  FIdentFuncTable[751] := FuncV_par_language_fields;
+  FIdentFuncTable[366] := FuncV_time;
+  FIdentFuncTable[218] := FuncV_true;
+  FIdentFuncTable[159] := FuncVariables;
+  FIdentFuncTable[149] := FuncVaroptions;
+  FIdentFuncTable[84] := FuncWhile;
+  FIdentFuncTable[745] := FuncZerorlenstr;
+end;
+
+function TSynCPMSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAllentities(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAllproducts(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAllproperties(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAllqualityproperties(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAllsuppliers(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncAssign(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncBegin(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncBlock(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCategory(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCenterstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCharreplacestr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCharrlenstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCharrllenstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncChr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncClient(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncConstants(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncContinue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCopyfile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncCountry(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncDecr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncDefinition(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncDistinct_execute(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncDivide(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncEmptysheet(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncEnd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncEntitycode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncEqualstring(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncEqualvalue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncExecute(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFileappend(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFileassign(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFileclose(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilecopy(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFiledate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFiledelete(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFileend(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFileexists(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilereadln(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilereset(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilerewrite(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilesize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilesort(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFiletime(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilewriteln(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFilterstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFirstinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFlow(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncFold(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncForeign(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGlobalconstants(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGlobals(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGlobalvariables(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGroupdown(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGroupfooter(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGroupheader(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGroupkey(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncGroupup(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncInclude(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncIncr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLanguage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLastinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLeftstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLength(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLlenstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLocal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLocasestr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLoop(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLowerlevelstoo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncLtrunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMatching(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMember(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMerge(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMessagedlg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMetaflow(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMidstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncMultiply(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncNextinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncNextrepeatinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncOf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncOptions(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncOrganisation(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncOutput(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncParam(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncParent(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncParseinc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPdriver(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPrevinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPrevrepeatinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPrinter(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPrintfile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncPropertygroup(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRastr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRaval(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncReadinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncReadrepeatinstance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRepeat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRepeatcount(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncReportlevel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRightstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRlenstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRoot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncRound(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncShowmessage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSkipemtpty(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSortdown(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSortkey(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSortup(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_add(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_asfloat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_asstring(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_create(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_dump(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_eof(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_execute(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_free(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_mladd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_mlmultiadd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_next(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSql_setvar(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSQLKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSqr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncStripstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncStroptions(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncStrpos(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSubtract(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSum(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSupplier(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncSuppliesofmembers(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncThen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncTrunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncUpcasestr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncUsedby(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_date(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_false(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_nonereal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_par_language(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_par_language_count(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_par_language_fields(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_time(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncV_true(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSpecialVar
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncVariables(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncVaroptions(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncWhile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCPMSyn.FuncZerorlenstr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkSystem
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynCPMSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Foreground := clNavy;
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Foreground := clGreen;
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  
+  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FSQLKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrSQLKey, SYNS_FriendlyAttrSQLKey);
+  FSQLKeyAttri.ForeGround := clTeal;
+  FSQLKeyAttri.Style := [fsBold];
+  AddAttribute(FSQLKeyAttri);
+
+  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  FSpecialVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
+  FSpecialVarAttri.Style := [fsBold];
+  AddAttribute(FSpecialVarAttri);
+
+  FSystemAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystem, SYNS_FriendlyAttrSystem);
+  FSystemAttri.Foreground := $000080FF;
+  FSystemAttri.Style := [fsBold];
+  AddAttribute(FSystemAttri);
+
+  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  FVariableAttri.Foreground := clMaroon;
+  AddAttribute(FVariableAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FRange := rsUnknown;
+  FCommentLevel := 0;
+  FDefaultFilter := SYNS_FilterCPM;
+end; { Create }
+
+procedure TSynCPMSyn.BraceOpenProc;
+begin
+  FRange := rsBraceComment;
+  BraceCommentProc;
+  FTokenID := tkComment;
+end; { BraceOpenProc }
+
+procedure TSynCPMSyn.IdentProc;
+begin
+  FTokenID := IdentKind(FLine + Run);
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end; { IdentProc }
+
+procedure TSynCPMSyn.VariableProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  if (FTokenID = tkIdentifier) then
+  begin
+    if (FLine[Run + 1] = '_') then
+      FTokenID := tkVariable
+  end;
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end; { VariableProc }
+
+procedure TSynCPMSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end; { NullProc }
+
+procedure TSynCPMSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end; { SpaceProc }
+
+procedure TSynCPMSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = '"');
+  if (FLine[Run] = '"') then
+  begin
+    Inc(Run);
+    if (FLine[Run] = '"') then
+      Inc(Run);
+  end;
+end; { StringProc }
+
+procedure TSynCPMSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end; { UnknownProc }
+
+procedure TSynCPMSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsBraceComment: BraceCommentProc;
+  else
+    case FLine[Run] of
+      #0: NullProc;
+      #10: LFProc;
+      #13: CRProc;
+      #1..#9, #11, #12, #14..#32: SpaceProc;
+      '"': StringProc;
+      '0'..'9': NumberProc;
+      'A'..'Z', 'a'..'z', '_':
+        case FLine[Run] of
+          'V', 'v', 'S', 's': VariableProc;
+          else
+            IdentProc;
+        end;
+      '{': BraceOpenProc;
+      '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~':
+      begin
+        case FLine[Run] of
+          ';': SemiColonProc;
+          else
+            SymbolProc;
+        end;
+      end;
+    else
+      UnknownProc;
+    end;
+  end;
+  inherited;
+end; { Next }
+
+function TSynCPMSyn.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; { GetDefaultAttribute }
+
+function TSynCPMSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end; { GetEol }
+
+function TSynCPMSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end; { GetTokenID }
+
+function TSynCPMSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkSQLKey: Result := FSQLKeyAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkSpecialVar: Result := FSpecialVarAttri;
+    tkSystem: Result := FSystemAttri;
+    tkVariable: Result := FVariableAttri;
+    tkUnknown: Result := FIdentifierAttri;
+  else
+    Result := nil;
+  end;
+end; { GetTokenAttribute }
+
+function TSynCPMSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end; { GetTokenKind }
+
+class function TSynCPMSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCPM;
+end;
+
+procedure TSynCPMSyn.BraceCommentProc;
+begin
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+  else
+    begin
+      FTokenID := tkComment;
+      repeat
+        if FLine[Run] = '{' then
+          Inc(FCommentLevel)
+        else if FLine[Run] = '}' then
+        begin
+          Dec(FCommentLevel);
+          if (FCommentLevel < 1) then
+          begin
+            Inc(Run);
+            FRange := rsUnknown;
+            FCommentLevel := 0;
+            Break;
+          end;
+        end;
+        Inc(Run);
+      until IsLineEnd(Run);
+    end;
+  end;
+end; { BraceCommentProc }
+
+procedure TSynCPMSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end; { CRProc }
+
+procedure TSynCPMSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end; { LFProc }
+
+function TSynCPMSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '{ COAS Product Manager report (RDF) }'#13#10 +
+            'PARAM'#13#10 +
+            '  LANGUAGE;'#13#10 +
+            '  CONTINUE;'#13#10 +
+            'END; { Param }'#13#10 +
+            #13#10 +
+            'GLOBALS'#13#10 +
+            '  LANGUAGE = LOCAL;'#13#10 +
+            'END; { Globals }'#13#10 +
+            #13#10 +
+            'DEFINITION BLOCK "MAIN"'#13#10 +
+            'VARIABLES'#13#10 +
+            '  S_Query = "";'#13#10 +
+            '  V_OraErr = -1;'#13#10 +
+            '  V_Count;'#13#10 +
+            'BEGIN'#13#10 +
+            '  ASSIGN(S_Query, "SELECT * FROM DUAL");'#13#10 +
+            '  SQL_CREATE(V_OraErr, S_Query);'#13#10 +
+            '  ASSIGN(V_Count, V_NoneReal);'#13#10 +
+            'END;';
+end; { GetSampleSource }
+
+function TSynCPMSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCPM;
+end; { IsFilterStored }
+
+procedure TSynCPMSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end; { SemiColonProc }
+
+procedure TSynCPMSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'e', 'E':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.': if FLine[Run + 1] = '.' then
+             Break;
+    end;
+    Inc(Run);
+  end;
+end; { NumberProc }
+
+procedure TSynCPMSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end; { SymbolProc }
+
+procedure TSynCPMSyn.ResetRange;
+begin
+  inherited;
+  FRange := rsUnknown;
+  FCommentLevel := 0;
+end; { ResetRange }
+
+procedure TSynCPMSyn.SetRange(Value: Pointer);
+var
+  AValue: LongInt;
+begin
+  inherited;
+  AValue := Longint(Value);
+  FCommentLevel := AValue div $10000;
+  FRange := TRangeState(AValue mod $10000);
+end; { SetRange }
+
+function TSynCPMSyn.GetRange: Pointer;
+begin
+  Result := Pointer((FCommentLevel * $10000) + Integer(FRange));
+end; { GetRange }
+
+class function TSynCPMSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCPM;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCPMSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCS.pas b/Source/VCL/SynEdit/Source/SynHighlighterCS.pas
index f3f6138f..1a9a7adb 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCS.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCS.pas
@@ -1,2006 +1,2013 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCS.pas, released 2001-10-28.
-The Original Code is based on SynHighlighterCpp.pas, released 2000-04-10,
-which in turn is based on the dcjCppSyn.pas file from the mwEdit component
-suite by Martin Waldenburg and other developers, the Initial Author of this file
-is Michael Trier.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCS.pas,v 1.8.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of SynEdit from the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-You may retrieve the latest version of this file from
-http://www.ashleybrown.co.uk/synedit/
-
-Known Issues:
-  - strings on multiple lines are not supported 
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a C# syntax highlighter for SynEdit)
-@author(Ashley Brown)
-@created(2001)
-@lastmod(2001-10-20)
-The SynHighlighterCS unit provides SynEdit with a C# syntax highlighter.
-Based on SynHighlighterCpp.pas
-}
-
-unit SynHighlighterCS;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynEditMiscClasses,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown);
-
-  TxtkTokenKind = (
-    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
-    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
-    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
-    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
-    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
-    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
-    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
-    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
-    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
-    xtkXorAssign);
-
-  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
-    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39,
-    rsMultiLineString);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynCSSyn = class(TSynCustomHighlighter)
-  private
-    fAsmStart: Boolean;
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FExtTokenID: TxtkTokenKind;
-    fIdentFuncTable: array[0..210] of TIdentFuncTableFunc;
-    fAsmAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirecAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fInvalidAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncAbstract(Index: Integer): TtkTokenKind;
-    function FuncAs(Index: Integer): TtkTokenKind;
-    function FuncBase(Index: Integer): TtkTokenKind;
-    function FuncBool(Index: Integer): TtkTokenKind;
-    function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncByte(Index: Integer): TtkTokenKind;
-    function FuncCase(Index: Integer): TtkTokenKind;
-    function FuncCatch(Index: Integer): TtkTokenKind;
-    function FuncChar(Index: Integer): TtkTokenKind;
-    function FuncChecked(Index: Integer): TtkTokenKind;
-    function FuncClass(Index: Integer): TtkTokenKind;
-    function FuncConst(Index: Integer): TtkTokenKind;
-    function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncDecimal(Index: Integer): TtkTokenKind;
-    function FuncDefault(Index: Integer): TtkTokenKind;
-    function FuncDelegate(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncDouble(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncEnum(Index: Integer): TtkTokenKind;
-    function FuncEvent(Index: Integer): TtkTokenKind;
-    function FuncExplicit(Index: Integer): TtkTokenKind;
-    function FuncExtern(Index: Integer): TtkTokenKind;
-    function FuncFalse(Index: Integer): TtkTokenKind;
-    function FuncFinally(Index: Integer): TtkTokenKind;
-    function FuncFixed(Index: Integer): TtkTokenKind;
-    function FuncFloat(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncForeach(Index: Integer): TtkTokenKind;
-    function FuncGoto(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncImplicit(Index: Integer): TtkTokenKind;
-    function FuncIn(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
-    function FuncInterface(Index: Integer): TtkTokenKind;
-    function FuncInternal(Index: Integer): TtkTokenKind;
-    function FuncIs(Index: Integer): TtkTokenKind;
-    function FuncLock(Index: Integer): TtkTokenKind;
-    function FuncLong(Index: Integer): TtkTokenKind;
-    function FuncNamespace(Index: Integer): TtkTokenKind;
-    function FuncNew(Index: Integer): TtkTokenKind;
-    function FuncNull(Index: Integer): TtkTokenKind;
-    function FuncObject(Index: Integer): TtkTokenKind;
-    function FuncOperator(Index: Integer): TtkTokenKind;
-    function FuncOut(Index: Integer): TtkTokenKind;
-    function FuncOverride(Index: Integer): TtkTokenKind;
-    function FuncParams(Index: Integer): TtkTokenKind;
-    function FuncPrivate(Index: Integer): TtkTokenKind;
-    function FuncProtected(Index: Integer): TtkTokenKind;
-    function FuncPublic(Index: Integer): TtkTokenKind;
-    function FuncReadonly(Index: Integer): TtkTokenKind;
-    function FuncRef(Index: Integer): TtkTokenKind;
-    function FuncReturn(Index: Integer): TtkTokenKind;
-    function FuncSbyte(Index: Integer): TtkTokenKind;
-    function FuncSealed(Index: Integer): TtkTokenKind;
-    function FuncSizeof(Index: Integer): TtkTokenKind;
-    function FuncStackalloc(Index: Integer): TtkTokenKind;
-    function FuncStatic(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
-    function FuncStruct(Index: Integer): TtkTokenKind;
-    function FuncSwitch(Index: Integer): TtkTokenKind;
-    function FuncThis(Index: Integer): TtkTokenKind;
-    function FuncThrow(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncTry(Index: Integer): TtkTokenKind;
-    function FuncTypeof(Index: Integer): TtkTokenKind;
-    function FuncUint(Index: Integer): TtkTokenKind;
-    function FuncUlong(Index: Integer): TtkTokenKind;
-    function FuncUnchecked(Index: Integer): TtkTokenKind;
-    function FuncUnsafe(Index: Integer): TtkTokenKind;
-    function FuncUshort(Index: Integer): TtkTokenKind;
-    function FuncUsing(Index: Integer): TtkTokenKind;
-    function FuncVirtual(Index: Integer): TtkTokenKind;
-    function FuncVoid(Index: Integer): TtkTokenKind;
-    function FuncWhile(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AnsiCProc;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure DirectiveProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-    procedure StringEndProc;
-  protected
-    function GetExtTokenID: TxtkTokenKind;
-    function IsFilterStored: Boolean; override;
-    function GetSampleSource: string; override;
-    procedure NextProcedure;
-  public
-    class function GetCapabilities: TSynHighlighterCapabilities; override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    function UseUserSettings(settingIndex: integer): boolean; override;
-    procedure EnumUserSettings(settings: TStrings); override;
-    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
-  published
-    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
-      write fDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri
-      write fInvalidAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  Windows,
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..74] of string = (
-    'abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'char', 
-    'checked', 'class', 'const', 'continue', 'decimal', 'default', 'delegate', 
-    'do', 'double', 'else', 'enum', 'event', 'explicit', 'extern', 'false', 
-    'finally', 'fixed', 'float', 'for', 'foreach', 'goto', 'if', 'implicit', 
-    'in', 'int', 'interface', 'internal', 'is', 'lock', 'long', 'namespace', 
-    'new', 'null', 'object', 'operator', 'out', 'override', 'params', 'private', 
-    'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed', 
-    'sizeof', 'stackalloc', 'static', 'string', 'struct', 'switch', 'this', 
-    'throw', 'true', 'try', 'typeof', 'uint', 'ulong', 'unchecked', 'unsafe', 
-    'ushort', 'using', 'virtual', 'void', 'while' 
-  );
-
-  KeyIndices: array[0..210] of Integer = (
-    71, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, 1, 46, -1, -1, 62, 
-    -1, 53, -1, -1, -1, -1, 3, -1, -1, 18, -1, 8, -1, -1, -1, -1, -1, 19, -1, 
-    -1, -1, -1, -1, 45, -1, -1, 28, 44, -1, 47, 21, -1, -1, -1, -1, -1, 73, -1, 
-    -1, 9, -1, -1, -1, 26, 49, 63, 65, -1, -1, 16, 67, -1, 59, -1, -1, -1, 66, 
-    -1, 50, -1, -1, -1, 29, -1, 32, 37, -1, -1, 48, -1, -1, 55, -1, 14, 40, -1, 
-    -1, 13, -1, 12, -1, -1, 15, 30, -1, -1, -1, 41, -1, -1, -1, -1, 4, 56, -1, 
-    58, -1, 38, -1, -1, -1, -1, 74, -1, -1, -1, 17, 33, -1, -1, 20, -1, -1, 27, 
-    31, -1, 6, -1, -1, -1, -1, 7, -1, -1, 10, -1, -1, 2, -1, -1, -1, 64, -1, -1, 
-    43, -1, -1, -1, 0, -1, 34, -1, 25, -1, -1, 5, 61, 60, -1, 42, -1, -1, -1, 
-    51, -1, -1, -1, -1, 22, -1, -1, 72, -1, -1, 57, -1, 70, -1, 11, -1, -1, -1, 
-    24, -1, 35, -1, -1, 23, -1, 39, -1, -1, 68, 52, 36, -1, -1, -1, -1, 54, -1, 
-    -1 
-  );
-
-{$Q-}
-function TSynCSSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 723 + Ord(Str^) * 24;
-    inc(Str);
-  end;
-  Result := Result mod 211;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCSSyn.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 TSynCSSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[157] := FuncAbstract;
-  fIdentFuncTable[14] := FuncAs;
-  fIdentFuncTable[146] := FuncBase;
-  fIdentFuncTable[25] := FuncBool;
-  fIdentFuncTable[111] := FuncBreak;
-  fIdentFuncTable[164] := FuncByte;
-  fIdentFuncTable[135] := FuncCase;
-  fIdentFuncTable[140] := FuncCatch;
-  fIdentFuncTable[30] := FuncChar;
-  fIdentFuncTable[58] := FuncChecked;
-  fIdentFuncTable[143] := FuncClass;
-  fIdentFuncTable[187] := FuncConst;
-  fIdentFuncTable[98] := FuncContinue;
-  fIdentFuncTable[96] := FuncDecimal;
-  fIdentFuncTable[92] := FuncDefault;
-  fIdentFuncTable[101] := FuncDelegate;
-  fIdentFuncTable[68] := FuncDo;
-  fIdentFuncTable[125] := FuncDouble;
-  fIdentFuncTable[28] := FuncElse;
-  fIdentFuncTable[36] := FuncEnum;
-  fIdentFuncTable[129] := FuncEvent;
-  fIdentFuncTable[49] := FuncExplicit;
-  fIdentFuncTable[177] := FuncExtern;
-  fIdentFuncTable[196] := FuncFalse;
-  fIdentFuncTable[191] := FuncFinally;
-  fIdentFuncTable[161] := FuncFixed;
-  fIdentFuncTable[62] := FuncFloat;
-  fIdentFuncTable[132] := FuncFor;
-  fIdentFuncTable[45] := FuncForeach;
-  fIdentFuncTable[81] := FuncGoto;
-  fIdentFuncTable[102] := FuncIf;
-  fIdentFuncTable[133] := FuncImplicit;
-  fIdentFuncTable[83] := FuncIn;
-  fIdentFuncTable[126] := FuncInt;
-  fIdentFuncTable[159] := FuncInterface;
-  fIdentFuncTable[193] := FuncInternal;
-  fIdentFuncTable[203] := FuncIs;
-  fIdentFuncTable[84] := FuncLock;
-  fIdentFuncTable[116] := FuncLong;
-  fIdentFuncTable[198] := FuncNamespace;
-  fIdentFuncTable[93] := FuncNew;
-  fIdentFuncTable[106] := FuncNull;
-  fIdentFuncTable[168] := FuncObject;
-  fIdentFuncTable[153] := FuncOperator;
-  fIdentFuncTable[46] := FuncOut;
-  fIdentFuncTable[42] := FuncOverride;
-  fIdentFuncTable[15] := FuncParams;
-  fIdentFuncTable[48] := FuncPrivate;
-  fIdentFuncTable[87] := FuncProtected;
-  fIdentFuncTable[63] := FuncPublic;
-  fIdentFuncTable[77] := FuncReadonly;
-  fIdentFuncTable[172] := FuncRef;
-  fIdentFuncTable[202] := FuncReturn;
-  fIdentFuncTable[20] := FuncSbyte;
-  fIdentFuncTable[208] := FuncSealed;
-  fIdentFuncTable[90] := FuncSizeof;
-  fIdentFuncTable[112] := FuncStackalloc;
-  fIdentFuncTable[183] := FuncStatic;
-  fIdentFuncTable[114] := FuncString;
-  fIdentFuncTable[71] := FuncStruct;
-  fIdentFuncTable[166] := FuncSwitch;
-  fIdentFuncTable[165] := FuncThis;
-  fIdentFuncTable[18] := FuncThrow;
-  fIdentFuncTable[64] := FuncTrue;
-  fIdentFuncTable[150] := FuncTry;
-  fIdentFuncTable[65] := FuncTypeof;
-  fIdentFuncTable[75] := FuncUint;
-  fIdentFuncTable[69] := FuncUlong;
-  fIdentFuncTable[201] := FuncUnchecked;
-  fIdentFuncTable[9] := FuncUnsafe;
-  fIdentFuncTable[185] := FuncUshort;
-  fIdentFuncTable[0] := FuncUsing;
-  fIdentFuncTable[180] := FuncVirtual;
-  fIdentFuncTable[55] := FuncVoid;
-  fIdentFuncTable[121] := FuncWhile;
-end;
-
-
-
-function TSynCSSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncAbstract(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncAs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncBase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncBool(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncBreak(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncByte(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncCase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncCatch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncChar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncChecked(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncClass(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncConst(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncContinue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncDecimal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncDefault(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncDelegate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncDo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncDouble(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncEnum(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncEvent(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncExplicit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncExtern(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncFalse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncFinally(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncFixed(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncFloat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncFor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncForeach(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncGoto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncImplicit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncIn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncInt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncInterface(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncInternal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncIs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncLock(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncLong(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncNamespace(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncNew(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncNull(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncObject(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncOperator(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncOut(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncOverride(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncParams(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncPrivate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncProtected(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncPublic(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncReadonly(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncRef(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncReturn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncSbyte(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncSealed(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncSizeof(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncStackalloc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncStatic(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncStruct(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncSwitch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncThis(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncThrow(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncTrue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncTry(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncTypeof(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUlong(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUnchecked(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUnsafe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUshort(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUsing(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncVirtual(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncVoid(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncWhile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynCSSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
-  AddAttribute(fAsmAttri);
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style:= [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(fInvalidAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(fDirecAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fRange := rsUnknown;
-  fAsmStart := False;
-  fDefaultFilter := SYNS_FilterCS;
-end; { Create }
-
-procedure TSynCSSyn.AnsiCProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        if fLine[Run + 1] = '/' then
-        begin
-          inc(Run, 2);
-          if fRange = rsAnsiCAsm then
-            fRange := rsAsm
-          else if fRange = rsAnsiCAsmBlock then
-            fRange := rsAsmBlock
-          else if fRange = rsDirectiveComment then
-            fRange := rsDirective
-          else
-            fRange := rsUnKnown;
-          break;
-        end else
-          inc(Run);
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-procedure TSynCSSyn.AndSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAndAssign;
-      end;
-    '&':                               {logical and}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogAnd;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAnd;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      if CharInSet(fLine[Run + 1], [#39, '\']) then
-        inc(Run);
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #39);
-  if fLine[Run] = #39 then
-    inc(Run);
-end;
-
-procedure TSynCSSyn.AtSymbolProc;
-begin
-  fTokenID := tkUnknown;
-  inc(Run);
-end;
-
-procedure TSynCSSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceClose;
-  if fRange = rsAsmBlock then fRange := rsUnknown;
-end;
-
-procedure TSynCSSyn.BraceOpenProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceOpen;
-  if fRange = rsAsm then
-  begin
-    fRange := rsAsmBlock;
-    fAsmStart := True;
-  end;
-end;
-
-procedure TSynCSSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run + 1] = #10 then Inc(Run);
-end;
-
-procedure TSynCSSyn.ColonProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkScopeResolution;
-      end;
-  else                                 {colon}
-    begin
-      inc(Run);
-      FExtTokenID := xtkColon;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkComma;
-end;
-
-procedure TSynCSSyn.DirectiveProc;
-begin
-  if IsLineEnd(Run) then
-  begin
-    if (Run <= 0) or (fLine[Run - 1] <> '\') then
-      fRange := rsUnknown;
-    NextProcedure;
-  end
-  else
-  begin
-    fTokenID := tkDirective;
-    while True do
-      case fLine[Run] of
-        '/': // comment?
-          begin
-            if fLine[Run + 1] = '/' then
-            begin // is end of directive as well
-              fRange := rsUnknown;
-              break;
-            end else if fLine[Run + 1] = '*' then
-            begin // might be embedded only
-              fRange := rsDirectiveComment;
-              break;
-            end else
-              Inc(Run);
-          end;
-        '\': // directive continued on next line?
-          begin
-            Inc(Run);
-            if IsLineEnd(Run) then
-            begin
-              fRange := rsDirective;
-              break;
-            end;
-          end;
-        #0, #10, #13:
-          begin
-            fRange := rsUnknown;
-            break;
-          end;
-        else
-          Inc(Run);
-      end;
-  end;
-end;
-
-procedure TSynCSSyn.EqualProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogEqual;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAssign;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.GreaterProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkGreaterThanEqual;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftRightAssign;
-        end
-        else                           {shift right}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftRight;
-        end;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkGreaterThan;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.QuestionProc;
-begin
-  fTokenID := tkSymbol;                {conditional}
-  FExtTokenID := xtkQuestion;
-  inc(Run);
-end;
-
-procedure TSynCSSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynCSSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynCSSyn.LowerProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLessThanEqual;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftLeftAssign;
-        end
-        else                           {shift left}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftLeft;
-        end;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLessThan;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.MinusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkSubtractAssign;
-      end;
-    '-':                               {decrement}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkDecrement;
-      end;
-    '>':                               {arrow}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkArrow;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      FExtTokenID := xtkSubtract;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.ModSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkModAssign;
-      end;
-  else                                 {mod}
-    begin
-      inc(Run);
-      FExtTokenID := xtkMod;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.NotSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkNotEqual;
-      end;
-  else                                 {not}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLogComplement;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCSSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynCSSyn.OrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {or assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncOrAssign;
-      end;
-    '|':                               {logical or}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogOr;
-      end;
-  else                                 {or}
-    begin
-      inc(Run);
-      FExtTokenID := xtkIncOr;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.PlusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAddAssign;
-      end;
-    '+':                               {increment}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncrement;
-      end;
-  else                                 {add}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAdd;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.PointProc;
-begin
-  fTokenID := tkSymbol;
-  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
-    begin                              {ellipse}
-      inc(Run, 3);
-      FExtTokenID := xtkEllipse;
-    end
-  else                                 {point}
-    begin
-      inc(Run);
-      FExtTokenID := xtkPoint;
-    end;
-end;
-
-procedure TSynCSSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkRoundClose;
-end;
-
-procedure TSynCSSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundOpen;
-end;
-
-procedure TSynCSSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSemiColon;
-  if fRange = rsAsm then fRange := rsUnknown;
-end;
-
-procedure TSynCSSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':                               {c++ style comments}
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-        while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '*':                               {c style comments}
-      begin
-        fTokenID := tkComment;
-        if fRange = rsAsm then
-          fRange := rsAnsiCAsm
-        else if fRange = rsAsmBlock then
-          fRange := rsAnsiCAsmBlock
-        else if fRange <> rsDirectiveComment then                          
-          fRange := rsAnsiC;
-        inc(Run, 2);
-        while fLine[Run] <> #0 do
-          case fLine[Run] of
-            '*':
-              if fLine[Run + 1] = '/' then
-              begin
-                inc(Run, 2);
-                if fRange = rsDirectiveComment then
-                  fRange := rsDirective
-                else if fRange = rsAnsiCAsm then
-                  fRange := rsAsm
-                else
-                  begin
-                  if fRange = rsAnsiCAsmBlock then
-                    fRange := rsAsmBlock
-                  else
-                    fRange := rsUnKnown;
-                  end;
-                break;
-              end else inc(Run);
-            #10, #13:
-              begin
-                if fRange = rsDirectiveComment then
-                  fRange := rsAnsiC;
-                break;
-              end;
-          else inc(Run);
-          end;
-      end;
-    '=':                               {divide assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-        FExtTokenID := xtkDivideAssign;
-      end;
-  else                                 {divide}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-      FExtTokenID := xtkDivide;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynCSSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareClose;
-end;
-
-procedure TSynCSSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareOpen;
-end;
-
-procedure TSynCSSyn.StarProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkMultiplyAssign;
-      end;
-  else                                 {star}
-    begin
-      inc(Run);
-      FExtTokenID := xtkStar;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.StringProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      case fLine[Run + 1] of
-        #34, '\':
-          Inc(Run);
-        #00:
-          begin
-            Inc(Run);
-            fRange := rsMultilineString;
-            Exit;
-          end;
-      end;
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #34);
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynCSSyn.StringEndProc;
-begin
-  fTokenID := tkString;
-
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-
-  fRange := rsUnknown;
-
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-      '\':
-        begin
-          case fLine[Run + 1] of
-            #34, '\':
-              Inc(Run);
-            #00:
-              begin
-                Inc(Run);
-                fRange := rsMultilineString;
-                Exit;
-              end;
-          end;
-        end;
-      #34: Break;
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #34);
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynCSSyn.TildeProc;
-begin
-  inc(Run);                            {bitwise complement}
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBitComplement;
-end;
-
-procedure TSynCSSyn.XOrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-  	'=':                               {xor assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkXorAssign;
-      end;
-  else                                 {xor}
-    begin
-      inc(Run);
-      FExtTokenID := xtkXor;
-    end;
-  end;
-end;
-
-procedure TSynCSSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynCSSyn.Next;
-begin
-  fAsmStart := False;
-  fTokenPos := Run;
-  case fRange of
-    rsAnsiC, rsAnsiCAsm,
-    rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
-    rsDirective: DirectiveProc;
-    rsMultilineString: StringEndProc;
-  else
-    begin
-      fRange := rsUnknown;
-      NextProcedure;
-    end;
-  end;
-  inherited;
-end;
-
-procedure TSynCSSyn.NextProcedure;
-begin
-  case fLine[Run] of
-    '&': AndSymbolProc;
-    #39: AsciiCharProc;
-    '@': AtSymbolProc;
-    '}': BraceCloseProc;
-    '{': BraceOpenProc;
-    #13: CRProc;
-    ':': ColonProc;
-    ',': CommaProc;
-    '#': DirectiveProc;
-    '=': EqualProc;
-    '>': GreaterProc;
-    '?': QuestionProc;
-    'A'..'Z', 'a'..'z', '_': IdentProc;
-    #10: LFProc;
-    '<': LowerProc;
-    '-': MinusProc;
-    '%': ModSymbolProc;
-    '!': NotSymbolProc;
-    #0: NullProc;
-    '0'..'9': NumberProc;
-    '|': OrSymbolProc;
-    '+': PlusProc;
-    '.': PointProc;
-    ')': RoundCloseProc;
-    '(': RoundOpenProc;
-    ';': SemiColonProc;
-    '/': SlashProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    ']': SquareCloseProc;
-    '[': SquareOpenProc;
-    '*': StarProc;
-    #34: StringProc;
-    '~': TildeProc;
-    '^': XOrSymbolProc;
-    else UnknownProc;
-  end;
-end;
-
-function TSynCSSyn.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 TSynCSSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCSSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynCSSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-  if ((fRange = rsAsm) or (fRange = rsAsmBlock)) and not fAsmStart
-    and not (fTokenId in [tkComment, tkSpace, tkNull])
-  then
-    Result := tkAsm;
-end;
-
-function TSynCSSyn.GetExtTokenID: TxtkTokenKind;
-begin
-  Result := FExtTokenID;
-end;
-
-function TSynCSSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkAsm: Result := fAsmAttri;
-    tkComment: Result := fCommentAttri;
-    tkDirective: Result := fDirecAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fInvalidAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynCSSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-procedure TSynCSSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-procedure TSynCSSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynCSSyn.EnumUserSettings(settings: TStrings);
-begin
-  { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
-  begin
-    try
-      RootKey := HKEY_LOCAL_MACHINE;
-      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
-      begin
-        try
-          GetKeyNames(settings);
-        finally
-          CloseKey;
-        end;
-      end;
-    finally
-      Free;
-    end;
-  end;
-end;
-
-function TSynCSSyn.UseUserSettings(settingIndex: integer): boolean;
-// Possible parameter values:
-//   index into TStrings returned by EnumUserSettings
-// Possible return values:
-//   true : settings were read and used
-//   false: problem reading settings or invalid version specified - old settings
-//          were preserved
-
-  function ReadCPPBSettings(settingIndex: integer): boolean;
-
-    function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean;
-
-      function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): boolean;
-      var
-        i: integer;
-      begin
-        for i := 1 to Length(name) do
-          if name[i] = ' ' then name[i] := '_';
-        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-             '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name,true);
-      end; { ReadCPPB1 }
-
-      function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean;
-      begin
-        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-                 '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight',
-                 key,false);
-      end; { ReadCPPB3OrMore }
-
-    begin { ReadCPPBSetting }
-      try
-        if (settingTag[1] = '1')
-          then Result := ReadCPPB1(settingTag,attri,key)
-          else Result := ReadCPPB3OrMore(settingTag,attri,key);
-      except Result := false; end;
-    end; { ReadCPPBSetting }
-
-  var
-    tmpStringAttri    : TSynHighlighterAttributes;
-    tmpNumberAttri    : TSynHighlighterAttributes;
-    tmpKeyAttri       : TSynHighlighterAttributes;
-    tmpSymbolAttri    : TSynHighlighterAttributes;
-    tmpAsmAttri       : TSynHighlighterAttributes;
-    tmpCommentAttri   : TSynHighlighterAttributes;
-    tmpIdentifierAttri: TSynHighlighterAttributes;
-    tmpInvalidAttri   : TSynHighlighterAttributes;
-    tmpSpaceAttri     : TSynHighlighterAttributes;
-    tmpDirecAttri     : TSynHighlighterAttributes;
-    s                 : TStringList;
-
-  begin { ReadCPPBSettings }
-    s := TStringList.Create;
-    try
-      EnumUserSettings(s);
-      if settingIndex >= s.Count then Result := false
-      else begin
-        tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
-        tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpAsmAttri       := TSynHighlighterAttributes.Create('', '');
-        tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
-        tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
-        tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
-        tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpStringAttri    .Assign(fStringAttri);
-        tmpNumberAttri    .Assign(fNumberAttri);
-        tmpKeyAttri       .Assign(fKeyAttri);
-        tmpSymbolAttri    .Assign(fSymbolAttri);
-        tmpAsmAttri       .Assign(fAsmAttri);
-        tmpCommentAttri   .Assign(fCommentAttri);
-        tmpIdentifierAttri.Assign(fIdentifierAttri);
-        tmpInvalidAttri   .Assign(fInvalidAttri);
-        tmpSpaceAttri     .Assign(fSpaceAttri);
-        tmpDirecAttri     .Assign(fDirecAttri);
-        if s[settingIndex][1] = '1'
-          then Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Plain text')
-          else Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Assembler');
-        Result := Result                                                         and
-                  ReadCPPBSetting(s[settingIndex],fCommentAttri,'Comment')       and
-                  ReadCPPBSetting(s[settingIndex],fIdentifierAttri,'Identifier') and
-                  ReadCPPBSetting(s[settingIndex],fInvalidAttri,'Illegal Char')  and 
-                  ReadCPPBSetting(s[settingIndex],fKeyAttri,'Reserved word')     and
-                  ReadCPPBSetting(s[settingIndex],fNumberAttri,'Integer')        and
-                  ReadCPPBSetting(s[settingIndex],fSpaceAttri,'Whitespace')      and
-                  ReadCPPBSetting(s[settingIndex],fStringAttri,'String')         and
-                  ReadCPPBSetting(s[settingIndex],fSymbolAttri,'Symbol')         and
-                  ReadCPPBSetting(s[settingIndex],fDirecAttri,'Preprocessor');
-        if not Result then begin
-          fStringAttri    .Assign(tmpStringAttri);
-          fNumberAttri    .Assign(tmpNumberAttri);
-          fKeyAttri       .Assign(tmpKeyAttri);
-          fSymbolAttri    .Assign(tmpSymbolAttri);
-          fAsmAttri       .Assign(tmpAsmAttri);
-          fCommentAttri   .Assign(tmpCommentAttri);
-          fIdentifierAttri.Assign(tmpIdentifierAttri);
-          fInvalidAttri.Assign(tmpInvalidAttri);
-          fSpaceAttri     .Assign(tmpSpaceAttri);
-          fDirecAttri     .Assign(tmpDirecAttri);
-        end;
-        tmpStringAttri    .Free;
-        tmpNumberAttri    .Free;
-        tmpKeyAttri       .Free;
-        tmpSymbolAttri    .Free;
-        tmpAsmAttri       .Free;
-        tmpCommentAttri   .Free;
-        tmpIdentifierAttri.Free;
-        tmpInvalidAttri   .Free;
-        tmpSpaceAttri     .Free;
-        tmpDirecAttri     .Free;
-      end;
-    finally s.Free; end;
-  end; { ReadCPPBSettings }
-
-begin
-  Result := ReadCPPBSettings(settingIndex);
-end; { TSynCSSyn.UseUserSettings }
-
-function TSynCSSyn.GetSampleSource: string;
-begin
-  Result := '/* Syntax Highlighting */'#13#10 +
-				'int num = 12345;'#13#10 +
-				'string str = "Hello World";'#13#10;
-
-end; { GetSampleSource }
-
-class function TSynCSSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCS;
-end;
-
-function TSynCSSyn.IsFilterStored: boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCS;
-end;
-
-class function TSynCSSyn.GetCapabilities: TSynHighlighterCapabilities;
-begin
-  Result := inherited GetCapabilities + [hcUserSettings];
-end;
-
-class function TSynCSSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCS;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCSSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCS.pas, released 2001-10-28.
+The Original Code is based on SynHighlighterCpp.pas, released 2000-04-10,
+which in turn is based on the dcjCppSyn.pas file from the mwEdit component
+suite by Martin Waldenburg and other developers, the Initial Author of this file
+is Michael Trier.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCS.pas,v 1.8.2.7 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of SynEdit from the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+You may retrieve the latest version of this file from
+http://www.ashleybrown.co.uk/synedit/
+
+Known Issues:
+  - strings on multiple lines are not supported 
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a C# syntax highlighter for SynEdit)
+@author(Ashley Brown)
+@created(2001)
+@lastmod(2001-10-20)
+The SynHighlighterCS unit provides SynEdit with a C# syntax highlighter.
+Based on SynHighlighterCpp.pas
+}
+
+unit SynHighlighterCS;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynEditMiscClasses,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
+    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown);
+
+  TxtkTokenKind = (
+    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
+    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
+    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
+    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
+    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
+    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
+    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
+    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
+    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
+    xtkXorAssign);
+
+  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
+    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39,
+    rsMultiLineString);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynCSSyn = class(TSynCustomHighlighter)
+  private
+    FAsmStart: Boolean;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FExtTokenID: TxtkTokenKind;
+    FIdentFuncTable: array[0..210] of TIdentFuncTableFunc;
+    FAsmAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInvalidAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncAbstract(Index: Integer): TtkTokenKind;
+    function FuncAs(Index: Integer): TtkTokenKind;
+    function FuncBase(Index: Integer): TtkTokenKind;
+    function FuncBool(Index: Integer): TtkTokenKind;
+    function FuncBreak(Index: Integer): TtkTokenKind;
+    function FuncByte(Index: Integer): TtkTokenKind;
+    function FuncCase(Index: Integer): TtkTokenKind;
+    function FuncCatch(Index: Integer): TtkTokenKind;
+    function FuncChar(Index: Integer): TtkTokenKind;
+    function FuncChecked(Index: Integer): TtkTokenKind;
+    function FuncClass(Index: Integer): TtkTokenKind;
+    function FuncConst(Index: Integer): TtkTokenKind;
+    function FuncContinue(Index: Integer): TtkTokenKind;
+    function FuncDecimal(Index: Integer): TtkTokenKind;
+    function FuncDefault(Index: Integer): TtkTokenKind;
+    function FuncDelegate(Index: Integer): TtkTokenKind;
+    function FuncDo(Index: Integer): TtkTokenKind;
+    function FuncDouble(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncEnum(Index: Integer): TtkTokenKind;
+    function FuncEvent(Index: Integer): TtkTokenKind;
+    function FuncExplicit(Index: Integer): TtkTokenKind;
+    function FuncExtern(Index: Integer): TtkTokenKind;
+    function FuncFalse(Index: Integer): TtkTokenKind;
+    function FuncFinally(Index: Integer): TtkTokenKind;
+    function FuncFixed(Index: Integer): TtkTokenKind;
+    function FuncFloat(Index: Integer): TtkTokenKind;
+    function FuncFor(Index: Integer): TtkTokenKind;
+    function FuncForeach(Index: Integer): TtkTokenKind;
+    function FuncGoto(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncImplicit(Index: Integer): TtkTokenKind;
+    function FuncIn(Index: Integer): TtkTokenKind;
+    function FuncInt(Index: Integer): TtkTokenKind;
+    function FuncInterface(Index: Integer): TtkTokenKind;
+    function FuncInternal(Index: Integer): TtkTokenKind;
+    function FuncIs(Index: Integer): TtkTokenKind;
+    function FuncLock(Index: Integer): TtkTokenKind;
+    function FuncLong(Index: Integer): TtkTokenKind;
+    function FuncNamespace(Index: Integer): TtkTokenKind;
+    function FuncNew(Index: Integer): TtkTokenKind;
+    function FuncNull(Index: Integer): TtkTokenKind;
+    function FuncObject(Index: Integer): TtkTokenKind;
+    function FuncOperator(Index: Integer): TtkTokenKind;
+    function FuncOut(Index: Integer): TtkTokenKind;
+    function FuncOverride(Index: Integer): TtkTokenKind;
+    function FuncParams(Index: Integer): TtkTokenKind;
+    function FuncPrivate(Index: Integer): TtkTokenKind;
+    function FuncProtected(Index: Integer): TtkTokenKind;
+    function FuncPublic(Index: Integer): TtkTokenKind;
+    function FuncReadonly(Index: Integer): TtkTokenKind;
+    function FuncRef(Index: Integer): TtkTokenKind;
+    function FuncReturn(Index: Integer): TtkTokenKind;
+    function FuncSbyte(Index: Integer): TtkTokenKind;
+    function FuncSealed(Index: Integer): TtkTokenKind;
+    function FuncSizeof(Index: Integer): TtkTokenKind;
+    function FuncStackalloc(Index: Integer): TtkTokenKind;
+    function FuncStatic(Index: Integer): TtkTokenKind;
+    function FuncString(Index: Integer): TtkTokenKind;
+    function FuncStruct(Index: Integer): TtkTokenKind;
+    function FuncSwitch(Index: Integer): TtkTokenKind;
+    function FuncThis(Index: Integer): TtkTokenKind;
+    function FuncThrow(Index: Integer): TtkTokenKind;
+    function FuncTrue(Index: Integer): TtkTokenKind;
+    function FuncTry(Index: Integer): TtkTokenKind;
+    function FuncTypeof(Index: Integer): TtkTokenKind;
+    function FuncUint(Index: Integer): TtkTokenKind;
+    function FuncUlong(Index: Integer): TtkTokenKind;
+    function FuncUnchecked(Index: Integer): TtkTokenKind;
+    function FuncUnsafe(Index: Integer): TtkTokenKind;
+    function FuncUshort(Index: Integer): TtkTokenKind;
+    function FuncUsing(Index: Integer): TtkTokenKind;
+    function FuncVirtual(Index: Integer): TtkTokenKind;
+    function FuncVoid(Index: Integer): TtkTokenKind;
+    function FuncWhile(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AnsiCProc;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure DirectiveProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+    procedure StringEndProc;
+  protected
+    function GetExtTokenID: TxtkTokenKind;
+    function IsFilterStored: Boolean; override;
+    function GetSampleSource: UnicodeString; override;
+    procedure NextProcedure;
+  public
+    class function GetCapabilities: TSynHighlighterCapabilities; override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+    function UseUserSettings(settingIndex: Integer): Boolean; override;
+    procedure EnumUserSettings(settings: TStrings); override;
+    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+  published
+    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
+      write FInvalidAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  Windows,
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..74] of UnicodeString = (
+    'abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'char', 
+    'checked', 'class', 'const', 'continue', 'decimal', 'default', 'delegate', 
+    'do', 'double', 'else', 'enum', 'event', 'explicit', 'extern', 'false', 
+    'finally', 'fixed', 'float', 'for', 'foreach', 'goto', 'if', 'implicit', 
+    'in', 'int', 'interface', 'internal', 'is', 'lock', 'long', 'namespace', 
+    'new', 'null', 'object', 'operator', 'out', 'override', 'params', 'private', 
+    'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed', 
+    'sizeof', 'stackalloc', 'static', 'string', 'struct', 'switch', 'this', 
+    'throw', 'true', 'try', 'typeof', 'uint', 'ulong', 'unchecked', 'unsafe', 
+    'ushort', 'using', 'virtual', 'void', 'while' 
+  );
+
+  KeyIndices: array[0..210] of Integer = (
+    71, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, 1, 46, -1, -1, 62, 
+    -1, 53, -1, -1, -1, -1, 3, -1, -1, 18, -1, 8, -1, -1, -1, -1, -1, 19, -1, 
+    -1, -1, -1, -1, 45, -1, -1, 28, 44, -1, 47, 21, -1, -1, -1, -1, -1, 73, -1, 
+    -1, 9, -1, -1, -1, 26, 49, 63, 65, -1, -1, 16, 67, -1, 59, -1, -1, -1, 66, 
+    -1, 50, -1, -1, -1, 29, -1, 32, 37, -1, -1, 48, -1, -1, 55, -1, 14, 40, -1, 
+    -1, 13, -1, 12, -1, -1, 15, 30, -1, -1, -1, 41, -1, -1, -1, -1, 4, 56, -1, 
+    58, -1, 38, -1, -1, -1, -1, 74, -1, -1, -1, 17, 33, -1, -1, 20, -1, -1, 27, 
+    31, -1, 6, -1, -1, -1, -1, 7, -1, -1, 10, -1, -1, 2, -1, -1, -1, 64, -1, -1, 
+    43, -1, -1, -1, 0, -1, 34, -1, 25, -1, -1, 5, 61, 60, -1, 42, -1, -1, -1, 
+    51, -1, -1, -1, -1, 22, -1, -1, 72, -1, -1, 57, -1, 70, -1, 11, -1, -1, -1, 
+    24, -1, 35, -1, -1, 23, -1, 39, -1, -1, 68, 52, 36, -1, -1, -1, -1, 54, -1, 
+    -1 
+  );
+
+{$Q-}
+function TSynCSSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 723 + Ord(Str^) * 24;
+    Inc(Str);
+  end;
+  Result := Result mod 211;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCSSyn.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 TSynCSSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[157] := FuncAbstract;
+  FIdentFuncTable[14] := FuncAs;
+  FIdentFuncTable[146] := FuncBase;
+  FIdentFuncTable[25] := FuncBool;
+  FIdentFuncTable[111] := FuncBreak;
+  FIdentFuncTable[164] := FuncByte;
+  FIdentFuncTable[135] := FuncCase;
+  FIdentFuncTable[140] := FuncCatch;
+  FIdentFuncTable[30] := FuncChar;
+  FIdentFuncTable[58] := FuncChecked;
+  FIdentFuncTable[143] := FuncClass;
+  FIdentFuncTable[187] := FuncConst;
+  FIdentFuncTable[98] := FuncContinue;
+  FIdentFuncTable[96] := FuncDecimal;
+  FIdentFuncTable[92] := FuncDefault;
+  FIdentFuncTable[101] := FuncDelegate;
+  FIdentFuncTable[68] := FuncDo;
+  FIdentFuncTable[125] := FuncDouble;
+  FIdentFuncTable[28] := FuncElse;
+  FIdentFuncTable[36] := FuncEnum;
+  FIdentFuncTable[129] := FuncEvent;
+  FIdentFuncTable[49] := FuncExplicit;
+  FIdentFuncTable[177] := FuncExtern;
+  FIdentFuncTable[196] := FuncFalse;
+  FIdentFuncTable[191] := FuncFinally;
+  FIdentFuncTable[161] := FuncFixed;
+  FIdentFuncTable[62] := FuncFloat;
+  FIdentFuncTable[132] := FuncFor;
+  FIdentFuncTable[45] := FuncForeach;
+  FIdentFuncTable[81] := FuncGoto;
+  FIdentFuncTable[102] := FuncIf;
+  FIdentFuncTable[133] := FuncImplicit;
+  FIdentFuncTable[83] := FuncIn;
+  FIdentFuncTable[126] := FuncInt;
+  FIdentFuncTable[159] := FuncInterface;
+  FIdentFuncTable[193] := FuncInternal;
+  FIdentFuncTable[203] := FuncIs;
+  FIdentFuncTable[84] := FuncLock;
+  FIdentFuncTable[116] := FuncLong;
+  FIdentFuncTable[198] := FuncNamespace;
+  FIdentFuncTable[93] := FuncNew;
+  FIdentFuncTable[106] := FuncNull;
+  FIdentFuncTable[168] := FuncObject;
+  FIdentFuncTable[153] := FuncOperator;
+  FIdentFuncTable[46] := FuncOut;
+  FIdentFuncTable[42] := FuncOverride;
+  FIdentFuncTable[15] := FuncParams;
+  FIdentFuncTable[48] := FuncPrivate;
+  FIdentFuncTable[87] := FuncProtected;
+  FIdentFuncTable[63] := FuncPublic;
+  FIdentFuncTable[77] := FuncReadonly;
+  FIdentFuncTable[172] := FuncRef;
+  FIdentFuncTable[202] := FuncReturn;
+  FIdentFuncTable[20] := FuncSbyte;
+  FIdentFuncTable[208] := FuncSealed;
+  FIdentFuncTable[90] := FuncSizeof;
+  FIdentFuncTable[112] := FuncStackalloc;
+  FIdentFuncTable[183] := FuncStatic;
+  FIdentFuncTable[114] := FuncString;
+  FIdentFuncTable[71] := FuncStruct;
+  FIdentFuncTable[166] := FuncSwitch;
+  FIdentFuncTable[165] := FuncThis;
+  FIdentFuncTable[18] := FuncThrow;
+  FIdentFuncTable[64] := FuncTrue;
+  FIdentFuncTable[150] := FuncTry;
+  FIdentFuncTable[65] := FuncTypeof;
+  FIdentFuncTable[75] := FuncUint;
+  FIdentFuncTable[69] := FuncUlong;
+  FIdentFuncTable[201] := FuncUnchecked;
+  FIdentFuncTable[9] := FuncUnsafe;
+  FIdentFuncTable[185] := FuncUshort;
+  FIdentFuncTable[0] := FuncUsing;
+  FIdentFuncTable[180] := FuncVirtual;
+  FIdentFuncTable[55] := FuncVoid;
+  FIdentFuncTable[121] := FuncWhile;
+end;
+
+
+
+function TSynCSSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncAbstract(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncAs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncBase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncBool(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncBreak(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncByte(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncCase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncCatch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncChar(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncChecked(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncClass(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncConst(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncContinue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncDecimal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncDefault(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncDelegate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncDo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncDouble(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncEnum(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncEvent(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncExplicit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncExtern(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncFalse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncFinally(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncFixed(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncFloat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncFor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncForeach(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncGoto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncImplicit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncIn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncInt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncInterface(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncInternal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncIs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncLock(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncLong(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncNamespace(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncNew(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncNull(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncObject(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncOperator(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncOut(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncOverride(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncParams(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncPrivate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncProtected(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncPublic(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncReadonly(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncRef(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncReturn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncSbyte(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncSealed(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncSizeof(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncStackalloc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncStatic(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncString(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncStruct(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncSwitch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncThis(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncThrow(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncTrue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncTry(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncTypeof(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUint(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUlong(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUnchecked(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUnsafe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUshort(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncUsing(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncVirtual(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncVoid(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCSSyn.FuncWhile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynCSSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
+  AddAttribute(FAsmAttri);
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(FInvalidAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(FDirecAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FRange := rsUnknown;
+  FAsmStart := False;
+  FDefaultFilter := SYNS_FilterCS;
+end; { Create }
+
+procedure TSynCSSyn.AnsiCProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          Inc(Run, 2);
+          if FRange = rsAnsiCAsm then
+            FRange := rsAsm
+          else if FRange = rsAnsiCAsmBlock then
+            FRange := rsAsmBlock
+          else if FRange = rsDirectiveComment then
+            FRange := rsDirective
+          else
+            FRange := rsUnknown;
+          Break;
+        end else
+          Inc(Run);
+      #10, #13:
+        Break;
+      else
+        Inc(Run);
+    end;
+end;
+
+procedure TSynCSSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAndAssign;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogAnd;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAnd;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#39, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #39);
+  if FLine[Run] = #39 then
+    Inc(Run);
+end;
+
+procedure TSynCSSyn.AtSymbolProc;
+begin
+  FTokenID := tkUnknown;
+  Inc(Run);
+end;
+
+procedure TSynCSSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceClose;
+  if FRange = rsAsmBlock then FRange := rsUnknown;
+end;
+
+procedure TSynCSSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceOpen;
+  if FRange = rsAsm then
+  begin
+    FRange := rsAsmBlock;
+    FAsmStart := True;
+  end;
+end;
+
+procedure TSynCSSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run + 1] = #10 then Inc(Run);
+end;
+
+procedure TSynCSSyn.ColonProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkScopeResolution;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkColon;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkComma;
+end;
+
+procedure TSynCSSyn.DirectiveProc;
+begin
+  if IsLineEnd(Run) then
+  begin
+    if (Run <= 0) or (FLine[Run - 1] <> '\') then
+      FRange := rsUnknown;
+    NextProcedure;
+  end
+  else
+  begin
+    FTokenID := tkDirective;
+    while True do
+      case FLine[Run] of
+        '/': // comment?
+          begin
+            if FLine[Run + 1] = '/' then
+            begin // is end of directive as well
+              FRange := rsUnknown;
+              Break;
+            end else if FLine[Run + 1] = '*' then
+            begin // might be embedded only
+              FRange := rsDirectiveComment;
+              Break;
+            end else
+              Inc(Run);
+          end;
+        '\': // directive continued on next line?
+          begin
+            Inc(Run);
+            if IsLineEnd(Run) then
+            begin
+              FRange := rsDirective;
+              Break;
+            end;
+          end;
+        #0, #10, #13:
+          begin
+            FRange := rsUnknown;
+            Break;
+          end;
+        else
+          Inc(Run);
+      end;
+  end;
+end;
+
+procedure TSynCSSyn.EqualProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogEqual;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAssign;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkGreaterThanEqual;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftRightAssign;
+        end
+        else                           {shift right}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftRight;
+        end;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkGreaterThan;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.QuestionProc;
+begin
+  FTokenID := tkSymbol;                {conditional}
+  FExtTokenID := xtkQuestion;
+  Inc(Run);
+end;
+
+procedure TSynCSSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynCSSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynCSSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLessThanEqual;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftLeftAssign;
+        end
+        else                           {shift left}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftLeft;
+        end;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLessThan;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkSubtractAssign;
+      end;
+    '-':                               {decrement}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkDecrement;
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkArrow;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkSubtract;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkModAssign;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkMod;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.NotSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkNotEqual;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLogComplement;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCSSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynCSSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {or assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncOrAssign;
+      end;
+    '|':                               {logical or}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogOr;
+      end;
+  else                                 {or}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkIncOr;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAddAssign;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncrement;
+      end;
+  else                                 {add}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAdd;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
+    begin                              {ellipse}
+      Inc(Run, 3);
+      FExtTokenID := xtkEllipse;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkPoint;
+    end;
+end;
+
+procedure TSynCSSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundClose;
+end;
+
+procedure TSynCSSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundOpen;
+end;
+
+procedure TSynCSSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSemiColon;
+  if FRange = rsAsm then FRange := rsUnknown;
+end;
+
+procedure TSynCSSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':                               {c++ style comments}
+      begin
+        FTokenID := tkComment;
+        Inc(Run, 2);
+        while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '*':                               {c style comments}
+      begin
+        FTokenID := tkComment;
+        if FRange = rsAsm then
+          FRange := rsAnsiCAsm
+        else if FRange = rsAsmBlock then
+          FRange := rsAnsiCAsmBlock
+        else if FRange <> rsDirectiveComment then
+          FRange := rsAnsiC;
+        Inc(Run, 2);
+        while FLine[Run] <> #0 do
+          case FLine[Run] of
+            '*':
+              if FLine[Run + 1] = '/' then
+              begin
+                Inc(Run, 2);
+                if FRange = rsDirectiveComment then
+                  FRange := rsDirective
+                else if FRange = rsAnsiCAsm then
+                  FRange := rsAsm
+                else
+                  begin
+                  if FRange = rsAnsiCAsmBlock then
+                    FRange := rsAsmBlock
+                  else
+                    FRange := rsUnknown;
+                  end;
+                Break;
+              end else Inc(Run);
+            #10, #13:
+              begin
+                if FRange = rsDirectiveComment then
+                  FRange := rsAnsiC;
+                Break;
+              end;
+          else Inc(Run);
+          end;
+      end;
+    '=':                               {divide assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+        FExtTokenID := xtkDivideAssign;
+      end;
+  else                                 {divide}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      FExtTokenID := xtkDivide;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynCSSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareClose;
+end;
+
+procedure TSynCSSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareOpen;
+end;
+
+procedure TSynCSSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkMultiplyAssign;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkStar;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      case FLine[Run + 1] of
+        #34, '\':
+          Inc(Run);
+        #00:
+          begin
+            Inc(Run);
+            FRange := rsMultilineString;
+            Exit;
+          end;
+      end;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynCSSyn.StringEndProc;
+begin
+  FTokenID := tkString;
+
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  FRange := rsUnknown;
+
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '\':
+        begin
+          case FLine[Run + 1] of
+            #34, '\':
+              Inc(Run);
+            #00:
+              begin
+                Inc(Run);
+                FRange := rsMultilineString;
+                Exit;
+              end;
+          end;
+        end;
+      #34: Break;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynCSSyn.TildeProc;
+begin
+  Inc(Run);                            {bitwise complement}
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBitComplement;
+end;
+
+procedure TSynCSSyn.XOrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+  	'=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkXorAssign;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkXor;
+    end;
+  end;
+end;
+
+procedure TSynCSSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynCSSyn.Next;
+begin
+  FAsmStart := False;
+  FTokenPos := Run;
+  case FRange of
+    rsAnsiC, rsAnsiCAsm,
+    rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
+    rsDirective: DirectiveProc;
+    rsMultilineString: StringEndProc;
+  else
+    begin
+      FRange := rsUnknown;
+      NextProcedure;
+    end;
+  end;
+  inherited;
+end;
+
+procedure TSynCSSyn.NextProcedure;
+begin
+  case FLine[Run] of
+    '&': AndSymbolProc;
+    #39: AsciiCharProc;
+    '@': AtSymbolProc;
+    '}': BraceCloseProc;
+    '{': BraceOpenProc;
+    #13: CRProc;
+    ':': ColonProc;
+    ',': CommaProc;
+    '#': DirectiveProc;
+    '=': EqualProc;
+    '>': GreaterProc;
+    '?': QuestionProc;
+    'A'..'Z', 'a'..'z', '_': IdentProc;
+    #10: LFProc;
+    '<': LowerProc;
+    '-': MinusProc;
+    '%': ModSymbolProc;
+    '!': NotSymbolProc;
+    #0: NullProc;
+    '0'..'9': NumberProc;
+    '|': OrSymbolProc;
+    '+': PlusProc;
+    '.': PointProc;
+    ')': RoundCloseProc;
+    '(': RoundOpenProc;
+    ';': SemiColonProc;
+    '/': SlashProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    ']': SquareCloseProc;
+    '[': SquareOpenProc;
+    '*': StarProc;
+    #34: StringProc;
+    '~': TildeProc;
+    '^': XOrSymbolProc;
+    else UnknownProc;
+  end;
+end;
+
+function TSynCSSyn.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 TSynCSSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCSSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynCSSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+  if ((FRange = rsAsm) or (FRange = rsAsmBlock)) and not FAsmStart
+    and not (FTokenID in [tkComment, tkSpace, tkNull])
+  then
+    Result := tkAsm;
+end;
+
+function TSynCSSyn.GetExtTokenID: TxtkTokenKind;
+begin
+  Result := FExtTokenID;
+end;
+
+function TSynCSSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkAsm: Result := FAsmAttri;
+    tkComment: Result := FCommentAttri;
+    tkDirective: Result := FDirecAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FInvalidAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynCSSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+procedure TSynCSSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynCSSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynCSSyn.EnumUserSettings(settings: TStrings);
+begin
+  { returns the user settings that exist in the registry }
+  with TBetterRegistry.Create do
+  begin
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
+      begin
+        try
+          GetKeyNames(settings);
+        finally
+          CloseKey;
+        end;
+      end;
+    finally
+      Free;
+    end;
+  end;
+end;
+
+function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
+// Possible parameter values:
+//   index into TStrings returned by EnumUserSettings
+// Possible return values:
+//   True : settings were read and used
+//   False: problem reading settings or invalid version specified - old settings
+//          were preserved
+
+  function ReadCPPBSettings(settingIndex: Integer): Boolean;
+
+    function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
+
+      function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean;
+      var
+        i: Integer;
+      begin
+        for i := 1 to Length(name) do
+          if name[i] = ' ' then name[i] := '_';
+        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
+             '\SOFTWARE\Borland\C++Builder\' + settingTag + '\Highlight', name, True);
+      end; { ReadCPPB1 }
+
+      function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
+      begin
+        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
+                 '\Software\Borland\C++Builder\' + settingTag + '\Editor\Highlight',
+                 key, False);
+      end; { ReadCPPB3OrMore }
+
+    begin { ReadCPPBSetting }
+      try
+        if (settingTag[1] = '1') then
+          Result := ReadCPPB1(settingTag,attri,key)
+        else
+          Result := ReadCPPB3OrMore(settingTag,attri,key);
+      except
+        Result := False;
+      end;
+    end; { ReadCPPBSetting }
+
+  var
+    tmpStringAttri    : TSynHighlighterAttributes;
+    tmpNumberAttri    : TSynHighlighterAttributes;
+    tmpKeyAttri       : TSynHighlighterAttributes;
+    tmpSymbolAttri    : TSynHighlighterAttributes;
+    tmpAsmAttri       : TSynHighlighterAttributes;
+    tmpCommentAttri   : TSynHighlighterAttributes;
+    tmpIdentifierAttri: TSynHighlighterAttributes;
+    tmpInvalidAttri   : TSynHighlighterAttributes;
+    tmpSpaceAttri     : TSynHighlighterAttributes;
+    tmpDirecAttri     : TSynHighlighterAttributes;
+    s                 : TStringList;
+
+  begin { ReadCPPBSettings }
+    s := TStringList.Create;
+    try
+      EnumUserSettings(s);
+      if settingIndex >= s.Count then Result := False
+      else begin
+        tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
+        tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpAsmAttri       := TSynHighlighterAttributes.Create('', '');
+        tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
+        tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
+        tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
+        tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpStringAttri    .Assign(FStringAttri);
+        tmpNumberAttri    .Assign(FNumberAttri);
+        tmpKeyAttri       .Assign(FKeyAttri);
+        tmpSymbolAttri    .Assign(FSymbolAttri);
+        tmpAsmAttri       .Assign(FAsmAttri);
+        tmpCommentAttri   .Assign(FCommentAttri);
+        tmpIdentifierAttri.Assign(FIdentifierAttri);
+        tmpInvalidAttri   .Assign(FInvalidAttri);
+        tmpSpaceAttri     .Assign(FSpaceAttri);
+        tmpDirecAttri     .Assign(FDirecAttri);
+        if s[settingIndex][1] = '1'
+          then Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Plain text')
+          else Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Assembler');
+        Result := Result                                                         and
+                  ReadCPPBSetting(s[settingIndex],FCommentAttri,'Comment')       and
+                  ReadCPPBSetting(s[settingIndex],FIdentifierAttri,'Identifier') and
+                  ReadCPPBSetting(s[settingIndex],FInvalidAttri,'Illegal Char')  and
+                  ReadCPPBSetting(s[settingIndex],FKeyAttri,'Reserved word')     and
+                  ReadCPPBSetting(s[settingIndex],FNumberAttri,'Integer')        and
+                  ReadCPPBSetting(s[settingIndex],FSpaceAttri,'Whitespace')      and
+                  ReadCPPBSetting(s[settingIndex],FStringAttri,'String')         and
+                  ReadCPPBSetting(s[settingIndex],FSymbolAttri,'Symbol')         and
+                  ReadCPPBSetting(s[settingIndex],FDirecAttri,'Preprocessor');
+        if not Result then begin
+          FStringAttri    .Assign(tmpStringAttri);
+          FNumberAttri    .Assign(tmpNumberAttri);
+          FKeyAttri       .Assign(tmpKeyAttri);
+          FSymbolAttri    .Assign(tmpSymbolAttri);
+          FAsmAttri       .Assign(tmpAsmAttri);
+          FCommentAttri   .Assign(tmpCommentAttri);
+          FIdentifierAttri.Assign(tmpIdentifierAttri);
+          FInvalidAttri.Assign(tmpInvalidAttri);
+          FSpaceAttri     .Assign(tmpSpaceAttri);
+          FDirecAttri     .Assign(tmpDirecAttri);
+        end;
+        tmpStringAttri    .Free;
+        tmpNumberAttri    .Free;
+        tmpKeyAttri       .Free;
+        tmpSymbolAttri    .Free;
+        tmpAsmAttri       .Free;
+        tmpCommentAttri   .Free;
+        tmpIdentifierAttri.Free;
+        tmpInvalidAttri   .Free;
+        tmpSpaceAttri     .Free;
+        tmpDirecAttri     .Free;
+      end;
+    finally s.Free; end;
+  end; { ReadCPPBSettings }
+
+begin
+  Result := ReadCPPBSettings(settingIndex);
+end; { TSynCSSyn.UseUserSettings }
+
+function TSynCSSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '/* Syntax Highlighting */'#13#10 +
+				'int num = 12345;'#13#10 +
+				'string str = "Hello World";'#13#10;
+
+end; { GetSampleSource }
+
+class function TSynCSSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCS;
+end;
+
+function TSynCSSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCS;
+end;
+
+class function TSynCSSyn.GetCapabilities: TSynHighlighterCapabilities;
+begin
+  Result := inherited GetCapabilities + [hcUserSettings];
+end;
+
+class function TSynCSSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCS;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCSSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCache.pas b/Source/VCL/SynEdit/Source/SynHighlighterCache.pas
index c4ddcc7e..003e5af2 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCache.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCache.pas
@@ -1,823 +1,828 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCache.pas, released 2000-04-21.
-The Original Code is based on the mwCacheSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Pavel Krehula.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCache.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Cache object script files highlighter for SynEdit)
-@author(Pavel Krehula , converted to SynEdit by Bruno Mikkelsen )
-@created(1999-12-17, converted to SynEdit 2000-04-21)
-@lastmod(2000-06-23)
-The SynHighlighterCache unit provides SynEdit with a Cache object script files highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterCache;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkClass, tkComment, tkFunction, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkDirective, tkSpace, tkString, tkSymbol, tkIndirect, tkLabel,
-    tkMacro, tkUserFunction, tkEmbedSQL, tkEmbedText, tkUnknown);
-
-  TRangeState = (rsUnKnown, rsSQL, rsHTML, rsCommand);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynCacheSyn = class(TSynCustomHighlighter)
-  private
-    fBrace: Integer;
-    fFirstBrace: Boolean;
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..1996] of TIdentFuncTableFunc;
-    fClassAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fFunctionAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fDirectiveAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fIndirectAttri: TSynHighlighterAttributes;
-    fLabelAttri: TSynHighlighterAttributes;
-    fMacroAttri: TSynHighlighterAttributes;
-    fUserFunctionAttri: TSynHighlighterAttributes;
-    fEmbedSQLAttri: TSynHighlighterAttributes;
-    fEmbedTextAttri: TSynHighlighterAttributes;
-    FCanKey: boolean;    // if true, the next token can be a keyword
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function Func38html(Index: Integer): TtkTokenKind;
-    function Func38sql(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure CRProc;
-    procedure CommentProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure IndirectProc;
-    procedure SymbolProc;
-    procedure FuncProc;
-    procedure DirectiveProc;
-    procedure EmbeddedProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property ClassAttri: TSynHighlighterAttributes read fClassAttri
-      write fClassAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri
-      write fFunctionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property PreprocesorAttri: TSynHighlighterAttributes read fDirectiveAttri
-      write fDirectiveAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property IndirectAttri: TSynHighlighterAttributes read fIndirectAttri
-      write fIndirectAttri;
-    property LabelAttri: TSynHighlighterAttributes read fLabelAttri
-      write fLabelAttri;
-    property MacroAttri: TSynHighlighterAttributes read fMacroAttri
-      write fMacroAttri;
-    property UserFunctionAttri: TSynHighlighterAttributes
-      read fUserFunctionAttri write fUserFunctionAttri;
-    property EmbededSQLandHTMLAttri: TSynHighlighterAttributes
-      read fEmbedSQLAttri write fEmbedSQLAttri;
-    property EmbededTextAttri: TSynHighlighterAttributes read fEmbedTextAttri
-      write fEmbedTextAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..274] of string = (
-    '$a', '$ascii', '$c', '$char', '$d', '$data', '$device', '$e', '$ec', 
-    '$ecode', '$es', '$estack', '$et', '$etrap', '$extract', '$f', '$find', 
-    '$fn', '$fnumber', '$g', '$get', '$h', '$horolog', '$i', '$in', 
-    '$increment', '$inumber', '$io', '$j', '$job', '$justify', '$k', '$key', 
-    '$l', '$lb', '$ld', '$length', '$lf', '$lg', '$li', '$list', '$listbuild', 
-    '$listdata', '$listfind', '$listget', '$listlength', '$ll', '$n', '$na', 
-    '$name', '$next', '$o', '$order', '$p', '$piece', '$principal', '$q', '$ql', 
-    '$qlength', '$qs', '$qsubscript', '$query', '$quit', '$r', '$random', '$re', 
-    '$reverse', '$s', '$select', '$st', '$stack', '$storage', '$t', '$test', 
-    '$text', '$tl', '$tlevel', '$tr', '$translate', '$vi', '$view', '$x', '$y', 
-    '$za', '$zabs', '$zarccos', '$zarcsin', '$zarctan', '$zb', '$zbitand', 
-    '$zbitcount', '$zbitfind', '$zbitget', '$zbitlen', '$zbitnot', '$zbitor', 
-    '$zbitset', '$zbitstr', '$zbitxor', '$zboolean', '$zc', '$zchild', 
-    '$zconvert', '$zcos', '$zcot', '$zcrc', '$zcsc', '$zcvt', '$zcyc', '$zdate', 
-    '$zdateh', '$zdatetime', '$zdatetimeh', '$ze', '$zeof', '$zerr', '$zerror', 
-    '$zexp', '$zf', '$zh', '$zhex', '$zhorolog', '$zi', '$zincr', '$zincrement', 
-    '$zio', '$zis', '$ziswide', '$zjob', '$zla', '$zlascii', '$zlc', '$zlchar', 
-    '$zln', '$zlog', '$zmode', '$zn', '$zname', '$znext', '$znspace', '$zo', 
-    '$zorder', '$zp', '$zparent', '$zpi', '$zpos', '$zposition', '$zpower', 
-    '$zprevious', '$zr', '$zreference', '$zs', '$zse', '$zsearch', '$zsec', 
-    '$zseek', '$zsin', '$zsort', '$zsqr', '$zstorage', '$zstrip', '$zt', 
-    '$ztan', '$zth', '$ztime', '$ztimeh', '$ztimestamp', '$ztrap', '$zts', 
-    '$zu', '$zutil', '$zv', '$zversion', '$zw', '$zwa', '$zwascii', '$zwbp', 
-    '$zwbpack', '$zwbunp', '$zwbunpack', '$zwc', '$zwchar', '$zwidth', '$zwp', 
-    '$zwpack', '$zwunp', '$zwunpack', '$zz', '$zzdec', '$zzenkaku', '$zzhex', 
-    '&html', '&sql', '^$g', '^$global', '^$j', '^$job', '^$l', '^$lock', '^$r', 
-    '^$routine', 'b', 'break', 'c', 'close', 'd', 'do', 'e', 'else', 'f', 'for', 
-    'g', 'goto', 'h', 'halt', 'hang', 'i', 'if', 'j', 'job', 'k', 'kill', 'l', 
-    'lock', 'm', 'merge', 'n', 'new', 'o', 'open', 'p', 'print', 'q', 'quit', 
-    'r', 'read', 's', 'set', 'tc', 'tcommint', 'tro', 'trollback', 'ts', 
-    'tstart', 'u', 'use', 'vi', 'view', 'w', 'write', 'x', 'xecute', 'zb', 
-    'zbreak', 'zi', 'zinsert', 'zk', 'zkill', 'zl', 'zload', 'zn', 'znspace', 
-    'zp', 'zprint', 'zq', 'zquit', 'zr', 'zremove', 'zs', 'zsave', 'zsync', 
-    'ztrap', 'zw', 'zwrite', 'zzdump' 
-  );
-
-  KeyIndices: array[0..1996] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, 153, -1, 232, -1, 
-    212, 74, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 272, 
-    259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, 
-    187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 198, 246, -1, -1, -1, 
-    24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, 206, 210, -1, -1, 181, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, -1, -1, 27, -1, -1, -1, 
-    9, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 58, -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, -1, 
-    -1, 28, -1, -1, 137, -1, -1, -1, -1, -1, -1, 183, -1, -1, -1, 18, 49, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 244, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 
-    -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 242, 108, 31, -1, 
-    -1, 93, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, -1, -1, 128, -1, -1, 
-    -1, -1, -1, 8, -1, -1, -1, -1, 191, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, 88, -1, -1, -1, -1, 66, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 249, -1, 33, -1, -1, 185, 59, 
-    -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, 
-    -1, 117, -1, -1, 84, -1, -1, -1, -1, -1, 100, -1, 133, -1, -1, 245, -1, -1, 
-    -1, 257, -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, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, 152, -1, -1, 
-    -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 47, -1, -1, 22, 114, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 247, -1, 86, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 252, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 
-    -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 51, -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, 195, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, 
-    -1, 65, -1, 175, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, 
-    -1, -1, -1, 95, 121, -1, 92, 188, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 164, 240, -1, -1, -1, -1, -1, 202, -1, 130, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, 56, -1, -1, -1, 
-    -1, 1, -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, -1, 
-    -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, 
-    -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    106, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, 85, -1, -1, -1, 261, 
-    -1, 182, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, 158, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 154, -1, -1, -1, -1, 
-    -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, 69, -1, -1, 
-    -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, 
-    -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 251, -1, 
-    -1, -1, 176, -1, -1, -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, 203, -1, 
-    -1, -1, -1, -1, -1, 165, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, -1, 190, 
-    103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, 
-    254, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, 205, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, 104, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, 35, -1, -1, -1, -1, 
-    115, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 253, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, 166, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, 
-    -1, -1, -1, -1, 143, -1, 238, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, 
-    174, -1, -1, -1, -1, -1, 109, 199, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, 136, -1, -1, 
-    -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 267, 
-    -1, 96, -1, -1, -1, -1, -1, -1, -1, 148, -1, 258, -1, -1, -1, -1, -1, 150, 
-    -1, -1, -1, -1, 90, -1, -1, -1, 211, -1, -1, -1, 140, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, 13, 82, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 38, 45, -1, -1, -1, -1, -1, 180, -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, 213, -1, -1, -1, 142, -1, -1, -1, 189, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 273, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, 
-    172, -1, 177, -1, -1, 260, 112, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, 
-    36, -1, 216, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 241, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, 110, 
-    39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, 218, 
-    54, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, 129, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, 135, -1, -1, 30, -1, -1, -1, 70, 
-    262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220, -1, -1, 
-    -1, 151, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 14, 
-    -1, -1, 42, -1, -1, -1, -1, -1, 263, -1, -1, 0, -1, -1, 94, -1, -1, -1, -1, 
-    -1, -1, 105, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, 264, -1, 
-    -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, 161, 
-    -1, -1, 200, -1, -1, -1, -1, -1, -1, 71, 131, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, -1, 46, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, -1, -1, 217, 169, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, 235, -1, 
-    233, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, 
-    -1, 62, -1, -1, 155, 97, -1, -1, -1, -1, -1, -1, 268, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 159, 226, -1, 73, -1, 171, -1, -1, 271, -1, 
-    107, -1, 127, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 4, -1, 87, -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, 29, -1, -1, -1, 
-    146, -1, 138, -1, -1, -1, 228, -1, -1, -1, 173, -1, -1, -1, 50, -1, -1, 78, 
-    -1, -1, -1, 60, -1, 219, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    52, -1, 7, -1, -1, -1, 57, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, 160, -1, 
-    -1, -1, 214, -1, 230, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, -1, 163, -1, -1, 
-    15, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynCacheSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 355 + Ord(Str^) * 71;
-    inc(Str);
-  end;
-  Result := Result mod 1997;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCacheSyn.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 TSynCacheSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[379] := Func38html;
-  fIdentFuncTable[1125] := Func38sql;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynCacheSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynCacheSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-function TSynCacheSyn.Func38html(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    Result := tkEmbedSQL;
-    fRange := rsHTML;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCacheSyn.Func38sql(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    Result := tkEmbedSQL;
-    fRange := rsSQL;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-constructor TSynCacheSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fClassAttri := TSynHighlighterAttributes.Create(SYNS_AttrClass, SYNS_FriendlyAttrClass);
-  AddAttribute(fClassAttri);
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
-  AddAttribute(fFunctionAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDir, SYNS_FriendlyAttrDir);
-  AddAttribute(fDirectiveAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fIndirectAttri := TSynHighlighterAttributes.Create(SYNS_AttrIndirect, SYNS_FriendlyAttrIndirect);
-  AddAttribute(fIndirectAttri);
-  fLabelAttri := TSynHighlighterAttributes.Create(SYNS_AttrLabel, SYNS_FriendlyAttrLabel);
-  AddAttribute(fLabelAttri);
-  fMacroAttri := TSynHighlighterAttributes.Create(SYNS_AttrMacro, SYNS_FriendlyAttrMacro);
-  AddAttribute(fMacroAttri);
-  fUserFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrUserFunction, SYNS_FriendlyAttrUserFunction);
-  AddAttribute(fUserFunctionAttri);
-  fEmbedSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedSQL, SYNS_FriendlyAttrEmbedSQL);
-  AddAttribute(fEmbedSQLAttri);
-  fEmbedTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedText, SYNS_FriendlyAttrEmbedText);
-  AddAttribute(fEmbedTextAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterCache;
-  fRange := rsUnknown;
-end;
-
-procedure TSynCacheSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then inc(Run);
-  FRange := rsUnknown;
-end;
-
-procedure TSynCacheSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-  if FLine[Run+1]=';' then fTokenID := tkEmbedText;
-
-  while FLine[Run] <> #0 do  begin
-    case FLine[Run] of
-      #10, #13: break;
-    end;
-    inc(Run);
-  end;
-end;
-
-//------------------------------------------------------------------------------
-//    higlight keywords and identifiers
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.IdentProc;
-var
-  fir: WideChar;
-begin
-  if FTokenPos=0 then fTokenID := tkLabel
-  else begin
-    fir := FLine[Run];
-    if fir = '^' then FCanKey := true;
-
-    FRange := rsUnknown;
-    if FCanKey then
-      fTokenID := IdentKind(fLine + Run)
-    else
-    begin
-      fTokenID := tkIdentifier;
-      while IsIdentChar(fLine[Run]) do inc(Run);
-      exit;
-    end;
-    FRange := rsCommand;
-    inc(Run, fStringLen);
-    if not (IsLineEnd(Run) or CharInSet(fLine[Run], [#32, ':'])) and (fir <> '^') then
-    begin
-      fTokenID := tkIdentifier;
-    end
-  end;
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynCacheSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  FCanKey := true;
-  inc(Run);
-end;
-
-procedure TSynCacheSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCacheSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  if (fTokenPos = 0) and CharInSet(FLine[Run], ['0'..'9']) then
-  begin
-    fTokenID := tkLabel;
-    while IsIdentChar(fLine[Run]) do inc(Run);
-    FCanKey := false;
-    exit;
-  end;
-
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':  if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-  FRange := rsUnknown;
-end;
-
-procedure TSynCacheSyn.SpaceProc;
-var
-  x: integer;
-begin
-  x := Run;
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-  FCanKey := true;
-  if FRange = rsCommand then
-    FCanKey := (Run - x > 1);
-end;
-
-procedure TSynCacheSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-  FRange := rsUnknown;
-end;
-
-procedure TSynCacheSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynCacheSyn.Next;
-begin
-  fTokenPos := Run;
-  if FLine[Run] = #0 then NullProc
-  else
-    case fRange of
-      rsSQL,
-      rsHTML: EmbeddedProc;
-      else
-        case fLine[Run] of
-          #13: CRProc;
-          ';': CommentProc;
-          'A'..'Z', 'a'..'z', '%', '^': IdentProc;
-          '$': FuncProc;
-          '@': IndirectProc;
-          #10: LFProc;
-          #0: NullProc;
-          '0'..'9': NumberProc;
-          #1..#9, #11, #12, #14..#32: SpaceProc;
-          #34: StringProc;
-          '(',')','+','-','[',']','.','<','>','''','=',',',':','/','\',
-          '?','!','_','*': SymbolProc;
-          '#': DirectiveProc;
-          '&': EmbeddedProc;
-          else UnknownProc;
-        end;
-    end;
-  inherited;
-end;
-
-function TSynCacheSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := fCommentAttri;
-    SYN_ATTR_KEYWORD: Result := fKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynCacheSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCacheSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynCacheSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynCacheSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkClass: Result := fClassAttri;
-    tkComment: Result := fCommentAttri;
-    tkFunction: Result := fFunctionAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkDirective: Result := fDirectiveAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkIndirect: Result := fIndirectAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    tkLabel: Result := fLabelAttri;
-    tkMacro: Result := fMacroAttri;
-    tkUserFunction: Result := fUserFunctionAttri;
-    tkEmbedSQL: Result := fEmbedSQLAttri;
-    tkEmbedText: Result := fEmbedTextAttri;
-  else Result := nil;
-  end;
-end;
-
-function TSynCacheSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-procedure TSynCacheSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynCacheSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynCacheSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCache;
-end;
-
-function TSynCacheSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '0'..'9', 'a'..'z', 'A'..'Z', '%', '^', '$', '&':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynCacheSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCache;
-end;
-
-//------------------------------------------------------------------------------
-//   highlight indirection syntax:   @ident
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.IndirectProc;
-begin
-  fTokenID := tkIndirect;
-  inc(Run);
-  while IsIdentChar(FLine[Run]) do inc(Run);
-  FRange := rsUnknown;
-end;
-
-//------------------------------------------------------------------------------
-//  highlight symbols
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.SymbolProc;
-begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  FRange := rsUnknown;
-end;
-
-//------------------------------------------------------------------------------
-//  highlight user defined functions and macros
-//              function:   $$ident
-//              macro   :   $$$ident
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.FuncProc;
-begin
-  case FLine[Run] of
-    '$': case FLine[Run + 1] of
-           '$': case Fline[Run + 2] of
-                  '$': fTokenID := tkMacro;
-                  else fTokenID := tkUserFunction;
-                end;
-           else begin
-                  fTokenID := IdentKind((fLine + Run));
-                  inc(Run, fStringLen);
-                  if fTokenID = tkKey then fTokenID := tkFunction;
-                end;
-         end;
-    else fTokenID := tkIdentifier;
-  end;
-  while IsIdentChar(fLine[Run]) do inc(Run);
-  FRange := rsUnknown;
-end;
-
-//------------------------------------------------------------------------------
-//    highlight preprocesor directives and class syntax
-//              preprocesor:  #identifier
-//              class      :  ##class
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.DirectiveProc;
-var
-  i: integer;
-begin
-  if FLine[Run + 1] = '#' then
-    fTokenID := tkClass
-  else
-  begin
-    for i := fTokenPos downto 0 do
-      if not CharInSet(FLine[i], [#32, '#']) then
-      begin
-        fTokenID := tkSymbol;
-        inc(Run);
-        exit;
-      end;
-
-    fTokenID := tkDirective
-  end;
-
-  inc(Run);
-  while IsIdentChar(fLine[Run]) or (FLine[Run] = '#') do inc(Run);
-  FRange := rsUnknown;
-end;
-
-//------------------------------------------------------------------------------
-//  highlight embeded SQL and HTML
-//                SQL  :    &sql( .... )
-//                HTML :    &html<   ..... >
-//------------------------------------------------------------------------------
-procedure TSynCacheSyn.EmbeddedProc;
-begin
-  case fRange of
-    rsUnknown, rsCommand: begin
-                 fTokenID := IdentKind( (fLine + Run) );
-                 if fTokenID <> tkEmbedSQL then begin
-                   fTokenID := tkSymbol;
-                   inc( Run );
-                 end else begin
-                   fBrace := 1;
-                   fFirstBrace := true;
-                   inc( Run, fStringLen );
-                 end;
-               end;
-    rsSQL: begin
-             fTokenID := tkEmbedSQL;
-             while (FLine[Run] <> #0) and (fBrace<>0) do begin
-               case FLine[Run] of
-                 '(': if not fFirstBrace then inc(fBrace)
-                      else fFirstBrace := false;
-                 ')': dec(fBrace);
-               end;
-               inc(Run);
-             end;
-             if fBrace=0 then fRange := rsUnknown;
-           end;
-    rsHTML: begin
-              fTokenID := tkEmbedSQL;
-              while (FLine[Run] <> #0) and (fBrace<>0) do begin
-                case FLine[Run] of
-                  '<': if not fFirstBrace then inc(fBrace)
-                       else fFirstBrace := false;
-                  '>': dec(fBrace);
-                end;
-                inc(Run);
-              end;
-              if fBrace=0 then fRange := rsUnknown;
-            end;
-  end;
-end;
-
-class function TSynCacheSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCache;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCacheSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCache.pas, released 2000-04-21.
+The Original Code is based on the mwCacheSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Pavel Krehula.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCache.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Cache object script files highlighter for SynEdit)
+@author(Pavel Krehula , converted to SynEdit by Bruno Mikkelsen )
+@created(1999-12-17, converted to SynEdit 2000-04-21)
+@lastmod(2000-06-23)
+The SynHighlighterCache unit provides SynEdit with a Cache object script files highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterCache;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkClass, tkComment, tkFunction, tkIdentifier, tkKey, tkNull,
+    tkNumber, tkDirective, tkSpace, tkString, tkSymbol, tkIndirect, tkLabel,
+    tkMacro, tkUserFunction, tkEmbedSQL, tkEmbedText, tkUnknown);
+
+  TRangeState = (rsUnknown, rsSQL, rsHTML, rsCommand);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynCacheSyn = class(TSynCustomHighlighter)
+  private
+    FBrace: LongInt;
+    FFirstBrace: Boolean;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..1996] of TIdentFuncTableFunc;
+    FClassAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FFunctionAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FDirectiveAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FIndirectAttri: TSynHighlighterAttributes;
+    FLabelAttri: TSynHighlighterAttributes;
+    FMacroAttri: TSynHighlighterAttributes;
+    FUserFunctionAttri: TSynHighlighterAttributes;
+    FEmbedSQLAttri: TSynHighlighterAttributes;
+    FEmbedTextAttri: TSynHighlighterAttributes;
+    FCanKey: Boolean;    // if true, the next token can be a keyword
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function Func38html(Index: Integer): TtkTokenKind;
+    function Func38sql(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure CRProc;
+    procedure CommentProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure IndirectProc;
+    procedure SymbolProc;
+    procedure FuncProc;
+    procedure DirectiveProc;
+    procedure EmbeddedProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+  published
+    property ClassAttri: TSynHighlighterAttributes read FClassAttri
+      write FClassAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri
+      write FFunctionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property PreprocesorAttri: TSynHighlighterAttributes read FDirectiveAttri
+      write FDirectiveAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+    property IndirectAttri: TSynHighlighterAttributes read FIndirectAttri
+      write FIndirectAttri;
+    property LabelAttri: TSynHighlighterAttributes read FLabelAttri
+      write FLabelAttri;
+    property MacroAttri: TSynHighlighterAttributes read FMacroAttri
+      write FMacroAttri;
+    property UserFunctionAttri: TSynHighlighterAttributes
+      read FUserFunctionAttri write FUserFunctionAttri;
+    property EmbededSQLandHTMLAttri: TSynHighlighterAttributes
+      read FEmbedSQLAttri write FEmbedSQLAttri;
+    property EmbededTextAttri: TSynHighlighterAttributes read FEmbedTextAttri
+      write FEmbedTextAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..274] of UnicodeString = (
+    '$a', '$ascii', '$c', '$char', '$d', '$data', '$device', '$e', '$ec', 
+    '$ecode', '$es', '$estack', '$et', '$etrap', '$extract', '$f', '$find', 
+    '$fn', '$fnumber', '$g', '$get', '$h', '$horolog', '$i', '$in', 
+    '$increment', '$inumber', '$io', '$j', '$job', '$justify', '$k', '$key', 
+    '$l', '$lb', '$ld', '$length', '$lf', '$lg', '$li', '$list', '$listbuild', 
+    '$listdata', '$listfind', '$listget', '$listlength', '$ll', '$n', '$na', 
+    '$name', '$next', '$o', '$order', '$p', '$piece', '$principal', '$q', '$ql', 
+    '$qlength', '$qs', '$qsubscript', '$query', '$quit', '$r', '$random', '$re', 
+    '$reverse', '$s', '$select', '$st', '$stack', '$storage', '$t', '$test', 
+    '$text', '$tl', '$tlevel', '$tr', '$translate', '$vi', '$view', '$x', '$y', 
+    '$za', '$zabs', '$zarccos', '$zarcsin', '$zarctan', '$zb', '$zbitand', 
+    '$zbitcount', '$zbitfind', '$zbitget', '$zbitlen', '$zbitnot', '$zbitor', 
+    '$zbitset', '$zbitstr', '$zbitxor', '$zboolean', '$zc', '$zchild', 
+    '$zconvert', '$zcos', '$zcot', '$zcrc', '$zcsc', '$zcvt', '$zcyc', '$zdate', 
+    '$zdateh', '$zdatetime', '$zdatetimeh', '$ze', '$zeof', '$zerr', '$zerror', 
+    '$zexp', '$zf', '$zh', '$zhex', '$zhorolog', '$zi', '$zincr', '$zincrement', 
+    '$zio', '$zis', '$ziswide', '$zjob', '$zla', '$zlascii', '$zlc', '$zlchar', 
+    '$zln', '$zlog', '$zmode', '$zn', '$zname', '$znext', '$znspace', '$zo', 
+    '$zorder', '$zp', '$zparent', '$zpi', '$zpos', '$zposition', '$zpower', 
+    '$zprevious', '$zr', '$zreference', '$zs', '$zse', '$zsearch', '$zsec', 
+    '$zseek', '$zsin', '$zsort', '$zsqr', '$zstorage', '$zstrip', '$zt', 
+    '$ztan', '$zth', '$ztime', '$ztimeh', '$ztimestamp', '$ztrap', '$zts', 
+    '$zu', '$zutil', '$zv', '$zversion', '$zw', '$zwa', '$zwascii', '$zwbp', 
+    '$zwbpack', '$zwbunp', '$zwbunpack', '$zwc', '$zwchar', '$zwidth', '$zwp', 
+    '$zwpack', '$zwunp', '$zwunpack', '$zz', '$zzdec', '$zzenkaku', '$zzhex', 
+    '&html', '&sql', '^$g', '^$global', '^$j', '^$job', '^$l', '^$lock', '^$r', 
+    '^$routine', 'b', 'break', 'c', 'close', 'd', 'do', 'e', 'else', 'f', 'for', 
+    'g', 'goto', 'h', 'halt', 'hang', 'i', 'if', 'j', 'job', 'k', 'kill', 'l', 
+    'lock', 'm', 'merge', 'n', 'new', 'o', 'open', 'p', 'print', 'q', 'quit', 
+    'r', 'read', 's', 'set', 'tc', 'tcommint', 'tro', 'trollback', 'ts', 
+    'tstart', 'u', 'use', 'vi', 'view', 'w', 'write', 'x', 'xecute', 'zb', 
+    'zbreak', 'zi', 'zinsert', 'zk', 'zkill', 'zl', 'zload', 'zn', 'znspace', 
+    'zp', 'zprint', 'zq', 'zquit', 'zr', 'zremove', 'zs', 'zsave', 'zsync', 
+    'ztrap', 'zw', 'zwrite', 'zzdump' 
+  );
+
+  KeyIndices: array[0..1996] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, 153, -1, 232, -1, 
+    212, 74, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 272, 
+    259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, 
+    187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 198, 246, -1, -1, -1, 
+    24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, 206, 210, -1, -1, 181, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, -1, -1, 27, -1, -1, -1, 
+    9, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 58, -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, -1, 
+    -1, 28, -1, -1, 137, -1, -1, -1, -1, -1, -1, 183, -1, -1, -1, 18, 49, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 244, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 
+    -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 242, 108, 31, -1, 
+    -1, 93, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, -1, -1, 128, -1, -1, 
+    -1, -1, -1, 8, -1, -1, -1, -1, 191, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, 88, -1, -1, -1, -1, 66, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 249, -1, 33, -1, -1, 185, 59, 
+    -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, 
+    -1, 117, -1, -1, 84, -1, -1, -1, -1, -1, 100, -1, 133, -1, -1, 245, -1, -1, 
+    -1, 257, -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, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, 152, -1, -1, 
+    -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 47, -1, -1, 22, 114, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 247, -1, 86, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 252, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 
+    -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 51, -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, 195, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, 
+    -1, 65, -1, 175, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, 
+    -1, -1, -1, 95, 121, -1, 92, 188, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 164, 240, -1, -1, -1, -1, -1, 202, -1, 130, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, 56, -1, -1, -1, 
+    -1, 1, -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, -1, 
+    -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, 
+    -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    106, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, 85, -1, -1, -1, 261, 
+    -1, 182, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, 158, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 154, -1, -1, -1, -1, 
+    -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, 69, -1, -1, 
+    -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, 
+    -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 251, -1, 
+    -1, -1, 176, -1, -1, -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, 203, -1, 
+    -1, -1, -1, -1, -1, 165, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, -1, 190, 
+    103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, 
+    254, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, 205, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, 104, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, 35, -1, -1, -1, -1, 
+    115, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 253, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, 166, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, 
+    -1, -1, -1, -1, 143, -1, 238, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, 
+    174, -1, -1, -1, -1, -1, 109, 199, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, 136, -1, -1, 
+    -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 267, 
+    -1, 96, -1, -1, -1, -1, -1, -1, -1, 148, -1, 258, -1, -1, -1, -1, -1, 150, 
+    -1, -1, -1, -1, 90, -1, -1, -1, 211, -1, -1, -1, 140, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, 13, 82, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 38, 45, -1, -1, -1, -1, -1, 180, -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, 213, -1, -1, -1, 142, -1, -1, -1, 189, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 273, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, 
+    172, -1, 177, -1, -1, 260, 112, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, 
+    36, -1, 216, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 241, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, 110, 
+    39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, 218, 
+    54, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, 129, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, 135, -1, -1, 30, -1, -1, -1, 70, 
+    262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220, -1, -1, 
+    -1, 151, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 14, 
+    -1, -1, 42, -1, -1, -1, -1, -1, 263, -1, -1, 0, -1, -1, 94, -1, -1, -1, -1, 
+    -1, -1, 105, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, 264, -1, 
+    -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, 161, 
+    -1, -1, 200, -1, -1, -1, -1, -1, -1, 71, 131, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, -1, 46, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, -1, -1, 217, 169, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, 235, -1, 
+    233, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, 
+    -1, 62, -1, -1, 155, 97, -1, -1, -1, -1, -1, -1, 268, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 159, 226, -1, 73, -1, 171, -1, -1, 271, -1, 
+    107, -1, 127, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 4, -1, 87, -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, 29, -1, -1, -1, 
+    146, -1, 138, -1, -1, -1, 228, -1, -1, -1, 173, -1, -1, -1, 50, -1, -1, 78, 
+    -1, -1, -1, 60, -1, 219, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    52, -1, 7, -1, -1, -1, 57, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, 160, -1, 
+    -1, -1, 214, -1, 230, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, -1, 163, -1, -1, 
+    15, -1, -1, -1 
+  );
+
+{$Q-}
+function TSynCacheSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 355 + Ord(Str^) * 71;
+    Inc(Str);
+  end;
+  Result := Result mod 1997;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCacheSyn.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 TSynCacheSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[379] := Func38html;
+  FIdentFuncTable[1125] := Func38sql;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynCacheSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynCacheSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+function TSynCacheSyn.Func38html(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    Result := tkEmbedSQL;
+    FRange := rsHTML;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynCacheSyn.Func38sql(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    Result := tkEmbedSQL;
+    FRange := rsSQL;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+constructor TSynCacheSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FClassAttri := TSynHighlighterAttributes.Create(SYNS_AttrClass, SYNS_FriendlyAttrClass);
+  AddAttribute(FClassAttri);
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
+  AddAttribute(FFunctionAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDir, SYNS_FriendlyAttrDir);
+  AddAttribute(FDirectiveAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FIndirectAttri := TSynHighlighterAttributes.Create(SYNS_AttrIndirect, SYNS_FriendlyAttrIndirect);
+  AddAttribute(FIndirectAttri);
+  FLabelAttri := TSynHighlighterAttributes.Create(SYNS_AttrLabel, SYNS_FriendlyAttrLabel);
+  AddAttribute(FLabelAttri);
+  FMacroAttri := TSynHighlighterAttributes.Create(SYNS_AttrMacro, SYNS_FriendlyAttrMacro);
+  AddAttribute(FMacroAttri);
+  FUserFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrUserFunction, SYNS_FriendlyAttrUserFunction);
+  AddAttribute(FUserFunctionAttri);
+  FEmbedSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedSQL, SYNS_FriendlyAttrEmbedSQL);
+  AddAttribute(FEmbedSQLAttri);
+  FEmbedTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedText, SYNS_FriendlyAttrEmbedText);
+  AddAttribute(FEmbedTextAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterCache;
+  FRange := rsUnknown;
+end;
+
+procedure TSynCacheSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+  FRange := rsUnknown;
+end;
+
+procedure TSynCacheSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  if FLine[Run+1]=';' then FTokenID := tkEmbedText;
+
+  while FLine[Run] <> #0 do  begin
+    case FLine[Run] of
+      #10, #13: Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+//------------------------------------------------------------------------------
+//    higlight keywords and identifiers
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.IdentProc;
+var
+  fir: WideChar;
+begin
+  if FTokenPos=0 then FTokenID := tkLabel
+  else begin
+    fir := FLine[Run];
+    if fir = '^' then FCanKey := true;
+
+    FRange := rsUnknown;
+    if FCanKey then
+      FTokenID := IdentKind(FLine + Run)
+    else
+    begin
+      FTokenID := tkIdentifier;
+      while IsIdentChar(FLine[Run]) do Inc(Run);
+      Exit;
+    end;
+    FRange := rsCommand;
+    Inc(Run, FStringLen);
+    if not (IsLineEnd(Run) or CharInSet(FLine[Run], [#32, ':'])) and (fir <> '^') then
+    begin
+      FTokenID := tkIdentifier;
+    end
+  end;
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynCacheSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  FCanKey := true;
+  Inc(Run);
+end;
+
+procedure TSynCacheSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCacheSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'e', 'E':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  if (FTokenPos = 0) and CharInSet(FLine[Run], ['0'..'9']) then
+  begin
+    FTokenID := tkLabel;
+    while IsIdentChar(FLine[Run]) do Inc(Run);
+    FCanKey := False;
+    Exit;
+  end;
+
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+  FRange := rsUnknown;
+end;
+
+procedure TSynCacheSyn.SpaceProc;
+var
+  x: Integer;
+begin
+  x := Run;
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+  FCanKey := true;
+  if FRange = rsCommand then
+    FCanKey := (Run - x > 1);
+end;
+
+procedure TSynCacheSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+  FRange := rsUnknown;
+end;
+
+procedure TSynCacheSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynCacheSyn.Next;
+begin
+  FTokenPos := Run;
+  if FLine[Run] = #0 then NullProc
+  else
+    case FRange of
+      rsSQL,
+      rsHTML: EmbeddedProc;
+      else
+        case FLine[Run] of
+          #13: CRProc;
+          ';': CommentProc;
+          'A'..'Z', 'a'..'z', '%', '^': IdentProc;
+          '$': FuncProc;
+          '@': IndirectProc;
+          #10: LFProc;
+          #0: NullProc;
+          '0'..'9': NumberProc;
+          #1..#9, #11, #12, #14..#32: SpaceProc;
+          #34: StringProc;
+          '(',')','+','-','[',']','.','<','>','''','=',',',':','/','\',
+          '?','!','_','*': SymbolProc;
+          '#': DirectiveProc;
+          '&': EmbeddedProc;
+          else UnknownProc;
+        end;
+    end;
+  inherited;
+end;
+
+function TSynCacheSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+begin
+  case Index of
+    SYN_ATTR_COMMENT: Result := FCommentAttri;
+    SYN_ATTR_KEYWORD: Result := FKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynCacheSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCacheSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynCacheSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynCacheSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkClass: Result := FClassAttri;
+    tkComment: Result := FCommentAttri;
+    tkFunction: Result := FFunctionAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkDirective: Result := FDirectiveAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkIndirect: Result := FIndirectAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    tkLabel: Result := FLabelAttri;
+    tkMacro: Result := FMacroAttri;
+    tkUserFunction: Result := FUserFunctionAttri;
+    tkEmbedSQL: Result := FEmbedSQLAttri;
+    tkEmbedText: Result := FEmbedTextAttri;
+  else Result := nil;
+  end;
+end;
+
+function TSynCacheSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynCacheSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynCacheSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynCacheSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCache;
+end;
+
+function TSynCacheSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '0'..'9', 'a'..'z', 'A'..'Z', '%', '^', '$', '&':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynCacheSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCache;
+end;
+
+//------------------------------------------------------------------------------
+//   highlight indirection syntax:   @ident
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.IndirectProc;
+begin
+  FTokenID := tkIndirect;
+  Inc(Run);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+  FRange := rsUnknown;
+end;
+
+//------------------------------------------------------------------------------
+//  highlight symbols
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.SymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  FRange := rsUnknown;
+end;
+
+//------------------------------------------------------------------------------
+//  highlight user defined functions and macros
+//              function:   $$ident
+//              macro   :   $$$ident
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.FuncProc;
+begin
+  case FLine[Run] of
+    '$': case FLine[Run + 1] of
+           '$': case FLine[Run + 2] of
+                  '$': FTokenID := tkMacro;
+                  else FTokenID := tkUserFunction;
+                end;
+           else begin
+                  FTokenID := IdentKind((FLine + Run));
+                  Inc(Run, FStringLen);
+                  if FTokenID = tkKey then FTokenID := tkFunction;
+                end;
+         end;
+    else FTokenID := tkIdentifier;
+  end;
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+  FRange := rsUnknown;
+end;
+
+//------------------------------------------------------------------------------
+//    highlight preprocesor directives and class syntax
+//              preprocesor:  #identifier
+//              class      :  ##class
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.DirectiveProc;
+var
+  i: Integer;
+begin
+  if FLine[Run + 1] = '#' then
+    FTokenID := tkClass
+  else
+  begin
+    for i := FTokenPos downto 0 do
+      if not CharInSet(FLine[i], [#32, '#']) then
+      begin
+        FTokenID := tkSymbol;
+        Inc(Run);
+        Exit;
+      end;
+
+    FTokenID := tkDirective
+  end;
+
+  Inc(Run);
+  while IsIdentChar(FLine[Run]) or (FLine[Run] = '#') do Inc(Run);
+  FRange := rsUnknown;
+end;
+
+//------------------------------------------------------------------------------
+//  highlight embeded SQL and HTML
+//                SQL  :    &sql( .... )
+//                HTML :    &html<   ..... >
+//------------------------------------------------------------------------------
+procedure TSynCacheSyn.EmbeddedProc;
+begin
+  case FRange of
+    rsUnknown, rsCommand: begin
+                 FTokenID := IdentKind( (FLine + Run) );
+                 if FTokenID <> tkEmbedSQL then begin
+                   FTokenID := tkSymbol;
+                   Inc( Run );
+                 end else begin
+                   FBrace := 1;
+                   FFirstBrace := true;
+                   Inc( Run, FStringLen );
+                 end;
+               end;
+    rsSQL: begin
+             FTokenID := tkEmbedSQL;
+             while (FLine[Run] <> #0) and (FBrace<>0) do begin
+               case FLine[Run] of
+                 '(': if not FFirstBrace then Inc(FBrace)
+                      else FFirstBrace := False;
+                 ')': Dec(FBrace);
+               end;
+               Inc(Run);
+             end;
+             if FBrace = 0 then FRange := rsUnknown;
+           end;
+    rsHTML: begin
+              FTokenID := tkEmbedSQL;
+              while (FLine[Run] <> #0) and (FBrace<>0) do begin
+                case FLine[Run] of
+                  '<': if not FFirstBrace then Inc(FBrace)
+                       else FFirstBrace := False;
+                  '>': Dec(FBrace);
+                end;
+                Inc(Run);
+              end;
+              if FBrace = 0 then FRange := rsUnknown;
+            end;
+  end;
+end;
+
+class function TSynCacheSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCache;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCacheSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCobol.pas b/Source/VCL/SynEdit/Source/SynHighlighterCobol.pas
index 3fda5b7e..7156a7f2 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCobol.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCobol.pas
@@ -1,928 +1,930 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterCobol.pas, released 2002-08-26.
-Description: COBOL Syntax Parser/Highlighter
-The author of this file is Andrey Ustinov.
-Copyright (c) 2002 Software Mining, http://www.softwaremining.com/.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCobol.pas,v 1.5.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-
-unit SynHighlighterCobol;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,  
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (
-    tkComment,
-    tkIdentifier,
-    tkAIdentifier,
-    tkPreprocessor,
-    tkKey,
-    tkBoolean,
-    tkNull,
-    tkNumber,
-    tkSpace,
-    tkString,
-    tkSequence,
-    tkIndicator,
-    tkTagArea,
-    tkDebugLines,
-    tkUnknown);
-
-  TRangeState = (rsUnknown,
-                 rsQuoteString, rsApostString,
-                 rsPseudoText,
-                 rsQuoteStringMayBe, rsApostStringMayBe);
-
-type
-  TSynCobolSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fIndicator: WideChar;
-
-    fCodeStartPos: Integer;
-    fCodeMediumPos: Integer;
-    fCodeEndPos: Integer;
-
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fAIdentifierAttri: TSynHighlighterAttributes;
-    fPreprocessorAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fBooleanAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSequenceAttri: TSynHighlighterAttributes;
-    fIndicatorAttri: TSynHighlighterAttributes;
-    fTagAreaAttri: TSynHighlighterAttributes;
-    fDebugLinesAttri: TSynHighlighterAttributes;
-    fKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: string; AKind: integer);
-    function HashKey(Str: PWideChar): Integer;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure IdentProc;
-    procedure UnknownProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure CRProc;
-    procedure LFProc;
-    procedure NumberProc;
-    procedure PointProc;
-    procedure StringOpenProc;
-    procedure StringProc;
-    procedure StringEndProc;
-    procedure FirstCharsProc;
-    procedure LastCharsProc;
-    procedure CommentProc;
-    procedure DebugProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-    procedure NextProcedure;
-
-    procedure SetCodeStartPos(Value: Integer);
-    procedure SetCodeMediumPos(Value: Integer);
-    procedure SetCodeEndPos(Value: Integer);
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: 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 GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
-    property AreaAIdentifierAttri: TSynHighlighterAttributes read fAIdentifierAttri write fAIdentifierAttri;
-    property PreprocessorAttri: TSynHighlighterAttributes read fPreprocessorAttri write fPreprocessorAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
-    property BooleanAttri: TSynHighlighterAttributes read fBooleanAttri write fBooleanAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
-    property SequenceAttri: TSynHighlighterAttributes read fSequenceAttri write fSequenceAttri;
-    property IndicatorAttri: TSynHighlighterAttributes read fIndicatorAttri write fIndicatorAttri;
-    property TagAreaAttri: TSynHighlighterAttributes read fTagAreaAttri write fTagAreaAttri;
-    property DebugLinesAttri: TSynHighlighterAttributes read fDebugLinesAttri write fDebugLinesAttri;
-
-    property AreaAStartPos: Integer read fCodeStartPos write SetCodeStartPos;
-    property AreaBStartPos: Integer read fCodeMediumPos write SetCodeMediumPos;
-    property CodeEndPos: Integer read fCodeEndPos write SetCodeEndPos;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  BooleanWords: string =
-    'false, true';
-
-  KeyWords: string =
-    'accept, access, acquire, add, address, advancing, after, all, allowing, ' +
-    'alphabet, alphabetic, alphabetic-lower, alphabetic-upper, alphanumeric, ' +
-    'alphanumeric-edited, also, alter, alternate, and, any, apply, are, ' +
-    'area, areas, area-value, arithmetic, ascending, assign, at, author, ' +
-    'auto, automatic, auto-skip, background-color, background-colour, ' +
-    'backward, b-and, beep, before, beginning, bell, b-exor, binary, bit, ' +
-    'bits, blank, b-less, blink, block, b-not, boolean, b-or, bottom, by, ' +
-    'call, cancel, cd, cf, ch, chain, chaining, changed, character, ' +
-    'characters, class, clock-units, close, cobol, code, code-set, col, ' +
-    'collating, color, column, comma, command-line, commit, commitment, ' +
-    'common, communication, comp, comp-0, comp-1, comp-2, comp-3, comp-4, ' +
-    'comp-5, comp-6, comp-7, comp-8, comp-9, computational, computational-0, ' +
-    'computational-1, computational-2, computational-3, computational-4, ' +
-    'computational-5, computational-6, computational-7, computational-8, ' +
-    'computational-9, computational-x, compute, comp-x, com-reg, ' +
-    'configuration, connect, console, contained, contains, content, ' +
-    'continue, control-area, controls, converting, corr, corresponding, ' +
-    'count, crt, crt-under, currency, current, cursor, cycle, data, date, ' +
-    'date-compiled, date-written, day, day-of-week, db, ' +
-    'db-access-control-key, dbcs, db-data-name, db-exception, ' +
-    'db-format-name, db-record-name, db-set-name, db-status, de, ' +
-    'debug-contents, debugging, debug-item, debug-line, debug-name, ' +
-    'debug-sub-1, debug-sub-2, debug-sub-3, decimal-point, declaratives, ' +
-    'default, delimited, delimiter, depending, descending, destination, ' +
-    'detail, disable, disconnect, disk, display, display-1, display-2, ' +
-    'display-3, display-4, display-5, display-6, display-7, display-8, ' +
-    'display-9, divide, division, down, drop, duplicate, duplicates, ' +
-    'dynamic, egcs, egi, else, emi, empty, empty-check, enable, end, ' +
-    'end-accept, end-add, end-call, end-compute, end-delete, end-disable, ' +
-    'end-divide, end-enable, end-evaluate, end-if, ending, end-multiply, ' +
-    'end-of-page, end-perform, end-read, end-receive, end-return, ' +
-    'end-rewrite, end-search, end-send, end-start, end-string, end-subtract, ' +
-    'end-transceive, end-unstring, end-write, enter, entry, environment, ' +
-    'eop, equal, equals, erase, error, escape, esi, evaluate, every, exact, ' +
-    'exceeds, exception, excess-3, exclusive, exec, execute, exhibit, exit, ' +
-    'extend, external, externally-described-key, fd, fetch, file, ' +
-    'file-control, file-id, filler, final, find, finish, first, fixed, ' +
-    'footing, for, foreground-color, foreground-colour, form, format, free, ' +
-    'from, full, function, generate, get, giving, global, go, goback, ' +
-    'greater, group, heading, highlight, id, identification, if, in, index, ' +
-    'index-1, index-2, index-3, index-4, index-5, index-6, index-7, index-8, ' +
-    'index-9, indexed, indic, indicate, indicator, indicators, initial, ' +
-    'initialize, initiate, input, input-output, inspect, installation, into, ' +
-    'invalid, i-o, i-o-control, is, japanese, just, justified, kanji, keep, ' +
-    'kept, key, keyboard, last, ld, leading, left, left-justify, length, ' +
-    'length-check, less, like, limit, limits, linage, linage-counter, line, ' +
-    'line-counter, lines, linkage, locally, lock, manual, member, memory, ' +
-    'merge, message, mode, modified, modify, modules, more-labels, move, ' +
-    'multiple, multiply, name, native, negative, next, no, no-echo, none, ' +
-    'normal, not, number, numeric, numeric-edited, object-computer, occurs, ' +
-    'of, off, omitted, on, only, open, optional, or, order, organization, ' +
-    'other, output, overflow, owner, packed-decimal, padding, page, ' +
-    'page-counter, palette, paragraph, password, perform, pf, ph, pic, ' +
-    'picture, plus, pointer, position, positive, present, previous, printer, ' +
-    'printer-1, printing, print-switch, prior, procedure, procedures, ' +
-    'proceed, process, processing, program, program-id, prompt, protected, ' +
-    'purge, queue, random, range, rd, read, realm, receive, reconnect, ' +
-    'record, recording, record-name, records, redefines, reel, reference, ' +
-    'references, relation, relative, release, remainder, removal, renames, ' +
-    'repeated, replacing, report, reporting, reports, required, rerun, ' +
-    'reserve, retaining, retrieval, return, return-code, reversed, ' +
-    'reverse-video, rewind, rewrite, rf, rh, right, right-justify, rollback, ' +
-    'rolling, rounded, run, same, screen, sd, search, section, secure, ' +
-    'security, segment, segment-limit, select, send, sentence, separate, ' +
-    'sequence, sequential, session-id, set, shared, shift-in, shift-out, ' +
-    'sign, size, sort, sort-control, sort-core-size, sort-file-size, ' +
-    'sort-merge, sort-message, sort-mode-size, sort-return, source, ' +
-    'source-computer, space-fill, special-names, standard, standard-1, ' +
-    'standard-2, standard-3, standard-4, start, starting, status, stop, ' +
-    'store, string, subfile, subprogram, sub-queue-1, sub-queue-2, ' +
-    'sub-queue-3, sub-schema, subtract, sum, suppress, switch, switch-1, ' +
-    'switch-2, switch-3, switch-4, switch-5, switch-6, switch-7, switch-8, ' +
-    'symbolic, sync, synchronized, table, tally, tallying, tape, tenant, ' +
-    'terminal, terminate, test, text, than, then, through, thru, time, ' +
-    'timeout, times, to, top, trailing, trailing-sign, transaction, ' +
-    'transceive, type, underline, unequal, unit, unlock, unstring, until, ' +
-    'up, update, upon, usage, usage-mode, user, using, valid, validate, ' +
-    'value, values, variable, varying, wait, when, when-compiled, with, ' +
-    'within, words, working-storage, write, write-only, zero-fill';
-
-  PreprocessorWords: string =
-    'basis, cbl, control, copy, delete, eject, insert, ready, reload, ' +
-    'replace, reset, service, skip1, skip2, skip3, title, trace, use';
-
-  StringWords: string =
-    'high-value, high-values, low-value, low-values, null, nulls, quote, ' +
-    'quotes, space, spaces, zero, zeroes, zeros';
-
-  // Ambigious means that a simple string comparision is not enough
-  AmbigiousWords: string =
-    'label';
-
-const
-  StringChars: array[TRangeState] of WideChar = (#0, '"', '''', '=',  '"', '''');
-
-procedure TSynCobolSyn.DoAddKeyword(AKeyword: string; AKind: integer);
-var
-  HashValue: integer;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-function TSynCobolSyn.HashKey(Str: PWideChar): Integer;
-var
-  fRun: Integer;
-
-  function GetOrd: Integer;
-  begin
-    case Str^ of
-      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
-      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
-      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
-      '-': Result := 27;
-      else Result := 0;
-    end
-  end;
-
-begin
-  fRun := Run;
-  Result := 0;
-
-  while IsIdentChar(Str^) and (fRun <= fCodeEndPos) do
-  begin
-{$IFOPT Q-}
-    Result := 7 * Result + GetOrd;
-{$ELSE}
-    Result := (7 * Result + GetOrd) and $FFFFFF;
-{$ENDIF}
-    Inc(Str);
-    inc(fRun);
-  end;
-  
-  Result := Result and $FF; // 255
-  fStringLen := Str - fToIdent;
-end;
-
-function TSynCobolSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Entry: TSynHashEntry;
-  I: Integer;
-begin
-  fToIdent := MayBe;
-  Entry := fKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > fStringLen then
-      break
-    else if Entry.KeywordLen = fStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-
-        if Result = tkUnknown then // handling of "ambigious" words 
-        begin
-          if IsCurrentToken('label') then
-          begin
-            I := Run + Length('label');
-            while fLine[I] = ' ' do
-              Inc(I);
-            if (AnsiStrLComp(PWideChar(@fLine[I]), 'record', Length('record')) = 0)
-              and (I + Length('record') - 1 <= fCodeEndPos) then
-                Result := tkKey
-              else
-                Result := tkPreprocessor;
-          end
-          else
-            Result := tkIdentifier;
-        end;
-        
-        exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
-end;
-
-procedure TSynCobolSyn.SpaceProc;
-begin
-  fTokenID := tkSpace;
-  repeat
-    inc(Run);
-  until not CharInSet(fLine[Run], [#1..#32]);
-end;
-
-procedure TSynCobolSyn.FirstCharsProc;
-var
-  I: Integer;
-begin
-  if IsLineEnd(Run) then
-    NextProcedure
-  else if Run < fCodeStartPos - 1 then
-  begin
-    fTokenID := tkSequence;
-    repeat
-      inc(Run);
-    until (Run = fCodeStartPos - 1) or IsLineEnd(Run);
-  end
-  else
-  begin
-    fTokenID := tkIndicator;
-    case fLine[Run] of
-      '*', '/', 'D', 'd': fIndicator := fLine[Run];
-      '-': if fRange in [rsQuoteStringMayBe, rsApostStringMayBe] then
-           begin
-             I := Run + 1;
-             while fLine[I] = ' ' do
-               Inc(I);
-             if (AnsiStrLComp(PWideChar(@fLine[I]), PWideChar(StringofChar(StringChars[fRange], 2)), 2) <> 0)
-               or (I + 1 > fCodeEndPos) then
-                 fRange := rsUnknown;
-           end;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynCobolSyn.LastCharsProc;
-begin
-  if IsLineEnd(Run) then
-    NextProcedure
-  else
-  begin
-    fTokenID := tkTagArea;
-    repeat
-      inc(Run);
-    until IsLineEnd(Run);
-  end;
-end;
-
-procedure TSynCobolSyn.CommentProc;
-begin
-  fIndicator := #0;
-
-  if IsLineEnd(Run) then
-    NextProcedure
-  else
-  begin
-    fTokenID := tkComment;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run) or (Run > fCodeEndPos);
-  end;
-end;
-
-procedure TSynCobolSyn.DebugProc;
-begin
-  fIndicator := #0;
-
-  if IsLineEnd(Run) then
-    NextProcedure
-  else
-  begin
-    fTokenID := tkDebugLines;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run) or (Run > fCodeEndPos);
-  end;
-end;
-
-procedure TSynCobolSyn.PointProc;
-begin
-  if (Run < fCodeEndPos) and CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
-    NumberProc
-  else
-    UnknownProc;
-end;
-
-procedure TSynCobolSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E', '-', '+':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-var
-  fFloat: Boolean;
-begin
-  fTokenID := tkNumber;
-  Inc(Run);
-  fFloat := False;
-
-  while IsNumberChar and (Run <= fCodeEndPos) do
-  begin
-    case FLine[Run] of
-      '.':
-        if not CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
-          Break
-        else
-          fFloat := True;
-      'e', 'E':
-          if not CharInSet(FLine[Run - 1], ['0'..'9', '.']) then
-            Break
-          else fFloat := True;
-      '-', '+':
-        begin
-          if not fFloat or not CharInSet(FLine[Run - 1], ['e', 'E']) then
-            Break;
-        end;
-    end;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynCobolSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCobolSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
-    inc(Run);
-end;
-
-procedure TSynCobolSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynCobolSyn.StringOpenProc;
-begin
-  case fLine[Run] of
-    '"': fRange := rsQuoteString;
-    '''': fRange := rsApostString;
-    else
-      if fLine[Run + 1] = '=' then
-      begin
-        fRange := rsPseudoText;
-        Inc(Run);
-      end
-      else
-      begin
-        UnknownProc;
-        Exit;
-      end;
-  end;
-
-  Inc(Run);
-  StringProc;
-  fTokenID := tkString;
-end;
-
-procedure TSynCobolSyn.StringProc;
-begin
-  fTokenID := tkString;
-
-  if Run <= fCodeEndPos then
-  repeat
-    if (fLine[Run] = StringChars[fRange])
-      and ((fLine[Run] <> '=') or ((Run > 0) and (fLine[Run - 1] = '='))) then
-    begin
-      if (Run = fCodeEndPos) and (fRange in [rsQuoteString, rsApostString]) then
-        Inc(fRange, 3)
-      else
-        fRange := rsUnknown;
-      Inc(Run);
-      Break;
-    end;
-    if not IsLineEnd(Run) then
-      Inc(Run);
-  until IsLineEnd(Run) or (Run > fCodeEndPos);
-end;
-
-procedure TSynCobolSyn.StringEndProc;
-begin
-  if IsLineEnd(Run) then
-    NextProcedure
-  else
-  begin
-    fTokenID := tkString;
-
-    if (fRange <> rsPseudoText) and (Run <= fCodeEndPos) then
-    repeat
-      if (fLine[Run] = StringChars[fRange]) then
-      begin
-        if fRange in [rsQuoteString, rsApostString] then
-          Inc(Run)
-        else
-        begin
-          Inc(Run, 2);
-          Dec(fRange, 3);
-        end;
-        Break;
-      end;
-      Inc(Run);
-    until IsLineEnd(Run) or (Run > fCodeEndPos);
-
-    StringProc;
-  end;
-end;
-
-constructor TSynCobolSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fKeywords := TSynHashEntryList.Create;
-
-  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  fCommentAttri.Foreground := clGray;
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fAIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrAreaAIdentifier, SYNS_FriendlyAttrAreaAIdentifier);
-  fAIdentifierAttri.Foreground := clTeal;
-  fAIdentifierAttri.Style := [fsBold];
-  AddAttribute(fAIdentifierAttri);
-
-  fPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  fPreprocessorAttri.Foreground := clMaroon;
-  AddAttribute(fPreprocessorAttri);
-
-  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-
-  fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  fNumberAttri.Foreground := clGreen;
-  AddAttribute(fNumberAttri);
-
-  fBooleanAttri := TSynHighLighterAttributes.Create(SYNS_AttrBoolean, SYNS_FriendlyAttrBoolean);
-  fBooleanAttri.Foreground := clGreen;
-  AddAttribute(fBooleanAttri);
-
-  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  fStringAttri.Foreground := clBlue;
-  AddAttribute(fStringAttri);
-
-  fSequenceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSequence, SYNS_FriendlyAttrSequence);
-  fSequenceAttri.Foreground := clDkGray;
-  AddAttribute(fSequenceAttri);
-
-  fIndicatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrIndicator, SYNS_FriendlyAttrIndicator);
-  fIndicatorAttri.Foreground := clRed;
-  AddAttribute(fIndicatorAttri);
-
-  fTagAreaAttri := TSynHighLighterAttributes.Create(SYNS_AttrTagArea, SYNS_FriendlyAttrTagArea);
-  fTagAreaAttri.Foreground := clMaroon;
-  AddAttribute(fTagAreaAttri);
-
-  fDebugLinesAttri := TSynHighLighterAttributes.Create(SYNS_AttrDebugLines, SYNS_FriendlyAttrDebugLines);
-  fDebugLinesAttri.Foreground := clDkGray;
-  AddAttribute(fDebugLinesAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  fDefaultFilter := SYNS_FilterCOBOL;
-  fRange := rsUnknown;
-  fIndicator := #0;
-
-  fCodeStartPos := 7;
-  fCodeMediumPos := 11;
-  fCodeEndPos := 71;
-
-  EnumerateKeywords(Ord(tkBoolean), BooleanWords, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkPreprocessor), PreprocessorWords, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkString), StringWords, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkUnknown), AmbigiousWords, IsIdentChar, DoAddKeyword);
-end;
-
-destructor TSynCobolSyn.Destroy;
-begin
-  fKeywords.Free;
-  inherited Destroy;
-end;
-
-procedure TSynCobolSyn.IdentProc;
-begin
-  if CharInSet(fLine[Run], ['x', 'g', 'X', 'G'])
-    and (Run < fCodeEndPos) and CharInSet(fLine[Run + 1], ['"', '''']) then
-  begin
-    Inc(Run);
-    StringOpenProc;
-  end
-  else
-  begin
-    fTokenID := IdentKind((fLine + Run));
-    if (fTokenID = tkIdentifier) and (Run < fCodeMediumPos) then
-      fTokenID := tkAIdentifier;
-    inc(Run, fStringLen);
-
-    while IsIdentChar(fLine[Run]) and (Run <= fCodeEndPos) do
-      Inc(Run);
-  end;
-end;
-
-procedure TSynCobolSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynCobolSyn.Next;
-begin
-  fTokenPos := Run;
-
-  if fTokenPos < fCodeStartPos then
-    FirstCharsProc
-  else
-    case fIndicator of
-      '*', '/': CommentProc;
-      'D', 'd': DebugProc;
-      else
-        if fTokenPos > fCodeEndPos then
-          LastCharsProc
-        else
-          case fRange of
-            rsQuoteString..rsApostStringMayBe: StringEndProc;
-          else
-            begin
-              fRange := rsUnknown;
-              NextProcedure;
-            end;
-          end;
-    end;
-  inherited;
-end;
-
-procedure TSynCobolSyn.NextProcedure;
-begin
-  case fLine[Run] of
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    '"': StringOpenProc;
-    '''': StringOpenProc;
-    '=': StringOpenProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '.': PointProc;
-    '0'..'9': NumberProc;
-    'A'..'Z', 'a'..'z': IdentProc;
-    else UnknownProc;
-  end;
-end;
-
-function TSynCobolSyn.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 TSynCobolSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCobolSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynCobolSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkAIdentifier: Result := fAIdentifierAttri;
-    tkPreprocessor: Result := fPreprocessorAttri;
-    tkKey: Result := fKeyAttri;
-    tkBoolean: Result := fBooleanAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSequence: Result := fSequenceAttri;
-    tkIndicator: Result := fIndicatorAttri;
-    tkTagArea: Result := fTagAreaAttri;
-    tkDebugLines: Result := fDebugLinesAttri;
-    tkUnknown: Result := fIdentifierAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynCobolSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynCobolSyn.GetSampleSource: string;
-begin
-  Result := '000100* This is a sample file to be used to show all TSynCobolSyn''s'#13#10 +
-            '000200* features.'#13#10 +
-            '000300* This isn''t a valid COBOL program.'#13#10 +
-            '000400'#13#10 +
-            '000500* 1. Supported COBOL features.'#13#10 +
-            '000600'#13#10 +
-            '000700* 1.1  Sequence area.'#13#10 +
-            '000800*    First six columns in COBOL are reserved for enumeration'#13#10 +
-            '000900*    of source lines.'#13#10 +
-            '001000* 1.2  Indicator area.'#13#10 +
-            '001100*    7th column in COBOL is reserved for special markers like ''*'''#13#10 +
-            '001200*    or ''D''.'#13#10 +
-            '001300* 1.3  Comment lines.'#13#10 +
-            '001400*    Any line started from ''*'' in 7th column is a comment.'#13#10 +
-            '001500*    No separate word highlighting will be done by the editor.'#13#10 +
-            '001600* 1.4  Debug lines.'#13#10 +
-            '001700D    Any line started from ''D'' will be treated as containing debug'#13#10 +
-            '001800D    commands. No separate word highlighting will be done'#13#10 +
-            '001900D    by the editor.'#13#10 +
-            '002000* 1.5  Tag area.'#13#10 +
-            '002100*    Only columns from 8th till 72th can be used for COBOL        TAG_AREA'#13#10 +
-            '002200*    program. Columns beyond the 72th one may be used by some     TAG_AREA'#13#10 +
-            '002300*    COBOL compilers to tag the code in some internal way.        TAG_AREA'#13#10 +
-            '002400* 1.6  Area A identifiers.'#13#10 +
-            '002500*    In area A (from 8th column till'#13#10 +
-            '002600*    11th one) you should type only sections''/paragraphs'' names.'#13#10 +
-            '002700*    For example "SOME" is a section name:'#13#10 +
-            '002800 SOME SECTION.'#13#10 +
-            '002900* 1.7  Preprocessor directives.'#13#10 +
-            '003000*    For example "COPY" is a preprocessor directive:'#13#10 +
-            '003100     COPY "PRD-DATA.SEL".'#13#10 +
-            '003200* 1.8  Key words.'#13#10 +
-            '003300*    For example "ACCEPT" and "AT" are COBOL key words:'#13#10 +
-            '003400     ACCEPT WS-ENTRY AT 2030.'#13#10 +
-            '003500* 1.9  Boolean constants.'#13#10 +
-            '003600*    These are "TRUE" and "FALSE" constants. For example:'#13#10 +
-            '003700     EVALUATE TRUE.'#13#10 +
-            '003800* 1.10 Numbers.'#13#10 +
-            '003900*    Here are the examples of numbers:'#13#10 +
-            '004000 01  WSV-TEST-REC.'#13#10 +
-            '004100     03  WSV-INT-T	       PIC 9(5) VALUE 12345.'#13#10 +
-            '004200     03  WSV-PRICES              PIC 9(4)V99 COMP-3 VALUE 0000.33. 		'#13#10 +
-            '004300     03  WSV-Z-PRICES            PIC Z(5)9.99- VALUE -2.12. 		'#13#10 +
-            '004400     03  WSV-STORE-DATE          PIC 9(4)V99E99 VALUE 0001.33E02.'#13#10 +
-            '004500* 1.11 Strings.'#13#10 +
-            '004600*    The following types of strings are supported:'#13#10 +
-            '004700*    1.11.1 Quoted strings.'#13#10 +
-            '004800         MOVE "The name of field is ""PRODUCT""" TO WS-ERR-MESS.'#13#10 +
-            '004900         MOVE ''The name of field is ''''PRODUCT'''''' TO WS-ERR-MESS.'#13#10 +
-            '005000*    1.11.2 Pseudo-text.'#13#10 +
-            '005100         COPY'#13#10 +
-            '005200             REPLACING ==+00001== BY  +2'#13#10 +
-            '005300                       == 1 ==    BY  -3.'#13#10 +
-            '005400*    1.11.3 Figurative constants.'#13#10 +
-            '005500*        For example "SPACES" is figurative constant:'#13#10 +
-            '005600             DISPLAY SPACES UPON CRT.'#13#10 +
-            '005700* 1.12 Continued lines.'#13#10 +
-            '005800*    Only continued strings are supported. For example:'#13#10 +
-            '005900         MOVE "The name of figurative constant field is'#13#10 +
-            '006000-"SPACES" TO WS-ERR-MESS.'#13#10 +
-            '006100*    Or (a single quotation mark in 72th column):'#13#10 +
-            '005900         MOVE "The name of figurative constant field is  ""SPACES"'#13#10 +
-            '006000-""" TO WS-ERR-MESS.'#13#10 +
-            '006100'#13#10 +
-            '006200* 2. Unsupported COBOL features.'#13#10 +
-            '006300'#13#10 +
-            '006400* 2.1 Continued lines.'#13#10 +
-            '006500*    Continuation of key words is not supported. For example,'#13#10 +
-            '006600*    the following COBOL code is valid but TSynCobolSyn won''t'#13#10 +
-            '006700*    highlight "VALUE" keyword properly:'#13#10 +
-            '006800     03  WSV-STORE-DATE                         PIC 9(4)V99E99 VAL'#13#10 +
-            '006900-UE 0001.33E02.'#13#10 +
-            '007000* 2.2 Identifiers started from digits.'#13#10 +
-            '007100*    They are valid in COBOL but won''t be highlighted properly'#13#10 +
-            '007200*    by TSynCobolSyn. For example, "000-main" is a paragraph'#13#10 +
-            '007300*    name and should be highlighted as Area A identifier:'#13#10 +
-            '007400 000-main.'#13#10 +
-            '007500* 2.3 Comment entries in optional paragraphs'#13#10 +
-            '007600*    The so called comment-entries in the optional paragraphs'#13#10 +
-            '007700*    of the Identification Division are not supported and won''t'#13#10 +
-            '007800*    be highlighted properly.';
-end;
-
-function TSynCobolSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCOBOL;
-end;
-
-function TSynCobolSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '-', '0'..'9', 'a'..'z', 'A'..'Z':
-      Result := True;
-    else
-      Result := False;              
-  end;
-end;
-
-procedure TSynCobolSyn.SetCodeStartPos(Value: Integer);
-begin
-  if Value < fCodeMediumPos then
-    fCodeStartPos := Value
-  else
-    fCodeStartPos := fCodeMediumPos;
-end;
-
-procedure TSynCobolSyn.SetCodeMediumPos(Value: Integer);
-begin
-  if (fCodeStartPos <= Value) and (Value <= fCodeEndPos) then
-    fCodeMediumPos := Value
-  else
-    if Value > fCodeEndPos
-    then fCodeMediumPos := fCodeEndPos
-    else fCodeMediumPos := fCodeStartPos;
-end;
-
-procedure TSynCobolSyn.SetCodeEndPos(Value: Integer);
-begin
-  if Value > fCodeMediumPos then
-    fCodeEndPos := Value
-  else
-    fCodeEndPos := fCodeMediumPos;
-end;
-
-class function TSynCobolSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCOBOL;
-end;
-
-procedure TSynCobolSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynCobolSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynCobolSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-class function TSynCobolSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCOBOL;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCobolSyn);
-end.
+{-------------------------------------------------------------------------------
+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: SynHighlighterCobol.pas, released 2002-08-26.
+Description: COBOL Syntax Parser/Highlighter
+The author of this file is Andrey Ustinov.
+Copyright (c) 2002 Software Mining, http://www.softwaremining.com/.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCobol.pas,v 1.5.2.7 2008/09/14 16:24:59 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+-------------------------------------------------------------------------------}
+
+unit SynHighlighterCobol;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynHighlighterHashEntries,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (
+    tkComment,
+    tkIdentifier,
+    tkAIdentifier,
+    tkPreprocessor,
+    tkKey,
+    tkBoolean,
+    tkNull,
+    tkNumber,
+    tkSpace,
+    tkString,
+    tkSequence,
+    tkIndicator,
+    tkTagArea,
+    tkDebugLines,
+    tkUnknown);
+
+  TRangeState = (rsUnknown,
+                 rsQuoteString, rsApostString,
+                 rsPseudoText,
+                 rsQuoteStringMayBe, rsApostStringMayBe);
+
+type
+  TSynCobolSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FIndicator: WideChar;
+
+    FCodeStartPos: LongInt;
+    FCodeMediumPos: LongInt;
+    FCodeEndPos: LongInt;
+
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FAIdentifierAttri: TSynHighlighterAttributes;
+    FPreprocessorAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FBooleanAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSequenceAttri: TSynHighlighterAttributes;
+    FIndicatorAttri: TSynHighlighterAttributes;
+    FTagAreaAttri: TSynHighlighterAttributes;
+    FDebugLinesAttri: TSynHighlighterAttributes;
+    FKeywords: TSynHashEntryList;
+    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    function HashKey(Str: PWideChar): Integer;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure IdentProc;
+    procedure UnknownProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure CRProc;
+    procedure LFProc;
+    procedure NumberProc;
+    procedure PointProc;
+    procedure StringOpenProc;
+    procedure StringProc;
+    procedure StringEndProc;
+    procedure FirstCharsProc;
+    procedure LastCharsProc;
+    procedure CommentProc;
+    procedure DebugProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+    procedure NextProcedure;
+
+    procedure SetCodeStartPos(Value: LongInt);
+    procedure SetCodeMediumPos(Value: LongInt);
+    procedure SetCodeEndPos(Value: LongInt);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+    function GetRange: Pointer; override;
+    procedure ResetRange; override;
+    procedure SetRange(Value: Pointer); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
+    property AreaAIdentifierAttri: TSynHighlighterAttributes read FAIdentifierAttri write FAIdentifierAttri;
+    property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
+    property BooleanAttri: TSynHighlighterAttributes read FBooleanAttri write FBooleanAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+    property SequenceAttri: TSynHighlighterAttributes read FSequenceAttri write FSequenceAttri;
+    property IndicatorAttri: TSynHighlighterAttributes read FIndicatorAttri write FIndicatorAttri;
+    property TagAreaAttri: TSynHighlighterAttributes read FTagAreaAttri write FTagAreaAttri;
+    property DebugLinesAttri: TSynHighlighterAttributes read FDebugLinesAttri write FDebugLinesAttri;
+
+    property AreaAStartPos: LongInt read FCodeStartPos write SetCodeStartPos;
+    property AreaBStartPos: LongInt read FCodeMediumPos write SetCodeMediumPos;
+    property CodeEndPos: LongInt read FCodeEndPos write SetCodeEndPos;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  BooleanWords: UnicodeString =
+    'false, true';
+
+  KeyWords: UnicodeString =
+    'accept, access, acquire, add, address, advancing, after, all, allowing, ' +
+    'alphabet, alphabetic, alphabetic-lower, alphabetic-upper, alphanumeric, ' +
+    'alphanumeric-edited, also, alter, alternate, and, any, apply, are, ' +
+    'area, areas, area-value, arithmetic, ascending, assign, at, author, ' +
+    'auto, automatic, auto-skip, background-color, background-colour, ' +
+    'backward, b-and, beep, before, beginning, bell, b-exor, binary, bit, ' +
+    'bits, blank, b-less, blink, block, b-not, boolean, b-or, bottom, by, ' +
+    'call, cancel, cd, cf, ch, chain, chaining, changed, character, ' +
+    'characters, class, clock-units, close, cobol, code, code-set, col, ' +
+    'collating, color, column, comma, command-line, commit, commitment, ' +
+    'common, communication, comp, comp-0, comp-1, comp-2, comp-3, comp-4, ' +
+    'comp-5, comp-6, comp-7, comp-8, comp-9, computational, computational-0, ' +
+    'computational-1, computational-2, computational-3, computational-4, ' +
+    'computational-5, computational-6, computational-7, computational-8, ' +
+    'computational-9, computational-x, compute, comp-x, com-reg, ' +
+    'configuration, connect, console, contained, contains, content, ' +
+    'continue, control-area, controls, converting, corr, corresponding, ' +
+    'count, crt, crt-under, currency, current, cursor, cycle, data, date, ' +
+    'date-compiled, date-written, day, day-of-week, db, ' +
+    'db-access-control-key, dbcs, db-data-name, db-exception, ' +
+    'db-format-name, db-record-name, db-set-name, db-status, de, ' +
+    'debug-contents, debugging, debug-item, debug-line, debug-name, ' +
+    'debug-sub-1, debug-sub-2, debug-sub-3, decimal-point, declaratives, ' +
+    'default, delimited, delimiter, depending, descending, destination, ' +
+    'detail, disable, disconnect, disk, display, display-1, display-2, ' +
+    'display-3, display-4, display-5, display-6, display-7, display-8, ' +
+    'display-9, divide, division, down, drop, duplicate, duplicates, ' +
+    'dynamic, egcs, egi, else, emi, empty, empty-check, enable, end, ' +
+    'end-accept, end-add, end-call, end-compute, end-delete, end-disable, ' +
+    'end-divide, end-enable, end-evaluate, end-if, ending, end-multiply, ' +
+    'end-of-page, end-perform, end-read, end-receive, end-return, ' +
+    'end-rewrite, end-search, end-send, end-start, end-string, end-subtract, ' +
+    'end-transceive, end-unstring, end-write, enter, entry, environment, ' +
+    'eop, equal, equals, erase, error, escape, esi, evaluate, every, exact, ' +
+    'exceeds, exception, excess-3, exclusive, exec, execute, exhibit, exit, ' +
+    'extend, external, externally-described-key, fd, fetch, file, ' +
+    'file-control, file-id, filler, final, find, finish, first, fixed, ' +
+    'footing, for, foreground-color, foreground-colour, form, format, free, ' +
+    'from, full, function, generate, get, giving, global, go, goback, ' +
+    'greater, group, heading, highlight, id, identification, if, in, index, ' +
+    'index-1, index-2, index-3, index-4, index-5, index-6, index-7, index-8, ' +
+    'index-9, indexed, indic, indicate, indicator, indicators, initial, ' +
+    'initialize, initiate, input, input-output, inspect, installation, into, ' +
+    'invalid, i-o, i-o-control, is, japanese, just, justified, kanji, keep, ' +
+    'kept, key, keyboard, last, ld, leading, left, left-justify, length, ' +
+    'length-check, less, like, limit, limits, linage, linage-counter, line, ' +
+    'line-counter, lines, linkage, locally, lock, manual, member, memory, ' +
+    'merge, message, mode, modified, modify, modules, more-labels, move, ' +
+    'multiple, multiply, name, native, negative, next, no, no-echo, none, ' +
+    'normal, not, number, numeric, numeric-edited, object-computer, occurs, ' +
+    'of, off, omitted, on, only, open, optional, or, order, organization, ' +
+    'other, output, overflow, owner, packed-decimal, padding, page, ' +
+    'page-counter, palette, paragraph, password, perform, pf, ph, pic, ' +
+    'picture, plus, pointer, position, positive, present, previous, printer, ' +
+    'printer-1, printing, print-switch, prior, procedure, procedures, ' +
+    'proceed, process, processing, program, program-id, prompt, protected, ' +
+    'purge, queue, random, range, rd, read, realm, receive, reconnect, ' +
+    'record, recording, record-name, records, redefines, reel, reference, ' +
+    'references, relation, relative, release, remainder, removal, renames, ' +
+    'repeated, replacing, report, reporting, reports, required, rerun, ' +
+    'reserve, retaining, retrieval, return, return-code, reversed, ' +
+    'reverse-video, rewind, rewrite, rf, rh, right, right-justify, rollback, ' +
+    'rolling, rounded, run, same, screen, sd, search, section, secure, ' +
+    'security, segment, segment-limit, select, send, sentence, separate, ' +
+    'sequence, sequential, session-id, set, shared, shift-in, shift-out, ' +
+    'sign, size, sort, sort-control, sort-core-size, sort-file-size, ' +
+    'sort-merge, sort-message, sort-mode-size, sort-return, source, ' +
+    'source-computer, space-fill, special-names, standard, standard-1, ' +
+    'standard-2, standard-3, standard-4, start, starting, status, stop, ' +
+    'store, string, subfile, subprogram, sub-queue-1, sub-queue-2, ' +
+    'sub-queue-3, sub-schema, subtract, sum, suppress, switch, switch-1, ' +
+    'switch-2, switch-3, switch-4, switch-5, switch-6, switch-7, switch-8, ' +
+    'symbolic, sync, synchronized, table, tally, tallying, tape, tenant, ' +
+    'terminal, terminate, test, text, than, then, through, thru, time, ' +
+    'timeout, times, to, top, trailing, trailing-sign, transaction, ' +
+    'transceive, type, underline, unequal, unit, unlock, unstring, until, ' +
+    'up, update, upon, usage, usage-mode, user, using, valid, validate, ' +
+    'value, values, variable, varying, wait, when, when-compiled, with, ' +
+    'within, words, working-storage, write, write-only, zero-fill';
+
+  PreprocessorWords: UnicodeString =
+    'basis, cbl, control, copy, delete, eject, insert, ready, reload, ' +
+    'replace, reset, service, skip1, skip2, skip3, title, trace, use';
+
+  StringWords: UnicodeString =
+    'high-value, high-values, low-value, low-values, null, nulls, quote, ' +
+    'quotes, space, spaces, zero, zeroes, zeros';
+
+  // Ambigious means that a simple string comparision is not enough
+  AmbigiousWords: UnicodeString =
+    'label';
+
+const
+  StringChars: array[TRangeState] of WideChar = (#0, '"', '''', '=',  '"', '''');
+
+procedure TSynCobolSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Integer;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+function TSynCobolSyn.HashKey(Str: PWideChar): Integer;
+var
+  InternalRun: LongInt;
+
+  function GetOrd: Integer;
+  begin
+    case Str^ of
+      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
+      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
+      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
+      '-': Result := 27;
+      else Result := 0;
+    end
+  end;
+
+begin
+  InternalRun := Run;
+  Result := 0;
+
+  while IsIdentChar(Str^) and (InternalRun <= FCodeEndPos) do
+  begin
+{$IFOPT Q-}
+    Result := 7 * Result + GetOrd;
+{$ELSE}
+    Result := (7 * Result + GetOrd) and $FFFFFF;
+{$ENDIF}
+    Inc(Str);
+    Inc(InternalRun);
+  end;
+
+  Result := Result and $FF; // 255
+  FStringLen := Str - FToIdent;
+end;
+
+function TSynCobolSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Entry: TSynHashEntry;
+  I: Integer;
+begin
+  FToIdent := MayBe;
+  Entry := FKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+
+        if Result = tkUnknown then // handling of "ambigious" words 
+        begin
+          if IsCurrentToken('label') then
+          begin
+            I := Run + Length('label');
+            while FLine[I] = ' ' do
+              Inc(I);
+            if (WStrLComp(PWideChar(@FLine[I]), 'record', Length('record')) = 0)
+              and (I + Length('record') - 1 <= FCodeEndPos) then
+                Result := tkKey
+              else
+                Result := tkPreprocessor;
+          end
+          else
+            Result := tkIdentifier;
+        end;
+        
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+  Result := tkIdentifier;
+end;
+
+procedure TSynCobolSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  repeat
+    Inc(Run);
+  until not CharInSet(FLine[Run], [#1..#32]);
+end;
+
+procedure TSynCobolSyn.FirstCharsProc;
+var
+  I: Integer;
+begin
+  if IsLineEnd(Run) then
+    NextProcedure
+  else if Run < FCodeStartPos - 1 then
+  begin
+    FTokenID := tkSequence;
+    repeat
+      Inc(Run);
+    until (Run = FCodeStartPos - 1) or IsLineEnd(Run);
+  end
+  else
+  begin
+    FTokenID := tkIndicator;
+    case FLine[Run] of
+      '*', '/', 'D', 'd': FIndicator := FLine[Run];
+      '-': if FRange in [rsQuoteStringMayBe, rsApostStringMayBe] then
+           begin
+             I := Run + 1;
+             while FLine[I] = ' ' do
+               Inc(I);
+             if (WStrLComp(PWideChar(@FLine[I]), PWideChar(UnicodeStringOfChar(StringChars[FRange], 2)), 2) <> 0)
+               or (I + 1 > FCodeEndPos) then
+                 FRange := rsUnknown;
+           end;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynCobolSyn.LastCharsProc;
+begin
+  if IsLineEnd(Run) then
+    NextProcedure
+  else
+  begin
+    FTokenID := tkTagArea;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end;
+end;
+
+procedure TSynCobolSyn.CommentProc;
+begin
+  FIndicator := #0;
+
+  if IsLineEnd(Run) then
+    NextProcedure
+  else
+  begin
+    FTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run) or (Run > FCodeEndPos);
+  end;
+end;
+
+procedure TSynCobolSyn.DebugProc;
+begin
+  FIndicator := #0;
+
+  if IsLineEnd(Run) then
+    NextProcedure
+  else
+  begin
+    FTokenID := tkDebugLines;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run) or (Run > FCodeEndPos);
+  end;
+end;
+
+procedure TSynCobolSyn.PointProc;
+begin
+  if (Run < FCodeEndPos) and CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
+    NumberProc
+  else
+    UnknownProc;
+end;
+
+procedure TSynCobolSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'e', 'E', '-', '+':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+var
+  fFloat: Boolean;
+begin
+  FTokenID := tkNumber;
+  Inc(Run);
+  fFloat := False;
+
+  while IsNumberChar and (Run <= FCodeEndPos) do
+  begin
+    case FLine[Run] of
+      '.':
+        if not CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
+          Break
+        else
+          fFloat := True;
+      'e', 'E':
+          if not CharInSet(FLine[Run - 1], ['0'..'9', '.']) then
+            Break
+          else fFloat := True;
+      '-', '+':
+        begin
+          if not fFloat or not CharInSet(FLine[Run - 1], ['e', 'E']) then
+            Break;
+        end;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynCobolSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCobolSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end;
+
+procedure TSynCobolSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynCobolSyn.StringOpenProc;
+begin
+  case FLine[Run] of
+    '"': FRange := rsQuoteString;
+    '''': FRange := rsApostString;
+    else
+      if FLine[Run + 1] = '=' then
+      begin
+        FRange := rsPseudoText;
+        Inc(Run);
+      end
+      else
+      begin
+        UnknownProc;
+        Exit;
+      end;
+  end;
+
+  Inc(Run);
+  StringProc;
+  FTokenID := tkString;
+end;
+
+procedure TSynCobolSyn.StringProc;
+begin
+  FTokenID := tkString;
+
+  if Run <= FCodeEndPos then
+  repeat
+    if (FLine[Run] = StringChars[FRange])
+      and ((FLine[Run] <> '=') or ((Run > 0) and (FLine[Run - 1] = '='))) then
+    begin
+      if (Run = FCodeEndPos) and (FRange in [rsQuoteString, rsApostString]) then
+        Inc(FRange, 3)
+      else
+        FRange := rsUnknown;
+      Inc(Run);
+      Break;
+    end;
+    if not IsLineEnd(Run) then
+      Inc(Run);
+  until IsLineEnd(Run) or (Run > FCodeEndPos);
+end;
+
+procedure TSynCobolSyn.StringEndProc;
+begin
+  if IsLineEnd(Run) then
+    NextProcedure
+  else
+  begin
+    FTokenID := tkString;
+
+    if (FRange <> rsPseudoText) and (Run <= FCodeEndPos) then
+    repeat
+      if (FLine[Run] = StringChars[FRange]) then
+      begin
+        if FRange in [rsQuoteString, rsApostString] then
+          Inc(Run)
+        else
+        begin
+          Inc(Run, 2);
+          Dec(FRange, 3);
+        end;
+        Break;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run) or (Run > FCodeEndPos);
+
+    StringProc;
+  end;
+end;
+
+constructor TSynCobolSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FKeywords := TSynHashEntryList.Create;
+
+  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  FCommentAttri.Foreground := clGray;
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FAIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrAreaAIdentifier, SYNS_FriendlyAttrAreaAIdentifier);
+  FAIdentifierAttri.Foreground := clTeal;
+  FAIdentifierAttri.Style := [fsBold];
+  AddAttribute(FAIdentifierAttri);
+
+  FPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  FPreprocessorAttri.Foreground := clMaroon;
+  AddAttribute(FPreprocessorAttri);
+
+  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FNumberAttri.Foreground := clGreen;
+  AddAttribute(FNumberAttri);
+
+  FBooleanAttri := TSynHighLighterAttributes.Create(SYNS_AttrBoolean, SYNS_FriendlyAttrBoolean);
+  FBooleanAttri.Foreground := clGreen;
+  AddAttribute(FBooleanAttri);
+
+  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  FStringAttri.Foreground := clBlue;
+  AddAttribute(FStringAttri);
+
+  FSequenceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSequence, SYNS_FriendlyAttrSequence);
+  FSequenceAttri.Foreground := clDkGray;
+  AddAttribute(FSequenceAttri);
+
+  FIndicatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrIndicator, SYNS_FriendlyAttrIndicator);
+  FIndicatorAttri.Foreground := clRed;
+  AddAttribute(FIndicatorAttri);
+
+  FTagAreaAttri := TSynHighLighterAttributes.Create(SYNS_AttrTagArea, SYNS_FriendlyAttrTagArea);
+  FTagAreaAttri.Foreground := clMaroon;
+  AddAttribute(FTagAreaAttri);
+
+  FDebugLinesAttri := TSynHighLighterAttributes.Create(SYNS_AttrDebugLines, SYNS_FriendlyAttrDebugLines);
+  FDebugLinesAttri.Foreground := clDkGray;
+  AddAttribute(FDebugLinesAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  FDefaultFilter := SYNS_FilterCOBOL;
+  FRange := rsUnknown;
+  FIndicator := #0;
+
+  FCodeStartPos := 7;
+  FCodeMediumPos := 11;
+  FCodeEndPos := 71;
+
+  EnumerateKeywords(Ord(tkBoolean), BooleanWords, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkPreprocessor), PreprocessorWords, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkString), StringWords, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkUnknown), AmbigiousWords, IsIdentChar, DoAddKeyword);
+end;
+
+destructor TSynCobolSyn.Destroy;
+begin
+  FKeywords.Free;
+  inherited Destroy;
+end;
+
+procedure TSynCobolSyn.IdentProc;
+begin
+  if CharInSet(FLine[Run], ['x', 'g', 'X', 'G'])
+    and (Run < FCodeEndPos) and CharInSet(FLine[Run + 1], ['"', '''']) then
+  begin
+    Inc(Run);
+    StringOpenProc;
+  end
+  else
+  begin
+    FTokenID := IdentKind((FLine + Run));
+    if (FTokenID = tkIdentifier) and (Run < FCodeMediumPos) then
+      FTokenID := tkAIdentifier;
+    Inc(Run, FStringLen);
+
+    while IsIdentChar(FLine[Run]) and (Run <= FCodeEndPos) do
+      Inc(Run);
+  end;
+end;
+
+procedure TSynCobolSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynCobolSyn.Next;
+begin
+  FTokenPos := Run;
+
+  if FTokenPos < FCodeStartPos then
+    FirstCharsProc
+  else
+    case FIndicator of
+      '*', '/': CommentProc;
+      'D', 'd': DebugProc;
+      else
+        if FTokenPos > FCodeEndPos then
+          LastCharsProc
+        else
+          case FRange of
+            rsQuoteString..rsApostStringMayBe: StringEndProc;
+          else
+            begin
+              FRange := rsUnknown;
+              NextProcedure;
+            end;
+          end;
+    end;
+  inherited;
+end;
+
+procedure TSynCobolSyn.NextProcedure;
+begin
+  case FLine[Run] of
+    #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    '"': StringOpenProc;
+    '''': StringOpenProc;
+    '=': StringOpenProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    '.': PointProc;
+    '0'..'9': NumberProc;
+    'A'..'Z', 'a'..'z': IdentProc;
+    else UnknownProc;
+  end;
+end;
+
+function TSynCobolSyn.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 TSynCobolSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCobolSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynCobolSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkAIdentifier: Result := FAIdentifierAttri;
+    tkPreprocessor: Result := FPreprocessorAttri;
+    tkKey: Result := FKeyAttri;
+    tkBoolean: Result := FBooleanAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSequence: Result := FSequenceAttri;
+    tkIndicator: Result := FIndicatorAttri;
+    tkTagArea: Result := FTagAreaAttri;
+    tkDebugLines: Result := FDebugLinesAttri;
+    tkUnknown: Result := FIdentifierAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynCobolSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynCobolSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '000100* This is a sample file to be used to show all TSynCobolSyn''s'#13#10 +
+            '000200* features.'#13#10 +
+            '000300* This isn''t a valid COBOL program.'#13#10 +
+            '000400'#13#10 +
+            '000500* 1. Supported COBOL features.'#13#10 +
+            '000600'#13#10 +
+            '000700* 1.1  Sequence area.'#13#10 +
+            '000800*    First six columns in COBOL are reserved for enumeration'#13#10 +
+            '000900*    of source lines.'#13#10 +
+            '001000* 1.2  Indicator area.'#13#10 +
+            '001100*    7th column in COBOL is reserved for special markers like ''*'''#13#10 +
+            '001200*    or ''D''.'#13#10 +
+            '001300* 1.3  Comment lines.'#13#10 +
+            '001400*    Any line started from ''*'' in 7th column is a comment.'#13#10 +
+            '001500*    No separate word highlighting will be done by the editor.'#13#10 +
+            '001600* 1.4  Debug lines.'#13#10 +
+            '001700D    Any line started from ''D'' will be treated as containing debug'#13#10 +
+            '001800D    commands. No separate word highlighting will be done'#13#10 +
+            '001900D    by the editor.'#13#10 +
+            '002000* 1.5  Tag area.'#13#10 +
+            '002100*    Only columns from 8th till 72th can be used for COBOL        TAG_AREA'#13#10 +
+            '002200*    program. Columns beyond the 72th one may be used by some     TAG_AREA'#13#10 +
+            '002300*    COBOL compilers to tag the code in some internal way.        TAG_AREA'#13#10 +
+            '002400* 1.6  Area A identifiers.'#13#10 +
+            '002500*    In area A (from 8th column till'#13#10 +
+            '002600*    11th one) you should type only sections''/paragraphs'' names.'#13#10 +
+            '002700*    For example "SOME" is a section name:'#13#10 +
+            '002800 SOME SECTION.'#13#10 +
+            '002900* 1.7  Preprocessor directives.'#13#10 +
+            '003000*    For example "COPY" is a preprocessor directive:'#13#10 +
+            '003100     COPY "PRD-DATA.SEL".'#13#10 +
+            '003200* 1.8  Key words.'#13#10 +
+            '003300*    For example "ACCEPT" and "AT" are COBOL key words:'#13#10 +
+            '003400     ACCEPT WS-ENTRY AT 2030.'#13#10 +
+            '003500* 1.9  Boolean constants.'#13#10 +
+            '003600*    These are "TRUE" and "FALSE" constants. For example:'#13#10 +
+            '003700     EVALUATE TRUE.'#13#10 +
+            '003800* 1.10 Numbers.'#13#10 +
+            '003900*    Here are the examples of numbers:'#13#10 +
+            '004000 01  WSV-TEST-REC.'#13#10 +
+            '004100     03  WSV-INT-T	       PIC 9(5) VALUE 12345.'#13#10 +
+            '004200     03  WSV-PRICES              PIC 9(4)V99 COMP-3 VALUE 0000.33. 		'#13#10 +
+            '004300     03  WSV-Z-PRICES            PIC Z(5)9.99- VALUE -2.12. 		'#13#10 +
+            '004400     03  WSV-STORE-DATE          PIC 9(4)V99E99 VALUE 0001.33E02.'#13#10 +
+            '004500* 1.11 Strings.'#13#10 +
+            '004600*    The following types of strings are supported:'#13#10 +
+            '004700*    1.11.1 Quoted strings.'#13#10 +
+            '004800         MOVE "The name of field is ""PRODUCT""" TO WS-ERR-MESS.'#13#10 +
+            '004900         MOVE ''The name of field is ''''PRODUCT'''''' TO WS-ERR-MESS.'#13#10 +
+            '005000*    1.11.2 Pseudo-text.'#13#10 +
+            '005100         COPY'#13#10 +
+            '005200             REPLACING ==+00001== BY  +2'#13#10 +
+            '005300                       == 1 ==    BY  -3.'#13#10 +
+            '005400*    1.11.3 Figurative constants.'#13#10 +
+            '005500*        For example "SPACES" is figurative constant:'#13#10 +
+            '005600             DISPLAY SPACES UPON CRT.'#13#10 +
+            '005700* 1.12 Continued lines.'#13#10 +
+            '005800*    Only continued strings are supported. For example:'#13#10 +
+            '005900         MOVE "The name of figurative constant field is'#13#10 +
+            '006000-"SPACES" TO WS-ERR-MESS.'#13#10 +
+            '006100*    Or (a single quotation mark in 72th column):'#13#10 +
+            '005900         MOVE "The name of figurative constant field is  ""SPACES"'#13#10 +
+            '006000-""" TO WS-ERR-MESS.'#13#10 +
+            '006100'#13#10 +
+            '006200* 2. Unsupported COBOL features.'#13#10 +
+            '006300'#13#10 +
+            '006400* 2.1 Continued lines.'#13#10 +
+            '006500*    Continuation of key words is not supported. For example,'#13#10 +
+            '006600*    the following COBOL code is valid but TSynCobolSyn won''t'#13#10 +
+            '006700*    highlight "VALUE" keyword properly:'#13#10 +
+            '006800     03  WSV-STORE-DATE                         PIC 9(4)V99E99 VAL'#13#10 +
+            '006900-UE 0001.33E02.'#13#10 +
+            '007000* 2.2 Identifiers started from digits.'#13#10 +
+            '007100*    They are valid in COBOL but won''t be highlighted properly'#13#10 +
+            '007200*    by TSynCobolSyn. For example, "000-main" is a paragraph'#13#10 +
+            '007300*    name and should be highlighted as Area A identifier:'#13#10 +
+            '007400 000-main.'#13#10 +
+            '007500* 2.3 Comment entries in optional paragraphs'#13#10 +
+            '007600*    The so called comment-entries in the optional paragraphs'#13#10 +
+            '007700*    of the Identification Division are not supported and won''t'#13#10 +
+            '007800*    be highlighted properly.';
+end;
+
+function TSynCobolSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCOBOL;
+end;
+
+function TSynCobolSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '-', '0'..'9', 'a'..'z', 'A'..'Z':
+      Result := True;
+    else
+      Result := False;              
+  end;
+end;
+
+procedure TSynCobolSyn.SetCodeStartPos(Value: LongInt);
+begin
+  if Value < FCodeMediumPos then
+    FCodeStartPos := Value
+  else
+    FCodeStartPos := FCodeMediumPos;
+end;
+
+procedure TSynCobolSyn.SetCodeMediumPos(Value: LongInt);
+begin
+  if (FCodeStartPos <= Value) and (Value <= FCodeEndPos) then
+    FCodeMediumPos := Value
+  else
+    if Value > FCodeEndPos
+    then FCodeMediumPos := FCodeEndPos
+    else FCodeMediumPos := FCodeStartPos;
+end;
+
+procedure TSynCobolSyn.SetCodeEndPos(Value: LongInt);
+begin
+  if Value > FCodeMediumPos then
+    FCodeEndPos := Value
+  else
+    FCodeEndPos := FCodeMediumPos;
+end;
+
+class function TSynCobolSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCOBOL;
+end;
+
+procedure TSynCobolSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynCobolSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynCobolSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+class function TSynCobolSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCOBOL;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCobolSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCpp.pas b/Source/VCL/SynEdit/Source/SynHighlighterCpp.pas
index 2d5d0a7f..89162f68 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCpp.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCpp.pas
@@ -1,1790 +1,1553 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCpp.pas, released 2000-04-10.
-The Original Code is based on the dcjCppSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Michael Trier.
-Unicode translation by Maël Hörz.
-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: SynHighlighterCpp.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a C++ syntax highlighter for SynEdit)
-@author(Michael Trier)
-@created(1998)
-@lastmod(2001-11-21)
-The SynHighlighterCpp unit provides SynEdit with a C++ syntax highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterCpp;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown,
-    tkChar, tkFloat, tkHex, tkOctal);
-
-  TxtkTokenKind = (
-    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
-    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
-    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
-    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
-    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
-    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
-    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
-    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
-    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
-    xtkXorAssign);
-
-  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
-    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39,
-    rsMultiLineString, rsMultiLineDirective);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynCppSyn = class(TSynCustomHighlighter)
-  private
-    fAsmStart: Boolean;
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FExtTokenID: TxtkTokenKind;
-    fIdentFuncTable: array[0..342] of TIdentFuncTableFunc;
-    fAsmAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirecAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fInvalidAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fFloatAttri: TSynHighlighterAttributes;
-    fHexAttri: TSynHighlighterAttributes;
-    fOctalAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fCharAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function FuncAsm(Index: Integer): TtkTokenKind;
-
-{    function FuncAlignas(Index: Integer): TtkTokenKind;
-    function FuncAlignof(Index: Integer): TtkTokenKind;
-    function FuncAnd(Index: Integer): TtkTokenKind;
-    function FuncAnd95eq(Index: Integer): TtkTokenKind;
-    function FuncAuto(Index: Integer): TtkTokenKind;
-    function FuncBitand(Index: Integer): TtkTokenKind;
-    function FuncBitor(Index: Integer): TtkTokenKind;
-    function FuncBool(Index: Integer): TtkTokenKind;
-    function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncCase(Index: Integer): TtkTokenKind;
-    function FuncCatch(Index: Integer): TtkTokenKind;
-    function FuncChar(Index: Integer): TtkTokenKind;
-    function FuncChar1695t(Index: Integer): TtkTokenKind;
-    function FuncChar3295t(Index: Integer): TtkTokenKind;
-    function FuncChar895t(Index: Integer): TtkTokenKind;
-    function FuncClass(Index: Integer): TtkTokenKind;
-    function FuncCo95await(Index: Integer): TtkTokenKind;
-    function FuncCo95return(Index: Integer): TtkTokenKind;
-    function FuncCo95yield(Index: Integer): TtkTokenKind;
-    function FuncCompl(Index: Integer): TtkTokenKind;
-    function FuncConcept(Index: Integer): TtkTokenKind;
-    function FuncConst(Index: Integer): TtkTokenKind;
-    function FuncConst95cast(Index: Integer): TtkTokenKind;
-    function FuncConsteval(Index: Integer): TtkTokenKind;
-    function FuncConstexpr(Index: Integer): TtkTokenKind;
-    function FuncConstinit(Index: Integer): TtkTokenKind;
-    function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncDecltype(Index: Integer): TtkTokenKind;
-    function FuncDefault(Index: Integer): TtkTokenKind;
-    function FuncDelete(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncDouble(Index: Integer): TtkTokenKind;
-    function FuncDynamic95cast(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncEnum(Index: Integer): TtkTokenKind;
-    function FuncExplicit(Index: Integer): TtkTokenKind;
-    function FuncExport(Index: Integer): TtkTokenKind;
-    function FuncExtern(Index: Integer): TtkTokenKind;
-    function FuncFalse(Index: Integer): TtkTokenKind;
-    function FuncFloat(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncFriend(Index: Integer): TtkTokenKind;
-    function FuncGoto(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncInline(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
-    function FuncLong(Index: Integer): TtkTokenKind;
-    function FuncMutable(Index: Integer): TtkTokenKind;
-    function FuncNamespace(Index: Integer): TtkTokenKind;
-    function FuncNew(Index: Integer): TtkTokenKind;
-    function FuncNoexcept(Index: Integer): TtkTokenKind;
-    function FuncNot(Index: Integer): TtkTokenKind;
-    function FuncNot95eq(Index: Integer): TtkTokenKind;
-    function FuncNullptr(Index: Integer): TtkTokenKind;
-    function FuncOperator(Index: Integer): TtkTokenKind;
-    function FuncOr(Index: Integer): TtkTokenKind;
-    function FuncOr95eq(Index: Integer): TtkTokenKind;
-    function FuncPrivate(Index: Integer): TtkTokenKind;
-    function FuncProtected(Index: Integer): TtkTokenKind;
-    function FuncPublic(Index: Integer): TtkTokenKind;
-    function FuncRegister(Index: Integer): TtkTokenKind;
-    function FuncReinterpret95cast(Index: Integer): TtkTokenKind;
-    function FuncReturn(Index: Integer): TtkTokenKind;
-    function FuncShort(Index: Integer): TtkTokenKind;
-    function FuncSigned(Index: Integer): TtkTokenKind;
-    function FuncSizeof(Index: Integer): TtkTokenKind;
-    function FuncStatic(Index: Integer): TtkTokenKind;
-    function FuncStatic95assert(Index: Integer): TtkTokenKind;
-    function FuncStatic95cast(Index: Integer): TtkTokenKind;
-    function FuncStruct(Index: Integer): TtkTokenKind;
-    function FuncSwitch(Index: Integer): TtkTokenKind;
-    function FuncTemplate(Index: Integer): TtkTokenKind;
-    function FuncThis(Index: Integer): TtkTokenKind;
-    function FuncThread95local(Index: Integer): TtkTokenKind;
-    function FuncThrow(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncTry(Index: Integer): TtkTokenKind;
-    function FuncTypedef(Index: Integer): TtkTokenKind;
-    function FuncTypeid(Index: Integer): TtkTokenKind;
-    function FuncTypename(Index: Integer): TtkTokenKind;
-    function FuncUnion(Index: Integer): TtkTokenKind;
-    function FuncUnsigned(Index: Integer): TtkTokenKind;
-    function FuncUsing(Index: Integer): TtkTokenKind;
-    function FuncVirtual(Index: Integer): TtkTokenKind;
-    function FuncVoid(Index: Integer): TtkTokenKind;
-    function FuncVolatile(Index: Integer): TtkTokenKind;
-    function FuncWchar95t(Index: Integer): TtkTokenKind;
-    function FuncWhile(Index: Integer): TtkTokenKind;
-    function FuncXor(Index: Integer): TtkTokenKind;
-    function FuncXor95eq(Index: Integer): TtkTokenKind;     }
-
-
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AnsiCProc;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure DirectiveProc;
-    procedure DirectiveEndProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-    procedure StringEndProc;
-  protected
-    function GetExtTokenID: TxtkTokenKind;
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetCapabilities: TSynHighlighterCapabilities; override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    function UseUserSettings(settingIndex: integer): boolean; override;
-    procedure EnumUserSettings(settings: TStrings); override;
-    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
-  published
-    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
-      write fDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri
-      write fInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property FloatAttri: TSynHighlighterAttributes read fFloatAttri
-      write fFloatAttri;
-    property HexAttri: TSynHighlighterAttributes read fHexAttri
-      write fHexAttri;
-    property OctalAttri: TSynHighlighterAttributes read fOctalAttri
-      write fOctalAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property CharAttri: TSynHighlighterAttributes read fCharAttri
-      write fCharAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-  end;
-
-implementation
-
-uses
-  Windows,
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..90] of WideString = (
-    'alignas', 'alignof', 'and', 'and_eq', 'asm', 'auto', 'bitand', 'bitor',
-    'bool', 'break', 'case', 'catch', 'char', 'char16_t', 'char32_t', 'char8_t',
-    'class', 'co_await', 'co_return', 'co_yield', 'compl', 'concept', 'const',
-    'const_cast', 'consteval', 'constexpr', 'constinit', 'continue', 'decltype',
-    'default', 'delete', 'do', 'double', 'dynamic_cast', 'else', 'enum',
-    'explicit', 'export', 'extern', 'false', 'float', 'for', 'friend', 'goto',
-    'if', 'inline', 'int', 'long', 'mutable', 'namespace', 'new', 'noexcept',
-    'not', 'not_eq', 'nullptr', 'operator', 'or', 'or_eq', 'private',
-    'protected', 'public', 'register', 'reinterpret_cast', 'return', 'short',
-    'signed', 'sizeof', 'static', 'static_assert', 'static_cast', 'struct',
-    'switch', 'template', 'this', 'thread_local', 'throw', 'true', 'try',
-    'typedef', 'typeid', 'typename', 'union', 'unsigned', 'using', 'virtual',
-    'void', 'volatile', 'wchar_t', 'while', 'xor', 'xor_eq'
-  );
-
-  KeyIndices: array[0..330] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34,
-    13, 11, -1, 6, 53, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, 80, 50, 22,
-    45, -1, -1, -1, -1, -1, -1, 21, -1, -1, 55, -1, 83, -1, -1, 82, -1, 35, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, 18, 20, -1, -1,
-    17, -1, -1, -1, -1, -1, -1, -1, 72, 90, 26, 43, -1, 37, -1, 25, -1, -1, -1,
-    36, -1, -1, -1, 79, -1, 16, -1, -1, -1, 41, -1, -1, 88, -1, -1, -1, -1, -1,
-    -1, 2, 48, -1, 86, 74, -1, -1, 5, -1, -1, -1, -1, 52, -1, -1, 69, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 60, -1, -1, 46, -1, -1, -1, -1, 38,
-    -1, -1, 54, 76, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, 12, -1, -1,
-    -1, -1, -1, -1, 47, -1, -1, 24, 87, 70, -1, -1, -1, 73, -1, -1, -1, -1, -1,
-    63, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, 30, 44, -1, 56, 77, -1, -1, -1,
-    -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, 59, 57, -1, -1, -1, 42, -1,
-    -1, 29, 0, -1, -1, -1, -1, 3, -1, -1, 62, -1, -1, -1, -1, -1, -1, 10, -1,
-    -1, -1, -1, 4, -1, 19, -1, -1, -1, 64, -1, -1, 89, -1, 28, 85, -1, -1, -1,
-    -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, 75, 84,
-    -1, -1, -1, -1, 67, 27, 9, -1, -1, 8, 1, -1, 15, -1, -1, 78, -1, 32, -1, -1,
-    81, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, 66, -1, 14, -1, 40, -1, -1,
-    -1, -1, -1, -1, 33, -1, -1
-  );
-
-{
-const
-  KeyWords: array[0..94] of string = (
-    '__asm', '__automated', '__cdecl', '__classid', '__closure', '__declspec',
-    '__dispid', '__except', '__export', '__fastcall', '__finally', '__import',
-    '__int16', '__int32', '__int64', '__int8', '__pascal', '__property',
-    '__published', '__rtti', '__stdcall', '__thread', '__try', '_asm', '_cdecl',
-    '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'asm', 'auto',
-    'bool', 'break', 'case', 'catch', 'cdecl', 'char', 'class', 'const',
-    'const_cast', 'continue', 'default', 'delete', 'do', 'double',
-    'dynamic_cast', 'else', 'enum', 'explicit', 'extern', 'false', 'float',
-    'for', 'friend', 'goto', 'if', 'inline', 'int', 'interface', 'long',
-    'mutable', 'namespace', 'new', 'operator', 'pascal', 'private', 'protected',
-    'public', 'register', 'reinterpret_cast', 'return', 'short', 'signed',
-    'sizeof', 'static', 'static_cast', 'struct', 'switch', 'template', 'this',
-    'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'union',
-    'unsigned', 'using', 'virtual', 'void', 'volatile', 'wchar_t', 'while'
-  );
-
-  KeyIndices: array[0..342] of Integer = (
-    -1, 34, -1, -1, 57, 72, -1, 39, -1, 9, -1, 86, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 88, -1, 12, 66, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 56, 51,
-    40, 87, 77, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 41,
-    -1, 63, 6, -1, -1, -1, -1, -1, -1, -1, -1, 55, 65, 0, -1, -1, -1, -1, -1,
-    -1, 26, 83, -1, 38, 92, -1, -1, 93, 33, -1, -1, -1, -1, -1, -1, -1, 35, -1,
-    -1, -1, -1, -1, -1, -1, 79, 27, -1, -1, -1, 43, -1, -1, 20, -1, -1, 31, -1,
-    -1, -1, -1, -1, 89, -1, -1, -1, -1, 59, -1, 58, -1, -1, 46, -1, -1, 3, -1,
-    -1, 17, -1, 54, -1, 45, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, 1, -1, -1,
-    -1, -1, 44, 90, 32, -1, -1, -1, -1, -1, -1, 91, 13, -1, -1, -1, 60, -1, -1,
-    -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, 75, -1, -1, 76, -1, -1, -1, -1, 30,
-    68, 23, 82, -1, 15, -1, -1, 2, -1, 70, -1, -1, -1, 73, 18, -1, -1, -1, -1,
-    -1, 47, 24, 52, 14, 84, -1, -1, -1, -1, -1, 25, -1, -1, -1, 80, 69, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, 19, -1, -1, -1,
-    -1, -1, -1, 74, -1, -1, -1, 29, -1, -1, -1, 67, -1, 7, -1, -1, -1, 50, 61,
-    -1, -1, -1, 4, -1, 94, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    81, -1, -1, -1, -1, -1, 10, 16, -1, -1, 36, 37, -1, -1, -1, 8, -1, 22, -1,
-    -1, -1, -1, 78, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 71, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 11, -1, 48,
-    -1
-  ); }
-
-{$Q-}
-function TSynCppSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 967 + Ord(Str^) * 308;
-    inc(Str);
-  end;
-  Result := Result mod 331;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCppSyn.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;
-
-//{$Q-}
-//function TSynCppSyn.HashKey(Str: PWideChar): Cardinal;
-//begin
-//  Result := 0;
-//  while IsIdentChar(Str^) do
-//  begin
-//    Result := Result * 179 + Ord(Str^) * 44;
-//    inc(Str);
-//  end;
-//  Result := Result mod 343;
-//  fStringLen := Str - fToIdent;
-//end;
-//{$Q+}
-
-//function TSynCppSyn.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 TSynCppSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[70] := FuncAsm;
-  fIdentFuncTable[191] := FuncAsm;
-  fIdentFuncTable[189] := FuncAsm;
-
-  {fIdentFuncTable[230] := FuncAlignas;
-  fIdentFuncTable[295] := FuncAlignof;
-  fIdentFuncTable[115] := FuncAnd;
-  fIdentFuncTable[235] := FuncAnd95eq;
-  fIdentFuncTable[250] := FuncAsm;
-  fIdentFuncTable[122] := FuncAuto;
-  fIdentFuncTable[22] := FuncBitand;
-  fIdentFuncTable[166] := FuncBitor;
-  fIdentFuncTable[294] := FuncBool;
-  fIdentFuncTable[291] := FuncBreak;
-  fIdentFuncTable[245] := FuncCase;
-  fIdentFuncTable[20] := FuncCatch;
-  fIdentFuncTable[168] := FuncChar;
-  fIdentFuncTable[19] := FuncChar1695t;
-  fIdentFuncTable[319] := FuncChar3295t;
-  fIdentFuncTable[297] := FuncChar895t;
-  fIdentFuncTable[101] := FuncClass;
-  fIdentFuncTable[76] := FuncCo95await;
-  fIdentFuncTable[72] := FuncCo95return;
-  fIdentFuncTable[252] := FuncCo95yield;
-  fIdentFuncTable[73] := FuncCompl;
-  fIdentFuncTable[45] := FuncConcept;
-  fIdentFuncTable[37] := FuncConst;
-  fIdentFuncTable[26] := FuncConst95cast;
-  fIdentFuncTable[178] := FuncConsteval;
-  fIdentFuncTable[91] := FuncConstexpr;
-  fIdentFuncTable[86] := FuncConstinit;
-  fIdentFuncTable[290] := FuncContinue;
-  fIdentFuncTable[261] := FuncDecltype;
-  fIdentFuncTable[229] := FuncDefault;
-  fIdentFuncTable[201] := FuncDelete;
-  fIdentFuncTable[315] := FuncDo;
-  fIdentFuncTable[302] := FuncDouble;
-  fIdentFuncTable[328] := FuncDynamic95cast;
-  fIdentFuncTable[18] := FuncElse;
-  fIdentFuncTable[55] := FuncEnum;
-  fIdentFuncTable[95] := FuncExplicit;
-  fIdentFuncTable[89] := FuncExport;
-  fIdentFuncTable[151] := FuncExtern;
-  fIdentFuncTable[279] := FuncFalse;
-  fIdentFuncTable[321] := FuncFloat;
-  fIdentFuncTable[105] := FuncFor;
-  fIdentFuncTable[226] := FuncFriend;
-  fIdentFuncTable[87] := FuncGoto;
-  fIdentFuncTable[202] := FuncIf;
-  fIdentFuncTable[38] := FuncInline;
-  fIdentFuncTable[146] := FuncInt;
-  fIdentFuncTable[175] := FuncLong;
-  fIdentFuncTable[116] := FuncMutable;
-  fIdentFuncTable[157] := FuncNamespace;
-  fIdentFuncTable[36] := FuncNew;
-  fIdentFuncTable[66] := FuncNoexcept;
-  fIdentFuncTable[127] := FuncNot;
-  fIdentFuncTable[23] := FuncNot95eq;
-  fIdentFuncTable[154] := FuncNullptr;
-  fIdentFuncTable[48] := FuncOperator;
-  fIdentFuncTable[204] := FuncOr;
-  fIdentFuncTable[222] := FuncOr95eq;
-  fIdentFuncTable[8] := FuncPrivate;
-  fIdentFuncTable[221] := FuncProtected;
-  fIdentFuncTable[143] := FuncPublic;
-  fIdentFuncTable[142] := FuncRegister;
-  fIdentFuncTable[238] := FuncReinterpret95cast;
-  fIdentFuncTable[190] := FuncReturn;
-  fIdentFuncTable[256] := FuncShort;
-  fIdentFuncTable[197] := FuncSigned;
-  fIdentFuncTable[317] := FuncSizeof;
-  fIdentFuncTable[289] := FuncStatic;
-  fIdentFuncTable[270] := FuncStatic95assert;
-  fIdentFuncTable[130] := FuncStatic95cast;
-  fIdentFuncTable[180] := FuncStruct;
-  fIdentFuncTable[213] := FuncSwitch;
-  fIdentFuncTable[84] := FuncTemplate;
-  fIdentFuncTable[184] := FuncThis;
-  fIdentFuncTable[119] := FuncThread95local;
-  fIdentFuncTable[283] := FuncThrow;
-  fIdentFuncTable[155] := FuncTrue;
-  fIdentFuncTable[205] := FuncTry;
-  fIdentFuncTable[300] := FuncTypedef;
-  fIdentFuncTable[99] := FuncTypeid;
-  fIdentFuncTable[35] := FuncTypename;
-  fIdentFuncTable[305] := FuncUnion;
-  fIdentFuncTable[53] := FuncUnsigned;
-  fIdentFuncTable[50] := FuncUsing;
-  fIdentFuncTable[284] := FuncVirtual;
-  fIdentFuncTable[262] := FuncVoid;
-  fIdentFuncTable[118] := FuncVolatile;
-  fIdentFuncTable[179] := FuncWchar95t;
-  fIdentFuncTable[108] := FuncWhile;
-  fIdentFuncTable[259] := FuncXor;
-  fIdentFuncTable[85] := FuncXor95eq;       }
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynCppSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynCppSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-function TSynCppSyn.FuncAsm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    Result := tkKey;
-    fRange := rsAsm;
-    fAsmStart := True;
-  end
-  else
-    Result := tkIdentifier
-end;
-
-constructor TSynCppSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
-  AddAttribute(fAsmAttri);
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style:= [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(fInvalidAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
-  AddAttribute(fCharAttri);
-  fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
-  AddAttribute(fFloatAttri);
-  fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
-  AddAttribute(fHexAttri);
-  fOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
-  AddAttribute(fOctalAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(fDirecAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fRange := rsUnknown;
-  fAsmStart := False;
-  fDefaultFilter := SYNS_FilterCPP;
-end;
-
-procedure TSynCppSyn.AnsiCProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        if fLine[Run + 1] = '/' then
-        begin
-          inc(Run, 2);
-          if fRange = rsAnsiCAsm then
-            fRange := rsAsm
-          else if fRange = rsAnsiCAsmBlock then
-            fRange := rsAsmBlock
-          else if (fRange = rsDirectiveComment) and
-            not IsLineEnd(Run) then
-              fRange := rsMultiLineDirective
-          else
-            fRange := rsUnKnown;
-          break;
-        end else
-          inc(Run);
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-procedure TSynCppSyn.AndSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAndAssign;
-      end;
-    '&':                               {logical and}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogAnd;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAnd;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.AsciiCharProc;
-begin
-  fTokenID := tkChar;
-  repeat
-    if fLine[Run] = '\' then begin
-      if CharInSet(fLine[Run + 1], [#39, '\']) then
-        inc(Run);
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #39);
-  if fLine[Run] = #39 then
-    inc(Run);
-end;
-
-procedure TSynCppSyn.AtSymbolProc;
-begin
-  fTokenID := tkUnknown;
-  inc(Run);
-end;
-
-procedure TSynCppSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceClose;
-  if fRange = rsAsmBlock then fRange := rsUnknown;
-end;
-
-procedure TSynCppSyn.BraceOpenProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceOpen;
-  if fRange = rsAsm then
-  begin
-    fRange := rsAsmBlock;
-    fAsmStart := True;
-  end;
-end;
-
-procedure TSynCppSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run + 1] = #10 then Inc(Run);
-end;
-
-procedure TSynCppSyn.ColonProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkScopeResolution;
-      end;
-  else                                 {colon}
-    begin
-      inc(Run);
-      FExtTokenID := xtkColon;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkComma;
-end;
-
-procedure TSynCppSyn.DirectiveProc;
-begin
-  if Trim(fLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
-  begin
-    fTokenID := tkUnknown;
-    Inc(Run);
-    Exit;
-  end;
-  fTokenID := tkDirective;
-  repeat
-    if fLine[Run] = '/' then // comment?
-    begin
-      if fLine[Run + 1] = '/' then // is end of directive as well
-      begin
-        fRange := rsUnknown;
-        Exit;
-      end
-      else
-        if fLine[Run + 1] = '*' then // might be embedded only
-        begin
-          fRange := rsDirectiveComment;
-          Exit;
-        end;
-    end;
-    if (fLine[Run] = '\') and (fLine[Run +1 ] = #0) then // a multiline directive
-    begin
-      Inc(Run);
-      fRange := rsMultiLineDirective;
-      Exit;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run)
-end;
-
-procedure TSynCppSyn.DirectiveEndProc;
-begin
-  fTokenID := tkDirective;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-  fRange := rsUnknown;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-      '/': // comment?
-        begin
-          case fLine[Run + 1] of
-            '/': // is end of directive as well
-              begin
-                fRange := rsUnknown;
-                Exit;
-              end;
-            '*': // might be embedded only
-              begin
-                fRange := rsDirectiveComment;
-                Exit;
-              end;
-          end;
-        end;
-      '\': // yet another line?
-        begin
-          if fLine[Run + 1] = #0 then
-          begin
-            Inc(Run);
-            fRange := rsMultiLineDirective;
-            Exit;
-          end;
-        end;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynCppSyn.EqualProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogEqual;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAssign;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.GreaterProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkGreaterThanEqual;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftRightAssign;
-        end
-        else                           {shift right}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftRight;
-        end;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkGreaterThan;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.QuestionProc;
-begin
-  fTokenID := tkSymbol;                {conditional}
-  FExtTokenID := xtkQuestion;
-  inc(Run);
-end;
-
-procedure TSynCppSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynCppSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynCppSyn.LowerProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLessThanEqual;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftLeftAssign;
-        end
-        else                           {shift left}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftLeft;
-        end;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLessThan;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.MinusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkSubtractAssign;
-      end;
-    '-':                               {decrement}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkDecrement;
-      end;
-    '>':                               {arrow}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkArrow;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      FExtTokenID := xtkSubtract;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.ModSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkModAssign;
-      end;
-  else                                 {mod}
-    begin
-      inc(Run);
-      FExtTokenID := xtkMod;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.NotSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkNotEqual;
-      end;
-  else                                 {not}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLogComplement;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCppSyn.NumberProc;
-
-  function IsNumberChar(Run: Integer): Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', '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'..'7':
-        if (Run = Succ(idx1)) and (FLine[idx1] = '0') then // octal number
-          fTokenID := tkOctal;
-      '8', '9':
-        if (FLine[idx1] = '0') and
-           ((fTokenID <> tkHex) and (fTokenID <> tkFloat)) then // invalid octal char
-             fTokenID := tkUnknown;
-      'a'..'d', 'A'..'D':
-        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;
-      'f', 'F':
-        if fTokenID <> tkHex then
-        begin
-          for i := idx1 to Pred(Run) do
-            if CharInSet(FLine[i], ['f', 'F']) then // declaration syntax error
-            begin
-              fTokenID := tkUnknown;
-              Exit;
-            end;
-          if fTokenID = tkFloat then
-          begin
-            if CharInSet(fLine[Pred(Run)], ['l', 'L']) then // can't mix
-              Break;
-          end
-          else
-            fTokenID := tkFloat;
-        end;
-      'l', 'L':
-        begin
-          for i := idx1 to Run - 2 do
-            if CharInSet(FLine[i], ['l', 'L']) then // declaration syntax error
-            begin
-              fTokenID := tkUnknown;
-              Exit;
-            end;
-          if fTokenID = tkFloat then
-            if CharInSet(fLine[Pred(Run)], ['f', 'F']) then // can't mix
-              Break;
-        end;
-      'u', 'U':
-        if fTokenID = tkFloat then // not allowed
-          Break
-        else
-          for i := idx1 to Pred(Run) do
-            if CharInSet(FLine[i], ['u', 'U']) then // declaration syntax error
-            begin
-              fTokenID := tkUnknown;
-              Exit;
-            end;
-      '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 TSynCppSyn.OrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {or assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncOrAssign;
-      end;
-    '|':                               {logical or}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogOr;
-      end;
-  else                                 {or}
-    begin
-      inc(Run);
-      FExtTokenID := xtkIncOr;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.PlusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAddAssign;
-      end;
-    '+':                               {increment}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncrement;
-      end;
-  else                                 {add}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAdd;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.PointProc;
-begin
-  fTokenID := tkSymbol;
-  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
-    begin                              {ellipse}
-      inc(Run, 3);
-      FExtTokenID := xtkEllipse;
-    end
-  else
-    if CharInSet(FLine[Run + 1], ['0'..'9']) then // float
-    begin
-      Dec(Run); // numberproc must see the point
-      NumberProc;
-    end
-  else                                 {point}
-    begin
-      inc(Run);
-      FExtTokenID := xtkPoint;
-    end;
-end;
-
-procedure TSynCppSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkRoundClose;
-end;
-
-procedure TSynCppSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundOpen;
-end;
-
-procedure TSynCppSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSemiColon;
-  if fRange = rsAsm then fRange := rsUnknown;
-end;
-
-procedure TSynCppSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':                               {c++ style comments}
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-        while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '*':                               {c style comments}
-      begin
-        fTokenID := tkComment;
-        if fRange = rsAsm then
-          fRange := rsAnsiCAsm
-        else if fRange = rsAsmBlock then
-          fRange := rsAnsiCAsmBlock
-        else if fRange <> rsDirectiveComment then
-          fRange := rsAnsiC;
-        inc(Run, 2);
-        while fLine[Run] <> #0 do
-          case fLine[Run] of
-            '*':
-              if fLine[Run + 1] = '/' then
-              begin
-                inc(Run, 2);
-                if fRange = rsDirectiveComment then
-                  fRange := rsMultiLineDirective
-                else if fRange = rsAnsiCAsm then
-                  fRange := rsAsm
-                else
-                  begin
-                  if fRange = rsAnsiCAsmBlock then
-                    fRange := rsAsmBlock
-                  else
-                    fRange := rsUnKnown;
-                  end;
-                break;
-              end else inc(Run);
-            #10, #13:
-              begin
-                if fRange = rsDirectiveComment then
-                  fRange := rsAnsiC;
-                break;
-              end;
-          else inc(Run);
-          end;
-      end;
-    '=':                               {divide assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-        FExtTokenID := xtkDivideAssign;
-      end;
-  else                                 {divide}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-      FExtTokenID := xtkDivide;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynCppSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareClose;
-end;
-
-procedure TSynCppSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareOpen;
-end;
-
-procedure TSynCppSyn.StarProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkMultiplyAssign;
-      end;
-  else                                 {star}
-    begin
-      inc(Run);
-      FExtTokenID := xtkStar;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.StringProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      case fLine[Run + 1] of
-        #34, '\':
-          Inc(Run);
-        #00:
-          begin
-            Inc(Run);
-            fRange := rsMultilineString;
-            Exit;
-          end;
-      end;
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #34);
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynCppSyn.StringEndProc;
-begin
-  fTokenID := tkString;
-
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-
-  fRange := rsUnknown;
-
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-      '\':
-        begin
-          case fLine[Run + 1] of
-            #34, '\':
-              Inc(Run);
-            #00:
-              begin
-                Inc(Run);
-                fRange := rsMultilineString;
-                Exit;
-              end;
-          end;
-        end;
-      #34: Break;
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #34);
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynCppSyn.TildeProc;
-begin
-  inc(Run);                            {bitwise complement}
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBitComplement;
-end;
-
-procedure TSynCppSyn.XOrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-  	'=':                               {xor assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkXorAssign;
-      end;
-  else                                 {xor}
-    begin
-      inc(Run);
-      FExtTokenID := xtkXor;
-    end;
-  end;
-end;
-
-procedure TSynCppSyn.UnknownProc;
-begin
-  Inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynCppSyn.Next;
-begin
-  fAsmStart := False;
-  fTokenPos := Run;
-  case fRange of
-    rsAnsiC, rsAnsiCAsm,
-    rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
-    rsMultiLineDirective: DirectiveEndProc;
-    rsMultilineString: StringEndProc;
-  else
-    begin
-      case fLine[Run] of
-        '&': AndSymbolProc;
-        #39: AsciiCharProc;
-        '@': AtSymbolProc;
-        '}': BraceCloseProc;
-        '{': BraceOpenProc;
-        #13: CRProc;
-        ':': ColonProc;
-        ',': CommaProc;
-        '#': DirectiveProc;
-        '=': EqualProc;
-        '>': GreaterProc;
-        '?': QuestionProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        #10: LFProc;
-        '<': LowerProc;
-        '-': MinusProc;
-        '%': ModSymbolProc;
-        '!': NotSymbolProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '|': OrSymbolProc;
-        '+': PlusProc;
-        '.': PointProc;
-        ')': RoundCloseProc;
-        '(': RoundOpenProc;
-        ';': SemiColonProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        ']': SquareCloseProc;
-        '[': SquareOpenProc;
-        '*': StarProc;
-        #34: StringProc;
-        '~': TildeProc;
-        '^': XOrSymbolProc;
-        else UnknownProc;
-      end;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynCppSyn.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 TSynCppSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCppSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynCppSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-  if ((fRange = rsAsm) or (fRange = rsAsmBlock)) and not fAsmStart
-    and not (fTokenId in [tkComment, tkSpace, tkNull])
-  then
-    Result := tkAsm;
-end;
-
-function TSynCppSyn.GetExtTokenID: TxtkTokenKind;
-begin
-  Result := FExtTokenID;
-end;
-
-function TSynCppSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  fTokenID := GetTokenID;
-  case fTokenID of
-    tkAsm: Result := fAsmAttri;
-    tkComment: Result := fCommentAttri;
-    tkDirective: Result := fDirecAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkFloat: Result := fFloatAttri;
-    tkHex: Result := fHexAttri;
-    tkOctal: Result := fOctalAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkChar: Result := fCharAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fInvalidAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynCppSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-procedure TSynCppSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-procedure TSynCppSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynCppSyn.EnumUserSettings(settings: TStrings);
-begin
-  { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
-  begin
-    try
-      RootKey := HKEY_LOCAL_MACHINE;
-      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
-      begin
-        try
-          GetKeyNames(settings);
-        finally
-          CloseKey;
-        end;
-      end;
-    finally
-      Free;
-    end;
-  end;
-end;
-
-function TSynCppSyn.UseUserSettings(settingIndex: integer): boolean;
-// Possible parameter values:
-//   index into TStrings returned by EnumUserSettings
-// Possible return values:
-//   true : settings were read and used
-//   false: problem reading settings or invalid version specified - old settings
-//          were preserved
-
-  function ReadCPPBSettings(settingIndex: integer): boolean;
-
-    function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean;
-
-      function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): boolean;
-      var
-        i: integer;
-      begin
-        for i := 1 to Length(name) do
-          if name[i] = ' ' then name[i] := '_';
-        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-             '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name,true);
-      end; { ReadCPPB1 }
-
-      function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean;
-      begin
-        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-                 '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight',
-                 key,false);
-      end; { ReadCPPB3OrMore }
-
-    begin { ReadCPPBSetting }
-      try
-        if (settingTag[1] = '1')
-          then Result := ReadCPPB1(settingTag,attri,key)
-          else Result := ReadCPPB3OrMore(settingTag,attri,key);
-      except Result := false; end;
-    end; { ReadCPPBSetting }
-
-  var
-    tmpStringAttri    : TSynHighlighterAttributes;
-    tmpCharAttri      : TSynHighlighterAttributes;
-    tmpNumberAttri    : TSynHighlighterAttributes;
-    tmpFloatAttri     : TSynHighlighterAttributes;
-    tmpHexAttri       : TSynHighlighterAttributes;
-    tmpOctalAttri     : TSynHighlighterAttributes;
-    tmpKeyAttri       : TSynHighlighterAttributes;
-    tmpSymbolAttri    : TSynHighlighterAttributes;
-    tmpAsmAttri       : TSynHighlighterAttributes;
-    tmpCommentAttri   : TSynHighlighterAttributes;
-    tmpIdentifierAttri: TSynHighlighterAttributes;
-    tmpInvalidAttri   : TSynHighlighterAttributes;
-    tmpSpaceAttri     : TSynHighlighterAttributes;
-    tmpDirecAttri     : TSynHighlighterAttributes;
-    s                 : TStringList;
-
-  begin { ReadCPPBSettings }
-    s := TStringList.Create;
-    try
-      EnumUserSettings(s);
-      if settingIndex >= s.Count then Result := false
-      else begin
-        tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpCharAttri      := TSynHighlighterAttributes.Create('', '');
-        tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpFloatAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpHexAttri       := TSynHighlighterAttributes.Create('', '');
-        tmpOctalAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
-        tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
-        tmpAsmAttri       := TSynHighlighterAttributes.Create('', '');
-        tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
-        tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
-        tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
-        tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpStringAttri    .Assign(fStringAttri);
-        tmpCharAttri      .Assign(fCharAttri);
-        tmpNumberAttri    .Assign(fNumberAttri);
-        tmpFloatAttri     .Assign(fFloatAttri);
-        tmpHexAttri       .Assign(fHexAttri);
-        tmpOctalAttri     .Assign(fOctalAttri);
-        tmpKeyAttri       .Assign(fKeyAttri);
-        tmpSymbolAttri    .Assign(fSymbolAttri);
-        tmpAsmAttri       .Assign(fAsmAttri);
-        tmpCommentAttri   .Assign(fCommentAttri);
-        tmpIdentifierAttri.Assign(fIdentifierAttri);
-        tmpInvalidAttri   .Assign(fInvalidAttri);
-        tmpSpaceAttri     .Assign(fSpaceAttri);
-        tmpDirecAttri     .Assign(fDirecAttri);
-        if s[settingIndex][1] = '1'
-          then Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Plain text')
-          else Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Assembler');
-        Result := Result                                                         and
-                  ReadCPPBSetting(s[settingIndex],fCommentAttri,'Comment')       and
-                  ReadCPPBSetting(s[settingIndex],fIdentifierAttri,'Identifier') and
-                  ReadCPPBSetting(s[settingIndex],fInvalidAttri,'Illegal Char')  and
-                  ReadCPPBSetting(s[settingIndex],fKeyAttri,'Reserved word')     and
-                  ReadCPPBSetting(s[settingIndex],fNumberAttri,'Integer')        and
-                  ReadCPPBSetting(s[settingIndex],fFloatAttri,'Float')           and
-                  ReadCPPBSetting(s[settingIndex],fHexAttri,'Hex')               and
-                  ReadCPPBSetting(s[settingIndex],fOctalAttri,'Octal')           and
-                  ReadCPPBSetting(s[settingIndex],fSpaceAttri,'Whitespace')      and
-                  ReadCPPBSetting(s[settingIndex],fStringAttri,'String')         and
-                  ReadCPPBSetting(s[settingIndex],fCharAttri,'Character')             and
-                  ReadCPPBSetting(s[settingIndex],fSymbolAttri,'Symbol')         and
-                  ReadCPPBSetting(s[settingIndex],fDirecAttri,'Preprocessor');
-        if not Result then begin
-          fStringAttri    .Assign(tmpStringAttri);
-          fCharAttri      .Assign(tmpCharAttri);
-          fNumberAttri    .Assign(tmpNumberAttri);
-          fFloatAttri     .Assign(tmpFloatAttri);
-          fHexAttri       .Assign(tmpHexAttri);
-          fOctalAttri     .Assign(tmpOctalAttri);
-          fKeyAttri       .Assign(tmpKeyAttri);
-          fSymbolAttri    .Assign(tmpSymbolAttri);
-          fAsmAttri       .Assign(tmpAsmAttri);
-          fCommentAttri   .Assign(tmpCommentAttri);
-          fIdentifierAttri.Assign(tmpIdentifierAttri);
-          fInvalidAttri   .Assign(tmpInvalidAttri);
-          fSpaceAttri     .Assign(tmpSpaceAttri);
-          fDirecAttri     .Assign(tmpDirecAttri);
-        end;
-        tmpStringAttri    .Free;
-        tmpCharAttri      .Free;
-        tmpNumberAttri    .Free;
-        tmpFloatAttri     .Free;
-        tmpHexAttri       .Free;
-        tmpOctalAttri     .Free;
-        tmpKeyAttri       .Free;
-        tmpSymbolAttri    .Free;
-        tmpAsmAttri       .Free;
-        tmpCommentAttri   .Free;
-        tmpIdentifierAttri.Free;
-        tmpInvalidAttri   .Free;
-        tmpSpaceAttri     .Free;
-        tmpDirecAttri     .Free;
-      end;
-    finally s.Free; end;
-  end; { ReadCPPBSettings }
-
-begin
-  Result := ReadCPPBSettings(settingIndex);
-end; { TSynCppSyn.UseUserSettings }
-
-function TSynCppSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCPP;
-end;
-
-class function TSynCppSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCPP;
-end;
-
-class function TSynCppSyn.GetCapabilities: TSynHighlighterCapabilities;
-begin
-  Result := inherited GetCapabilities + [hcUserSettings];
-end;
-
-function TSynCppSyn.GetSampleSource: string;
-begin
-  Result := '// Syntax Highlighting'#13#10+
-            'void __fastcall TForm1::Button1Click(TObject *Sender)'#13#10+
-            '{'#13#10+
-            '  int number = 123456;'#13#10+
-            '  char c = ''a'';'#13#10+
-            '  Caption = "The number is " + IntToStr(i);'#13#10+
-            '  for (int i = 0; i <= number; i++)'#13#10+
-            '  {'#13#10+
-            '    x -= 0xff;'#13#10+
-            '    x -= 023;'#13#10+
-            '    x += 1.0;'#13#10+
-            '    x += @; /* illegal character */'#13#10+
-            '  }'#13#10+
-            '  #ifdef USE_ASM'#13#10+
-            '    asm'#13#10+
-            '    {'#13#10+
-            '      ASM MOV AX, 0x1234'#13#10+
-            '      ASM MOV i, AX'#13#10+
-            '    }'#13#10+
-            '  #endif'#13#10+
-            '}';
-
-end;
-
-class function TSynCppSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCPP;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCppSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCpp.pas, released 2000-04-10.
+The Original Code is based on the dcjCppSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Michael Trier.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCpp.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a C++ syntax highlighter for SynEdit)
+@author(Michael Trier)
+@created(1998)
+@lastmod(2001-11-21)
+The SynHighlighterCpp unit provides SynEdit with a C++ syntax highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterCpp;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
+    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown,
+    tkChar, tkFloat, tkHex, tkOctal);
+
+  TxtkTokenKind = (
+    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
+    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
+    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
+    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
+    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
+    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
+    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
+    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
+    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
+    xtkXorAssign);
+
+  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
+    rsAsmBlock, rsDirective, rsDirectiveComment, rsMultiLineString,
+    rsMultiLineDirective);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynCppSyn = class(TSynCustomHighlighter)
+  private
+    FAsmStart: Boolean;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FExtTokenID: TxtkTokenKind;
+    FIdentFuncTable: array[0..342] of TIdentFuncTableFunc;
+    FAsmAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInvalidAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FFloatAttri: TSynHighlighterAttributes;
+    FHexAttri: TSynHighlighterAttributes;
+    FOctalAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FCharAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function FuncAsm(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AnsiCProc;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure DirectiveProc;
+    procedure DirectiveEndProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+    procedure StringEndProc;
+  protected
+    function GetExtTokenID: TxtkTokenKind;
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetCapabilities: TSynHighlighterCapabilities; override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+    function UseUserSettings(settingIndex: Integer): Boolean; override;
+    procedure EnumUserSettings(settings: TStrings); override;
+
+    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+  published
+    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
+      write FInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
+      write FFloatAttri;
+    property HexAttri: TSynHighlighterAttributes read FHexAttri
+      write FHexAttri;
+    property OctalAttri: TSynHighlighterAttributes read FOctalAttri
+      write FOctalAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property CharAttri: TSynHighlighterAttributes read FCharAttri
+      write FCharAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+  end;
+
+implementation
+
+uses
+  Windows,
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..94] of UnicodeString = (
+    '__asm', '__automated', '__cdecl', '__classid', '__closure', '__declspec', 
+    '__dispid', '__except', '__export', '__fastcall', '__finally', '__import', 
+    '__int16', '__int32', '__int64', '__int8', '__pascal', '__property', 
+    '__published', '__rtti', '__stdcall', '__thread', '__try', '_asm', '_cdecl', 
+    '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'asm', 'auto', 
+    'bool', 'break', 'case', 'catch', 'cdecl', 'char', 'class', 'const', 
+    'const_cast', 'continue', 'default', 'delete', 'do', 'double', 
+    'dynamic_cast', 'else', 'enum', 'explicit', 'extern', 'false', 'float', 
+    'for', 'friend', 'goto', 'if', 'inline', 'int', 'interface', 'long', 
+    'mutable', 'namespace', 'new', 'operator', 'pascal', 'private', 'protected', 
+    'public', 'register', 'reinterpret_cast', 'return', 'short', 'signed', 
+    'sizeof', 'static', 'static_cast', 'struct', 'switch', 'template', 'this', 
+    'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'union', 
+    'unsigned', 'using', 'virtual', 'void', 'volatile', 'wchar_t', 'while' 
+  );
+
+  KeyIndices: array[0..342] of Integer = (
+    -1, 34, -1, -1, 57, 72, -1, 39, -1, 9, -1, 86, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 88, -1, 12, 66, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 56, 51, 
+    40, 87, 77, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 41, 
+    -1, 63, 6, -1, -1, -1, -1, -1, -1, -1, -1, 55, 65, 0, -1, -1, -1, -1, -1, 
+    -1, 26, 83, -1, 38, 92, -1, -1, 93, 33, -1, -1, -1, -1, -1, -1, -1, 35, -1, 
+    -1, -1, -1, -1, -1, -1, 79, 27, -1, -1, -1, 43, -1, -1, 20, -1, -1, 31, -1, 
+    -1, -1, -1, -1, 89, -1, -1, -1, -1, 59, -1, 58, -1, -1, 46, -1, -1, 3, -1, 
+    -1, 17, -1, 54, -1, 45, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, 1, -1, -1, 
+    -1, -1, 44, 90, 32, -1, -1, -1, -1, -1, -1, 91, 13, -1, -1, -1, 60, -1, -1, 
+    -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, 75, -1, -1, 76, -1, -1, -1, -1, 30, 
+    68, 23, 82, -1, 15, -1, -1, 2, -1, 70, -1, -1, -1, 73, 18, -1, -1, -1, -1, 
+    -1, 47, 24, 52, 14, 84, -1, -1, -1, -1, -1, 25, -1, -1, -1, 80, 69, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, 19, -1, -1, -1, 
+    -1, -1, -1, 74, -1, -1, -1, 29, -1, -1, -1, 67, -1, 7, -1, -1, -1, 50, 61, 
+    -1, -1, -1, 4, -1, 94, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    81, -1, -1, -1, -1, -1, 10, 16, -1, -1, 36, 37, -1, -1, -1, 8, -1, 22, -1, 
+    -1, -1, -1, 78, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 71, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 11, -1, 48, 
+    -1 
+  );
+
+{$Q-}
+function TSynCppSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 179 + Ord(Str^) * 44;
+    Inc(Str);
+  end;
+  Result := Result mod 343;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCppSyn.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 TSynCppSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[70] := FuncAsm;
+  FIdentFuncTable[191] := FuncAsm;
+  FIdentFuncTable[189] := FuncAsm;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynCppSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynCppSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+function TSynCppSyn.FuncAsm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    Result := tkKey;
+    FRange := rsAsm;
+    FAsmStart := True;
+  end
+  else
+    Result := tkIdentifier
+end;
+
+constructor TSynCppSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
+  AddAttribute(FAsmAttri);
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(FInvalidAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
+  AddAttribute(FCharAttri);
+  FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
+  AddAttribute(FFloatAttri);
+  FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
+  AddAttribute(FHexAttri);
+  FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
+  AddAttribute(FOctalAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(FDirecAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FRange := rsUnknown;
+  FAsmStart := False;
+  FDefaultFilter := SYNS_FilterCPP;
+end;
+
+procedure TSynCppSyn.AnsiCProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          Inc(Run, 2);
+          if FRange = rsAnsiCAsm then
+            FRange := rsAsm
+          else if FRange = rsAnsiCAsmBlock then
+            FRange := rsAsmBlock
+          else if (FRange = rsDirectiveComment) and
+            not IsLineEnd(Run) then
+              FRange := rsMultiLineDirective
+          else
+            FRange := rsUnknown;
+          Break;
+        end else
+          Inc(Run);
+      #10, #13:
+        Break;
+      else
+        Inc(Run);
+    end;
+end;
+
+procedure TSynCppSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAndAssign;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogAnd;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAnd;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.AsciiCharProc;
+begin
+  FTokenID := tkChar;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#39, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #39);
+  if FLine[Run] = #39 then
+    Inc(Run);
+end;
+
+procedure TSynCppSyn.AtSymbolProc;
+begin
+  FTokenID := tkUnknown;
+  Inc(Run);
+end;
+
+procedure TSynCppSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceClose;
+  if FRange = rsAsmBlock then FRange := rsUnknown;
+end;
+
+procedure TSynCppSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceOpen;
+  if FRange = rsAsm then
+  begin
+    FRange := rsAsmBlock;
+    FAsmStart := True;
+  end;
+end;
+
+procedure TSynCppSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run + 1] = #10 then Inc(Run);
+end;
+
+procedure TSynCppSyn.ColonProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkScopeResolution;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkColon;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkComma;
+end;
+
+procedure TSynCppSyn.DirectiveProc;
+begin
+  if WideTrim(FLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
+  begin
+    FTokenID := tkUnknown;
+    Inc(Run);
+    Exit;
+  end;
+  FTokenID := tkDirective;
+  repeat
+    if FLine[Run] = '/' then // comment?
+    begin
+      if FLine[Run + 1] = '/' then // is end of directive as well
+      begin
+        FRange := rsUnknown;
+        Exit;
+      end
+      else
+        if FLine[Run + 1] = '*' then // might be embedded only
+        begin
+          FRange := rsDirectiveComment;
+          Exit;
+        end;
+    end;
+    if (FLine[Run] = '\') and (FLine[Run +1 ] = #0) then // a multiline directive
+    begin
+      Inc(Run);
+      FRange := rsMultiLineDirective;
+      Exit;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run)
+end;
+
+procedure TSynCppSyn.DirectiveEndProc;
+begin
+  FTokenID := tkDirective;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+  FRange := rsUnknown;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '/': // comment?
+        begin
+          case FLine[Run + 1] of
+            '/': // is end of directive as well
+              begin
+                FRange := rsUnknown;
+                Exit;
+              end;
+            '*': // might be embedded only
+              begin
+                FRange := rsDirectiveComment;
+                Exit;
+              end;
+          end;
+        end;
+      '\': // yet another line?
+        begin
+          if FLine[Run + 1] = #0 then
+          begin
+            Inc(Run);
+            FRange := rsMultiLineDirective;
+            Exit;
+          end;
+        end;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynCppSyn.EqualProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogEqual;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAssign;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkGreaterThanEqual;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftRightAssign;
+        end
+        else                           {shift right}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftRight;
+        end;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkGreaterThan;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.QuestionProc;
+begin
+  FTokenID := tkSymbol;                {conditional}
+  FExtTokenID := xtkQuestion;
+  Inc(Run);
+end;
+
+procedure TSynCppSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynCppSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynCppSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLessThanEqual;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftLeftAssign;
+        end
+        else                           {shift left}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftLeft;
+        end;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLessThan;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkSubtractAssign;
+      end;
+    '-':                               {decrement}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkDecrement;
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkArrow;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkSubtract;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkModAssign;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkMod;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.NotSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkNotEqual;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLogComplement;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCppSyn.NumberProc;
+
+  function IsNumberChar(Run: Integer): Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', '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'..'7':
+        if (Run = Succ(idx1)) and (FLine[idx1] = '0') then // octal number
+          FTokenID := tkOctal;
+      '8', '9':
+        if (FLine[idx1] = '0') and
+           ((FTokenID <> tkHex) and (FTokenID <> tkFloat)) then // invalid octal char
+             FTokenID := tkUnknown;
+      'a'..'d', 'A'..'D':
+        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;
+      'f', 'F':
+        if FTokenID <> tkHex then
+        begin
+          for i := idx1 to Pred(Run) do
+            if CharInSet(FLine[i], ['f', 'F']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+          if FTokenID = tkFloat then
+          begin
+            if CharInSet(FLine[Pred(Run)], ['l', 'L']) then // can't mix
+              Break;
+          end
+          else
+            FTokenID := tkFloat;
+        end;
+      'l', 'L':
+        begin
+          for i := idx1 to Run - 2 do
+            if CharInSet(FLine[i], ['l', 'L']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+          if FTokenID = tkFloat then
+            if CharInSet(FLine[Pred(Run)], ['f', 'F']) then // can't mix
+              Break;
+        end;
+      'u', 'U':
+        if FTokenID = tkFloat then // not allowed
+          Break
+        else
+          for i := idx1 to Pred(Run) do
+            if CharInSet(FLine[i], ['u', 'U']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+      '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 TSynCppSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {or assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncOrAssign;
+      end;
+    '|':                               {logical or}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogOr;
+      end;
+  else                                 {or}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkIncOr;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAddAssign;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncrement;
+      end;
+  else                                 {add}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAdd;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
+    begin                              {ellipse}
+      Inc(Run, 3);
+      FExtTokenID := xtkEllipse;
+    end
+  else
+    if CharInSet(FLine[Run + 1], ['0'..'9']) then // float
+    begin
+      Dec(Run); // numberproc must see the point
+      NumberProc;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkPoint;
+    end;
+end;
+
+procedure TSynCppSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundClose;
+end;
+
+procedure TSynCppSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundOpen;
+end;
+
+procedure TSynCppSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSemiColon;
+  if FRange = rsAsm then FRange := rsUnknown;
+end;
+
+procedure TSynCppSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':                               {c++ style comments}
+      begin
+        FTokenID := tkComment;
+        Inc(Run, 2);
+        while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '*':                               {c style comments}
+      begin
+        FTokenID := tkComment;
+        if FRange = rsAsm then
+          FRange := rsAnsiCAsm
+        else if FRange = rsAsmBlock then
+          FRange := rsAnsiCAsmBlock
+        else if FRange <> rsDirectiveComment then
+          FRange := rsAnsiC;
+        Inc(Run, 2);
+        while FLine[Run] <> #0 do
+          case FLine[Run] of
+            '*':
+              if FLine[Run + 1] = '/' then
+              begin
+                Inc(Run, 2);
+                if FRange = rsDirectiveComment then
+                  FRange := rsMultiLineDirective
+                else if FRange = rsAnsiCAsm then
+                  FRange := rsAsm
+                else
+                  begin
+                  if FRange = rsAnsiCAsmBlock then
+                    FRange := rsAsmBlock
+                  else
+                    FRange := rsUnknown;
+                  end;
+                Break;
+              end else Inc(Run);
+            #10, #13:
+              begin
+                if FRange = rsDirectiveComment then
+                  FRange := rsAnsiC;
+                Break;
+              end;
+          else Inc(Run);
+          end;
+      end;
+    '=':                               {divide assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+        FExtTokenID := xtkDivideAssign;
+      end;
+  else                                 {divide}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      FExtTokenID := xtkDivide;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynCppSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareClose;
+end;
+
+procedure TSynCppSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareOpen;
+end;
+
+procedure TSynCppSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkMultiplyAssign;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkStar;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      case FLine[Run + 1] of
+        #34, '\':
+          Inc(Run);
+        #00:
+          begin
+            Inc(Run);
+            FRange := rsMultilineString;
+            Exit;
+          end;
+      end;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynCppSyn.StringEndProc;
+begin
+  FTokenID := tkString;
+
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  FRange := rsUnknown;
+
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '\':
+        begin
+          case FLine[Run + 1] of
+            #34, '\':
+              Inc(Run);
+            #00:
+              begin
+                Inc(Run);
+                FRange := rsMultilineString;
+                Exit;
+              end;
+          end;
+        end;
+      #34: Break;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynCppSyn.TildeProc;
+begin
+  Inc(Run);                            {bitwise complement}
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBitComplement;
+end;
+
+procedure TSynCppSyn.XOrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+  	'=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkXorAssign;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkXor;
+    end;
+  end;
+end;
+
+procedure TSynCppSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynCppSyn.Next;
+begin
+  FAsmStart := False;
+  FTokenPos := Run;
+  case FRange of
+    rsAnsiC, rsAnsiCAsm,
+    rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
+    rsMultiLineDirective: DirectiveEndProc;
+    rsMultilineString: StringEndProc;
+  else
+    begin
+      case FLine[Run] of
+        '&': AndSymbolProc;
+        #39: AsciiCharProc;
+        '@': AtSymbolProc;
+        '}': BraceCloseProc;
+        '{': BraceOpenProc;
+        #13: CRProc;
+        ':': ColonProc;
+        ',': CommaProc;
+        '#': DirectiveProc;
+        '=': EqualProc;
+        '>': GreaterProc;
+        '?': QuestionProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        #10: LFProc;
+        '<': LowerProc;
+        '-': MinusProc;
+        '%': ModSymbolProc;
+        '!': NotSymbolProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '|': OrSymbolProc;
+        '+': PlusProc;
+        '.': PointProc;
+        ')': RoundCloseProc;
+        '(': RoundOpenProc;
+        ';': SemiColonProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        ']': SquareCloseProc;
+        '[': SquareOpenProc;
+        '*': StarProc;
+        #34: StringProc;
+        '~': TildeProc;
+        '^': XOrSymbolProc;
+        else UnknownProc;
+      end;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynCppSyn.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;
+	SYN_ATTR_CHAR: Result := fCharAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynCppSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCppSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynCppSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+  if ((FRange = rsAsm) or (FRange = rsAsmBlock)) and not FAsmStart
+    and not (FTokenID in [tkComment, tkSpace, tkNull])
+  then
+    Result := tkAsm;
+end;
+
+function TSynCppSyn.GetExtTokenID: TxtkTokenKind;
+begin
+  Result := FExtTokenID;
+end;
+
+function TSynCppSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  FTokenID := GetTokenID;
+  case FTokenID of
+    tkAsm: Result := FAsmAttri;
+    tkComment: Result := FCommentAttri;
+    tkDirective: Result := FDirecAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkFloat: Result := FFloatAttri;
+    tkHex: Result := FHexAttri;
+    tkOctal: Result := FOctalAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkChar: Result := FCharAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FInvalidAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynCppSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+procedure TSynCppSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynCppSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynCppSyn.EnumUserSettings(settings: TStrings);
+begin
+  { returns the user settings that exist in the registry }
+  with TBetterRegistry.Create do
+  begin
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
+      begin
+        try
+          GetKeyNames(settings);
+        finally
+          CloseKey;
+        end;
+      end;
+    finally
+      Free;
+    end;
+  end;
+end;
+
+function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
+// Possible parameter values:
+//   index into TStrings returned by EnumUserSettings
+// Possible return values:
+//   True : settings were read and used
+//   False: problem reading settings or invalid version specified - old settings
+//          were preserved
+
+  function ReadCPPBSettings(settingIndex: Integer): Boolean;
+
+    function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
+
+      function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean;
+      var
+        i: Integer;
+      begin
+        for i := 1 to Length(name) do
+          if name[i] = ' ' then name[i] := '_';
+        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
+             '\SOFTWARE\Borland\C++Builder\' + settingTag + '\Highlight', name, True);
+      end; { ReadCPPB1 }
+
+      function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
+      begin
+        Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
+          '\Software\Borland\C++Builder\' + settingTag + '\Editor\Highlight',
+          key, False);
+      end; { ReadCPPB3OrMore }
+
+    begin { ReadCPPBSetting }
+      try
+        if (settingTag[1] = '1') then
+          Result := ReadCPPB1(settingTag,attri,key)
+        else
+          Result := ReadCPPB3OrMore(settingTag,attri,key);
+      except
+        Result := False;
+      end;
+    end; { ReadCPPBSetting }
+
+  var
+    tmpStringAttri    : TSynHighlighterAttributes;
+    tmpCharAttri      : TSynHighlighterAttributes;
+    tmpNumberAttri    : TSynHighlighterAttributes;
+    tmpFloatAttri     : TSynHighlighterAttributes;
+    tmpHexAttri       : TSynHighlighterAttributes;
+    tmpOctalAttri     : TSynHighlighterAttributes;
+    tmpKeyAttri       : TSynHighlighterAttributes;
+    tmpSymbolAttri    : TSynHighlighterAttributes;
+    tmpAsmAttri       : TSynHighlighterAttributes;
+    tmpCommentAttri   : TSynHighlighterAttributes;
+    tmpIdentifierAttri: TSynHighlighterAttributes;
+    tmpInvalidAttri   : TSynHighlighterAttributes;
+    tmpSpaceAttri     : TSynHighlighterAttributes;
+    tmpDirecAttri     : TSynHighlighterAttributes;
+    s                 : TStringList;
+
+  begin { ReadCPPBSettings }
+    s := TStringList.Create;
+    try
+      EnumUserSettings(s);
+      if settingIndex >= s.Count then
+        Result := False
+      else
+      begin
+        tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpCharAttri      := TSynHighlighterAttributes.Create('', '');
+        tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpFloatAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpHexAttri       := TSynHighlighterAttributes.Create('', '');
+        tmpOctalAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpKeyAttri       := TSynHighlighterAttributes.Create('', '');
+        tmpSymbolAttri    := TSynHighlighterAttributes.Create('', '');
+        tmpAsmAttri       := TSynHighlighterAttributes.Create('', '');
+        tmpCommentAttri   := TSynHighlighterAttributes.Create('', '');
+        tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', '');
+        tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
+        tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
+        tmpStringAttri    .Assign(FStringAttri);
+        tmpCharAttri      .Assign(FCharAttri);
+        tmpNumberAttri    .Assign(FNumberAttri);
+        tmpFloatAttri     .Assign(FFloatAttri);
+        tmpHexAttri       .Assign(FHexAttri);
+        tmpOctalAttri     .Assign(FOctalAttri);
+        tmpKeyAttri       .Assign(FKeyAttri);
+        tmpSymbolAttri    .Assign(FSymbolAttri);
+        tmpAsmAttri       .Assign(FAsmAttri);
+        tmpCommentAttri   .Assign(FCommentAttri);
+        tmpIdentifierAttri.Assign(FIdentifierAttri);
+        tmpInvalidAttri   .Assign(FInvalidAttri);
+        tmpSpaceAttri     .Assign(FSpaceAttri);
+        tmpDirecAttri     .Assign(FDirecAttri);
+        if s[settingIndex][1] = '1' then
+          Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Plain text')
+        else
+          Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Assembler');
+        Result := Result                                                         and
+                  ReadCPPBSetting(s[settingIndex],FCommentAttri,'Comment')       and
+                  ReadCPPBSetting(s[settingIndex],FIdentifierAttri,'Identifier') and
+                  ReadCPPBSetting(s[settingIndex],FInvalidAttri,'Illegal Char')  and
+                  ReadCPPBSetting(s[settingIndex],FKeyAttri,'Reserved word')     and
+                  ReadCPPBSetting(s[settingIndex],FNumberAttri,'Integer')        and
+                  ReadCPPBSetting(s[settingIndex],FFloatAttri,'Float')           and
+                  ReadCPPBSetting(s[settingIndex],FHexAttri,'Hex')               and
+                  ReadCPPBSetting(s[settingIndex],FOctalAttri,'Octal')           and
+                  ReadCPPBSetting(s[settingIndex],FSpaceAttri,'Whitespace')      and
+                  ReadCPPBSetting(s[settingIndex],FStringAttri,'String')         and
+                  ReadCPPBSetting(s[settingIndex],FCharAttri,'Character')             and
+                  ReadCPPBSetting(s[settingIndex],FSymbolAttri,'Symbol')         and
+                  ReadCPPBSetting(s[settingIndex],FDirecAttri,'Preprocessor');
+        if not Result then
+        begin
+          FStringAttri    .Assign(tmpStringAttri);
+          FCharAttri      .Assign(tmpCharAttri);
+          FNumberAttri    .Assign(tmpNumberAttri);
+          FFloatAttri     .Assign(tmpFloatAttri);
+          FHexAttri       .Assign(tmpHexAttri);
+          FOctalAttri     .Assign(tmpOctalAttri);
+          FKeyAttri       .Assign(tmpKeyAttri);
+          FSymbolAttri    .Assign(tmpSymbolAttri);
+          FAsmAttri       .Assign(tmpAsmAttri);
+          FCommentAttri   .Assign(tmpCommentAttri);
+          FIdentifierAttri.Assign(tmpIdentifierAttri);
+          FInvalidAttri   .Assign(tmpInvalidAttri);
+          FSpaceAttri     .Assign(tmpSpaceAttri);
+          FDirecAttri     .Assign(tmpDirecAttri);
+        end;
+        tmpStringAttri    .Free;
+        tmpCharAttri      .Free;
+        tmpNumberAttri    .Free;
+        tmpFloatAttri     .Free;
+        tmpHexAttri       .Free;
+        tmpOctalAttri     .Free;
+        tmpKeyAttri       .Free;
+        tmpSymbolAttri    .Free;
+        tmpAsmAttri       .Free;
+        tmpCommentAttri   .Free;
+        tmpIdentifierAttri.Free;
+        tmpInvalidAttri   .Free;
+        tmpSpaceAttri     .Free;
+        tmpDirecAttri     .Free;
+      end;
+    finally
+      s.Free;
+    end;
+  end; { ReadCPPBSettings }
+
+begin
+  Result := ReadCPPBSettings(settingIndex);
+end; { TSynCppSyn.UseUserSettings }
+
+function TSynCppSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCPP;
+end;
+
+class function TSynCppSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCPP;
+end;
+
+class function TSynCppSyn.GetCapabilities: TSynHighlighterCapabilities;
+begin
+  Result := inherited GetCapabilities + [hcUserSettings];
+end;
+
+function TSynCppSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '// Syntax Highlighting'#13#10+
+    'void __fastcall TForm1::Button1Click(TObject *Sender)'#13#10+
+    '{'#13#10+
+    '  int number = 123456;'#13#10+
+    '  char c = ''a'';'#13#10+
+    '  Caption = "The number is " + IntToStr(i);'#13#10+
+    '  for (int i = 0; i <= number; i++)'#13#10+
+    '  {'#13#10+
+    '    x -= 0xff;'#13#10+
+    '    x -= 023;'#13#10+
+    '    x += 1.0;'#13#10+
+    '    x += @; /* illegal character */'#13#10+
+    '  }'#13#10+
+    '  #ifdef USE_ASM'#13#10+
+    '    asm'#13#10+
+    '    {'#13#10+
+    '      ASM MOV AX, 0x1234'#13#10+
+    '      ASM MOV i, AX'#13#10+
+    '    }'#13#10+
+    '  #endif'#13#10+
+    '}';
+end;
+
+class function TSynCppSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCPP;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCppSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterCss.pas b/Source/VCL/SynEdit/Source/SynHighlighterCss.pas
index 7b964f07..d0a41711 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterCss.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterCss.pas
@@ -1,1069 +1,1146 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterEnhCSS.pas, released 2001-10-28
-Initial modifications to this CSS Highlighter were made by Ashley Brown,
-ashley@ashleybrown.co.uk.
-
-The Original Code is based on the SynHighlighterHTML.pas, released 2000-04-10 - 
-this in turn was based on the hkHTMLSyn.pas file from the mwEdit component suite
-by Martin Waldenburg and other developers, the Initial Author of this file is
-Hideo Koiso.
-Unicode translation by Maël Hörz.
-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.
-
-You may retrieve the latest version of SynEdit from the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-You may retrieve the latest version of this file from
-http://www.ashleybrown.co.uk/synedit/
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides an improved CSS highlighter for SynEdit)
-@author(Ashley Brown, based on HTML highlighter by Hideo Koiso and converted to SynEdit by Michael Hieke)
-@created(2001-10-28)
-@lastmod(2003-05-11)
-The SynHighlighterEnhCSS unit provides SynEdit with an improved CSS highlighter.
-
-http://www.ashleybrown.co.uk/
-ashley@ashleybrown.co.uk
-}
-
-unit SynHighlighterCSS;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkProperty, tkSelector, tkSelectorAttrib, tkNull,
-    tkSpace, tkString, tkSymbol, tkText, tkUndefProperty, tkValue, tkColor,
-    tkNumber, tkImportant);
-
-  TRangeState = (rsComment, rsSelector, rsDeclaration, rsUnknown, rsProperty,
-    rsValue, rsAttrib, rsParameter);
-
-  TSynCssSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fCommentRange: TRangeState;
-    fParameterRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fPropertyAttri: TSynHighlighterAttributes;
-    fAttributeAttri: TSynHighlighterAttributes;
-    fSelectorAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fColorAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fTextAttri: TSynHighlighterAttributes;
-    fValueAttri: TSynHighlighterAttributes;
-    fUndefPropertyAttri: TSynHighlighterAttributes;
-    fImportantPropertyAttri: TSynHighlighterAttributes;
-    fKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: string; AKind: integer);
-    function HashKey(Str: PWideChar): Integer;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure SelectorProc;
-    procedure AttributeProc;
-    procedure CommentProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure ParenOpenProc;
-    procedure ParenCloseProc;
-    procedure BracketOpenProc;
-    procedure BracketCloseProc;
-    procedure CRProc;
-    procedure SemiProc;
-    procedure StartValProc;
-    procedure NumberProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure HashProc;
-    procedure SlashProc;
-    procedure GreaterProc;
-    procedure PlusProc;
-    procedure TildeProc;
-    procedure PipeProc;
-    procedure EqualProc;
-    procedure ExclamProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-    procedure NextDeclaration;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property PropertyAttri: TSynHighlighterAttributes read fPropertyAttri
-      write fPropertyAttri;
-    property ColorAttri: TSynHighlighterAttributes read fColorAttri
-      write fColorAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property SelectorAttri: TSynHighlighterAttributes read fSelectorAttri
-      write fSelectorAttri;
-    property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri
-      write fAttributeAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property TextAttri: TSynHighlighterAttributes read fTextAttri
-      write fTextAttri;
-    property ValueAttri: TSynHighlighterAttributes read fValueAttri
-      write fValueAttri;
-    property UndefPropertyAttri: TSynHighlighterAttributes read fUndefPropertyAttri
-      write fUndefPropertyAttri;
-    property ImportantPropertyAttri: TSynHighlighterAttributes read fImportantPropertyAttri
-      write fImportantPropertyAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-   Properties_CSS1 : string =
-                      'background'
-                     +',background-attachment'
-                     +',background-color'
-                     +',background-image'
-                     +',background-position'
-                     +',background-repeat'
-                     +',border'
-                     +',border-bottom'
-                     +',border-bottom-color'
-                     +',border-bottom-style'
-                     +',border-bottom-width'
-                     +',border-color'
-                     +',border-left'
-                     +',border-left-color'
-                     +',border-left-style'
-                     +',border-left-width'
-                     +',border-right'
-                     +',border-right-color'
-                     +',border-right-style'
-                     +',border-right-width'
-                     +',border-style'
-                     +',border-top'
-                     +',border-top-color'
-                     +',border-top-style'
-                     +',border-top-width'
-                     +',border-width'
-                     +',clear'
-                     +',color'
-                     +',display'
-                     +',float'
-                     +',font'
-                     +',font-family'
-                     +',font-size'
-                     +',font-style'
-                     +',font-variant'
-                     +',font-weight'
-                     +',height'
-                     +',letter-spacing'
-                     +',line-height'
-                     +',list-style'
-                     +',list-style-image'
-                     +',list-style-position'
-                     +',list-style-type'
-                     +',margin'
-                     +',margin-bottom'
-                     +',margin-left'
-                     +',margin-right'
-                     +',margin-top'
-                     +',padding'
-                     +',padding-bottom'
-                     +',padding-left'
-                     +',padding-right'
-                     +',padding-top'
-                     +',text-align'
-                     +',text-decoration'
-                     +',text-indent'
-                     +',text-transform'
-                     +',vertical-align'
-                     +',white-space'
-                     +',width'
-                     +',word-spacing';
-   Properties_CSS2 : string =
-                      'border-collapse'
-                     +',border-spacing'
-                     +',bottom'
-                     +',caption-side'
-                     +',clip'
-                     +',content'
-                     +',counter-increment'
-                     +',counter-reset'
-                     +',cursor'
-                     +',direction'
-                     +',empty-cells'
-                     +',left'
-                     +',max-height'
-                     +',max-width'
-                     +',min-height'
-                     +',min-width'
-                     +',orphans'
-                     +',outline'
-                     +',outline-color'
-                     +',outline-style'
-                     +',outline-width'
-                     +',overflow'
-                     +',page-break-after'
-                     +',page-break-before'
-                     +',page-break-inside'
-                     +',position'
-                     +',quotes'
-                     +',right'
-                     +',table-layout'
-                     +',top'
-                     +',unicode-bidi'
-                     +',visibility'
-                     +',widows'
-                     +',z-index';
-   Properties_CSS2_Aural : string =
-                      'azimuth'
-                     +',cue'
-                     +',cue-after'
-                     +',cue-before'
-                     +',elevation'
-                     +',pause'
-                     +',pause-after'
-                     +',pause-before'
-                     +',pitch'
-                     +',pitch-range'
-                     +',play-during'
-                     +',richness'
-                     +',speak'
-                     +',speak-header'
-                     +',speak-numeral'
-                     +',speak-punctuation'
-                     +',speech-rate'
-                     +',stress'
-                     +',voice-family'
-                     +',volume';
-   Properties_CSS3 : string =
-                      '@font-face'
-                     +',@font-feature-values'
-                     +',@keyframes'
-                     +',align-content'
-                     +',align-items'
-                     +',align-self'
-                     +',alignment-adjust'
-                     +',alignment-baseline'
-                     +',animation'
-                     +',animation-delay'
-                     +',animation-direction'
-                     +',animation-duration'
-                     +',animation-fill-mode'
-                     +',animation-iteration-count'
-                     +',animation-name'
-                     +',animation-play-state'
-                     +',animation-timing-function'
-                     +',appearance'
-                     +',backface-visibility'
-                     +',background-clip'
-                     +',background-origin'
-                     +',background-size'
-                     +',baseline-shift'
-                     +',bookmark-label'
-                     +',bookmark-level'
-                     +',bookmark-target'
-                     +',border-bottom-left-radius'
-                     +',border-bottom-right-radius'
-                     +',border-image'
-                     +',border-image-outset'
-                     +',border-image-repeat'
-                     +',border-image-slice'
-                     +',border-image-source'
-                     +',border-image-width'
-                     +',border-radius'
-                     +',border-top-left-radius'
-                     +',border-top-right-radius'
-                     +',box-align'
-                     +',box-decoration-break'
-                     +',box-direction'
-                     +',box-flex'
-                     +',box-flex-group'
-                     +',box-lines'
-                     +',box-ordinal-group'
-                     +',box-orient'
-                     +',box-pack'
-                     +',box-shadow'
-                     +',box-sizing'
-                     +',break-after'
-                     +',break-before'
-                     +',break-inside'
-                     +',color-profile'
-                     +',column-count'
-                     +',column-fill'
-                     +',column-gap'
-                     +',column-rule'
-                     +',column-rule-color'
-                     +',column-rule-style'
-                     +',column-rule-width'
-                     +',columns'
-                     +',column-span'
-                     +',column-width'
-                     +',crop'
-                     +',dominant-baseline'
-                     +',drop-initial-after-adjust'
-                     +',drop-initial-after-align'
-                     +',drop-initial-before-adjust'
-                     +',drop-initial-before-align'
-                     +',drop-initial-size'
-                     +',drop-initial-value'
-                     +',filter'
-                     +',fit'
-                     +',fit-position'
-                     +',float-offset'
-                     +',flex'
-                     +',flex-basis'
-                     +',flex-direction'
-                     +',flex-flow'
-                     +',flex-grow'
-                     +',flex-shrink'
-                     +',flex-wrap'
-                     +',font-size-adjust'
-                     +',font-feature-setting'
-                     +',font-kerning'
-                     +',font-language-override'
-                     +',font-synthesis'
-                     +',font-variant-alternates'
-                     +',font-variant-caps'
-                     +',font-variant-east-asian'
-                     +',font-variant-ligatures'
-                     +',font-variant-numeric'
-                     +',font-variant-position'
-                     +',font-stretch'
-                     +',grid-columns'
-                     +',grid-rows'
-                     +',hanging-punctuation'
-                     +',hyphenate-after'
-                     +',hyphenate-before'
-                     +',hyphenate-character'
-                     +',hyphenate-lines'
-                     +',hyphenate-resource'
-                     +',hyphens'
-                     +',icon'
-                     +',image-orientation'
-                     +',image-rendering'
-                     +',image-resolution'
-                     +',ime-mode'
-                     +',justify-content'
-                     +',inline-box-align'
-                     +',line-break'
-                     +',line-stacking'
-                     +',line-stacking-ruby'
-                     +',line-stacking-shift'
-                     +',line-stacking-strategy'
-                     +',mark'
-                     +',mark-after'
-                     +',mark-before'
-                     +',marks'
-                     +',marquee-direction'
-                     +',marquee-play-count'
-                     +',marquee-speed'
-                     +',marquee-style'
-                     +',mask'
-                     +',mask-type'
-                     +',move-to'
-                     +',nav-down'
-                     +',nav-index'
-                     +',nav-left'
-                     +',nav-right'
-                     +',nav-up'
-                     +',object-fit'
-                     +',object-position'
-                     +',opacity'
-                     +',order'
-                     +',outline-offset'
-                     +',overflow-style'
-                     +',overflow-x'
-                     +',overflow-y'
-                     +',overflow-wrap'
-                     +',page'
-                     +',page-policy'
-                     +',perspective'
-                     +',perspective-origin'
-                     +',phonemes'
-                     +',punctuation-trim'
-                     +',rendering-intent'
-                     +',resize'
-                     +',rest'
-                     +',rest-after'
-                     +',rest-before'
-                     +',rotation'
-                     +',rotation-point'
-                     +',ruby-align'
-                     +',ruby-overhang'
-                     +',ruby-position'
-                     +',ruby-span'
-                     +',size'
-                     +',string-set'
-                     +',tab-size'
-                     +',target'
-                     +',target-name'
-                     +',target-new'
-                     +',target-position'
-                     +',text-align-last'
-                     +',text-combine-horizontal'
-                     +',text-decoration-color'
-                     +',text-decoration-line'
-                     +',text-decoration-style'
-                     +',text-height'
-                     +',text-justify'
-                     +',text-orientation'
-                     +',text-outline'
-                     +',text-overflow'
-                     +',text-shadow'
-                     +',text-underline-position'
-                     +',text-wrap'
-                     +',transform'
-                     +',transform-origin'
-                     +',transform-style'
-                     +',transition'
-                     +',transition-delay'
-                     +',transition-duration'
-                     +',transition-property'
-                     +',transition-timing-function'
-                     +',voice-balance'
-                     +',voice-duration'
-                     +',voice-pitch'
-                     +',voice-pitch-range'
-                     +',voice-rate'
-                     +',voice-stress'
-                     +',voice-volume'
-                     +',word-break'
-                     +',word-wrap'
-                     +',writing-mode';
-
-{ TSynCssSyn }
-
-{$Q-}
-function TSynCssSyn.HashKey(Str: PWideChar): Integer;
-begin
-  Result := 0;
-  while CharInSet(Str^, ['a'..'z', 'A'..'Z', '_', '-']) do
-  begin
-    if Str^ <> '-' then
-    case Str^ of
-      '_': Inc(Result, 27);
-      '-': Inc(Result, 28);
-      else Inc(Result, Ord(SysUtils.AnsiUpperCase(Str^)[1]) - 64);
-    end;
-    Inc(Str);
-  end;
-  while CharInSet(Str^, ['0'..'9']) do
-  begin
-    Inc(Result, Ord(Str^) - Ord('0'));
-    Inc(Str);
-  end;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynCssSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Entry: TSynHashEntry;
-begin
-  fToIdent := MayBe;
-  Entry := fKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > fStringLen then
-      break
-    else if Entry.KeywordLen = fStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkUndefProperty;
-end;
-
-procedure TSynCssSyn.DoAddKeyword(AKeyword: string; AKind: Integer);
-var
-  HashValue: Integer;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-constructor TSynCssSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fKeywords := TSynHashEntryList.Create;
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(fCommentAttri);
-
-  fPropertyAttri := TSynHighlighterAttributes.Create(SYNS_AttrProperty, SYNS_FriendlyAttrProperty);
-  fPropertyAttri.Style := [fsBold];
-  AddAttribute(fPropertyAttri);
-
-  fSelectorAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fSelectorAttri.Style := [fsBold];
-  fSelectorAttri.Foreground := $00ff0080;
-  AddAttribute(fSelectorAttri);
-
-  fAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
-  fAttributeAttri.Style := [];
-  fAttributeAttri.Foreground := $00ff0080;
-  AddAttribute(fAttributeAttri);
-
-  fUndefPropertyAttri := TSynHighlighterAttributes.Create(
-    SYNS_AttrUndefinedProperty, SYNS_FriendlyAttrUndefinedProperty);
-  fUndefPropertyAttri.Style := [fsBold];
-  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);
-
-  fColorAttri := TSynHighlighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor);
-  AddAttribute(fColorAttri);
-
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-
-  fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
-  AddAttribute(fTextAttri);
-
-  fValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  fValueAttri.Foreground := $00ff8000;
-  AddAttribute(fValueAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-
-  // TODO: differentiating tkProperty for CSS1, CSS2 & CSS3 highlighting
-  EnumerateKeywords(Ord(tkProperty), Properties_CSS1, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkProperty), Properties_CSS2, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkProperty), Properties_CSS2_Aural, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkProperty), Properties_CSS3, IsIdentChar, DoAddKeyword);
-
-  fRange := rsSelector;
-  fDefaultFilter := SYNS_FilterCSS;
-end;
-
-destructor TSynCssSyn.Destroy;
-begin
-  fKeywords.Free;
-  inherited Destroy;
-end;
-
-procedure TSynCssSyn.AttributeProc;
-
-  function IsStopChar: Boolean;
-  begin
-    case fLine[Run] of
-      #0..#31, ']', '~', '^', '$', '*', '|', '=':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  if IsStopChar then
-  begin
-    case fLine[Run] of
-      #0..#31, '{', '/': NextDeclaration;
-      ']': BracketCloseProc;
-      '~': TildeProc;
-      '|': PipeProc;
-      '=': EqualProc;
-    end;
-    Exit;
-  end;
-
-  fTokenID := tkSelectorAttrib;
-  while not IsStopChar do
-    Inc(Run);
-end;
-
-procedure TSynCssSyn.BraceCloseProc;
-begin
-  fRange := rsSelector;
-  fTokenId := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.BraceOpenProc;
-begin
-  Inc(Run);
-  fRange := rsDeclaration;
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynCssSyn.BracketCloseProc;
-begin
-  fTokenID := tkSymbol;
-  fRange := rsSelector;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.BracketOpenProc;
-begin
-  Inc(Run);
-  fRange := rsAttrib;
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynCssSyn.CommentProc;
-begin
-  if fLine[Run] = #0 then
-    NullProc
-  else
-  begin
-    fTokenID := tkComment;
-    repeat
-      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then
-      begin
-        fRange := fCommentRange;
-        inc(Run, 2);
-        break;
-      end;
-      inc(Run);
-    until IsLineEnd(Run)
-  end;
-end;
-
-procedure TSynCssSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynCssSyn.SemiProc;
-begin
-  fRange := rsUnknown;
-  fTokenID := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.StartValProc;
-begin
-  fRange := rsValue;
-  fTokenID := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.NumberProc;
-begin
-  if (FLine[Run] = '-') and not CharInSet(FLine[Run + 1], ['0'..'9']) then
-    IdentProc
-  else
-  begin
-    inc(Run);
-    fTokenID := tkNumber;
-    while CharInSet(FLine[Run], ['0'..'9', '.']) do
-    begin
-      case FLine[Run] of
-        '.':
-          if FLine[Run + 1] = '.' then break;
-      end;
-      inc(Run);
-    end;
-  end;
-end;
-
-procedure TSynCssSyn.ParenCloseProc;
-begin
-  fRange := fParameterRange;
-  fTokenID := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.ParenOpenProc;
-begin
-  Inc(Run);
-  fParameterRange := fRange;
-  fRange := rsParameter;
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynCssSyn.PipeProc;
-begin
-  Inc(Run);
-  if fLine[Run] = '=' then
-  begin
-    Inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynCssSyn.PlusProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynCssSyn.IdentProc;
-begin
-  case fRange of
-    rsProperty:
-      begin
-        fRange := rsDeclaration;
-        fTokenID := tkSelector;
-        Inc(Run, fStringLen);
-      end;
-    rsValue, rsParameter:
-      begin
-        fTokenID := tkValue;
-
-        while not IsLineEnd(Run) and
-          not CharInSet(fLine[Run], ['(', ')', '}', ';', ',', ' ']) do
-        begin
-          Inc(Run);
-        end;
-
-        if IsLineEnd(Run) or CharInSet(fLine[Run], ['}', ';']) then
-          fRange := rsDeclaration;
-      end;
-    else
-      fTokenID := IdentKind((fLine + Run));
-      repeat
-        Inc(Run);
-      until (fLine[Run] <= #32) or CharInSet(fLine[Run], [':', '"', '}', ';']);
-  end;
-end;
-
-procedure TSynCssSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynCssSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynCssSyn.SelectorProc;
-
-  function IsStopChar: Boolean;
-  begin
-    case fLine[Run] of
-      #0..#31, '{', '/', '[', ']', '>', '+', '~':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  if IsStopChar then
-  begin
-    case fLine[Run] of
-      #0..#31, '{', '/': NextDeclaration;
-      '[': BracketOpenProc;
-      ']': BracketCloseProc;
-      '>': GreaterProc;
-      '+': PlusProc;
-      '~': TildeProc;
-    end;
-    Exit;
-  end;
-
-  fTokenID := tkSelector;
-  while not IsStopChar do
-    Inc(Run);
-end;
-
-procedure TSynCssSyn.TildeProc;
-begin
-  Inc(Run);
-  if fLine[Run] = '=' then
-  begin
-    Inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynCssSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynCssSyn.StringProc;
-begin
-  fTokenID := tkString;
-  Inc(Run);  // first '"'
-  while not (IsLineEnd(Run) or (fLine[Run] = '"')) do Inc(Run);
-  if fLine[Run] = '"' then Inc(Run);  // last '"'
-end;
-
-procedure TSynCssSyn.HashProc;
-
-  function IsHexChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  fTokenID := tkColor;
-  Inc(Run);  // '#'
-  while IsHexChar do Inc(Run);
-end;
-
-procedure TSynCssSyn.EqualProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-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);
-  if fLine[Run] = '*' then
-  begin
-    fTokenID := tkComment;
-    fCommentRange := fRange;
-    fRange := rsComment;
-    inc(Run);
-    if not IsLineEnd(Run) then
-      CommentProc;
-  end
-  else
-    fTokenID := tkSymbol;
-end;
-
-procedure TSynCssSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsSelector:
-      SelectorProc;
-    rsAttrib:
-      AttributeProc;
-    rsComment:
-      CommentProc;
-    else
-      NextDeclaration;
-  end;
-  inherited;
-end;
-
-procedure TSynCssSyn.NextDeclaration;
-begin
-  case fLine[Run] of
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '"': StringProc;
-    '#': HashProc;
-    '{': BraceOpenProc;
-    '}': BraceCloseProc;
-    '(': ParenOpenProc;
-    ')': ParenCloseProc;
-    ':', ',': StartValProc;
-    ';': SemiProc;
-    '0'..'9', '-', '.': NumberProc;
-    '/': SlashProc;
-    '!': ExclamProc;
-    else IdentProc;
-  end;
-end;
-
-function TSynCssSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := fCommentAttri;
-    SYN_ATTR_KEYWORD: Result := fSelectorAttri;
-    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
-    SYN_ATTR_STRING: Result := fStringAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynCssSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynCssSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynCssSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkProperty: Result := fPropertyAttri;
-    tkSelector: Result := fSelectorAttri;
-    tkSelectorAttrib: Result := fAttributeAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkText: Result := fTextAttri;
-    tkUndefProperty: Result := fUndefPropertyAttri;
-    tkImportant: Result := fImportantPropertyAttri;
-    tkValue: Result := fValueAttri;
-    tkColor: Result := fColorAttri;
-    tkNumber: Result := fNumberAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynCssSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-procedure TSynCssSyn.GreaterProc;
-begin
-  Inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-function TSynCssSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-procedure TSynCssSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynCssSyn.ResetRange;
-begin
-  fRange:= rsSelector;
-end;
-
-function TSynCssSyn.GetSampleSource: string;
-begin
-  Result := '/* Syntax Highlighting */'#13#10 +
-        'body { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 8pt }'#13#10 +
-        'H1 { font-size: 18pt; color: #000099; made-up-property: 1 }';
-end; { GetSampleSource }
-
-class function TSynCssSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangCSS;
-end;
-
-function TSynCssSyn.IsFilterStored: boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterCSS;
-end;
-
-function TSynCssSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '_', '-', '0'..'9', 'A'..'Z', 'a'..'z':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynCssSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangCSS;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynCssSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterEnhCSS.pas, released 2001-10-28
+Initial modifications to this CSS Highlighter were made by Ashley Brown,
+ashley@ashleybrown.co.uk.
+
+The Original Code is based on the SynHighlighterHTML.pas, released 2000-04-10 - 
+this in turn was based on the hkHTMLSyn.pas file from the mwEdit component suite
+by Martin Waldenburg and other developers, the Initial Author of this file is
+Hideo Koiso.
+Unicode translation by Maël Hörz.
+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.
+
+You may retrieve the latest version of SynEdit from the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+You may retrieve the latest version of this file from
+http://www.ashleybrown.co.uk/synedit/
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides an improved CSS highlighter for SynEdit)
+@author(Ashley Brown, based on HTML highlighter by Hideo Koiso and converted to SynEdit by Michael Hieke)
+@created(2001-10-28)
+@lastmod(2003-05-11)
+The SynHighlighterEnhCSS unit provides SynEdit with an improved CSS highlighter.
+
+http://www.ashleybrown.co.uk/
+ashley@ashleybrown.co.uk
+}
+
+unit SynHighlighterCSS;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynHighlighterHashEntries,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkAtRule, tkProperty, tkSelector, tkSelectorAttrib,
+    tkNull, tkSpace, tkString, tkSymbol, tkText, tkUndefProperty, tkValue,
+    tkColor, tkNumber, tkImportant);
+
+  TRangeState = (rsComment, rsSelector, rsDeclaration, rsUnknown, rsProperty,
+    rsValue, rsAttrib, rsParameter);
+
+  TSynCssSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FCommentRange: TRangeState;
+    FParameterRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FPropertyAttri: TSynHighlighterAttributes;
+    FAttributeAttri: TSynHighlighterAttributes;
+    FSelectorAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FColorAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FTextAttri: TSynHighlighterAttributes;
+    FValueAttri: TSynHighlighterAttributes;
+    FUndefPropertyAttri: TSynHighlighterAttributes;
+    FImportantPropertyAttri: TSynHighlighterAttributes;
+    FAtRuleAttri: TSynHighlighterAttributes;
+    FKeywords: TSynHashEntryList;
+    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    function HashKey(Str: PWideChar): Integer;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure AtRuleProc;
+    procedure SelectorProc;
+    procedure AttributeProc;
+    procedure CommentProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure ParenOpenProc;
+    procedure ParenCloseProc;
+    procedure BracketOpenProc;
+    procedure BracketCloseProc;
+    procedure CRProc;
+    procedure SemiProc;
+    procedure StartValProc;
+    procedure NumberProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure HashProc;
+    procedure SlashProc;
+    procedure GreaterProc;
+    procedure PlusProc;
+    procedure TildeProc;
+    procedure PipeProc;
+    procedure CircumflexProc;
+    procedure AttrContainProc;
+    procedure EqualProc;
+    procedure ExclamProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+    procedure NextDeclaration;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property PropertyAttri: TSynHighlighterAttributes read FPropertyAttri
+      write FPropertyAttri;
+    property ColorAttri: TSynHighlighterAttributes read FColorAttri
+      write FColorAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property AtRuleAttri: TSynHighlighterAttributes read FAtRuleAttri
+      write FAtRuleAttri;
+    property SelectorAttri: TSynHighlighterAttributes read FSelectorAttri
+      write FSelectorAttri;
+    property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri
+      write FAttributeAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+    property TextAttri: TSynHighlighterAttributes read FTextAttri
+      write FTextAttri;
+    property ValueAttri: TSynHighlighterAttributes read FValueAttri
+      write FValueAttri;
+    property UndefPropertyAttri: TSynHighlighterAttributes read FUndefPropertyAttri
+      write FUndefPropertyAttri;
+    property ImportantPropertyAttri: TSynHighlighterAttributes read FImportantPropertyAttri
+      write FImportantPropertyAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+   Properties_CSS1 : UnicodeString =
+                      'background'
+                     +',background-attachment'
+                     +',background-color'
+                     +',background-image'
+                     +',background-position'
+                     +',background-repeat'
+                     +',border'
+                     +',border-bottom'
+                     +',border-bottom-color'
+                     +',border-bottom-style'
+                     +',border-bottom-width'
+                     +',border-color'
+                     +',border-left'
+                     +',border-left-color'
+                     +',border-left-style'
+                     +',border-left-width'
+                     +',border-right'
+                     +',border-right-color'
+                     +',border-right-style'
+                     +',border-right-width'
+                     +',border-style'
+                     +',border-top'
+                     +',border-top-color'
+                     +',border-top-style'
+                     +',border-top-width'
+                     +',border-width'
+                     +',clear'
+                     +',color'
+                     +',display'
+                     +',float'
+                     +',font'
+                     +',font-family'
+                     +',font-size'
+                     +',font-style'
+                     +',font-variant'
+                     +',font-weight'
+                     +',height'
+                     +',letter-spacing'
+                     +',line-height'
+                     +',list-style'
+                     +',list-style-image'
+                     +',list-style-position'
+                     +',list-style-type'
+                     +',margin'
+                     +',margin-bottom'
+                     +',margin-left'
+                     +',margin-right'
+                     +',margin-top'
+                     +',padding'
+                     +',padding-bottom'
+                     +',padding-left'
+                     +',padding-right'
+                     +',padding-top'
+                     +',text-align'
+                     +',text-decoration'
+                     +',text-indent'
+                     +',text-transform'
+                     +',vertical-align'
+                     +',white-space'
+                     +',width'
+                     +',word-spacing';
+   Properties_CSS2 : UnicodeString =
+                      'border-collapse'
+                     +',border-spacing'
+                     +',bottom'
+                     +',caption-side'
+                     +',clip'
+                     +',content'
+                     +',counter-increment'
+                     +',counter-reset'
+                     +',cursor'
+                     +',direction'
+                     +',empty-cells'
+                     +',left'
+                     +',max-height'
+                     +',max-width'
+                     +',min-height'
+                     +',min-width'
+                     +',orphans'
+                     +',outline'
+                     +',outline-color'
+                     +',outline-style'
+                     +',outline-width'
+                     +',overflow'
+                     +',page-break-after'
+                     +',page-break-before'
+                     +',page-break-inside'
+                     +',position'
+                     +',quotes'
+                     +',right'
+                     +',table-layout'
+                     +',top'
+                     +',unicode-bidi'
+                     +',visibility'
+                     +',widows'
+                     +',z-index';
+   Properties_CSS2_Aural : UnicodeString =
+                      'azimuth'
+                     +',cue'
+                     +',cue-after'
+                     +',cue-before'
+                     +',elevation'
+                     +',pause'
+                     +',pause-after'
+                     +',pause-before'
+                     +',pitch'
+                     +',pitch-range'
+                     +',play-during'
+                     +',richness'
+                     +',speak'
+                     +',speak-header'
+                     +',speak-numeral'
+                     +',speak-punctuation'
+                     +',speech-rate'
+                     +',stress'
+                     +',voice-family'
+                     +',volume';
+   Properties_CSS3 : UnicodeString =
+                      '@font-face'
+                     +',@font-feature-values'
+                     +',@keyframes'
+                     +',align-content'
+                     +',align-items'
+                     +',align-self'
+                     +',alignment-adjust'
+                     +',alignment-baseline'
+                     +',animation'
+                     +',animation-delay'
+                     +',animation-direction'
+                     +',animation-duration'
+                     +',animation-fill-mode'
+                     +',animation-iteration-count'
+                     +',animation-name'
+                     +',animation-play-state'
+                     +',animation-timing-function'
+                     +',appearance'
+                     +',backface-visibility'
+                     +',background-clip'
+                     +',background-origin'
+                     +',background-size'
+                     +',baseline-shift'
+                     +',bookmark-label'
+                     +',bookmark-level'
+                     +',bookmark-target'
+                     +',border-bottom-left-radius'
+                     +',border-bottom-right-radius'
+                     +',border-image'
+                     +',border-image-outset'
+                     +',border-image-repeat'
+                     +',border-image-slice'
+                     +',border-image-source'
+                     +',border-image-width'
+                     +',border-radius'
+                     +',border-top-left-radius'
+                     +',border-top-right-radius'
+                     +',box-align'
+                     +',box-decoration-break'
+                     +',box-direction'
+                     +',box-flex'
+                     +',box-flex-group'
+                     +',box-lines'
+                     +',box-ordinal-group'
+                     +',box-orient'
+                     +',box-pack'
+                     +',box-shadow'
+                     +',box-sizing'
+                     +',break-after'
+                     +',break-before'
+                     +',break-inside'
+                     +',color-profile'
+                     +',column-count'
+                     +',column-fill'
+                     +',column-gap'
+                     +',column-rule'
+                     +',column-rule-color'
+                     +',column-rule-style'
+                     +',column-rule-width'
+                     +',columns'
+                     +',column-span'
+                     +',column-width'
+                     +',crop'
+                     +',dominant-baseline'
+                     +',drop-initial-after-adjust'
+                     +',drop-initial-after-align'
+                     +',drop-initial-before-adjust'
+                     +',drop-initial-before-align'
+                     +',drop-initial-size'
+                     +',drop-initial-value'
+                     +',filter'
+                     +',fit'
+                     +',fit-position'
+                     +',float-offset'
+                     +',flex'
+                     +',flex-basis'
+                     +',flex-direction'
+                     +',flex-flow'
+                     +',flex-grow'
+                     +',flex-shrink'
+                     +',flex-wrap'
+                     +',font-size-adjust'
+                     +',font-feature-setting'
+                     +',font-kerning'
+                     +',font-language-override'
+                     +',font-synthesis'
+                     +',font-variant-alternates'
+                     +',font-variant-caps'
+                     +',font-variant-east-asian'
+                     +',font-variant-ligatures'
+                     +',font-variant-numeric'
+                     +',font-variant-position'
+                     +',font-stretch'
+                     +',grid-columns'
+                     +',grid-rows'
+                     +',hanging-punctuation'
+                     +',hyphenate-after'
+                     +',hyphenate-before'
+                     +',hyphenate-character'
+                     +',hyphenate-lines'
+                     +',hyphenate-resource'
+                     +',hyphens'
+                     +',icon'
+                     +',image-orientation'
+                     +',image-rendering'
+                     +',image-resolution'
+                     +',ime-mode'
+                     +',justify-content'
+                     +',inline-box-align'
+                     +',line-break'
+                     +',line-stacking'
+                     +',line-stacking-ruby'
+                     +',line-stacking-shift'
+                     +',line-stacking-strategy'
+                     +',mark'
+                     +',mark-after'
+                     +',mark-before'
+                     +',marks'
+                     +',marquee-direction'
+                     +',marquee-play-count'
+                     +',marquee-speed'
+                     +',marquee-style'
+                     +',mask'
+                     +',mask-type'
+                     +',move-to'
+                     +',nav-down'
+                     +',nav-index'
+                     +',nav-left'
+                     +',nav-right'
+                     +',nav-up'
+                     +',object-fit'
+                     +',object-position'
+                     +',opacity'
+                     +',order'
+                     +',outline-offset'
+                     +',overflow-style'
+                     +',overflow-x'
+                     +',overflow-y'
+                     +',overflow-wrap'
+                     +',page'
+                     +',page-policy'
+                     +',perspective'
+                     +',perspective-origin'
+                     +',phonemes'
+                     +',punctuation-trim'
+                     +',rendering-intent'
+                     +',resize'
+                     +',rest'
+                     +',rest-after'
+                     +',rest-before'
+                     +',rotation'
+                     +',rotation-point'
+                     +',ruby-align'
+                     +',ruby-overhang'
+                     +',ruby-position'
+                     +',ruby-span'
+                     +',size'
+                     +',string-set'
+                     +',tab-size'
+                     +',target'
+                     +',target-name'
+                     +',target-new'
+                     +',target-position'
+                     +',text-align-last'
+                     +',text-combine-horizontal'
+                     +',text-decoration-color'
+                     +',text-decoration-line'
+                     +',text-decoration-style'
+                     +',text-height'
+                     +',text-justify'
+                     +',text-orientation'
+                     +',text-outline'
+                     +',text-overflow'
+                     +',text-shadow'
+                     +',text-underline-position'
+                     +',text-wrap'
+                     +',transform'
+                     +',transform-origin'
+                     +',transform-style'
+                     +',transition'
+                     +',transition-delay'
+                     +',transition-duration'
+                     +',transition-property'
+                     +',transition-timing-function'
+                     +',voice-balance'
+                     +',voice-duration'
+                     +',voice-pitch'
+                     +',voice-pitch-range'
+                     +',voice-rate'
+                     +',voice-stress'
+                     +',voice-volume'
+                     +',word-break'
+                     +',word-wrap'
+                     +',writing-mode';
+
+{ TSynCssSyn }
+
+{$Q-}
+function TSynCssSyn.HashKey(Str: PWideChar): Integer;
+begin
+  Result := 0;
+  while CharInSet(Str^, ['a'..'z', 'A'..'Z', '_', '-']) do
+  begin
+    if Str^ <> '-' then
+    case Str^ of
+      '_': Inc(Result, 27);
+      '-': Inc(Result, 28);
+      else Inc(Result, Ord(SynWideUpperCase(Str^)[1]) - 64);
+    end;
+    Inc(Str);
+  end;
+  while CharInSet(Str^, ['0'..'9']) do
+  begin
+    Inc(Result, Ord(Str^) - Ord('0'));
+    Inc(Str);
+  end;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynCssSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Entry: TSynHashEntry;
+begin
+  FToIdent := MayBe;
+  Entry := FKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+  Result := tkUndefProperty;
+end;
+
+procedure TSynCssSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Integer;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+constructor TSynCssSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FKeywords := TSynHashEntryList.Create;
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  AddAttribute(FCommentAttri);
+
+  FPropertyAttri := TSynHighlighterAttributes.Create(SYNS_AttrProperty, SYNS_FriendlyAttrProperty);
+  FPropertyAttri.Style := [fsBold];
+  AddAttribute(FPropertyAttri);
+
+  FSelectorAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FSelectorAttri.Style := [fsBold];
+  FSelectorAttri.Foreground := $00ff0080;
+  AddAttribute(FSelectorAttri);
+
+  FAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
+  FAttributeAttri.Style := [];
+  FAttributeAttri.Foreground := $00ff0080;
+  AddAttribute(FAttributeAttri);
+
+  FAtRuleAttri := TSynHighlighterAttributes.Create(SYNS_AttrAtRules, SYNS_FriendlyAttrAttribute);
+  FAtRuleAttri.Style := [];
+  FAtRuleAttri.Foreground := $00808000;
+  AddAttribute(FAtRuleAttri);
+
+  FUndefPropertyAttri := TSynHighlighterAttributes.Create(
+    SYNS_AttrUndefinedProperty, SYNS_FriendlyAttrUndefinedProperty);
+  FUndefPropertyAttri.Style := [fsBold];
+  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);
+
+  FColorAttri := TSynHighlighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor);
+  AddAttribute(FColorAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
+  AddAttribute(FTextAttri);
+
+  FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
+  FValueAttri.Foreground := $00ff8000;
+  AddAttribute(FValueAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+
+  // TODO: differentiating tkProperty for CSS1, CSS2 & CSS3 highlighting
+  EnumerateKeywords(Ord(tkProperty), Properties_CSS1, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkProperty), Properties_CSS2, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkProperty), Properties_CSS2_Aural, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkProperty), Properties_CSS3, IsIdentChar, DoAddKeyword);
+
+  FRange := rsSelector;
+  FDefaultFilter := SYNS_FilterCSS;
+end;
+
+destructor TSynCssSyn.Destroy;
+begin
+  FKeywords.Free;
+  inherited Destroy;
+end;
+
+procedure TSynCssSyn.AttributeProc;
+
+  function IsStopChar: Boolean;
+  begin
+    case FLine[Run] of
+      #0..#31, ']', '~', '^', '$', '*', '|', '=':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  if IsStopChar then
+  begin
+    case FLine[Run] of
+      #0..#31, '{', '/': NextDeclaration;
+      ']': BracketCloseProc;
+      '~': TildeProc;
+      '|': PipeProc;
+      '=': EqualProc;
+      '^': CircumflexProc;
+      '*': AttrContainProc;
+    end;
+    Exit;
+  end;
+
+  FTokenID := tkSelectorAttrib;
+  while not IsStopChar do
+    Inc(Run);
+end;
+
+procedure TSynCssSyn.BraceCloseProc;
+begin
+  FRange := rsSelector;
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FRange := rsDeclaration;
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynCssSyn.BracketCloseProc;
+begin
+  FTokenID := tkSymbol;
+  FRange := rsSelector;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.BracketOpenProc;
+begin
+  Inc(Run);
+  FRange := rsAttrib;
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynCssSyn.CircumflexProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '=' then
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynCssSyn.AttrContainProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '=' then
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynCssSyn.CommentProc;
+begin
+  if FLine[Run] = #0 then
+    NullProc
+  else
+  begin
+    FTokenID := tkComment;
+    repeat
+      if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+      begin
+        FRange := FCommentRange;
+        Inc(Run, 2);
+        Break;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run)
+  end;
+end;
+
+procedure TSynCssSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynCssSyn.SemiProc;
+begin
+  FRange := rsUnknown;
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.StartValProc;
+begin
+  FRange := rsValue;
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.NumberProc;
+begin
+  if (FLine[Run] = '-') and not CharInSet(FLine[Run + 1], ['0'..'9']) then
+    IdentProc
+  else
+  begin
+    Inc(Run);
+    FTokenID := tkNumber;
+    while CharInSet(FLine[Run], ['0'..'9', '.']) do
+    begin
+      case FLine[Run] of
+        '.':
+          if FLine[Run + 1] = '.' then Break;
+      end;
+      Inc(Run);
+    end;
+  end;
+end;
+
+procedure TSynCssSyn.ParenCloseProc;
+begin
+  FRange := FParameterRange;
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.ParenOpenProc;
+begin
+  Inc(Run);
+  FParameterRange := FRange;
+  FRange := rsParameter;
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynCssSyn.PipeProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '=' then
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynCssSyn.PlusProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynCssSyn.IdentProc;
+begin
+  case FRange of
+    rsProperty:
+      begin
+        FRange := rsDeclaration;
+        FTokenID := tkSelector;
+        Inc(Run, FStringLen);
+      end;
+    rsValue, rsParameter:
+      begin
+        FTokenID := tkValue;
+
+        while not IsLineEnd(Run) and
+          not CharInSet(FLine[Run], ['(', ')', '}', ';', ',', ' ']) do
+        begin
+          Inc(Run);
+        end;
+
+        if IsLineEnd(Run) or CharInSet(FLine[Run], ['}', ';']) then
+          FRange := rsDeclaration;
+      end;
+    else
+      FTokenID := IdentKind((FLine + Run));
+      repeat
+        Inc(Run);
+      until (FLine[Run] <= #32) or CharInSet(FLine[Run], [':', '"', '}', ';']);
+  end;
+end;
+
+procedure TSynCssSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynCssSyn.AtRuleProc;
+
+  function IsStopChar: Boolean;
+  begin
+    case FLine[Run] of
+      #0..#31, '{', ';':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  if IsStopChar then
+  begin
+    case FLine[Run] of
+      #0..#31, '{', ';': SelectorProc;
+    end;
+    Exit;
+  end;
+
+  FTokenID := tkAtRule;
+  while not IsStopChar do
+    Inc(Run);
+end;
+
+procedure TSynCssSyn.SelectorProc;
+
+  function IsStopChar: Boolean;
+  begin
+    case FLine[Run] of
+      #0..#31, '{', '/', '[', ']', '>', '+', '~':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  if FLine[Run] = '}' then
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+    Exit;
+  end;
+
+  if FLine[Run] = '@' then
+  begin
+    Inc(Run);
+    AtRuleProc;
+    Exit;
+  end;
+
+  if IsStopChar then
+  begin
+    case FLine[Run] of
+      #0..#31, '{', '/': NextDeclaration;
+      '[': BracketOpenProc;
+      ']': BracketCloseProc;
+      '>': GreaterProc;
+      '+': PlusProc;
+      '~': TildeProc;
+    end;
+    Exit;
+  end;
+
+  FTokenID := tkSelector;
+  while not IsStopChar do
+    Inc(Run);
+end;
+
+procedure TSynCssSyn.TildeProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '=' then
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynCssSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynCssSyn.StringProc;
+begin
+  FTokenID := tkString;
+  Inc(Run);  // first '"'
+  while not (IsLineEnd(Run) or (FLine[Run] = '"')) do Inc(Run);
+  if FLine[Run] = '"' then Inc(Run);  // last '"'
+end;
+
+procedure TSynCssSyn.HashProc;
+
+  function IsHexChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  FTokenID := tkColor;
+  Inc(Run);  // '#'
+  while IsHexChar do Inc(Run);
+end;
+
+procedure TSynCssSyn.EqualProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+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);
+  if FLine[Run] = '*' then
+  begin
+    FTokenID := tkComment;
+    FCommentRange := FRange;
+    FRange := rsComment;
+    Inc(Run);
+    if not IsLineEnd(Run) then
+      CommentProc;
+  end
+  else
+    FTokenID := tkSymbol;
+end;
+
+procedure TSynCssSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsSelector:
+      SelectorProc;
+    rsAttrib:
+      AttributeProc;
+    rsComment:
+      CommentProc;
+    else
+      NextDeclaration;
+  end;
+
+  inherited;
+end;
+
+procedure TSynCssSyn.NextDeclaration;
+begin
+  case FLine[Run] of
+    #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    '"': StringProc;
+    '#': HashProc;
+    '{': BraceOpenProc;
+    '}': BraceCloseProc;
+    '(': ParenOpenProc;
+    ')': ParenCloseProc;
+    ':', ',': StartValProc;
+    ';': SemiProc;
+    '0'..'9', '-', '.': NumberProc;
+    '/': SlashProc;
+    '!': ExclamProc;
+    else IdentProc;
+  end;
+end;
+
+function TSynCssSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+begin
+  case Index of
+    SYN_ATTR_COMMENT: Result := FCommentAttri;
+    SYN_ATTR_KEYWORD: Result := FSelectorAttri;
+    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_STRING: Result := FStringAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynCssSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynCssSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynCssSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkAtRule: Result := FAtRuleAttri;
+    tkProperty: Result := FPropertyAttri;
+    tkSelector: Result := FSelectorAttri;
+    tkSelectorAttrib: Result := FAttributeAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkText: Result := FTextAttri;
+    tkUndefProperty: Result := FUndefPropertyAttri;
+    tkImportant: Result := FImportantPropertyAttri;
+    tkValue: Result := FValueAttri;
+    tkColor: Result := FColorAttri;
+    tkNumber: Result := FNumberAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynCssSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynCssSyn.GreaterProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+function TSynCssSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+procedure TSynCssSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynCssSyn.ResetRange;
+begin
+  FRange:= rsSelector;
+end;
+
+function TSynCssSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '/* Syntax Highlighting */'#13#10 +
+        'body { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 8pt }'#13#10 +
+        'H1 { font-size: 18pt; color: #000099; made-up-property: 1 }';
+end; { GetSampleSource }
+
+class function TSynCssSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangCSS;
+end;
+
+function TSynCssSyn.IsFilterStored: boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterCSS;
+end;
+
+function TSynCssSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '_', '-', '0'..'9', 'A'..'Z', 'a'..'z':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynCssSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangCSS;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynCssSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterDOT.pas b/Source/VCL/SynEdit/Source/SynHighlighterDOT.pas
index 377bc6b4..72d8b59e 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterDOT.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterDOT.pas
@@ -1,2096 +1,2098 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterDOT.pas, released 2002-11-30.
-Description: DOT Syntax Parser/Highlighter
-The initial author of this file is nissl (nissl@tiscali.it, nissl@mammuth.it)
-Unicode translation by Maël Hörz.
-Copyright (c) 2002, 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: SynHighlighterDOT.pas,v 1.3.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a ATT DOT highlighter for SynEdit)
-@author(Massimo Maria Ghisalberti (nissl@mammuth.it))
-@created(november 2002)
-@lastmod(2002-11-30)
-The SynHighlighterDOT unit provides SynEdit with a DOT Graph Drawing (.dot) highlighter.
-The highlighter formats DOT source code ref.: http://www.research.att.com/sw/tools/graphviz/.
-}
-
-unit SynHighlighterDOT;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Controls,
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (
-    tkArrowHead,
-    tkAttribute,
-    tkComment,
-    tkDirections,
-    tkIdentifier,
-    tkKey,
-    tkNull,
-    tkShape,
-    tkSpace,
-    tkString,
-    tkUnknown,
-    tkValue,
-    tkSymbol);
-
-  TRangeState = (rsUnKnown, rsCStyleComment, rsString);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynDOTSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..786] of TIdentFuncTableFunc;
-    fArrowHeadAttri: TSynHighlighterAttributes;
-    fAttributeAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirectionsAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fShapeAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fValueAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncAll(Index: Integer): TtkTokenKind;
-    function FuncAppendix(Index: Integer): TtkTokenKind;
-    function FuncArrowhead(Index: Integer): TtkTokenKind;
-    function FuncArrowsize(Index: Integer): TtkTokenKind;
-    function FuncArrowtail(Index: Integer): TtkTokenKind;
-    function FuncAuto(Index: Integer): TtkTokenKind;
-    function FuncBack(Index: Integer): TtkTokenKind;
-    function FuncBgcolor(Index: Integer): TtkTokenKind;
-    function FuncBold(Index: Integer): TtkTokenKind;
-    function FuncBoth(Index: Integer): TtkTokenKind;
-    function FuncBottomlabel(Index: Integer): TtkTokenKind;
-    function FuncBox(Index: Integer): TtkTokenKind;
-    function FuncCenter(Index: Integer): TtkTokenKind;
-    function FuncCircle(Index: Integer): TtkTokenKind;
-    function FuncClusterrank(Index: Integer): TtkTokenKind;
-    function FuncColor(Index: Integer): TtkTokenKind;
-    function FuncComment(Index: Integer): TtkTokenKind;
-    function FuncCompound(Index: Integer): TtkTokenKind;
-    function FuncConcentrate(Index: Integer): TtkTokenKind;
-    function FuncConstraint(Index: Integer): TtkTokenKind;
-    function FuncDecorate(Index: Integer): TtkTokenKind;
-    function FuncDiamond(Index: Integer): TtkTokenKind;
-    function FuncDigraph(Index: Integer): TtkTokenKind;
-    function FuncDir(Index: Integer): TtkTokenKind;
-    function FuncDistortion(Index: Integer): TtkTokenKind;
-    function FuncDot(Index: Integer): TtkTokenKind;
-    function FuncDotted(Index: Integer): TtkTokenKind;
-    function FuncDoublecircle(Index: Integer): TtkTokenKind;
-    function FuncDoubleoctagon(Index: Integer): TtkTokenKind;
-    function FuncE(Index: Integer): TtkTokenKind;
-    function FuncEdge(Index: Integer): TtkTokenKind;
-    function FuncEgg(Index: Integer): TtkTokenKind;
-    function FuncEllipse(Index: Integer): TtkTokenKind;
-    function FuncFalse(Index: Integer): TtkTokenKind;
-    function FuncFill(Index: Integer): TtkTokenKind;
-    function FuncFillcolor(Index: Integer): TtkTokenKind;
-    function FuncFilled(Index: Integer): TtkTokenKind;
-    function FuncFixedsize(Index: Integer): TtkTokenKind;
-    function FuncFontcolor(Index: Integer): TtkTokenKind;
-    function FuncFontname(Index: Integer): TtkTokenKind;
-    function FuncFontpath(Index: Integer): TtkTokenKind;
-    function FuncFontsize(Index: Integer): TtkTokenKind;
-    function FuncForward(Index: Integer): TtkTokenKind;
-    function FuncGlobal(Index: Integer): TtkTokenKind;
-    function FuncGraph(Index: Integer): TtkTokenKind;
-    function FuncGroup(Index: Integer): TtkTokenKind;
-    function FuncHeadlabel(Index: Integer): TtkTokenKind;
-    function FuncHeadport(Index: Integer): TtkTokenKind;
-    function FuncHeadurl(Index: Integer): TtkTokenKind;
-    function FuncHeight(Index: Integer): TtkTokenKind;
-    function FuncHexagon(Index: Integer): TtkTokenKind;
-    function FuncHouse(Index: Integer): TtkTokenKind;
-    function FuncId(Index: Integer): TtkTokenKind;
-    function FuncInv(Index: Integer): TtkTokenKind;
-    function FuncInvdot(Index: Integer): TtkTokenKind;
-    function FuncInvhouse(Index: Integer): TtkTokenKind;
-    function FuncInvodot(Index: Integer): TtkTokenKind;
-    function FuncInvtrapezium(Index: Integer): TtkTokenKind;
-    function FuncInvtriangle(Index: Integer): TtkTokenKind;
-    function FuncLabel(Index: Integer): TtkTokenKind;
-    function FuncLabelangle(Index: Integer): TtkTokenKind;
-    function FuncLabeldistance(Index: Integer): TtkTokenKind;
-    function FuncLabelfloat(Index: Integer): TtkTokenKind;
-    function FuncLabelfontcolor(Index: Integer): TtkTokenKind;
-    function FuncLabelfontname(Index: Integer): TtkTokenKind;
-    function FuncLabelfontsize(Index: Integer): TtkTokenKind;
-    function FuncLabeljust(Index: Integer): TtkTokenKind;
-    function FuncLabelloc(Index: Integer): TtkTokenKind;
-    function FuncLayer(Index: Integer): TtkTokenKind;
-    function FuncLayers(Index: Integer): TtkTokenKind;
-    function FuncLhead(Index: Integer): TtkTokenKind;
-    function FuncLtail(Index: Integer): TtkTokenKind;
-    function FuncMargin(Index: Integer): TtkTokenKind;
-    function FuncMax(Index: Integer): TtkTokenKind;
-    function FuncMcircle(Index: Integer): TtkTokenKind;
-    function FuncMclimit(Index: Integer): TtkTokenKind;
-    function FuncMdiamond(Index: Integer): TtkTokenKind;
-    function FuncMerged(Index: Integer): TtkTokenKind;
-    function FuncMin(Index: Integer): TtkTokenKind;
-    function FuncMinimum(Index: Integer): TtkTokenKind;
-    function FuncMinlen(Index: Integer): TtkTokenKind;
-    function FuncMrecord(Index: Integer): TtkTokenKind;
-    function FuncMsquare(Index: Integer): TtkTokenKind;
-    function FuncMultiples(Index: Integer): TtkTokenKind;
-    function FuncN(Index: Integer): TtkTokenKind;
-    function FuncNe(Index: Integer): TtkTokenKind;
-    function FuncNode(Index: Integer): TtkTokenKind;
-    function FuncNodesep(Index: Integer): TtkTokenKind;
-    function FuncNone(Index: Integer): TtkTokenKind;
-    function FuncNormal(Index: Integer): TtkTokenKind;
-    function FuncNslimit(Index: Integer): TtkTokenKind;
-    function FuncNw(Index: Integer): TtkTokenKind;
-    function FuncOctagon(Index: Integer): TtkTokenKind;
-    function FuncOdot(Index: Integer): TtkTokenKind;
-    function FuncOnto(Index: Integer): TtkTokenKind;
-    function FuncOrdering(Index: Integer): TtkTokenKind;
-    function FuncOrientation(Index: Integer): TtkTokenKind;
-    function FuncPage(Index: Integer): TtkTokenKind;
-    function FuncPagedir(Index: Integer): TtkTokenKind;
-    function FuncParallelogram(Index: Integer): TtkTokenKind;
-    function FuncPeripheries(Index: Integer): TtkTokenKind;
-    function FuncPlaintext(Index: Integer): TtkTokenKind;
-    function FuncPoint(Index: Integer): TtkTokenKind;
-    function FuncPolygon(Index: Integer): TtkTokenKind;
-    function FuncQuantum(Index: Integer): TtkTokenKind;
-    function FuncRank(Index: Integer): TtkTokenKind;
-    function FuncRankdir(Index: Integer): TtkTokenKind;
-    function FuncRanksep(Index: Integer): TtkTokenKind;
-    function FuncRatio(Index: Integer): TtkTokenKind;
-    function FuncRecord(Index: Integer): TtkTokenKind;
-    function FuncRegular(Index: Integer): TtkTokenKind;
-    function FuncRemincross(Index: Integer): TtkTokenKind;
-    function FuncRotate(Index: Integer): TtkTokenKind;
-    function FuncS(Index: Integer): TtkTokenKind;
-    function FuncSame(Index: Integer): TtkTokenKind;
-    function FuncSamehead(Index: Integer): TtkTokenKind;
-    function FuncSametail(Index: Integer): TtkTokenKind;
-    function FuncSamplepoints(Index: Integer): TtkTokenKind;
-    function FuncSe(Index: Integer): TtkTokenKind;
-    function FuncSearchsize(Index: Integer): TtkTokenKind;
-    function FuncSection(Index: Integer): TtkTokenKind;
-    function FuncShape(Index: Integer): TtkTokenKind;
-    function FuncShapefile(Index: Integer): TtkTokenKind;
-    function FuncSides(Index: Integer): TtkTokenKind;
-    function FuncSink(Index: Integer): TtkTokenKind;
-    function FuncSize(Index: Integer): TtkTokenKind;
-    function FuncSkew(Index: Integer): TtkTokenKind;
-    function FuncSource(Index: Integer): TtkTokenKind;
-    function FuncStrict(Index: Integer): TtkTokenKind;
-    function FuncStyle(Index: Integer): TtkTokenKind;
-    function FuncSubgraph(Index: Integer): TtkTokenKind;
-    function FuncSw(Index: Integer): TtkTokenKind;
-    function FuncTaillabel(Index: Integer): TtkTokenKind;
-    function FuncTailport(Index: Integer): TtkTokenKind;
-    function FuncTailurl(Index: Integer): TtkTokenKind;
-    function FuncToplabel(Index: Integer): TtkTokenKind;
-    function FuncTrapezium(Index: Integer): TtkTokenKind;
-    function FuncTriangle(Index: Integer): TtkTokenKind;
-    function FuncTripleoctagon(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncUrl(Index: Integer): TtkTokenKind;
-    function FuncW(Index: Integer): TtkTokenKind;
-    function FuncWeight(Index: Integer): TtkTokenKind;
-    function FuncWhen(Index: Integer): TtkTokenKind;
-    function FuncWidth(Index: Integer): TtkTokenKind;
-    function FuncZ(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure IdentProc;
-    procedure UnknownProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure CRProc;
-    procedure LFProc;
-    procedure CStyleCommentOpenProc;
-    procedure CStyleCommentProc;
-    procedure StringOpenProc;
-    procedure StringProc;
-    procedure SymbolProc;
-    procedure DirectionsProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: 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): string; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-     function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-  published
-    property ArrowHeadAttri: TSynHighlighterAttributes read fArrowHeadAttri write fArrowHeadAttri;
-    property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri write fAttributeAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    property DirectionsAttri: TSynHighlighterAttributes read fDirectionsAttri write fDirectionsAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property ShapeAttri: TSynHighlighterAttributes read fShapeAttri write fShapeAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
-    property ValueAttri: TSynHighlighterAttributes read fValueAttri write fValueAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..145] of string = (
-    'all', 'appendix', 'arrowhead', 'arrowsize', 'arrowtail', 'auto', 'back', 
-    'bgcolor', 'bold', 'both', 'bottomlabel', 'box', 'center', 'circle', 
-    'clusterrank', 'color', 'comment', 'compound', 'concentrate', 'constraint', 
-    'decorate', 'diamond', 'digraph', 'dir', 'distortion', 'dot', 'dotted', 
-    'doublecircle', 'doubleoctagon', 'e', 'edge', 'egg', 'ellipse', 'false', 
-    'fill', 'fillcolor', 'filled', 'fixedsize', 'fontcolor', 'fontname', 
-    'fontpath', 'fontsize', 'forward', 'global', 'graph', 'group', 'headlabel', 
-    'headport', 'headurl', 'height', 'hexagon', 'house', 'id', 'inv', 'invdot', 
-    'invhouse', 'invodot', 'invtrapezium', 'invtriangle', 'label', 'labelangle', 
-    'labeldistance', 'labelfloat', 'labelfontcolor', 'labelfontname', 
-    'labelfontsize', 'labeljust', 'labelloc', 'layer', 'layers', 'lhead', 
-    'ltail', 'margin', 'max', 'mcircle', 'mclimit', 'mdiamond', 'merged', 'min', 
-    'minimum', 'minlen', 'mrecord', 'msquare', 'multiples', 'n', 'ne', 'node', 
-    'nodesep', 'none', 'normal', 'nslimit', 'nw', 'octagon', 'odot', 'onto', 
-    'ordering', 'orientation', 'page', 'pagedir', 'parallelogram', 
-    'peripheries', 'plaintext', 'point', 'polygon', 'quantum', 'rank', 
-    'rankdir', 'ranksep', 'ratio', 'record', 'regular', 'remincross', 'rotate', 
-    's', 'same', 'samehead', 'sametail', 'samplepoints', 'se', 'searchsize', 
-    'section', 'shape', 'shapefile', 'sides', 'sink', 'size', 'skew', 'source', 
-    'strict', 'style', 'subgraph', 'sw', 'taillabel', 'tailport', 'tailurl', 
-    'toplabel', 'trapezium', 'triangle', 'tripleoctagon', 'true', 'url', 'w', 
-    'weight', 'when', 'width', 'z' 
-  );
-
-  KeyIndices: array[0..786] of Integer = (
-    -1, -1, -1, -1, 11, -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, -1, -1, -1, -1, -1, 
-    -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, 50, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 40, -1, -1, -1, -1, 4, -1, -1, -1, -1, 90, -1, 3, -1, 110, 86, 
-    -1, -1, 49, 23, -1, 92, -1, -1, -1, 15, -1, 122, -1, -1, 28, -1, 78, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 85, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 140, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, 7, -1, 0, 
-    -1, -1, 97, -1, -1, -1, -1, -1, 43, -1, -1, -1, 131, -1, -1, -1, 5, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 10, -1, 
-    47, 68, -1, 132, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 
-    -1, -1, 64, -1, -1, 124, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, 12, -1, 84, 
-    -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 42, -1, 38, -1, -1, -1, 143, -1, -1, -1, 145, 
-    106, -1, 127, -1, -1, -1, 99, 75, -1, -1, 102, -1, 58, -1, -1, 56, -1, -1, 
-    -1, -1, 9, -1, -1, -1, -1, -1, 22, -1, 73, -1, -1, -1, 17, -1, 54, 112, -1, 
-    -1, -1, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, -1, 
-    21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 116, -1, -1, 32, -1, 
-    -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, 
-    -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, 117, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 111, 93, -1, -1, -1, -1, 108, -1, -1, 119, -1, -1, -1, 
-    -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, 76, -1, -1, -1, 
-    -1, -1, -1, -1, 77, -1, -1, 104, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 26, -1, -1, -1, 79, -1, 19, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 39, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 109, 35, -1, -1, 70, -1, -1, 57, -1, 72, -1, 
-    -1, 83, -1, -1, -1, -1, 130, -1, -1, -1, 18, -1, 118, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 
-    37, 1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 14, -1, -1, 8, -1, -1, -1, 125, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, 
-    95, -1, -1, -1, -1, 136, -1, -1, 20, -1, 62, -1, -1, -1, -1, 134, -1, -1, 
-    -1, 63, -1, -1, -1, 121, 80, -1, -1, -1, -1, -1, -1, 135, -1, -1, 120, -1, 
-    -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, 
-    -1, 24, -1, -1, 139, 67, -1, -1, 59, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 128, 34, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, 114, -1, -1, -1, -1, 
-    -1, -1, -1, 55, -1, -1, 94, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, 44, -1, 
-    -1, -1, -1, -1, 74, -1, 51, 144, -1, -1, 82, 98, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 66, -1, 25, -1, -1, -1, 45, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 
-    6, 105, -1, -1, 133, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynDOTSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 63 + Ord(Str^) * 331;
-    inc(Str);
-  end;
-  Result := Result mod 787;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynDOTSyn.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 TSynDOTSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[132] := FuncAll;
-  fIdentFuncTable[509] := FuncAppendix;
-  fIdentFuncTable[188] := FuncArrowhead;
-  fIdentFuncTable[72] := FuncArrowsize;
-  fIdentFuncTable[65] := FuncArrowtail;
-  fIdentFuncTable[149] := FuncAuto;
-  fIdentFuncTable[752] := FuncBack;
-  fIdentFuncTable[130] := FuncBgcolor;
-  fIdentFuncTable[536] := FuncBold;
-  fIdentFuncTable[266] := FuncBoth;
-  fIdentFuncTable[169] := FuncBottomlabel;
-  fIdentFuncTable[4] := FuncBox;
-  fIdentFuncTable[206] := FuncCenter;
-  fIdentFuncTable[666] := FuncCircle;
-  fIdentFuncTable[533] := FuncClusterrank;
-  fIdentFuncTable[85] := FuncColor;
-  fIdentFuncTable[327] := FuncComment;
-  fIdentFuncTable[278] := FuncCompound;
-  fIdentFuncTable[481] := FuncConcentrate;
-  fIdentFuncTable[425] := FuncConstraint;
-  fIdentFuncTable[573] := FuncDecorate;
-  fIdentFuncTable[302] := FuncDiamond;
-  fIdentFuncTable[272] := FuncDigraph;
-  fIdentFuncTable[79] := FuncDir;
-  fIdentFuncTable[621] := FuncDistortion;
-  fIdentFuncTable[726] := FuncDot;
-  fIdentFuncTable[419] := FuncDotted;
-  fIdentFuncTable[104] := FuncDoublecircle;
-  fIdentFuncTable[90] := FuncDoubleoctagon;
-  fIdentFuncTable[377] := FuncE;
-  fIdentFuncTable[783] := FuncEdge;
-  fIdentFuncTable[614] := FuncEgg;
-  fIdentFuncTable[319] := FuncEllipse;
-  fIdentFuncTable[409] := FuncFalse;
-  fIdentFuncTable[641] := FuncFill;
-  fIdentFuncTable[461] := FuncFillcolor;
-  fIdentFuncTable[631] := FuncFilled;
-  fIdentFuncTable[508] := FuncFixedsize;
-  fIdentFuncTable[237] := FuncFontcolor;
-  fIdentFuncTable[435] := FuncFontname;
-  fIdentFuncTable[60] := FuncFontpath;
-  fIdentFuncTable[685] := FuncFontsize;
-  fIdentFuncTable[235] := FuncForward;
-  fIdentFuncTable[141] := FuncGlobal;
-  fIdentFuncTable[693] := FuncGraph;
-  fIdentFuncTable[730] := FuncGroup;
-  fIdentFuncTable[212] := FuncHeadlabel;
-  fIdentFuncTable[171] := FuncHeadport;
-  fIdentFuncTable[749] := FuncHeadurl;
-  fIdentFuncTable[78] := FuncHeight;
-  fIdentFuncTable[51] := FuncHexagon;
-  fIdentFuncTable[701] := FuncHouse;
-  fIdentFuncTable[177] := FuncId;
-  fIdentFuncTable[603] := FuncInv;
-  fIdentFuncTable[280] := FuncInvdot;
-  fIdentFuncTable[660] := FuncInvhouse;
-  fIdentFuncTable[261] := FuncInvodot;
-  fIdentFuncTable[467] := FuncInvtrapezium;
-  fIdentFuncTable[258] := FuncInvtriangle;
-  fIdentFuncTable[628] := FuncLabel;
-  fIdentFuncTable[557] := FuncLabelangle;
-  fIdentFuncTable[507] := FuncLabeldistance;
-  fIdentFuncTable[575] := FuncLabelfloat;
-  fIdentFuncTable[584] := FuncLabelfontcolor;
-  fIdentFuncTable[192] := FuncLabelfontname;
-  fIdentFuncTable[650] := FuncLabelfontsize;
-  fIdentFuncTable[724] := FuncLabeljust;
-  fIdentFuncTable[625] := FuncLabelloc;
-  fIdentFuncTable[172] := FuncLayer;
-  fIdentFuncTable[315] := FuncLayers;
-  fIdentFuncTable[464] := FuncLhead;
-  fIdentFuncTable[341] := FuncLtail;
-  fIdentFuncTable[469] := FuncMargin;
-  fIdentFuncTable[274] := FuncMax;
-  fIdentFuncTable[699] := FuncMcircle;
-  fIdentFuncTable[253] := FuncMclimit;
-  fIdentFuncTable[391] := FuncMdiamond;
-  fIdentFuncTable[399] := FuncMerged;
-  fIdentFuncTable[92] := FuncMin;
-  fIdentFuncTable[423] := FuncMinimum;
-  fIdentFuncTable[589] := FuncMinlen;
-  fIdentFuncTable[493] := FuncMrecord;
-  fIdentFuncTable[705] := FuncMsquare;
-  fIdentFuncTable[472] := FuncMultiples;
-  fIdentFuncTable[208] := FuncN;
-  fIdentFuncTable[102] := FuncNe;
-  fIdentFuncTable[75] := FuncNode;
-  fIdentFuncTable[202] := FuncNodesep;
-  fIdentFuncTable[50] := FuncNone;
-  fIdentFuncTable[386] := FuncNormal;
-  fIdentFuncTable[70] := FuncNslimit;
-  fIdentFuncTable[551] := FuncNw;
-  fIdentFuncTable[81] := FuncOctagon;
-  fIdentFuncTable[364] := FuncOdot;
-  fIdentFuncTable[663] := FuncOnto;
-  fIdentFuncTable[565] := FuncOrdering;
-  fIdentFuncTable[300] := FuncOrientation;
-  fIdentFuncTable[135] := FuncPage;
-  fIdentFuncTable[706] := FuncPagedir;
-  fIdentFuncTable[252] := FuncParallelogram;
-  fIdentFuncTable[723] := FuncPeripheries;
-  fIdentFuncTable[167] := FuncPlaintext;
-  fIdentFuncTable[256] := FuncPoint;
-  fIdentFuncTable[117] := FuncPolygon;
-  fIdentFuncTable[402] := FuncQuantum;
-  fIdentFuncTable[753] := FuncRank;
-  fIdentFuncTable[246] := FuncRankdir;
-  fIdentFuncTable[773] := FuncRanksep;
-  fIdentFuncTable[369] := FuncRatio;
-  fIdentFuncTable[460] := FuncRecord;
-  fIdentFuncTable[74] := FuncRegular;
-  fIdentFuncTable[363] := FuncRemincross;
-  fIdentFuncTable[281] := FuncRotate;
-  fIdentFuncTable[289] := FuncS;
-  fIdentFuncTable[652] := FuncSame;
-  fIdentFuncTable[439] := FuncSamehead;
-  fIdentFuncTable[316] := FuncSametail;
-  fIdentFuncTable[354] := FuncSamplepoints;
-  fIdentFuncTable[483] := FuncSe;
-  fIdentFuncTable[372] := FuncSearchsize;
-  fIdentFuncTable[599] := FuncSection;
-  fIdentFuncTable[588] := FuncShape;
-  fIdentFuncTable[87] := FuncShapefile;
-  fIdentFuncTable[757] := FuncSides;
-  fIdentFuncTable[195] := FuncSink;
-  fIdentFuncTable[540] := FuncSize;
-  fIdentFuncTable[333] := FuncSkew;
-  fIdentFuncTable[248] := FuncSource;
-  fIdentFuncTable[640] := FuncStrict;
-  fIdentFuncTable[520] := FuncStyle;
-  fIdentFuncTable[477] := FuncSubgraph;
-  fIdentFuncTable[145] := FuncSw;
-  fIdentFuncTable[174] := FuncTaillabel;
-  fIdentFuncTable[756] := FuncTailport;
-  fIdentFuncTable[580] := FuncTailurl;
-  fIdentFuncTable[596] := FuncToplabel;
-  fIdentFuncTable[570] := FuncTrapezium;
-  fIdentFuncTable[351] := FuncTriangle;
-  fIdentFuncTable[514] := FuncTripleoctagon;
-  fIdentFuncTable[624] := FuncTrue;
-  fIdentFuncTable[115] := FuncUrl;
-  fIdentFuncTable[39] := FuncW;
-  fIdentFuncTable[128] := FuncWeight;
-  fIdentFuncTable[241] := FuncWhen;
-  fIdentFuncTable[702] := FuncWidth;
-  fIdentFuncTable[245] := FuncZ;
-end;
-
-function TSynDOTSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncAll(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncAppendix(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncArrowhead(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncArrowsize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncArrowtail(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncAuto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBack(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBgcolor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBold(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBoth(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBottomlabel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncBox(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncCenter(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncCircle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncClusterrank(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncColor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncComment(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncCompound(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncConcentrate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncConstraint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDecorate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDiamond(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDigraph(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDir(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDistortion(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDotted(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDoublecircle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncDoubleoctagon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncE(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncEdge(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncEgg(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncEllipse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFalse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFill(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFillcolor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFilled(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue  // TODO: ANSI source isn't clear if tkValue or tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFixedsize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFontcolor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFontname(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFontpath(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncFontsize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncForward(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncGlobal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncGraph(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncGroup(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHeadlabel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHeadport(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHeadurl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHeight(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHexagon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncHouse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncId(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInv(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInvdot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInvhouse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInvodot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInvtrapezium(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncInvtriangle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelangle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabeldistance(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelfloat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelfontcolor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelfontname(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelfontsize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabeljust(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLabelloc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLayer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute  // TODO: ANSI source isn't clear if tkAttribute or tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLayers(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute  // TODO: ANSI source isn't clear if tkAttribute or tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLhead(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncLtail(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMargin(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMax(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMcircle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMclimit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMdiamond(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMerged(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMin(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMinimum(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMinlen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMrecord(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMsquare(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncMultiples(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncN(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNodesep(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNone(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNormal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNslimit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncNw(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncOctagon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncOdot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkArrowHead
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncOnto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncOrdering(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncOrientation(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPagedir(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncParallelogram(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPeripheries(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPlaintext(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPoint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncPolygon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncQuantum(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRank(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRankdir(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRanksep(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRatio(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRecord(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRegular(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRemincross(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncRotate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncS(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSame(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSamehead(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSametail(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSamplepoints(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSe(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSearchsize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSection(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncShape(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncShapefile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSides(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSink(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSkew(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSource(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncStrict(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncStyle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSubgraph(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncSw(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTaillabel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTailport(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTailurl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncToplabel(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTrapezium(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTriangle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTripleoctagon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkShape
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncTrue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncUrl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncW(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncWeight(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncWhen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncWidth(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDOTSyn.FuncZ(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkAttribute
-  else
-    Result := tkIdentifier;
-end;
-
-procedure TSynDOTSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynDOTSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynDOTSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
-    inc(Run);
-end;
-
-procedure TSynDOTSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynDOTSyn.DirectionsProc;
-begin
-  Inc(Run);
-  if (fLine[Run] = '>') or (fLine[Run] = '-') then
-  begin
-    fTokenID := tkDirections;
-    inc(Run);
-  end
-  else
-    fTokenID := tkSymbol;
-end;
-
-procedure TSynDOTSyn.CStyleCommentOpenProc;
-begin
-  Inc(Run);
-  if fLine[Run] = '/' then
-  begin
-    fTokenID := tkComment;
-    inc(Run, 2);
-    while not IsLineEnd(Run) do Inc(Run);
-    Exit;
-  end;
-  if fLine[Run] = '*' then
-  begin
-    fRange := rsCStyleComment;
-    CStyleCommentProc;
-    fTokenID := tkComment;
-  end
-  else
-    fTokenID := tkIdentifier;
-end;
-
-procedure TSynDOTSyn.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 TSynDOTSyn.StringOpenProc;
-begin
-  Inc(Run);
-  fRange := rsString;
-  StringProc;
-  fTokenID := tkString;
-end;
-
-procedure TSynDOTSyn.StringProc;
-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;
-
-constructor TSynDOTSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fArrowHeadAttri := TSynHighLighterAttributes.Create(SYNS_AttrArrowHead, SYNS_FriendlyAttrArrowHead);
-  fArrowHeadAttri.Foreground := clRed;
-  AddAttribute(fArrowHeadAttri);
-
-  fAttributeAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
-  AddAttribute(fAttributeAttri);
-
-  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  fCommentAttri.Foreground := clNavy;
-  AddAttribute(fCommentAttri);
-
-  fDirectionsAttri := TSynHighLighterAttributes.Create(SYNS_AttrDirections, SYNS_FriendlyAttrDirections);
-  fDirectionsAttri.Style := [fsBold];
-  fDirectionsAttri.Foreground := clYellow;
-  AddAttribute(fDirectionsAttri);
-
-  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-
-  fShapeAttri := TSynHighLighterAttributes.Create(SYNS_AttrShape, SYNS_FriendlyAttrShape);
-  fShapeAttri.Style := [fsBold];
-  fShapeAttri.Foreground := clRed;
-  AddAttribute(fShapeAttri);
-
-  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-
-  fValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  fValueAttri.Style := [fsItalic];
-  fValueAttri.Foreground := clRed;
-  AddAttribute(fValueAttri);
-
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  fSymbolAttri.Style := [fsBold];
-  fSymbolAttri.Foreground := clGreen;
-  AddAttribute(fSymbolAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterDOT;
-  fRange := rsUnknown;
-end;
-
-procedure TSynDOTSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
-    Inc(Run);
-end;
-
-procedure TSynDOTSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynDOTSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynDOTSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsCStyleComment: CStyleCommentProc;
-  else
-    begin
-      fRange := rsUnknown;
-      case fLine[Run] of
-        #0: NullProc;
-        #10: LFProc;
-        #13: CRProc;
-        '/': CStyleCommentOpenProc;
-        '-': DirectionsProc;
-        '''': StringOpenProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        '~', '{', '}', ',', '(', ')', '[', ']', '<', '>', ':', '?', ';', '!', '=': SymbolProc;
-        else UnknownProc;
-      end;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynDOTSyn.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 TSynDOTSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynDOTSyn.GetKeyWords(TokenKind: Integer): string;
-begin
-  Result :=
-    '--,->,all,appendix,arrowhead,arrowsize,arrowtail,auto,back,bgcolor,bo' +
-    'ld,both,bottomlabel,box,center,circle,clusterrank,color,comment,compou' +
-    'nd,concentrate,constraint,decorate,diamond,digraph,dir,distortion,dot,' +
-    'dotted,doublecircle,doubleoctagon,e,edge,egg,ellipse,false,fill,fillco' +
-    'lor,filled,fixedsize,fontcolor,fontname,fontpath,fontsize,forward,glob' +
-    'al,graph,group,headlabel,headport,headURL,height,hexagon,house,id,inv,' +
-    'invdot,invhouse,invodot,invtrapezium,invtriangle,label,labelangle,labe' +
-    'ldistance,labelfloat,labelfontcolor,labelfontname,labelfontsize,labelj' +
-    'ust,labelloc,layer,layers,lhead,ltail,margin,max,mcircle,mclimit,mdiam' +
-    'ond,merged,min,minimum,minlen,mrecord,msquare,multiples,n,ne,node,node' +
-    'sep,none,normal,nslimit,nw,octagon,odot,onto,ordering,orientation,page' +
-    ',pagedir,parallelogram,peripheries,plaintext,point,polygon,quantum,ran' +
-    'k,rankdir,ranksep,ratio,record,regular,remincross,rotate,s,same,samehe' +
-    'ad,sametail,samplepoints,se,searchsize,section,shape,shapefile,sides,s' +
-    'ink,size,skew,source,strict,style,subgraph,sw,taillabel,tailport,tailU' +
-    'RL,toplabel,trapezium,triangle,tripleoctagon,true,url,w,weight,when,wi' +
-    'dth,z';
-end;
-
-function TSynDOTSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynDOTSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkArrowHead: Result := fArrowHeadAttri;
-    tkAttribute: Result := fAttributeAttri;
-    tkComment: Result := fCommentAttri;
-    tkDirections: Result := fDirectionsAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkShape: Result := fShapeAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkValue: Result := fValueAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    tkSymbol: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynDOTSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynDOTSyn.GetSampleSource: string;
-begin
-  Result :=
-    '// ATT DOT Graphic description language'#13#10 +
-    'digraph asde91 {'#13#10 +
-    '  ranksep=.75; size = "7.5,7.5";'#13#10 +
-    '  {'#13#10 +
-    '      node [shape=plaintext, fontsize=16];'#13#10 +
-    '      /* the time-line graph */'#13#10 +
-    '      past -> 1978 -> 1980 -> 1982 -> 1983 -> 1985 -> 1986 ->'#13#10 +
-    '      1987 -> 1988 -> 1989 -> 1990 -> "future";'#13#10 +
-    '      /* ancestor programs */'#13#10 +
-    '      "Bourne sh"; "make"; "SCCS"; "yacc"; "cron"; "Reiser cpp";'#13#10 +
-    '      "Cshell"; "emacs"; "build"; "vi"; ""; "RCS"; "C*";'#13#10 +
-    '  }'#13#10 +
-    '      { rank = same;'#13#10 +
-    '      "Software IS"; "Configuration Mgt"; "Architecture & Libraries";'#13#10 +
-    '      "Process";'#13#10 +
-    '  };'#13#10 +
-    '    node [shape=box];'#13#10 +
-    '    { rank = same; "past"; "SCCS"; "make"; "Bourne sh"; "yacc"; "cron"; }'#13#10 +
-    '    { rank = same; 1978; "Reiser cpp"; "Cshell"; }'#13#10 +
-    '    { rank = same; 1980; "build"; "emacs"; "vi"; }'#13#10 +
-    '    { rank = same; 1982; "RCS"; ""; "IMX"; "SYNED"; }'#13#10 +
-    '    { rank = same; 1983; "ksh"; "IFS"; "TTU"; }'#13#10 +
-    '    { rank = same; 1985; "nmake"; "Peggy"; }'#13#10 +
-    '    { rank = same; 1986; "C*"; "ncpp"; "ksh-i"; ""; "PG2"; }'#13#10 +
-    '    { rank = same; 1987; "Ansi cpp"; "nmake 2.0"; "3D File System"; "fdelta";'#13#10 +
-    '        "DAG"; "CSAS";}'#13#10 +
-    '    { rank = same; 1988; "CIA"; "SBCS"; "ksh-88"; "PEGASUS/PML"; "PAX";'#13#10 +
-    '        "backtalk"; }'#13#10 +
-    '    { rank = same; 1989; "CIA++"; "APP"; "SHIP"; "DataShare"; "ryacc";'#13#10 +
-    '        "Mosaic"; }'#13#10 +
-    '    { rank = same; 1990; "libft"; "CoShell"; "DIA"; "IFS-i"; "kyacc"; "sfio";'#13#10 +
-    '        "yeast"; "ML-X"; "DOT"; }'#13#10 +
-    '    { rank = same; "future"; "Adv. Software Technology"; }'#13#10 +
-    '    "PEGASUS/PML" -> "ML-X";'#13#10 +
-    '    "SCCS" -> "nmake";'#13#10 +
-    '    "SCCS" -> "3D File System";'#13#10 +
-    '    "SCCS" -> "RCS";'#13#10 +
-    '    "make" -> "nmake";'#13#10 +
-    '    "make" -> "build";'#13#10 +
-    '}';
-end;
-
-function TSynDOTSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterDOT;
-end;
-
-function TSynDOTSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '_', 'A'..'Z', 'a'..'z':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynDOTSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangDOT;
-end;
-
-procedure TSynDOTSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynDOTSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynDOTSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-class function TSynDOTSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangDOT;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynDOTSyn);
-end.
+{-------------------------------------------------------------------------------
+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: SynHighlighterDOT.pas, released 2002-11-30.
+Description: DOT Syntax Parser/Highlighter
+The initial author of this file is nissl (nissl@tiscali.it, nissl@mammuth.it)
+Unicode translation by Maël Hörz.
+Copyright (c) 2002, 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: SynHighlighterDOT.pas,v 1.3.2.7 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a ATT DOT highlighter for SynEdit)
+@author(Massimo Maria Ghisalberti (nissl@mammuth.it))
+@created(november 2002)
+@lastmod(2002-11-30)
+The SynHighlighterDOT unit provides SynEdit with a DOT Graph Drawing (.dot) highlighter.
+The highlighter formats DOT source code ref.: http://www.research.att.com/sw/tools/graphviz/.
+}
+
+unit SynHighlighterDOT;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Controls,
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (
+    tkArrowHead,
+    tkAttribute,
+    tkComment,
+    tkDirections,
+    tkIdentifier,
+    tkKey,
+    tkNull,
+    tkShape,
+    tkSpace,
+    tkString,
+    tkUnknown,
+    tkValue,
+    tkSymbol);
+
+  TRangeState = (rsUnknown, rsCStyleComment, rsString);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynDOTSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..786] of TIdentFuncTableFunc;
+    FArrowHeadAttri: TSynHighlighterAttributes;
+    FAttributeAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirectionsAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FShapeAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FValueAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncAll(Index: Integer): TtkTokenKind;
+    function FuncAppendix(Index: Integer): TtkTokenKind;
+    function FuncArrowhead(Index: Integer): TtkTokenKind;
+    function FuncArrowsize(Index: Integer): TtkTokenKind;
+    function FuncArrowtail(Index: Integer): TtkTokenKind;
+    function FuncAuto(Index: Integer): TtkTokenKind;
+    function FuncBack(Index: Integer): TtkTokenKind;
+    function FuncBgcolor(Index: Integer): TtkTokenKind;
+    function FuncBold(Index: Integer): TtkTokenKind;
+    function FuncBoth(Index: Integer): TtkTokenKind;
+    function FuncBottomlabel(Index: Integer): TtkTokenKind;
+    function FuncBox(Index: Integer): TtkTokenKind;
+    function FuncCenter(Index: Integer): TtkTokenKind;
+    function FuncCircle(Index: Integer): TtkTokenKind;
+    function FuncClusterrank(Index: Integer): TtkTokenKind;
+    function FuncColor(Index: Integer): TtkTokenKind;
+    function FuncComment(Index: Integer): TtkTokenKind;
+    function FuncCompound(Index: Integer): TtkTokenKind;
+    function FuncConcentrate(Index: Integer): TtkTokenKind;
+    function FuncConstraint(Index: Integer): TtkTokenKind;
+    function FuncDecorate(Index: Integer): TtkTokenKind;
+    function FuncDiamond(Index: Integer): TtkTokenKind;
+    function FuncDigraph(Index: Integer): TtkTokenKind;
+    function FuncDir(Index: Integer): TtkTokenKind;
+    function FuncDistortion(Index: Integer): TtkTokenKind;
+    function FuncDot(Index: Integer): TtkTokenKind;
+    function FuncDotted(Index: Integer): TtkTokenKind;
+    function FuncDoublecircle(Index: Integer): TtkTokenKind;
+    function FuncDoubleoctagon(Index: Integer): TtkTokenKind;
+    function FuncE(Index: Integer): TtkTokenKind;
+    function FuncEdge(Index: Integer): TtkTokenKind;
+    function FuncEgg(Index: Integer): TtkTokenKind;
+    function FuncEllipse(Index: Integer): TtkTokenKind;
+    function FuncFalse(Index: Integer): TtkTokenKind;
+    function FuncFill(Index: Integer): TtkTokenKind;
+    function FuncFillcolor(Index: Integer): TtkTokenKind;
+    function FuncFilled(Index: Integer): TtkTokenKind;
+    function FuncFixedsize(Index: Integer): TtkTokenKind;
+    function FuncFontcolor(Index: Integer): TtkTokenKind;
+    function FuncFontname(Index: Integer): TtkTokenKind;
+    function FuncFontpath(Index: Integer): TtkTokenKind;
+    function FuncFontsize(Index: Integer): TtkTokenKind;
+    function FuncForward(Index: Integer): TtkTokenKind;
+    function FuncGlobal(Index: Integer): TtkTokenKind;
+    function FuncGraph(Index: Integer): TtkTokenKind;
+    function FuncGroup(Index: Integer): TtkTokenKind;
+    function FuncHeadlabel(Index: Integer): TtkTokenKind;
+    function FuncHeadport(Index: Integer): TtkTokenKind;
+    function FuncHeadurl(Index: Integer): TtkTokenKind;
+    function FuncHeight(Index: Integer): TtkTokenKind;
+    function FuncHexagon(Index: Integer): TtkTokenKind;
+    function FuncHouse(Index: Integer): TtkTokenKind;
+    function FuncId(Index: Integer): TtkTokenKind;
+    function FuncInv(Index: Integer): TtkTokenKind;
+    function FuncInvdot(Index: Integer): TtkTokenKind;
+    function FuncInvhouse(Index: Integer): TtkTokenKind;
+    function FuncInvodot(Index: Integer): TtkTokenKind;
+    function FuncInvtrapezium(Index: Integer): TtkTokenKind;
+    function FuncInvtriangle(Index: Integer): TtkTokenKind;
+    function FuncLabel(Index: Integer): TtkTokenKind;
+    function FuncLabelangle(Index: Integer): TtkTokenKind;
+    function FuncLabeldistance(Index: Integer): TtkTokenKind;
+    function FuncLabelfloat(Index: Integer): TtkTokenKind;
+    function FuncLabelfontcolor(Index: Integer): TtkTokenKind;
+    function FuncLabelfontname(Index: Integer): TtkTokenKind;
+    function FuncLabelfontsize(Index: Integer): TtkTokenKind;
+    function FuncLabeljust(Index: Integer): TtkTokenKind;
+    function FuncLabelloc(Index: Integer): TtkTokenKind;
+    function FuncLayer(Index: Integer): TtkTokenKind;
+    function FuncLayers(Index: Integer): TtkTokenKind;
+    function FuncLhead(Index: Integer): TtkTokenKind;
+    function FuncLtail(Index: Integer): TtkTokenKind;
+    function FuncMargin(Index: Integer): TtkTokenKind;
+    function FuncMax(Index: Integer): TtkTokenKind;
+    function FuncMcircle(Index: Integer): TtkTokenKind;
+    function FuncMclimit(Index: Integer): TtkTokenKind;
+    function FuncMdiamond(Index: Integer): TtkTokenKind;
+    function FuncMerged(Index: Integer): TtkTokenKind;
+    function FuncMin(Index: Integer): TtkTokenKind;
+    function FuncMinimum(Index: Integer): TtkTokenKind;
+    function FuncMinlen(Index: Integer): TtkTokenKind;
+    function FuncMrecord(Index: Integer): TtkTokenKind;
+    function FuncMsquare(Index: Integer): TtkTokenKind;
+    function FuncMultiples(Index: Integer): TtkTokenKind;
+    function FuncN(Index: Integer): TtkTokenKind;
+    function FuncNe(Index: Integer): TtkTokenKind;
+    function FuncNode(Index: Integer): TtkTokenKind;
+    function FuncNodesep(Index: Integer): TtkTokenKind;
+    function FuncNone(Index: Integer): TtkTokenKind;
+    function FuncNormal(Index: Integer): TtkTokenKind;
+    function FuncNslimit(Index: Integer): TtkTokenKind;
+    function FuncNw(Index: Integer): TtkTokenKind;
+    function FuncOctagon(Index: Integer): TtkTokenKind;
+    function FuncOdot(Index: Integer): TtkTokenKind;
+    function FuncOnto(Index: Integer): TtkTokenKind;
+    function FuncOrdering(Index: Integer): TtkTokenKind;
+    function FuncOrientation(Index: Integer): TtkTokenKind;
+    function FuncPage(Index: Integer): TtkTokenKind;
+    function FuncPagedir(Index: Integer): TtkTokenKind;
+    function FuncParallelogram(Index: Integer): TtkTokenKind;
+    function FuncPeripheries(Index: Integer): TtkTokenKind;
+    function FuncPlaintext(Index: Integer): TtkTokenKind;
+    function FuncPoint(Index: Integer): TtkTokenKind;
+    function FuncPolygon(Index: Integer): TtkTokenKind;
+    function FuncQuantum(Index: Integer): TtkTokenKind;
+    function FuncRank(Index: Integer): TtkTokenKind;
+    function FuncRankdir(Index: Integer): TtkTokenKind;
+    function FuncRanksep(Index: Integer): TtkTokenKind;
+    function FuncRatio(Index: Integer): TtkTokenKind;
+    function FuncRecord(Index: Integer): TtkTokenKind;
+    function FuncRegular(Index: Integer): TtkTokenKind;
+    function FuncRemincross(Index: Integer): TtkTokenKind;
+    function FuncRotate(Index: Integer): TtkTokenKind;
+    function FuncS(Index: Integer): TtkTokenKind;
+    function FuncSame(Index: Integer): TtkTokenKind;
+    function FuncSamehead(Index: Integer): TtkTokenKind;
+    function FuncSametail(Index: Integer): TtkTokenKind;
+    function FuncSamplepoints(Index: Integer): TtkTokenKind;
+    function FuncSe(Index: Integer): TtkTokenKind;
+    function FuncSearchsize(Index: Integer): TtkTokenKind;
+    function FuncSection(Index: Integer): TtkTokenKind;
+    function FuncShape(Index: Integer): TtkTokenKind;
+    function FuncShapefile(Index: Integer): TtkTokenKind;
+    function FuncSides(Index: Integer): TtkTokenKind;
+    function FuncSink(Index: Integer): TtkTokenKind;
+    function FuncSize(Index: Integer): TtkTokenKind;
+    function FuncSkew(Index: Integer): TtkTokenKind;
+    function FuncSource(Index: Integer): TtkTokenKind;
+    function FuncStrict(Index: Integer): TtkTokenKind;
+    function FuncStyle(Index: Integer): TtkTokenKind;
+    function FuncSubgraph(Index: Integer): TtkTokenKind;
+    function FuncSw(Index: Integer): TtkTokenKind;
+    function FuncTaillabel(Index: Integer): TtkTokenKind;
+    function FuncTailport(Index: Integer): TtkTokenKind;
+    function FuncTailurl(Index: Integer): TtkTokenKind;
+    function FuncToplabel(Index: Integer): TtkTokenKind;
+    function FuncTrapezium(Index: Integer): TtkTokenKind;
+    function FuncTriangle(Index: Integer): TtkTokenKind;
+    function FuncTripleoctagon(Index: Integer): TtkTokenKind;
+    function FuncTrue(Index: Integer): TtkTokenKind;
+    function FuncUrl(Index: Integer): TtkTokenKind;
+    function FuncW(Index: Integer): TtkTokenKind;
+    function FuncWeight(Index: Integer): TtkTokenKind;
+    function FuncWhen(Index: Integer): TtkTokenKind;
+    function FuncWidth(Index: Integer): TtkTokenKind;
+    function FuncZ(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure IdentProc;
+    procedure UnknownProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure CRProc;
+    procedure LFProc;
+    procedure CStyleCommentOpenProc;
+    procedure CStyleCommentProc;
+    procedure StringOpenProc;
+    procedure StringProc;
+    procedure SymbolProc;
+    procedure DirectionsProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; 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 ArrowHeadAttri: TSynHighlighterAttributes read FArrowHeadAttri write FArrowHeadAttri;
+    property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri write FAttributeAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    property DirectionsAttri: TSynHighlighterAttributes read FDirectionsAttri write FDirectionsAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property ShapeAttri: TSynHighlighterAttributes read FShapeAttri write FShapeAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+    property ValueAttri: TSynHighlighterAttributes read FValueAttri write FValueAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..145] of UnicodeString = (
+    'all', 'appendix', 'arrowhead', 'arrowsize', 'arrowtail', 'auto', 'back', 
+    'bgcolor', 'bold', 'both', 'bottomlabel', 'box', 'center', 'circle', 
+    'clusterrank', 'color', 'comment', 'compound', 'concentrate', 'constraint', 
+    'decorate', 'diamond', 'digraph', 'dir', 'distortion', 'dot', 'dotted', 
+    'doublecircle', 'doubleoctagon', 'e', 'edge', 'egg', 'ellipse', 'false', 
+    'fill', 'fillcolor', 'filled', 'fixedsize', 'fontcolor', 'fontname', 
+    'fontpath', 'fontsize', 'forward', 'global', 'graph', 'group', 'headlabel', 
+    'headport', 'headurl', 'height', 'hexagon', 'house', 'id', 'inv', 'invdot', 
+    'invhouse', 'invodot', 'invtrapezium', 'invtriangle', 'label', 'labelangle', 
+    'labeldistance', 'labelfloat', 'labelfontcolor', 'labelfontname', 
+    'labelfontsize', 'labeljust', 'labelloc', 'layer', 'layers', 'lhead', 
+    'ltail', 'margin', 'max', 'mcircle', 'mclimit', 'mdiamond', 'merged', 'min', 
+    'minimum', 'minlen', 'mrecord', 'msquare', 'multiples', 'n', 'ne', 'node', 
+    'nodesep', 'none', 'normal', 'nslimit', 'nw', 'octagon', 'odot', 'onto', 
+    'ordering', 'orientation', 'page', 'pagedir', 'parallelogram', 
+    'peripheries', 'plaintext', 'point', 'polygon', 'quantum', 'rank', 
+    'rankdir', 'ranksep', 'ratio', 'record', 'regular', 'remincross', 'rotate', 
+    's', 'same', 'samehead', 'sametail', 'samplepoints', 'se', 'searchsize', 
+    'section', 'shape', 'shapefile', 'sides', 'sink', 'size', 'skew', 'source', 
+    'strict', 'style', 'subgraph', 'sw', 'taillabel', 'tailport', 'tailurl', 
+    'toplabel', 'trapezium', 'triangle', 'tripleoctagon', 'true', 'url', 'w', 
+    'weight', 'when', 'width', 'z' 
+  );
+
+  KeyIndices: array[0..786] of Integer = (
+    -1, -1, -1, -1, 11, -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, -1, -1, -1, -1, -1, 
+    -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, 50, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 40, -1, -1, -1, -1, 4, -1, -1, -1, -1, 90, -1, 3, -1, 110, 86, 
+    -1, -1, 49, 23, -1, 92, -1, -1, -1, 15, -1, 122, -1, -1, 28, -1, 78, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 85, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 140, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, 7, -1, 0, 
+    -1, -1, 97, -1, -1, -1, -1, -1, 43, -1, -1, -1, 131, -1, -1, -1, 5, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 10, -1, 
+    47, 68, -1, 132, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 
+    -1, -1, 64, -1, -1, 124, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, 12, -1, 84, 
+    -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 42, -1, 38, -1, -1, -1, 143, -1, -1, -1, 145, 
+    106, -1, 127, -1, -1, -1, 99, 75, -1, -1, 102, -1, 58, -1, -1, 56, -1, -1, 
+    -1, -1, 9, -1, -1, -1, -1, -1, 22, -1, 73, -1, -1, -1, 17, -1, 54, 112, -1, 
+    -1, -1, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, -1, 
+    21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 116, -1, -1, 32, -1, 
+    -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, 
+    -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, 117, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 111, 93, -1, -1, -1, -1, 108, -1, -1, 119, -1, -1, -1, 
+    -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, 76, -1, -1, -1, 
+    -1, -1, -1, -1, 77, -1, -1, 104, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 26, -1, -1, -1, 79, -1, 19, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 39, -1, -1, -1, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 109, 35, -1, -1, 70, -1, -1, 57, -1, 72, -1, 
+    -1, 83, -1, -1, -1, -1, 130, -1, -1, -1, 18, -1, 118, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 
+    37, 1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 14, -1, -1, 8, -1, -1, -1, 125, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, 
+    95, -1, -1, -1, -1, 136, -1, -1, 20, -1, 62, -1, -1, -1, -1, 134, -1, -1, 
+    -1, 63, -1, -1, -1, 121, 80, -1, -1, -1, -1, -1, -1, 135, -1, -1, 120, -1, 
+    -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, 
+    -1, 24, -1, -1, 139, 67, -1, -1, 59, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 128, 34, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, 114, -1, -1, -1, -1, 
+    -1, -1, -1, 55, -1, -1, 94, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, 44, -1, 
+    -1, -1, -1, -1, 74, -1, 51, 144, -1, -1, 82, 98, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 66, -1, 25, -1, -1, -1, 45, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 
+    6, 105, -1, -1, 133, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1 
+  );
+
+{$Q-}
+function TSynDOTSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 63 + Ord(Str^) * 331;
+    Inc(Str);
+  end;
+  Result := Result mod 787;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynDOTSyn.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 TSynDOTSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[132] := FuncAll;
+  FIdentFuncTable[509] := FuncAppendix;
+  FIdentFuncTable[188] := FuncArrowhead;
+  FIdentFuncTable[72] := FuncArrowsize;
+  FIdentFuncTable[65] := FuncArrowtail;
+  FIdentFuncTable[149] := FuncAuto;
+  FIdentFuncTable[752] := FuncBack;
+  FIdentFuncTable[130] := FuncBgcolor;
+  FIdentFuncTable[536] := FuncBold;
+  FIdentFuncTable[266] := FuncBoth;
+  FIdentFuncTable[169] := FuncBottomlabel;
+  FIdentFuncTable[4] := FuncBox;
+  FIdentFuncTable[206] := FuncCenter;
+  FIdentFuncTable[666] := FuncCircle;
+  FIdentFuncTable[533] := FuncClusterrank;
+  FIdentFuncTable[85] := FuncColor;
+  FIdentFuncTable[327] := FuncComment;
+  FIdentFuncTable[278] := FuncCompound;
+  FIdentFuncTable[481] := FuncConcentrate;
+  FIdentFuncTable[425] := FuncConstraint;
+  FIdentFuncTable[573] := FuncDecorate;
+  FIdentFuncTable[302] := FuncDiamond;
+  FIdentFuncTable[272] := FuncDigraph;
+  FIdentFuncTable[79] := FuncDir;
+  FIdentFuncTable[621] := FuncDistortion;
+  FIdentFuncTable[726] := FuncDot;
+  FIdentFuncTable[419] := FuncDotted;
+  FIdentFuncTable[104] := FuncDoublecircle;
+  FIdentFuncTable[90] := FuncDoubleoctagon;
+  FIdentFuncTable[377] := FuncE;
+  FIdentFuncTable[783] := FuncEdge;
+  FIdentFuncTable[614] := FuncEgg;
+  FIdentFuncTable[319] := FuncEllipse;
+  FIdentFuncTable[409] := FuncFalse;
+  FIdentFuncTable[641] := FuncFill;
+  FIdentFuncTable[461] := FuncFillcolor;
+  FIdentFuncTable[631] := FuncFilled;
+  FIdentFuncTable[508] := FuncFixedsize;
+  FIdentFuncTable[237] := FuncFontcolor;
+  FIdentFuncTable[435] := FuncFontname;
+  FIdentFuncTable[60] := FuncFontpath;
+  FIdentFuncTable[685] := FuncFontsize;
+  FIdentFuncTable[235] := FuncForward;
+  FIdentFuncTable[141] := FuncGlobal;
+  FIdentFuncTable[693] := FuncGraph;
+  FIdentFuncTable[730] := FuncGroup;
+  FIdentFuncTable[212] := FuncHeadlabel;
+  FIdentFuncTable[171] := FuncHeadport;
+  FIdentFuncTable[749] := FuncHeadurl;
+  FIdentFuncTable[78] := FuncHeight;
+  FIdentFuncTable[51] := FuncHexagon;
+  FIdentFuncTable[701] := FuncHouse;
+  FIdentFuncTable[177] := FuncId;
+  FIdentFuncTable[603] := FuncInv;
+  FIdentFuncTable[280] := FuncInvdot;
+  FIdentFuncTable[660] := FuncInvhouse;
+  FIdentFuncTable[261] := FuncInvodot;
+  FIdentFuncTable[467] := FuncInvtrapezium;
+  FIdentFuncTable[258] := FuncInvtriangle;
+  FIdentFuncTable[628] := FuncLabel;
+  FIdentFuncTable[557] := FuncLabelangle;
+  FIdentFuncTable[507] := FuncLabeldistance;
+  FIdentFuncTable[575] := FuncLabelfloat;
+  FIdentFuncTable[584] := FuncLabelfontcolor;
+  FIdentFuncTable[192] := FuncLabelfontname;
+  FIdentFuncTable[650] := FuncLabelfontsize;
+  FIdentFuncTable[724] := FuncLabeljust;
+  FIdentFuncTable[625] := FuncLabelloc;
+  FIdentFuncTable[172] := FuncLayer;
+  FIdentFuncTable[315] := FuncLayers;
+  FIdentFuncTable[464] := FuncLhead;
+  FIdentFuncTable[341] := FuncLtail;
+  FIdentFuncTable[469] := FuncMargin;
+  FIdentFuncTable[274] := FuncMax;
+  FIdentFuncTable[699] := FuncMcircle;
+  FIdentFuncTable[253] := FuncMclimit;
+  FIdentFuncTable[391] := FuncMdiamond;
+  FIdentFuncTable[399] := FuncMerged;
+  FIdentFuncTable[92] := FuncMin;
+  FIdentFuncTable[423] := FuncMinimum;
+  FIdentFuncTable[589] := FuncMinlen;
+  FIdentFuncTable[493] := FuncMrecord;
+  FIdentFuncTable[705] := FuncMsquare;
+  FIdentFuncTable[472] := FuncMultiples;
+  FIdentFuncTable[208] := FuncN;
+  FIdentFuncTable[102] := FuncNe;
+  FIdentFuncTable[75] := FuncNode;
+  FIdentFuncTable[202] := FuncNodesep;
+  FIdentFuncTable[50] := FuncNone;
+  FIdentFuncTable[386] := FuncNormal;
+  FIdentFuncTable[70] := FuncNslimit;
+  FIdentFuncTable[551] := FuncNw;
+  FIdentFuncTable[81] := FuncOctagon;
+  FIdentFuncTable[364] := FuncOdot;
+  FIdentFuncTable[663] := FuncOnto;
+  FIdentFuncTable[565] := FuncOrdering;
+  FIdentFuncTable[300] := FuncOrientation;
+  FIdentFuncTable[135] := FuncPage;
+  FIdentFuncTable[706] := FuncPagedir;
+  FIdentFuncTable[252] := FuncParallelogram;
+  FIdentFuncTable[723] := FuncPeripheries;
+  FIdentFuncTable[167] := FuncPlaintext;
+  FIdentFuncTable[256] := FuncPoint;
+  FIdentFuncTable[117] := FuncPolygon;
+  FIdentFuncTable[402] := FuncQuantum;
+  FIdentFuncTable[753] := FuncRank;
+  FIdentFuncTable[246] := FuncRankdir;
+  FIdentFuncTable[773] := FuncRanksep;
+  FIdentFuncTable[369] := FuncRatio;
+  FIdentFuncTable[460] := FuncRecord;
+  FIdentFuncTable[74] := FuncRegular;
+  FIdentFuncTable[363] := FuncRemincross;
+  FIdentFuncTable[281] := FuncRotate;
+  FIdentFuncTable[289] := FuncS;
+  FIdentFuncTable[652] := FuncSame;
+  FIdentFuncTable[439] := FuncSamehead;
+  FIdentFuncTable[316] := FuncSametail;
+  FIdentFuncTable[354] := FuncSamplepoints;
+  FIdentFuncTable[483] := FuncSe;
+  FIdentFuncTable[372] := FuncSearchsize;
+  FIdentFuncTable[599] := FuncSection;
+  FIdentFuncTable[588] := FuncShape;
+  FIdentFuncTable[87] := FuncShapefile;
+  FIdentFuncTable[757] := FuncSides;
+  FIdentFuncTable[195] := FuncSink;
+  FIdentFuncTable[540] := FuncSize;
+  FIdentFuncTable[333] := FuncSkew;
+  FIdentFuncTable[248] := FuncSource;
+  FIdentFuncTable[640] := FuncStrict;
+  FIdentFuncTable[520] := FuncStyle;
+  FIdentFuncTable[477] := FuncSubgraph;
+  FIdentFuncTable[145] := FuncSw;
+  FIdentFuncTable[174] := FuncTaillabel;
+  FIdentFuncTable[756] := FuncTailport;
+  FIdentFuncTable[580] := FuncTailurl;
+  FIdentFuncTable[596] := FuncToplabel;
+  FIdentFuncTable[570] := FuncTrapezium;
+  FIdentFuncTable[351] := FuncTriangle;
+  FIdentFuncTable[514] := FuncTripleoctagon;
+  FIdentFuncTable[624] := FuncTrue;
+  FIdentFuncTable[115] := FuncUrl;
+  FIdentFuncTable[39] := FuncW;
+  FIdentFuncTable[128] := FuncWeight;
+  FIdentFuncTable[241] := FuncWhen;
+  FIdentFuncTable[702] := FuncWidth;
+  FIdentFuncTable[245] := FuncZ;
+end;
+
+function TSynDOTSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncAll(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncAppendix(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncArrowhead(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncArrowsize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncArrowtail(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncAuto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBack(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBgcolor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBold(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBoth(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBottomlabel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncBox(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncCenter(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncCircle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncClusterrank(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncColor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncComment(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncCompound(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncConcentrate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncConstraint(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDecorate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDiamond(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDigraph(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDir(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDistortion(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDotted(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDoublecircle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncDoubleoctagon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncE(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncEdge(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncEgg(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncEllipse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFalse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFill(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFillcolor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFilled(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue  // TODO: ANSI source isn't clear if tkValue or tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFixedsize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFontcolor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFontname(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFontpath(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncFontsize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncForward(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncGlobal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncGraph(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncGroup(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHeadlabel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHeadport(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHeadurl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHeight(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHexagon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncHouse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncId(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInv(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInvdot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInvhouse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInvodot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInvtrapezium(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncInvtriangle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelangle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabeldistance(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelfloat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelfontcolor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelfontname(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelfontsize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabeljust(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLabelloc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLayer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute  // TODO: ANSI source isn't clear if tkAttribute or tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLayers(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute  // TODO: ANSI source isn't clear if tkAttribute or tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLhead(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncLtail(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMargin(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMax(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMcircle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMclimit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMdiamond(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMerged(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMin(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMinimum(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMinlen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMrecord(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMsquare(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncMultiples(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncN(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNodesep(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNone(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNormal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNslimit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncNw(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncOctagon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncOdot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkArrowHead
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncOnto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncOrdering(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncOrientation(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPagedir(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncParallelogram(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPeripheries(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPlaintext(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPoint(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncPolygon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncQuantum(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRank(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRankdir(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRanksep(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRatio(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRecord(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRegular(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRemincross(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncRotate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncS(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSame(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSamehead(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSametail(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSamplepoints(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSe(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSearchsize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSection(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncShape(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncShapefile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSides(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSink(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSkew(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSource(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncStrict(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncStyle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSubgraph(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncSw(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTaillabel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTailport(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTailurl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncToplabel(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTrapezium(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTriangle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTripleoctagon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkShape
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncTrue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncUrl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncW(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncWeight(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncWhen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncWidth(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDOTSyn.FuncZ(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkAttribute
+  else
+    Result := tkIdentifier;
+end;
+
+procedure TSynDOTSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynDOTSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynDOTSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end;
+
+procedure TSynDOTSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynDOTSyn.DirectionsProc;
+begin
+  Inc(Run);
+  if (FLine[Run] = '>') or (FLine[Run] = '-') then
+  begin
+    FTokenID := tkDirections;
+    Inc(Run);
+  end
+  else
+    FTokenID := tkSymbol;
+end;
+
+procedure TSynDOTSyn.CStyleCommentOpenProc;
+begin
+  Inc(Run);
+  if FLine[Run] = '/' then
+  begin
+    FTokenID := tkComment;
+    Inc(Run, 2);
+    while not IsLineEnd(Run) do Inc(Run);
+    Exit;
+  end;
+  if FLine[Run] = '*' then
+  begin
+    FRange := rsCStyleComment;
+    CStyleCommentProc;
+    FTokenID := tkComment;
+  end
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynDOTSyn.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 TSynDOTSyn.StringOpenProc;
+begin
+  Inc(Run);
+  FRange := rsString;
+  StringProc;
+  FTokenID := tkString;
+end;
+
+procedure TSynDOTSyn.StringProc;
+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;
+
+constructor TSynDOTSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FArrowHeadAttri := TSynHighLighterAttributes.Create(SYNS_AttrArrowHead, SYNS_FriendlyAttrArrowHead);
+  FArrowHeadAttri.Foreground := clRed;
+  AddAttribute(FArrowHeadAttri);
+
+  FAttributeAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
+  AddAttribute(FAttributeAttri);
+
+  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  FCommentAttri.Foreground := clNavy;
+  AddAttribute(FCommentAttri);
+
+  FDirectionsAttri := TSynHighLighterAttributes.Create(SYNS_AttrDirections, SYNS_FriendlyAttrDirections);
+  FDirectionsAttri.Style := [fsBold];
+  FDirectionsAttri.Foreground := clYellow;
+  AddAttribute(FDirectionsAttri);
+
+  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FShapeAttri := TSynHighLighterAttributes.Create(SYNS_AttrShape, SYNS_FriendlyAttrShape);
+  FShapeAttri.Style := [fsBold];
+  FShapeAttri.Foreground := clRed;
+  AddAttribute(FShapeAttri);
+
+  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
+  FValueAttri.Style := [fsItalic];
+  FValueAttri.Foreground := clRed;
+  AddAttribute(FValueAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  FSymbolAttri.Style := [fsBold];
+  FSymbolAttri.Foreground := clGreen;
+  AddAttribute(FSymbolAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterDOT;
+  FRange := rsUnknown;
+end;
+
+procedure TSynDOTSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end;
+
+procedure TSynDOTSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynDOTSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynDOTSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsCStyleComment: CStyleCommentProc;
+  else
+    begin
+      FRange := rsUnknown;
+      case FLine[Run] of
+        #0: NullProc;
+        #10: LFProc;
+        #13: CRProc;
+        '/': CStyleCommentOpenProc;
+        '-': DirectionsProc;
+        '''': StringOpenProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        '~', '{', '}', ',', '(', ')', '[', ']', '<', '>', ':', '?', ';', '!', '=': SymbolProc;
+        else UnknownProc;
+      end;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynDOTSyn.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 TSynDOTSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynDOTSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+begin
+  Result :=
+    '--,->,all,appendix,arrowhead,arrowsize,arrowtail,auto,back,bgcolor,bo' +
+    'ld,both,bottomlabel,box,center,circle,clusterrank,color,comment,compou' +
+    'nd,concentrate,constraint,decorate,diamond,digraph,dir,distortion,dot,' +
+    'dotted,doublecircle,doubleoctagon,e,edge,egg,ellipse,false,fill,fillco' +
+    'lor,filled,fixedsize,fontcolor,fontname,fontpath,fontsize,forward,glob' +
+    'al,graph,group,headlabel,headport,headURL,height,hexagon,house,id,inv,' +
+    'invdot,invhouse,invodot,invtrapezium,invtriangle,label,labelangle,labe' +
+    'ldistance,labelfloat,labelfontcolor,labelfontname,labelfontsize,labelj' +
+    'ust,labelloc,layer,layers,lhead,ltail,margin,max,mcircle,mclimit,mdiam' +
+    'ond,merged,min,minimum,minlen,mrecord,msquare,multiples,n,ne,node,node' +
+    'sep,none,normal,nslimit,nw,octagon,odot,onto,ordering,orientation,page' +
+    ',pagedir,parallelogram,peripheries,plaintext,point,polygon,quantum,ran' +
+    'k,rankdir,ranksep,ratio,record,regular,remincross,rotate,s,same,samehe' +
+    'ad,sametail,samplepoints,se,searchsize,section,shape,shapefile,sides,s' +
+    'ink,size,skew,source,strict,style,subgraph,sw,taillabel,tailport,tailU' +
+    'RL,toplabel,trapezium,triangle,tripleoctagon,true,url,w,weight,when,wi' +
+    'dth,z';
+end;
+
+function TSynDOTSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynDOTSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkArrowHead: Result := FArrowHeadAttri;
+    tkAttribute: Result := FAttributeAttri;
+    tkComment: Result := FCommentAttri;
+    tkDirections: Result := FDirectionsAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkShape: Result := FShapeAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkValue: Result := FValueAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    tkSymbol: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynDOTSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynDOTSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '// ATT DOT Graphic description language'#13#10 +
+    'digraph asde91 {'#13#10 +
+    '  ranksep=.75; size = "7.5,7.5";'#13#10 +
+    '  {'#13#10 +
+    '      node [shape=plaintext, fontsize=16];'#13#10 +
+    '      /* the time-line graph */'#13#10 +
+    '      past -> 1978 -> 1980 -> 1982 -> 1983 -> 1985 -> 1986 ->'#13#10 +
+    '      1987 -> 1988 -> 1989 -> 1990 -> "future";'#13#10 +
+    '      /* ancestor programs */'#13#10 +
+    '      "Bourne sh"; "make"; "SCCS"; "yacc"; "cron"; "Reiser cpp";'#13#10 +
+    '      "Cshell"; "emacs"; "build"; "vi"; ""; "RCS"; "C*";'#13#10 +
+    '  }'#13#10 +
+    '      { rank = same;'#13#10 +
+    '      "Software IS"; "Configuration Mgt"; "Architecture & Libraries";'#13#10 +
+    '      "Process";'#13#10 +
+    '  };'#13#10 +
+    '    node [shape=box];'#13#10 +
+    '    { rank = same; "past"; "SCCS"; "make"; "Bourne sh"; "yacc"; "cron"; }'#13#10 +
+    '    { rank = same; 1978; "Reiser cpp"; "Cshell"; }'#13#10 +
+    '    { rank = same; 1980; "build"; "emacs"; "vi"; }'#13#10 +
+    '    { rank = same; 1982; "RCS"; ""; "IMX"; "SYNED"; }'#13#10 +
+    '    { rank = same; 1983; "ksh"; "IFS"; "TTU"; }'#13#10 +
+    '    { rank = same; 1985; "nmake"; "Peggy"; }'#13#10 +
+    '    { rank = same; 1986; "C*"; "ncpp"; "ksh-i"; ""; "PG2"; }'#13#10 +
+    '    { rank = same; 1987; "Ansi cpp"; "nmake 2.0"; "3D File System"; "fdelta";'#13#10 +
+    '        "DAG"; "CSAS";}'#13#10 +
+    '    { rank = same; 1988; "CIA"; "SBCS"; "ksh-88"; "PEGASUS/PML"; "PAX";'#13#10 +
+    '        "backtalk"; }'#13#10 +
+    '    { rank = same; 1989; "CIA++"; "APP"; "SHIP"; "DataShare"; "ryacc";'#13#10 +
+    '        "Mosaic"; }'#13#10 +
+    '    { rank = same; 1990; "libft"; "CoShell"; "DIA"; "IFS-i"; "kyacc"; "sfio";'#13#10 +
+    '        "yeast"; "ML-X"; "DOT"; }'#13#10 +
+    '    { rank = same; "future"; "Adv. Software Technology"; }'#13#10 +
+    '    "PEGASUS/PML" -> "ML-X";'#13#10 +
+    '    "SCCS" -> "nmake";'#13#10 +
+    '    "SCCS" -> "3D File System";'#13#10 +
+    '    "SCCS" -> "RCS";'#13#10 +
+    '    "make" -> "nmake";'#13#10 +
+    '    "make" -> "build";'#13#10 +
+    '}';
+end;
+
+function TSynDOTSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterDOT;
+end;
+
+function TSynDOTSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '_', 'A'..'Z', 'a'..'z':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynDOTSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangDOT;
+end;
+
+procedure TSynDOTSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynDOTSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynDOTSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+class function TSynDOTSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangDOT;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynDOTSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterDWS.pas b/Source/VCL/SynEdit/Source/SynHighlighterDWS.pas
index d37fa103..2fc6fa45 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterDWS.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterDWS.pas
@@ -52,19 +52,19 @@ interface
   SynEditHighlighter,
   SysUtils,
   Classes,
-//++ CodeFolding
+{$IFDEF SYN_CodeFolding}
   SynEditCodeFolding,
-  RegularExpressions,
-//-- CodeFolding
+  SynRegExpr,
+{$ENDIF}
   Character;
 
 type
   TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber,
     tkSpace, tkString, tkSymbol, tkUnknown, tkFloat, tkHex, tkDirec, tkChar);
 
-  TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty,
-    rsExports, rsDirective, rsDirectiveAsm, rsHereDocSingle, rsHereDocDouble,
-    rsType, rsUnknown);
+  TRangeState = (rsANil, rsCommentAnsi, rsCommentC, rsAsm, rsAsmCommentC,
+    rsCommentBor, rsProperty, rsExports, rsDirective, rsAsmDirective,
+    rsStringSingle, rsStringDouble, rsType, rsUnit, rsUnknown);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function : TtkTokenKind of object;
@@ -75,39 +75,44 @@    TAnsiStringList = class(TStringList)
    end;
 
 type
-//++ CodeFolding
+{$IFDEF SYN_CodeFolding}
   TSynDWSSyn = class(TSynCustomCodeFoldingHighlighter)
-//-- CodeFolding
+{$ELSE}
+  TSynDWSSyn = class(TSynCustomHighlighter)
+{$ENDIF}
   private
-    fAsmStart: Boolean;
-    fRange: TRangeState;
-    fCommentClose : Char;
-    fIdentFuncTable: array[0..388] of TIdentFuncTableFunc;
-    fKeyWords : TAnsiStringList;
+    FAsmStart: Boolean;
+    FRange: TRangeState;
+    FCommentClose: Char;
+    FIdentFuncTable: array[0..388] of TIdentFuncTableFunc;
+    FKeywords: TAnsiStringList;
+    FKeywordsUnitScoped: TAnsiStringList;
     FKeywordsPropertyScoped: TAnsiStringList;
     FKeywordsTypeScoped: TAnsiStringList;
-    fTokenID: TtkTokenKind;
-    fStringAttri: TSynHighlighterAttributes;
-    fCharAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fFloatAttri: TSynHighlighterAttributes;
-    fHexAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fAsmAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirecAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-//++ CodeFolding
-    RE_BlockBegin : TRegEx;
-    RE_BlockEnd : TRegEx;
-    RE_Code: TRegEx;
-//-- CodeFolding
+    FTokenID: TtkTokenKind;
+    FStringAttri: TSynHighlighterAttributes;
+    FCharAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FFloatAttri: TSynHighlighterAttributes;
+    FHexAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FAsmAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+{$IFDEF SYN_CodeFolding}
+    RE_BlockBegin : TRegExpr;
+    RE_BlockEnd : TRegExpr;
+    RE_Code: TRegExpr;
+{$ENDIF}
     function AltFunc: TtkTokenKind;
-    function KeyWordFunc: TtkTokenKind;
+    function KeywordFunc: TtkTokenKind;
     function FuncAsm: TtkTokenKind;
     function FuncEnd: TtkTokenKind;
+    function FuncUnitScoped: TtkTokenKind;
+    function FuncUnit: TtkTokenKind;
     function FuncPropertyScoped: TtkTokenKind;
     function FuncProperty: TtkTokenKind;
     function FuncTypeScoped: TtkTokenKind;
@@ -117,10 +122,10 @@   TSynDWSSyn = class(TSynCustomCodeFoldingHighlighter)
     procedure InitIdent;
     procedure AddressOpProc;
     procedure AsciiCharProc;
-    procedure AnsiProc;
-    procedure BorProc;
+    procedure CommentBorProc;
     procedure BraceOpenProc;
     procedure ColonOrGreaterProc;
+    procedure CommentAnsiProc;
     procedure CRProc;
     procedure IdentProc;
     procedure IntegerProc;
@@ -139,14 +144,14 @@   TSynDWSSyn = class(TSynCustomCodeFoldingHighlighter)
     procedure SymbolProc;
     procedure UnknownProc;
   protected
-    function GetSampleSource: string; override;
+    function GetSampleSource: UnicodeString; override;
     function IsFilterStored: Boolean; override;
-    function IsCurrentToken(const Token: string): Boolean; override;
+    function IsCurrentToken(const Token: UnicodeString): Boolean; override;
 
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
 
   public
     constructor Create(AOwner: TComponent); override;
@@ -169,35 +174,35 @@   TSynDWSSyn = class(TSynCustomCodeFoldingHighlighter)
     // and highlighting. It modifies the basic TSynDWSSyn to reproduce
     // the most recent Delphi editor highlighting.
 
-//++ CodeFolding
+{$IFDEF SYN_CodeFolding}
     procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
       LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
     procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges;
       LinesToScan: TStrings); override;
-//-- CodeFolding
+{$ENDIF}
   published
-    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property DirectiveAttri: TSynHighlighterAttributes read fDirecAttri
-      write fDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property FloatAttri: TSynHighlighterAttributes read fFloatAttri
-      write fFloatAttri;
-    property HexAttri: TSynHighlighterAttributes read fHexAttri
-      write fHexAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property CharAttri: TSynHighlighterAttributes read fCharAttri
-      write fCharAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
+    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirectiveAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
+      write FFloatAttri;
+    property HexAttri: TSynHighlighterAttributes read FHexAttri
+      write FHexAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property CharAttri: TSynHighlighterAttributes read FCharAttri
+      write FCharAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
   end;
 
 implementation
@@ -207,7 +212,7 @@ implementation
 
 const
    // if the language is case-insensitive keywords *must* be in lowercase
-   cKeyWords: array[1..95] of string = (
+   cKeywords: array[1..94] of UnicodeString = (
       'abstract', 'and', 'array', 'as', 'asm',
       'begin', 'break', 'case', 'cdecl', 'class', 'const', 'constructor',
       'continue', 'deprecated', 'destructor',
@@ -216,24 +221,27 @@ implementation
       'finally', 'for', 'forward', 'function', 'helper', 'if',
       'implementation', 'implements', 'implies', 'in', 'inherited',
       'initialization', 'inline', 'interface', 'is', 'lambda', 'lazy', 'library',
-      'method', 'mod', 'new', 'nil', 'not', 'object', 'of', 'old', 'on',
-      'operator', 'or', 'overload', 'override', 'pascal', 'partial', 'private',
-      'procedure', 'program', 'property', 'protected', 'public', 'published',
-      'raise', 'record', 'register', 'reintroduce', 'repeat', 'require',
-      'resourcestring', 'sar', 'sealed', 'set', 'shl', 'shr', 'static',
-      'step', 'strict', 'then', 'to', 'try', 'type', 'unit', 'until', 'uses',
-      'var', 'virtual', 'while', 'xor'
+      'method', 'mod', 'new', 'nil', 'not', 'object', 'of', 'old', 'on', 
+      'operator', 'or', 'overload', 'override', 'pascal', 'partial', 'private', 
+      'procedure', 'program', 'property', 'protected', 'public', 'published', 
+      'raise', 'record', 'register', 'reintroduce', 'repeat', 'require', 
+      'resourcestring', 'sar', 'sealed', 'set', 'shl', 'shr', 'static', 
+      'strict', 'then', 'to', 'try', 'type', 'unit', 'until', 'uses', 'var', 
+      'virtual', 'while', 'xor'
   );
-  cKeyWordsPropertyScoped: array [0..4] of string = (
+  cKeywordsUnitScoped: array [0..0] of UnicodeString = (
+      'namespace'
+  );
+  cKeywordsPropertyScoped: array [0..4] of UnicodeString = (
       'default', 'index', 'read', 'stored', 'write'
   );
-  cKeywordsTypeScoped: array [0..1] of string = (
+  cKeywordsTypeScoped: array [0..1] of UnicodeString = (
       'enum', 'flag'
   );
 
 function TAnsiStringList.CompareStrings(const S1, S2: string): Integer;
 begin
-   Result:=CompareText(S1, S2);
+  Result := CompareText(S1, S2);
 end;
 
 
@@ -243,6 +251,7 @@ constructor TSynDWSSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   FCaseSensitive := True; // bypass automatic lowercase, we handle it here
+  FCommentClose := ')';
 
   FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
   FAsmAttri.Foreground := RGB(128, 0, 0);
@@ -294,6 +303,7 @@ constructor TSynDWSSyn.Create(AOwner: TComponent);
   SetAttributesOnChange(DefHighlightChange);
 
   FKeywords := TAnsiStringList.Create;
+  FKeywordsUnitScoped := TAnsiStringList.Create;
   FKeywordsPropertyScoped := TAnsiStringList.Create;
   FKeywordsTypeScoped := TAnsiStringList.Create;
 
@@ -302,11 +312,19 @@ constructor TSynDWSSyn.Create(AOwner: TComponent);
   FAsmStart := False;
   FDefaultFilter := SYNS_FilterDWS;
 
-//++ CodeFolding
-  RE_BlockBegin.Create('\b(begin|record|class)\b', [roNotEmpty, roIgnoreCase]);
-  RE_BlockEnd.Create('\bend\b', [roNotEmpty, roIgnoreCase]);
-  RE_Code.Create('^\s*(function|procedure)\b', [roNotEmpty, roIgnoreCase]);
-//-- CodeFolding
+{$IFDEF SYN_CodeFolding}
+  RE_BlockBegin := TRegExpr.Create;
+  RE_BlockBegin.Expression := '\b(begin|record|class)\b';
+  RE_BlockBegin.ModifierI := True;
+
+  RE_BlockEnd := TRegExpr.Create;
+  RE_BlockEnd.Expression := '\bend\b';
+  RE_BlockEnd.ModifierI := True;
+
+  RE_Code := TRegExpr.Create;
+  RE_Code.Expression := '^\s*(function|procedure)\b';
+  RE_Code.ModifierI := True;
+{$ENDIF}
 end;
 
 // Destroy
@@ -315,35 +333,41 @@ destructor TSynDWSSyn.Destroy;
 begin
   inherited;
   FKeywords.Free;
+  FKeywordsUnitScoped.Free;
   FKeywordsPropertyScoped.Free;
   FKeywordsTypeScoped.Free;
+{$IFDEF SYN_CodeFolding}
+  RE_BlockBegin.Free;
+  RE_BlockEnd.Free;
+  RE_Code.Free;
+{$ENDIF}
 end;
 
 function TSynDWSSyn.HashKey(Str: PWideChar): Cardinal;
 var
-   c : Word;
+  c: Word;
 begin
-   Result:=0;
+  Result := 0;
   while IsIdentChar(Str^) do
   begin
-      c:=Ord(Str^);
-      if c in [Ord('A')..Ord('Z')] then
-         c := c + (Ord('a')-Ord('A'));
-      Result := Result * 692 + c * 171;
-      inc(Str);
-   end;
-   fStringLen := Str - fToIdent;
-   Result := Result mod Cardinal(Length(fIdentFuncTable));
+    c := Ord(Str^);
+    if c in [Ord('A')..Ord('Z')] then
+      c := c + (Ord('a') - Ord('A'));
+    Result := Result * 692 + c * 171;
+    Inc(Str);
+  end;
+  FStringLen := Str - FToIdent;
+  Result := Result mod Cardinal(Length(FIdentFuncTable));
 end;
 
 function TSynDWSSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  fToIdent := MayBe;
+  FToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(fIdentFuncTable) then
-    Result := fIdentFuncTable[Key]
+  if Key <= High(FIdentFuncTable) then
+    Result := FIdentFuncTable[Key]
   else
     Result := tkIdentifier;
 end;
@@ -352,7 +376,7 @@ procedure TSynDWSSyn.InitIdent;
 
    procedure SetIdentFunc(h : Integer; const func : TIdentFuncTableFunc);
    begin
-      fIdentFuncTable[h]:=func;
+      FIdentFuncTable[h] := func;
    end;
 
 var
@@ -360,9 +384,15 @@ procedure TSynDWSSyn.InitIdent;
 begin
   for i := Low(cKeywords) to High(cKeywords) do
   begin
-      SetIdentFunc(HashKey(@cKeyWords[i][1]), KeyWordFunc);
-      fKeyWords.Add(cKeyWords[i]);
-   end;
+    SetIdentFunc(HashKey(@cKeywords[i][1]), KeywordFunc);
+    FKeywords.Add(cKeywords[i]);
+  end;
+  
+  for i := 0 to High(cKeywordsUnitScoped) do
+  begin
+    SetIdentFunc(HashKey(@cKeywordsUnitScoped[i][1]), FuncUnitScoped);
+    FKeywordsUnitScoped.Add(cKeywordsUnitScoped[i]);
+  end;
 
   for i := 0 to High(cKeywordsPropertyScoped) do
   begin
@@ -374,18 +404,19 @@ procedure TSynDWSSyn.InitIdent;
   begin
     SetIdentFunc(HashKey(@cKeywordsTypeScoped[i][1]), FuncTypeScoped);
     FKeywordsTypeScoped.Add(cKeywordsTypeScoped[i]);
-   end;
+  end;
 
-   for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-      if @fIdentFuncTable[i] = nil then
-         fIdentFuncTable[i] := AltFunc;
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := AltFunc;
 
-   SetIdentFunc(HashKey('asm'), FuncAsm);
-   SetIdentFunc(HashKey('end'), FuncEnd);
-   SetIdentFunc(HashKey('property'), FuncProperty);
+  SetIdentFunc(HashKey('asm'), FuncAsm);
+  SetIdentFunc(HashKey('end'), FuncEnd);
+  SetIdentFunc(HashKey('property'), FuncProperty);
+  SetIdentFunc(HashKey('unit'), FuncUnit);
   SetIdentFunc(HashKey('type'), FuncType);
 
-   fKeyWords.Sorted:=True;
+  FKeywords.Sorted := True;
 end;
 
 function TSynDWSSyn.AltFunc: TtkTokenKind;
@@ -393,12 +424,12 @@ function TSynDWSSyn.AltFunc: TtkTokenKind;
   Result := tkIdentifier
 end;
 
-function TSynDWSSyn.KeyWordFunc: TtkTokenKind;
+function TSynDWSSyn.KeywordFunc: TtkTokenKind;
 var
    buf : String;
 begin
-   SetString(buf, fToIdent, fStringLen);
-   if (fKeyWords.IndexOf(buf)>=0) and (FLine[Run - 1] <> '&') then
+   SetString(buf, FToIdent, FStringLen);
+   if (FKeywords.IndexOf(buf) >= 0) and (FLine[Run - 1] <> '&') then
       Result := tkKey
    else Result := tkIdentifier
 end;
@@ -407,31 +438,31 @@ function TSynDWSSyn.FuncAsm: TtkTokenKind;
 begin
    if IsCurrentToken('asm') then begin
       Result := tkKey;
-      fRange := rsAsm;
-      fAsmStart := True;
-   end else Result:=KeyWordFunc;
+      FRange := rsAsm;
+      FAsmStart := True;
+   end else Result := KeywordFunc;
 end;
 
 function TSynDWSSyn.FuncEnd: TtkTokenKind;
 begin
-   if IsCurrentToken('end') then begin
+  if IsCurrentToken('end') then begin
     if (FLine[Run - 1] <> '&') then
     begin
       Result := tkKey;
-      fRange := rsUnknown;
+      FRange := rsUnknown;
     end
     else
       Result := tkIdentifier;
-   end else Result:=KeyWordFunc;
+  end else Result := KeywordFunc;
 end;
 
 function TSynDWSSyn.FuncTypeScoped: TtkTokenKind;
 var
-   buf : String;
+   buf: String;
 begin
-   SetString(buf, fToIdent, fStringLen);
+  SetString(buf, FToIdent, FStringLen);
   if (FRange = rsType) and (FKeywordsTypeScoped.IndexOf(buf) >= 0) then
-      Result:=tkKey
+    Result := tkKey
   else
     Result := KeywordFunc;
 end;
@@ -441,13 +472,13 @@ function TSynDWSSyn.FuncType: TtkTokenKind;
   if IsCurrentToken('type') then
   begin
     if (FLine[Run - 1] <> '&') then
-begin
+    begin
       Result := tkKey;
       FRange := rsType;
     end
     else
       Result := tkIdentifier;
-   end else Result:=KeyWordFunc;
+  end else Result := KeywordFunc;
 end;
 
 function TSynDWSSyn.FuncPropertyScoped: TtkTokenKind;
@@ -461,10 +492,21 @@ function TSynDWSSyn.FuncPropertyScoped: TtkTokenKind;
     Result := KeywordFunc;
 end;
 
+function TSynDWSSyn.FuncUnitScoped: TtkTokenKind;
+var
+   buf: String;
+begin
+  SetString(buf, FToIdent, FStringLen);
+  if (FRange = rsUnit) and (FKeywordsUnitScoped.IndexOf(buf) >= 0) then
+    Result := tkKey
+  else
+    Result := KeywordFunc;
+end;
+
 function TSynDWSSyn.FuncProperty: TtkTokenKind;
 begin
   if IsCurrentToken('property') then
-begin
+  begin
     Result := tkKey;
     FRange := rsProperty;
   end
@@ -472,18 +514,29 @@ function TSynDWSSyn.FuncProperty: TtkTokenKind;
     Result := KeywordFunc;
 end;
 
+function TSynDWSSyn.FuncUnit: TtkTokenKind;
+begin
+  if IsCurrentToken('unit') then
+  begin
+    Result := tkKey;
+    FRange := rsUnit;
+  end
+  else
+    Result := KeywordFunc;
+end;
+
 procedure TSynDWSSyn.AddressOpProc;
 begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if fLine[Run] = '@' then inc(Run);
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '@' then Inc(Run);
 end;
 
 procedure TSynDWSSyn.AsciiCharProc;
 
   function IsAsciiChar: Boolean;
   begin
-    case fLine[Run] of
+    case FLine[Run] of
       '0'..'9', '$', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -492,9 +545,9 @@ procedure TSynDWSSyn.AsciiCharProc;
   end;
 
 begin
-  fTokenID := tkChar;
+  FTokenID := tkChar;
   Inc(Run);
-  if fLine[run]='''' then
+  if FLine[run]='''' then
       StringAposMultiProc
   else begin
      while IsAsciiChar do
@@ -502,27 +555,27 @@ procedure TSynDWSSyn.AsciiCharProc;
   end;
 end;
 
-procedure TSynDWSSyn.BorProc;
+procedure TSynDWSSyn.CommentBorProc;
 begin
-  case fLine[Run] of
+  case FLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
     begin
-      if fRange in [rsDirective, rsDirectiveAsm] then
-        fTokenID := tkDirec
+      if FRange in [rsDirective, rsAsmDirective] then
+        FTokenID := tkDirec
       else
-        fTokenID := tkComment;
+        FTokenID := tkComment;
       repeat
-        if fLine[Run] = '}' then
+        if FLine[Run] = '}' then
         begin
           Inc(Run);
-          if fRange in [rsBorAsm, rsDirectiveAsm] then
-            fRange := rsAsm
+          if FRange in [rsAsmDirective] then
+            FRange := rsAsm
           else
-            fRange := rsUnKnown;
-          break;
+            FRange := rsUnknown;
+          Break;
         end;
         Inc(Run);
       until IsLineEnd(Run);
@@ -532,43 +585,47 @@ procedure TSynDWSSyn.BorProc;
 
 procedure TSynDWSSyn.BraceOpenProc;
 begin
-  if (fLine[Run + 1] = '$') then
+  if (FLine[Run + 1] = '$') then
   begin
-    if fRange = rsAsm then
-      fRange := rsDirectiveAsm
+    if FRange = rsAsm then
+      FRange := rsAsmDirective
     else
-      fRange := rsDirective;
+      FRange := rsDirective;
   end
   else
   begin
-    if fRange = rsAsm then
-      fRange := rsBorAsm
+    if FRange = rsAsm then
+    begin
+      FTokenID := tkSymbol;
+      Inc(Run);
+      Exit;
+    end
     else
-      fRange := rsBor;
+      FRange := rsCommentBor;
   end;
-  BorProc;
+  CommentBorProc;
 end;
 
 procedure TSynDWSSyn.ColonOrGreaterProc;
 begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if fLine[Run] = '=' then inc(Run);
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '=' then Inc(Run);
 end;
 
 procedure TSynDWSSyn.CRProc;
 begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.IdentProc;
 begin
-  fTokenID := IdentKind(fLine + Run);
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
+  FTokenID := IdentKind(FLine + Run);
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
     Inc(Run);
 end;
 
@@ -576,7 +633,7 @@ procedure TSynDWSSyn.IntegerProc;
 
   function IsIntegerChar: Boolean;
   begin
-    case fLine[Run] of
+    case FLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -585,49 +642,48 @@ procedure TSynDWSSyn.IntegerProc;
   end;
 
 begin
-  inc(Run);
-  fTokenID := tkHex;
+  Inc(Run);
+  FTokenID := tkHex;
   while IsIntegerChar do
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.LFProc;
 begin
-  fTokenID := tkSpace;
-  inc(Run);
+  FTokenID := tkSpace;
+  Inc(Run);
 end;
 
 procedure TSynDWSSyn.LoadDelphiStyle;
 
-
-   procedure AddKeyword( const AName : string );
+   procedure AddKeyword(const AName : string);
    var
-     I : integer;
+     I : Integer;
    begin
      I := HashKey( @AName[1] );
-     fIdentFuncTable[I]:= KeyWordFunc;
-     fKeyWords.Add(AName);
+     FIdentFuncTable[I] := KeywordFunc;
+     FKeywords.Add(AName);
    end;
 
-   procedure RemoveKeyword( const AName : string );
+   procedure RemoveKeyword(const AName : string);
    var
-     I : integer;
+     I : Integer;
    begin
-     I := fKeyWords.IndexOf(AName);
+     I := FKeywords.IndexOf(AName);
      if I <> -1 then
-       fKeywords.Delete( I );
+       FKeywords.Delete(I);
    end;
 
 const
   clID = clNavy;
   clString = clBlue;
   clComment = clGreen;
-  cKeywordsToAdd: array[0..0] of string = (
+  cKeywordsToAdd: array[0..0] of UnicodeString = (
       'string');
-  cKeywordsToRemove: array[0..1] of string = (
+  cKeywordsToRemove: array[0..1] of UnicodeString = (
       'break', 'exit');
 var
-  i : integer;
+  i : Integer;
 begin
   // This routine can be called to install a Delphi style of colors
   // and highlighting. It modifies the basic TSynDWSSyn to reproduce
@@ -639,33 +695,33 @@ procedure TSynDWSSyn.LoadDelphiStyle;
   CommentAttri.Foreground := clComment;
 
   // These are keywords highlighted in Delphi but not in TSynDWSSyn ..
-  for i:=Low(cKeywordsToAdd) to High(cKeywordsToAdd) do
-    AddKeyword( cKeywordsToAdd[i] );
+  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] );
+  for i := Low(cKeywordsToRemove) to High(cKeywordsToRemove) do
+    RemoveKeyword(cKeywordsToRemove[i]);
 end;
 
 procedure TSynDWSSyn.LowerProc;
 begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if (fLine[Run] = '=') or (fLine[Run] = '>') then
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run] = '=') or (FLine[Run] = '>') then
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.NullProc;
 begin
-  fTokenID := tkNull;
-  inc(Run);
+  FTokenID := tkNull;
+  Inc(Run);
 end;
 
 procedure TSynDWSSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case fLine[Run] of
+    case FLine[Run] of
       '0'..'9', '.', 'e', 'E', '-', '+':
         Result := True;
       else
@@ -675,19 +731,19 @@ procedure TSynDWSSyn.NumberProc;
 
 begin
   Inc(Run);
-  fTokenID := tkNumber;
+  FTokenID := tkNumber;
   while IsNumberChar do
   begin
-    case fLine[Run] of
+    case FLine[Run] of
       '.':
-        if fLine[Run + 1] = '.' then
+        if FLine[Run + 1] = '.' then
           Break
         else
-          fTokenID := tkFloat;
-      'e', 'E': fTokenID := tkFloat;
+          FTokenID := tkFloat;
+      'e', 'E': FTokenID := tkFloat;
       '-', '+':
         begin
-          if fTokenID <> tkFloat then // arithmetic
+          if FTokenID <> tkFloat then // arithmetic
             Break;
           if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then
             Break; //float, but it ends here
@@ -699,28 +755,28 @@ procedure TSynDWSSyn.NumberProc;
 
 procedure TSynDWSSyn.PointProc;
 begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if (fLine[Run] = '.') or (fLine[Run - 1] = ')') then
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run] = '.') or (FLine[Run - 1] = ')') then
     Inc(Run);
 end;
 
-procedure TSynDWSSyn.AnsiProc;
+procedure TSynDWSSyn.CommentAnsiProc;
 begin
-  case fLine[Run] of
+  case FLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
-    fTokenID := tkComment;
+    FTokenID := tkComment;
     repeat
-      if (fLine[Run] = '*') and (fLine[Run + 1] = fCommentClose) then begin
+      if (FLine[Run] = '*') and (FLine[Run + 1] = FCommentClose) then begin
         Inc(Run, 2);
-        if fRange = rsAnsiAsm then
-          fRange := rsAsm
+        if FRange in [rsAsmCommentC] then
+          FRange := rsAsm
         else
-          fRange := rsUnKnown;
-        break;
+          FRange := rsUnknown;
+        Break;
       end;
       Inc(Run);
     until IsLineEnd(Run);
@@ -730,43 +786,47 @@ procedure TSynDWSSyn.AnsiProc;
 procedure TSynDWSSyn.RoundOpenProc;
 begin
   Inc(Run);
-  case fLine[Run] of
+  case FLine[Run] of
     '*':
       begin
         Inc(Run);
-        if fRange = rsAsm then
-          fRange := rsAnsiAsm
+        if FRange = rsAsm then
+        begin
+          Inc(Run);
+          FTokenID := tkSymbol;
+          Exit;
+        end
         else
-          fRange := rsAnsi;
-        fTokenID := tkComment;
-        fCommentClose := ')';
+          FRange := rsCommentAnsi;
+        FTokenID := tkComment;
+        FCommentClose := ')';
         if not IsLineEnd(Run) then
-          AnsiProc;
+          CommentAnsiProc;
       end;
     '.':
       begin
-        inc(Run);
-        fTokenID := tkSymbol;
+        Inc(Run);
+        FTokenID := tkSymbol;
       end;
   else
-    fTokenID := tkSymbol;
+    FTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynDWSSyn.SemicolonProc;
 begin
   Inc(Run);
-  fTokenID := tkSymbol;
-  if fRange in [rsProperty, rsExports] then
-    fRange := rsUnknown;
+  FTokenID := tkSymbol;
+  if FRange in [rsUnit, rsProperty, rsExports] then
+    FRange := rsUnknown;
 end;
 
 procedure TSynDWSSyn.SlashProc;
 begin
   Inc(Run);
-  case fLine[Run] of
+  case FLine[Run] of
     '/': begin
-      fTokenID := tkComment;
+      FTokenID := tkComment;
       repeat
         Inc(Run);
       until IsLineEnd(Run);
@@ -774,37 +834,37 @@ procedure TSynDWSSyn.SlashProc;
     '*':
       begin
         Inc(Run);
-        if fRange = rsAsm then
-          fRange := rsAnsiAsm
+        if FRange = rsAsm then
+          FRange := rsAsmCommentC
         else
-          fRange := rsAnsi;
-        fTokenID := tkComment;
-        fCommentClose := '/';
+          FRange := rsCommentC;
+        FTokenID := tkComment;
+        FCommentClose := '/';
         if not IsLineEnd(Run) then
-          AnsiProc;
+          CommentAnsiProc;
       end;
   else
-    fTokenID := tkSymbol;
+    FTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynDWSSyn.SpaceProc;
 begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynDWSSyn.StringAposProc;
 begin
-  fTokenID := tkString;
+  FTokenID := tkString;
   Inc(Run);
   while not IsLineEnd(Run) do
   begin
-    if fLine[Run] = #39 then begin
+    if FLine[Run] = #39 then begin
       Inc(Run);
-      if fLine[Run] <> #39 then
-        break;
+      if FLine[Run] <> #39 then
+        Break;
     end;
     Inc(Run);
   end;
@@ -812,17 +872,17 @@ procedure TSynDWSSyn.StringAposProc;
 
 procedure TSynDWSSyn.StringAposMultiProc;
 begin
-  fTokenID := tkString;
+  FTokenID := tkString;
   if (Run>0) or IsLineEnd(Run+1) then
      Inc(Run);
-  fRange := rsHereDocSingle;
+  FRange := rsStringSingle;
   while not IsLineEnd(Run) do
   begin
-    if fLine[Run] = '''' then begin
+    if FLine[Run] = '''' then begin
       Inc(Run);
-      if fLine[Run] <> '''' then begin
-        fRange := rsUnknown;
-        break;
+      if FLine[Run] <> '''' then begin
+        FRange := rsUnknown;
+        Break;
       end;
     end;
     Inc(Run);
@@ -831,10 +891,10 @@ procedure TSynDWSSyn.StringAposMultiProc;
 
 procedure TSynDWSSyn.StringQuoteProc;
 begin
-  fTokenID := tkString;
-  if fRange <> rsHereDocDouble then
+  FTokenID := tkString;
+  if FRange <> rsStringDouble then
   begin
-    fRange := rsHereDocDouble;
+    FRange := rsStringDouble;
     Inc(Run);
   end else
   begin
@@ -847,13 +907,13 @@ procedure TSynDWSSyn.StringQuoteProc;
 
   while not IsLineEnd(Run) do
   begin
-    if fLine[Run] = '"' then
+    if FLine[Run] = '"' then
     begin
       Inc(Run);
-      if fLine[Run] <> '"' then
+      if FLine[Run] <> '"' then
       begin
-        fRange := rsUnknown;
-        break;
+        FRange := rsUnknown;
+        Break;
       end;
     end;
     Inc(Run);
@@ -862,76 +922,76 @@ procedure TSynDWSSyn.StringQuoteProc;
 
 procedure TSynDWSSyn.SymbolProc;
 begin
-  inc(Run);
-  fTokenID := tkSymbol;
+  Inc(Run);
+  FTokenID := tkSymbol;
 end;
 
 procedure TSynDWSSyn.UnknownProc;
 begin
-  inc(Run);
-  fTokenID := tkUnknown;
+  Inc(Run);
+  FTokenID := tkUnknown;
 end;
 
 procedure TSynDWSSyn.Next;
 begin
-   fAsmStart := False;
-   fTokenPos := Run;
-   case fRange of
-      rsAnsi, rsAnsiAsm:
-         AnsiProc;
-      rsBor, rsBorAsm, rsDirective, rsDirectiveAsm:
-         BorProc;
-      rsHereDocSingle:
-         StringAposMultiProc;
-      rsHereDocDouble:
-         StringQuoteProc;
-   else
-      case fLine[Run] of
-         #0: NullProc;
-         #10: LFProc;
-         #13: CRProc;
-         #1..#9, #11, #12, #14..#32: SpaceProc;
-         '#': AsciiCharProc;
-         '$': IntegerProc;
-         #39: StringAposProc;
-         '"': StringQuoteProc;
-         '0'..'9': NumberProc;
-         'A'..'Z', 'a'..'z', '_': IdentProc;
-         '{': BraceOpenProc;
-         '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin
-            case fLine[Run] of
-               '(': RoundOpenProc;
-               '.': PointProc;
-               ';': SemicolonProc;
-               '/': SlashProc;
-               ':', '>': ColonOrGreaterProc;
-               '<': LowerProc;
-               '@': AddressOpProc;
-            else
-               SymbolProc;
-            end;
-         end;
-         #$0080..#$FFFF :
-            if Char(fLine[Run]).IsLetterOrDigit then
-               IdentProc
-            else UnknownProc;
-      else
-         UnknownProc;
-      end;
-   end;
-   inherited;
+  FAsmStart := False;
+  FTokenPos := Run;
+  case FRange of
+    rsCommentAnsi, rsCommentC, rsAsmCommentC:
+        CommentAnsiProc;
+    rsCommentBor, rsDirective, rsAsmDirective:
+       CommentBorProc;
+    rsStringSingle:
+       StringAposMultiProc;
+    rsStringDouble:
+       StringQuoteProc;
+  else
+    case FLine[Run] of
+       #0: NullProc;
+       #10: LFProc;
+       #13: CRProc;
+       #1..#9, #11, #12, #14..#32: SpaceProc;
+       '#': AsciiCharProc;
+       '$': IntegerProc;
+       #39: StringAposProc;
+       '"': StringQuoteProc;
+       '0'..'9': NumberProc;
+       'A'..'Z', 'a'..'z', '_': IdentProc;
+       '{': BraceOpenProc;
+       '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin
+          case FLine[Run] of
+             '(': RoundOpenProc;
+             '.': PointProc;
+             ';': SemicolonProc;
+             '/': SlashProc;
+             ':', '>': ColonOrGreaterProc;
+             '<': LowerProc;
+             '@': AddressOpProc;
+          else
+             SymbolProc;
+          end;
+       end;
+       #$0080..#$FFFF :
+          if {$IFDEF SYN_COMPILER_18_UP}Char(FLine[Run]).IsLetterOrDigit{$ELSE}TCharacter.IsLetterOrDigit(FLine[Run]){$ENDIF} then
+             IdentProc
+          else UnknownProc;
+    else
+       UnknownProc;
+    end;
+  end;
+  inherited;
 end;
 
 function TSynDWSSyn.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;
+    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;
@@ -939,35 +999,35 @@ function TSynDWSSyn.GetDefaultAttribute(Index: Integer):
 
 function TSynDWSSyn.GetEol: Boolean;
 begin
-  Result := Run = fLineLen + 1;
+  Result := Run = FLineLen + 1;
 end;
 
 function TSynDWSSyn.GetTokenID: TtkTokenKind;
 begin
-  if not fAsmStart and (fRange = rsAsm)
-    and not (fTokenId in [tkNull, tkComment, tkDirec, tkSpace])
+  if not FAsmStart and (FRange = rsAsm)
+    and not (FTokenID in [tkNull, tkComment, tkDirec, tkSpace])
   then
     Result := tkAsm
   else
-    Result := fTokenId;
+    Result := FTokenID;
 end;
 
 function TSynDWSSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkAsm: Result := fAsmAttri;
-    tkComment: Result := fCommentAttri;
-    tkDirec: Result := fDirecAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkFloat: Result := fFloatAttri;
-    tkHex: Result := fHexAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkChar: Result := fCharAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fSymbolAttri;
+    tkAsm: Result := FAsmAttri;
+    tkComment: Result := FCommentAttri;
+    tkDirec: Result := FDirecAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkFloat: Result := FFloatAttri;
+    tkHex: Result := FHexAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkChar: Result := FCharAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FSymbolAttri;
   else
     Result := nil;
   end;
@@ -980,10 +1040,10 @@ function TSynDWSSyn.GetTokenKind: Integer;
 
 function TSynDWSSyn.GetRange: Pointer;
 begin
-  Result := Pointer(fRange);
+  Result := Pointer(FRange);
 end;
 
-//++ CodeFolding
+{$IFDEF SYN_CodeFolding}
 type
   TRangeStates = set of TRangeState;
 
@@ -991,8 +1051,8 @@ function TSynDWSSyn.GetRange: Pointer;
   FT_Standard = 1;  // begin end, class end, record end
   FT_Comment = 11;
   FT_Asm = 12;
-  FT_HereDocDouble = 13;
-  FT_HereDocSingle = 14;
+  FT_StringDouble = 13;
+  FT_StringSingle = 14;
   FT_ConditionalDirective = 15;
   FT_CodeDeclaration = 16;
   FT_CodeDeclarationWithBody = 17;
@@ -1007,34 +1067,29 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
   function BlockDelimiter(Line: Integer): Boolean;
   var
     Index: Integer;
-    Match : TMatch;
   begin
     Result := False;
 
-    Match := RE_BlockBegin.Match(CurLine);
-    if Match.Success then
+    if RE_BlockBegin.Exec(CurLine) then
     begin
       // Char must have proper highlighting (ignore stuff inside comments...)
-      Index :=  Match.Index;
+      Index := RE_BlockBegin.MatchPos[0];
       if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
       begin
         // And ignore lines with both opening and closing chars in them
-        if not RE_BlockEnd.IsMatch(CurLine, Index + 1) then begin
+        Re_BlockEnd.InputString := CurLine;
+        if not RE_BlockEnd.Exec(Index + 1) then begin
           FoldRanges.StartFoldRange(Line + 1, FT_Standard);
           Result := True;
         end;
       end;
-    end else begin
-      Match := RE_BlockEnd.Match(CurLine);
-      if Match.Success then begin
-        begin
-          Index :=  Match.Index;
-          if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
-          begin
-            FoldRanges.StopFoldRange(Line + 1, FT_Standard);
-            Result := True;
-          end;
-        end;
+    end else if RE_BlockEnd.Exec(CurLine) then
+    begin
+      Index := RE_BlockEnd.MatchPos[0];
+      if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+      begin
+        FoldRanges.StopFoldRange(Line + 1, FT_Standard);
+        Result := True;
       end;
     end;
   end;
@@ -1097,12 +1152,10 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
   for Line := FromLine to ToLine do
   begin
     // Deal first with Multiline statements
-    if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or
-       IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or
-       IsMultiLineStatement(Line, [rsHereDocDouble], True, FT_HereDocDouble)  or
-       IsMultiLineStatement(Line, [rsHereDocSingle], True, FT_HereDocSingle)  or
-       IsMultiLineStatement(Line, [rsHereDocSingle], True, FT_HereDocSingle)  or
-       IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or
+    if IsMultiLineStatement(Line, [rsCommentAnsi, rsCommentC, rsCommentBor], True, FT_Comment) or
+       IsMultiLineStatement(Line, [rsAsm, rsAsmCommentC, rsAsmDirective], True, FT_Asm) or
+       IsMultiLineStatement(Line, [rsStringDouble], True, FT_StringDouble) or
+       IsMultiLineStatement(Line, [rsStringSingle], True, FT_StringSingle) or
        IsMultiLineStatement(Line, [rsDirective], False)
     then
       Continue;
@@ -1127,7 +1180,7 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
     if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then
       FoldRanges.StartFoldRange(Line +1, FT_Implementation)
     // Functions and procedures
-    else if RE_Code.IsMatch(CurLine) then
+    else if RE_Code.Exec(CurLine) then
       FoldRanges.StartFoldRange(Line +1, FT_CodeDeclaration)
     // Find begin or end  (Fold Type 1)
     else if not BlockDelimiter(Line) then
@@ -1144,7 +1197,6 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
   i, j, SkipTo: Integer;
   ImplementationIndex: Integer;
   FoldRange: TSynFoldRange;
-  Match : TMatch;
 begin
   ImplementationIndex := - 1;
   for i  := FoldRanges.Ranges.Count - 1 downto 0 do
@@ -1166,36 +1218,33 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
         FoldRange := FoldRanges.Ranges.List[j];
         Inc(j);
         case FoldRange.FoldType of
+          // Nested procedure or function
           FT_CodeDeclarationWithBody:
-            // Nested procedure or function
             begin
               SkipTo := FoldRange.ToLine;
               continue;
             end;
           FT_Standard:
-            // possibly begin end;
+          // possibly begin end;
             if FoldRange.ToLine <= SkipTo then
               Continue
-            else begin
-              Match := RE_BlockBegin.Match(LinesToScan[FoldRange.FromLine - 1]);
-              if Match.Success then
+            else if RE_BlockBegin.Exec(LinesToScan[FoldRange.FromLine - 1]) then
+            begin
+              if LowerCase(RE_BlockBegin.Match[0]) = 'begin' then
               begin
-                if LowerCase(Match.Value) = 'begin' then
-                begin
-                  // function or procedure followed by begin end block
-                  // Adjust ToLine
-                  FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine;
-                  FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody;
-                  break
-                end else
-                begin
-                  // class or record declaration follows, so
-                  FoldRanges.Ranges.Delete(i);
-                  break;
-                 end;
+                // function or procedure followed by begin end block
+                // Adjust ToLine
+                FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine;
+                FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody;
+                break
               end else
-                Assert(False, 'TSynDWSSyn.AdjustFoldRanges');
-            end;
+              begin
+                // class or record declaration follows, so
+                FoldRanges.Ranges.Delete(i);
+                break;
+               end;
+            end else
+              Assert(False, 'TSynDWSSyn.AdjustFoldRanges');
         else
           begin
             if FoldRange.ToLine <= SkipTo then
@@ -1216,41 +1265,42 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
     //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count;
     FoldRanges.Ranges.Delete(ImplementationIndex);
 end;
-//-- CodeFolding
+{$ENDIF}
 
 procedure TSynDWSSyn.SetRange(Value: Pointer);
 begin
-  fRange := TRangeState(Value);
+  FRange := TRangeState(Value);
 end;
 
 procedure TSynDWSSyn.ResetRange;
 begin
-  fRange:= rsUnknown;
+  FRange := rsUnknown;
 end;
 
-function TSynDWSSyn.GetSampleSource: string;
+function TSynDWSSyn.GetSampleSource: UnicodeString;
 begin
-  Result := '{ Syntax highlighting }'#13#10 +
-             'procedure TForm1.Button1Click(Sender: TObject);'#13#10 +
-             'var'#13#10 +
-             '  Number, I, X: Integer;'#13#10 +
-             'begin'#13#10 +
-             '  Number := 123456;'#13#10 +
-             '  Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 +
-             '  for I := 0 to Number do'#13#10 +
-             '  begin'#13#10 +
-             '    Inc(X);'#13#10 +
-             '    Dec(X);'#13#10 +
-             '    X := X + 1.0;'#13#10 +
-             '    X := X - $5E;'#13#10 +
-             '  end;'#13#10 +
-             '  {$R+}'#13#10 +
-             '  asm'#13#10 +
-             '    mov AX, 1234H'#13#10 +
-             '    mov Number, AX'#13#10 +
-             '  end;'#13#10 +
-             '  {$R-}'#13#10 +
-             'end;';
+  Result := 
+    '{ Syntax highlighting }'#13#10 +
+    'procedure TForm1.Button1Click(Sender: TObject);'#13#10 +
+    'var'#13#10 +
+    '  Number, I, X: Integer;'#13#10 +
+    'begin'#13#10 +
+    '  Number := 123456;'#13#10 +
+    '  Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 +
+    '  for I := 0 to Number do'#13#10 +
+    '  begin'#13#10 +
+    '    Inc(X);'#13#10 +
+    '    Dec(X);'#13#10 +
+    '    X := X + 1.0;'#13#10 +
+    '    X := X - $5E;'#13#10 +
+    '  end;'#13#10 +
+    '  {$R+}'#13#10 +
+    '  asm'#13#10 +
+    '    mov AX, 1234H'#13#10 +
+    '    mov Number, AX'#13#10 +
+    '  end;'#13#10 +
+    '  {$R-}'#13#10 +
+    'end;';
 end;
 
 
@@ -1266,29 +1316,29 @@ class function TSynDWSSyn.GetCapabilities: TSynHighlighterCapabilities;
 
 function TSynDWSSyn.IsFilterStored: Boolean;
 begin
-  Result := fDefaultFilter <> SYNS_FilterPascal;
+  Result := FDefaultFilter <> SYNS_FilterPascal;
 end;
 
 // IsCurrentToken
 //
-function TSynDWSSyn.IsCurrentToken(const Token: string): Boolean;
+function TSynDWSSyn.IsCurrentToken(const Token: UnicodeString): Boolean;
 var
-   i : Integer;
-   temp : PWideChar;
+  i: Integer;
+  temp: PWideChar;
 begin
-   temp := fToIdent;
+  temp := FToIdent;
   if Length(Token) = FStringLen then
   begin
-      Result := True;
+    Result := True;
     for i := 1 to FStringLen do
     begin
       if (temp^ <> Token[i]) and ((temp^>'z') or (UpCase(temp^) <> UpCase(Token[i]))) then
       begin
-            Result := False;
-            break;
-         end;
-         inc(temp);
+        Result := False;
+        Break;
       end;
+      Inc(temp);
+    end;
   end
   else
     Result := False;
@@ -1298,19 +1348,21 @@ function TSynDWSSyn.IsCurrentToken(const Token: string): Boolean;
 //
 function TSynDWSSyn.IsIdentChar(AChar: WideChar): Boolean;
 begin
-   if Ord(AChar)<=$7F then
-      Result := AnsiChar(AChar) in ['_', '0'..'9', 'A'..'Z', 'a'..'z']
-   else
-      Result := AChar.IsLetterOrDigit;
+  if Ord(AChar) <= $7F then
+    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: string;
+class function TSynDWSSyn.GetFriendlyLanguageName: UnicodeString;
 begin
   Result := SYNS_FriendlyLangPascal;
 end;
 
 initialization
+
+{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynDWSSyn);
+{$ENDIF}
 
 end.
-
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterDfm.pas b/Source/VCL/SynEdit/Source/SynHighlighterDfm.pas
index 42faeeb8..2e2d1409 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterDfm.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterDfm.pas
@@ -1,548 +1,636 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterDfm.pas, released 2000-04-14.
-The Original Code is based on the dmDfmSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is David H. Muir.
-Unicode translation by Maël Hörz.
-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: SynHighlighterDfm.pas,v 1.16.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Delphi Form Source highlighter for SynEdit)
-@author(David Muir )
-@created(April 13, 2000)
-@lastmod(2000-06-23)
-The SynHighlighterDfm unit provides SynEdit with a Delphi Form Source (.dfm) highlighter.
-The highlighter formats form source code similar to when forms are viewed as text in the Delphi editor.
-}
-
-unit SynHighlighterDfm;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown);
-
-  TRangeState = (rsANil, rsComment, rsUnKnown);
-
-type
-  TSynDfmSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    procedure AltProc;
-    procedure AsciiCharProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CommentProc;
-    procedure CRProc;
-    procedure EndProc;
-    procedure IntegerProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure ObjectProc;
-    procedure InheritedProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure SymbolProc;
-    procedure UnknownProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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;
-  end;
-
-function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
-  var WasText: Boolean): Integer;
-function SaveStrings2DFMFile(AStrings: TStrings;
-  const AFile: string): Integer;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-{ A couple of useful Delphi Form functions }
-
-function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
-  var WasText: Boolean): Integer;
-var
-  Src, Dest: TStream;
-  origFormat: TStreamOriginalFormat;
-begin
-  Result := 0;
-  WasText := FALSE;
-  AStrings.Clear;
-  try
-    Src := TFileStream.Create(AFile, fmOpenRead or fmShareDenyWrite);
-    try
-      Dest := TMemoryStream.Create;
-      try
-        origFormat := sofUnknown;
-        ObjectResourceToText(Src, Dest, origFormat);
-        WasText := origFormat = sofText;
-        Dest.Seek(0, soFromBeginning);
-        AStrings.LoadFromStream(Dest);
-      finally
-        Dest.Free;
-      end;
-    finally
-      Src.Free;
-    end;
-  except
-    on E: EInOutError do Result := -E.ErrorCode;
-    else Result := -1;
-  end;
-end;
-
-function SaveStrings2DFMFile(AStrings: TStrings; const AFile: string): Integer;
-var
-  Src, Dest: TStream;
-begin
-  Result := 0;
-  try
-    Src := TMemoryStream.Create;
-    try
-      AStrings.SaveToStream(Src);
-      Src.Seek(0, soFromBeginning);
-      Dest := TFileStream.Create(AFile, fmCreate);
-      try
-        ObjectTextToResource(Src, Dest);
-      finally
-        Dest.Free;
-      end;
-    finally
-      Src.Free;
-    end;
-  except
-    on E: EInOutError do Result := -E.ErrorCode;
-    else Result := -1;
-  end;
-end;
-
-{ TSynDfmSyn }
-
-constructor TSynDfmSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  fDefaultFilter := SYNS_FilterDFM;
-  fRange := rsUnknown;
-end;
-
-procedure TSynDfmSyn.AltProc;
-begin
-  fTokenID := tkIdentifier;
-  repeat
-    Inc(Run);
-  until not IsIdentChar(fLine[Run]);
-end;
-
-procedure TSynDfmSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    Inc(Run);
-  until not CharInSet(fLine[Run], ['0'..'9']);
-end;
-
-procedure TSynDfmSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fRange := rsUnknown;
-  fTokenId := tkIdentifier;
-end;
-
-procedure TSynDfmSyn.BraceOpenProc;
-begin
-  fRange := rsComment;
-  CommentProc;
-end;
-
-procedure TSynDfmSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-  repeat
-    inc(Run);
-    if fLine[Run] = '}' then begin
-      Inc(Run);
-      fRange := rsUnknown;
-      break;
-    end;
-  until IsLineEnd(Run);
-end;
-
-procedure TSynDfmSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if (fLine[Run] = #10) then Inc(Run);
-end;
-
-procedure TSynDfmSyn.EndProc;
-begin
-  if CharInSet(fLine[Run + 1], ['n', 'N']) and
-     CharInSet(fLine[Run + 2], ['d', 'D']) and
-     not IsIdentChar(fLine[Run + 3])
-  then
-  begin
-    fTokenID := tkKey;
-    Inc(Run, 3);
-  end
-  else
-    AltProc;
-end;
-
-procedure TSynDfmSyn.IntegerProc;
-
-  function IsIntegerChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  fTokenID := tkNumber;
-  repeat
-    inc(Run);
-  until not IsIntegerChar;
-end;
-
-procedure TSynDfmSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynDfmSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynDfmSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'e', 'E':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  fTokenID := tkNumber;
-  repeat
-    Inc(Run);
-    if fLine[Run] = '.' then
-    begin
-      if fLine[Run + 1] <> '.' then Inc(Run);
-      break;
-    end;
-  until not IsNumberChar;
-end;
-
-procedure TSynDfmSyn.ObjectProc;
-begin
-  if CharInSet(fLine[Run + 1], ['b', 'B']) and
-     CharInSet(fLine[Run + 2], ['j', 'J']) and
-     CharInSet(fLine[Run + 3], ['e', 'E']) and
-     CharInSet(fLine[Run + 4], ['c', 'C']) and
-     CharInSet(fLine[Run + 5], ['t', 'T']) and
-     not IsIdentChar(fLine[Run + 6])
-  then
-  begin
-    fTokenID := tkKey;
-    Inc(Run, 6);
-  end
-  else
-    AltProc;
-end;
-
-procedure TSynDfmSyn.InheritedProc;
-begin
-  if CharInSet(fLine[Run + 1], ['n', 'N']) and
-     CharInSet(fLine[Run + 2], ['h', 'H']) and
-     CharInSet(fLine[Run + 3], ['e', 'E']) and
-     CharInSet(fLine[Run + 4], ['r', 'R']) and
-     CharInSet(fLine[Run + 5], ['i', 'I']) and
-     CharInSet(fLine[Run + 6], ['t', 'T']) and
-     CharInSet(fLine[Run + 7], ['e', 'E']) and
-     CharInSet(fLine[Run + 8], ['d', 'D']) and
-     not IsIdentChar(fLine[Run + 9])
-  then
-  begin
-    fTokenID := tkKey;
-    Inc(Run, 9);
-  end
-  else if CharInSet(fLine[Run + 1], ['n', 'N']) and
-          CharInSet(fLine[Run + 2], ['l', 'L']) and
-          CharInSet(fLine[Run + 3], ['i', 'I']) and
-          CharInSet(fLine[Run + 4], ['n', 'N']) and
-          CharInSet(fLine[Run + 5], ['e', 'E']) and
-          not IsIdentChar(fLine[Run + 6])
-  then
-  begin
-    fTokenID := tkKey;
-    Inc(Run, 6);
-  end
-  else
-    AltProc;
-end;
-
-procedure TSynDfmSyn.SpaceProc;
-begin
-  fTokenID := tkSpace;
-  repeat
-    Inc(Run);
-  until (fLine[Run] > #32) or IsLineEnd(Run);
-end;
-
-procedure TSynDfmSyn.StringProc;
-begin
-  fTokenID := tkString;
-  repeat
-    Inc(Run);
-    if fLine[Run] = '''' then begin
-      Inc(Run);
-      if fLine[Run] <> '''' then break
-    end;
-  until IsLineEnd(Run);
-end;
-
-procedure TSynDfmSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynDfmSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynDfmSyn.Next;
-begin
-  fTokenPos := Run;
-  if fRange = rsComment then
-  begin
-    if fLine[Run] = #0 then
-      NullProc
-    else
-      CommentProc;
-  end
-  else
-    case fLine[Run] of
-      '#': AsciiCharProc;
-      '}': BraceCloseProc;
-      '{': BraceOpenProc;
-      #13: CRProc;
-      'A'..'Z', 'a'..'z', '_':
-        if CharInSet(fLine[Run], ['e', 'E']) then
-          EndProc
-        else if CharInSet(fLine[Run], ['o', 'O']) then
-          ObjectProc
-        else if CharInSet(fLine[Run], ['i', 'I']) then
-          InheritedProc
-        else
-          AltProc;
-      '$': IntegerProc;
-      #10: LFProc;
-      #0: NullProc;
-      '0'..'9': NumberProc;
-      '(', ')', '/', '=', '<', '>', '.', ',', '[', ']': SymbolProc;
-      #1..#9, #11, #12, #14..#32: SpaceProc;
-      #39: StringProc;
-      else UnknownProc;
-    end;
-  inherited;
-end;
-
-function TSynDfmSyn.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 TSynDfmSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynDfmSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynDfmSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynDfmSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynDfmSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenID);
-end;
-
-procedure TSynDfmSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynDfmSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynDfmSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterDFM;
-end;
-
-class function TSynDfmSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangDfm;
-end;
-
-function TSynDfmSyn.GetSampleSource: string;
-begin
-  Result := '{ Delphi/C++ Builder Form Definitions }'#13#10 +
-            'object TestForm: TTestForm'#13#10 +
-            '  Left = 273'#13#10 +
-            '  Top = 103'#13#10 +
-            '  Caption = ''SynEdit sample source'''#13#10 +
-            'end';
-end; { GetSampleSource }
-
-class function TSynDfmSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangDfm;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynDfmSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterDfm.pas, released 2000-04-14.
+The Original Code is based on the dmDfmSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is David H. Muir.
+Unicode translation by Maël Hörz.
+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: SynHighlighterDfm.pas,v 1.16.2.7 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Delphi Form Source highlighter for SynEdit)
+@author(David Muir )
+@created(April 13, 2000)
+@lastmod(2000-06-23)
+The SynHighlighterDfm unit provides SynEdit with a Delphi Form Source (.dfm) highlighter.
+The highlighter formats form source code similar to when forms are viewed as text in the Delphi editor.
+}
+
+unit SynHighlighterDfm;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkString, tkSymbol, tkUnknown);
+
+  TRangeState = (rsANil, rsComment, rsUnknown);
+
+type
+  TSynDfmSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    procedure AltProc;
+    procedure AsciiCharProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CommentProc;
+    procedure CRProc;
+    procedure EndProc;
+    procedure IntegerProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure ObjectProc;
+    procedure InheritedProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure SymbolProc;
+    procedure UnknownProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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;
+  end;
+
+function LoadDFMFile2Strings(const AFile: UnicodeString; AStrings: TUnicodeStrings;
+  var WasText: Boolean): Integer; {$IFNDEF UNICODE} overload; {$ENDIF}
+{$IFNDEF UNICODE}
+function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
+  var WasText: Boolean): Integer; overload;
+{$ENDIF}
+function SaveStrings2DFMFile(AStrings: TUnicodeStrings;
+  const AFile: UnicodeString): Integer; {$IFNDEF UNICODE} overload; {$ENDIF}
+{$IFNDEF UNICODE}
+function SaveStrings2DFMFile(AStrings: TStrings;
+  const AFile: string): Integer; overload;
+{$ENDIF}
+
+implementation
+
+uses
+  SynEditStrConst;
+
+{ A couple of useful Delphi Form functions }
+
+function LoadDFMFile2Strings(const AFile: UnicodeString; AStrings: TUnicodeStrings;
+  var WasText: Boolean): Integer;
+var
+  Src, Dest: TStream;
+  origFormat: TStreamOriginalFormat;
+begin
+  Result := 0;
+  WasText := FALSE;
+  AStrings.Clear;
+  try
+    Src := TWideFileStream.Create(AFile, fmOpenRead or fmShareDenyWrite);
+    try
+      Dest := TMemoryStream.Create;
+      try
+        origFormat := sofUnknown;
+        ObjectResourceToText(Src, Dest, origFormat);
+        WasText := origFormat = sofText;
+        Dest.Seek(0, soFromBeginning);
+        AStrings.LoadFromStream(Dest);
+      finally
+        Dest.Free;
+      end;
+    finally
+      Src.Free;
+    end;
+  except
+    on E: EInOutError do Result := -E.ErrorCode;
+    else Result := -1;
+  end;
+end;
+
+{$IFNDEF UNICODE}
+function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
+  var WasText: Boolean): Integer;
+var
+  Src, Dest: TStream;
+{$IFDEF SYN_COMPILER_5_UP}
+  origFormat: TStreamOriginalFormat;
+{$ENDIF}
+begin
+  Result := 0;
+  WasText := FALSE;
+  AStrings.Clear;
+  try
+    Src := TFileStream.Create(AFile, fmOpenRead or fmShareDenyWrite);
+    try
+      Dest := TMemoryStream.Create;
+      try
+{$IFDEF SYN_COMPILER_5_UP}
+        origFormat := sofUnknown;
+        ObjectResourceToText(Src, Dest, origFormat);
+        WasText := origFormat = sofText;
+{$ELSE}
+        ObjectResourceToText(Src, Dest);
+{$ENDIF}
+        Dest.Seek(0, soFromBeginning);
+        AStrings.LoadFromStream(Dest);
+      finally
+        Dest.Free;
+      end;
+    finally
+      Src.Free;
+    end;
+  except
+    on E: EInOutError do Result := -E.ErrorCode;
+    else Result := -1;
+  end;
+end;
+{$ENDIF}
+
+function SaveStrings2DFMFile(AStrings: TUnicodeStrings; const AFile: UnicodeString): Integer;
+var
+  Src, Dest: TStream;
+{$IFNDEF UNICODE}
+  OldSaveUnicode: Boolean;
+{$ENDIF}
+begin
+  Result := 0;
+  try
+    Src := TMemoryStream.Create;
+    try
+{$IFNDEF UNICODE}
+      OldSaveUnicode := AStrings.SaveUnicode;
+      AStrings.SaveUnicode := False;
+{$ENDIF}
+      AStrings.SaveToStream(Src);
+{$IFNDEF UNICODE}
+      AStrings.SaveUnicode := OldSaveUnicode;
+{$ENDIF}
+      Src.Seek(0, soFromBeginning);
+      Dest := TWideFileStream.Create(AFile, fmCreate);
+      try
+        ObjectTextToResource(Src, Dest);
+      finally
+        Dest.Free;
+      end;
+    finally
+      Src.Free;
+    end;
+  except
+    on E: EInOutError do Result := -E.ErrorCode;
+    else Result := -1;
+  end;
+end;
+
+{$IFNDEF UNICODE}
+function SaveStrings2DFMFile(AStrings: TStrings; const AFile: string): Integer;
+var
+  Src, Dest: TStream;
+begin
+  Result := 0;
+  try
+    Src := TMemoryStream.Create;
+    try
+      AStrings.SaveToStream(Src);
+      Src.Seek(0, soFromBeginning);
+      Dest := TFileStream.Create(AFile, fmCreate);
+      try
+        ObjectTextToResource(Src, Dest);
+      finally
+        Dest.Free;
+      end;
+    finally
+      Src.Free;
+    end;
+  except
+    on E: EInOutError do Result := -E.ErrorCode;
+    else Result := -1;
+  end;
+end;
+{$ENDIF}
+
+{ TSynDfmSyn }
+
+constructor TSynDfmSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  FDefaultFilter := SYNS_FilterDFM;
+  FRange := rsUnknown;
+end;
+
+procedure TSynDfmSyn.AltProc;
+begin
+  FTokenID := tkIdentifier;
+  repeat
+    Inc(Run);
+  until not IsIdentChar(FLine[Run]);
+end;
+
+procedure TSynDfmSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    Inc(Run);
+  until not CharInSet(FLine[Run], ['0'..'9']);
+end;
+
+procedure TSynDfmSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FRange := rsUnknown;
+  FTokenID := tkIdentifier;
+end;
+
+procedure TSynDfmSyn.BraceOpenProc;
+begin
+  FRange := rsComment;
+  CommentProc;
+end;
+
+procedure TSynDfmSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  repeat
+    Inc(Run);
+    if FLine[Run] = '}' then begin
+      Inc(Run);
+      FRange := rsUnknown;
+      Break;
+    end;
+  until IsLineEnd(Run);
+end;
+
+procedure TSynDfmSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if (FLine[Run] = #10) then Inc(Run);
+end;
+
+procedure TSynDfmSyn.EndProc;
+begin
+  if CharInSet(FLine[Run + 1], ['n', 'N']) and
+     CharInSet(FLine[Run + 2], ['d', 'D']) and
+     not IsIdentChar(FLine[Run + 3])
+  then
+  begin
+    FTokenID := tkKey;
+    Inc(Run, 3);
+  end
+  else
+    AltProc;
+end;
+
+procedure TSynDfmSyn.IntegerProc;
+
+  function IsIntegerChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  FTokenID := tkNumber;
+  repeat
+    Inc(Run);
+  until not IsIntegerChar;
+end;
+
+procedure TSynDfmSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynDfmSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynDfmSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'e', 'E':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  FTokenID := tkNumber;
+  repeat
+    Inc(Run);
+    if FLine[Run] = '.' then
+    begin
+      if FLine[Run + 1] <> '.' then Inc(Run);
+      Break;
+    end;
+  until not IsNumberChar;
+end;
+
+procedure TSynDfmSyn.ObjectProc;
+begin
+  if CharInSet(FLine[Run + 1], ['b', 'B']) and
+     CharInSet(FLine[Run + 2], ['j', 'J']) and
+     CharInSet(FLine[Run + 3], ['e', 'E']) and
+     CharInSet(FLine[Run + 4], ['c', 'C']) and
+     CharInSet(FLine[Run + 5], ['t', 'T']) and
+     not IsIdentChar(FLine[Run + 6])
+  then
+  begin
+    FTokenID := tkKey;
+    Inc(Run, 6);
+  end
+  else
+    AltProc;
+end;
+
+procedure TSynDfmSyn.InheritedProc;
+begin
+  if CharInSet(FLine[Run + 1], ['n', 'N']) and
+     CharInSet(FLine[Run + 2], ['h', 'H']) and
+     CharInSet(FLine[Run + 3], ['e', 'E']) and
+     CharInSet(FLine[Run + 4], ['r', 'R']) and
+     CharInSet(FLine[Run + 5], ['i', 'I']) and
+     CharInSet(FLine[Run + 6], ['t', 'T']) and
+     CharInSet(FLine[Run + 7], ['e', 'E']) and
+     CharInSet(FLine[Run + 8], ['d', 'D']) and
+     not IsIdentChar(FLine[Run + 9])
+  then
+  begin
+    FTokenID := tkKey;
+    Inc(Run, 9);
+  end
+  else if CharInSet(FLine[Run + 1], ['n', 'N']) and
+          CharInSet(FLine[Run + 2], ['l', 'L']) and
+          CharInSet(FLine[Run + 3], ['i', 'I']) and
+          CharInSet(FLine[Run + 4], ['n', 'N']) and
+          CharInSet(FLine[Run + 5], ['e', 'E']) and
+          not IsIdentChar(FLine[Run + 6])
+  then
+  begin
+    FTokenID := tkKey;
+    Inc(Run, 6);
+  end
+  else
+    AltProc;
+end;
+
+procedure TSynDfmSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  repeat
+    Inc(Run);
+  until (FLine[Run] > #32) or IsLineEnd(Run);
+end;
+
+procedure TSynDfmSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    Inc(Run);
+    if FLine[Run] = '''' then
+    begin
+      Inc(Run);
+      if FLine[Run] <> '''' then
+        Break
+    end;
+  until IsLineEnd(Run);
+end;
+
+procedure TSynDfmSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynDfmSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynDfmSyn.Next;
+begin
+  FTokenPos := Run;
+  if FRange = rsComment then
+  begin
+    if FLine[Run] = #0 then
+      NullProc
+    else
+      CommentProc;
+  end
+  else
+    case FLine[Run] of
+      '#': AsciiCharProc;
+      '}': BraceCloseProc;
+      '{': BraceOpenProc;
+      #13: CRProc;
+      'A'..'Z', 'a'..'z', '_':
+        if CharInSet(FLine[Run], ['e', 'E']) then
+          EndProc
+        else if CharInSet(FLine[Run], ['o', 'O']) then
+          ObjectProc
+        else if CharInSet(FLine[Run], ['i', 'I']) then
+          InheritedProc
+        else
+          AltProc;
+      '$': IntegerProc;
+      #10: LFProc;
+      #0: NullProc;
+      '0'..'9': NumberProc;
+      '(', ')', '/', '=', '<', '>', '.', ',', '[', ']': SymbolProc;
+      #1..#9, #11, #12, #14..#32: SpaceProc;
+      #39: StringProc;
+      else UnknownProc;
+    end;
+  inherited;
+end;
+
+function TSynDfmSyn.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 TSynDfmSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynDfmSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynDfmSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynDfmSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynDfmSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynDfmSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynDfmSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynDfmSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterDFM;
+end;
+
+class function TSynDfmSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangDfm;
+end;
+
+function TSynDfmSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '{ Delphi/C++ Builder Form Definitions }'#13#10 +
+            'object TestForm: TTestForm'#13#10 +
+            '  Left = 273'#13#10 +
+            '  Top = 103'#13#10 +
+            '  Caption = ''SynEdit sample source'''#13#10 +
+            'end';
+end; { GetSampleSource }
+
+class function TSynDfmSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangDfm;
+end;
+
+{$IFNDEF SYN_CPPB_1}
+initialization
+  RegisterPlaceableHighlighter(TSynDfmSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterDml.pas b/Source/VCL/SynEdit/Source/SynHighlighterDml.pas
index 28e5c5c7..505ae200 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterDml.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterDml.pas
@@ -1,3437 +1,3440 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterDml.pas, released 2000-04-17.
-The Original Code is based on the mwDmlSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Peter Adam.
-Unicode translation by Maël Hörz.
-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: SynHighlighterDml.pas,v 1.11.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
-  - There are no metadata qualifiers.
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Dml highlighter for SynEdit)
-@author(Peter Adam)
-@created(1999)
-@lastmod(2000-06-23)
-The SynHighlighterDml unit provides SynEdit with a Dml highlighter.
-}
-
-unit SynHighlighterDml;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkBlock, tkComment, tkForm, tkFunction, tkIdentifier, tkKey,
-    tkNull, tkNumber, tkQualifier, tkSpace, tkSpecial, tkString, tkSymbol,
-    tkUnknown, tkVariable);
-
-  TRangeState = (rsANil, rsAdd, rsFind, rsUnKnown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynDmlSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fIdentFuncTable: array[0..2438] of TIdentFuncTableFunc;
-    FTokenID: TtkTokenKind;
-    fFormAttri: TSynHighlighterAttributes;
-    fBlockAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fQualiAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fFunctionAttri: TSynHighlighterAttributes;
-    fVariableAttri: TSynHighlighterAttributes;
-    fSpecialAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncAbs(Index: Integer): TtkTokenKind;
-    function FuncAbsolute_position(Index: Integer): TtkTokenKind;
-    function FuncAccount(Index: Integer): TtkTokenKind;
-    function FuncAcos(Index: Integer): TtkTokenKind;
-    function FuncActual_break(Index: Integer): TtkTokenKind;
-    function FuncAdd(Index: Integer): TtkTokenKind;
-    function FuncAdd_form(Index: Integer): TtkTokenKind;
-    function FuncAlternate_form(Index: Integer): TtkTokenKind;
-    function FuncAscii(Index: Integer): TtkTokenKind;
-    function FuncAsin(Index: Integer): TtkTokenKind;
-    function FuncAtan(Index: Integer): TtkTokenKind;
-    function FuncAtan2(Index: Integer): TtkTokenKind;
-    function FuncAttributes(Index: Integer): TtkTokenKind;
-    function FuncBack(Index: Integer): TtkTokenKind;
-    function FuncBase(Index: Integer): TtkTokenKind;
-    function FuncBatch(Index: Integer): TtkTokenKind;
-    function FuncBegin_block(Index: Integer): TtkTokenKind;
-    function FuncBegin_case(Index: Integer): TtkTokenKind;
-    function FuncBegin_disable_trigger(Index: Integer): TtkTokenKind;
-    function FuncBegin_row(Index: Integer): TtkTokenKind;
-    function FuncBegin_signal_to_status(Index: Integer): TtkTokenKind;
-    function FuncBell(Index: Integer): TtkTokenKind;
-    function FuncBinary_to_poly(Index: Integer): TtkTokenKind;
-    function FuncBottom_line(Index: Integer): TtkTokenKind;
-    function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncBreak0(Index: Integer): TtkTokenKind;
-    function FuncCall(Index: Integer): TtkTokenKind;
-    function FuncCase(Index: Integer): TtkTokenKind;
-    function FuncCeil(Index: Integer): TtkTokenKind;
-    function FuncCheck(Index: Integer): TtkTokenKind;
-    function FuncCheck_domain(Index: Integer): TtkTokenKind;
-    function FuncChr(Index: Integer): TtkTokenKind;
-    function FuncClear_buffer(Index: Integer): TtkTokenKind;
-    function FuncCli(Index: Integer): TtkTokenKind;
-    function FuncClose(Index: Integer): TtkTokenKind;
-    function FuncClose_text(Index: Integer): TtkTokenKind;
-    function FuncCol(Index: Integer): TtkTokenKind;
-    function FuncColumn_heading_row(Index: Integer): TtkTokenKind;
-    function FuncColumn_headings(Index: Integer): TtkTokenKind;
-    function FuncColumn_spacing(Index: Integer): TtkTokenKind;
-    function FuncCommit(Index: Integer): TtkTokenKind;
-    function FuncCommit_rate(Index: Integer): TtkTokenKind;
-    function FuncCompile(Index: Integer): TtkTokenKind;
-    function FuncCompress(Index: Integer): TtkTokenKind;
-    function FuncCompress_all(Index: Integer): TtkTokenKind;
-    function FuncConfirm(Index: Integer): TtkTokenKind;
-    function FuncConnect(Index: Integer): TtkTokenKind;
-    function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncCos(Index: Integer): TtkTokenKind;
-    function FuncCosh(Index: Integer): TtkTokenKind;
-    function FuncCross_reference(Index: Integer): TtkTokenKind;
-    function FuncDate(Index: Integer): TtkTokenKind;
-    function FuncDate_seconds(Index: Integer): TtkTokenKind;
-    function FuncDay_of_week(Index: Integer): TtkTokenKind;
-    function FuncDays(Index: Integer): TtkTokenKind;
-    function FuncDcl(Index: Integer): TtkTokenKind;
-    function FuncDefault_tag(Index: Integer): TtkTokenKind;
-    function FuncDelete(Index: Integer): TtkTokenKind;
-    function FuncDelete_form(Index: Integer): TtkTokenKind;
-    function FuncDescription(Index: Integer): TtkTokenKind;
-    function FuncDir(Index: Integer): TtkTokenKind;
-    function FuncDisconnect(Index: Integer): TtkTokenKind;
-    function FuncDisplay(Index: Integer): TtkTokenKind;
-    function FuncDisplay_length(Index: Integer): TtkTokenKind;
-    function FuncDocumentation(Index: Integer): TtkTokenKind;
-    function FuncDomain(Index: Integer): TtkTokenKind;
-    function FuncEdit(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncElse_if(Index: Integer): TtkTokenKind;
-    function FuncEnd_block(Index: Integer): TtkTokenKind;
-    function FuncEnd_case(Index: Integer): TtkTokenKind;
-    function FuncEnd_disable_trigger(Index: Integer): TtkTokenKind;
-    function FuncEnd_execute(Index: Integer): TtkTokenKind;
-    function FuncEnd_form(Index: Integer): TtkTokenKind;
-    function FuncEnd_if(Index: Integer): TtkTokenKind;
-    function FuncEnd_row(Index: Integer): TtkTokenKind;
-    function FuncEnd_signal_to_status(Index: Integer): TtkTokenKind;
-    function FuncEnd_while(Index: Integer): TtkTokenKind;
-    function FuncErase(Index: Integer): TtkTokenKind;
-    function FuncError(Index: Integer): TtkTokenKind;
-    function FuncExecute(Index: Integer): TtkTokenKind;
-    function FuncExit(Index: Integer): TtkTokenKind;
-    function FuncExit_forward(Index: Integer): TtkTokenKind;
-    function FuncExpand(Index: Integer): TtkTokenKind;
-    function FuncExternal(Index: Integer): TtkTokenKind;
-    function FuncFacility(Index: Integer): TtkTokenKind;
-    function FuncFailure(Index: Integer): TtkTokenKind;
-    function FuncFetch(Index: Integer): TtkTokenKind;
-    function FuncFiles(Index: Integer): TtkTokenKind;
-    function FuncFind(Index: Integer): TtkTokenKind;
-    function FuncFind_form(Index: Integer): TtkTokenKind;
-    function FuncFinish(Index: Integer): TtkTokenKind;
-    function FuncFirst(Index: Integer): TtkTokenKind;
-    function FuncFloor(Index: Integer): TtkTokenKind;
-    function FuncFooting(Index: Integer): TtkTokenKind;
-    function FuncFooting_form(Index: Integer): TtkTokenKind;
-    function FuncForm(Index: Integer): TtkTokenKind;
-    function FuncGenerate(Index: Integer): TtkTokenKind;
-    function FuncGoto(Index: Integer): TtkTokenKind;
-    function FuncGrouped_by(Index: Integer): TtkTokenKind;
-    function FuncHeading(Index: Integer): TtkTokenKind;
-    function FuncHeading_form(Index: Integer): TtkTokenKind;
-    function FuncHeight(Index: Integer): TtkTokenKind;
-    function FuncIdentifier(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncIn(Index: Integer): TtkTokenKind;
-    function FuncInput_block(Index: Integer): TtkTokenKind;
-    function FuncInput_mask(Index: Integer): TtkTokenKind;
-    function FuncInput_row_height(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
-    function FuncInvoke(Index: Integer): TtkTokenKind;
-    function FuncItem(Index: Integer): TtkTokenKind;
-    function FuncItem_block(Index: Integer): TtkTokenKind;
-    function FuncItem_if(Index: Integer): TtkTokenKind;
-    function FuncJoined_to(Index: Integer): TtkTokenKind;
-    function FuncLeft(Index: Integer): TtkTokenKind;
-    function FuncLen(Index: Integer): TtkTokenKind;
-    function FuncLfooting(Index: Integer): TtkTokenKind;
-    function FuncLheading(Index: Integer): TtkTokenKind;
-    function FuncLine(Index: Integer): TtkTokenKind;
-    function FuncLines_after(Index: Integer): TtkTokenKind;
-    function FuncLines_before(Index: Integer): TtkTokenKind;
-    function FuncList(Index: Integer): TtkTokenKind;
-    function FuncLoad(Index: Integer): TtkTokenKind;
-    function FuncLock(Index: Integer): TtkTokenKind;
-    function FuncLog(Index: Integer): TtkTokenKind;
-    function FuncLog10(Index: Integer): TtkTokenKind;
-    function FuncLov(Index: Integer): TtkTokenKind;
-    function FuncLov_auto_select(Index: Integer): TtkTokenKind;
-    function FuncLov_col(Index: Integer): TtkTokenKind;
-    function FuncLov_data(Index: Integer): TtkTokenKind;
-    function FuncLov_first(Index: Integer): TtkTokenKind;
-    function FuncLov_height(Index: Integer): TtkTokenKind;
-    function FuncLov_noheading(Index: Integer): TtkTokenKind;
-    function FuncLov_nosearch(Index: Integer): TtkTokenKind;
-    function FuncLov_reduced_to(Index: Integer): TtkTokenKind;
-    function FuncLov_row(Index: Integer): TtkTokenKind;
-    function FuncLov_secondary(Index: Integer): TtkTokenKind;
-    function FuncLov_selection(Index: Integer): TtkTokenKind;
-    function FuncLov_sorted_by(Index: Integer): TtkTokenKind;
-    function FuncLov_width(Index: Integer): TtkTokenKind;
-    function FuncLov_with(Index: Integer): TtkTokenKind;
-    function FuncLowercase(Index: Integer): TtkTokenKind;
-    function FuncLtrim(Index: Integer): TtkTokenKind;
-    function FuncMail(Index: Integer): TtkTokenKind;
-    function FuncMenu(Index: Integer): TtkTokenKind;
-    function FuncMenu_block(Index: Integer): TtkTokenKind;
-    function FuncMenu_form(Index: Integer): TtkTokenKind;
-    function FuncMessage(Index: Integer): TtkTokenKind;
-    function FuncMid(Index: Integer): TtkTokenKind;
-    function FuncMod(Index: Integer): TtkTokenKind;
-    function FuncModify_form(Index: Integer): TtkTokenKind;
-    function FuncNew(Index: Integer): TtkTokenKind;
-    function FuncNo_domain(Index: Integer): TtkTokenKind;
-    function FuncNobell(Index: Integer): TtkTokenKind;
-    function FuncNoclear_buffer(Index: Integer): TtkTokenKind;
-    function FuncNodeadlock_exit(Index: Integer): TtkTokenKind;
-    function FuncNoerase(Index: Integer): TtkTokenKind;
-    function FuncNoerror(Index: Integer): TtkTokenKind;
-    function FuncNoexit_forward(Index: Integer): TtkTokenKind;
-    function FuncNoheading(Index: Integer): TtkTokenKind;
-    function FuncNolov_data(Index: Integer): TtkTokenKind;
-    function FuncNorepeat(Index: Integer): TtkTokenKind;
-    function FuncNostatus(Index: Integer): TtkTokenKind;
-    function FuncNototals(Index: Integer): TtkTokenKind;
-    function FuncNounderlines(Index: Integer): TtkTokenKind;
-    function FuncNowait(Index: Integer): TtkTokenKind;
-    function FuncOpen(Index: Integer): TtkTokenKind;
-    function FuncOpen_text(Index: Integer): TtkTokenKind;
-    function FuncOpt(Index: Integer): TtkTokenKind;
-    function FuncOptions(Index: Integer): TtkTokenKind;
-    function FuncOutput(Index: Integer): TtkTokenKind;
-    function FuncOutput_block(Index: Integer): TtkTokenKind;
-    function FuncOutput_mask(Index: Integer): TtkTokenKind;
-    function FuncPause(Index: Integer): TtkTokenKind;
-    function FuncPause_block(Index: Integer): TtkTokenKind;
-    function FuncPerform(Index: Integer): TtkTokenKind;
-    function FuncPoly_to_binary(Index: Integer): TtkTokenKind;
-    function FuncPos(Index: Integer): TtkTokenKind;
-    function FuncPrint(Index: Integer): TtkTokenKind;
-    function FuncProcedure_form(Index: Integer): TtkTokenKind;
-    function FuncPrompt(Index: Integer): TtkTokenKind;
-    function FuncProtect(Index: Integer): TtkTokenKind;
-    function FuncQuery(Index: Integer): TtkTokenKind;
-    function FuncQuery_form(Index: Integer): TtkTokenKind;
-    function FuncRandom(Index: Integer): TtkTokenKind;
-    function FuncRead_line(Index: Integer): TtkTokenKind;
-    function FuncRead_only(Index: Integer): TtkTokenKind;
-    function FuncReceive(Index: Integer): TtkTokenKind;
-    function FuncReceive_arguments(Index: Integer): TtkTokenKind;
-    function FuncReceive_data(Index: Integer): TtkTokenKind;
-    function FuncReceive_table(Index: Integer): TtkTokenKind;
-    function FuncReduced_to(Index: Integer): TtkTokenKind;
-    function FuncRelease(Index: Integer): TtkTokenKind;
-    function FuncRemain(Index: Integer): TtkTokenKind;
-    function FuncRepeat(Index: Integer): TtkTokenKind;
-    function FuncReport(Index: Integer): TtkTokenKind;
-    function FuncReport_form(Index: Integer): TtkTokenKind;
-    function FuncReposition(Index: Integer): TtkTokenKind;
-    function FuncRewind_text(Index: Integer): TtkTokenKind;
-    function FuncRfooting(Index: Integer): TtkTokenKind;
-    function FuncRheading(Index: Integer): TtkTokenKind;
-    function FuncRight(Index: Integer): TtkTokenKind;
-    function FuncRollback(Index: Integer): TtkTokenKind;
-    function FuncRound(Index: Integer): TtkTokenKind;
-    function FuncRow(Index: Integer): TtkTokenKind;
-    function FuncRow_height(Index: Integer): TtkTokenKind;
-    function FuncSearch(Index: Integer): TtkTokenKind;
-    function FuncSecondary(Index: Integer): TtkTokenKind;
-    function FuncSeconds(Index: Integer): TtkTokenKind;
-    function FuncSelection(Index: Integer): TtkTokenKind;
-    function FuncSend(Index: Integer): TtkTokenKind;
-    function FuncSend_data(Index: Integer): TtkTokenKind;
-    function FuncSend_message(Index: Integer): TtkTokenKind;
-    function FuncSend_table(Index: Integer): TtkTokenKind;
-    function FuncSequence(Index: Integer): TtkTokenKind;
-    function FuncSeverity(Index: Integer): TtkTokenKind;
-    function FuncSin(Index: Integer): TtkTokenKind;
-    function FuncSinh(Index: Integer): TtkTokenKind;
-    function FuncSorted_by(Index: Integer): TtkTokenKind;
-    function FuncSource(Index: Integer): TtkTokenKind;
-    function FuncSource_if(Index: Integer): TtkTokenKind;
-    function FuncSqrt(Index: Integer): TtkTokenKind;
-    function FuncStart_stream(Index: Integer): TtkTokenKind;
-    function FuncStart_transaction(Index: Integer): TtkTokenKind;
-    function FuncStatistic(Index: Integer): TtkTokenKind;
-    function FuncStatus(Index: Integer): TtkTokenKind;
-    function FuncStream_name(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
-    function FuncSuccess(Index: Integer): TtkTokenKind;
-    function FuncSwitch(Index: Integer): TtkTokenKind;
-    function FuncSwitch_base(Index: Integer): TtkTokenKind;
-    function FuncSystem(Index: Integer): TtkTokenKind;
-    function FuncTable(Index: Integer): TtkTokenKind;
-    function FuncTable_form(Index: Integer): TtkTokenKind;
-    function FuncTable_search(Index: Integer): TtkTokenKind;
-    function FuncTag(Index: Integer): TtkTokenKind;
-    function FuncTag_length(Index: Integer): TtkTokenKind;
-    function FuncTan(Index: Integer): TtkTokenKind;
-    function FuncTanh(Index: Integer): TtkTokenKind;
-    function FuncTarget(Index: Integer): TtkTokenKind;
-    function FuncText(Index: Integer): TtkTokenKind;
-    function FuncText_only(Index: Integer): TtkTokenKind;
-    function FuncTitle(Index: Integer): TtkTokenKind;
-    function FuncTo(Index: Integer): TtkTokenKind;
-    function FuncTop_line(Index: Integer): TtkTokenKind;
-    function FuncTotal(Index: Integer): TtkTokenKind;
-    function FuncTransfer(Index: Integer): TtkTokenKind;
-    function FuncTrigger(Index: Integer): TtkTokenKind;
-    function FuncTrim(Index: Integer): TtkTokenKind;
-    function FuncTsuppress(Index: Integer): TtkTokenKind;
-    function FuncUnload(Index: Integer): TtkTokenKind;
-    function FuncUppercase(Index: Integer): TtkTokenKind;
-    function FuncUse_if(Index: Integer): TtkTokenKind;
-    function FuncUser_key(Index: Integer): TtkTokenKind;
-    function FuncUsing(Index: Integer): TtkTokenKind;
-    function FuncUtilities(Index: Integer): TtkTokenKind;
-    function FuncWait(Index: Integer): TtkTokenKind;
-    function FuncWhile(Index: Integer): TtkTokenKind;
-    function FuncWidth(Index: Integer): TtkTokenKind;
-    function FuncWith(Index: Integer): TtkTokenKind;
-    function FuncWrite(Index: Integer): TtkTokenKind;
-    function FuncWrite_line(Index: Integer): TtkTokenKind;
-    function FuncYesno_block(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure SymbolProc;
-    procedure AddressOpProc;
-    procedure AsciiCharProc;
-    procedure CRProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure PointProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure RemProc;
-    function IsQuali: Boolean;
-    function IsSpecial: Boolean;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property BlockAttri: TSynHighlighterAttributes read fBlockAttri
-      write fBlockAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property FormAttri: TSynHighlighterAttributes read fFormAttri
-      write fFormAttri;
-    property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri
-      write fFunctionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property QualiAttri: TSynHighlighterAttributes read fQualiAttri
-      write fQualiAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property SpecialAttri: TSynHighlighterAttributes read fSpecialAttri
-      write fSpecialAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property VariableAttri: TSynHighlighterAttributes read fVariableAttri
-      write fVariableAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..263] of string = (
-    'abs', 'absolute_position', 'account', 'acos', 'actual_break', 'add', 
-    'add_form', 'alternate_form', 'ascii', 'asin', 'atan', 'atan2', 
-    'attributes', 'back', 'base', 'batch', 'begin_block', 'begin_case', 
-    'begin_disable_trigger', 'begin_row', 'begin_signal_to_status', 'bell', 
-    'binary_to_poly', 'bottom_line', 'break', 'break0', 'call', 'case', 'ceil', 
-    'check', 'check_domain', 'chr', 'clear_buffer', 'cli', 'close', 
-    'close_text', 'col', 'column_heading_row', 'column_headings', 
-    'column_spacing', 'commit', 'commit_rate', 'compile', 'compress', 
-    'compress_all', 'confirm', 'connect', 'continue', 'cos', 'cosh', 
-    'cross_reference', 'date', 'date_seconds', 'day_of_week', 'days', 'dcl', 
-    'default_tag', 'delete', 'delete_form', 'description', 'dir', 'disconnect', 
-    'display', 'display_length', 'documentation', 'domain', 'edit', 'else', 
-    'else_if', 'end_block', 'end_case', 'end_disable_trigger', 'end_execute', 
-    'end_form', 'end_if', 'end_row', 'end_signal_to_status', 'end_while', 
-    'erase', 'error', 'execute', 'exit', 'exit_forward', 'expand', 'external', 
-    'facility', 'failure', 'fetch', 'files', 'find', 'find_form', 'finish', 
-    'first', 'floor', 'footing', 'footing_form', 'form', 'generate', 'goto', 
-    'grouped_by', 'heading', 'heading_form', 'height', 'identifier', 'if', 'in', 
-    'input_block', 'input_mask', 'input_row_height', 'int', 'invoke', 'item', 
-    'item_block', 'item_if', 'joined_to', 'left', 'len', 'lfooting', 'lheading', 
-    'line', 'lines_after', 'lines_before', 'list', 'load', 'lock', 'log', 
-    'log10', 'lov', 'lov_auto_select', 'lov_col', 'lov_data', 'lov_first', 
-    'lov_height', 'lov_noheading', 'lov_nosearch', 'lov_reduced_to', 'lov_row', 
-    'lov_secondary', 'lov_selection', 'lov_sorted_by', 'lov_width', 'lov_with', 
-    'lowercase', 'ltrim', 'mail', 'menu', 'menu_block', 'menu_form', 'message', 
-    'mid', 'mod', 'modify_form', 'new', 'no_domain', 'nobell', 'noclear_buffer', 
-    'nodeadlock_exit', 'noerase', 'noerror', 'noexit_forward', 'noheading', 
-    'nolov_data', 'norepeat', 'nostatus', 'nototals', 'nounderlines', 'nowait', 
-    'open', 'open_text', 'opt', 'options', 'output', 'output_block', 
-    'output_mask', 'pause', 'pause_block', 'perform', 'poly_to_binary', 'pos', 
-    'print', 'procedure_form', 'prompt', 'protect', 'query', 'query_form', 
-    'random', 'read_line', 'read_only', 'receive', 'receive_arguments', 
-    'receive_data', 'receive_table', 'reduced_to', 'release', 'remain', 
-    'repeat', 'report', 'report_form', 'reposition', 'rewind_text', 'rfooting', 
-    'rheading', 'right', 'rollback', 'round', 'row', 'row_height', 'search', 
-    'secondary', 'seconds', 'selection', 'send', 'send_data', 'send_message', 
-    'send_table', 'sequence', 'severity', 'sin', 'sinh', 'sorted_by', 'source', 
-    'source_if', 'sqrt', 'start_stream', 'start_transaction', 'statistic', 
-    'status', 'stream_name', 'string', 'success', 'switch', 'switch_base', 
-    'system', 'table', 'table_form', 'table_search', 'tag', 'tag_length', 'tan', 
-    'tanh', 'target', 'text', 'text_only', 'title', 'to', 'top_line', 'total', 
-    'transfer', 'trigger', 'trim', 'tsuppress', 'unload', 'uppercase', 'use_if', 
-    'user_key', 'using', 'utilities', 'wait', 'while', 'width', 'with', 'write', 
-    'write_line', 'yesno_block' 
-  );
-
-  KeyIndices: array[0..2438] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 230, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 217, -1, -1, -1, -1, -1, 183, -1, 246, -1, 134, -1, -1, -1, -1, 
-    -1, 65, -1, -1, 223, -1, -1, -1, -1, -1, 213, -1, -1, -1, 46, -1, -1, 262, 
-    -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, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 111, 157, -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 123, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 84, -1, 154, -1, 96, -1, -1, -1, 176, -1, -1, -1, 120, 178, -1, -1, -1, 
-    -1, 74, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, 147, -1, -1, -1, 122, 
-    -1, 58, -1, 87, 191, -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, 170, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 5, -1, -1, 194, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, 
-    -1, 28, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, 20, -1, -1, -1, -1, 79, 
-    116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 0, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 196, -1, -1, 85, -1, -1, -1, 104, -1, 103, -1, -1, 14, -1, -1, 
-    131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, 
-    -1, 6, -1, 182, -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, 41, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, -1, -1, 
-    -1, -1, -1, 115, -1, -1, 108, -1, 150, -1, -1, 42, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 143, 166, -1, -1, 
-    -1, -1, -1, -1, 225, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, 92, -1, -1, 
-    226, -1, 161, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, 
-    -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 151, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 146, 210, -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, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 245, -1, -1, -1, -1, -1, 68, -1, 
-    231, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, 
-    -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 
-    -1, -1, 75, -1, 252, 212, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    149, -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, 187, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 
-    -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, 164, 35, -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, 
-    234, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, 
-    -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 240, -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, -1, -1, -1, 39, -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, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, 229, 11, 
-    -1, -1, 43, -1, -1, -1, -1, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 159, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 181, -1, 139, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, 15, -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, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 
-    258, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, 153, 
-    -1, -1, 36, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 48, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, -1, -1, 9, -1, -1, 140, 193, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, -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, -1, -1, -1, -1, -1, 188, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 228, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    19, -1, 66, -1, -1, -1, 24, -1, -1, -1, -1, 186, -1, -1, -1, -1, 99, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, 259, -1, 32, -1, -1, -1, -1, -1, 
-    121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, 209, 260, -1, 
-    -1, -1, -1, -1, -1, -1, 76, 257, -1, -1, -1, -1, 211, -1, 90, -1, -1, -1, 
-    -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, 70, 
-    -1, -1, -1, -1, -1, 63, -1, -1, -1, 25, 207, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, 
-    189, -1, -1, -1, 113, -1, -1, -1, 110, -1, 205, -1, 56, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, 45, -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, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, 254, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, 
-    235, -1, 34, -1, 218, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, 220, -1, 
-    -1, -1, 141, -1, -1, -1, -1, 195, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, 160, -1, 
-    -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 203, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 219, -1, -1, -1, -1, -1, 61, -1, -1, 30, -1, -1, 130, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 12, -1, 202, -1, -1, -1, -1, -1, 200, -1, -1, 169, -1, 
-    -1, -1, -1, -1, -1, 16, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, 162, -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, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 247, -1, -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, 251, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 216, -1, -1, -1, -1, 128, 27, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, 
-    -1, 158, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, 173, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 17, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 135, -1, -1, 190, -1, -1, -1, 222, 60, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 106, -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, -1, -1, -1, 38, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, 144, -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, -1, -1, -1, -1, -1, 94, -1, 95, -1, -1, -1, -1, -1, 215, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, 
-    -1, -1, 10, 250, -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 201, -1, -1, -1, 
-    233, -1, -1, -1, -1, -1, 249, -1, -1, 184, -1, -1, -1, -1, -1, 263, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 26, 138, -1, -1, -1, -1, -1, -1, -1, -1, 64, 
-    -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 127, 206, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, 
-    -1, 244, -1, -1, -1, -1, -1, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynDmlSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 798 + Ord(Str^) * 3;
-    inc(Str);
-  end;
-  Result := Result mod 2439;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynDmlSyn.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 TSynDmlSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[435] := FuncAbs;
-  fIdentFuncTable[41] := FuncAbsolute_position;
-  fIdentFuncTable[13] := FuncAccount;
-  fIdentFuncTable[2405] := FuncAcos;
-  fIdentFuncTable[1707] := FuncActual_break;
-  fIdentFuncTable[300] := FuncAdd;
-  fIdentFuncTable[486] := FuncAdd_form;
-  fIdentFuncTable[839] := FuncAlternate_form;
-  fIdentFuncTable[735] := FuncAscii;
-  fIdentFuncTable[1265] := FuncAsin;
-  fIdentFuncTable[2300] := FuncAtan;
-  fIdentFuncTable[1065] := FuncAtan2;
-  fIdentFuncTable[1930] := FuncAttributes;
-  fIdentFuncTable[1202] := FuncBack;
-  fIdentFuncTable[464] := FuncBase;
-  fIdentFuncTable[1118] := FuncBatch;
-  fIdentFuncTable[1948] := FuncBegin_block;
-  fIdentFuncTable[2124] := FuncBegin_case;
-  fIdentFuncTable[2068] := FuncBegin_disable_trigger;
-  fIdentFuncTable[1385] := FuncBegin_row;
-  fIdentFuncTable[387] := FuncBegin_signal_to_status;
-  fIdentFuncTable[1061] := FuncBell;
-  fIdentFuncTable[166] := FuncBinary_to_poly;
-  fIdentFuncTable[776] := FuncBottom_line;
-  fIdentFuncTable[1391] := FuncBreak;
-  fIdentFuncTable[1524] := FuncBreak0;
-  fIdentFuncTable[2380] := FuncCall;
-  fIdentFuncTable[2044] := FuncCase;
-  fIdentFuncTable[337] := FuncCeil;
-  fIdentFuncTable[644] := FuncCheck;
-  fIdentFuncTable[1918] := FuncCheck_domain;
-  fIdentFuncTable[1512] := FuncChr;
-  fIdentFuncTable[1454] := FuncClear_buffer;
-  fIdentFuncTable[1305] := FuncCli;
-  fIdentFuncTable[1761] := FuncClose;
-  fIdentFuncTable[908] := FuncClose_text;
-  fIdentFuncTable[1179] := FuncCol;
-  fIdentFuncTable[1114] := FuncColumn_heading_row;
-  fIdentFuncTable[2183] := FuncColumn_headings;
-  fIdentFuncTable[1007] := FuncColumn_spacing;
-  fIdentFuncTable[697] := FuncCommit;
-  fIdentFuncTable[521] := FuncCommit_rate;
-  fIdentFuncTable[591] := FuncCompile;
-  fIdentFuncTable[1068] := FuncCompress;
-  fIdentFuncTable[1359] := FuncCompress_all;
-  fIdentFuncTable[1637] := FuncConfirm;
-  fIdentFuncTable[89] := FuncConnect;
-  fIdentFuncTable[898] := FuncContinue;
-  fIdentFuncTable[1200] := FuncCos;
-  fIdentFuncTable[1747] := FuncCosh;
-  fIdentFuncTable[954] := FuncCross_reference;
-  fIdentFuncTable[1630] := FuncDate;
-  fIdentFuncTable[320] := FuncDate_seconds;
-  fIdentFuncTable[368] := FuncDay_of_week;
-  fIdentFuncTable[1447] := FuncDays;
-  fIdentFuncTable[2394] := FuncDcl;
-  fIdentFuncTable[1583] := FuncDefault_tag;
-  fIdentFuncTable[820] := FuncDelete;
-  fIdentFuncTable[261] := FuncDelete_form;
-  fIdentFuncTable[608] := FuncDescription;
-  fIdentFuncTable[2142] := FuncDir;
-  fIdentFuncTable[1915] := FuncDisconnect;
-  fIdentFuncTable[1889] := FuncDisplay;
-  fIdentFuncTable[1520] := FuncDisplay_length;
-  fIdentFuncTable[2390] := FuncDocumentation;
-  fIdentFuncTable[76] := FuncDomain;
-  fIdentFuncTable[1387] := FuncEdit;
-  fIdentFuncTable[1414] := FuncElse;
-  fIdentFuncTable[801] := FuncElse_if;
-  fIdentFuncTable[1158] := FuncEnd_block;
-  fIdentFuncTable[1514] := FuncEnd_case;
-  fIdentFuncTable[1734] := FuncEnd_disable_trigger;
-  fIdentFuncTable[1043] := FuncEnd_execute;
-  fIdentFuncTable[2119] := FuncEnd_form;
-  fIdentFuncTable[224] := FuncEnd_if;
-  fIdentFuncTable[842] := FuncEnd_row;
-  fIdentFuncTable[1484] := FuncEnd_signal_to_status;
-  fIdentFuncTable[338] := FuncEnd_while;
-  fIdentFuncTable[893] := FuncErase;
-  fIdentFuncTable[392] := FuncError;
-  fIdentFuncTable[503] := FuncExecute;
-  fIdentFuncTable[253] := FuncExit;
-  fIdentFuncTable[1280] := FuncExit_forward;
-  fIdentFuncTable[1146] := FuncExpand;
-  fIdentFuncTable[206] := FuncExternal;
-  fIdentFuncTable[455] := FuncFacility;
-  fIdentFuncTable[176] := FuncFailure;
-  fIdentFuncTable[263] := FuncFetch;
-  fIdentFuncTable[2106] := FuncFiles;
-  fIdentFuncTable[1191] := FuncFind;
-  fIdentFuncTable[1492] := FuncFind_form;
-  fIdentFuncTable[1868] := FuncFinish;
-  fIdentFuncTable[651] := FuncFirst;
-  fIdentFuncTable[2081] := FuncFloor;
-  fIdentFuncTable[2267] := FuncFooting;
-  fIdentFuncTable[2269] := FuncFooting_form;
-  fIdentFuncTable[210] := FuncForm;
-  fIdentFuncTable[516] := FuncGenerate;
-  fIdentFuncTable[2196] := FuncGoto;
-  fIdentFuncTable[1401] := FuncGrouped_by;
-  fIdentFuncTable[711] := FuncHeading;
-  fIdentFuncTable[1173] := FuncHeading_form;
-  fIdentFuncTable[194] := FuncHeight;
-  fIdentFuncTable[461] := FuncIdentifier;
-  fIdentFuncTable[459] := FuncIf;
-  fIdentFuncTable[483] := FuncIn;
-  fIdentFuncTable[2151] := FuncInput_block;
-  fIdentFuncTable[947] := FuncInput_mask;
-  fIdentFuncTable[586] := FuncInput_row_height;
-  fIdentFuncTable[420] := FuncInt;
-  fIdentFuncTable[1579] := FuncInvoke;
-  fIdentFuncTable[134] := FuncItem;
-  fIdentFuncTable[824] := FuncItem_block;
-  fIdentFuncTable[1575] := FuncItem_if;
-  fIdentFuncTable[1988] := FuncJoined_to;
-  fIdentFuncTable[583] := FuncLeft;
-  fIdentFuncTable[393] := FuncLen;
-  fIdentFuncTable[1698] := FuncLfooting;
-  fIdentFuncTable[142] := FuncLheading;
-  fIdentFuncTable[439] := FuncLine;
-  fIdentFuncTable[218] := FuncLines_after;
-  fIdentFuncTable[1460] := FuncLines_before;
-  fIdentFuncTable[259] := FuncList;
-  fIdentFuncTable[193] := FuncLoad;
-  fIdentFuncTable[124] := FuncLock;
-  fIdentFuncTable[2361] := FuncLog;
-  fIdentFuncTable[807] := FuncLog10;
-  fIdentFuncTable[2406] := FuncLov;
-  fIdentFuncTable[2043] := FuncLov_auto_select;
-  fIdentFuncTable[1806] := FuncLov_col;
-  fIdentFuncTable[1921] := FuncLov_data;
-  fIdentFuncTable[467] := FuncLov_first;
-  fIdentFuncTable[1673] := FuncLov_height;
-  fIdentFuncTable[1499] := FuncLov_noheading;
-  fIdentFuncTable[70] := FuncLov_nosearch;
-  fIdentFuncTable[2134] := FuncLov_reduced_to;
-  fIdentFuncTable[2208] := FuncLov_row;
-  fIdentFuncTable[1788] := FuncLov_secondary;
-  fIdentFuncTable[2381] := FuncLov_selection;
-  fIdentFuncTable[1107] := FuncLov_sorted_by;
-  fIdentFuncTable[1268] := FuncLov_width;
-  fIdentFuncTable[1779] := FuncLov_with;
-  fIdentFuncTable[538] := FuncLowercase;
-  fIdentFuncTable[631] := FuncLtrim;
-  fIdentFuncTable[2233] := FuncMail;
-  fIdentFuncTable[2296] := FuncMenu;
-  fIdentFuncTable[743] := FuncMenu_block;
-  fIdentFuncTable[255] := FuncMenu_form;
-  fIdentFuncTable[1824] := FuncMessage;
-  fIdentFuncTable[858] := FuncMid;
-  fIdentFuncTable[588] := FuncMod;
-  fIdentFuncTable[729] := FuncModify_form;
-  fIdentFuncTable[1770] := FuncNew;
-  fIdentFuncTable[1176] := FuncNo_domain;
-  fIdentFuncTable[208] := FuncNobell;
-  fIdentFuncTable[1756] := FuncNoclear_buffer;
-  fIdentFuncTable[1858] := FuncNodeadlock_exit;
-  fIdentFuncTable[135] := FuncNoerase;
-  fIdentFuncTable[2073] := FuncNoerror;
-  fIdentFuncTable[1092] := FuncNoexit_forward;
-  fIdentFuncTable[1811] := FuncNoheading;
-  fIdentFuncTable[656] := FuncNolov_data;
-  fIdentFuncTable[1959] := FuncNorepeat;
-  fIdentFuncTable[1319] := FuncNostatus;
-  fIdentFuncTable[907] := FuncNototals;
-  fIdentFuncTable[2427] := FuncNounderlines;
-  fIdentFuncTable[632] := FuncNowait;
-  fIdentFuncTable[1560] := FuncOpen;
-  fIdentFuncTable[2226] := FuncOpen_text;
-  fIdentFuncTable[1941] := FuncOpt;
-  fIdentFuncTable[290] := FuncOptions;
-  fIdentFuncTable[491] := FuncOutput;
-  fIdentFuncTable[1952] := FuncOutput_block;
-  fIdentFuncTable[2108] := FuncOutput_mask;
-  fIdentFuncTable[1539] := FuncPause;
-  fIdentFuncTable[1182] := FuncPause_block;
-  fIdentFuncTable[214] := FuncPerform;
-  fIdentFuncTable[1294] := FuncPoly_to_binary;
-  fIdentFuncTable[219] := FuncPos;
-  fIdentFuncTable[1569] := FuncPrint;
-  fIdentFuncTable[1719] := FuncProcedure_form;
-  fIdentFuncTable[1105] := FuncPrompt;
-  fIdentFuncTable[488] := FuncProtect;
-  fIdentFuncTable[66] := FuncQuery;
-  fIdentFuncTable[2344] := FuncQuery_form;
-  fIdentFuncTable[575] := FuncRandom;
-  fIdentFuncTable[1396] := FuncRead_line;
-  fIdentFuncTable[885] := FuncRead_only;
-  fIdentFuncTable[1353] := FuncReceive;
-  fIdentFuncTable[1571] := FuncReceive_arguments;
-  fIdentFuncTable[2137] := FuncReceive_data;
-  fIdentFuncTable[264] := FuncReceive_table;
-  fIdentFuncTable[410] := FuncReduced_to;
-  fIdentFuncTable[1269] := FuncRelease;
-  fIdentFuncTable[303] := FuncRemain;
-  fIdentFuncTable[1784] := FuncRepeat;
-  fIdentFuncTable[452] := FuncReport;
-  fIdentFuncTable[2315] := FuncReport_form;
-  fIdentFuncTable[2025] := FuncReposition;
-  fIdentFuncTable[1259] := FuncRewind_text;
-  fIdentFuncTable[1938] := FuncRfooting;
-  fIdentFuncTable[2331] := FuncRheading;
-  fIdentFuncTable[1932] := FuncRight;
-  fIdentFuncTable[1849] := FuncRollback;
-  fIdentFuncTable[553] := FuncRound;
-  fIdentFuncTable[1581] := FuncRow;
-  fIdentFuncTable[2407] := FuncRow_height;
-  fIdentFuncTable[1525] := FuncSearch;
-  fIdentFuncTable[151] := FuncSecondary;
-  fIdentFuncTable[1475] := FuncSeconds;
-  fIdentFuncTable[744] := FuncSelection;
-  fIdentFuncTable[1490] := FuncSend;
-  fIdentFuncTable[845] := FuncSend_data;
-  fIdentFuncTable[85] := FuncSend_message;
-  fIdentFuncTable[720] := FuncSend_table;
-  fIdentFuncTable[2275] := FuncSequence;
-  fIdentFuncTable[2038] := FuncSeverity;
-  fIdentFuncTable[60] := FuncSin;
-  fIdentFuncTable[1763] := FuncSinh;
-  fIdentFuncTable[1909] := FuncSorted_by;
-  fIdentFuncTable[1775] := FuncSource;
-  fIdentFuncTable[1474] := FuncSource_if;
-  fIdentFuncTable[2141] := FuncSqrt;
-  fIdentFuncTable[79] := FuncStart_stream;
-  fIdentFuncTable[604] := FuncStart_transaction;
-  fIdentFuncTable[639] := FuncStatistic;
-  fIdentFuncTable[654] := FuncStatus;
-  fIdentFuncTable[1816] := FuncStream_name;
-  fIdentFuncTable[1368] := FuncString;
-  fIdentFuncTable[1064] := FuncSuccess;
-  fIdentFuncTable[39] := FuncSwitch;
-  fIdentFuncTable[803] := FuncSwitch_base;
-  fIdentFuncTable[1212] := FuncSystem;
-  fIdentFuncTable[2335] := FuncTable;
-  fIdentFuncTable[934] := FuncTable_form;
-  fIdentFuncTable[1759] := FuncTable_search;
-  fIdentFuncTable[1074] := FuncTag;
-  fIdentFuncTable[705] := FuncTag_length;
-  fIdentFuncTable[1095] := FuncTan;
-  fIdentFuncTable[382] := FuncTanh;
-  fIdentFuncTable[975] := FuncTarget;
-  fIdentFuncTable[229] := FuncText;
-  fIdentFuncTable[2007] := FuncText_only;
-  fIdentFuncTable[307] := FuncTitle;
-  fIdentFuncTable[2430] := FuncTo;
-  fIdentFuncTable[795] := FuncTop_line;
-  fIdentFuncTable[68] := FuncTotal;
-  fIdentFuncTable[2000] := FuncTransfer;
-  fIdentFuncTable[333] := FuncTrigger;
-  fIdentFuncTable[2341] := FuncTrim;
-  fIdentFuncTable[2301] := FuncTsuppress;
-  fIdentFuncTable[2029] := FuncUnload;
-  fIdentFuncTable[844] := FuncUppercase;
-  fIdentFuncTable[1437] := FuncUse_if;
-  fIdentFuncTable[1736] := FuncUser_key;
-  fIdentFuncTable[353] := FuncUsing;
-  fIdentFuncTable[2305] := FuncUtilities;
-  fIdentFuncTable[1485] := FuncWait;
-  fIdentFuncTable[1159] := FuncWhile;
-  fIdentFuncTable[1452] := FuncWidth;
-  fIdentFuncTable[1476] := FuncWith;
-  fIdentFuncTable[27] := FuncWrite;
-  fIdentFuncTable[92] := FuncWrite_line;
-  fIdentFuncTable[2350] := FuncYesno_block;
-end;
-
-function TSynDmlSyn.IsQuali: boolean;
-begin
-  Result:= False;
-  if Run > 0 then
-    if fLine[Run - 1] = '/' then Result:= True;
-end;
-
-function TSynDmlSyn.IsSpecial: Boolean;
-begin
-  Result:= False;
-  if Run > 0 then
-    if fLine[Run - 1] = '%' then Result:= True;
-end;
-
-function TSynDmlSyn.FuncAbs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAbsolute_position(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAccount(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAcos(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncActual_break(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAdd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsSpecial then
-      Result := tkSpecial
-    else
-    begin
-      Result := tkKey;
-      fRange := rsAdd;
-    end;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAdd_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAlternate_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAscii(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAsin(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAtan(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAtan2(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncAttributes(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBack(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBatch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBegin_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBegin_case(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBegin_disable_trigger(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBegin_row(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBegin_signal_to_status(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBell(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBinary_to_poly(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBottom_line(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBreak(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncBreak0(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCall(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCeil(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCheck(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCheck_domain(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncChr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncClear_buffer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCli(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncClose(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncClose_text(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCol(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkIdentifier;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncColumn_heading_row(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncColumn_headings(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncColumn_spacing(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCommit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCommit_rate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCompile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCompress(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCompress_all(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncConfirm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncConnect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncContinue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCos(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCosh(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncCross_reference(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDate_seconds(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDay_of_week(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDays(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDcl(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDefault_tag(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDelete(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDelete_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDescription(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDir(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDisconnect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDisplay(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDisplay_length(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDocumentation(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncDomain(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEdit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncElse_if(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_case(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_disable_trigger(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_execute(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_if(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_row(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_signal_to_status(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncEnd_while(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncErase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncError(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else
-      Result := tkKey;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncExecute(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncExit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncExit_forward(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncExpand(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncExternal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFacility(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFailure(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkIdentifier;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFetch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFiles(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFind(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    Result := tkKey;
-    fRange := rsFind;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFind_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFinish(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFirst(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFloor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFooting(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncFooting_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncForm(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkForm;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncGenerate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncGoto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncGrouped_by(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncHeading(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncHeading_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncHeight(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncIdentifier(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncIn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and (fRange = rsFind) then
-  begin
-    Result := tkKey;
-    fRange := rsUnKnown;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncInput_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncInput_mask(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncInput_row_height(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncInt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncInvoke(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncItem(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncItem_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncItem_if(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncJoined_to(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLeft(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else
-      Result := tkFunction;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLfooting(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLheading(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLine(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLines_after(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLines_before(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncList(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLoad(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLock(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLog(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else
-      Result := tkFunction;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLog10(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_auto_select(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_col(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_data(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_first(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_height(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_noheading(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_nosearch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_reduced_to(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_row(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_secondary(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_selection(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_sorted_by(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_width(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLov_with(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLowercase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncLtrim(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMail(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMenu(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMenu_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMenu_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMessage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMid(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncMod(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncModify_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNew(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNo_domain(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNobell(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNoclear_buffer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNodeadlock_exit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNoerase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNoerror(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNoexit_forward(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNoheading(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNolov_data(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNorepeat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNostatus(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNototals(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNounderlines(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkIdentifier;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncNowait(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOpen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOpen_text(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOpt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOptions(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOutput(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOutput_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncOutput_mask(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPause(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPause_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPerform(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPoly_to_binary(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPos(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPrint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncProcedure_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncPrompt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncProtect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncQuery(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncQuery_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRandom(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRead_line(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRead_only(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReceive(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReceive_arguments(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReceive_data(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReceive_table(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReduced_to(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRelease(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRemain(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRepeat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else
-      Result := tkKey;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReport(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReport_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncReposition(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRewind_text(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRfooting(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRheading(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRight(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRollback(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRound(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRow(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncRow_height(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSearch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSecondary(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSeconds(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSelection(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSend(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSend_data(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSend_message(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSend_table(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSequence(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSeverity(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSin(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSinh(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSorted_by(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSource(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSource_if(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSqrt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncStart_stream(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncStart_transaction(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncStatistic(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncStatus(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkIdentifier;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncStream_name(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSuccess(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkIdentifier;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSwitch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSwitch_base(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncSystem(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTable(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTable_form(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkForm
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTable_search(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTag(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTag_length(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTan(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTanh(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTarget(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncText(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsSpecial then
-      Result := tkSpecial
-    else
-      Result := tkKey;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncText_only(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTitle(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-  begin
-    if IsQuali then
-      Result := tkQualifier
-    else
-      Result := tkKey;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and (fRange = rsAdd) then
-  begin
-    Result := tkKey;
-    fRange := rsUnKnown;
-  end
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTop_line(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTotal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTransfer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTrigger(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTrim(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncTsuppress(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
-    Result := tkSpecial
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUnload(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUppercase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkFunction
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUse_if(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUser_key(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUsing(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncUtilities(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWait(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWhile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWidth(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWith(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) and IsQuali then
-    Result := tkQualifier
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWrite(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncWrite_line(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.FuncYesno_block(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBlock
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynDmlSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-constructor TSynDmlSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fFormAttri:= TSynHighlighterAttributes.Create(SYNS_AttrForm, SYNS_FriendlyAttrForm);
-  fFormAttri.Style:= [fsBold];
-  fFormAttri.Foreground:= clBlue;
-  AddAttribute(fFormAttri);
-  fBlockAttri:= TSynHighlighterAttributes.Create(SYNS_AttrBlock, SYNS_FriendlyAttrBlock);
-  fBlockAttri.Style:= [fsBold];
-  fBlockAttri.Foreground:= clGreen;
-  AddAttribute(fBlockAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style:= [fsBold];
-  fCommentAttri.Foreground:= clRed;
-  AddAttribute(fCommentAttri);
-  fQualiAttri:= TSynHighlighterAttributes.Create(SYNS_AttrQualifier, SYNS_FriendlyAttrQualifier);
-  fQualiAttri.Style:= [fsItalic];
-  fQualiAttri.Foreground:= clGreen;
-  AddAttribute(fQualiAttri);
-  fFunctionAttri:= TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
-  fFunctionAttri.Style:= [fsItalic];
-  fFunctionAttri.Foreground:= clBlack;
-  AddAttribute(fFunctionAttri);
-  fVariableAttri:= TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  fVariableAttri.Style:= [fsBold, fsItalic];
-  fVariableAttri.Foreground:= clBlack;
-  AddAttribute(fVariableAttri);
-  fSpecialAttri:= TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
-  fSpecialAttri.Style:= [fsItalic];
-  fSpecialAttri.Foreground:= clBlack;
-  AddAttribute(fSpecialAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  InitIdent;
-  fRange := rsUnknown;
-
-  fDefaultFilter := SYNS_FilterGembase;
-end;
-
-procedure TSynDmlSyn.AddressOpProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if fLine[Run] = '@' then Inc(Run);
-end;
-
-procedure TSynDmlSyn.AsciiCharProc;
-
-  function IsAsciiChar: Boolean;
-  begin
-     case FLine[Run] of
-       '_', '0'..'9', 'A'..'Z', 'a'..'z':
-         Result := True;
-       else
-         Result := False;
-     end;
-  end;
-
-begin
-  // variables...
-  fTokenID := tkVariable;
-  repeat
-    inc(Run);
-  until not IsAsciiChar;
-end;
-
-procedure TSynDmlSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynDmlSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if FLine[Run] = #10 then inc(Run);
-end;
-
-procedure TSynDmlSyn.GreaterProc;
-begin
-  fTokenID := tkSymbol;
-  Inc(Run);
-  if FLine[Run] = '=' then Inc(Run);
-end;
-
-procedure TSynDmlSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynDmlSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynDmlSyn.LowerProc;
-begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if (fLine[Run]= '=') or (fLine[Run]= '>') then Inc(Run);
-end;
-
-procedure TSynDmlSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynDmlSyn.NumberProc;
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while CharInSet(FLine[Run], ['0'..'9', '.']) do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynDmlSyn.PointProc;
-begin
-  fTokenID := tkSymbol;
-  inc(Run);
-  if (fLine[Run]='.') or (fLine[Run]=')') then inc(Run);
-end;
-
-procedure TSynDmlSyn.RemProc;
-var
-  p: PWideChar;
-begin
-  p := PWideChar(@fLine[Run - 1]);
-  while p >= fLine do
-  begin
-    if not CharInSet(p^, [#9, #32]) then
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-      exit;
-    end;
-    Dec(p);
-  end;
-  // it is a comment...
-  fTokenID := tkComment;
-  repeat
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynDmlSyn.SpaceProc;
-begin
-  fTokenID := tkSpace;
-  while (fLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynDmlSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then inc(Run, 2);
-  repeat
-    inc(Run);
-  until (FLine[Run] = '"') or IsLineEnd(Run);
-
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynDmlSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynDmlSyn.Next;
-begin
-  fTokenPos := Run;
-   case fLine[Run] of
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #1..#9, #11, #12, #14..#32:
-      SpaceProc;
-    '#': AsciiCharProc;
-    '"': StringProc;
-    '0'..'9': NumberProc;
-    'A'..'Z', 'a'..'z', '_':
-      IdentProc;
-    '{': SymbolProc;
-    '}': SymbolProc;
-    '!': RemProc;
-    '.': PointProc;
-    '<': LowerProc;
-    '>': GreaterProc;
-    '@': AddressOpProc;
-    #39, '&', '('..'-', '/', ':', ';', '=', '?', '['..'^', '`', '~':
-      SymbolProc;
-  else
-    UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynDmlSyn.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 TSynDmlSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynDmlSyn.GetTokenID: TtkTokenKind;
-begin
-  Result:= fTokenId;
-end;
-
-function TSynDmlSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkForm: Result := fFormAttri;
-    tkBlock: Result := fBlockAttri;
-    tkKey: Result := fKeyAttri;
-    tkComment: Result := fCommentAttri;
-    tkQualifier: Result := fQualiAttri;
-    tkFunction: Result := fFunctionAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpecial: Result := fSpecialAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkVariable: Result := fVariableAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fSymbolAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynDmlSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-function TSynDmlSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-procedure TSynDmlSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynDmlSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-function TSynDmlSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterGembase;
-end;
-
-class function TSynDmlSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGembase;
-end;
-
-class function TSynDmlSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangGembase;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynDmlSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterDml.pas, released 2000-04-17.
+The Original Code is based on the mwDmlSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Peter Adam.
+Unicode translation by Maël Hörz.
+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: SynHighlighterDml.pas,v 1.11.2.7 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+  - There are no metadata qualifiers.
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Dml highlighter for SynEdit)
+@author(Peter Adam)
+@created(1999)
+@lastmod(2000-06-23)
+The SynHighlighterDml unit provides SynEdit with a Dml highlighter.
+}
+
+unit SynHighlighterDml;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkBlock, tkComment, tkForm, tkFunction, tkIdentifier, tkKey,
+    tkNull, tkNumber, tkQualifier, tkSpace, tkSpecial, tkString, tkSymbol,
+    tkUnknown, tkVariable);
+
+  TRangeState = (rsANil, rsAdd, rsFind, rsUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynDmlSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FIdentFuncTable: array[0..2438] of TIdentFuncTableFunc;
+    FTokenID: TtkTokenKind;
+    FFormAttri: TSynHighlighterAttributes;
+    FBlockAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FQualiAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FFunctionAttri: TSynHighlighterAttributes;
+    FVariableAttri: TSynHighlighterAttributes;
+    FSpecialAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncAbs(Index: Integer): TtkTokenKind;
+    function FuncAbsolute_position(Index: Integer): TtkTokenKind;
+    function FuncAccount(Index: Integer): TtkTokenKind;
+    function FuncAcos(Index: Integer): TtkTokenKind;
+    function FuncActual_break(Index: Integer): TtkTokenKind;
+    function FuncAdd(Index: Integer): TtkTokenKind;
+    function FuncAdd_form(Index: Integer): TtkTokenKind;
+    function FuncAlternate_form(Index: Integer): TtkTokenKind;
+    function FuncAscii(Index: Integer): TtkTokenKind;
+    function FuncAsin(Index: Integer): TtkTokenKind;
+    function FuncAtan(Index: Integer): TtkTokenKind;
+    function FuncAtan2(Index: Integer): TtkTokenKind;
+    function FuncAttributes(Index: Integer): TtkTokenKind;
+    function FuncBack(Index: Integer): TtkTokenKind;
+    function FuncBase(Index: Integer): TtkTokenKind;
+    function FuncBatch(Index: Integer): TtkTokenKind;
+    function FuncBegin_block(Index: Integer): TtkTokenKind;
+    function FuncBegin_case(Index: Integer): TtkTokenKind;
+    function FuncBegin_disable_trigger(Index: Integer): TtkTokenKind;
+    function FuncBegin_row(Index: Integer): TtkTokenKind;
+    function FuncBegin_signal_to_status(Index: Integer): TtkTokenKind;
+    function FuncBell(Index: Integer): TtkTokenKind;
+    function FuncBinary_to_poly(Index: Integer): TtkTokenKind;
+    function FuncBottom_line(Index: Integer): TtkTokenKind;
+    function FuncBreak(Index: Integer): TtkTokenKind;
+    function FuncBreak0(Index: Integer): TtkTokenKind;
+    function FuncCall(Index: Integer): TtkTokenKind;
+    function FuncCase(Index: Integer): TtkTokenKind;
+    function FuncCeil(Index: Integer): TtkTokenKind;
+    function FuncCheck(Index: Integer): TtkTokenKind;
+    function FuncCheck_domain(Index: Integer): TtkTokenKind;
+    function FuncChr(Index: Integer): TtkTokenKind;
+    function FuncClear_buffer(Index: Integer): TtkTokenKind;
+    function FuncCli(Index: Integer): TtkTokenKind;
+    function FuncClose(Index: Integer): TtkTokenKind;
+    function FuncClose_text(Index: Integer): TtkTokenKind;
+    function FuncCol(Index: Integer): TtkTokenKind;
+    function FuncColumn_heading_row(Index: Integer): TtkTokenKind;
+    function FuncColumn_headings(Index: Integer): TtkTokenKind;
+    function FuncColumn_spacing(Index: Integer): TtkTokenKind;
+    function FuncCommit(Index: Integer): TtkTokenKind;
+    function FuncCommit_rate(Index: Integer): TtkTokenKind;
+    function FuncCompile(Index: Integer): TtkTokenKind;
+    function FuncCompress(Index: Integer): TtkTokenKind;
+    function FuncCompress_all(Index: Integer): TtkTokenKind;
+    function FuncConfirm(Index: Integer): TtkTokenKind;
+    function FuncConnect(Index: Integer): TtkTokenKind;
+    function FuncContinue(Index: Integer): TtkTokenKind;
+    function FuncCos(Index: Integer): TtkTokenKind;
+    function FuncCosh(Index: Integer): TtkTokenKind;
+    function FuncCross_reference(Index: Integer): TtkTokenKind;
+    function FuncDate(Index: Integer): TtkTokenKind;
+    function FuncDate_seconds(Index: Integer): TtkTokenKind;
+    function FuncDay_of_week(Index: Integer): TtkTokenKind;
+    function FuncDays(Index: Integer): TtkTokenKind;
+    function FuncDcl(Index: Integer): TtkTokenKind;
+    function FuncDefault_tag(Index: Integer): TtkTokenKind;
+    function FuncDelete(Index: Integer): TtkTokenKind;
+    function FuncDelete_form(Index: Integer): TtkTokenKind;
+    function FuncDescription(Index: Integer): TtkTokenKind;
+    function FuncDir(Index: Integer): TtkTokenKind;
+    function FuncDisconnect(Index: Integer): TtkTokenKind;
+    function FuncDisplay(Index: Integer): TtkTokenKind;
+    function FuncDisplay_length(Index: Integer): TtkTokenKind;
+    function FuncDocumentation(Index: Integer): TtkTokenKind;
+    function FuncDomain(Index: Integer): TtkTokenKind;
+    function FuncEdit(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncElse_if(Index: Integer): TtkTokenKind;
+    function FuncEnd_block(Index: Integer): TtkTokenKind;
+    function FuncEnd_case(Index: Integer): TtkTokenKind;
+    function FuncEnd_disable_trigger(Index: Integer): TtkTokenKind;
+    function FuncEnd_execute(Index: Integer): TtkTokenKind;
+    function FuncEnd_form(Index: Integer): TtkTokenKind;
+    function FuncEnd_if(Index: Integer): TtkTokenKind;
+    function FuncEnd_row(Index: Integer): TtkTokenKind;
+    function FuncEnd_signal_to_status(Index: Integer): TtkTokenKind;
+    function FuncEnd_while(Index: Integer): TtkTokenKind;
+    function FuncErase(Index: Integer): TtkTokenKind;
+    function FuncError(Index: Integer): TtkTokenKind;
+    function FuncExecute(Index: Integer): TtkTokenKind;
+    function FuncExit(Index: Integer): TtkTokenKind;
+    function FuncExit_forward(Index: Integer): TtkTokenKind;
+    function FuncExpand(Index: Integer): TtkTokenKind;
+    function FuncExternal(Index: Integer): TtkTokenKind;
+    function FuncFacility(Index: Integer): TtkTokenKind;
+    function FuncFailure(Index: Integer): TtkTokenKind;
+    function FuncFetch(Index: Integer): TtkTokenKind;
+    function FuncFiles(Index: Integer): TtkTokenKind;
+    function FuncFind(Index: Integer): TtkTokenKind;
+    function FuncFind_form(Index: Integer): TtkTokenKind;
+    function FuncFinish(Index: Integer): TtkTokenKind;
+    function FuncFirst(Index: Integer): TtkTokenKind;
+    function FuncFloor(Index: Integer): TtkTokenKind;
+    function FuncFooting(Index: Integer): TtkTokenKind;
+    function FuncFooting_form(Index: Integer): TtkTokenKind;
+    function FuncForm(Index: Integer): TtkTokenKind;
+    function FuncGenerate(Index: Integer): TtkTokenKind;
+    function FuncGoto(Index: Integer): TtkTokenKind;
+    function FuncGrouped_by(Index: Integer): TtkTokenKind;
+    function FuncHeading(Index: Integer): TtkTokenKind;
+    function FuncHeading_form(Index: Integer): TtkTokenKind;
+    function FuncHeight(Index: Integer): TtkTokenKind;
+    function FuncIdentifier(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncIn(Index: Integer): TtkTokenKind;
+    function FuncInput_block(Index: Integer): TtkTokenKind;
+    function FuncInput_mask(Index: Integer): TtkTokenKind;
+    function FuncInput_row_height(Index: Integer): TtkTokenKind;
+    function FuncInt(Index: Integer): TtkTokenKind;
+    function FuncInvoke(Index: Integer): TtkTokenKind;
+    function FuncItem(Index: Integer): TtkTokenKind;
+    function FuncItem_block(Index: Integer): TtkTokenKind;
+    function FuncItem_if(Index: Integer): TtkTokenKind;
+    function FuncJoined_to(Index: Integer): TtkTokenKind;
+    function FuncLeft(Index: Integer): TtkTokenKind;
+    function FuncLen(Index: Integer): TtkTokenKind;
+    function FuncLfooting(Index: Integer): TtkTokenKind;
+    function FuncLheading(Index: Integer): TtkTokenKind;
+    function FuncLine(Index: Integer): TtkTokenKind;
+    function FuncLines_after(Index: Integer): TtkTokenKind;
+    function FuncLines_before(Index: Integer): TtkTokenKind;
+    function FuncList(Index: Integer): TtkTokenKind;
+    function FuncLoad(Index: Integer): TtkTokenKind;
+    function FuncLock(Index: Integer): TtkTokenKind;
+    function FuncLog(Index: Integer): TtkTokenKind;
+    function FuncLog10(Index: Integer): TtkTokenKind;
+    function FuncLov(Index: Integer): TtkTokenKind;
+    function FuncLov_auto_select(Index: Integer): TtkTokenKind;
+    function FuncLov_col(Index: Integer): TtkTokenKind;
+    function FuncLov_data(Index: Integer): TtkTokenKind;
+    function FuncLov_first(Index: Integer): TtkTokenKind;
+    function FuncLov_height(Index: Integer): TtkTokenKind;
+    function FuncLov_noheading(Index: Integer): TtkTokenKind;
+    function FuncLov_nosearch(Index: Integer): TtkTokenKind;
+    function FuncLov_reduced_to(Index: Integer): TtkTokenKind;
+    function FuncLov_row(Index: Integer): TtkTokenKind;
+    function FuncLov_secondary(Index: Integer): TtkTokenKind;
+    function FuncLov_selection(Index: Integer): TtkTokenKind;
+    function FuncLov_sorted_by(Index: Integer): TtkTokenKind;
+    function FuncLov_width(Index: Integer): TtkTokenKind;
+    function FuncLov_with(Index: Integer): TtkTokenKind;
+    function FuncLowercase(Index: Integer): TtkTokenKind;
+    function FuncLtrim(Index: Integer): TtkTokenKind;
+    function FuncMail(Index: Integer): TtkTokenKind;
+    function FuncMenu(Index: Integer): TtkTokenKind;
+    function FuncMenu_block(Index: Integer): TtkTokenKind;
+    function FuncMenu_form(Index: Integer): TtkTokenKind;
+    function FuncMessage(Index: Integer): TtkTokenKind;
+    function FuncMid(Index: Integer): TtkTokenKind;
+    function FuncMod(Index: Integer): TtkTokenKind;
+    function FuncModify_form(Index: Integer): TtkTokenKind;
+    function FuncNew(Index: Integer): TtkTokenKind;
+    function FuncNo_domain(Index: Integer): TtkTokenKind;
+    function FuncNobell(Index: Integer): TtkTokenKind;
+    function FuncNoclear_buffer(Index: Integer): TtkTokenKind;
+    function FuncNodeadlock_exit(Index: Integer): TtkTokenKind;
+    function FuncNoerase(Index: Integer): TtkTokenKind;
+    function FuncNoerror(Index: Integer): TtkTokenKind;
+    function FuncNoexit_forward(Index: Integer): TtkTokenKind;
+    function FuncNoheading(Index: Integer): TtkTokenKind;
+    function FuncNolov_data(Index: Integer): TtkTokenKind;
+    function FuncNorepeat(Index: Integer): TtkTokenKind;
+    function FuncNostatus(Index: Integer): TtkTokenKind;
+    function FuncNototals(Index: Integer): TtkTokenKind;
+    function FuncNounderlines(Index: Integer): TtkTokenKind;
+    function FuncNowait(Index: Integer): TtkTokenKind;
+    function FuncOpen(Index: Integer): TtkTokenKind;
+    function FuncOpen_text(Index: Integer): TtkTokenKind;
+    function FuncOpt(Index: Integer): TtkTokenKind;
+    function FuncOptions(Index: Integer): TtkTokenKind;
+    function FuncOutput(Index: Integer): TtkTokenKind;
+    function FuncOutput_block(Index: Integer): TtkTokenKind;
+    function FuncOutput_mask(Index: Integer): TtkTokenKind;
+    function FuncPause(Index: Integer): TtkTokenKind;
+    function FuncPause_block(Index: Integer): TtkTokenKind;
+    function FuncPerform(Index: Integer): TtkTokenKind;
+    function FuncPoly_to_binary(Index: Integer): TtkTokenKind;
+    function FuncPos(Index: Integer): TtkTokenKind;
+    function FuncPrint(Index: Integer): TtkTokenKind;
+    function FuncProcedure_form(Index: Integer): TtkTokenKind;
+    function FuncPrompt(Index: Integer): TtkTokenKind;
+    function FuncProtect(Index: Integer): TtkTokenKind;
+    function FuncQuery(Index: Integer): TtkTokenKind;
+    function FuncQuery_form(Index: Integer): TtkTokenKind;
+    function FuncRandom(Index: Integer): TtkTokenKind;
+    function FuncRead_line(Index: Integer): TtkTokenKind;
+    function FuncRead_only(Index: Integer): TtkTokenKind;
+    function FuncReceive(Index: Integer): TtkTokenKind;
+    function FuncReceive_arguments(Index: Integer): TtkTokenKind;
+    function FuncReceive_data(Index: Integer): TtkTokenKind;
+    function FuncReceive_table(Index: Integer): TtkTokenKind;
+    function FuncReduced_to(Index: Integer): TtkTokenKind;
+    function FuncRelease(Index: Integer): TtkTokenKind;
+    function FuncRemain(Index: Integer): TtkTokenKind;
+    function FuncRepeat(Index: Integer): TtkTokenKind;
+    function FuncReport(Index: Integer): TtkTokenKind;
+    function FuncReport_form(Index: Integer): TtkTokenKind;
+    function FuncReposition(Index: Integer): TtkTokenKind;
+    function FuncRewind_text(Index: Integer): TtkTokenKind;
+    function FuncRfooting(Index: Integer): TtkTokenKind;
+    function FuncRheading(Index: Integer): TtkTokenKind;
+    function FuncRight(Index: Integer): TtkTokenKind;
+    function FuncRollback(Index: Integer): TtkTokenKind;
+    function FuncRound(Index: Integer): TtkTokenKind;
+    function FuncRow(Index: Integer): TtkTokenKind;
+    function FuncRow_height(Index: Integer): TtkTokenKind;
+    function FuncSearch(Index: Integer): TtkTokenKind;
+    function FuncSecondary(Index: Integer): TtkTokenKind;
+    function FuncSeconds(Index: Integer): TtkTokenKind;
+    function FuncSelection(Index: Integer): TtkTokenKind;
+    function FuncSend(Index: Integer): TtkTokenKind;
+    function FuncSend_data(Index: Integer): TtkTokenKind;
+    function FuncSend_message(Index: Integer): TtkTokenKind;
+    function FuncSend_table(Index: Integer): TtkTokenKind;
+    function FuncSequence(Index: Integer): TtkTokenKind;
+    function FuncSeverity(Index: Integer): TtkTokenKind;
+    function FuncSin(Index: Integer): TtkTokenKind;
+    function FuncSinh(Index: Integer): TtkTokenKind;
+    function FuncSorted_by(Index: Integer): TtkTokenKind;
+    function FuncSource(Index: Integer): TtkTokenKind;
+    function FuncSource_if(Index: Integer): TtkTokenKind;
+    function FuncSqrt(Index: Integer): TtkTokenKind;
+    function FuncStart_stream(Index: Integer): TtkTokenKind;
+    function FuncStart_transaction(Index: Integer): TtkTokenKind;
+    function FuncStatistic(Index: Integer): TtkTokenKind;
+    function FuncStatus(Index: Integer): TtkTokenKind;
+    function FuncStream_name(Index: Integer): TtkTokenKind;
+    function FuncString(Index: Integer): TtkTokenKind;
+    function FuncSuccess(Index: Integer): TtkTokenKind;
+    function FuncSwitch(Index: Integer): TtkTokenKind;
+    function FuncSwitch_base(Index: Integer): TtkTokenKind;
+    function FuncSystem(Index: Integer): TtkTokenKind;
+    function FuncTable(Index: Integer): TtkTokenKind;
+    function FuncTable_form(Index: Integer): TtkTokenKind;
+    function FuncTable_search(Index: Integer): TtkTokenKind;
+    function FuncTag(Index: Integer): TtkTokenKind;
+    function FuncTag_length(Index: Integer): TtkTokenKind;
+    function FuncTan(Index: Integer): TtkTokenKind;
+    function FuncTanh(Index: Integer): TtkTokenKind;
+    function FuncTarget(Index: Integer): TtkTokenKind;
+    function FuncText(Index: Integer): TtkTokenKind;
+    function FuncText_only(Index: Integer): TtkTokenKind;
+    function FuncTitle(Index: Integer): TtkTokenKind;
+    function FuncTo(Index: Integer): TtkTokenKind;
+    function FuncTop_line(Index: Integer): TtkTokenKind;
+    function FuncTotal(Index: Integer): TtkTokenKind;
+    function FuncTransfer(Index: Integer): TtkTokenKind;
+    function FuncTrigger(Index: Integer): TtkTokenKind;
+    function FuncTrim(Index: Integer): TtkTokenKind;
+    function FuncTsuppress(Index: Integer): TtkTokenKind;
+    function FuncUnload(Index: Integer): TtkTokenKind;
+    function FuncUppercase(Index: Integer): TtkTokenKind;
+    function FuncUse_if(Index: Integer): TtkTokenKind;
+    function FuncUser_key(Index: Integer): TtkTokenKind;
+    function FuncUsing(Index: Integer): TtkTokenKind;
+    function FuncUtilities(Index: Integer): TtkTokenKind;
+    function FuncWait(Index: Integer): TtkTokenKind;
+    function FuncWhile(Index: Integer): TtkTokenKind;
+    function FuncWidth(Index: Integer): TtkTokenKind;
+    function FuncWith(Index: Integer): TtkTokenKind;
+    function FuncWrite(Index: Integer): TtkTokenKind;
+    function FuncWrite_line(Index: Integer): TtkTokenKind;
+    function FuncYesno_block(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure SymbolProc;
+    procedure AddressOpProc;
+    procedure AsciiCharProc;
+    procedure CRProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure PointProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure RemProc;
+    function IsQuali: Boolean;
+    function IsSpecial: Boolean;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+  published
+    property BlockAttri: TSynHighlighterAttributes read FBlockAttri
+      write FBlockAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property FormAttri: TSynHighlighterAttributes read FFormAttri
+      write FFormAttri;
+    property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri
+      write FFunctionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property QualiAttri: TSynHighlighterAttributes read FQualiAttri
+      write FQualiAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property SpecialAttri: TSynHighlighterAttributes read FSpecialAttri
+      write FSpecialAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+    property VariableAttri: TSynHighlighterAttributes read FVariableAttri
+      write FVariableAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..263] of UnicodeString = (
+    'abs', 'absolute_position', 'account', 'acos', 'actual_break', 'add', 
+    'add_form', 'alternate_form', 'ascii', 'asin', 'atan', 'atan2', 
+    'attributes', 'back', 'base', 'batch', 'begin_block', 'begin_case', 
+    'begin_disable_trigger', 'begin_row', 'begin_signal_to_status', 'bell', 
+    'binary_to_poly', 'bottom_line', 'break', 'break0', 'call', 'case', 'ceil', 
+    'check', 'check_domain', 'chr', 'clear_buffer', 'cli', 'close', 
+    'close_text', 'col', 'column_heading_row', 'column_headings', 
+    'column_spacing', 'commit', 'commit_rate', 'compile', 'compress', 
+    'compress_all', 'confirm', 'connect', 'continue', 'cos', 'cosh', 
+    'cross_reference', 'date', 'date_seconds', 'day_of_week', 'days', 'dcl', 
+    'default_tag', 'delete', 'delete_form', 'description', 'dir', 'disconnect', 
+    'display', 'display_length', 'documentation', 'domain', 'edit', 'else', 
+    'else_if', 'end_block', 'end_case', 'end_disable_trigger', 'end_execute', 
+    'end_form', 'end_if', 'end_row', 'end_signal_to_status', 'end_while', 
+    'erase', 'error', 'execute', 'exit', 'exit_forward', 'expand', 'external', 
+    'facility', 'failure', 'fetch', 'files', 'find', 'find_form', 'finish', 
+    'first', 'floor', 'footing', 'footing_form', 'form', 'generate', 'goto', 
+    'grouped_by', 'heading', 'heading_form', 'height', 'identifier', 'if', 'in', 
+    'input_block', 'input_mask', 'input_row_height', 'int', 'invoke', 'item', 
+    'item_block', 'item_if', 'joined_to', 'left', 'len', 'lfooting', 'lheading', 
+    'line', 'lines_after', 'lines_before', 'list', 'load', 'lock', 'log', 
+    'log10', 'lov', 'lov_auto_select', 'lov_col', 'lov_data', 'lov_first', 
+    'lov_height', 'lov_noheading', 'lov_nosearch', 'lov_reduced_to', 'lov_row', 
+    'lov_secondary', 'lov_selection', 'lov_sorted_by', 'lov_width', 'lov_with', 
+    'lowercase', 'ltrim', 'mail', 'menu', 'menu_block', 'menu_form', 'message', 
+    'mid', 'mod', 'modify_form', 'new', 'no_domain', 'nobell', 'noclear_buffer', 
+    'nodeadlock_exit', 'noerase', 'noerror', 'noexit_forward', 'noheading', 
+    'nolov_data', 'norepeat', 'nostatus', 'nototals', 'nounderlines', 'nowait', 
+    'open', 'open_text', 'opt', 'options', 'output', 'output_block', 
+    'output_mask', 'pause', 'pause_block', 'perform', 'poly_to_binary', 'pos', 
+    'print', 'procedure_form', 'prompt', 'protect', 'query', 'query_form', 
+    'random', 'read_line', 'read_only', 'receive', 'receive_arguments', 
+    'receive_data', 'receive_table', 'reduced_to', 'release', 'remain', 
+    'repeat', 'report', 'report_form', 'reposition', 'rewind_text', 'rfooting', 
+    'rheading', 'right', 'rollback', 'round', 'row', 'row_height', 'search', 
+    'secondary', 'seconds', 'selection', 'send', 'send_data', 'send_message', 
+    'send_table', 'sequence', 'severity', 'sin', 'sinh', 'sorted_by', 'source', 
+    'source_if', 'sqrt', 'start_stream', 'start_transaction', 'statistic', 
+    'status', 'stream_name', 'string', 'success', 'switch', 'switch_base', 
+    'system', 'table', 'table_form', 'table_search', 'tag', 'tag_length', 'tan', 
+    'tanh', 'target', 'text', 'text_only', 'title', 'to', 'top_line', 'total', 
+    'transfer', 'trigger', 'trim', 'tsuppress', 'unload', 'uppercase', 'use_if', 
+    'user_key', 'using', 'utilities', 'wait', 'while', 'width', 'with', 'write', 
+    'write_line', 'yesno_block' 
+  );
+
+  KeyIndices: array[0..2438] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 230, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 217, -1, -1, -1, -1, -1, 183, -1, 246, -1, 134, -1, -1, -1, -1, 
+    -1, 65, -1, -1, 223, -1, -1, -1, -1, -1, 213, -1, -1, -1, 46, -1, -1, 262, 
+    -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, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 111, 157, -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 123, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 84, -1, 154, -1, 96, -1, -1, -1, 176, -1, -1, -1, 120, 178, -1, -1, -1, 
+    -1, 74, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, 147, -1, -1, -1, 122, 
+    -1, 58, -1, 87, 191, -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, 170, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 5, -1, -1, 194, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, 
+    -1, 28, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, 20, -1, -1, -1, -1, 79, 
+    116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 0, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 196, -1, -1, 85, -1, -1, -1, 104, -1, 103, -1, -1, 14, -1, -1, 
+    131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, 
+    -1, 6, -1, 182, -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, 41, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, -1, -1, 
+    -1, -1, -1, 115, -1, -1, 108, -1, 150, -1, -1, 42, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 143, 166, -1, -1, 
+    -1, -1, -1, -1, 225, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, 92, -1, -1, 
+    226, -1, 161, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, 
+    -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 151, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 146, 210, -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, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 245, -1, -1, -1, -1, -1, 68, -1, 
+    231, -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, 
+    -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 
+    -1, -1, 75, -1, 252, 212, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    149, -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, 187, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 
+    -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, 164, 35, -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, 
+    234, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, 
+    -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 240, -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, -1, -1, -1, 39, -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, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, 229, 11, 
+    -1, -1, 43, -1, -1, -1, -1, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 159, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 181, -1, 139, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, 15, -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, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 
+    258, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, -1, 153, 
+    -1, -1, 36, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 48, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, -1, -1, 9, -1, -1, 140, 193, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, -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, -1, -1, -1, -1, -1, 188, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 228, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    19, -1, 66, -1, -1, -1, 24, -1, -1, -1, -1, 186, -1, -1, -1, -1, 99, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, 259, -1, 32, -1, -1, -1, -1, -1, 
+    121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, 209, 260, -1, 
+    -1, -1, -1, -1, -1, -1, 76, 257, -1, -1, -1, -1, 211, -1, 90, -1, -1, -1, 
+    -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, 70, 
+    -1, -1, -1, -1, -1, 63, -1, -1, -1, 25, 207, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, 
+    189, -1, -1, -1, 113, -1, -1, -1, 110, -1, 205, -1, 56, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, 45, -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, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, 254, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, 
+    235, -1, 34, -1, 218, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, 220, -1, 
+    -1, -1, 141, -1, -1, -1, -1, 195, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, 160, -1, 
+    -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 203, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 219, -1, -1, -1, -1, -1, 61, -1, -1, 30, -1, -1, 130, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 12, -1, 202, -1, -1, -1, -1, -1, 200, -1, -1, 169, -1, 
+    -1, -1, -1, -1, -1, 16, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, 162, -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, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 247, -1, -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, 251, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 216, -1, -1, -1, -1, 128, 27, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, 
+    -1, 158, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, 173, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 17, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 135, -1, -1, 190, -1, -1, -1, 222, 60, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 106, -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, -1, -1, -1, 38, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, 144, -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, -1, -1, -1, -1, -1, 94, -1, 95, -1, -1, -1, -1, -1, 215, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, 
+    -1, -1, 10, 250, -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 201, -1, -1, -1, 
+    233, -1, -1, -1, -1, -1, 249, -1, -1, 184, -1, -1, -1, -1, -1, 263, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 26, 138, -1, -1, -1, -1, -1, -1, -1, -1, 64, 
+    -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 127, 206, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, 
+    -1, 244, -1, -1, -1, -1, -1, -1, -1, -1 
+  );
+
+{$Q-}
+function TSynDmlSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 798 + Ord(Str^) * 3;
+    Inc(Str);
+  end;
+  Result := Result mod 2439;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynDmlSyn.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 TSynDmlSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[435] := FuncAbs;
+  FIdentFuncTable[41] := FuncAbsolute_position;
+  FIdentFuncTable[13] := FuncAccount;
+  FIdentFuncTable[2405] := FuncAcos;
+  FIdentFuncTable[1707] := FuncActual_break;
+  FIdentFuncTable[300] := FuncAdd;
+  FIdentFuncTable[486] := FuncAdd_form;
+  FIdentFuncTable[839] := FuncAlternate_form;
+  FIdentFuncTable[735] := FuncAscii;
+  FIdentFuncTable[1265] := FuncAsin;
+  FIdentFuncTable[2300] := FuncAtan;
+  FIdentFuncTable[1065] := FuncAtan2;
+  FIdentFuncTable[1930] := FuncAttributes;
+  FIdentFuncTable[1202] := FuncBack;
+  FIdentFuncTable[464] := FuncBase;
+  FIdentFuncTable[1118] := FuncBatch;
+  FIdentFuncTable[1948] := FuncBegin_block;
+  FIdentFuncTable[2124] := FuncBegin_case;
+  FIdentFuncTable[2068] := FuncBegin_disable_trigger;
+  FIdentFuncTable[1385] := FuncBegin_row;
+  FIdentFuncTable[387] := FuncBegin_signal_to_status;
+  FIdentFuncTable[1061] := FuncBell;
+  FIdentFuncTable[166] := FuncBinary_to_poly;
+  FIdentFuncTable[776] := FuncBottom_line;
+  FIdentFuncTable[1391] := FuncBreak;
+  FIdentFuncTable[1524] := FuncBreak0;
+  FIdentFuncTable[2380] := FuncCall;
+  FIdentFuncTable[2044] := FuncCase;
+  FIdentFuncTable[337] := FuncCeil;
+  FIdentFuncTable[644] := FuncCheck;
+  FIdentFuncTable[1918] := FuncCheck_domain;
+  FIdentFuncTable[1512] := FuncChr;
+  FIdentFuncTable[1454] := FuncClear_buffer;
+  FIdentFuncTable[1305] := FuncCli;
+  FIdentFuncTable[1761] := FuncClose;
+  FIdentFuncTable[908] := FuncClose_text;
+  FIdentFuncTable[1179] := FuncCol;
+  FIdentFuncTable[1114] := FuncColumn_heading_row;
+  FIdentFuncTable[2183] := FuncColumn_headings;
+  FIdentFuncTable[1007] := FuncColumn_spacing;
+  FIdentFuncTable[697] := FuncCommit;
+  FIdentFuncTable[521] := FuncCommit_rate;
+  FIdentFuncTable[591] := FuncCompile;
+  FIdentFuncTable[1068] := FuncCompress;
+  FIdentFuncTable[1359] := FuncCompress_all;
+  FIdentFuncTable[1637] := FuncConfirm;
+  FIdentFuncTable[89] := FuncConnect;
+  FIdentFuncTable[898] := FuncContinue;
+  FIdentFuncTable[1200] := FuncCos;
+  FIdentFuncTable[1747] := FuncCosh;
+  FIdentFuncTable[954] := FuncCross_reference;
+  FIdentFuncTable[1630] := FuncDate;
+  FIdentFuncTable[320] := FuncDate_seconds;
+  FIdentFuncTable[368] := FuncDay_of_week;
+  FIdentFuncTable[1447] := FuncDays;
+  FIdentFuncTable[2394] := FuncDcl;
+  FIdentFuncTable[1583] := FuncDefault_tag;
+  FIdentFuncTable[820] := FuncDelete;
+  FIdentFuncTable[261] := FuncDelete_form;
+  FIdentFuncTable[608] := FuncDescription;
+  FIdentFuncTable[2142] := FuncDir;
+  FIdentFuncTable[1915] := FuncDisconnect;
+  FIdentFuncTable[1889] := FuncDisplay;
+  FIdentFuncTable[1520] := FuncDisplay_length;
+  FIdentFuncTable[2390] := FuncDocumentation;
+  FIdentFuncTable[76] := FuncDomain;
+  FIdentFuncTable[1387] := FuncEdit;
+  FIdentFuncTable[1414] := FuncElse;
+  FIdentFuncTable[801] := FuncElse_if;
+  FIdentFuncTable[1158] := FuncEnd_block;
+  FIdentFuncTable[1514] := FuncEnd_case;
+  FIdentFuncTable[1734] := FuncEnd_disable_trigger;
+  FIdentFuncTable[1043] := FuncEnd_execute;
+  FIdentFuncTable[2119] := FuncEnd_form;
+  FIdentFuncTable[224] := FuncEnd_if;
+  FIdentFuncTable[842] := FuncEnd_row;
+  FIdentFuncTable[1484] := FuncEnd_signal_to_status;
+  FIdentFuncTable[338] := FuncEnd_while;
+  FIdentFuncTable[893] := FuncErase;
+  FIdentFuncTable[392] := FuncError;
+  FIdentFuncTable[503] := FuncExecute;
+  FIdentFuncTable[253] := FuncExit;
+  FIdentFuncTable[1280] := FuncExit_forward;
+  FIdentFuncTable[1146] := FuncExpand;
+  FIdentFuncTable[206] := FuncExternal;
+  FIdentFuncTable[455] := FuncFacility;
+  FIdentFuncTable[176] := FuncFailure;
+  FIdentFuncTable[263] := FuncFetch;
+  FIdentFuncTable[2106] := FuncFiles;
+  FIdentFuncTable[1191] := FuncFind;
+  FIdentFuncTable[1492] := FuncFind_form;
+  FIdentFuncTable[1868] := FuncFinish;
+  FIdentFuncTable[651] := FuncFirst;
+  FIdentFuncTable[2081] := FuncFloor;
+  FIdentFuncTable[2267] := FuncFooting;
+  FIdentFuncTable[2269] := FuncFooting_form;
+  FIdentFuncTable[210] := FuncForm;
+  FIdentFuncTable[516] := FuncGenerate;
+  FIdentFuncTable[2196] := FuncGoto;
+  FIdentFuncTable[1401] := FuncGrouped_by;
+  FIdentFuncTable[711] := FuncHeading;
+  FIdentFuncTable[1173] := FuncHeading_form;
+  FIdentFuncTable[194] := FuncHeight;
+  FIdentFuncTable[461] := FuncIdentifier;
+  FIdentFuncTable[459] := FuncIf;
+  FIdentFuncTable[483] := FuncIn;
+  FIdentFuncTable[2151] := FuncInput_block;
+  FIdentFuncTable[947] := FuncInput_mask;
+  FIdentFuncTable[586] := FuncInput_row_height;
+  FIdentFuncTable[420] := FuncInt;
+  FIdentFuncTable[1579] := FuncInvoke;
+  FIdentFuncTable[134] := FuncItem;
+  FIdentFuncTable[824] := FuncItem_block;
+  FIdentFuncTable[1575] := FuncItem_if;
+  FIdentFuncTable[1988] := FuncJoined_to;
+  FIdentFuncTable[583] := FuncLeft;
+  FIdentFuncTable[393] := FuncLen;
+  FIdentFuncTable[1698] := FuncLfooting;
+  FIdentFuncTable[142] := FuncLheading;
+  FIdentFuncTable[439] := FuncLine;
+  FIdentFuncTable[218] := FuncLines_after;
+  FIdentFuncTable[1460] := FuncLines_before;
+  FIdentFuncTable[259] := FuncList;
+  FIdentFuncTable[193] := FuncLoad;
+  FIdentFuncTable[124] := FuncLock;
+  FIdentFuncTable[2361] := FuncLog;
+  FIdentFuncTable[807] := FuncLog10;
+  FIdentFuncTable[2406] := FuncLov;
+  FIdentFuncTable[2043] := FuncLov_auto_select;
+  FIdentFuncTable[1806] := FuncLov_col;
+  FIdentFuncTable[1921] := FuncLov_data;
+  FIdentFuncTable[467] := FuncLov_first;
+  FIdentFuncTable[1673] := FuncLov_height;
+  FIdentFuncTable[1499] := FuncLov_noheading;
+  FIdentFuncTable[70] := FuncLov_nosearch;
+  FIdentFuncTable[2134] := FuncLov_reduced_to;
+  FIdentFuncTable[2208] := FuncLov_row;
+  FIdentFuncTable[1788] := FuncLov_secondary;
+  FIdentFuncTable[2381] := FuncLov_selection;
+  FIdentFuncTable[1107] := FuncLov_sorted_by;
+  FIdentFuncTable[1268] := FuncLov_width;
+  FIdentFuncTable[1779] := FuncLov_with;
+  FIdentFuncTable[538] := FuncLowercase;
+  FIdentFuncTable[631] := FuncLtrim;
+  FIdentFuncTable[2233] := FuncMail;
+  FIdentFuncTable[2296] := FuncMenu;
+  FIdentFuncTable[743] := FuncMenu_block;
+  FIdentFuncTable[255] := FuncMenu_form;
+  FIdentFuncTable[1824] := FuncMessage;
+  FIdentFuncTable[858] := FuncMid;
+  FIdentFuncTable[588] := FuncMod;
+  FIdentFuncTable[729] := FuncModify_form;
+  FIdentFuncTable[1770] := FuncNew;
+  FIdentFuncTable[1176] := FuncNo_domain;
+  FIdentFuncTable[208] := FuncNobell;
+  FIdentFuncTable[1756] := FuncNoclear_buffer;
+  FIdentFuncTable[1858] := FuncNodeadlock_exit;
+  FIdentFuncTable[135] := FuncNoerase;
+  FIdentFuncTable[2073] := FuncNoerror;
+  FIdentFuncTable[1092] := FuncNoexit_forward;
+  FIdentFuncTable[1811] := FuncNoheading;
+  FIdentFuncTable[656] := FuncNolov_data;
+  FIdentFuncTable[1959] := FuncNorepeat;
+  FIdentFuncTable[1319] := FuncNostatus;
+  FIdentFuncTable[907] := FuncNototals;
+  FIdentFuncTable[2427] := FuncNounderlines;
+  FIdentFuncTable[632] := FuncNowait;
+  FIdentFuncTable[1560] := FuncOpen;
+  FIdentFuncTable[2226] := FuncOpen_text;
+  FIdentFuncTable[1941] := FuncOpt;
+  FIdentFuncTable[290] := FuncOptions;
+  FIdentFuncTable[491] := FuncOutput;
+  FIdentFuncTable[1952] := FuncOutput_block;
+  FIdentFuncTable[2108] := FuncOutput_mask;
+  FIdentFuncTable[1539] := FuncPause;
+  FIdentFuncTable[1182] := FuncPause_block;
+  FIdentFuncTable[214] := FuncPerform;
+  FIdentFuncTable[1294] := FuncPoly_to_binary;
+  FIdentFuncTable[219] := FuncPos;
+  FIdentFuncTable[1569] := FuncPrint;
+  FIdentFuncTable[1719] := FuncProcedure_form;
+  FIdentFuncTable[1105] := FuncPrompt;
+  FIdentFuncTable[488] := FuncProtect;
+  FIdentFuncTable[66] := FuncQuery;
+  FIdentFuncTable[2344] := FuncQuery_form;
+  FIdentFuncTable[575] := FuncRandom;
+  FIdentFuncTable[1396] := FuncRead_line;
+  FIdentFuncTable[885] := FuncRead_only;
+  FIdentFuncTable[1353] := FuncReceive;
+  FIdentFuncTable[1571] := FuncReceive_arguments;
+  FIdentFuncTable[2137] := FuncReceive_data;
+  FIdentFuncTable[264] := FuncReceive_table;
+  FIdentFuncTable[410] := FuncReduced_to;
+  FIdentFuncTable[1269] := FuncRelease;
+  FIdentFuncTable[303] := FuncRemain;
+  FIdentFuncTable[1784] := FuncRepeat;
+  FIdentFuncTable[452] := FuncReport;
+  FIdentFuncTable[2315] := FuncReport_form;
+  FIdentFuncTable[2025] := FuncReposition;
+  FIdentFuncTable[1259] := FuncRewind_text;
+  FIdentFuncTable[1938] := FuncRfooting;
+  FIdentFuncTable[2331] := FuncRheading;
+  FIdentFuncTable[1932] := FuncRight;
+  FIdentFuncTable[1849] := FuncRollback;
+  FIdentFuncTable[553] := FuncRound;
+  FIdentFuncTable[1581] := FuncRow;
+  FIdentFuncTable[2407] := FuncRow_height;
+  FIdentFuncTable[1525] := FuncSearch;
+  FIdentFuncTable[151] := FuncSecondary;
+  FIdentFuncTable[1475] := FuncSeconds;
+  FIdentFuncTable[744] := FuncSelection;
+  FIdentFuncTable[1490] := FuncSend;
+  FIdentFuncTable[845] := FuncSend_data;
+  FIdentFuncTable[85] := FuncSend_message;
+  FIdentFuncTable[720] := FuncSend_table;
+  FIdentFuncTable[2275] := FuncSequence;
+  FIdentFuncTable[2038] := FuncSeverity;
+  FIdentFuncTable[60] := FuncSin;
+  FIdentFuncTable[1763] := FuncSinh;
+  FIdentFuncTable[1909] := FuncSorted_by;
+  FIdentFuncTable[1775] := FuncSource;
+  FIdentFuncTable[1474] := FuncSource_if;
+  FIdentFuncTable[2141] := FuncSqrt;
+  FIdentFuncTable[79] := FuncStart_stream;
+  FIdentFuncTable[604] := FuncStart_transaction;
+  FIdentFuncTable[639] := FuncStatistic;
+  FIdentFuncTable[654] := FuncStatus;
+  FIdentFuncTable[1816] := FuncStream_name;
+  FIdentFuncTable[1368] := FuncString;
+  FIdentFuncTable[1064] := FuncSuccess;
+  FIdentFuncTable[39] := FuncSwitch;
+  FIdentFuncTable[803] := FuncSwitch_base;
+  FIdentFuncTable[1212] := FuncSystem;
+  FIdentFuncTable[2335] := FuncTable;
+  FIdentFuncTable[934] := FuncTable_form;
+  FIdentFuncTable[1759] := FuncTable_search;
+  FIdentFuncTable[1074] := FuncTag;
+  FIdentFuncTable[705] := FuncTag_length;
+  FIdentFuncTable[1095] := FuncTan;
+  FIdentFuncTable[382] := FuncTanh;
+  FIdentFuncTable[975] := FuncTarget;
+  FIdentFuncTable[229] := FuncText;
+  FIdentFuncTable[2007] := FuncText_only;
+  FIdentFuncTable[307] := FuncTitle;
+  FIdentFuncTable[2430] := FuncTo;
+  FIdentFuncTable[795] := FuncTop_line;
+  FIdentFuncTable[68] := FuncTotal;
+  FIdentFuncTable[2000] := FuncTransfer;
+  FIdentFuncTable[333] := FuncTrigger;
+  FIdentFuncTable[2341] := FuncTrim;
+  FIdentFuncTable[2301] := FuncTsuppress;
+  FIdentFuncTable[2029] := FuncUnload;
+  FIdentFuncTable[844] := FuncUppercase;
+  FIdentFuncTable[1437] := FuncUse_if;
+  FIdentFuncTable[1736] := FuncUser_key;
+  FIdentFuncTable[353] := FuncUsing;
+  FIdentFuncTable[2305] := FuncUtilities;
+  FIdentFuncTable[1485] := FuncWait;
+  FIdentFuncTable[1159] := FuncWhile;
+  FIdentFuncTable[1452] := FuncWidth;
+  FIdentFuncTable[1476] := FuncWith;
+  FIdentFuncTable[27] := FuncWrite;
+  FIdentFuncTable[92] := FuncWrite_line;
+  FIdentFuncTable[2350] := FuncYesno_block;
+end;
+
+function TSynDmlSyn.IsQuali: Boolean;
+begin
+  Result:= False;
+  if Run > 0 then
+    if FLine[Run - 1] = '/' then Result:= True;
+end;
+
+function TSynDmlSyn.IsSpecial: Boolean;
+begin
+  Result:= False;
+  if Run > 0 then
+    if FLine[Run - 1] = '%' then Result:= True;
+end;
+
+function TSynDmlSyn.FuncAbs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAbsolute_position(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAccount(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAcos(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncActual_break(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAdd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsSpecial then
+      Result := tkSpecial
+    else
+    begin
+      Result := tkKey;
+      FRange := rsAdd;
+    end;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAdd_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAlternate_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAscii(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAsin(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAtan(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAtan2(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncAttributes(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBack(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBatch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBegin_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBegin_case(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBegin_disable_trigger(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBegin_row(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBegin_signal_to_status(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBell(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBinary_to_poly(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBottom_line(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBreak(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncBreak0(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCall(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCeil(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCheck(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCheck_domain(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncChr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncClear_buffer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCli(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncClose(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncClose_text(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCol(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkIdentifier;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncColumn_heading_row(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncColumn_headings(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncColumn_spacing(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCommit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCommit_rate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCompile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCompress(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCompress_all(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncConfirm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncConnect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncContinue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCos(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCosh(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncCross_reference(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDate_seconds(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDay_of_week(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDays(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDcl(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDefault_tag(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDelete(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDelete_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDescription(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDir(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDisconnect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDisplay(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDisplay_length(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDocumentation(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncDomain(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEdit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncElse_if(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_case(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_disable_trigger(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_execute(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_if(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_row(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_signal_to_status(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncEnd_while(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncErase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncError(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else
+      Result := tkKey;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncExecute(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncExit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncExit_forward(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncExpand(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncExternal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFacility(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFailure(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkIdentifier;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFetch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFiles(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFind(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    Result := tkKey;
+    FRange := rsFind;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFind_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFinish(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFirst(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFloor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFooting(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncFooting_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncForm(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkForm;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncGenerate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncGoto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncGrouped_by(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncHeading(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncHeading_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncHeight(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncIdentifier(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncIn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and (FRange = rsFind) then
+  begin
+    Result := tkKey;
+    FRange := rsUnknown;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncInput_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncInput_mask(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncInput_row_height(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncInt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncInvoke(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncItem(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncItem_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncItem_if(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncJoined_to(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLeft(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else
+      Result := tkFunction;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLfooting(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLheading(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLine(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLines_after(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLines_before(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncList(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLoad(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLock(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLog(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else
+      Result := tkFunction;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLog10(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_auto_select(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_col(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_data(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_first(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_height(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_noheading(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_nosearch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_reduced_to(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_row(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_secondary(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_selection(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_sorted_by(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_width(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLov_with(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLowercase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncLtrim(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMail(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMenu(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMenu_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMenu_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMessage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMid(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncMod(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncModify_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNew(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNo_domain(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNobell(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNoclear_buffer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNodeadlock_exit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNoerase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNoerror(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNoexit_forward(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNoheading(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNolov_data(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNorepeat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNostatus(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNototals(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNounderlines(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkIdentifier;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncNowait(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOpen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOpen_text(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOpt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOptions(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOutput(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOutput_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncOutput_mask(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPause(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPause_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPerform(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPoly_to_binary(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPos(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPrint(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncProcedure_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncPrompt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncProtect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncQuery(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncQuery_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRandom(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRead_line(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRead_only(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReceive(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReceive_arguments(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReceive_data(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReceive_table(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReduced_to(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRelease(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRemain(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRepeat(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else
+      Result := tkKey;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReport(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReport_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncReposition(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRewind_text(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRfooting(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRheading(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRight(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRollback(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRound(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRow(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncRow_height(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSearch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSecondary(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSeconds(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSelection(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSend(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSend_data(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSend_message(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSend_table(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSequence(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSeverity(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSin(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSinh(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSorted_by(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSource(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSource_if(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSqrt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncStart_stream(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncStart_transaction(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncStatistic(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncStatus(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkIdentifier;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncStream_name(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncString(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSuccess(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkIdentifier;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSwitch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSwitch_base(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncSystem(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTable(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTable_form(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkForm
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTable_search(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTag(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTag_length(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTan(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTanh(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTarget(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncText(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsSpecial then
+      Result := tkSpecial
+    else
+      Result := tkKey;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncText_only(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTitle(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+  begin
+    if IsQuali then
+      Result := tkQualifier
+    else
+      Result := tkKey;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and (FRange = rsAdd) then
+  begin
+    Result := tkKey;
+    FRange := rsUnknown;
+  end
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTop_line(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTotal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTransfer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTrigger(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTrim(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncTsuppress(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsSpecial then
+    Result := tkSpecial
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUnload(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUppercase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkFunction
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUse_if(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUser_key(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUsing(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncUtilities(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWait(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWhile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWidth(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWith(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) and IsQuali then
+    Result := tkQualifier
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWrite(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncWrite_line(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.FuncYesno_block(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBlock
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynDmlSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+constructor TSynDmlSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FFormAttri:= TSynHighlighterAttributes.Create(SYNS_AttrForm, SYNS_FriendlyAttrForm);
+  FFormAttri.Style:= [fsBold];
+  FFormAttri.Foreground:= clBlue;
+  AddAttribute(FFormAttri);
+  FBlockAttri:= TSynHighlighterAttributes.Create(SYNS_AttrBlock, SYNS_FriendlyAttrBlock);
+  FBlockAttri.Style:= [fsBold];
+  FBlockAttri.Foreground:= clGreen;
+  AddAttribute(FBlockAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsBold];
+  FCommentAttri.Foreground:= clRed;
+  AddAttribute(FCommentAttri);
+  FQualiAttri:= TSynHighlighterAttributes.Create(SYNS_AttrQualifier, SYNS_FriendlyAttrQualifier);
+  FQualiAttri.Style:= [fsItalic];
+  FQualiAttri.Foreground:= clGreen;
+  AddAttribute(FQualiAttri);
+  FFunctionAttri:= TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
+  FFunctionAttri.Style:= [fsItalic];
+  FFunctionAttri.Foreground:= clBlack;
+  AddAttribute(FFunctionAttri);
+  FVariableAttri:= TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  FVariableAttri.Style:= [fsBold, fsItalic];
+  FVariableAttri.Foreground:= clBlack;
+  AddAttribute(FVariableAttri);
+  FSpecialAttri:= TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
+  FSpecialAttri.Style:= [fsItalic];
+  FSpecialAttri.Foreground:= clBlack;
+  AddAttribute(FSpecialAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  InitIdent;
+  FRange := rsUnknown;
+
+  FDefaultFilter := SYNS_FilterGembase;
+end;
+
+procedure TSynDmlSyn.AddressOpProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '@' then Inc(Run);
+end;
+
+procedure TSynDmlSyn.AsciiCharProc;
+
+  function IsAsciiChar: Boolean;
+  begin
+     case FLine[Run] of
+       '_', '0'..'9', 'A'..'Z', 'a'..'z':
+         Result := True;
+       else
+         Result := False;
+     end;
+  end;
+
+begin
+  // variables...
+  FTokenID := tkVariable;
+  repeat
+    Inc(Run);
+  until not IsAsciiChar;
+end;
+
+procedure TSynDmlSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynDmlSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynDmlSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '=' then Inc(Run);
+end;
+
+procedure TSynDmlSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynDmlSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynDmlSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run]= '=') or (FLine[Run]= '>') then Inc(Run);
+end;
+
+procedure TSynDmlSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynDmlSyn.NumberProc;
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while CharInSet(FLine[Run], ['0'..'9', '.']) do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynDmlSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run]='.') or (FLine[Run]=')') then Inc(Run);
+end;
+
+procedure TSynDmlSyn.RemProc;
+var
+  p: PWideChar;
+begin
+  p := PWideChar(@FLine[Run - 1]);
+  while p >= FLine do
+  begin
+    if not CharInSet(p^, [#9, #32]) then
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      Exit;
+    end;
+    Dec(p);
+  end;
+  // it is a comment...
+  FTokenID := tkComment;
+  repeat
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynDmlSyn.SpaceProc;
+begin
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynDmlSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then Inc(Run, 2);
+  repeat
+    Inc(Run);
+  until (FLine[Run] = '"') or IsLineEnd(Run);
+
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynDmlSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynDmlSyn.Next;
+begin
+  FTokenPos := Run;
+   case FLine[Run] of
+    #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    #1..#9, #11, #12, #14..#32:
+      SpaceProc;
+    '#': AsciiCharProc;
+    '"': StringProc;
+    '0'..'9': NumberProc;
+    'A'..'Z', 'a'..'z', '_':
+      IdentProc;
+    '{': SymbolProc;
+    '}': SymbolProc;
+    '!': RemProc;
+    '.': PointProc;
+    '<': LowerProc;
+    '>': GreaterProc;
+    '@': AddressOpProc;
+    #39, '&', '('..'-', '/', ':', ';', '=', '?', '['..'^', '`', '~':
+      SymbolProc;
+  else
+    UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynDmlSyn.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 TSynDmlSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynDmlSyn.GetTokenID: TtkTokenKind;
+begin
+  Result:= FTokenID;
+end;
+
+function TSynDmlSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkForm: Result := FFormAttri;
+    tkBlock: Result := FBlockAttri;
+    tkKey: Result := FKeyAttri;
+    tkComment: Result := FCommentAttri;
+    tkQualifier: Result := FQualiAttri;
+    tkFunction: Result := FFunctionAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpecial: Result := FSpecialAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkVariable: Result := FVariableAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FSymbolAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynDmlSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+function TSynDmlSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+procedure TSynDmlSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynDmlSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+function TSynDmlSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterGembase;
+end;
+
+class function TSynDmlSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGembase;
+end;
+
+class function TSynDmlSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGembase;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynDmlSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterECMAScript.pas b/Source/VCL/SynEdit/Source/SynHighlighterECMAScript.pas
new file mode 100644
index 00000000..574e6470
--- /dev/null
+++ b/Source/VCL/SynEdit/Source/SynHighlighterECMAScript.pas
@@ -0,0 +1,889 @@
+{-------------------------------------------------------------------------------
+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\Test ECMAScript\SynHighlighterECMAScript.pas, released 2020-06-21.
+Description: ECMA Script Syntax Highlighter
+The initial author of this file is Christian-W. Budde.
+Copyright (c) 2020, 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
+
+-------------------------------------------------------------------------------}
+
+unit SynHighlighterECMAScript;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (
+    tkComment,
+    tkIdentifier,
+    tkKey,
+    tkReserved,
+    tkStrict,
+    tkNull,
+    tkNumber,
+    tkSpace,
+    tkString,
+    tkSymbol,
+    tkUnknown);
+
+  TRangeState = (rsUnknown, rsMultiLineComment, rsSingleLineComment,
+    rsDoubleQuotedString, rsSingleQuotedString);
+
+  TProcTableProc = procedure of object;
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynECMAScriptSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenId: TtkTokenKind;
+    FIdentFuncTable: array[0..108] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncKeyWord(Index: Integer): TtkTokenKind;
+    function FuncReservedWord(Index: Integer): TtkTokenKind;
+    function FuncStrictMode(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure AndSymbolProc;
+    procedure BackslashProc;
+    procedure CRProc;
+    procedure CoalesceProc;
+    procedure EqualsProc;
+    procedure GreaterProc;
+    procedure Hex4DigitProc;
+    procedure InitIdent;
+    procedure IdentProc;
+    procedure LessProc;
+    procedure LFProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure MultiLineCommentProc;
+    procedure NotProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure DotProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure SymbolProc;
+    procedure UnknownProc;
+    procedure XorSymbolProc;
+  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 CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+resourcestring
+  SYNS_FilterECMAScript = 'JavaScript files (*.js)|*.js';
+  SYNS_LangECMAScript = 'ECMA Script';
+  SYNS_FriendlyLangECMAScript = 'ECMA Script';
+
+const
+  // as this language is case-insensitive keywords *must* be in lowercase
+  KeyWords: array[0..52] of UnicodeString = (
+    'as', 'async', 'await', 'break', 'case', 'catch', 'class', 'const',
+    'continue', 'debugger', 'default', 'delete', 'do', 'else', 'enum', 'export',
+    'extends', 'false', 'finally', 'for', 'from', 'function', 'get', 'if',
+    'implements', 'import', 'in', 'instance', 'interface', 'let', 'new', 'null',
+    'of', 'package', 'private', 'protected', 'public', 'return', 'set',
+    'static', 'super', 'switch', 'target', 'this', 'throw', 'true', 'try',
+    'typeof', 'var', 'void', 'while', 'with', 'yield'
+  );
+
+  KeyIndices: array[0..108] of Integer = (
+    -1, 25, -1, 42, -1, 52, 48, 10, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1,
+    4, 46, -1, 5, 30, -1, -1, 27, 20, -1, -1, 32, 51, -1, 38, 13, -1, 28, 12,
+    -1, -1, 19, 41, -1, 3, -1, -1, -1, 9, 6, -1, 24, 34, -1, -1, 36, 16, 49, -1,
+    22, 17, -1, -1, 35, -1, 21, 0, -1, -1, -1, -1, 50, 11, -1, 40, 18, -1, 7,
+    -1, -1, 39, 44, -1, -1, 47, 31, 43, 26, -1, -1, -1, -1, 33, 23, 29, 14, -1,
+    45, 37, -1, 8, -1, -1, -1, -1, -1, -1, 1, -1, 15
+  );
+
+constructor TSynECMAScriptSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  FCommentAttri.Foreground := clNavy;
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+
+  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterECMAScript;
+  FRange := rsUnknown;
+end;
+
+procedure TSynECMAScriptSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[12] := FuncReservedWord;
+  FIdentFuncTable[65] := FuncKeyWord;
+  FIdentFuncTable[106] := FuncKeyWord;
+  FIdentFuncTable[43] := FuncReservedWord;
+  FIdentFuncTable[19] := FuncReservedWord;
+  FIdentFuncTable[22] := FuncReservedWord;
+  FIdentFuncTable[48] := FuncReservedWord;
+  FIdentFuncTable[76] := FuncReservedWord;
+  FIdentFuncTable[99] := FuncReservedWord;
+  FIdentFuncTable[47] := FuncReservedWord;
+  FIdentFuncTable[7] := FuncReservedWord;
+  FIdentFuncTable[71] := FuncReservedWord;
+  FIdentFuncTable[37] := FuncReservedWord;
+  FIdentFuncTable[34] := FuncReservedWord;
+  FIdentFuncTable[94] := FuncReservedWord;
+  FIdentFuncTable[108] := FuncReservedWord;
+  FIdentFuncTable[55] := FuncReservedWord;
+  FIdentFuncTable[59] := FuncReservedWord;
+  FIdentFuncTable[74] := FuncReservedWord;
+  FIdentFuncTable[40] := FuncReservedWord;
+  FIdentFuncTable[27] := FuncKeyWord;
+  FIdentFuncTable[64] := FuncReservedWord;
+  FIdentFuncTable[58] := FuncKeyWord;
+  FIdentFuncTable[92] := FuncReservedWord;
+  FIdentFuncTable[50] := FuncStrictMode;
+  FIdentFuncTable[1] := FuncReservedWord;
+  FIdentFuncTable[86] := FuncReservedWord;
+  FIdentFuncTable[26] := FuncReservedWord;
+  FIdentFuncTable[36] := FuncStrictMode;
+  FIdentFuncTable[93] := FuncStrictMode;
+  FIdentFuncTable[23] := FuncReservedWord;
+  FIdentFuncTable[84] := FuncReservedWord;
+  FIdentFuncTable[30] := FuncKeyWord;
+  FIdentFuncTable[91] := FuncStrictMode;
+  FIdentFuncTable[51] := FuncStrictMode;
+  FIdentFuncTable[62] := FuncStrictMode;
+  FIdentFuncTable[54] := FuncStrictMode;
+  FIdentFuncTable[97] := FuncReservedWord;
+  FIdentFuncTable[33] := FuncKeyWord;
+  FIdentFuncTable[79] := FuncStrictMode;
+  FIdentFuncTable[73] := FuncReservedWord;
+  FIdentFuncTable[41] := FuncReservedWord;
+  FIdentFuncTable[3] := FuncKeyWord;
+  FIdentFuncTable[85] := FuncReservedWord;
+  FIdentFuncTable[80] := FuncReservedWord;
+  FIdentFuncTable[96] := FuncReservedWord;
+  FIdentFuncTable[20] := FuncReservedWord;
+  FIdentFuncTable[83] := FuncReservedWord;
+  FIdentFuncTable[6] := FuncReservedWord;
+  FIdentFuncTable[56] := FuncReservedWord;
+  FIdentFuncTable[70] := FuncReservedWord;
+  FIdentFuncTable[31] := FuncReservedWord;
+  FIdentFuncTable[5] := FuncReservedWord;
+end;
+
+{$Q-}
+function TSynECMAScriptSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 474 + Ord(Str^) * 408;
+    Inc(Str);
+  end;
+  Result := Result mod 109;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynECMAScriptSyn.FuncReservedWord(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkReserved
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynECMAScriptSyn.FuncStrictMode(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkStrict
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynECMAScriptSyn.FuncKeyWord(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynECMAScriptSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+procedure TSynECMAScriptSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['=', '&']) then
+    Inc(Run);
+end;
+
+function TSynECMAScriptSyn.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 TSynECMAScriptSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenId := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.CoalesceProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '?' then
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.NotProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '=' then
+  begin
+    Inc(Run);
+    if FLine[Run] = '=' then
+      Inc(Run);
+  end;
+end;
+
+procedure TSynECMAScriptSyn.NullProc;
+begin
+  FTokenId := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.CRProc;
+begin
+  FTokenId := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.LFProc;
+begin
+  FTokenId := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.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 TSynECMAScriptSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['=', '|']) then Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.EqualsProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  case FLine[Run] of
+    '=':
+      begin
+        Inc(Run);
+        if FLine[Run] = '=' then
+          Inc(Run);
+      end;
+    '>':
+      Inc(Run);
+  end;
+end;
+
+procedure TSynECMAScriptSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  case FLine[Run] of
+    '=':
+      Inc(Run);
+    '>':
+      begin
+        Inc(Run);
+        case FLine[Run] of
+          '=':
+            Inc(Run);
+          '>':
+            begin
+              Inc(Run);
+              if FLine[Run] = '=' then
+                Inc(Run);
+            end;
+        end;
+      end;
+  end;
+end;
+
+procedure TSynECMAScriptSyn.LessProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  case FLine[Run] of
+    '=':
+      Inc(Run);
+    '<':
+      begin
+        Inc(Run);
+        if FLine[Run] = '=' then
+          Inc(Run);
+      end;
+  end;
+end;
+
+procedure TSynECMAScriptSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['=', '+']) then
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.DotProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2);
+end;
+
+procedure TSynECMAScriptSyn.SlashProc;
+begin
+  Inc(Run);
+  case FLine[Run] of
+    '/':
+      begin
+        FTokenId := tkComment;
+        FRange := rsSingleLineComment;
+        repeat
+          Inc(Run);
+        until IsLineEnd(Run);
+        FTokenId := tkComment;
+      end;
+    '*':
+      begin
+        Inc(Run, 1);
+        FRange := rsMultiLineComment;
+        FTokenId := tkComment;
+        repeat
+          Inc(Run);
+           if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+           begin
+             FRange := rsUnknown;
+             Inc(Run, 2);
+             Break;
+           end;
+         until IsLineEnd(Run);
+      end;
+    '=':
+      begin
+        Inc(Run);
+        FTokenID := tkSymbol;
+      end;
+  end;
+end;
+
+procedure TSynECMAScriptSyn.MultiLineCommentProc;
+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 TSynECMAScriptSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  case FLine[Run] of
+    '=':
+      Inc(Run);
+    '*':
+      begin
+        Inc(Run);
+        if FLine[Run] = '=' then
+          Inc(Run);
+      end;
+  end;
+end;
+
+procedure TSynECMAScriptSyn.StringProc;
+var
+  QuoteChar: UnicodeString;
+begin
+  FTokenID := tkString;
+  QuoteChar := FLine[Run];   // We could have '"' or #39
+  if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) then Inc(Run, 2);
+  repeat
+    if IsLineEnd(Run) then
+      Break;
+    Inc(Run);
+  until (FLine[Run] = QuoteChar) and (FLine[Pred(Run)] <> '\');
+  if not IsLineEnd(Run) then
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.Hex4DigitProc;
+var
+  i: Integer;
+
+  function IsHexDigit(AChar: WideChar): Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'a'..'f', 'A'..'F':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  for i := 0 to 3 do
+  begin
+    if not IsHexDigit(FLine[Run]) then
+    begin
+      FTokenId := tkUnknown;
+      Exit;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynECMAScriptSyn.BackslashProc;
+begin
+  Inc(Run);
+  if FLine[Run] = 'u' then
+  begin
+    Inc(Run);
+    Hex4DigitProc;
+  end
+  else
+    FTokenId := tkUnknown;
+end;
+
+procedure TSynECMAScriptSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '=' then Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.SymbolProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynECMAScriptSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenId := tkUnknown;
+end;
+
+procedure TSynECMAScriptSyn.XorSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+  if FLine[Run] = '=' then
+    Inc(Run);
+end;
+
+procedure TSynECMAScriptSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsMultiLineComment: MultiLineCommentProc;
+  else
+    case FLine[Run] of
+      #0:
+        NullProc;
+      #10:
+        LFProc;
+      #13:
+        CRProc;
+      #1..#9, #11, #12, #14..#32:
+        SpaceProc;
+      '"', #39:
+        StringProc;
+      '%':
+        ModSymbolProc;
+      '&':
+        AndSymbolProc;
+      '.':
+        DotProc;
+      '/':
+        SlashProc;
+      '-':
+        MinusProc;
+      '\':
+        BackslashProc;
+      '|':
+        OrSymbolProc;
+      '(', ')':
+        SymbolProc;
+      '*':
+        StarProc;
+      '+':
+        PlusProc;
+      '=':
+        EqualsProc;
+      '>':
+        GreaterProc;
+      '<':
+        LessProc;
+      '!':
+        NotProc;
+      '?':
+        CoalesceProc;
+      '^':
+        XorSymbolProc;
+      '~', ',', '[', ']', ':', ';', '{', '}':
+        SymbolProc;
+      '0'..'9':
+        NumberProc;
+      'A'..'Z', 'a'..'z', '_', '$', #$AA, #$B5, #$BA, #$C0..#$D6, #$D8..#$F6,
+      #$0F8..#$2C1:
+        IdentProc;
+    else
+      UnknownProc;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynECMAScriptSyn.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 TSynECMAScriptSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynECMAScriptSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+begin
+  Result :=
+    'as,async,await,break,case,catch,class,const,continue,debugger,default,' +
+    'delete,do,else,enum,export,extends,false,finally,for,from,function,' +
+    'get,if,implements,import,in,instance,interface,let,new,null,of,package,' +
+    'private,protected,public,return,set,static,super,switch,target,this,' +
+    'throw,true,try,typeof,var,void,while,with,yield';
+end;
+
+function TSynECMAScriptSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenId;
+end;
+
+function TSynECMAScriptSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkComment:
+      Result := FCommentAttri;
+    tkIdentifier:
+      Result := FIdentifierAttri;
+    tkKey:
+      Result := FKeyAttri;
+    tkReserved:
+      Result := FKeyAttri;
+    tkNumber:
+      Result := FNumberAttri;
+    tkStrict:
+      Result := FKeyAttri;
+    tkSpace:
+      Result := FSpaceAttri;
+    tkString:
+      Result := FStringAttri;
+    tkSymbol:
+      Result := FSymbolAttri;
+    tkUnknown:
+      Result := FIdentifierAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynECMAScriptSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenId);
+end;
+
+function TSynECMAScriptSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    'A'..'Z', 'a'..'z', '_', '$', #$AA, #$B5, #$BA, #$C0..#$D6, #$D8..#$F6,
+    #$0F8..#$2C1:
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+function TSynECMAScriptSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '// Syntax highlighting'#13#10 +
+    'function printNumber()'#13#10 +
+    '{'#13#10 +
+    '  var number = 1234;'#13#10 +
+    '  var x;'#13#10 +
+    '  document.write("The number is " + number);'#13#10 +
+    '  for (var i = 0; i <= number; i++)'#13#10 +
+    '  {'#13#10 +
+    '    x++;'#13#10 +
+    '    x--;'#13#10 +
+    '    x += 1.0;'#13#10 +
+    '  }'#13#10 +
+    '  i += @; // illegal character'#13#10 +
+    '}'#13#10 +
+    'body.onLoad = printNumber;';
+end;
+
+function TSynECMAScriptSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterECMAScript;
+end;
+
+class function TSynECMAScriptSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangECMAScript;
+end;
+
+class function TSynECMAScriptSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangECMAScript;
+end;
+
+procedure TSynECMAScriptSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynECMAScriptSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynECMAScriptSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+initialization
+  RegisterPlaceableHighlighter(TSynECMAScriptSyn);
+
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterEiffel.pas b/Source/VCL/SynEdit/Source/SynHighlighterEiffel.pas
index dfdc7cf4..46ba345b 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterEiffel.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterEiffel.pas
@@ -1,1553 +1,1555 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterEiffel.pas, released 2004-03-08.
-Description: Eiffel Syntax Parser/Highlighter
-The initial author of this file is Massimo Maria Ghisalberti (nissl).
-Unicode translation by Maël Hörz.
-Copyright (c) 2004, 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: SynHighlighterEiffel.pas,v 1.3.2.8 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-{
-@abstract(Provides an Eiffel highlighter for SynEdit)
-@author(Massimo Maria Ghisalberti (nissl@mammuth.it, nissl@linee.it - www.linee.it)
-@created(03-08-2004)
-@lastmod(03-08-2004)
-The SynHighlighterEiffel unit provides SynEdit with an Eiffel highlighter.
-}
-
-unit SynHighlighterEiffel;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (
-    tkBasicTypes,
-    tkComment,
-    tkIdentifier,
-    tkKey,
-    tkLace,
-    tkNull,
-    tkOperatorAndSymbols,
-    tkPredefined,
-    tkResultValue,
-    tkSpace,
-    tkString,
-    tkUnknown);
-
-  TRangeState = (rsUnKnown, rsEiffelComment, rsString, rsOperatorAndSymbolProc);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynEiffelSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..502] of TIdentFuncTableFunc;
-    fBasicTypesAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fLaceAttri: TSynHighlighterAttributes;
-    fOperatorAndSymbolsAttri: TSynHighlighterAttributes;
-    fPredefinedAttri: TSynHighlighterAttributes;
-    fResultValueAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function OperatorFunc(Index: Integer): TtkTokenKind;
-    function Func37u(Index: Integer): TtkTokenKind;
-    function FuncAdapt(Index: Integer): TtkTokenKind;
-    function FuncAlias(Index: Integer): TtkTokenKind;
-    function FuncAll(Index: Integer): TtkTokenKind;
-    function FuncAnd(Index: Integer): TtkTokenKind;
-    function FuncArray(Index: Integer): TtkTokenKind;
-    function FuncAs(Index: Integer): TtkTokenKind;
-    function FuncAssertion(Index: Integer): TtkTokenKind;
-    function FuncBit(Index: Integer): TtkTokenKind;
-    function FuncBoolean(Index: Integer): TtkTokenKind;
-    function FuncCharacter(Index: Integer): TtkTokenKind;
-    function FuncCheck(Index: Integer): TtkTokenKind;
-    function FuncClass(Index: Integer): TtkTokenKind;
-    function FuncCluster(Index: Integer): TtkTokenKind;
-    function FuncColon(Index: Integer): TtkTokenKind;
-    function FuncComma(Index: Integer): TtkTokenKind;
-    function FuncCreation(Index: Integer): TtkTokenKind;
-    function FuncCurrent(Index: Integer): TtkTokenKind;
-    function FuncDebug(Index: Integer): TtkTokenKind;
-    function FuncDefault(Index: Integer): TtkTokenKind;
-    function FuncDeferred(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncDouble(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncElseif(Index: Integer): TtkTokenKind;
-    function FuncEnd(Index: Integer): TtkTokenKind;
-    function FuncEnsure(Index: Integer): TtkTokenKind;
-    function FuncExclude(Index: Integer): TtkTokenKind;
-    function FuncExecutable(Index: Integer): TtkTokenKind;
-    function FuncExpanded(Index: Integer): TtkTokenKind;
-    function FuncExport(Index: Integer): TtkTokenKind;
-    function FuncExternal(Index: Integer): TtkTokenKind;
-    function FuncFalse(Index: Integer): TtkTokenKind;
-    function FuncFeature(Index: Integer): TtkTokenKind;
-    function FuncFrom(Index: Integer): TtkTokenKind;
-    function FuncFrozen(Index: Integer): TtkTokenKind;
-    function FuncGenerate(Index: Integer): TtkTokenKind;
-    function FuncIdentifier(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncIgnore(Index: Integer): TtkTokenKind;
-    function FuncImplies(Index: Integer): TtkTokenKind;
-    function FuncInclude(Index: Integer): TtkTokenKind;
-    function FuncInclude95path(Index: Integer): TtkTokenKind;
-    function FuncIndexing(Index: Integer): TtkTokenKind;
-    function FuncInfix(Index: Integer): TtkTokenKind;
-    function FuncInherit(Index: Integer): TtkTokenKind;
-    function FuncInspect(Index: Integer): TtkTokenKind;
-    function FuncInteger(Index: Integer): TtkTokenKind;
-    function FuncInvariant(Index: Integer): TtkTokenKind;
-    function FuncIs(Index: Integer): TtkTokenKind;
-    function FuncLike(Index: Integer): TtkTokenKind;
-    function FuncLocal(Index: Integer): TtkTokenKind;
-    function FuncLoop(Index: Integer): TtkTokenKind;
-    function FuncMake(Index: Integer): TtkTokenKind;
-    function FuncNo(Index: Integer): TtkTokenKind;
-    function FuncNot(Index: Integer): TtkTokenKind;
-    function FuncObject(Index: Integer): TtkTokenKind;
-    function FuncObsolete(Index: Integer): TtkTokenKind;
-    function FuncOld(Index: Integer): TtkTokenKind;
-    function FuncOnce(Index: Integer): TtkTokenKind;
-    function FuncOptimize(Index: Integer): TtkTokenKind;
-    function FuncOption(Index: Integer): TtkTokenKind;
-    function FuncOr(Index: Integer): TtkTokenKind;
-    function FuncPointer(Index: Integer): TtkTokenKind;
-    function FuncPrecompiled(Index: Integer): TtkTokenKind;
-    function FuncPrecursor(Index: Integer): TtkTokenKind;
-    function FuncPrefix(Index: Integer): TtkTokenKind;
-    function FuncReal(Index: Integer): TtkTokenKind;
-    function FuncRedefine(Index: Integer): TtkTokenKind;
-    function FuncRename(Index: Integer): TtkTokenKind;
-    function FuncRequire(Index: Integer): TtkTokenKind;
-    function FuncRescue(Index: Integer): TtkTokenKind;
-    function FuncResult(Index: Integer): TtkTokenKind;
-    function FuncRetry(Index: Integer): TtkTokenKind;
-    function FuncRoot(Index: Integer): TtkTokenKind;
-    function FuncSelect(Index: Integer): TtkTokenKind;
-    function FuncSeparate(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
-    function FuncStrip(Index: Integer): TtkTokenKind;
-    function FuncSystem(Index: Integer): TtkTokenKind;
-    function FuncThen(Index: Integer): TtkTokenKind;
-    function FuncTrace(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncUndefine(Index: Integer): TtkTokenKind;
-    function FuncUnique(Index: Integer): TtkTokenKind;
-    function FuncUntil(Index: Integer): TtkTokenKind;
-    function FuncUse(Index: Integer): TtkTokenKind;
-    function FuncVariant(Index: Integer): TtkTokenKind;
-    function FuncVisible(Index: Integer): TtkTokenKind;
-    function FuncVoid(Index: Integer): TtkTokenKind;
-    function FuncWhen(Index: Integer): TtkTokenKind;
-    function FuncXor(Index: Integer): TtkTokenKind;
-    function FuncYes(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure IdentProc;
-    procedure InitIdent;
-    procedure OperatorAndSymbolProc;
-    procedure UnknownProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure CRProc;
-    procedure LFProc;
-    procedure EiffelCommentOpenProc;
-    procedure EiffelCommentProc;
-    procedure StringOpenProc;
-    procedure StringProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: 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): string; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    function IsOperatorChar(AChar: WideChar): Boolean;
-  published
-    property BasicTypesAttri: TSynHighlighterAttributes read fBasicTypesAttri write fBasicTypesAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property LaceAttri: TSynHighlighterAttributes read fLaceAttri write fLaceAttri;
-    property OperatorAndSymbolsAttri: TSynHighlighterAttributes read fOperatorAndSymbolsAttri write fOperatorAndSymbolsAttri;
-    property PredefinedAttri: TSynHighlighterAttributes read fPredefinedAttri write fPredefinedAttri;
-    property ResultValueAttri: TSynHighlighterAttributes read fResultValueAttri write fResultValueAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..118] of string = (
-    '-', '!', '#', '$', '%u', '&', '(', ')', '*', '.', '/', '//', '/=', ':', 
-    ':=', ';', '@', '[', '\\', ']', '^', '|', '+', '<', '<>', '=', '>', 'adapt', 
-    'alias', 'all', 'and', 'array', 'as', 'assertion', 'bit', 'boolean', 
-    'character', 'check', 'class', 'cluster', 'colon', 'comma', 'creation', 
-    'current', 'debug', 'default', 'deferred', 'do', 'double', 'else', 'elseif', 
-    'end', 'ensure', 'exclude', 'executable', 'expanded', 'export', 'external', 
-    'false', 'feature', 'from', 'frozen', 'generate', 'identifier', 'if', 
-    'ignore', 'implies', 'include', 'include_path', 'indexing', 'infix', 
-    'inherit', 'inspect', 'integer', 'invariant', 'is', 'like', 'local', 'loop', 
-    'make', 'no', 'not', 'object', 'obsolete', 'old', 'once', 'optimize', 
-    'option', 'or', 'pointer', 'precompiled', 'precursor', 'prefix', 'real', 
-    'redefine', 'rename', 'require', 'rescue', 'result', 'retry', 'root', 
-    'select', 'separate', 'string', 'strip', 'system', 'then', 'trace', 'true', 
-    'undefine', 'unique', 'until', 'use', 'variant', 'visible', 'void', 'when', 
-    'xor', 'yes' 
-  );
-
-  KeyIndices: array[0..502] of Integer = (
-    -1, 49, -1, -1, -1, 97, 69, 85, -1, -1, -1, 106, -1, -1, 37, -1, -1, 63, -1, 
-    92, -1, -1, -1, -1, 108, 82, 16, -1, -1, -1, -1, -1, 86, -1, 0, -1, -1, 66, 
-    -1, -1, -1, -1, 91, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 13, -1, 
-    -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 110, -1, 1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, 9, 
-    -1, -1, -1, -1, -1, -1, 68, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 15, 105, -1, -1, -1, 51, -1, -1, 6, -1, 96, -1, -1, 17, -1, -1, 55, -1, 
-    -1, -1, -1, -1, 117, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, 
-    -1, 62, -1, 59, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 83, 10, 95, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 65, 18, 23, -1, -1, -1, 35, -1, -1, -1, 7, -1, -1, 32, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 90, -1, 103, -1, -1, 80, -1, 
-    -1, -1, -1, 2, -1, 34, -1, -1, -1, -1, -1, -1, 41, -1, 27, 112, -1, -1, -1, 
-    33, -1, 44, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, -1, 93, -1, -1, -1, 8, 46, 102, -1, 
-    -1, 19, 87, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, 84, 53, -1, -1, 
-    -1, 71, -1, -1, 11, -1, 3, 107, 67, -1, 64, 47, -1, -1, -1, -1, -1, 24, -1, 
-    -1, -1, 114, -1, -1, -1, 116, -1, -1, -1, -1, 81, 75, -1, -1, -1, -1, -1, 
-    -1, -1, 100, -1, -1, -1, -1, -1, 54, -1, -1, 26, 115, -1, -1, -1, -1, -1, 
-    78, 22, 36, -1, 74, -1, 20, -1, -1, 42, -1, 99, -1, -1, -1, -1, -1, -1, -1, 
-    73, -1, 52, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 4, 94, -1, 
-    -1, 40, -1, -1, 39, -1, -1, -1, -1, 45, -1, 12, -1, -1, -1, 72, 38, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 28, 48, -1, -1, -1, -1, -1, 101, -1, 118, 
-    -1, -1, 57, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 70, -1, 89, -1, -1, 111, -1 
-  );
-
-{$Q-}
-function TSynEiffelSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) or IsOperatorChar(Str^) do
-  begin
-    Result := Result * 543 + Ord(Str^) * 79;
-    inc(Str);
-  end;
-  Result := Result mod 503;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynEiffelSyn.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 TSynEiffelSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[34] := OperatorFunc;
-  fIdentFuncTable[92] := OperatorFunc;
-  fIdentFuncTable[250] := OperatorFunc;
-  fIdentFuncTable[329] := OperatorFunc;
-  fIdentFuncTable[413] := Func37u;
-  fIdentFuncTable[487] := OperatorFunc;
-  fIdentFuncTable[142] := OperatorFunc;
-  fIdentFuncTable[221] := OperatorFunc;
-  fIdentFuncTable[300] := OperatorFunc;
-  fIdentFuncTable[113] := OperatorFunc;
-  fIdentFuncTable[192] := OperatorFunc;
-  fIdentFuncTable[327] := OperatorFunc;
-  fIdentFuncTable[427] := OperatorFunc;
-  fIdentFuncTable[55] := OperatorFunc;
-  fIdentFuncTable[480] := OperatorFunc;
-  fIdentFuncTable[134] := OperatorFunc;
-  fIdentFuncTable[26] := OperatorFunc;
-  fIdentFuncTable[147] := OperatorFunc;
-  fIdentFuncTable[212] := OperatorFunc;
-  fIdentFuncTable[305] := OperatorFunc;
-  fIdentFuncTable[384] := OperatorFunc;
-  fIdentFuncTable[239] := OperatorFunc;
-  fIdentFuncTable[379] := OperatorFunc;
-  fIdentFuncTable[213] := OperatorFunc;
-  fIdentFuncTable[340] := OperatorFunc;
-  fIdentFuncTable[292] := OperatorFunc;
-  fIdentFuncTable[371] := OperatorFunc;
-  fIdentFuncTable[261] := FuncAdapt;
-  fIdentFuncTable[462] := FuncAlias;
-  fIdentFuncTable[402] := FuncAll;
-  fIdentFuncTable[54] := FuncAnd;
-  fIdentFuncTable[105] := FuncArray;
-  fIdentFuncTable[224] := FuncAs;
-  fIdentFuncTable[266] := FuncAssertion;
-  fIdentFuncTable[252] := FuncBit;
-  fIdentFuncTable[217] := FuncBoolean;
-  fIdentFuncTable[380] := FuncCharacter;
-  fIdentFuncTable[14] := FuncCheck;
-  fIdentFuncTable[432] := FuncClass;
-  fIdentFuncTable[420] := FuncCluster;
-  fIdentFuncTable[417] := FuncColon;
-  fIdentFuncTable[259] := FuncComma;
-  fIdentFuncTable[387] := FuncCreation;
-  fIdentFuncTable[311] := FuncCurrent;
-  fIdentFuncTable[268] := FuncDebug;
-  fIdentFuncTable[425] := FuncDefault;
-  fIdentFuncTable[301] := FuncDeferred;
-  fIdentFuncTable[334] := FuncDo;
-  fIdentFuncTable[463] := FuncDouble;
-  fIdentFuncTable[1] := FuncElse;
-  fIdentFuncTable[270] := FuncElseif;
-  fIdentFuncTable[139] := FuncEnd;
-  fIdentFuncTable[399] := FuncEnsure;
-  fIdentFuncTable[320] := FuncExclude;
-  fIdentFuncTable[368] := FuncExecutable;
-  fIdentFuncTable[150] := FuncExpanded;
-  fIdentFuncTable[167] := FuncExport;
-  fIdentFuncTable[474] := FuncExternal;
-  fIdentFuncTable[85] := FuncFalse;
-  fIdentFuncTable[174] := FuncFeature;
-  fIdentFuncTable[411] := FuncFrom;
-  fIdentFuncTable[63] := FuncFrozen;
-  fIdentFuncTable[172] := FuncGenerate;
-  fIdentFuncTable[17] := FuncIdentifier;
-  fIdentFuncTable[333] := FuncIf;
-  fIdentFuncTable[211] := FuncIgnore;
-  fIdentFuncTable[37] := FuncImplies;
-  fIdentFuncTable[331] := FuncInclude;
-  fIdentFuncTable[120] := FuncInclude95path;
-  fIdentFuncTable[6] := FuncIndexing;
-  fIdentFuncTable[496] := FuncInfix;
-  fIdentFuncTable[324] := FuncInherit;
-  fIdentFuncTable[431] := FuncInspect;
-  fIdentFuncTable[397] := FuncInteger;
-  fIdentFuncTable[382] := FuncInvariant;
-  fIdentFuncTable[354] := FuncIs;
-  fIdentFuncTable[71] := FuncLike;
-  fIdentFuncTable[160] := FuncLocal;
-  fIdentFuncTable[378] := FuncLoop;
-  fIdentFuncTable[181] := FuncMake;
-  fIdentFuncTable[245] := FuncNo;
-  fIdentFuncTable[353] := FuncNot;
-  fIdentFuncTable[25] := FuncObject;
-  fIdentFuncTable[191] := FuncObsolete;
-  fIdentFuncTable[319] := FuncOld;
-  fIdentFuncTable[7] := FuncOnce;
-  fIdentFuncTable[32] := FuncOptimize;
-  fIdentFuncTable[306] := FuncOption;
-  fIdentFuncTable[121] := FuncOr;
-  fIdentFuncTable[498] := FuncPointer;
-  fIdentFuncTable[240] := FuncPrecompiled;
-  fIdentFuncTable[42] := FuncPrecursor;
-  fIdentFuncTable[19] := FuncPrefix;
-  fIdentFuncTable[296] := FuncReal;
-  fIdentFuncTable[414] := FuncRedefine;
-  fIdentFuncTable[193] := FuncRename;
-  fIdentFuncTable[144] := FuncRequire;
-  fIdentFuncTable[5] := FuncRescue;
-  fIdentFuncTable[43] := FuncResult;
-  fIdentFuncTable[389] := FuncRetry;
-  fIdentFuncTable[362] := FuncRoot;
-  fIdentFuncTable[469] := FuncSelect;
-  fIdentFuncTable[302] := FuncSeparate;
-  fIdentFuncTable[242] := FuncString;
-  fIdentFuncTable[282] := FuncStrip;
-  fIdentFuncTable[135] := FuncSystem;
-  fIdentFuncTable[11] := FuncThen;
-  fIdentFuncTable[330] := FuncTrace;
-  fIdentFuncTable[24] := FuncTrue;
-  fIdentFuncTable[452] := FuncUndefine;
-  fIdentFuncTable[90] := FuncUnique;
-  fIdentFuncTable[501] := FuncUntil;
-  fIdentFuncTable[262] := FuncUse;
-  fIdentFuncTable[195] := FuncVariant;
-  fIdentFuncTable[344] := FuncVisible;
-  fIdentFuncTable[372] := FuncVoid;
-  fIdentFuncTable[348] := FuncWhen;
-  fIdentFuncTable[156] := FuncXor;
-  fIdentFuncTable[471] := FuncYes;
-end;
-
-function TSynEiffelSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.OperatorFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkOperatorAndSymbols
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.Func37u(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAdapt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAlias(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAll(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAnd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncArray(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncAssertion(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncBit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncBoolean(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncCharacter(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncCheck(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncClass(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncCluster(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncColon(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncComma(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncCreation(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncCurrent(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncDebug(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncDefault(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncDeferred(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncDo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncDouble(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncElseif(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncEnd(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncEnsure(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncExclude(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncExecutable(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncExpanded(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncExport(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncExternal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncFalse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncFeature(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncFrom(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncFrozen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncGenerate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncIdentifier(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncIgnore(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncImplies(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInclude(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInclude95path(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncIndexing(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInfix(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInherit(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInspect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInteger(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncInvariant(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncIs(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncLike(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncLocal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncLoop(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncMake(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncNo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncNot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncObject(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncObsolete(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncOld(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncOnce(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncOptimize(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncOption(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncOr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncPointer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncPrecompiled(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncPrecursor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncPrefix(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncReal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRedefine(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRename(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRequire(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRescue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncResult(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkResultValue
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRetry(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncRoot(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncSelect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncSeparate(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkBasicTypes
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncStrip(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncSystem(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncThen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncTrace(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncTrue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncUndefine(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncUnique(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncUntil(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncUse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncVariant(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncVisible(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncVoid(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkPredefined
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncWhen(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncXor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynEiffelSyn.FuncYes(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkLace
-  else
-    Result := tkIdentifier;
-end;
-
-procedure TSynEiffelSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynEiffelSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynEiffelSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
-    inc(Run);
-end;
-
-procedure TSynEiffelSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynEiffelSyn.OperatorAndSymbolProc;
-begin
-  fTokenID := tkIdentifier;
-  if fLine[Run] = #33 then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-  if CharInSet(fLine[Run], [#35..#44]) then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-  if CharInSet(fLine[Run], [#46..#47]) then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-  if CharInSet(fLine[Run], [#58..#64]) then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-  if CharInSet(fLine[Run], [#91..#96]) then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-  if CharInSet(fLine[Run], [#123..#127]) then
-    begin
-      fRange := rsOperatorAndSymbolProc;
-      fTokenID := tkOperatorAndSymbols;
-      Inc(Run);
-      Exit;
-    end;
-end;
-
-procedure TSynEiffelSyn.EiffelCommentOpenProc;
-begin
-  Inc(Run);
-  if (fLine[Run - 1] = '-') and (fLine[Run] = '-') then
-    begin
-      fRange := rsEiffelComment;
-      EiffelCommentProc;
-      fTokenID := tkComment;
-    end
-  else
-    fTokenID := tkOperatorAndSymbols;
-end;
-
-procedure TSynEiffelSyn.EiffelCommentProc;
-begin
-  fTokenID := tkComment;
-  repeat
-    if not IsLineEnd(Run) then
-      Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynEiffelSyn.StringOpenProc;
-begin
-  Inc(Run);
-  fRange := rsString;
-  StringProc;
-  fTokenID := tkString;
-end;
-
-procedure TSynEiffelSyn.StringProc;
-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;
-
-constructor TSynEiffelSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fBasicTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrBasicTypes, SYNS_FriendlyAttrBasicTypes);
-  fBasicTypesAttri.Style := [fsBold];
-  fBasicTypesAttri.Foreground := clBlue;
-  AddAttribute(fBasicTypesAttri);
-
-  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  fCommentAttri.Foreground := clTeal;
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  fIdentifierAttri.Foreground := clMaroon;
-  AddAttribute(fIdentifierAttri);
-
-  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  fKeyAttri.Foreground := clNavy;
-  AddAttribute(fKeyAttri);
-
-  fLaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrLace, SYNS_FriendlyAttrLace);
-  fLaceAttri.Style := [fsBold];
-  fLaceAttri.Foreground := clNavy;
-  AddAttribute(fLaceAttri);
-
-  fOperatorAndSymbolsAttri := TSynHighLighterAttributes.Create(SYNS_AttrOperatorAndSymbols, SYNS_FriendlyAttrOperatorAndSymbols);
-  fOperatorAndSymbolsAttri.Style := [fsBold];
-  fOperatorAndSymbolsAttri.Foreground := clOlive;
-  AddAttribute(fOperatorAndSymbolsAttri);
-
-  fPredefinedAttri := TSynHighLighterAttributes.Create(SYNS_AttrPredefined, SYNS_FriendlyAttrPredefined);
-  fPredefinedAttri.Style := [fsBold];
-  fPredefinedAttri.Foreground := clRed;
-  AddAttribute(fPredefinedAttri);
-
-  fResultValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrResultValue, SYNS_FriendlyAttrResultValue);
-  fResultValueAttri.Style := [fsBold];
-  fResultValueAttri.Foreground := clPurple;
-  AddAttribute(fResultValueAttri);
-
-  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  fStringAttri.Style := [fsItalic];
-  fStringAttri.Foreground := clGray;
-  AddAttribute(fStringAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterEiffel;
-  fRange := rsUnknown;
-end;
-
-procedure TSynEiffelSyn.IdentProc;
-begin
-  fTokenID := IdentKind(fLine + Run);
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do
-    Inc(Run);
-end;
-
-procedure TSynEiffelSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynEiffelSyn.Next;
-begin
-  fTokenPos := Run;
-  fRange := rsUnknown;
-  case fLine[Run] of
-    #33, #35..#44, #46..#47, #58..#64, #91..#96, #123..#127: OperatorAndSymbolProc;
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    '-': EiffelCommentOpenProc;
-    '"': StringOpenProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    'A'..'Z', 'a'..'z': IdentProc;
-    else UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynEiffelSyn.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 TSynEiffelSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynEiffelSyn.GetKeyWords(TokenKind: Integer): string;
-begin
-  Result :=
-    '-,!,#,$,%U,&,(,),*,.,/,//,/=,:,:=,;,@,[,\\,],^,|,+,<,<>,=,>,adapt,ali' +
-    'as,all,and,Array,as,assertion,BIT,boolean,character,check,class,cluste' +
-    'r,colon,comma,creation,current,debug,default,deferred,do,double,else,e' +
-    'lseif,end,ensure,exclude,executable,expanded,export,external,false,fea' +
-    'ture,from,frozen,generate,identifier,if,ignore,implies,include,include' +
-    '_path,indexing,infix,inherit,inspect,integer,invariant,is,like,local,l' +
-    'oop,make,no,not,object,obsolete,old,once,optimize,option,or,pointer,pr' +
-    'ecompiled,precursor,prefix,real,redefine,rename,require,rescue,result,' +
-    'retry,root,select,separate,string,strip,system,then,trace,true,undefin' +
-    'e,unique,until,use,variant,visible,void,when,xor,yes';
-end;
-
-function TSynEiffelSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynEiffelSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkBasicTypes: Result := fBasicTypesAttri;
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkLace: Result := fLaceAttri;
-    tkOperatorAndSymbols: Result := fOperatorAndSymbolsAttri;
-    tkPredefined: Result := fPredefinedAttri;
-    tkResultValue: Result := fResultValueAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynEiffelSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynEiffelSyn.GetSampleSource: string;
-begin
-  Result := '-- Eiffel sample source from SmartEiffel'#13#10 +
-    'class FIBONACCI'#13#10 +
-    '-- Eiffel comment'#13#10 +
-    'creation make'#13#10 +
-    #13#10 +
-    'feature'#13#10 +
-    #13#10 +
-    '   make is'#13#10 +
-    '      do'#13#10 +
-    '         if argument_count /= 1 or else'#13#10 +
-    '            not argument(1).is_integer'#13#10 +
-    '          then'#13#10 +
-    '            io.put_string("Usage: ");'#13#10 +
-    '            io.put_string(argument(0));'#13#10 +
-    '            io.put_string(" %N");'#13#10 +
-    '            die_with_code(exit_failure_code);'#13#10 +
-    '         end;'#13#10 +
-    '         io.put_integer(fibonacci(argument(1).to_integer));'#13#10 +
-    '         io.put_new_line;'#13#10 +
-    '      end;'#13#10 +
-    '   -- Eiffel comment'#13#10 +
-    '   fibonacci(i: INTEGER): INTEGER is'#13#10 +
-    '      require -- Eiffel comment'#13#10 +
-    '         i >= 0'#13#10 +
-    '      do'#13#10 +
-    '         if i = 0 then'#13#10 +
-    '            Result := 1;'#13#10 +
-    '         elseif i = 1 then'#13#10 +
-    '            Result := 1;'#13#10 +
-    '         else'#13#10 +
-    '            Result := fibonacci(i - 1) + fibonacci(i - 2) ;'#13#10 +
-    '         end;'#13#10 +
-    '      end;'#13#10 +
-    #13#10 +
-    'end';
-end;
-
-function TSynEiffelSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterEiffel;
-end;
-
-class function TSynEiffelSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangEiffel;
-end;
-
-procedure TSynEiffelSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynEiffelSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynEiffelSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynEiffelSyn.IsOperatorChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '-', '!', '#', '$', '%', '&', '(', ')', '*', '.', '/',
-    ':', ';', '@', '[', '\', ']', '^', '|', '+', '<', '=', '>':
-      Result := True
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynEiffelSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangEiffel;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynEiffelSyn);
-end.
+{-------------------------------------------------------------------------------
+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: SynHighlighterEiffel.pas, released 2004-03-08.
+Description: Eiffel Syntax Parser/Highlighter
+The initial author of this file is Massimo Maria Ghisalberti (nissl).
+Unicode translation by Maël Hörz.
+Copyright (c) 2004, 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: SynHighlighterEiffel.pas,v 1.3.2.8 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides an Eiffel highlighter for SynEdit)
+@author(Massimo Maria Ghisalberti (nissl@mammuth.it, nissl@linee.it - www.linee.it)
+@created(03-08-2004)
+@lastmod(03-08-2004)
+The SynHighlighterEiffel unit provides SynEdit with an Eiffel highlighter.
+}
+
+unit SynHighlighterEiffel;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (
+    tkBasicTypes,
+    tkComment,
+    tkIdentifier,
+    tkKey,
+    tkLace,
+    tkNull,
+    tkOperatorAndSymbols,
+    tkPredefined,
+    tkResultValue,
+    tkSpace,
+    tkString,
+    tkUnknown);
+
+  TRangeState = (rsUnknown, rsEiffelComment, rsString, rsOperatorAndSymbolProc);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynEiffelSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..502] of TIdentFuncTableFunc;
+    FBasicTypesAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FLaceAttri: TSynHighlighterAttributes;
+    FOperatorAndSymbolsAttri: TSynHighlighterAttributes;
+    FPredefinedAttri: TSynHighlighterAttributes;
+    FResultValueAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function OperatorFunc(Index: Integer): TtkTokenKind;
+    function Func37u(Index: Integer): TtkTokenKind;
+    function FuncAdapt(Index: Integer): TtkTokenKind;
+    function FuncAlias(Index: Integer): TtkTokenKind;
+    function FuncAll(Index: Integer): TtkTokenKind;
+    function FuncAnd(Index: Integer): TtkTokenKind;
+    function FuncArray(Index: Integer): TtkTokenKind;
+    function FuncAs(Index: Integer): TtkTokenKind;
+    function FuncAssertion(Index: Integer): TtkTokenKind;
+    function FuncBit(Index: Integer): TtkTokenKind;
+    function FuncBoolean(Index: Integer): TtkTokenKind;
+    function FuncCharacter(Index: Integer): TtkTokenKind;
+    function FuncCheck(Index: Integer): TtkTokenKind;
+    function FuncClass(Index: Integer): TtkTokenKind;
+    function FuncCluster(Index: Integer): TtkTokenKind;
+    function FuncColon(Index: Integer): TtkTokenKind;
+    function FuncComma(Index: Integer): TtkTokenKind;
+    function FuncCreation(Index: Integer): TtkTokenKind;
+    function FuncCurrent(Index: Integer): TtkTokenKind;
+    function FuncDebug(Index: Integer): TtkTokenKind;
+    function FuncDefault(Index: Integer): TtkTokenKind;
+    function FuncDeferred(Index: Integer): TtkTokenKind;
+    function FuncDo(Index: Integer): TtkTokenKind;
+    function FuncDouble(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncElseif(Index: Integer): TtkTokenKind;
+    function FuncEnd(Index: Integer): TtkTokenKind;
+    function FuncEnsure(Index: Integer): TtkTokenKind;
+    function FuncExclude(Index: Integer): TtkTokenKind;
+    function FuncExecutable(Index: Integer): TtkTokenKind;
+    function FuncExpanded(Index: Integer): TtkTokenKind;
+    function FuncExport(Index: Integer): TtkTokenKind;
+    function FuncExternal(Index: Integer): TtkTokenKind;
+    function FuncFalse(Index: Integer): TtkTokenKind;
+    function FuncFeature(Index: Integer): TtkTokenKind;
+    function FuncFrom(Index: Integer): TtkTokenKind;
+    function FuncFrozen(Index: Integer): TtkTokenKind;
+    function FuncGenerate(Index: Integer): TtkTokenKind;
+    function FuncIdentifier(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncIgnore(Index: Integer): TtkTokenKind;
+    function FuncImplies(Index: Integer): TtkTokenKind;
+    function FuncInclude(Index: Integer): TtkTokenKind;
+    function FuncInclude95path(Index: Integer): TtkTokenKind;
+    function FuncIndexing(Index: Integer): TtkTokenKind;
+    function FuncInfix(Index: Integer): TtkTokenKind;
+    function FuncInherit(Index: Integer): TtkTokenKind;
+    function FuncInspect(Index: Integer): TtkTokenKind;
+    function FuncInteger(Index: Integer): TtkTokenKind;
+    function FuncInvariant(Index: Integer): TtkTokenKind;
+    function FuncIs(Index: Integer): TtkTokenKind;
+    function FuncLike(Index: Integer): TtkTokenKind;
+    function FuncLocal(Index: Integer): TtkTokenKind;
+    function FuncLoop(Index: Integer): TtkTokenKind;
+    function FuncMake(Index: Integer): TtkTokenKind;
+    function FuncNo(Index: Integer): TtkTokenKind;
+    function FuncNot(Index: Integer): TtkTokenKind;
+    function FuncObject(Index: Integer): TtkTokenKind;
+    function FuncObsolete(Index: Integer): TtkTokenKind;
+    function FuncOld(Index: Integer): TtkTokenKind;
+    function FuncOnce(Index: Integer): TtkTokenKind;
+    function FuncOptimize(Index: Integer): TtkTokenKind;
+    function FuncOption(Index: Integer): TtkTokenKind;
+    function FuncOr(Index: Integer): TtkTokenKind;
+    function FuncPointer(Index: Integer): TtkTokenKind;
+    function FuncPrecompiled(Index: Integer): TtkTokenKind;
+    function FuncPrecursor(Index: Integer): TtkTokenKind;
+    function FuncPrefix(Index: Integer): TtkTokenKind;
+    function FuncReal(Index: Integer): TtkTokenKind;
+    function FuncRedefine(Index: Integer): TtkTokenKind;
+    function FuncRename(Index: Integer): TtkTokenKind;
+    function FuncRequire(Index: Integer): TtkTokenKind;
+    function FuncRescue(Index: Integer): TtkTokenKind;
+    function FuncResult(Index: Integer): TtkTokenKind;
+    function FuncRetry(Index: Integer): TtkTokenKind;
+    function FuncRoot(Index: Integer): TtkTokenKind;
+    function FuncSelect(Index: Integer): TtkTokenKind;
+    function FuncSeparate(Index: Integer): TtkTokenKind;
+    function FuncString(Index: Integer): TtkTokenKind;
+    function FuncStrip(Index: Integer): TtkTokenKind;
+    function FuncSystem(Index: Integer): TtkTokenKind;
+    function FuncThen(Index: Integer): TtkTokenKind;
+    function FuncTrace(Index: Integer): TtkTokenKind;
+    function FuncTrue(Index: Integer): TtkTokenKind;
+    function FuncUndefine(Index: Integer): TtkTokenKind;
+    function FuncUnique(Index: Integer): TtkTokenKind;
+    function FuncUntil(Index: Integer): TtkTokenKind;
+    function FuncUse(Index: Integer): TtkTokenKind;
+    function FuncVariant(Index: Integer): TtkTokenKind;
+    function FuncVisible(Index: Integer): TtkTokenKind;
+    function FuncVoid(Index: Integer): TtkTokenKind;
+    function FuncWhen(Index: Integer): TtkTokenKind;
+    function FuncXor(Index: Integer): TtkTokenKind;
+    function FuncYes(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure IdentProc;
+    procedure InitIdent;
+    procedure OperatorAndSymbolProc;
+    procedure UnknownProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure CRProc;
+    procedure LFProc;
+    procedure EiffelCommentOpenProc;
+    procedure EiffelCommentProc;
+    procedure StringOpenProc;
+    procedure StringProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; 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;
+    procedure Next; override;
+    function IsOperatorChar(AChar: WideChar): Boolean;
+  published
+    property BasicTypesAttri: TSynHighlighterAttributes read FBasicTypesAttri write FBasicTypesAttri;
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property LaceAttri: TSynHighlighterAttributes read FLaceAttri write FLaceAttri;
+    property OperatorAndSymbolsAttri: TSynHighlighterAttributes read FOperatorAndSymbolsAttri write FOperatorAndSymbolsAttri;
+    property PredefinedAttri: TSynHighlighterAttributes read FPredefinedAttri write FPredefinedAttri;
+    property ResultValueAttri: TSynHighlighterAttributes read FResultValueAttri write FResultValueAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..118] of UnicodeString = (
+    '-', '!', '#', '$', '%u', '&', '(', ')', '*', '.', '/', '//', '/=', ':', 
+    ':=', ';', '@', '[', '\\', ']', '^', '|', '+', '<', '<>', '=', '>', 'adapt', 
+    'alias', 'all', 'and', 'array', 'as', 'assertion', 'bit', 'boolean', 
+    'character', 'check', 'class', 'cluster', 'colon', 'comma', 'creation', 
+    'current', 'debug', 'default', 'deferred', 'do', 'double', 'else', 'elseif', 
+    'end', 'ensure', 'exclude', 'executable', 'expanded', 'export', 'external', 
+    'false', 'feature', 'from', 'frozen', 'generate', 'identifier', 'if', 
+    'ignore', 'implies', 'include', 'include_path', 'indexing', 'infix', 
+    'inherit', 'inspect', 'integer', 'invariant', 'is', 'like', 'local', 'loop', 
+    'make', 'no', 'not', 'object', 'obsolete', 'old', 'once', 'optimize', 
+    'option', 'or', 'pointer', 'precompiled', 'precursor', 'prefix', 'real', 
+    'redefine', 'rename', 'require', 'rescue', 'result', 'retry', 'root', 
+    'select', 'separate', 'string', 'strip', 'system', 'then', 'trace', 'true', 
+    'undefine', 'unique', 'until', 'use', 'variant', 'visible', 'void', 'when', 
+    'xor', 'yes' 
+  );
+
+  KeyIndices: array[0..502] of Integer = (
+    -1, 49, -1, -1, -1, 97, 69, 85, -1, -1, -1, 106, -1, -1, 37, -1, -1, 63, -1, 
+    92, -1, -1, -1, -1, 108, 82, 16, -1, -1, -1, -1, -1, 86, -1, 0, -1, -1, 66, 
+    -1, -1, -1, -1, 91, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 13, -1, 
+    -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 110, -1, 1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, 9, 
+    -1, -1, -1, -1, -1, -1, 68, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 15, 105, -1, -1, -1, 51, -1, -1, 6, -1, 96, -1, -1, 17, -1, -1, 55, -1, 
+    -1, -1, -1, -1, 117, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, 
+    -1, 62, -1, 59, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 83, 10, 95, -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 65, 18, 23, -1, -1, -1, 35, -1, -1, -1, 7, -1, -1, 32, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 90, -1, 103, -1, -1, 80, -1, 
+    -1, -1, -1, 2, -1, 34, -1, -1, -1, -1, -1, -1, 41, -1, 27, 112, -1, -1, -1, 
+    33, -1, 44, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, -1, 93, -1, -1, -1, 8, 46, 102, -1, 
+    -1, 19, 87, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, 84, 53, -1, -1, 
+    -1, 71, -1, -1, 11, -1, 3, 107, 67, -1, 64, 47, -1, -1, -1, -1, -1, 24, -1, 
+    -1, -1, 114, -1, -1, -1, 116, -1, -1, -1, -1, 81, 75, -1, -1, -1, -1, -1, 
+    -1, -1, 100, -1, -1, -1, -1, -1, 54, -1, -1, 26, 115, -1, -1, -1, -1, -1, 
+    78, 22, 36, -1, 74, -1, 20, -1, -1, 42, -1, 99, -1, -1, -1, -1, -1, -1, -1, 
+    73, -1, 52, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 4, 94, -1, 
+    -1, 40, -1, -1, 39, -1, -1, -1, -1, 45, -1, 12, -1, -1, -1, 72, 38, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 28, 48, -1, -1, -1, -1, -1, 101, -1, 118, 
+    -1, -1, 57, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 70, -1, 89, -1, -1, 111, -1 
+  );
+
+{$Q-}
+function TSynEiffelSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) or IsOperatorChar(Str^) do
+  begin
+    Result := Result * 543 + Ord(Str^) * 79;
+    Inc(Str);
+  end;
+  Result := Result mod 503;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynEiffelSyn.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 TSynEiffelSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[34] := OperatorFunc;
+  FIdentFuncTable[92] := OperatorFunc;
+  FIdentFuncTable[250] := OperatorFunc;
+  FIdentFuncTable[329] := OperatorFunc;
+  FIdentFuncTable[413] := Func37u;
+  FIdentFuncTable[487] := OperatorFunc;
+  FIdentFuncTable[142] := OperatorFunc;
+  FIdentFuncTable[221] := OperatorFunc;
+  FIdentFuncTable[300] := OperatorFunc;
+  FIdentFuncTable[113] := OperatorFunc;
+  FIdentFuncTable[192] := OperatorFunc;
+  FIdentFuncTable[327] := OperatorFunc;
+  FIdentFuncTable[427] := OperatorFunc;
+  FIdentFuncTable[55] := OperatorFunc;
+  FIdentFuncTable[480] := OperatorFunc;
+  FIdentFuncTable[134] := OperatorFunc;
+  FIdentFuncTable[26] := OperatorFunc;
+  FIdentFuncTable[147] := OperatorFunc;
+  FIdentFuncTable[212] := OperatorFunc;
+  FIdentFuncTable[305] := OperatorFunc;
+  FIdentFuncTable[384] := OperatorFunc;
+  FIdentFuncTable[239] := OperatorFunc;
+  FIdentFuncTable[379] := OperatorFunc;
+  FIdentFuncTable[213] := OperatorFunc;
+  FIdentFuncTable[340] := OperatorFunc;
+  FIdentFuncTable[292] := OperatorFunc;
+  FIdentFuncTable[371] := OperatorFunc;
+  FIdentFuncTable[261] := FuncAdapt;
+  FIdentFuncTable[462] := FuncAlias;
+  FIdentFuncTable[402] := FuncAll;
+  FIdentFuncTable[54] := FuncAnd;
+  FIdentFuncTable[105] := FuncArray;
+  FIdentFuncTable[224] := FuncAs;
+  FIdentFuncTable[266] := FuncAssertion;
+  FIdentFuncTable[252] := FuncBit;
+  FIdentFuncTable[217] := FuncBoolean;
+  FIdentFuncTable[380] := FuncCharacter;
+  FIdentFuncTable[14] := FuncCheck;
+  FIdentFuncTable[432] := FuncClass;
+  FIdentFuncTable[420] := FuncCluster;
+  FIdentFuncTable[417] := FuncColon;
+  FIdentFuncTable[259] := FuncComma;
+  FIdentFuncTable[387] := FuncCreation;
+  FIdentFuncTable[311] := FuncCurrent;
+  FIdentFuncTable[268] := FuncDebug;
+  FIdentFuncTable[425] := FuncDefault;
+  FIdentFuncTable[301] := FuncDeferred;
+  FIdentFuncTable[334] := FuncDo;
+  FIdentFuncTable[463] := FuncDouble;
+  FIdentFuncTable[1] := FuncElse;
+  FIdentFuncTable[270] := FuncElseif;
+  FIdentFuncTable[139] := FuncEnd;
+  FIdentFuncTable[399] := FuncEnsure;
+  FIdentFuncTable[320] := FuncExclude;
+  FIdentFuncTable[368] := FuncExecutable;
+  FIdentFuncTable[150] := FuncExpanded;
+  FIdentFuncTable[167] := FuncExport;
+  FIdentFuncTable[474] := FuncExternal;
+  FIdentFuncTable[85] := FuncFalse;
+  FIdentFuncTable[174] := FuncFeature;
+  FIdentFuncTable[411] := FuncFrom;
+  FIdentFuncTable[63] := FuncFrozen;
+  FIdentFuncTable[172] := FuncGenerate;
+  FIdentFuncTable[17] := FuncIdentifier;
+  FIdentFuncTable[333] := FuncIf;
+  FIdentFuncTable[211] := FuncIgnore;
+  FIdentFuncTable[37] := FuncImplies;
+  FIdentFuncTable[331] := FuncInclude;
+  FIdentFuncTable[120] := FuncInclude95path;
+  FIdentFuncTable[6] := FuncIndexing;
+  FIdentFuncTable[496] := FuncInfix;
+  FIdentFuncTable[324] := FuncInherit;
+  FIdentFuncTable[431] := FuncInspect;
+  FIdentFuncTable[397] := FuncInteger;
+  FIdentFuncTable[382] := FuncInvariant;
+  FIdentFuncTable[354] := FuncIs;
+  FIdentFuncTable[71] := FuncLike;
+  FIdentFuncTable[160] := FuncLocal;
+  FIdentFuncTable[378] := FuncLoop;
+  FIdentFuncTable[181] := FuncMake;
+  FIdentFuncTable[245] := FuncNo;
+  FIdentFuncTable[353] := FuncNot;
+  FIdentFuncTable[25] := FuncObject;
+  FIdentFuncTable[191] := FuncObsolete;
+  FIdentFuncTable[319] := FuncOld;
+  FIdentFuncTable[7] := FuncOnce;
+  FIdentFuncTable[32] := FuncOptimize;
+  FIdentFuncTable[306] := FuncOption;
+  FIdentFuncTable[121] := FuncOr;
+  FIdentFuncTable[498] := FuncPointer;
+  FIdentFuncTable[240] := FuncPrecompiled;
+  FIdentFuncTable[42] := FuncPrecursor;
+  FIdentFuncTable[19] := FuncPrefix;
+  FIdentFuncTable[296] := FuncReal;
+  FIdentFuncTable[414] := FuncRedefine;
+  FIdentFuncTable[193] := FuncRename;
+  FIdentFuncTable[144] := FuncRequire;
+  FIdentFuncTable[5] := FuncRescue;
+  FIdentFuncTable[43] := FuncResult;
+  FIdentFuncTable[389] := FuncRetry;
+  FIdentFuncTable[362] := FuncRoot;
+  FIdentFuncTable[469] := FuncSelect;
+  FIdentFuncTable[302] := FuncSeparate;
+  FIdentFuncTable[242] := FuncString;
+  FIdentFuncTable[282] := FuncStrip;
+  FIdentFuncTable[135] := FuncSystem;
+  FIdentFuncTable[11] := FuncThen;
+  FIdentFuncTable[330] := FuncTrace;
+  FIdentFuncTable[24] := FuncTrue;
+  FIdentFuncTable[452] := FuncUndefine;
+  FIdentFuncTable[90] := FuncUnique;
+  FIdentFuncTable[501] := FuncUntil;
+  FIdentFuncTable[262] := FuncUse;
+  FIdentFuncTable[195] := FuncVariant;
+  FIdentFuncTable[344] := FuncVisible;
+  FIdentFuncTable[372] := FuncVoid;
+  FIdentFuncTable[348] := FuncWhen;
+  FIdentFuncTable[156] := FuncXor;
+  FIdentFuncTable[471] := FuncYes;
+end;
+
+function TSynEiffelSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.OperatorFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkOperatorAndSymbols
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.Func37u(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAdapt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAlias(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAll(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAnd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncArray(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncAssertion(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncBit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncBoolean(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncCharacter(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncCheck(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncClass(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncCluster(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncColon(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncComma(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncCreation(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncCurrent(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncDebug(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncDefault(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncDeferred(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncDo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncDouble(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncElseif(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncEnd(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncEnsure(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncExclude(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncExecutable(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncExpanded(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncExport(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncExternal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncFalse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncFeature(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncFrom(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncFrozen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncGenerate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncIdentifier(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncIgnore(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncImplies(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInclude(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInclude95path(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncIndexing(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInfix(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInherit(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInspect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInteger(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncInvariant(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncIs(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncLike(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncLocal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncLoop(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncMake(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncNo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncNot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncObject(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncObsolete(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncOld(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncOnce(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncOptimize(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncOption(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncOr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncPointer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncPrecompiled(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncPrecursor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncPrefix(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncReal(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRedefine(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRename(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRequire(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRescue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncResult(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkResultValue
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRetry(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncRoot(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncSelect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncSeparate(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncString(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkBasicTypes
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncStrip(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncSystem(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncThen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncTrace(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncTrue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncUndefine(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncUnique(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncUntil(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncUse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncVariant(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncVisible(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncVoid(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkPredefined
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncWhen(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncXor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynEiffelSyn.FuncYes(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkLace
+  else
+    Result := tkIdentifier;
+end;
+
+procedure TSynEiffelSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynEiffelSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynEiffelSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end;
+
+procedure TSynEiffelSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynEiffelSyn.OperatorAndSymbolProc;
+begin
+  FTokenID := tkIdentifier;
+  if FLine[Run] = #33 then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+  if CharInSet(FLine[Run], [#35..#44]) then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+  if CharInSet(FLine[Run], [#46..#47]) then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+  if CharInSet(FLine[Run], [#58..#64]) then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+  if CharInSet(FLine[Run], [#91..#96]) then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+  if CharInSet(FLine[Run], [#123..#127]) then
+    begin
+      FRange := rsOperatorAndSymbolProc;
+      FTokenID := tkOperatorAndSymbols;
+      Inc(Run);
+      Exit;
+    end;
+end;
+
+procedure TSynEiffelSyn.EiffelCommentOpenProc;
+begin
+  Inc(Run);
+  if (FLine[Run - 1] = '-') and (FLine[Run] = '-') then
+    begin
+      FRange := rsEiffelComment;
+      EiffelCommentProc;
+      FTokenID := tkComment;
+    end
+  else
+    FTokenID := tkOperatorAndSymbols;
+end;
+
+procedure TSynEiffelSyn.EiffelCommentProc;
+begin
+  FTokenID := tkComment;
+  repeat
+    if not IsLineEnd(Run) then
+      Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynEiffelSyn.StringOpenProc;
+begin
+  Inc(Run);
+  FRange := rsString;
+  StringProc;
+  FTokenID := tkString;
+end;
+
+procedure TSynEiffelSyn.StringProc;
+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;
+
+constructor TSynEiffelSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FBasicTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrBasicTypes, SYNS_FriendlyAttrBasicTypes);
+  FBasicTypesAttri.Style := [fsBold];
+  FBasicTypesAttri.Foreground := clBlue;
+  AddAttribute(FBasicTypesAttri);
+
+  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  FCommentAttri.Foreground := clTeal;
+  AddAttribute(FCommentAttri);
+
+  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  FIdentifierAttri.Foreground := clMaroon;
+  AddAttribute(FIdentifierAttri);
+
+  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  FKeyAttri.Foreground := clNavy;
+  AddAttribute(FKeyAttri);
+
+  FLaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrLace, SYNS_FriendlyAttrLace);
+  FLaceAttri.Style := [fsBold];
+  FLaceAttri.Foreground := clNavy;
+  AddAttribute(FLaceAttri);
+
+  FOperatorAndSymbolsAttri := TSynHighLighterAttributes.Create(SYNS_AttrOperatorAndSymbols, SYNS_FriendlyAttrOperatorAndSymbols);
+  FOperatorAndSymbolsAttri.Style := [fsBold];
+  FOperatorAndSymbolsAttri.Foreground := clOlive;
+  AddAttribute(FOperatorAndSymbolsAttri);
+
+  FPredefinedAttri := TSynHighLighterAttributes.Create(SYNS_AttrPredefined, SYNS_FriendlyAttrPredefined);
+  FPredefinedAttri.Style := [fsBold];
+  FPredefinedAttri.Foreground := clRed;
+  AddAttribute(FPredefinedAttri);
+
+  FResultValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrResultValue, SYNS_FriendlyAttrResultValue);
+  FResultValueAttri.Style := [fsBold];
+  FResultValueAttri.Foreground := clPurple;
+  AddAttribute(FResultValueAttri);
+
+  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+
+  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  FStringAttri.Style := [fsItalic];
+  FStringAttri.Foreground := clGray;
+  AddAttribute(FStringAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterEiffel;
+  FRange := rsUnknown;
+end;
+
+procedure TSynEiffelSyn.IdentProc;
+begin
+  FTokenID := IdentKind(FLine + Run);
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+end;
+
+procedure TSynEiffelSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynEiffelSyn.Next;
+begin
+  FTokenPos := Run;
+  FRange := rsUnknown;
+  case FLine[Run] of
+    #33, #35..#44, #46..#47, #58..#64, #91..#96, #123..#127: OperatorAndSymbolProc;
+    #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+    '-': EiffelCommentOpenProc;
+    '"': StringOpenProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    'A'..'Z', 'a'..'z': IdentProc;
+    else UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynEiffelSyn.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 TSynEiffelSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynEiffelSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+begin
+  Result :=
+    '-,!,#,$,%U,&,(,),*,.,/,//,/=,:,:=,;,@,[,\\,],^,|,+,<,<>,=,>,adapt,ali' +
+    'as,all,and,Array,as,assertion,BIT,boolean,character,check,class,cluste' +
+    'r,colon,comma,creation,current,debug,default,deferred,do,double,else,e' +
+    'lseif,end,ensure,exclude,executable,expanded,export,external,false,fea' +
+    'ture,from,frozen,generate,identifier,if,ignore,implies,include,include' +
+    '_path,indexing,infix,inherit,inspect,integer,invariant,is,like,local,l' +
+    'oop,make,no,not,object,obsolete,old,once,optimize,option,or,pointer,pr' +
+    'ecompiled,precursor,prefix,real,redefine,rename,require,rescue,result,' +
+    'retry,root,select,separate,string,strip,system,then,trace,true,undefin' +
+    'e,unique,until,use,variant,visible,void,when,xor,yes';
+end;
+
+function TSynEiffelSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynEiffelSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkBasicTypes: Result := FBasicTypesAttri;
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkLace: Result := FLaceAttri;
+    tkOperatorAndSymbols: Result := FOperatorAndSymbolsAttri;
+    tkPredefined: Result := FPredefinedAttri;
+    tkResultValue: Result := FResultValueAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynEiffelSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynEiffelSyn.GetSampleSource: UnicodeString;
+begin
+  Result := '-- Eiffel sample source from SmartEiffel'#13#10 +
+    'class FIBONACCI'#13#10 +
+    '-- Eiffel comment'#13#10 +
+    'creation make'#13#10 +
+    #13#10 +
+    'feature'#13#10 +
+    #13#10 +
+    '   make is'#13#10 +
+    '      do'#13#10 +
+    '         if argument_count /= 1 or else'#13#10 +
+    '            not argument(1).is_integer'#13#10 +
+    '          then'#13#10 +
+    '            io.put_string("Usage: ");'#13#10 +
+    '            io.put_string(argument(0));'#13#10 +
+    '            io.put_string(" %N");'#13#10 +
+    '            die_with_code(exit_failure_code);'#13#10 +
+    '         end;'#13#10 +
+    '         io.put_integer(fibonacci(argument(1).to_integer));'#13#10 +
+    '         io.put_new_line;'#13#10 +
+    '      end;'#13#10 +
+    '   -- Eiffel comment'#13#10 +
+    '   fibonacci(i: INTEGER): INTEGER is'#13#10 +
+    '      require -- Eiffel comment'#13#10 +
+    '         i >= 0'#13#10 +
+    '      do'#13#10 +
+    '         if i = 0 then'#13#10 +
+    '            Result := 1;'#13#10 +
+    '         elseif i = 1 then'#13#10 +
+    '            Result := 1;'#13#10 +
+    '         else'#13#10 +
+    '            Result := fibonacci(i - 1) + fibonacci(i - 2) ;'#13#10 +
+    '         end;'#13#10 +
+    '      end;'#13#10 +
+    #13#10 +
+    'end';
+end;
+
+function TSynEiffelSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterEiffel;
+end;
+
+class function TSynEiffelSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangEiffel;
+end;
+
+procedure TSynEiffelSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynEiffelSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynEiffelSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynEiffelSyn.IsOperatorChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '-', '!', '#', '$', '%', '&', '(', ')', '*', '.', '/',
+    ':', ';', '@', '[', '\', ']', '^', '|', '+', '<', '=', '>':
+      Result := True
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynEiffelSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangEiffel;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynEiffelSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterFortran.pas b/Source/VCL/SynEdit/Source/SynHighlighterFortran.pas
index b950aafd..e27f727a 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterFortran.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterFortran.pas
@@ -1,644 +1,651 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterFortran.pas, released 2000-04-21.
-The Original Code is based on the mwFortranSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is "riceball".
-Unicode translation by Maël Hörz.
-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: SynHighlighterFortran.pas,v 1.15.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Fortran syntax highlighter for SynEdit)
-@author(riceball , converted to SynEdit by Bruno Mikkelsen )
-@created(2000, converted to SynEdit 2000-04-21)
-@lastmod(2000-06-23)
-The SynHighlighterFortran unit provides SynEdit with a Fortran syntax highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterFortran;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynFortranSyn = class(TSynCustomHighlighter)
-  private
-    FTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..192] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AsciiCharProc;
-    procedure CRProc;
-    procedure CommaProc;
-    procedure EqualProc;
-    procedure ExclamationProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure CommentProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..69] of string = (
-    'allocatable', 'allocate', 'allocated', 'associated', 'call', 'case', 
-    'character', 'close', 'common', 'complex', 'contains', 'continue', 'cycle', 
-    'data', 'deallocate', 'default', 'define', 'dimension', 'do', 'else', 
-    'elseif', 'elsewhere', 'end', 'enddo', 'endif', 'entry', 'equivalence', 
-    'exit', 'external', 'forall', 'format', 'function', 'if', 'implicit', 
-    'include', 'integer', 'interface', 'logical', 'map', 'module', 'namelist', 
-    'nullify', 'open', 'optional', 'parameter', 'pause', 'pointer', 'print', 
-    'private', 'program', 'public', 'pure', 'read', 'real', 'record', 'return', 
-    'save', 'select', 'stop', 'subroutine', 'target', 'then', 'type', 'union', 
-    'use', 'value', 'volatile', 'where', 'while', 'write' 
-  );
-
-  KeyIndices: array[0..192] of Integer = (
-    8, -1, -1, -1, -1, 11, -1, -1, -1, 31, 2, -1, -1, 59, -1, -1, -1, -1, -1, 
-    13, 55, -1, -1, -1, 65, -1, 38, 54, 40, 10, 37, -1, -1, 25, -1, -1, 5, -1, 
-    -1, -1, -1, -1, -1, 4, -1, -1, 21, -1, -1, 49, -1, -1, -1, -1, 9, -1, -1, 
-    27, -1, 22, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, 53, 68, -1, 
-    34, -1, -1, 69, 30, -1, -1, -1, 32, -1, -1, -1, 19, 16, -1, -1, -1, -1, -1, 
-    -1, -1, 62, -1, -1, -1, -1, -1, -1, 36, 60, 14, -1, -1, 66, 29, -1, -1, -1, 
-    -1, 24, -1, 67, -1, 15, -1, -1, -1, -1, -1, -1, 44, 35, -1, -1, 46, -1, 17, 
-    -1, -1, 28, -1, 56, 61, -1, -1, 63, 45, 18, -1, 0, 20, -1, -1, -1, -1, -1, 
-    -1, 42, -1, 50, 3, 58, 52, -1, -1, -1, 51, -1, 48, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 12, 23, -1, 26, 1, -1, 41, 43, -1, -1, -1, 33, 7, -1, -1, -1, 47, 
-    39, 57, -1 
-  );
-
-{$Q-}
-function TSynFortranSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 294 + Ord(Str^) * 110;
-    inc(Str);
-  end;
-  Result := Result mod 193;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynFortranSyn.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 TSynFortranSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynFortranSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynFortranSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-constructor TSynFortranSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterFortran;
-end;
-
-procedure TSynFortranSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynFortranSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynFortranSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.EqualProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFortranSyn.ExclamationProc;
-begin
-  inc(Run, 1);                        {Fortran Comments}
-  fTokenID := tkComment;
-  while FLine[Run] <> #0 do
-  begin
-    case FLine[Run] of
-      #10, #13: break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynFortranSyn.GreaterProc;
-begin
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-          inc(Run, 3)
-        else                           {shift right}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFortranSyn.IdentProc;
-begin
-  if CharInSet(FLine[Run], ['C', 'c']) and (Run = 0) then
-  begin   //Fortran comments
-    inc(Run, 1);
-    CommentProc;
-  end
-  else begin
-    fTokenID := IdentKind(fLine + Run);
-    inc(Run, fStringLen);
-    while IsIdentChar(fLine[Run]) do inc(Run);
-  end;
-end;
-
-procedure TSynFortranSyn.LFProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-end;
-
-procedure TSynFortranSyn.LowerProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-          inc(Run, 3)
-        else                           {shift left}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFortranSyn.MinusProc;
-begin
-  {subtract}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.ModSymbolProc;
-begin
-  {mod}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynFortranSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynFortranSyn.PlusProc;
-begin
-  {subtract}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.PointProc;
-begin
-  if (((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'G') and CharInSet(SysUtils.AnsiUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.ge. .gt.}
-       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'L') and CharInSet(SysUtils.AnsiUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.le. .lt.}
-       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'N') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'E')) {.ne.}
-       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'E') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'Q')) {.eq.}
-       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'O') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'R'))){.or.}
-     and (FLine[Run + 3] = '.') then
-    begin
-      inc(Run, 4);
-      fTokenID := tkSymbol;
-    end
-  else if (((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'A')
-              and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'N')
-              and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'D'))    {.and.}
-           or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'N')
-              and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'O')
-              and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'T')))    {.not.}
-          and (FLine[Run + 4] = '.') then
-    begin
-      inc(Run, 5);
-      fTokenID := tkSymbol;
-    end
-  else if (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'T')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'R')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'U')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 4]) = 'E')
-          and (FLine[Run + 5] = '.') then  {.true.}
-    begin
-      inc(Run, 6);
-      fTokenID := tkSymbol;
-    end
-  else if (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'F')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'A')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'L')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 4]) = 'S')
-          and (SysUtils.AnsiUpperCase(FLine[Run + 5]) = 'E')
-          and (FLine[Run + 6] = '.') then  {.false.}
-    begin
-      inc(Run, 7);
-      fTokenID := tkSymbol;
-    end
-  else                                 {point}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-end;
-
-procedure TSynFortranSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.SlashProc;
-begin
-  {division}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFortranSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynFortranSyn.StarProc;
-begin
-  if (Run = 0) then begin   //Fortran comments
-    inc(Run);
-    CommentProc;
-  end
-  else begin
-    {star}
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynFortranSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-  while FLine[Run] <> #0 do
-  begin
-    case FLine[Run] of
-      #10, #13: break;
-    end; //case
-    inc(Run);
-  end; //while
-end;
-
-procedure TSynFortranSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      #92:
-        if FLine[Run + 1] = #10 then inc(Run);
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynFortranSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynFortranSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    #39: AsciiCharProc;
-    #13: CRProc;
-    ',': CommaProc;
-    '=': EqualProc;
-    '!': ExclamationProc;
-    '>': GreaterProc;
-    'A'..'Z', 'a'..'z', '_': IdentProc;
-    #10: LFProc;
-    '<': LowerProc;
-    '-': MinusProc;
-    '%': ModSymbolProc;
-    #0: NullProc;
-    '0'..'9': NumberProc;
-    '+': PlusProc;
-    '.': PointProc;
-    ')': RoundCloseProc;
-    '(': RoundOpenProc;
-    ';': SemiColonProc;
-    '/': SlashProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '*': StarProc;
-    #34: StringProc;
-    else UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynFortranSyn.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 TSynFortranSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynFortranSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynFortranSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynFortranSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynFortranSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterFortran;
-end;
-
-class function TSynFortranSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangFortran;
-end;
-
-class function TSynFortranSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangFortran;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynFortranSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterFortran.pas, released 2000-04-21.
+The Original Code is based on the mwFortranSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is "riceball".
+Unicode translation by Maël Hörz.
+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: SynHighlighterFortran.pas,v 1.15.2.9 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Fortran syntax highlighter for SynEdit)
+@author(riceball , converted to SynEdit by Bruno Mikkelsen )
+@created(2000, converted to SynEdit 2000-04-21)
+@lastmod(2000-06-23)
+The SynHighlighterFortran unit provides SynEdit with a Fortran syntax highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterFortran;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkString, tkSymbol, tkUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynFortranSyn = class(TSynCustomHighlighter)
+  private
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..192] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AsciiCharProc;
+    procedure CRProc;
+    procedure CommaProc;
+    procedure EqualProc;
+    procedure ExclamationProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure CommentProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..69] of UnicodeString = (
+    'allocatable', 'allocate', 'allocated', 'associated', 'call', 'case', 
+    'character', 'close', 'common', 'complex', 'contains', 'continue', 'cycle', 
+    'data', 'deallocate', 'default', 'define', 'dimension', 'do', 'else', 
+    'elseif', 'elsewhere', 'end', 'enddo', 'endif', 'entry', 'equivalence', 
+    'exit', 'external', 'forall', 'format', 'function', 'if', 'implicit', 
+    'include', 'integer', 'interface', 'logical', 'map', 'module', 'namelist', 
+    'nullify', 'open', 'optional', 'parameter', 'pause', 'pointer', 'print', 
+    'private', 'program', 'public', 'pure', 'read', 'real', 'record', 'return', 
+    'save', 'select', 'stop', 'subroutine', 'target', 'then', 'type', 'union', 
+    'use', 'value', 'volatile', 'where', 'while', 'write' 
+  );
+
+  KeyIndices: array[0..192] of Integer = (
+    8, -1, -1, -1, -1, 11, -1, -1, -1, 31, 2, -1, -1, 59, -1, -1, -1, -1, -1, 
+    13, 55, -1, -1, -1, 65, -1, 38, 54, 40, 10, 37, -1, -1, 25, -1, -1, 5, -1, 
+    -1, -1, -1, -1, -1, 4, -1, -1, 21, -1, -1, 49, -1, -1, -1, -1, 9, -1, -1, 
+    27, -1, 22, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, 53, 68, -1, 
+    34, -1, -1, 69, 30, -1, -1, -1, 32, -1, -1, -1, 19, 16, -1, -1, -1, -1, -1, 
+    -1, -1, 62, -1, -1, -1, -1, -1, -1, 36, 60, 14, -1, -1, 66, 29, -1, -1, -1, 
+    -1, 24, -1, 67, -1, 15, -1, -1, -1, -1, -1, -1, 44, 35, -1, -1, 46, -1, 17, 
+    -1, -1, 28, -1, 56, 61, -1, -1, 63, 45, 18, -1, 0, 20, -1, -1, -1, -1, -1, 
+    -1, 42, -1, 50, 3, 58, 52, -1, -1, -1, 51, -1, 48, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 12, 23, -1, 26, 1, -1, 41, 43, -1, -1, -1, 33, 7, -1, -1, -1, 47, 
+    39, 57, -1 
+  );
+
+{$Q-}
+function TSynFortranSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 294 + Ord(Str^) * 110;
+    Inc(Str);
+  end;
+  Result := Result mod 193;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynFortranSyn.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 TSynFortranSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynFortranSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynFortranSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+constructor TSynFortranSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterFortran;
+end;
+
+procedure TSynFortranSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynFortranSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynFortranSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.EqualProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFortranSyn.ExclamationProc;
+begin
+  Inc(Run, 1);                        {Fortran Comments}
+  FTokenID := tkComment;
+  while FLine[Run] <> #0 do
+  begin
+    case FLine[Run] of
+      #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynFortranSyn.GreaterProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+          Inc(Run, 3)
+        else                           {shift right}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFortranSyn.IdentProc;
+begin
+  if CharInSet(FLine[Run], ['C', 'c']) and (Run = 0) then
+  begin   //Fortran comments
+    Inc(Run, 1);
+    CommentProc;
+  end
+  else begin
+    FTokenID := IdentKind(FLine + Run);
+    Inc(Run, FStringLen);
+    while IsIdentChar(FLine[Run]) do Inc(Run);
+  end;
+end;
+
+procedure TSynFortranSyn.LFProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+end;
+
+procedure TSynFortranSyn.LowerProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+          Inc(Run, 3)
+        else                           {shift left}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFortranSyn.MinusProc;
+begin
+  {subtract}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.ModSymbolProc;
+begin
+  {mod}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynFortranSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynFortranSyn.PlusProc;
+begin
+  {subtract}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.PointProc;
+begin
+  if (((SynWideUpperCase(FLine[Run + 1]) = 'G') and CharInSet(SynWideUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.ge. .gt.}
+       or ((SynWideUpperCase(FLine[Run + 1]) = 'L') and CharInSet(SynWideUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.le. .lt.}
+       or ((SynWideUpperCase(FLine[Run + 1]) = 'N') and (SynWideUpperCase(FLine[Run + 2]) = 'E')) {.ne.}
+       or ((SynWideUpperCase(FLine[Run + 1]) = 'E') and (SynWideUpperCase(FLine[Run + 2]) = 'Q')) {.eq.}
+       or ((SynWideUpperCase(FLine[Run + 1]) = 'O') and (SynWideUpperCase(FLine[Run + 2]) = 'R'))){.or.}
+     and (FLine[Run + 3] = '.') then
+    begin
+      Inc(Run, 4);
+      FTokenID := tkSymbol;
+    end
+  else if (((SynWideUpperCase(FLine[Run + 1]) = 'A')
+              and (SynWideUpperCase(FLine[Run + 2]) = 'N')
+              and (SynWideUpperCase(FLine[Run + 3]) = 'D'))    {.and.}
+           or ((SynWideUpperCase(FLine[Run + 1]) = 'N')
+              and (SynWideUpperCase(FLine[Run + 2]) = 'O')
+              and (SynWideUpperCase(FLine[Run + 3]) = 'T')))    {.not.}
+          and (FLine[Run + 4] = '.') then
+    begin
+      Inc(Run, 5);
+      FTokenID := tkSymbol;
+    end
+  else if (SynWideUpperCase(FLine[Run + 1]) = 'T')
+          and (SynWideUpperCase(FLine[Run + 2]) = 'R')
+          and (SynWideUpperCase(FLine[Run + 3]) = 'U')
+          and (SynWideUpperCase(FLine[Run + 4]) = 'E')
+          and (FLine[Run + 5] = '.') then  {.true.}
+    begin
+      Inc(Run, 6);
+      FTokenID := tkSymbol;
+    end
+  else if (SynWideUpperCase(FLine[Run + 1]) = 'F')
+          and (SynWideUpperCase(FLine[Run + 2]) = 'A')
+          and (SynWideUpperCase(FLine[Run + 3]) = 'L')
+          and (SynWideUpperCase(FLine[Run + 4]) = 'S')
+          and (SynWideUpperCase(FLine[Run + 5]) = 'E')
+          and (FLine[Run + 6] = '.') then  {.false.}
+    begin
+      Inc(Run, 7);
+      FTokenID := tkSymbol;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+end;
+
+procedure TSynFortranSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.SlashProc;
+begin
+  {division}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFortranSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynFortranSyn.StarProc;
+begin
+  if (Run = 0) then begin   //Fortran comments
+    Inc(Run);
+    CommentProc;
+  end
+  else begin
+    {star}
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynFortranSyn.CommentProc;
+begin
+  FTokenID := tkComment;
+  while FLine[Run] <> #0 do
+  begin
+    case FLine[Run] of
+      #10, #13:
+        Break;
+    end; //case
+    Inc(Run);
+  end; //while
+end;
+
+procedure TSynFortranSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+      #92:
+        if FLine[Run + 1] = #10 then Inc(Run);
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynFortranSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynFortranSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+    #39: AsciiCharProc;
+    #13: CRProc;
+    ',': CommaProc;
+    '=': EqualProc;
+    '!': ExclamationProc;
+    '>': GreaterProc;
+    'A'..'Z', 'a'..'z', '_': IdentProc;
+    #10: LFProc;
+    '<': LowerProc;
+    '-': MinusProc;
+    '%': ModSymbolProc;
+    #0: NullProc;
+    '0'..'9': NumberProc;
+    '+': PlusProc;
+    '.': PointProc;
+    ')': RoundCloseProc;
+    '(': RoundOpenProc;
+    ';': SemiColonProc;
+    '/': SlashProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    '*': StarProc;
+    #34: StringProc;
+    else UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynFortranSyn.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 TSynFortranSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynFortranSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynFortranSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynFortranSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynFortranSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterFortran;
+end;
+
+class function TSynFortranSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangFortran;
+end;
+
+class function TSynFortranSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangFortran;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynFortranSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterFoxpro.pas b/Source/VCL/SynEdit/Source/SynHighlighterFoxpro.pas
index 7e0d8d8c..fc5dc0ab 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterFoxpro.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterFoxpro.pas
@@ -1,1765 +1,1775 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterFoxpro.pas, released 2000-04-21.
-The Original Code is based on the mwFoxproSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is "riceball".
-Unicode translation by Maël Hörz.
-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: SynHighlighterFoxpro.pas,v 1.12.2.10 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Foxpro Syntax highlighter for SynEdit)
-@author(riceball , converted to SynEdit by Bruno Mikkelsen )
-@created(2000, converted to SynEdit 2000-04-21)
-@lastmod(2000-06-23)
-The SynHighlighterFoxpro unit provides SynEdit with a Foxpro syntax highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterFoxpro;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynFoxproSyn = class(TSynCustomHighlighter)
-  private
-    FTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..17908] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..809] of string = (
-    '_curobj', '_msysmenu', '_pageno', '_screen', '_vfp', 'abs', 'accept', 
-    'aclass', 'acopy', 'acos', 'acti', 'activate', 'adatabases', 'adbobjects', 
-    'add', 'additive', 'adel', 'adir', 'aelement', 'aerror', 'afields', 'afont', 
-    'after', 'again', 'ains', 'ainstance', 'alen', 'alias', 'alines', 'all', 
-    'alltrim', 'alt', 'alter', 'alternate', 'amembers', 'and', 'ansi', 
-    'ansitooem', 'any', 'aplabout', 'appe', 'append', 'application', 
-    'aprinters', 'array', 'as', 'asc', 'ascan', 'ascending', 'ascii', 'aselobj', 
-    'asin', 'asort', 'assert', 'asubscript', 'at', 'at_c', 'atan', 'atc', 
-    'atcc', 'atcline', 'atline', 'atn2', 'aused', 'autosave', 'average', 'avg', 
-    'backcolor', 'bar', 'barcount', 'barprompt', 'baseclass', 'before', 'begin', 
-    'bell', 'between', 'bintoc', 'bitand', 'bitclear', 'bitlshift', 'bitnot', 
-    'bitor', 'bitrshift', 'bitset', 'bittest', 'bitxor', 'blan', 'blank', 
-    'blink', 'blocksize', 'bof', 'border', 'bott', 'bottom', 'box', 'brow', 
-    'browse', 'brstatus', 'build', 'by', 'calculate', 'call', 'cancel', 
-    'candidate', 'capslock', 'caption', 'carry', 'case', 'cd', 'cdow', 
-    'ceiling', 'century', 'change', 'char', 'chdir', 'check', 'chr', 'chrsaw', 
-    'chrtran', 'chrtranc', 'class', 'classlib', 'clear', 'clock', 'clos', 
-    'close', 'cls', 'cmonth', 'cnt', 'cntbar', 'cntpad', 'codepage', 'col', 
-    'collate', 'color', 'colorscheme', 'comm', 'command', 'commands', 'comment', 
-    'compact', 'compatible', 'compile', 'compobj', 'confirm', 'connection', 
-    'connstring', 'console', 'continue', 'copy', 'cos', 'count', 'cpconvert', 
-    'cpcurrent', 'cpdbf', 'cpdialog', 'cpnotrans', 'create', 'createobject', 
-    'createoffline', 'ctobin', 'ctod', 'ctot', 'curdir', 'currency', 'cursor', 
-    'curval', 'custom', 'database', 'databases', 'datasession', 'dateformat', 
-    'datemark', 'datetime', 'day', 'dbalias', 'dbc', 'dbused', 'debug', 
-    'debugout', 'decimals', 'declare', 'default', 'define', 'dele', 'delete', 
-    'deleted', 'delimite', 'delimited', 'delimiters', 'descending', 'desktop', 
-    'development', 'device', 'difference', 'dim', 'dimension', 'dir', 
-    'directory', 'diskspace', 'display', 'displayvalue', 'distinct', 'dlls', 
-    'dmy', 'do', 'dodefault', 'dohistory', 'double', 'dow', 'drop', 'dtoc', 
-    'dtor', 'dtos', 'dtot', 'each', 'echo', 'edit', 'eject', 'else', 'empty', 
-    'end', 'endcase', 'enddefine', 'enddo', 'endfor', 'endfunc', 'endif', 
-    'endprintjob', 'endproc', 'endscan', 'endtext', 'endwith', 'environment', 
-    'eof', 'erase', 'error', 'escape', 'evaluate', 'event', 'eventhandler', 
-    'events', 'exact', 'except', 'exclusive', 'exists', 'exit', 'exp', 'export', 
-    'expression', 'extended', 'external', 'fchsize', 'fclose', 'fcount', 
-    'fcreate', 'fdow', 'feof', 'ferror', 'fetch', 'fflush', 'fgets', 'field', 
-    'fields', 'file', 'files', 'fill', 'filter', 'find', 'fixed', 'float', 
-    'flock', 'floor', 'flush', 'font', 'footer', 'fopen', 'for', 'force', 
-    'foreign', 'form', 'format', 'found', 'fox2x', 'fputs', 'free', 'freeze', 
-    'from', 'fseek', 'fsize', 'fullpath', 'func', 'functi', 'function', 'fv', 
-    'fw2', 'fweek', 'fwrite', 'gath', 'gather', 'general', 'get', 'getbar', 
-    'getcolor', 'getcp', 'getdir', 'getenv', 'getexpr', 'getfile', 
-    'getfldstate', 'getfont', 'getnextmodified', 'getobject', 'getpad', 
-    'getpict', 'getprinter', 'gets', 'global', 'go', 'gomonth', 'gotfocus', 
-    'goto', 'group', 'grow', 'having', 'headings', 'help', 'helpcontextid', 
-    'helpfilter', 'hidden', 'highlight', 'hour', 'hours', 'icon', 'id', 
-    'idxcollate', 'if', 'ifdef', 'ifndef', 'iif', 'import', 'in', 'include', 
-    'indbc', 'index', 'indexes', 'inkey', 'inlist', 'input', 'insert', 
-    'insmode', 'int', 'integer', 'intensity', 'interval', 'into', 'is', 
-    'isalpha', 'iscolor', 'isdigit', 'isexclusive', 'isflocked', 'islower', 
-    'isnull', 'isreadonly', 'isrlocked', 'isupper', 'join', 'key', 'keyboard', 
-    'keycomp', 'keymatch', 'label', 'last', 'lastkey', 'ledit', 'left', 'leftc', 
-    'len', 'lenc', 'level', 'library', 'like', 'line', 'lineno', 'linked', 
-    'list', 'loadpicture', 'local', 'locate', 'locfile', 'lock', 'lockscreen', 
-    'log', 'log10', 'logerrors', 'logout', 'long', 'lookup', 'loop', 'lower', 
-    'lparameter', 'lparameters', 'lpartition', 'ltrim', 'lupdate', 'macdesktop', 
-    'machelp', 'mackey', 'macros', 'margin', 'mark', 'master', 'max', 'mcol', 
-    'md', 'mdown', 'mdx', 'mdy', 'memlines', 'memo', 'memory', 'memos', 
-    'memowidth', 'memvar', 'menu', 'menus', 'message', 'messagebox', 'messages', 
-    'middle', 'min', 'minimize', 'minute', 'mkdir', 'mline', 'mod', 'modal', 
-    'modi', 'modify', 'module', 'month', 'mouse', 'movable', 'move', 'moved', 
-    'mrkbar', 'mrkpad', 'mrow', 'mton', 'multilocks', 'multiselect', 'mvcount', 
-    'name', 'ndx', 'near', 'negotiate', 'network', 'newobject', 'next', 
-    'noalias', 'noappend', 'noclear', 'noclose', 'noconsole', 'nocptrans', 
-    'nodata', 'nodebug', 'nodefault', 'nodelete', 'noedit', 'noeject', 
-    'noenvironment', 'nofloat', 'noinit', 'nolink', 'nolock', 'nomargin', 
-    'nomdi', 'nomenu', 'nominimize', 'nomodify', 'nomouse', 'none', 
-    'nooptimize', 'nooverwrite', 'noprompt', 'noread', 'norefresh', 'norequery', 
-    'normal', 'normalize', 'nosave', 'noshadow', 'noshow', 'nospace', 'not', 
-    'note', 'notify', 'noupdate', 'novalidate', 'noverify', 'nowait', 
-    'nowindow', 'nowrap', 'nozoom', 'npv', 'ntom', 'null', 'nulldisplay', 
-    'numlock', 'nvl', 'objnum', 'objtoclient', 'objvar', 'occurs', 'odometer', 
-    'oemtoansi', 'of', 'off', 'oldval', 'oleclass', 'olecontrol', 'olepublic', 
-    'on', 'only', 'open', 'optimize', 'or', 'order', 'os', 'otherwise', 'outer', 
-    'overwrite', 'pack', 'pad', 'padc', 'padr', 'palette', 'para', 'parameter', 
-    'parameters', 'path', 'payment', 'pcol', 'pdox', 'pdsetup', 'pen', 'pi', 
-    'pictres', 'picture', 'pixels', 'plain', 'play', 'point', 'pop', 'popup', 
-    'preference', 'preview', 'primary', 'print', 'printer', 'printjob', 
-    'printstatus', 'private', 'proc', 'proced', 'procedure', 'procedures', 
-    'program', 'project', 'prompt', 'proper', 'protected', 'prow', 'prtinfo', 
-    'public', 'push', 'putfile', 'pv', 'query', 'quit', 'rand', 'range', 'rat', 
-    'ratc', 'ratline', 'rd', 'rdlevel', 'read', 'readborder', 'recall', 
-    'reccount', 'recno', 'record', 'recover', 'recsize', 'references', 
-    'refresh', 'region', 'regional', 'reindex', 'rela', 'relati', 'relation', 
-    'release', 'remote', 'rename', 'repl', 'repla', 'replace', 'replicate', 
-    'report', 'reprocess', 'requery', 'reset', 'resizable', 'resize', 
-    'resource', 'resources', 'rest', 'restore', 'resume', 'retry', 'retu', 
-    'return', 'rgb', 'rgbscheme', 'right', 'rightc', 'rightclick', 
-    'righttoleft', 'rlock', 'rmdir', 'rollback', 'round', 'row', 'rtod', 
-    'rtrim', 'run', 'runscript', 'runtime', 'safety', 'same', 'save', 'say', 
-    'scan', 'scat', 'scatt', 'scatter', 'scheme', 'schemes', 'scols', 
-    'scoreboard', 'screen', 'sdf', 'second', 'seek', 'sele', 'select', 
-    'selected', 'selection', 'separator', 'set', 'shadows', 'shape', 'show', 
-    'shutdown', 'sign', 'sin', 'single', 'sizable', 'size', 'skip', 'skpbar', 
-    'skppad', 'some', 'sort', 'sorted', 'soundex', 'space', 'sql', 'sqlcommit', 
-    'sqlrollback', 'sqlstringconnect', 'sqrt', 'srows', 'status', 
-    'statusbartext', 'std', 'step', 'sticky', 'store', 'str', 'strconv', 
-    'string', 'strtran', 'structure', 'stuff', 'stuffc', 'style', 'substr', 
-    'substrc', 'sum', 'summary', 'suspend', 'sylk', 'sys', 'sysformats', 
-    'sysmenu', 'sysmenus', 'sysmetric', 'system', 'tab', 'tabindex', 'table', 
-    'tablerevert', 'tables', 'tableupdate', 'tabstop', 'tag', 'talk', 'target', 
-    'text', 'textmerge', 'textwidth', 'this', 'thisform', 'thisformset', 'time', 
-    'timeout', 'timer', 'titles', 'to', 'top', 'topic', 'total', 'transaction', 
-    'transform', 'trap', 'trbetween', 'trigger', 'trim', 'ttoc', 'ttod', 
-    'txnlevel', 'txtwidth', 'type', 'typeahead', 'udfparms', 'undefine', 
-    'union', 'unique', 'unlock', 'unpack', 'update', 'updated', 'upper', 'use', 
-    'used', 'val', 'valid', 'validate', 'value', 'values', 'var', 'varread', 
-    'vartype', 'version', 'view', 'views', 'volume', 'wait', 'wchild', 'wcols', 
-    'week', 'wexist', 'wfont', 'when', 'while', 'window', 'windowlist', 
-    'windows', 'with', 'wk1', 'wk3', 'wks', 'wlast', 'wlcol', 'wlrow', 'wontop', 
-    'workarea', 'woutput', 'wparent', 'wr1', 'wread', 'writeexpression', 
-    'writemethod', 'wrk', 'wrows', 'wtitle', 'wvisible', 'xcmdfile', 'xl5', 
-    'xls', 'year', 'zap', 'zoom', 'zorder', 'zorderset' 
-  );
-
-  KeyIndices: array[0..17908] of Integer = (
-    -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 485, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 416, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 315, -1, -1, -1, -1, -1, -1, 523, -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, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 664, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    698, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 499, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -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, -1, 427, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 724, -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, -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, -1, 700, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 246, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 703, -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, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 800, -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, 621, -1, 
-    509, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 579, -1, -1, -1, -1, -1, -1, -1, 592, -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, -1, 528, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 596, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 50, -1, -1, 150, -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, 
-    -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, -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, -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, -1, -1, -1, -1, -1, 759, -1, -1, 665, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 181, -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, -1, -1, -1, -1, -1, 
-    -1, 324, -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, -1, -1, 537, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 745, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 728, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 467, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 530, -1, -1, 414, -1, 282, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 685, -1, -1, -1, -1, -1, -1, -1, -1, -1, 326, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 756, -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, -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, -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, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 561, -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, -1, -1, -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    500, -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, 372, -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, -1, -1, -1, -1, -1, -1, -1, -1, 273, -1, -1, -1, 
-    -1, -1, -1, 582, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 734, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 446, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    61, -1, -1, -1, -1, -1, -1, 680, -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, -1, -1, 
-    -1, 173, -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, -1, -1, -1, 343, -1, 218, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 366, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 717, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 751, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 56, 618, -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, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 713, -1, -1, -1, -1, -1, -1, 
-    329, -1, -1, -1, 491, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 513, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 121, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 688, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 514, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -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, -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, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 395, -1, -1, -1, 806, -1, 475, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, 483, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, 
-    -1, 186, -1, -1, -1, -1, -1, -1, 422, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 615, -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, -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, -1, -1, 515, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 746, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 750, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 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, -1, -1, -1, -1, -1, -1, -1, 521, -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, -1, -1, -1, -1, 420, -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, 
-    -1, 284, 167, -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, -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, -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, -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, 591, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, 
-    325, 641, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 452, 363, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 137, -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, -1, -1, -1, 
-    716, -1, -1, -1, -1, -1, 438, -1, -1, -1, -1, -1, 619, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 119, -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, -1, -1, 151, -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, 673, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 402, -1, -1, -1, 508, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 798, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    696, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, 
-    -1, -1, -1, -1, 57, -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, -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, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 601, 
-    352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 730, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 637, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 461, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 241, -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, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 638, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 770, -1, -1, 357, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 613, -1, -1, 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    684, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    140, -1, -1, -1, 142, -1, 425, -1, -1, -1, 598, -1, -1, 465, -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, -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, -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, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 780, 
-    -1, -1, -1, -1, 674, 131, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 265, -1, -1, -1, 490, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 184, -1, -1, 112, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 549, -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, -1, 558, -1, 658, -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, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 616, -1, -1, -1, 
-    148, -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, -1, -1, -1, -1, -1, 194, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 484, -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, -1, -1, -1, -1, -1, -1, 606, -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, 
-    532, -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, 492, -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, -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, 669, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 522, -1, -1, -1, -1, -1, -1, -1, -1, -1, 474, -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, -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, -1, 145, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 720, -1, -1, -1, 298, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 364, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -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, -1, -1, -1, -1, -1, -1, 449, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, 
-    -1, -1, -1, -1, -1, -1, 333, -1, 634, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 695, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 574, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 252, -1, -1, -1, -1, 581, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    489, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, 578, -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, 256, -1, -1, -1, -1, -1, -1, -1, -1, 645, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -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, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 725, -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, 541, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 546, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 468, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 754, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 693, -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, -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, -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, 0, 753, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 767, -1, -1, -1, -1, -1, 434, -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, 773, -1, -1, -1, -1, -1, -1, 795, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 110, -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, -1, -1, 293, -1, 
-    588, -1, -1, 41, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 662, -1, -1, -1, 310, -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, -1, -1, -1, -1, -1, -1, -1, 552, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 677, 
-    386, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 607, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 162, -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, -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, -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, 202, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, 266, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 371, 25, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 149, -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, 460, -1, -1, -1, -1, 599, -1, 
-    -1, -1, -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 380, -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, -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, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 26, -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, 66, 
-    -1, -1, -1, -1, 542, -1, -1, -1, -1, -1, -1, 334, -1, -1, -1, -1, -1, 171, 
-    -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, -1, -1, -1, 344, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 699, -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, 604, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    104, -1, 370, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 739, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    130, -1, -1, -1, -1, -1, 470, -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, -1, -1, 
-    -1, -1, -1, -1, -1, 466, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 43, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 694, -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, 453, -1, -1, -1, -1, 
-    726, -1, -1, -1, -1, -1, 428, -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, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 175, -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, -1, -1, -1, -1, 249, -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, -1, -1, 198, -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, -1, -1, -1, 404, -1, -1, -1, -1, -1, -1, -1, 539, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 176, 226, -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, -1, -1, 804, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 731, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 473, -1, -1, -1, -1, -1, -1, -1, 47, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 764, 630, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 444, -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, -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, -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, -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, -1, -1, 126, -1, 203, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, 556, -1, -1, -1, -1, 
-    -1, 228, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 338, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 763, -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, 
-    456, -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, -1, -1, -1, -1, -1, -1, -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, -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, -1, -1, 612, -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, -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, -1, -1, -1, -1, 
-    545, -1, -1, 23, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, 369, 
-    -1, -1, -1, -1, 302, 316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, 
-    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 649, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 337, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    48, -1, 118, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, 
-    809, -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, -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, 
-    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 503, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 84, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 603, -1, 678, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    76, -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, -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, 493, 
-    -1, -1, -1, 741, -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, -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, -1, -1, -1, -1, -1, -1, 494, -1, -1, -1, -1, 547, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 58, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 305, -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, -1, 631, -1, -1, 623, 676, 383, 335, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 681, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 429, -1, -1, 7, -1, -1, -1, -1, 
-    781, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 722, -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, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, 
-    451, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 346, -1, 
-    -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 223, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 306, -1, -1, -1, 280, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 760, -1, -1, -1, -1, 
-    -1, 45, -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, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 747, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    748, -1, 617, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 462, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -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, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 791, -1, -1, -1, -1, -1, -1, -1, 
-    323, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 571, -1, -1, 587, -1, -1, 
-    -1, -1, 690, -1, -1, -1, -1, -1, -1, -1, -1, 701, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304, -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, -1, -1, 705, 406, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -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, -1, -1, -1, -1, -1, -1, -1, 593, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 350, -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, 398, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 692, -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, -1, 49, -1, -1, -1, 240, 
-    -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, -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, 636, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 683, -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, -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, 217, -1, 691, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 793, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 711, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, 743, 
-    -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, -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, 101, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 505, -1, -1, -1, -1, 718, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 672, -1, -1, -1, -1, -1, -1, 355, -1, -1, -1, -1, -1, 91, -1, 742, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, 
-    -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    614, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    421, -1, -1, -1, 242, -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, -1, -1, -1, -1, 
-    113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 784, -1, -1, 761, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 501, -1, -1, -1, -1, -1, -1, -1, 710, -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, -1, 555, -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, -1, 
-    -1, -1, -1, 704, -1, -1, -1, -1, 504, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 744, -1, -1, -1, 360, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 464, -1, -1, -1, -1, 38, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 585, -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, -1, -1, -1, -1, 46, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 670, -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, -1, -1, 
-    -1, -1, -1, -1, 254, 187, 459, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    507, -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, -1, -1, 5, -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, 365, -1, -1, -1, -1, -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, -1, -1, -1, 733, 
-    -1, -1, -1, -1, -1, -1, 792, -1, -1, 668, -1, 156, -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, -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, -1, -1, -1, 769, -1, -1, -1, 
-    -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 437, -1, -1, -1, -1, 749, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 659, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 597, 655, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 610, -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, -1, 
-    -1, -1, -1, -1, -1, -1, 575, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -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, -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, -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, -1, -1, -1, -1, 624, -1, -1, -1, 417, -1, -1, 
-    -1, -1, -1, 212, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, 785, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    799, -1, -1, -1, 95, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 303, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, 
-    -1, -1, 341, 679, -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, 384, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 650, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 714, -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, -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, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    418, 666, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    215, 535, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 
-    -1, 497, -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, -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, -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, -1, 209, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 757, -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, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, -1, -1, 234, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 155, -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, -1, -1, -1, 
-    -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 740, -1, -1, -1, -1, -1, 712, -1, -1, -1, -1, -1, -1, -1, 
-    765, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 697, -1, -1, 42, -1, -1, -1, -1, -1, -1, 
-    -1, 594, -1, -1, -1, -1, -1, -1, -1, -1, 538, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 321, -1, 478, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 354, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 516, -1, -1, -1, 472, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 214, -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, -1, -1, -1, -1, 656, -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, -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, -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, 
-    -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, -1, -1, -1, -1, 263, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    774, -1, -1, -1, -1, -1, 299, -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, -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, -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, -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, 388, -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, 381, -1, -1, -1, -1, -1, 
-    -1, -1, 351, -1, -1, -1, 476, -1, -1, -1, -1, -1, -1, -1, -1, 375, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 736, -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, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 790, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 620, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 752, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 390, -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, -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, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 732, 419, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 221, -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, 510, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 654, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 177, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -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, -1, -1, -1, -1, -1, -1, 168, -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, -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, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 738, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 275, 768, -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, -1, -1, -1, -1, -1, -1, 
-    560, -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, 30, -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, -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, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    15, -1, -1, 307, -1, -1, 107, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 448, -1, -1, -1, -1, 628, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 644, -1, -1, 396, -1, -1, -1, -1, 349, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 376, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 244, -1, -1, -1, 719, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 27, -1, -1, -1, -1, -1, -1, -1, 482, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 328, -1, -1, 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 301, -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, -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, -1, -1, -1, 311, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 572, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 356, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 253, -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, -1, -1, -1, -1, -1, -1, -1, 138, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 455, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -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, 
-    -1, -1, 347, -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, -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, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 300, -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, 394, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 447, -1, -1, -1, -1, -1, -1, -1, 789, -1, 393, -1, 639, -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, 646, -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, 682, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 605, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 525, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 544, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 651, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 583, -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, -1, -1, -1, -1, -1, -1, -1, 667, -1, -1, 270, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 410, -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, -1, -1, -1, 382, -1, -1, -1, -1, -1, -1, 463, -1, 
-    -1, -1, -1, -1, -1, -1, 317, -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, -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, -1, -1, -1, 608, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 96, -1, 723, -1, -1, -1, -1, 762, -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, -1, 260, -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, -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, -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, 106, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 116, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 577, -1, -1, -1, -1, -1, -1, -1, 39, -1, 
-    -1, 2, -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, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    519, 11, -1, -1, -1, -1, -1, -1, -1, 562, -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, 686, -1, 
-    -1, -1, 520, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 536, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 78, 123, 445, -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, 59, -1, 
-    -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 632, -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, 660, -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, -1, -1, 
-    -1, -1, 584, -1, -1, -1, -1, 506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 557, -1, -1, 498, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 626, -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, -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, 22, -1, 259, -1, -1, 88, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 314, -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, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, 146, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, 339, -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, 590, -1, -1, -1, -1, -1, -1, -1, -1, -1, 495, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 663, -1, -1, -1, -1, -1, -1, -1, 34, 
-    -1, -1, -1, 289, -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, -1, -1, -1, 548, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, -1, -1, 
-    -1, -1, -1, -1, 779, -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, 318, -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, -1, -1, -1, -1, 627, -1, 141, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 517, -1, 327, -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, -1, -1, -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 721, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 653, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -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, -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, -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, -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, -1, -1, 
-    -1, -1, 183, 479, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    652, -1, -1, -1, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 387, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 565, -1, -1, -1, -1, -1, -1, -1, -1, 675, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 348, -1, -1, -1, -1, 622, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 518, -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, -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, 496, -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, -1, -1, 231, -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, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 435, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, 345, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, 
-    766, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 708, -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, -1, -1, -1, -1, -1, 
-    -1, -1, 635, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 378, -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, 204, -1, -1, 133, -1, 258, -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, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 625, -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, -1, -1, -1, -1, -1, 117, 
-    28, -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, 487, -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, -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, 77, -1, -1, -1, -1, -1, 559, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 707, -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, -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, -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, -1, -1, -1, -1, -1, -1, 794, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    609, -1, -1, -1, -1, -1, -1, 439, 431, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 647, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 340, -1, 413, -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, -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, -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, 309, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 208, -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, -1, -1, -1, 568, -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, -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, -1, -1, 
-    -1, -1, -1, 602, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 527, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233, 566, -1, 
-    -1, -1, -1, -1, -1, 85, -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, -1, -1, -1, -1, 
-    -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    385, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 330, -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, -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, -1, -1, -1, -1, -1, -1, 450, 
-    -1, -1, -1, -1, -1, -1, -1, 788, 787, -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, 
-    -1, -1, -1, 727, -1, -1, -1, -1, 550, -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, 
-    -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, -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, -1, 
-    -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 281, 531, -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, 163, -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, -1, -1, -1, -1, -1, -1, 567, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, 661, 64, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 755, -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, -1, 
-    3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 758, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 772, -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, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    440, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, 
-    -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, 512, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, 389, -1, -1, 
-    -1, -1, -1, 458, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 801, -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, -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, -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, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 580, -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, -1, 477, -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, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 361, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    201, -1, -1, -1, 67, 715, 803, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    220, -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, -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, 
-    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 441, -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, -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, -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, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 807, -1, -1, -1, 526, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 702, -1, -1, -1, -1, 132, 
-    -1, -1, -1, -1, -1, -1, 480, -1, -1, -1, -1, -1, -1, -1, -1, -1, 195, -1, 
-    -1, -1, -1, -1, -1, 81, -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, 154, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 430, -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, -1, -1, -1, -1, 199, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 737, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, -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, 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 
-    -1, -1, -1, -1, 576, -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, -1, -1, -1, -1, -1, 
-    -1, 633, -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, 65, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 775, 529, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 296, -1, 
-    287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 569, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, 
-    -1, -1, 573, 511, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 797, -1, 415, -1, -1, -1, -1, -1, -1, -1, 782, -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, -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, -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, -1, -1, -1, -1, -1, -1, 409, -1, -1, -1, -1, -1, 403, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    454, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 247, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 600, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 689, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 543, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 706, 32, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 423, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 533, 408, -1, -1, -1, -1, 808, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -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, -1, -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 640, -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, 52, -1, -1, -1, -1, -1, -1, -1, 564, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, 553, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 563, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 589, -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, 358, -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, -1, -1, -1, -1, 
-    -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, 278, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 687, 
-    426, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 488, -1, -1, -1, 8, 412, -1, 14, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 671, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 524, -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, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 411, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 401, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, 
-    -1, 551, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 629, -1, -1, -1, -1, -1, 274, -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, -1, -1, -1, -1, -1, 
-    135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    196, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 469, -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, -1, -1, -1, -1, 295, -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, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, 802, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 399, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    158, -1, -1, -1, -1, -1, -1, -1, -1, -1, 595, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 642, -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, -1, 586, -1, -1, -1, -1, 73, 
-    -1, -1, 353, -1, -1, -1, -1, 570, -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, -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, -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, -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, -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, 443, -1, -1, -1, -1, 
-    481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 771, -1, -1, -1, -1, -1, -1, -1, 147, -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, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 436, -1, -1, -1, -1, -1, -1, 442, -1, -1, -1, -1, -1, -1, 
-    79, -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, 611, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 534, -1, -1, -1, -1, -1, -1, 51, 
-    -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, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 735, -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, -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, -1, -1, -1, -1, 783, -1, 
-    -1, -1, 13, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 294, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, 777, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 457, -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, -1, -1, 796, -1, -1, -1, 709, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 407, -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, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 
-    -1, -1, 657, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, 471, -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, -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, -1, -1, 
-    -1, -1, -1, -1, -1, 392, -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, -1, -1, -1, -1, 
-    554, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 786, -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, -1, -1 
-  );
-
-{$Q-}
-function TSynFoxproSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 934 + Ord(Str^) * 420;
-    inc(Str);
-  end;
-  Result := Result mod 17909;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynFoxproSyn.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 TSynFoxproSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynFoxproSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynFoxproSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-constructor TSynFoxproSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterFoxpro;
-end;
-
-procedure TSynFoxproSyn.AndSymbolProc;
-begin
-  case FLine[Run + 1] of
-    '&':                               {Comments}
-      begin
-        inc(Run, 2);
-        fTokenID := tkComment;
-        while FLine[Run] <> #0 do
-        begin
-          case FLine[Run] of
-            #10, #13: break;
-          end; //case
-          inc(Run);
-        end;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFoxproSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynFoxproSyn.AtSymbolProc;
-begin
-  fTokenID := tkKey;
-  inc(Run);
-end;
-
-procedure TSynFoxproSyn.BraceOpenProc;
-begin
-  fTokenID := tkString;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      #92:
-        if FLine[Run + 1] = #10 then inc(Run);
-    end;
-    inc(Run);
-  until FLine[Run] = '}';
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynFoxproSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  case FLine[Run + 1] of
-    #10: inc(Run, 2);
-    else inc(Run);
-  end;
-end;
-
-procedure TSynFoxproSyn.ColonProc;
-begin
-  {colon}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.EqualProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFoxproSyn.GreaterProc;
-begin
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-          inc(Run, 3)
-        else                           {shift right}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFoxproSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynFoxproSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynFoxproSyn.LowerProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-          inc(Run, 3)
-        else                           {shift left}
-          inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-procedure TSynFoxproSyn.MinusProc;
-begin
-  {subtract}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.ModSymbolProc;
-begin
-  {mod}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.NotSymbolProc;
-begin
-  {not}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynFoxproSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynFoxproSyn.OrSymbolProc;
-begin
-  {or}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.PlusProc;
-begin
-  {subtract}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.PointProc;
-begin
-  if ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'T') or      {.t.}
-    (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'F')) and     {.f.}
-    (FLine[Run + 2] = '.') then
-  begin
-    inc(Run, 3);
-    fTokenID := tkSymbol;
-  end
-  else if (((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'A') and
-    (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'N') and
-    (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'D')) or   {.and.}
-    ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'N') and
-    (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'O') and
-    (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'T'))) and   {.not.}
-    (FLine[Run + 4] = '.') then
-  begin
-    inc(Run, 5);
-    fTokenID := tkSymbol;
-  end
-  else if (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'O') and
-    (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'R') and
-    (FLine[Run + 3] = '.') then  {.or.}
-  begin
-    inc(Run, 4);
-    fTokenID := tkSymbol;
-  end
-  else                                 {point}
-  begin
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynFoxproSyn.QuestionProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.RoundOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.SlashProc;
-begin
-  {division}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynFoxproSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.StarProc;
-begin
-  if (Run = 0) or (Trim(Copy(fLine, 1, Run)) = '') then
-  begin                        {Foxpro Comments}
-    inc(Run);
-    fTokenID := tkComment;
-    while FLine[Run] <> #0 do
-    begin
-      case FLine[Run] of
-        #10, #13: break;
-      end;
-      inc(Run);
-    end;
-  end
-  else
-  begin
-    {star}
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynFoxproSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      #92:
-        if FLine[Run + 1] = #10 then inc(Run);
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynFoxproSyn.TildeProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.XOrSymbolProc;
-begin
-  {xor}
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynFoxproSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynFoxproSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    '&': AndSymbolProc;
-    #39: AsciiCharProc;
-    '@': AtSymbolProc;
-    '{': BraceOpenProc;
-    #13: CRProc;
-    ':': ColonProc;
-    ',': CommaProc;
-    '=': EqualProc;
-    '>': GreaterProc;
-    'A'..'Z', 'a'..'z', '_': IdentProc;
-    #10: LFProc;
-    '<': LowerProc;
-    '-': MinusProc;
-    '%': ModSymbolProc;
-    '!': NotSymbolProc;
-    #0: NullProc;
-    '0'..'9': NumberProc;
-    '|': OrSymbolProc;
-    '+': PlusProc;
-    '.': PointProc;
-    '?': QuestionProc;
-    ')': RoundCloseProc;
-    '(': RoundOpenProc;
-    ';': SemiColonProc;
-    '/': SlashProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    ']': SquareCloseProc;
-    '[': SquareOpenProc;
-    '*': StarProc;
-    #34: StringProc;
-    '~': TildeProc;
-    '^': XOrSymbolProc;
-    else UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynFoxproSyn.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 TSynFoxproSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynFoxproSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynFoxproSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case GetTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynFoxproSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynFoxproSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterFoxpro;
-end;
-
-class function TSynFoxproSyn.GetLanguageName: string;                    
-begin
-  Result := SYNS_LangFoxpro;
-end;
-
-class function TSynFoxproSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangFoxpro;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynFoxproSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterFoxpro.pas, released 2000-04-21.
+The Original Code is based on the mwFoxproSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is "riceball".
+Unicode translation by Maël Hörz.
+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: SynHighlighterFoxpro.pas,v 1.12.2.10 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Foxpro Syntax highlighter for SynEdit)
+@author(riceball , converted to SynEdit by Bruno Mikkelsen )
+@created(2000, converted to SynEdit 2000-04-21)
+@lastmod(2000-06-23)
+The SynHighlighterFoxpro unit provides SynEdit with a Foxpro syntax highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterFoxpro;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
+    tkString, tkSymbol, tkUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynFoxproSyn = class(TSynCustomHighlighter)
+  private
+    FTokenID: TtkTokenKind;
+    FIdentFuncTable: array[0..17908] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..809] of UnicodeString = (
+    '_curobj', '_msysmenu', '_pageno', '_screen', '_vfp', 'abs', 'accept', 
+    'aclass', 'acopy', 'acos', 'acti', 'activate', 'adatabases', 'adbobjects', 
+    'add', 'additive', 'adel', 'adir', 'aelement', 'aerror', 'afields', 'afont', 
+    'after', 'again', 'ains', 'ainstance', 'alen', 'alias', 'alines', 'all', 
+    'alltrim', 'alt', 'alter', 'alternate', 'amembers', 'and', 'ansi', 
+    'ansitooem', 'any', 'aplabout', 'appe', 'append', 'application', 
+    'aprinters', 'array', 'as', 'asc', 'ascan', 'ascending', 'ascii', 'aselobj', 
+    'asin', 'asort', 'assert', 'asubscript', 'at', 'at_c', 'atan', 'atc', 
+    'atcc', 'atcline', 'atline', 'atn2', 'aused', 'autosave', 'average', 'avg', 
+    'backcolor', 'bar', 'barcount', 'barprompt', 'baseclass', 'before', 'begin', 
+    'bell', 'between', 'bintoc', 'bitand', 'bitclear', 'bitlshift', 'bitnot', 
+    'bitor', 'bitrshift', 'bitset', 'bittest', 'bitxor', 'blan', 'blank', 
+    'blink', 'blocksize', 'bof', 'border', 'bott', 'bottom', 'box', 'brow', 
+    'browse', 'brstatus', 'build', 'by', 'calculate', 'call', 'cancel', 
+    'candidate', 'capslock', 'caption', 'carry', 'case', 'cd', 'cdow', 
+    'ceiling', 'century', 'change', 'char', 'chdir', 'check', 'chr', 'chrsaw', 
+    'chrtran', 'chrtranc', 'class', 'classlib', 'clear', 'clock', 'clos', 
+    'close', 'cls', 'cmonth', 'cnt', 'cntbar', 'cntpad', 'codepage', 'col', 
+    'collate', 'color', 'colorscheme', 'comm', 'command', 'commands', 'comment', 
+    'compact', 'compatible', 'compile', 'compobj', 'confirm', 'connection', 
+    'connstring', 'console', 'continue', 'copy', 'cos', 'count', 'cpconvert', 
+    'cpcurrent', 'cpdbf', 'cpdialog', 'cpnotrans', 'create', 'createobject', 
+    'createoffline', 'ctobin', 'ctod', 'ctot', 'curdir', 'currency', 'cursor', 
+    'curval', 'custom', 'database', 'databases', 'datasession', 'dateformat', 
+    'datemark', 'datetime', 'day', 'dbalias', 'dbc', 'dbused', 'debug', 
+    'debugout', 'decimals', 'declare', 'default', 'define', 'dele', 'delete', 
+    'deleted', 'delimite', 'delimited', 'delimiters', 'descending', 'desktop', 
+    'development', 'device', 'difference', 'dim', 'dimension', 'dir', 
+    'directory', 'diskspace', 'display', 'displayvalue', 'distinct', 'dlls', 
+    'dmy', 'do', 'dodefault', 'dohistory', 'double', 'dow', 'drop', 'dtoc', 
+    'dtor', 'dtos', 'dtot', 'each', 'echo', 'edit', 'eject', 'else', 'empty', 
+    'end', 'endcase', 'enddefine', 'enddo', 'endfor', 'endfunc', 'endif', 
+    'endprintjob', 'endproc', 'endscan', 'endtext', 'endwith', 'environment', 
+    'eof', 'erase', 'error', 'escape', 'evaluate', 'event', 'eventhandler', 
+    'events', 'exact', 'except', 'exclusive', 'exists', 'exit', 'exp', 'export', 
+    'expression', 'extended', 'external', 'fchsize', 'fclose', 'fcount', 
+    'fcreate', 'fdow', 'feof', 'ferror', 'fetch', 'fflush', 'fgets', 'field', 
+    'fields', 'file', 'files', 'fill', 'filter', 'find', 'fixed', 'float', 
+    'flock', 'floor', 'flush', 'font', 'footer', 'fopen', 'for', 'force', 
+    'foreign', 'form', 'format', 'found', 'fox2x', 'fputs', 'free', 'freeze', 
+    'from', 'fseek', 'fsize', 'fullpath', 'func', 'functi', 'function', 'fv', 
+    'fw2', 'fweek', 'fwrite', 'gath', 'gather', 'general', 'get', 'getbar', 
+    'getcolor', 'getcp', 'getdir', 'getenv', 'getexpr', 'getfile', 
+    'getfldstate', 'getfont', 'getnextmodified', 'getobject', 'getpad', 
+    'getpict', 'getprinter', 'gets', 'global', 'go', 'gomonth', 'gotfocus', 
+    'goto', 'group', 'grow', 'having', 'headings', 'help', 'helpcontextid', 
+    'helpfilter', 'hidden', 'highlight', 'hour', 'hours', 'icon', 'id', 
+    'idxcollate', 'if', 'ifdef', 'ifndef', 'iif', 'import', 'in', 'include', 
+    'indbc', 'index', 'indexes', 'inkey', 'inlist', 'input', 'insert', 
+    'insmode', 'int', 'integer', 'intensity', 'interval', 'into', 'is', 
+    'isalpha', 'iscolor', 'isdigit', 'isexclusive', 'isflocked', 'islower', 
+    'isnull', 'isreadonly', 'isrlocked', 'isupper', 'join', 'key', 'keyboard', 
+    'keycomp', 'keymatch', 'label', 'last', 'lastkey', 'ledit', 'left', 'leftc', 
+    'len', 'lenc', 'level', 'library', 'like', 'line', 'lineno', 'linked', 
+    'list', 'loadpicture', 'local', 'locate', 'locfile', 'lock', 'lockscreen', 
+    'log', 'log10', 'logerrors', 'logout', 'long', 'lookup', 'loop', 'lower', 
+    'lparameter', 'lparameters', 'lpartition', 'ltrim', 'lupdate', 'macdesktop', 
+    'machelp', 'mackey', 'macros', 'margin', 'mark', 'master', 'max', 'mcol', 
+    'md', 'mdown', 'mdx', 'mdy', 'memlines', 'memo', 'memory', 'memos', 
+    'memowidth', 'memvar', 'menu', 'menus', 'message', 'messagebox', 'messages', 
+    'middle', 'min', 'minimize', 'minute', 'mkdir', 'mline', 'mod', 'modal', 
+    'modi', 'modify', 'module', 'month', 'mouse', 'movable', 'move', 'moved', 
+    'mrkbar', 'mrkpad', 'mrow', 'mton', 'multilocks', 'multiselect', 'mvcount', 
+    'name', 'ndx', 'near', 'negotiate', 'network', 'newobject', 'next', 
+    'noalias', 'noappend', 'noclear', 'noclose', 'noconsole', 'nocptrans', 
+    'nodata', 'nodebug', 'nodefault', 'nodelete', 'noedit', 'noeject', 
+    'noenvironment', 'nofloat', 'noinit', 'nolink', 'nolock', 'nomargin', 
+    'nomdi', 'nomenu', 'nominimize', 'nomodify', 'nomouse', 'none', 
+    'nooptimize', 'nooverwrite', 'noprompt', 'noread', 'norefresh', 'norequery', 
+    'normal', 'normalize', 'nosave', 'noshadow', 'noshow', 'nospace', 'not', 
+    'note', 'notify', 'noupdate', 'novalidate', 'noverify', 'nowait', 
+    'nowindow', 'nowrap', 'nozoom', 'npv', 'ntom', 'null', 'nulldisplay', 
+    'numlock', 'nvl', 'objnum', 'objtoclient', 'objvar', 'occurs', 'odometer', 
+    'oemtoansi', 'of', 'off', 'oldval', 'oleclass', 'olecontrol', 'olepublic', 
+    'on', 'only', 'open', 'optimize', 'or', 'order', 'os', 'otherwise', 'outer', 
+    'overwrite', 'pack', 'pad', 'padc', 'padr', 'palette', 'para', 'parameter', 
+    'parameters', 'path', 'payment', 'pcol', 'pdox', 'pdsetup', 'pen', 'pi', 
+    'pictres', 'picture', 'pixels', 'plain', 'play', 'point', 'pop', 'popup', 
+    'preference', 'preview', 'primary', 'print', 'printer', 'printjob', 
+    'printstatus', 'private', 'proc', 'proced', 'procedure', 'procedures', 
+    'program', 'project', 'prompt', 'proper', 'protected', 'prow', 'prtinfo', 
+    'public', 'push', 'putfile', 'pv', 'query', 'quit', 'rand', 'range', 'rat', 
+    'ratc', 'ratline', 'rd', 'rdlevel', 'read', 'readborder', 'recall', 
+    'reccount', 'recno', 'record', 'recover', 'recsize', 'references', 
+    'refresh', 'region', 'regional', 'reindex', 'rela', 'relati', 'relation', 
+    'release', 'remote', 'rename', 'repl', 'repla', 'replace', 'replicate', 
+    'report', 'reprocess', 'requery', 'reset', 'resizable', 'resize', 
+    'resource', 'resources', 'rest', 'restore', 'resume', 'retry', 'retu', 
+    'return', 'rgb', 'rgbscheme', 'right', 'rightc', 'rightclick', 
+    'righttoleft', 'rlock', 'rmdir', 'rollback', 'round', 'row', 'rtod', 
+    'rtrim', 'run', 'runscript', 'runtime', 'safety', 'same', 'save', 'say', 
+    'scan', 'scat', 'scatt', 'scatter', 'scheme', 'schemes', 'scols', 
+    'scoreboard', 'screen', 'sdf', 'second', 'seek', 'sele', 'select', 
+    'selected', 'selection', 'separator', 'set', 'shadows', 'shape', 'show', 
+    'shutdown', 'sign', 'sin', 'single', 'sizable', 'size', 'skip', 'skpbar', 
+    'skppad', 'some', 'sort', 'sorted', 'soundex', 'space', 'sql', 'sqlcommit', 
+    'sqlrollback', 'sqlstringconnect', 'sqrt', 'srows', 'status', 
+    'statusbartext', 'std', 'step', 'sticky', 'store', 'str', 'strconv', 
+    'string', 'strtran', 'structure', 'stuff', 'stuffc', 'style', 'substr', 
+    'substrc', 'sum', 'summary', 'suspend', 'sylk', 'sys', 'sysformats', 
+    'sysmenu', 'sysmenus', 'sysmetric', 'system', 'tab', 'tabindex', 'table', 
+    'tablerevert', 'tables', 'tableupdate', 'tabstop', 'tag', 'talk', 'target', 
+    'text', 'textmerge', 'textwidth', 'this', 'thisform', 'thisformset', 'time', 
+    'timeout', 'timer', 'titles', 'to', 'top', 'topic', 'total', 'transaction', 
+    'transform', 'trap', 'trbetween', 'trigger', 'trim', 'ttoc', 'ttod', 
+    'txnlevel', 'txtwidth', 'type', 'typeahead', 'udfparms', 'undefine', 
+    'union', 'unique', 'unlock', 'unpack', 'update', 'updated', 'upper', 'use', 
+    'used', 'val', 'valid', 'validate', 'value', 'values', 'var', 'varread', 
+    'vartype', 'version', 'view', 'views', 'volume', 'wait', 'wchild', 'wcols', 
+    'week', 'wexist', 'wfont', 'when', 'while', 'window', 'windowlist', 
+    'windows', 'with', 'wk1', 'wk3', 'wks', 'wlast', 'wlcol', 'wlrow', 'wontop', 
+    'workarea', 'woutput', 'wparent', 'wr1', 'wread', 'writeexpression', 
+    'writemethod', 'wrk', 'wrows', 'wtitle', 'wvisible', 'xcmdfile', 'xl5', 
+    'xls', 'year', 'zap', 'zoom', 'zorder', 'zorderset' 
+  );
+
+  KeyIndices: array[0..17908] of Integer = (
+    -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 485, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 416, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 315, -1, -1, -1, -1, -1, -1, 523, -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, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 664, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    698, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 499, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -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, -1, 427, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 724, -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, -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, -1, 700, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 246, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 703, -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, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 800, -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, 621, -1, 
+    509, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 579, -1, -1, -1, -1, -1, -1, -1, 592, -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, -1, 528, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 596, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 50, -1, -1, 150, -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, 
+    -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, -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, -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, -1, -1, -1, -1, -1, 759, -1, -1, 665, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 181, -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, -1, -1, -1, -1, -1, 
+    -1, 324, -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, -1, -1, 537, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 745, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 728, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 467, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 530, -1, -1, 414, -1, 282, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 685, -1, -1, -1, -1, -1, -1, -1, -1, -1, 326, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 756, -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, -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, -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, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 561, -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, -1, -1, -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    500, -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, 372, -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, -1, -1, -1, -1, -1, -1, -1, -1, 273, -1, -1, -1, 
+    -1, -1, -1, 582, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 734, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 446, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    61, -1, -1, -1, -1, -1, -1, 680, -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, -1, -1, 
+    -1, 173, -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, -1, -1, -1, 343, -1, 218, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 366, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 717, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 751, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 56, 618, -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, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 713, -1, -1, -1, -1, -1, -1, 
+    329, -1, -1, -1, 491, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 513, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 121, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 688, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 514, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -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, -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, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 395, -1, -1, -1, 806, -1, 475, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, 483, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, 
+    -1, 186, -1, -1, -1, -1, -1, -1, 422, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 615, -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, -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, -1, -1, 515, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 746, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 750, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 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, -1, -1, -1, -1, -1, -1, -1, 521, -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, -1, -1, -1, -1, 420, -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, 
+    -1, 284, 167, -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, -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, -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, -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, 591, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, 
+    325, 641, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 452, 363, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 137, -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, -1, -1, -1, 
+    716, -1, -1, -1, -1, -1, 438, -1, -1, -1, -1, -1, 619, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 119, -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, -1, -1, 151, -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, 673, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 402, -1, -1, -1, 508, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 798, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    696, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, 
+    -1, -1, -1, -1, 57, -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, -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, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 601, 
+    352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 730, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 637, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 461, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 241, -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, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 638, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 770, -1, -1, 357, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 613, -1, -1, 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    684, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    140, -1, -1, -1, 142, -1, 425, -1, -1, -1, 598, -1, -1, 465, -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, -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, -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, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 780, 
+    -1, -1, -1, -1, 674, 131, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 265, -1, -1, -1, 490, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 184, -1, -1, 112, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 549, -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, -1, 558, -1, 658, -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, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 616, -1, -1, -1, 
+    148, -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, -1, -1, -1, -1, -1, 194, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 484, -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, -1, -1, -1, -1, -1, -1, 606, -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, 
+    532, -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, 492, -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, -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, 669, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 522, -1, -1, -1, -1, -1, -1, -1, -1, -1, 474, -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, -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, -1, 145, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 720, -1, -1, -1, 298, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 364, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -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, -1, -1, -1, -1, -1, -1, 449, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, 
+    -1, -1, -1, -1, -1, -1, 333, -1, 634, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 695, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 574, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 252, -1, -1, -1, -1, 581, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    489, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, 578, -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, 256, -1, -1, -1, -1, -1, -1, -1, -1, 645, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -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, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 725, -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, 541, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 546, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 468, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 754, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 693, -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, -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, -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, 0, 753, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 767, -1, -1, -1, -1, -1, 434, -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, 773, -1, -1, -1, -1, -1, -1, 795, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 110, -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, -1, -1, 293, -1, 
+    588, -1, -1, 41, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 662, -1, -1, -1, 310, -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, -1, -1, -1, -1, -1, -1, -1, 552, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 677, 
+    386, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 607, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 162, -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, -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, -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, 202, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, 266, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 371, 25, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 149, -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, 460, -1, -1, -1, -1, 599, -1, 
+    -1, -1, -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 380, -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, -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, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 26, -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, 66, 
+    -1, -1, -1, -1, 542, -1, -1, -1, -1, -1, -1, 334, -1, -1, -1, -1, -1, 171, 
+    -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, -1, -1, -1, 344, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 699, -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, 604, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    104, -1, 370, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 739, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    130, -1, -1, -1, -1, -1, 470, -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, -1, -1, 
+    -1, -1, -1, -1, -1, 466, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 43, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 694, -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, 453, -1, -1, -1, -1, 
+    726, -1, -1, -1, -1, -1, 428, -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, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 175, -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, -1, -1, -1, -1, 249, -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, -1, -1, 198, -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, -1, -1, -1, 404, -1, -1, -1, -1, -1, -1, -1, 539, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 176, 226, -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, -1, -1, 804, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 731, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 473, -1, -1, -1, -1, -1, -1, -1, 47, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 764, 630, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 444, -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, -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, -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, -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, -1, -1, 126, -1, 203, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, 556, -1, -1, -1, -1, 
+    -1, 228, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 338, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 763, -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, 
+    456, -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, -1, -1, -1, -1, -1, -1, -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, -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, -1, -1, 612, -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, -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, -1, -1, -1, -1, 
+    545, -1, -1, 23, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, 369, 
+    -1, -1, -1, -1, 302, 316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, 
+    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 649, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 337, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    48, -1, 118, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, 
+    809, -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, -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, 
+    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 503, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 84, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 603, -1, 678, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    76, -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, -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, 493, 
+    -1, -1, -1, 741, -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, -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, -1, -1, -1, -1, -1, -1, 494, -1, -1, -1, -1, 547, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 58, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 305, -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, -1, 631, -1, -1, 623, 676, 383, 335, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 681, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 429, -1, -1, 7, -1, -1, -1, -1, 
+    781, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 722, -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, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, 
+    451, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 346, -1, 
+    -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 223, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 306, -1, -1, -1, 280, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 760, -1, -1, -1, -1, 
+    -1, 45, -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, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 747, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    748, -1, 617, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 462, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -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, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 791, -1, -1, -1, -1, -1, -1, -1, 
+    323, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 571, -1, -1, 587, -1, -1, 
+    -1, -1, 690, -1, -1, -1, -1, -1, -1, -1, -1, 701, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304, -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, -1, -1, 705, 406, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -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, -1, -1, -1, -1, -1, -1, -1, 593, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 350, -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, 398, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 692, -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, -1, 49, -1, -1, -1, 240, 
+    -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, -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, 636, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 683, -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, -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, 217, -1, 691, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 793, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 711, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, 743, 
+    -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, -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, 101, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 505, -1, -1, -1, -1, 718, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 672, -1, -1, -1, -1, -1, -1, 355, -1, -1, -1, -1, -1, 91, -1, 742, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, 
+    -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    614, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    421, -1, -1, -1, 242, -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, -1, -1, -1, -1, 
+    113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 784, -1, -1, 761, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 501, -1, -1, -1, -1, -1, -1, -1, 710, -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, -1, 555, -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, -1, 
+    -1, -1, -1, 704, -1, -1, -1, -1, 504, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 744, -1, -1, -1, 360, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 464, -1, -1, -1, -1, 38, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 585, -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, -1, -1, -1, -1, 46, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 670, -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, -1, -1, 
+    -1, -1, -1, -1, 254, 187, 459, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    507, -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, -1, -1, 5, -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, 365, -1, -1, -1, -1, -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, -1, -1, -1, 733, 
+    -1, -1, -1, -1, -1, -1, 792, -1, -1, 668, -1, 156, -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, -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, -1, -1, -1, 769, -1, -1, -1, 
+    -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 437, -1, -1, -1, -1, 749, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 659, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 597, 655, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 610, -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, -1, 
+    -1, -1, -1, -1, -1, -1, 575, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -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, -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, -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, -1, -1, -1, -1, 624, -1, -1, -1, 417, -1, -1, 
+    -1, -1, -1, 212, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, 785, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    799, -1, -1, -1, 95, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 303, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, 
+    -1, -1, 341, 679, -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, 384, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 650, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 714, -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, -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, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    418, 666, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    215, 535, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 
+    -1, 497, -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, -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, -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, -1, 209, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 757, -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, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, -1, -1, 234, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 155, -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, -1, -1, -1, 
+    -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 740, -1, -1, -1, -1, -1, 712, -1, -1, -1, -1, -1, -1, -1, 
+    765, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 697, -1, -1, 42, -1, -1, -1, -1, -1, -1, 
+    -1, 594, -1, -1, -1, -1, -1, -1, -1, -1, 538, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 321, -1, 478, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 354, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 516, -1, -1, -1, 472, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 214, -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, -1, -1, -1, -1, 656, -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, -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, -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, 
+    -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, -1, -1, -1, -1, 263, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    774, -1, -1, -1, -1, -1, 299, -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, -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, -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, -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, 388, -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, 381, -1, -1, -1, -1, -1, 
+    -1, -1, 351, -1, -1, -1, 476, -1, -1, -1, -1, -1, -1, -1, -1, 375, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 736, -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, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 790, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 620, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 752, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 390, -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, -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, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 732, 419, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 221, -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, 510, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 654, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 177, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -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, -1, -1, -1, -1, -1, -1, 168, -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, -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, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 738, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 275, 768, -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, -1, -1, -1, -1, -1, -1, 
+    560, -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, 30, -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, -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, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    15, -1, -1, 307, -1, -1, 107, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 448, -1, -1, -1, -1, 628, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 644, -1, -1, 396, -1, -1, -1, -1, 349, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 376, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 244, -1, -1, -1, 719, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 27, -1, -1, -1, -1, -1, -1, -1, 482, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 328, -1, -1, 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 301, -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, -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, -1, -1, -1, 311, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 572, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 356, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 253, -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, -1, -1, -1, -1, -1, -1, -1, 138, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 455, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -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, 
+    -1, -1, 347, -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, -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, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 300, -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, 394, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 447, -1, -1, -1, -1, -1, -1, -1, 789, -1, 393, -1, 639, -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, 646, -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, 682, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 605, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 525, -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, -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, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 544, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 651, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 583, -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, -1, -1, -1, -1, -1, -1, -1, 667, -1, -1, 270, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 410, -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, -1, -1, -1, 382, -1, -1, -1, -1, -1, -1, 463, -1, 
+    -1, -1, -1, -1, -1, -1, 317, -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, -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, -1, -1, -1, 608, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 96, -1, 723, -1, -1, -1, -1, 762, -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, -1, 260, -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, -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, -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, 106, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 116, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 577, -1, -1, -1, -1, -1, -1, -1, 39, -1, 
+    -1, 2, -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, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    519, 11, -1, -1, -1, -1, -1, -1, -1, 562, -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, 686, -1, 
+    -1, -1, 520, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 536, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 78, 123, 445, -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, 59, -1, 
+    -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 632, -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, 660, -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, -1, -1, 
+    -1, -1, 584, -1, -1, -1, -1, 506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 557, -1, -1, 498, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 626, -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, -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, 22, -1, 259, -1, -1, 88, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 314, -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, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, 146, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, 339, -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, 590, -1, -1, -1, -1, -1, -1, -1, -1, -1, 495, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 663, -1, -1, -1, -1, -1, -1, -1, 34, 
+    -1, -1, -1, 289, -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, -1, -1, -1, 548, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, -1, -1, 
+    -1, -1, -1, -1, 779, -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, 318, -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, -1, -1, -1, -1, 627, -1, 141, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 517, -1, 327, -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, -1, -1, -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 721, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 653, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -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, -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, -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, -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, -1, -1, 
+    -1, -1, 183, 479, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    652, -1, -1, -1, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 387, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 565, -1, -1, -1, -1, -1, -1, -1, -1, 675, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 348, -1, -1, -1, -1, 622, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 518, -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, -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, 496, -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, -1, -1, 231, -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, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 435, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, 345, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, 
+    766, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 708, -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, -1, -1, -1, -1, -1, 
+    -1, -1, 635, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 378, -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, 204, -1, -1, 133, -1, 258, -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, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 625, -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, -1, -1, -1, -1, -1, 117, 
+    28, -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, 487, -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, -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, 77, -1, -1, -1, -1, -1, 559, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 707, -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, -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, -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, -1, -1, -1, -1, -1, -1, 794, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    609, -1, -1, -1, -1, -1, -1, 439, 431, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 647, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 340, -1, 413, -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, -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, -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, 309, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 208, -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, -1, -1, -1, 568, -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, -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, -1, -1, 
+    -1, -1, -1, 602, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 527, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233, 566, -1, 
+    -1, -1, -1, -1, -1, 85, -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, -1, -1, -1, -1, 
+    -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    385, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 330, -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, -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, -1, -1, -1, -1, -1, -1, 450, 
+    -1, -1, -1, -1, -1, -1, -1, 788, 787, -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, 
+    -1, -1, -1, 727, -1, -1, -1, -1, 550, -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, 
+    -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, -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, -1, 
+    -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 281, 531, -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, 163, -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, -1, -1, -1, -1, -1, -1, 567, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, 661, 64, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 755, -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, -1, 
+    3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 758, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 772, -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, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    440, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, 
+    -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, 512, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, 389, -1, -1, 
+    -1, -1, -1, 458, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, 801, -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, -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, -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, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 580, -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, -1, 477, -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, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 361, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    201, -1, -1, -1, 67, 715, 803, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    220, -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, -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, 
+    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 441, -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, -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, -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, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 807, -1, -1, -1, 526, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 702, -1, -1, -1, -1, 132, 
+    -1, -1, -1, -1, -1, -1, 480, -1, -1, -1, -1, -1, -1, -1, -1, -1, 195, -1, 
+    -1, -1, -1, -1, -1, 81, -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, 154, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 430, -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, -1, -1, -1, -1, 199, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 737, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, -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, 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 
+    -1, -1, -1, -1, 576, -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, -1, -1, -1, -1, -1, 
+    -1, 633, -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, 65, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 775, 529, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 296, -1, 
+    287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 569, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, 
+    -1, -1, 573, 511, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 797, -1, 415, -1, -1, -1, -1, -1, -1, -1, 782, -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, -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, -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, -1, -1, -1, -1, -1, -1, 409, -1, -1, -1, -1, -1, 403, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    454, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 247, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 600, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 689, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 543, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 706, 32, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 423, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 533, 408, -1, -1, -1, -1, 808, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -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, -1, -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 640, -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, 52, -1, -1, -1, -1, -1, -1, -1, 564, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, 553, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 563, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 589, -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, 358, -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, -1, -1, -1, -1, 
+    -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, 278, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 687, 
+    426, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, 488, -1, -1, -1, 8, 412, -1, 14, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 671, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 524, -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, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 411, 
+    -1, -1, -1, -1, -1, -1, -1, -1, 401, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, 
+    -1, 551, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, 629, -1, -1, -1, -1, -1, 274, -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, -1, -1, -1, -1, -1, 
+    135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    196, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 469, -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, -1, -1, -1, -1, 295, -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, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, 802, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 399, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    158, -1, -1, -1, -1, -1, -1, -1, -1, -1, 595, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 642, -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, -1, 586, -1, -1, -1, -1, 73, 
+    -1, -1, 353, -1, -1, -1, -1, 570, -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, -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, -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, -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, -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, 443, -1, -1, -1, -1, 
+    481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, 771, -1, -1, -1, -1, -1, -1, -1, 147, -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, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 436, -1, -1, -1, -1, -1, -1, 442, -1, -1, -1, -1, -1, -1, 
+    79, -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, 611, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 534, -1, -1, -1, -1, -1, -1, 51, 
+    -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, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 735, -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, -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, -1, -1, -1, -1, 783, -1, 
+    -1, -1, 13, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 294, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, 777, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 457, -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, -1, -1, 796, -1, -1, -1, 709, -1, -1, -1, -1, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 407, -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, 
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 
+    -1, -1, 657, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, 471, -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, -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, -1, -1, 
+    -1, -1, -1, -1, -1, 392, -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, -1, -1, -1, -1, 
+    554, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+    -1, -1, -1, -1, 786, -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, -1, -1 
+  );
+
+{$Q-}
+function TSynFoxproSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 934 + Ord(Str^) * 420;
+    Inc(Str);
+  end;
+  Result := Result mod 17909;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynFoxproSyn.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 TSynFoxproSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynFoxproSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynFoxproSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+constructor TSynFoxproSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FDefaultFilter := SYNS_FilterFoxpro;
+end;
+
+procedure TSynFoxproSyn.AndSymbolProc;
+begin
+  case FLine[Run + 1] of
+    '&':                               {Comments}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkComment;
+        while FLine[Run] <> #0 do
+        begin
+          case FLine[Run] of
+            #10, #13:
+              Break;
+          end; //case
+          Inc(Run);
+        end;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFoxproSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynFoxproSyn.AtSymbolProc;
+begin
+  FTokenID := tkKey;
+  Inc(Run);
+end;
+
+procedure TSynFoxproSyn.BraceOpenProc;
+begin
+  FTokenID := tkString;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+      #92:
+        if FLine[Run + 1] = #10 then Inc(Run);
+    end;
+    Inc(Run);
+  until FLine[Run] = '}';
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynFoxproSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  case FLine[Run + 1] of
+    #10: Inc(Run, 2);
+    else Inc(Run);
+  end;
+end;
+
+procedure TSynFoxproSyn.ColonProc;
+begin
+  {colon}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.EqualProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFoxproSyn.GreaterProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+          Inc(Run, 3)
+        else                           {shift right}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFoxproSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynFoxproSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynFoxproSyn.LowerProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+          Inc(Run, 3)
+        else                           {shift left}
+          Inc(Run, 2);
+        FTokenID := tkSymbol;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+procedure TSynFoxproSyn.MinusProc;
+begin
+  {subtract}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.ModSymbolProc;
+begin
+  {mod}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.NotSymbolProc;
+begin
+  {not}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynFoxproSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynFoxproSyn.OrSymbolProc;
+begin
+  {or}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.PlusProc;
+begin
+  {subtract}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.PointProc;
+begin
+  if ((SynWideUpperCase(FLine[Run + 1]) = 'T') or      {.t.}
+    (SynWideUpperCase(FLine[Run + 1]) = 'F')) and     {.f.}
+    (FLine[Run + 2] = '.') then
+  begin
+    Inc(Run, 3);
+    FTokenID := tkSymbol;
+  end
+  else if (((SynWideUpperCase(FLine[Run + 1]) = 'A') and
+    (SynWideUpperCase(FLine[Run + 2]) = 'N') and
+    (SynWideUpperCase(FLine[Run + 3]) = 'D')) or   {.and.}
+    ((SynWideUpperCase(FLine[Run + 1]) = 'N') and
+    (SynWideUpperCase(FLine[Run + 2]) = 'O') and
+    (SynWideUpperCase(FLine[Run + 3]) = 'T'))) and   {.not.}
+    (FLine[Run + 4] = '.') then
+  begin
+    Inc(Run, 5);
+    FTokenID := tkSymbol;
+  end
+  else if (SynWideUpperCase(FLine[Run + 1]) = 'O') and
+    (SynWideUpperCase(FLine[Run + 2]) = 'R') and
+    (FLine[Run + 3] = '.') then  {.or.}
+  begin
+    Inc(Run, 4);
+    FTokenID := tkSymbol;
+  end
+  else                                 {point}
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynFoxproSyn.QuestionProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.SlashProc;
+begin
+  {division}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynFoxproSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.StarProc;
+begin
+  if (Run = 0) or (WideTrim(Copy(FLine, 1, Run)) = '') then
+  begin                        {Foxpro Comments}
+    Inc(Run);
+    FTokenID := tkComment;
+    while FLine[Run] <> #0 do
+    begin
+      case FLine[Run] of
+        #10, #13:
+          Break;
+      end;
+      Inc(Run);
+    end;
+  end
+  else
+  begin
+    {star}
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynFoxproSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+      #92:
+        if FLine[Run + 1] = #10 then
+          Inc(Run);
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynFoxproSyn.TildeProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.XOrSymbolProc;
+begin
+  {xor}
+  Inc(Run);
+  FTokenID := tkSymbol;
+end;
+
+procedure TSynFoxproSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynFoxproSyn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+    '&': AndSymbolProc;
+    #39: AsciiCharProc;
+    '@': AtSymbolProc;
+    '{': BraceOpenProc;
+    #13: CRProc;
+    ':': ColonProc;
+    ',': CommaProc;
+    '=': EqualProc;
+    '>': GreaterProc;
+    'A'..'Z', 'a'..'z', '_': IdentProc;
+    #10: LFProc;
+    '<': LowerProc;
+    '-': MinusProc;
+    '%': ModSymbolProc;
+    '!': NotSymbolProc;
+    #0: NullProc;
+    '0'..'9': NumberProc;
+    '|': OrSymbolProc;
+    '+': PlusProc;
+    '.': PointProc;
+    '?': QuestionProc;
+    ')': RoundCloseProc;
+    '(': RoundOpenProc;
+    ';': SemiColonProc;
+    '/': SlashProc;
+    #1..#9, #11, #12, #14..#32: SpaceProc;
+    ']': SquareCloseProc;
+    '[': SquareOpenProc;
+    '*': StarProc;
+    #34: StringProc;
+    '~': TildeProc;
+    '^': XOrSymbolProc;
+    else UnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynFoxproSyn.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 TSynFoxproSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynFoxproSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynFoxproSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case GetTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else
+      Result := nil;
+  end;
+end;
+
+function TSynFoxproSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynFoxproSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterFoxpro;
+end;
+
+class function TSynFoxproSyn.GetLanguageName: string;                    
+begin
+  Result := SYNS_LangFoxpro;
+end;
+
+class function TSynFoxproSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangFoxpro;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynFoxproSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterGLSL.pas b/Source/VCL/SynEdit/Source/SynHighlighterGLSL.pas
new file mode 100644
index 00000000..18312258
--- /dev/null
+++ b/Source/VCL/SynEdit/Source/SynHighlighterGLSL.pas
@@ -0,0 +1,1623 @@
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCpp.pas, released 2000-04-10.
+The Original Code is based on the dcjCppSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Michael Trier.
+Unicode translation by Maël Hörz.
+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: SynHighlighterCpp.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a C++ syntax highlighter for SynEdit)
+@author(Michael Trier)
+@created(1998)
+@lastmod(2001-11-21)
+The SynHighlighterCpp unit provides SynEdit with a C++ syntax highlighter.
+Thanks to Martin Waldenburg.
+}
+
+unit SynHighlighterGLSL;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkInterfaceQualifier,
+    tkInternalFunction, tkKey, tkNull, tkNumber, tkSpace, tkString, tkSymbol,
+    tkUnknown, tkChar, tkFloat, tkHex, tkOctal);
+
+  TxtkTokenKind = (
+    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
+    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
+    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
+    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
+    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
+    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
+    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
+    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
+    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
+    xtkXorAssign);
+
+  TRangeState = (rsUnknown, rsAnsiC, rsDirective, rsDirectiveComment,
+    rsMultiLineString, rsMultiLineDirective);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer; MayBe: PWideChar): TtkTokenKind of object;
+
+  TSynGLSLSyn = class(TSynCustomHighlighter)
+  private
+    FAsmStart: Boolean;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FExtTokenID: TxtkTokenKind;
+    FIdentFuncTable: array[0..2010] of TIdentFuncTableFunc;
+    FInternalFuncTable: array[0..1050] of TIdentFuncTableFunc;
+    FInterfaceQualifierAttri: TSynHighlighterAttributes;
+    FInternalFunctionsAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInvalidAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FFloatAttri: TSynHighlighterAttributes;
+    FHexAttri: TSynHighlighterAttributes;
+    FOctalAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FCharAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+    function AltFinalFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+    function InternalFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
+    function KeyWordFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
+    function InterfaceQualifierFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function HashInternal(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AnsiCProc;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure DirectiveProc;
+    procedure DirectiveEndProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+    procedure StringEndProc;
+  protected
+    function GetExtTokenID: TxtkTokenKind;
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+
+    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property InterfaceQualifierAttri: TSynHighlighterAttributes
+      read FInterfaceQualifierAttri write FInterfaceQualifierAttri;
+    property InternalFunctions: TSynHighlighterAttributes
+      read FInternalFunctionsAttri write FInternalFunctionsAttri;
+    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
+      write FInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
+      write FNumberAttri;
+    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
+      write FFloatAttri;
+    property HexAttri: TSynHighlighterAttributes read FHexAttri
+      write FHexAttri;
+    property OctalAttri: TSynHighlighterAttributes read FOctalAttri
+      write FOctalAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri
+      write FStringAttri;
+    property CharAttri: TSynHighlighterAttributes read FCharAttri
+      write FCharAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
+      write FSymbolAttri;
+  end;
+
+implementation
+
+uses
+  Windows,
+  SynEditStrConst;
+
+const
+  // as this language is case-insensitive keywords *must* be in lowercase
+  GKeyWords: array[0..239] of UnicodeString = (
+    'active', 'asm', 'atomic_uint', 'attribute', 'bool', 'break', 'buffer',
+    'bvec2', 'bvec3', 'bvec4', 'case', 'cast', 'centroid', 'class', 'coherent',
+    'common', 'const', 'continue', 'def', 'default', 'discard', 'dmat2',
+    'dmat2x2', 'dmat2x3', 'dmat2x4', 'dmat3', 'dmat3x2', 'dmat3x3', 'dmat3x4',
+    'dmat4', 'dmat4x2', 'dmat4x3', 'dmat4x4', 'do', 'double', 'dvec2', 'dvec3',
+    'dvec4', 'else', 'enum', 'extern', 'external', 'false', 'filter', 'fixed',
+    'flat', 'float', 'for', 'fvec2', 'fvec3', 'fvec4', 'goto', 'half', 'highp',
+    'hvec2', 'hvec3', 'hvec4', 'if', 'iimage1d', 'iimage1darray', 'iimage2d',
+    'iimage2darray', 'iimage2dms', 'iimage2dmsarray', 'iimage2drect',
+    'iimage3d', 'iimagebuffer', 'iimagecube', 'iimagecubearray', 'image1d',
+    'image1darray', 'image2d', 'image2darray', 'image2dms', 'image2dmsarray',
+    'image2drect', 'image3d', 'imagebuffer', 'imagecubearray', 'in', 'inline',
+    'inout', 'input', 'int', 'interface', 'invariant', 'isampler1d',
+    'isampler1darray', 'isampler2d', 'isampler2darray', 'isampler2dms',
+    'isampler2dmsarray', 'isampler2drect', 'isampler3d', 'isamplerbuffer',
+    'isamplercube', 'isamplercubearray', 'isubpassinput', 'isubpassinputms',
+    'itexture1d', 'itexture1darray', 'itexture2d', 'itexture2darray',
+    'itexture2dms', 'itexture2dmsarray', 'itexture2drect', 'itexture3d',
+    'itexturebuffer', 'itexturecube', 'itexturecubearray', 'ivec2', 'ivec3',
+    'ivec4', 'layout', 'long', 'lowp', 'mat2', 'mat2x2', 'mat2x3', 'mat2x4',
+    'mat3', 'mat3x2', 'mat3x3', 'mat3x4', 'mat4', 'mat4x2', 'mat4x3', 'mat4x4',
+    'mediump', 'namespace', 'noinline', 'noperspective', 'out', 'output',
+    'partition', 'patch', 'precise', 'precision', 'public', 'readonly',
+    'resource', 'restrict', 'return', 'sample', 'sampler', 'sampler1d',
+    'sampler1darray', 'sampler1darrayshadow', 'sampler1dshadow', 'sampler2d',
+    'sampler2darray', 'sampler2darrayshadow', 'sampler2dms', 'sampler2dmsarray',
+    'sampler2drectshadow', 'sampler2dshadow', 'sampler3d', 'sampler3drect',
+    'samplerbuffer', 'samplercubearray', 'samplercubearrayshadow',
+    'samplercubeshadow', 'samplershadow', 'shared', 'short', 'sizeof', 'smooth',
+    'static', 'struct', 'subpassinput', 'subpassinputms', 'subroutine',
+    'superp', 'switch', 'template', 'texture1d', 'texture1darray', 'texture2d',
+    'texture2darray', 'texture2dms', 'texture2dmsarray', 'texture2drect',
+    'texture3d', 'texturebuffer', 'texturecube', 'texturecubearray', 'this',
+    'true', 'type', 'uimage1d', 'uimage1darray', 'uimage2d', 'uimage2darray',
+    'uimage2dms', 'uimage2dmsarray', 'uimage2drect', 'uimage3dimagecube',
+    'uimagebuffer', 'uimagecube', 'uimagecubearray', 'uint', 'uniform', 'union',
+    'unsigned', 'usampler1d', 'usampler1darray', 'usampler2d',
+    'usampler2darraysampler2drect', 'usampler2dms', 'usampler2dmsarray',
+    'usampler2drect', 'usampler3dsamplercube', 'usamplerbuffer', 'usamplercube',
+    'usamplercubearray', 'using', 'usubpassinput', 'usubpassinputms',
+    'utexture1d', 'utexture1darray', 'utexture2d', 'utexture2darray',
+    'utexture2dms', 'utexture2dmsarray', 'utexture2drect', 'utexture3d',
+    'utexturebuffer', 'utexturecube', 'utexturecubearray', 'uvec2', 'uvec3',
+    'uvec4', 'varying', 'vec2', 'vec3', 'vec4', 'void', 'volatile', 'while',
+    'writeonly'
+  );
+
+  GInternalFunctions: array[0..160] of UnicodeString = (
+    'abs', 'acos', 'all', 'allinvocations', 'allinvocationsequal', 'any',
+    'anyinvocation', 'asin', 'atan', 'atomicadd', 'atomicand', 'atomiccompswap',
+    'atomiccounter', 'atomiccounteradd', 'atomiccounterand',
+    'atomiccountercompswap', 'atomiccounterdecrement', 'atomiccounterexchange',
+    'atomiccounterincrement', 'atomiccountermax', 'atomiccountermin',
+    'atomiccounteror', 'atomiccountersubtract', 'atomiccounterxor',
+    'atomicexchange', 'atomicmax', 'atomicmin', 'atomicor', 'atomicxor',
+    'barrier', 'bitcount', 'bitfieldextract', 'bitfieldinsert',
+    'bitfieldreverse', 'ceil', 'clamp', 'cos', 'cross', 'degrees',
+    'determinant', 'dfdx', 'dfdxcoarse', 'dfdxfine', 'dfdy', 'dfdycoarse',
+    'dfdyfine', 'distance', 'dot', 'emitstreamvertex', 'emitvertex',
+    'endprimitive', 'endstreamprimitive', 'equal', 'exp', 'exp2', 'faceforward',
+    'findlsb', 'findmsb', 'floor', 'fract', 'ftransform', 'fwidth',
+    'fwidthcoarse', 'fwidthfine', 'greaterthan', 'greaterthanequal',
+    'groupmemorybarrier', 'imageatomicadd', 'imageatomicand',
+    'imageatomiccompswap', 'imageatomicexchange', 'imageatomicmax',
+    'imageatomicmin', 'imageatomicor', 'imageatomicxor', 'imageload',
+    'imagesamples', 'imagesize', 'imagestore', 'imulextended',
+    'interpolateatcentroid', 'interpolateatoffset', 'interpolateatsample',
+    'inverse', 'inversesqrt', 'length', 'lessthan', 'lessthanequal', 'log',
+    'log2', 'matrixcompmult', 'max', 'memorybarrier',
+    'memorybarrieratomiccounter', 'memorybarrierbuffer', 'memorybarrierimage',
+    'memorybarriershared', 'min', 'mix', 'mod', 'noise1', 'noise2', 'noise3',
+    'noise4', 'normalize', 'not', 'notequal', 'outerproduct', 'pow', 'radians',
+    'reflect', 'refract', 'shadow2d', 'shadow2dproj', 'shadowld',
+    'shadowldproj', 'sign', 'sin', 'smoothstep', 'sqrt', 'step', 'subpassload',
+    'tan', 'texelfetch', 'texelfetchoffset', 'texture', 'texture1d',
+    'texture1dlod', 'texture1dproj', 'texture1dprojlod', 'texture2d',
+    'texture2dlod', 'texture2dproj', 'texture2dprojlod', 'texture3d',
+    'texture3dlod', 'texture3dproj', 'texture3dprojlod', 'texturecube',
+    'texturecubelod', 'texturegather', 'texturegatheroffset',
+    'texturegatheroffsets', 'texturegrad', 'texturegradoffset', 'texturelod',
+    'texturelodoffset', 'textureoffset', 'textureproj', 'textureprojgrad',
+    'textureprojgradoffset', 'textureprojlod', 'textureprojlodoffset',
+    'textureprojoffset', 'texturequerylevels', 'texturequerylod', 'texturesize',
+    'transpose', 'uaddcarry', 'umulextended', 'usubborrow'
+  );
+
+  GKeyIndices: array[0..2010] of Integer = (
+    -1, -1, 22, -1, -1, 65, -1, -1, -1, -1, -1, 129, 8, -1, 177, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 226, 23, -1, -1, -1, 182, -1, 33, 98, -1, -1, 9, -1, -1,
+    -1, 200, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, 108, 72, -1, -1, -1, -1, -1, -1, -1, -1, 163, 69, -1, 195, -1,
+    -1, 85, -1, -1, -1, -1, -1, -1, 79, 186, -1, 71, -1, -1, -1, -1, 68, -1, -1,
+    2, -1, 146, 96, -1, -1, -1, 76, -1, -1, -1, -1, 215, 219, -1, 30, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, 51,
+    -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, 206, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 239,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1,
+    -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 145, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, 149, -1, -1, -1, -1, 114, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 140, -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, 81, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 197, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, 1, 228, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, -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, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1,
+    -1, -1, 99, -1, -1, -1, -1, -1, 125, 135, -1, -1, -1, -1, -1, -1, -1, 101,
+    -1, -1, -1, -1, -1, -1, -1, -1, 187, -1, 0, -1, -1, 126, 106, -1, -1, -1,
+    -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, 127,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 113, -1, -1, -1,
+    -1, 118, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 150, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, 130, -1, 165,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 12, 46, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, 171, -1, 15, -1,
+    -1, -1, -1, -1, -1, 77, -1, -1, 93, -1, -1, -1, 217, -1, -1, -1, -1, -1, 41,
+    -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 176, -1, -1, -1, -1, -1, 208, -1, -1,
+    -1, 105, -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, -1, -1, -1, -1, -1, -1, 159, -1,
+    -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 64, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1,
+    -1, -1, 16, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, -1, 236, 166, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1,
+    -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1,
+    -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    138, 112, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1,
+    109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
+    134, -1, -1, -1, -1, 107, -1, -1, 178, -1, -1, -1, -1, 147, -1, -1, -1, -1,
+    -1, 136, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    229, -1, 173, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 230, 54, 66, -1, 233, -1, 14, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, 152, -1, -1, -1, 18, -1, -1, 231, 55, -1, -1, 234, -1, -1, -1,
+    -1, -1, -1, -1, -1, 94, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1,
+    235, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1,
+    -1, 44, -1, -1, -1, -1, -1, 120, -1, -1, 193, 20, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, 124, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1,
+    207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, 104, -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, -1, -1, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
+    -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 19, -1, -1, 82, -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, -1,
+    -1, -1, -1, -1, -1, -1, 4, -1, -1, 213, 121, 214, -1, 157, 170, -1, -1, -1,
+    -1, 181, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, 48, -1, 122, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49,
+    -1, 123, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 164, -1, -1, -1,
+    78, -1, -1, -1, 50, -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, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, 162, 169, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1,
+    -1, -1, -1, -1, -1, -1, -1, 90, -1, 43, -1, -1, -1, -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, -1, -1, -1, -1, -1, -1, -1, 184, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47,
+    -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1,
+    -1, -1, -1, 102, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 36, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1,
+    -1, 203, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, 188, -1, -1, 34, -1, 62, -1, -1, -1, -1, -1, -1,
+    -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, 84, -1,
+    42, 209, 185, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    137, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 151, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1,
+    5, 174, -1, -1, -1, 143, -1, 52, 74, -1, -1, 201, -1, -1, -1, -1, -1, -1,
+    -1, 237, -1, 190, -1, -1, -1, 202, -1, -1, -1, -1, -1, -1, -1, 11, 154, 218,
+    -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, 220, -1, 133, -1,
+    -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, 212, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, 21, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 25,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, 29, 7, 60, -1, -1, -1, -1, -1, -1, -1, -1, 175
+  );
+
+  GInternalFunctionIndices: array[0..1050] of Integer = (
+    -1, -1, -1, -1, -1, -1, -1, 50, 63, -1, 34, -1, 5, -1, 118, -1, 17, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, 65,
+    -1, -1, 19, -1, 141, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48,
+    -1, 40, 99, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1,
+    -1, -1, 24, -1, -1, -1, -1, -1, 71, -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, -1,
+    145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, 25, -1, -1,
+    -1, 52, 109, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, 159, -1, -1, -1,
+    -1, -1, -1, -1, -1, 98, 90, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, 87, -1, -1, -1, -1, 42, -1, -1,
+    -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, 39, 160, 9, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, 10, -1,
+    -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, 31,
+    -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 101, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, 102, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, -1, -1, 127,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, 2, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, 29, -1, 96,
+    -1, -1, -1, 53, -1, -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, 12, 88, -1, -1,
+    -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, 125, -1, -1, -1, 150,
+    -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 116,
+    -1, -1, 139, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 66, -1,
+    -1, 135, -1, -1, -1, -1, 82, 115, 16, -1, -1, 91, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, 89, -1, 124, -1, 72, -1, -1, -1, -1, -1, -1, 77, 123,
+    47, -1, -1, 151, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1,
+    -1, -1, -1, -1, -1, 136, 27, -1, 44, -1, -1, -1, -1, -1, -1, 85, -1, 26, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, 76, -1, -1, -1, -1, -1, -1, -1,
+    55, -1, 81, -1, -1, -1, -1, -1, 46, -1, -1, -1, 8, 61, -1, -1, -1, -1, -1,
+    -1, 126, -1, -1, 80, -1, -1, -1, -1, 22, -1, -1, -1, 78, -1, -1, -1, 54, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, 154, -1, 149, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -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, 3, -1, -1, -1, -1, -1, -1, -1,
+    -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, 121,
+    -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, 95, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1,
+    -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, 38, 153, -1,
+    -1, -1, 74, -1, -1, -1, -1, 122, 75, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1,
+    -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, 84, -1, 36, 158, -1, -1, -1, -1, -1, -1, -1, 86, -1, 4, -1,
+    113, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129,
+    -1, 57, 112, -1, -1, -1, 83, -1, -1, 105, -1, -1, 32, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, 70, -1, -1, 144, -1,
+    -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, 132, -1, 107, -1, -1, -1, -1, -1,
+    -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, 146, 79,
+    69
+  );
+
+{$Q-}
+function TSynGLSLSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 875 + Ord(Str^) * 23;
+    inc(Str);
+  end;
+  Result := Result mod 2011;
+  FStringLen := Str - FToIdent;
+end;
+
+function TSynGLSLSyn.HashInternal(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 703 + Ord(Str^) * 16;
+    inc(Str);
+  end;
+  Result := Result mod 1051;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynGLSLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Key: Cardinal;
+begin
+  FToIdent := MayBe;
+  Key := HashKey(MayBe);
+  if Key <= High(FIdentFuncTable) then
+    Result := FIdentFuncTable[Key](GKeyIndices[Key], Maybe)
+  else
+  begin
+    Key := HashInternal(MayBe);
+    if Key <= High(FInternalFuncTable) then
+      Result := FInternalFuncTable[Key](GInternalFunctionIndices[Key], Maybe)
+    else
+      Result := tkIdentifier;
+  end;
+end;
+
+procedure TSynGLSLSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if GKeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  for i := Low(FInternalFuncTable) to High(FInternalFuncTable) do
+    if GInternalFunctionIndices[i] = -1 then
+      FInternalFuncTable[i] := AltFinalFunc;
+
+  FIdentFuncTable[83] := InterfaceQualifierFunc;
+  FIdentFuncTable[143] := InterfaceQualifierFunc;
+  FIdentFuncTable[460] := InterfaceQualifierFunc;
+  FIdentFuncTable[1312] := InterfaceQualifierFunc;
+  FIdentFuncTable[1878] := InterfaceQualifierFunc;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+
+  for i := Low(FInternalFuncTable) to High(FInternalFuncTable) do
+    if @FInternalFuncTable[i] = nil then
+      FInternalFuncTable[i] := InternalFunc;
+end;
+
+function TSynGLSLSyn.InterfaceQualifierFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+begin
+  if IsCurrentToken(GKeyWords[Index]) then
+    Result := tkInterfaceQualifier
+  else
+    Result := tkIdentifier
+end;
+
+function TSynGLSLSyn.AltFinalFunc(Index: Integer;
+  Maybe: PWideChar): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynGLSLSyn.AltFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+var
+  Key: Cardinal;
+begin
+  Key := HashInternal(MayBe);
+  if Key <= High(FInternalFuncTable) then
+    Result := FInternalFuncTable[Key](GInternalFunctionIndices[Key], Maybe)
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGLSLSyn.KeyWordFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+begin
+  if IsCurrentToken(GKeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+function TSynGLSLSyn.InternalFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
+begin
+  if IsCurrentToken(GInternalFunctions[Index]) then
+    Result := tkInternalFunction
+  else
+    Result := tkIdentifier
+end;
+
+constructor TSynGLSLSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsItalic];
+  FCommentAttri.Foreground := clGray;
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  FInterfaceQualifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrInterfaceQualifier, SYNS_FriendlyAttrInterfaceQualifier);
+  FInterfaceQualifierAttri.Style:= [fsBold];
+  FInternalFunctionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
+  FInternalFunctionsAttri.Foreground := clGreen;
+  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Foreground := clNavy;
+  FKeyAttri.Style:= [fsBold];
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FNumberAttri.Foreground := clMaroon;
+  FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
+  FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
+  FFloatAttri.Foreground := clOlive;
+  FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
+  FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+
+  AddAttribute(FCommentAttri);
+  AddAttribute(FIdentifierAttri);
+  AddAttribute(FInterfaceQualifierAttri);
+  AddAttribute(FInternalFunctionsAttri);
+  AddAttribute(FInvalidAttri);
+  AddAttribute(FKeyAttri);
+  AddAttribute(FNumberAttri);
+  AddAttribute(FCharAttri);
+  AddAttribute(FFloatAttri);
+  AddAttribute(FHexAttri);
+  AddAttribute(FOctalAttri);
+  AddAttribute(FSpaceAttri);
+  AddAttribute(FStringAttri);
+  AddAttribute(FDirecAttri);
+  AddAttribute(FSymbolAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+
+  InitIdent;
+  FRange := rsUnknown;
+  FAsmStart := False;
+  FDefaultFilter := SYNS_FilterGLSL;
+end;
+
+procedure TSynGLSLSyn.AnsiCProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          Inc(Run, 2);
+          if (FRange = rsDirectiveComment) and
+            not IsLineEnd(Run) then
+              FRange := rsMultiLineDirective
+          else
+            FRange := rsUnknown;
+          Break;
+        end else
+          Inc(Run);
+      #10, #13:
+        Break;
+      else
+        Inc(Run);
+    end;
+end;
+
+procedure TSynGLSLSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAndAssign;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogAnd;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAnd;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.AsciiCharProc;
+begin
+  FTokenID := tkChar;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#39, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #39);
+  if FLine[Run] = #39 then
+    Inc(Run);
+end;
+
+procedure TSynGLSLSyn.AtSymbolProc;
+begin
+  FTokenID := tkUnknown;
+  Inc(Run);
+end;
+
+procedure TSynGLSLSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceClose;
+end;
+
+procedure TSynGLSLSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceOpen;
+end;
+
+procedure TSynGLSLSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run + 1] = #10 then Inc(Run);
+end;
+
+procedure TSynGLSLSyn.ColonProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkScopeResolution;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkColon;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkComma;
+end;
+
+procedure TSynGLSLSyn.DirectiveProc;
+begin
+  if WideTrim(FLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
+  begin
+    FTokenID := tkUnknown;
+    Inc(Run);
+    Exit;
+  end;
+  FTokenID := tkDirective;
+  repeat
+    if FLine[Run] = '/' then // comment?
+    begin
+      if FLine[Run + 1] = '/' then // is end of directive as well
+      begin
+        FRange := rsUnknown;
+        Exit;
+      end
+      else
+        if FLine[Run + 1] = '*' then // might be embedded only
+        begin
+          FRange := rsDirectiveComment;
+          Exit;
+        end;
+    end;
+    if (FLine[Run] = '\') and (FLine[Run +1 ] = #0) then // a multiline directive
+    begin
+      Inc(Run);
+      FRange := rsMultiLineDirective;
+      Exit;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run)
+end;
+
+procedure TSynGLSLSyn.DirectiveEndProc;
+begin
+  FTokenID := tkDirective;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+  FRange := rsUnknown;
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '/': // comment?
+        begin
+          case FLine[Run + 1] of
+            '/': // is end of directive as well
+              begin
+                FRange := rsUnknown;
+                Exit;
+              end;
+            '*': // might be embedded only
+              begin
+                FRange := rsDirectiveComment;
+                Exit;
+              end;
+          end;
+        end;
+      '\': // yet another line?
+        begin
+          if FLine[Run + 1] = #0 then
+          begin
+            Inc(Run);
+            FRange := rsMultiLineDirective;
+            Exit;
+          end;
+        end;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run);
+end;
+
+procedure TSynGLSLSyn.EqualProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogEqual;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAssign;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkGreaterThanEqual;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftRightAssign;
+        end
+        else                           {shift right}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftRight;
+        end;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkGreaterThan;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.QuestionProc;
+begin
+  FTokenID := tkSymbol;                {conditional}
+  FExtTokenID := xtkQuestion;
+  Inc(Run);
+end;
+
+procedure TSynGLSLSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynGLSLSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynGLSLSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLessThanEqual;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftLeftAssign;
+        end
+        else                           {shift left}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftLeft;
+        end;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLessThan;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkSubtractAssign;
+      end;
+    '-':                               {decrement}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkDecrement;
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkArrow;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkSubtract;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkModAssign;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkMod;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.NotSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkNotEqual;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLogComplement;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynGLSLSyn.NumberProc;
+
+  function IsNumberChar(Run: Integer): Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', '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'..'7':
+        if (Run = Succ(idx1)) and (FLine[idx1] = '0') then // octal number
+          FTokenID := tkOctal;
+      '8', '9':
+        if (FLine[idx1] = '0') and
+           ((FTokenID <> tkHex) and (FTokenID <> tkFloat)) then // invalid octal char
+             FTokenID := tkUnknown;
+      'a'..'d', 'A'..'D':
+        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;
+      'f', 'F':
+        if FTokenID <> tkHex then
+        begin
+          for i := idx1 to Pred(Run) do
+            if CharInSet(FLine[i], ['f', 'F']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+          if FTokenID = tkFloat then
+          begin
+            if CharInSet(FLine[Pred(Run)], ['l', 'L']) then // can't mix
+              Break;
+          end
+          else
+            FTokenID := tkFloat;
+        end;
+      'l', 'L':
+        begin
+          for i := idx1 to Run - 2 do
+            if CharInSet(FLine[i], ['l', 'L']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+          if FTokenID = tkFloat then
+            if CharInSet(FLine[Pred(Run)], ['f', 'F']) then // can't mix
+              Break;
+        end;
+      'u', 'U':
+        if FTokenID = tkFloat then // not allowed
+          Break
+        else
+          for i := idx1 to Pred(Run) do
+            if CharInSet(FLine[i], ['u', 'U']) then // declaration syntax error
+            begin
+              FTokenID := tkUnknown;
+              Exit;
+            end;
+      '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 TSynGLSLSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {or assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncOrAssign;
+      end;
+    '|':                               {logical or}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogOr;
+      end;
+  else                                 {or}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkIncOr;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAddAssign;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncrement;
+      end;
+  else                                 {add}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAdd;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
+    begin                              {ellipse}
+      Inc(Run, 3);
+      FExtTokenID := xtkEllipse;
+    end
+  else
+    if CharInSet(FLine[Run + 1], ['0'..'9']) then // float
+    begin
+      Dec(Run); // numberproc must see the point
+      NumberProc;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkPoint;
+    end;
+end;
+
+procedure TSynGLSLSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundClose;
+end;
+
+procedure TSynGLSLSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundOpen;
+end;
+
+procedure TSynGLSLSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSemiColon;
+end;
+
+procedure TSynGLSLSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':                               {c++ style comments}
+      begin
+        FTokenID := tkComment;
+        Inc(Run, 2);
+        while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '*':                               {c style comments}
+      begin
+        FTokenID := tkComment;
+        if FRange <> rsDirectiveComment then
+          FRange := rsAnsiC;
+        Inc(Run, 2);
+        while FLine[Run] <> #0 do
+          case FLine[Run] of
+            '*':
+              if FLine[Run + 1] = '/' then
+              begin
+                Inc(Run, 2);
+                if FRange = rsDirectiveComment then
+                  FRange := rsMultiLineDirective
+                else
+                  FRange := rsUnknown;
+                Break;
+              end else Inc(Run);
+            #10, #13:
+              begin
+                if FRange = rsDirectiveComment then
+                  FRange := rsAnsiC;
+                Break;
+              end;
+          else Inc(Run);
+          end;
+      end;
+    '=':                               {divide assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+        FExtTokenID := xtkDivideAssign;
+      end;
+  else                                 {divide}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      FExtTokenID := xtkDivide;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynGLSLSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareClose;
+end;
+
+procedure TSynGLSLSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareOpen;
+end;
+
+procedure TSynGLSLSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkMultiplyAssign;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkStar;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      case FLine[Run + 1] of
+        #34, '\':
+          Inc(Run);
+        #00:
+          begin
+            Inc(Run);
+            FRange := rsMultilineString;
+            Exit;
+          end;
+      end;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynGLSLSyn.StringEndProc;
+begin
+  FTokenID := tkString;
+
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  FRange := rsUnknown;
+
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      '\':
+        begin
+          case FLine[Run + 1] of
+            #34, '\':
+              Inc(Run);
+            #00:
+              begin
+                Inc(Run);
+                FRange := rsMultilineString;
+                Exit;
+              end;
+          end;
+        end;
+      #34: Break;
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynGLSLSyn.TildeProc;
+begin
+  Inc(Run);                            {bitwise complement}
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBitComplement;
+end;
+
+procedure TSynGLSLSyn.XOrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+  	'=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkXorAssign;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkXor;
+    end;
+  end;
+end;
+
+procedure TSynGLSLSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynGLSLSyn.Next;
+begin
+  FAsmStart := False;
+  FTokenPos := Run;
+  case FRange of
+    rsAnsiC, rsDirectiveComment: AnsiCProc;
+    rsMultiLineDirective: DirectiveEndProc;
+    rsMultilineString: StringEndProc;
+  else
+    begin
+      case FLine[Run] of
+        '&': AndSymbolProc;
+        #39: AsciiCharProc;
+        '@': AtSymbolProc;
+        '}': BraceCloseProc;
+        '{': BraceOpenProc;
+        #13: CRProc;
+        ':': ColonProc;
+        ',': CommaProc;
+        '#': DirectiveProc;
+        '=': EqualProc;
+        '>': GreaterProc;
+        '?': QuestionProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        #10: LFProc;
+        '<': LowerProc;
+        '-': MinusProc;
+        '%': ModSymbolProc;
+        '!': NotSymbolProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '|': OrSymbolProc;
+        '+': PlusProc;
+        '.': PointProc;
+        ')': RoundCloseProc;
+        '(': RoundOpenProc;
+        ';': SemiColonProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        ']': SquareCloseProc;
+        '[': SquareOpenProc;
+        '*': StarProc;
+        #34: StringProc;
+        '~': TildeProc;
+        '^': XOrSymbolProc;
+        else UnknownProc;
+      end;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynGLSLSyn.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 TSynGLSLSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynGLSLSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynGLSLSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynGLSLSyn.GetExtTokenID: TxtkTokenKind;
+begin
+  Result := FExtTokenID;
+end;
+
+function TSynGLSLSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  FTokenID := GetTokenID;
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkDirective: Result := FDirecAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkInterfaceQualifier: Result := FInterfaceQualifierAttri;
+    tkInternalFunction: Result := FInternalFunctionsAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkFloat: Result := FFloatAttri;
+    tkHex: Result := FHexAttri;
+    tkOctal: Result := FOctalAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkChar: Result := FCharAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FInvalidAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynGLSLSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+procedure TSynGLSLSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynGLSLSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynGLSLSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterGLSL;
+end;
+
+class function TSynGLSLSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGLSL;
+end;
+
+function TSynGLSLSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    'const int foo = 5;'#13#10 +
+    'uniform vec2 bar;'#13#10 +
+    'uniform sampler2d tex;'#13#10#13#10 +
+    'float rand(vec2 co){'#13#10 +
+    'return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);'#13#10 +
+    '}'#13#10#13#10 +
+    'void main()'#13#10 +
+    '{'#13#10 +
+    '  uint value = 21; // comment'#13#10 +
+    '  float number = abs(bar.x);'#13#10 +
+    '  if (foo < sin(3.14 * value))'#13#10 +
+    '    value = cos(12 * value);'#13#10 +
+    '  vec4 colors = texture(tex, bar.xy);'#13#10 +
+    '  for(int i = bar.x; i < bar.y; ++i)'#13#10 +
+    '  {'#13#10 +
+    '  }'#13#10 +
+    '}';
+end;
+
+class function TSynGLSLSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGLSL;
+end;
+
+initialization
+{$IFNDEF SYN_GLSLB_1}
+  RegisterPlaceableHighlighter(TSynGLSLSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterGWS.pas b/Source/VCL/SynEdit/Source/SynHighlighterGWS.pas
index 9ed6ae70..94335ca5 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterGWS.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterGWS.pas
@@ -1,1038 +1,1041 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterCpp.pas, released 2000-04-10.
-The Original Code is based on the dcjCppSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Michael Trier.
-Unicode translation by Maël Hörz.
-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: SynHighlighterGWS.pas,v 1.13.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-
-unit SynHighlighterGWS;
-
-{ This unit provides a syntax highlighter for GW-TEL Scripts }
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-Type
-  TtkTokenKind = (
-    tkComment,
-    tkIdentifier,
-    tkKey,
-    tkNull,
-    tkNumber,
-    tkSpace,
-    tkString,
-    tkSymbol,
-    tkUnknown);
-
-  TxtkTokenKind = (
-    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
-    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
-    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
-    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
-    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
-    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
-    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
-    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
-    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
-    xtkXorAssign);
-
-  TRangeState = (rsAnsiC, rsUnKnown);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynGWScriptSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FExtTokenID: TxtkTokenKind;
-    fIdentFuncTable: array[0..12] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fInvalidAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncBool(Index: Integer): TtkTokenKind;
-    function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncChar(Index: Integer): TtkTokenKind;
-    function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncFalse(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
-    function FuncReturn(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
-    function FuncTrue(Index: Integer): TtkTokenKind;
-    function FuncWhile(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure AnsiCProc;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-    procedure InitIdent;
-  protected
-    function GetExtTokenID: TxtkTokenKind;
-    function IsFilterStored: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-    function GetDefaultAttribute (Index: integer): TSynHighlighterAttributes; override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-
-    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri write fInvalidAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..12] of string = (
-    'bool', 'break', 'char', 'do', 'else', 'false', 'for', 'if', 'int', 
-    'return', 'string', 'true', 'while' 
-  );
-
-  KeyIndices: array[0..12] of Integer = (
-    8, 5, 11, 12, 1, 10, 0, 2, 9, 4, 6, 3, 7 
-  );
-
-{$Q-}
-function TSynGWScriptSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 797 + Ord(Str^) * 6;
-    inc(Str);
-  end;
-  Result := Result mod 13;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-procedure TSynGWScriptSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[6] := FuncBool;
-  fIdentFuncTable[4] := FuncBreak;
-  fIdentFuncTable[7] := FuncChar;
-  fIdentFuncTable[11] := FuncDo;
-  fIdentFuncTable[9] := FuncElse;
-  fIdentFuncTable[1] := FuncFalse;
-  fIdentFuncTable[10] := FuncFor;
-  fIdentFuncTable[12] := FuncIf;
-  fIdentFuncTable[0] := FuncInt;
-  fIdentFuncTable[8] := FuncReturn;
-  fIdentFuncTable[5] := FuncString;
-  fIdentFuncTable[2] := FuncTrue;
-  fIdentFuncTable[3] := FuncWhile;
-end;
-
-function TSynGWScriptSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-
-function TSynGWScriptSyn.FuncBool(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncBreak(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncChar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncDo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncFalse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncFor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncInt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncReturn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncTrue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGWScriptSyn.FuncWhile(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-
-function TSynGWScriptSyn.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;
-
-constructor TSynGWScriptSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style:= [fsItalic];
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-
-  AddAttribute(fCommentAttri);
-  AddAttribute(fIdentifierAttri);
-  AddAttribute(fInvalidAttri);
-  AddAttribute(fKeyAttri);
-  AddAttribute(fNumberAttri);
-  AddAttribute(fSpaceAttri);
-  AddAttribute(fStringAttri);
-  AddAttribute(fSymbolAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fRange         := rsUnknown;
-  fDefaultFilter := SYNS_FilterGWS;
-end; { Create }
-
-procedure TSynGWScriptSyn.AnsiCProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        if fLine[Run + 1] = '/' then begin
-          inc(Run, 2);
-          fRange := rsUnKnown;
-          break;
-        end else
-          inc(Run);
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-procedure TSynGWScriptSyn.AndSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAndAssign;
-      end;
-    '&':                               {logical and}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogAnd;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAnd;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      if CharInSet(fLine[Run + 1], [#39, '\']) then
-        inc(Run);
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #39);
-  if fLine[Run] = #39 then
-    inc(Run);
-end;
-
-procedure TSynGWScriptSyn.AtSymbolProc;
-begin
-  fTokenID := tkUnknown;
-  inc(Run);
-end;
-
-procedure TSynGWScriptSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceClose;
-  fRange := rsUnknown;
-end;
-
-procedure TSynGWScriptSyn.BraceOpenProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceOpen;
-end;
-
-procedure TSynGWScriptSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run + 1] = #10 then Inc(Run);
-end;
-
-procedure TSynGWScriptSyn.ColonProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkScopeResolution;
-      end;
-  else                                 {colon}
-    begin
-      inc(Run);
-      FExtTokenID := xtkColon;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkComma;
-end;
-
-procedure TSynGWScriptSyn.EqualProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogEqual;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAssign;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.GreaterProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkGreaterThanEqual;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftRightAssign;
-        end
-        else                           {shift right}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftRight;
-        end;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkGreaterThan;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.QuestionProc;
-begin
-  fTokenID := tkSymbol;                {conditional}
-  FExtTokenID := xtkQuestion;
-  inc(Run);
-end;
-
-procedure TSynGWScriptSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynGWScriptSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynGWScriptSyn.LowerProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLessThanEqual;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftLeftAssign;
-        end
-        else                           {shift left}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftLeft;
-        end;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLessThan;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.MinusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkSubtractAssign;
-      end;
-    '-':                               {decrement}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkDecrement;
-      end;
-    '>':                               {arrow}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkArrow;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      FExtTokenID := xtkSubtract;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.ModSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkModAssign;
-      end;
-  else                                 {mod}
-    begin
-      inc(Run);
-      FExtTokenID := xtkMod;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.NotSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkNotEqual;
-      end;
-  else                                 {not}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLogComplement;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynGWScriptSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynGWScriptSyn.OrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {or assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncOrAssign;
-      end;
-    '|':                               {logical or}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogOr;
-      end;
-  else                                 {or}
-    begin
-      inc(Run);
-      FExtTokenID := xtkIncOr;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.PlusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAddAssign;
-      end;
-    '+':                               {increment}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncrement;
-      end;
-  else                                 {add}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAdd;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.PointProc;
-begin
-  fTokenID := tkSymbol;
-  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
-    begin                              {ellipse}
-      inc(Run, 3);
-      FExtTokenID := xtkEllipse;
-    end
-  else                                 {point}
-    begin
-      inc(Run);
-      FExtTokenID := xtkPoint;
-    end;
-end;
-
-procedure TSynGWScriptSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkRoundClose;
-end;
-
-procedure TSynGWScriptSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundOpen;
-end;
-
-procedure TSynGWScriptSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSemiColon;
-  fRange := rsUnknown;
-end;
-
-procedure TSynGWScriptSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':                               {c++ style comments}
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-       while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '*':                               {c style comments}
-      begin
-        fTokenID := tkComment;
-        fRange := rsAnsiC;
-        inc(Run, 2);
-        while fLine[Run] <> #0 do
-          case fLine[Run] of
-            '*':
-              if fLine[Run + 1] = '/' then
-              begin
-                inc(Run, 2);
-                fRange := rsUnKnown;
-                break;
-              end else inc(Run);
-            #10: break;
-            #13: break;
-          else inc(Run);
-          end;
-      end;
-    '=':                               {divide assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-        FExtTokenID := xtkDivideAssign;
-      end;
-  else                                 {divide}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-      FExtTokenID := xtkDivide;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynGWScriptSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareClose;
-end;
-
-procedure TSynGWScriptSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareOpen;
-end;
-
-procedure TSynGWScriptSyn.StarProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkMultiplyAssign;
-      end;
-  else                                 {star}
-    begin
-      inc(Run);
-      FExtTokenID := xtkStar;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.StringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-      #92:                             {backslash}
-        case FLine[Run + 1] of
-          #34: inc(Run);               {escaped quote doesn't count}
-          #92: inc(Run);               {escaped backslash doesn't count}
-        end;
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynGWScriptSyn.TildeProc;
-begin
-  inc(Run);                            {bitwise complement}
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBitComplement;
-end;
-
-procedure TSynGWScriptSyn.XOrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-  	'=':                               {xor assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkXorAssign;
-      end;
-  else                                 {xor}
-    begin
-      inc(Run);
-      FExtTokenID := xtkXor;
-    end;
-  end;
-end;
-
-procedure TSynGWScriptSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynGWScriptSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsAnsiC : AnsiCProc;
-  else
-    begin
-      fRange := rsUnknown;
-      case fLine[Run] of
-        '&': AndSymbolProc;
-        #39: AsciiCharProc;
-        '@': AtSymbolProc;
-        '}': BraceCloseProc;
-        '{': BraceOpenProc;
-        #13: CRProc;
-        ':': ColonProc;
-        ',': CommaProc;
-        '=': EqualProc;
-        '>': GreaterProc;
-        '?': QuestionProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        #10: LFProc;
-        '<': LowerProc;
-        '-': MinusProc;
-        '%': ModSymbolProc;
-        '!': NotSymbolProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '|': OrSymbolProc;
-        '+': PlusProc;
-        '.': PointProc;
-        ')': RoundCloseProc;
-        '(': RoundOpenProc;
-        ';': SemiColonProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        ']': SquareCloseProc;
-        '[': SquareOpenProc;
-        '*': StarProc;
-        #34: StringProc;
-        '~': TildeProc;
-        '^': XOrSymbolProc;
-        else UnknownProc;
-      end;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynGWScriptSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynGWScriptSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynGWScriptSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynGWScriptSyn.GetExtTokenID: TxtkTokenKind;
-begin
-  Result := FExtTokenID;
-end;
-
-function TSynGWScriptSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fInvalidAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynGWScriptSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-procedure TSynGWScriptSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-procedure TSynGWScriptSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynGWScriptSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterGWS;
-end;
-
-class function TSynGWScriptSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGWS;
-end;
-
-function TSynGWScriptSyn.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;
-
-class function TSynGWScriptSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangGWS;
-end;
-
-initialization
-  RegisterPlaceableHighlighter (TSynGWScriptSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterCpp.pas, released 2000-04-10.
+The Original Code is based on the dcjCppSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Michael Trier.
+Unicode translation by Maël Hörz.
+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: SynHighlighterGWS.pas,v 1.13.2.7 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+-------------------------------------------------------------------------------}
+
+unit SynHighlighterGWS;
+
+{ This unit provides a syntax highlighter for GW-TEL Scripts }
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+Type
+  TtkTokenKind = (
+    tkComment,
+    tkIdentifier,
+    tkKey,
+    tkNull,
+    tkNumber,
+    tkSpace,
+    tkString,
+    tkSymbol,
+    tkUnknown);
+
+  TxtkTokenKind = (
+    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
+    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
+    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
+    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
+    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
+    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
+    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
+    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
+    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
+    xtkXorAssign);
+
+  TRangeState = (rsAnsiC, rsUnknown);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynGWScriptSyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FExtTokenID: TxtkTokenKind;
+    FIdentFuncTable: array[0..12] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInvalidAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function FuncBool(Index: Integer): TtkTokenKind;
+    function FuncBreak(Index: Integer): TtkTokenKind;
+    function FuncChar(Index: Integer): TtkTokenKind;
+    function FuncDo(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncFalse(Index: Integer): TtkTokenKind;
+    function FuncFor(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncInt(Index: Integer): TtkTokenKind;
+    function FuncReturn(Index: Integer): TtkTokenKind;
+    function FuncString(Index: Integer): TtkTokenKind;
+    function FuncTrue(Index: Integer): TtkTokenKind;
+    function FuncWhile(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure AnsiCProc;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+    procedure InitIdent;
+  protected
+    function GetExtTokenID: TxtkTokenKind;
+    function IsFilterStored: Boolean; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+    function GetDefaultAttribute (Index: Integer): TSynHighlighterAttributes; override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+
+    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri write FInvalidAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..12] of UnicodeString = (
+    'bool', 'break', 'char', 'do', 'else', 'false', 'for', 'if', 'int', 
+    'return', 'string', 'true', 'while' 
+  );
+
+  KeyIndices: array[0..12] of Integer = (
+    8, 5, 11, 12, 1, 10, 0, 2, 9, 4, 6, 3, 7 
+  );
+
+{$Q-}
+function TSynGWScriptSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 797 + Ord(Str^) * 6;
+    Inc(Str);
+  end;
+  Result := Result mod 13;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+procedure TSynGWScriptSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  FIdentFuncTable[6] := FuncBool;
+  FIdentFuncTable[4] := FuncBreak;
+  FIdentFuncTable[7] := FuncChar;
+  FIdentFuncTable[11] := FuncDo;
+  FIdentFuncTable[9] := FuncElse;
+  FIdentFuncTable[1] := FuncFalse;
+  FIdentFuncTable[10] := FuncFor;
+  FIdentFuncTable[12] := FuncIf;
+  FIdentFuncTable[0] := FuncInt;
+  FIdentFuncTable[8] := FuncReturn;
+  FIdentFuncTable[5] := FuncString;
+  FIdentFuncTable[2] := FuncTrue;
+  FIdentFuncTable[3] := FuncWhile;
+end;
+
+function TSynGWScriptSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+
+function TSynGWScriptSyn.FuncBool(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncBreak(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncChar(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncDo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncFalse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncFor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncInt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncReturn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncString(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncTrue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGWScriptSyn.FuncWhile(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+
+function TSynGWScriptSyn.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;
+
+constructor TSynGWScriptSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsItalic];
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+
+  AddAttribute(FCommentAttri);
+  AddAttribute(FIdentifierAttri);
+  AddAttribute(FInvalidAttri);
+  AddAttribute(FKeyAttri);
+  AddAttribute(FNumberAttri);
+  AddAttribute(FSpaceAttri);
+  AddAttribute(FStringAttri);
+  AddAttribute(FSymbolAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FRange         := rsUnknown;
+  FDefaultFilter := SYNS_FilterGWS;
+end; { Create }
+
+procedure TSynGWScriptSyn.AnsiCProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          Inc(Run, 2);
+          FRange := rsUnknown;
+          Break;
+        end else
+          Inc(Run);
+      #10: Break;
+      #13: Break;
+    else Inc(Run);
+    end;
+end;
+
+procedure TSynGWScriptSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAndAssign;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogAnd;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAnd;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#39, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #39);
+  if FLine[Run] = #39 then
+    Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.AtSymbolProc;
+begin
+  FTokenID := tkUnknown;
+  Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceClose;
+  FRange := rsUnknown;
+end;
+
+procedure TSynGWScriptSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceOpen;
+end;
+
+procedure TSynGWScriptSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run + 1] = #10 then Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.ColonProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkScopeResolution;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkColon;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkComma;
+end;
+
+procedure TSynGWScriptSyn.EqualProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogEqual;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAssign;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkGreaterThanEqual;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftRightAssign;
+        end
+        else                           {shift right}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftRight;
+        end;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkGreaterThan;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.QuestionProc;
+begin
+  FTokenID := tkSymbol;                {conditional}
+  FExtTokenID := xtkQuestion;
+  Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLessThanEqual;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftLeftAssign;
+        end
+        else                           {shift left}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftLeft;
+        end;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLessThan;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkSubtractAssign;
+      end;
+    '-':                               {decrement}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkDecrement;
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkArrow;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkSubtract;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkModAssign;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkMod;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.NotSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkNotEqual;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLogComplement;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynGWScriptSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {or assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncOrAssign;
+      end;
+    '|':                               {logical or}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogOr;
+      end;
+  else                                 {or}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkIncOr;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAddAssign;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncrement;
+      end;
+  else                                 {add}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAdd;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
+    begin                              {ellipse}
+      Inc(Run, 3);
+      FExtTokenID := xtkEllipse;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkPoint;
+    end;
+end;
+
+procedure TSynGWScriptSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundClose;
+end;
+
+procedure TSynGWScriptSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundOpen;
+end;
+
+procedure TSynGWScriptSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSemiColon;
+  FRange := rsUnknown;
+end;
+
+procedure TSynGWScriptSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':                               {c++ style comments}
+      begin
+        FTokenID := tkComment;
+        Inc(Run, 2);
+       while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '*':                               {c style comments}
+      begin
+        FTokenID := tkComment;
+        FRange := rsAnsiC;
+        Inc(Run, 2);
+        while FLine[Run] <> #0 do
+          case FLine[Run] of
+            '*':
+              if FLine[Run + 1] = '/' then
+              begin
+                Inc(Run, 2);
+                FRange := rsUnknown;
+                Break;
+              end else Inc(Run);
+            #10: Break;
+            #13: Break;
+          else Inc(Run);
+          end;
+      end;
+    '=':                               {divide assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+        FExtTokenID := xtkDivideAssign;
+      end;
+  else                                 {divide}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      FExtTokenID := xtkDivide;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareClose;
+end;
+
+procedure TSynGWScriptSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareOpen;
+end;
+
+procedure TSynGWScriptSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkMultiplyAssign;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkStar;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.StringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13: Break;
+      #92:                             {backslash}
+        case FLine[Run + 1] of
+          #34: Inc(Run);               {escaped quote doesn't count}
+          #92: Inc(Run);               {escaped backslash doesn't count}
+        end;
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynGWScriptSyn.TildeProc;
+begin
+  Inc(Run);                            {bitwise complement}
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBitComplement;
+end;
+
+procedure TSynGWScriptSyn.XOrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+  	'=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkXorAssign;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkXor;
+    end;
+  end;
+end;
+
+procedure TSynGWScriptSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynGWScriptSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsAnsiC : AnsiCProc;
+  else
+    begin
+      FRange := rsUnknown;
+      case FLine[Run] of
+        '&': AndSymbolProc;
+        #39: AsciiCharProc;
+        '@': AtSymbolProc;
+        '}': BraceCloseProc;
+        '{': BraceOpenProc;
+        #13: CRProc;
+        ':': ColonProc;
+        ',': CommaProc;
+        '=': EqualProc;
+        '>': GreaterProc;
+        '?': QuestionProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        #10: LFProc;
+        '<': LowerProc;
+        '-': MinusProc;
+        '%': ModSymbolProc;
+        '!': NotSymbolProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '|': OrSymbolProc;
+        '+': PlusProc;
+        '.': PointProc;
+        ')': RoundCloseProc;
+        '(': RoundOpenProc;
+        ';': SemiColonProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        ']': SquareCloseProc;
+        '[': SquareOpenProc;
+        '*': StarProc;
+        #34: StringProc;
+        '~': TildeProc;
+        '^': XOrSymbolProc;
+        else UnknownProc;
+      end;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynGWScriptSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynGWScriptSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynGWScriptSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynGWScriptSyn.GetExtTokenID: TxtkTokenKind;
+begin
+  Result := FExtTokenID;
+end;
+
+function TSynGWScriptSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FInvalidAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynGWScriptSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+procedure TSynGWScriptSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynGWScriptSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+function TSynGWScriptSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterGWS;
+end;
+
+class function TSynGWScriptSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGWS;
+end;
+
+function TSynGWScriptSyn.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;
+
+class function TSynGWScriptSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGWS;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter (TSynGWScriptSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterGalaxy.pas b/Source/VCL/SynEdit/Source/SynHighlighterGalaxy.pas
index fb77b61c..5ea4ecf6 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterGalaxy.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterGalaxy.pas
@@ -1,440 +1,447 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterGalaxy.pas, released 2000-04-07.
-The Original Code is based on the mkGalaxySyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Martijn van der Kooij.
-Unicode translation by Maël Hörz.
-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: SynHighlighterGalaxy.pas,v 1.12.2.8 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Galaxy highlighter for SynEdit)
-@author(Martijn van der Kooij, converted to SynEdit by David Muir )
-@created(May 1999, converted to SynEdit June 19, 2000)
-@lastmod(2000-06-23)
-The SynHighlighterGalaxy unit provides SynEdit with a Galaxy highlighter.
-Galaxy is a PBEM game for 10 to 500+ players, to see it wokring goto: http://members.tripod.com/~erisande/kooij.html .
-The keywords in the string list KeyWords have to be in lowercase and sorted.
-}
-
-unit SynHighlighterGalaxy;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Graphics,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils, Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkSpace, tkMessage,
-    tkUnknown);
-
-  TRangeState = (rsUnKnown, rsMessageStyle);
-
-type
-  TSynGalaxySyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    fMessageAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyWords: TStrings;
-    procedure PointCommaProc;
-    procedure CRProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure MessageStyleProc;
-    procedure SetKeyWords(const Value: TStrings);
-  protected
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    function IsKeyword(const AKeyword: string): Boolean; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    function SaveToRegistry(RootKey: HKEY; Key: string): boolean; override;
-    function LoadFromRegistry(RootKey: HKEY; Key: string): boolean; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property KeyWords: TStrings read fKeyWords write SetKeyWords;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property MessageAttri: TSynHighlighterAttributes read fMessageAttri
-      write fMessageAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-function TSynGalaxySyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-   '_', '0'..'9', 'a'..'z', 'A'..'Z', '#':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-function TSynGalaxySyn.IsKeyword(const AKeyword: string): Boolean;
-var
-  First, Last, I, Compare: Integer;
-  Token: string;
-begin
-  First := 0;
-  Last := fKeywords.Count - 1;
-  Result := False;
-  Token := SysUtils.AnsiUpperCase(AKeyword);
-  while First <= Last do
-  begin
-    I := (First + Last) shr 1;
-    Compare := WideCompareStr(fKeywords[i], Token);
-    if Compare = 0 then
-    begin
-      Result := True;
-      break;
-    end else
-      if Compare < 0 then First := I + 1 else Last := I - 1;
-  end;
-end; { IsKeyWord }
-
-constructor TSynGalaxySyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fKeyWords := TStringList.Create;
-  TStringList(fKeyWords).Sorted := True;
-  TStringList(fKeyWords).Duplicates := dupIgnore;
-  TStringList(fKeyWords).CommaText :=
-    '#end,#galaxy,a,anonymous,autounload,b,battleprotocol,c,cap,cargo,col,' +
-    'compress,d,drive,e,emp,f,fleet,fleettables,g,galaxytv,gplus,groupforecast,' +
-    'h,i,j,l,m,machinereport,mat,n,namecase,no,o,options,p,planetforecast,' +
-    'prodtable,produce,q,r,routesforecast,s,send,shields,shiptypeforecast,' +
-    'sortgroups,t,twocol,u,underscores,v,w,war,weapons,x,y,z';
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fMessageAttri := TSynHighlighterAttributes.Create(SYNS_AttrMessage, SYNS_FriendlyAttrMessage);
-  AddAttribute(fMessageAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  fRange := rsUnknown;
-  fDefaultFilter := SYNS_FilterGalaxy;
-end; { Create }
-
-destructor TSynGalaxySyn.Destroy;
-begin
-  fKeyWords.Free;
-  inherited Destroy;
-end; { Destroy }
-
-procedure TSynGalaxySyn.MessageStyleProc;
-begin
-  fTokenID := tkMessage;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  if (Run = 0) and (FLine[Run] = '@') then begin
-    fRange := rsUnKnown;
-    inc(Run);
-  end else
-    while FLine[Run] <> #0 do
-      inc(Run);
-end;
-
-procedure TSynGalaxySyn.PointCommaProc;                                         
-begin
-  fTokenID := tkComment;
-  fRange := rsUnknown;
-  repeat
-    inc(Run);
-  until fLine[Run] = #0;
-end;
-
-procedure TSynGalaxySyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then
-    Inc(Run);
-end;
-
-procedure TSynGalaxySyn.IdentProc;
-begin
-  while IsIdentChar(fLine[Run]) do
-    Inc(Run);
-  if IsKeyWord(GetToken) then
-    fTokenId := tkKey
-  else
-    fTokenId := tkIdentifier;
-end;
-
-procedure TSynGalaxySyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynGalaxySyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynGalaxySyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynGalaxySyn.StringProc;
-begin
-  if (Run = 0) and (fTokenID <> tkMessage) then
-  begin
-    fTokenID := tkMessage;
-    fRange := rsMessageStyle;
-  end;
-  inc(Run);
-end;
-
-procedure TSynGalaxySyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnKnown;
-end;
-
-procedure TSynGalaxySyn.Next;
-begin
-  fTokenPos := Run;
-  if fRange = rsMessageStyle then
-    MessageStyleProc
-  else
-    case fLine[Run] of
-      ';': PointCommaProc;                                      
-      #13: CRProc;
-      '#','A'..'Z', 'a'..'z', '_': IdentProc;
-      #10: LFProc;
-      #0: NullProc;
-      #1..#9, #11, #12, #14..#32: SpaceProc;
-      '@': StringProc;
-      else UnknownProc;
-    end;
-  inherited;
-end;
-
-function TSynGalaxySyn.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_WHITESPACE: Result := fSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynGalaxySyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynGalaxySyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynGalaxySyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynGalaxySyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkMessage: Result := fMessageAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkUnknown: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynGalaxySyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-procedure TSynGalaxySyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynGalaxySyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynGalaxySyn.SetKeyWords(const Value: TStrings);
-var
-  i: Integer;
-begin
-  if Value <> nil then
-    begin
-      Value.BeginUpdate;
-      for i := 0 to Value.Count - 1 do
-        Value[i] := SysUtils.AnsiUpperCase(Value[i]);
-      Value.EndUpdate;
-    end;
-  fKeyWords.Assign(Value);
-  DefHighLightChange(nil);
-end;
-
-function TSynGalaxySyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterGalaxy;
-end;
-
-class function TSynGalaxySyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGalaxy;
-end;
-
-function TSynGalaxySyn.LoadFromRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r:= TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKeyReadOnly(Key) then
-    begin
-      if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords');
-      Result := inherited LoadFromRegistry(RootKey, Key);
-    end
-    else
-      Result := False;
-  finally
-    r.Free;
-  end;
-end;
-
-function TSynGalaxySyn.SaveToRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r:= TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKey(Key,true) then
-    begin
-      r.WriteString('KeyWords', KeyWords.Text);
-      Result := inherited SaveToRegistry(RootKey, Key);
-    end
-    else
-      Result := false;
-  finally
-    r.Free;
-  end;
-end;
-
-class function TSynGalaxySyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangGalaxy;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynGalaxySyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterGalaxy.pas, released 2000-04-07.
+The Original Code is based on the mkGalaxySyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Martijn van der Kooij.
+Unicode translation by Maël Hörz.
+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: SynHighlighterGalaxy.pas,v 1.12.2.8 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Galaxy highlighter for SynEdit)
+@author(Martijn van der Kooij, converted to SynEdit by David Muir )
+@created(May 1999, converted to SynEdit June 19, 2000)
+@lastmod(2000-06-23)
+The SynHighlighterGalaxy unit provides SynEdit with a Galaxy highlighter.
+Galaxy is a PBEM game for 10 to 500+ players, to see it wokring goto: http://members.tripod.com/~erisande/kooij.html .
+The keywords in the string list KeyWords have to be in lowercase and sorted.
+}
+
+unit SynHighlighterGalaxy;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils, Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkSpace, tkMessage,
+    tkUnknown);
+
+  TRangeState = (rsUnknown, rsMessageStyle);
+
+type
+  TSynGalaxySyn = class(TSynCustomHighlighter)
+  private
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FMessageAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FCommentAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyWords: TUnicodeStrings;
+    procedure PointCommaProc;
+    procedure CRProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure MessageStyleProc;
+    procedure SetKeyWords(const Value: TUnicodeStrings);
+  protected
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    function IsKeyword(const AKeyword: UnicodeString): Boolean; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+
+    function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
+    function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
+      write FSpaceAttri;
+    property MessageAttri: TSynHighlighterAttributes read FMessageAttri
+      write FMessageAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+function TSynGalaxySyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+   '_', '0'..'9', 'a'..'z', 'A'..'Z', '#':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+function TSynGalaxySyn.IsKeyword(const AKeyword: UnicodeString): Boolean;
+var
+  First, Last, I, Compare: Integer;
+  Token: UnicodeString;
+begin
+  First := 0;
+  Last := FKeyWords.Count - 1;
+  Result := False;
+  Token := SynWideUpperCase(AKeyword);
+  while First <= Last do
+  begin
+    I := (First + Last) shr 1;
+    Compare := WideCompareStr(FKeyWords[i], Token);
+    if Compare = 0 then
+    begin
+      Result := True;
+      Break;
+    end else
+      if Compare < 0 then First := I + 1 else Last := I - 1;
+  end;
+end; { IsKeyWord }
+
+constructor TSynGalaxySyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := False;
+
+  FKeyWords := TUnicodeStringList.Create;
+  TUnicodeStringList(FKeyWords).Sorted := True;
+  TUnicodeStringList(FKeyWords).Duplicates := dupIgnore;
+  TUnicodeStringList(FKeyWords).CommaText :=
+    '#end,#galaxy,a,anonymous,autounload,b,battleprotocol,c,cap,cargo,col,' +
+    'compress,d,drive,e,emp,f,fleet,fleettables,g,galaxytv,gplus,groupforecast,' +
+    'h,i,j,l,m,machinereport,mat,n,namecase,no,o,options,p,planetforecast,' +
+    'prodtable,produce,q,r,routesforecast,s,send,shields,shiptypeforecast,' +
+    'sortgroups,t,twocol,u,underscores,v,w,war,weapons,x,y,z';
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FMessageAttri := TSynHighlighterAttributes.Create(SYNS_AttrMessage, SYNS_FriendlyAttrMessage);
+  AddAttribute(FMessageAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  FRange := rsUnknown;
+  FDefaultFilter := SYNS_FilterGalaxy;
+end; { Create }
+
+destructor TSynGalaxySyn.Destroy;
+begin
+  FKeyWords.Free;
+  inherited Destroy;
+end; { Destroy }
+
+procedure TSynGalaxySyn.MessageStyleProc;
+begin
+  FTokenID := tkMessage;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  if (Run = 0) and (FLine[Run] = '@') then
+  begin
+    FRange := rsUnknown;
+    Inc(Run);
+  end else
+    while FLine[Run] <> #0 do
+      Inc(Run);
+end;
+
+procedure TSynGalaxySyn.PointCommaProc;                                         
+begin
+  FTokenID := tkComment;
+  FRange := rsUnknown;
+  repeat
+    Inc(Run);
+  until FLine[Run] = #0;
+end;
+
+procedure TSynGalaxySyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then
+    Inc(Run);
+end;
+
+procedure TSynGalaxySyn.IdentProc;
+begin
+  while IsIdentChar(FLine[Run]) do
+    Inc(Run);
+  if IsKeyWord(GetToken) then
+    FTokenID := tkKey
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynGalaxySyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynGalaxySyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynGalaxySyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynGalaxySyn.StringProc;
+begin
+  if (Run = 0) and (FTokenID <> tkMessage) then
+  begin
+    FTokenID := tkMessage;
+    FRange := rsMessageStyle;
+  end;
+  Inc(Run);
+end;
+
+procedure TSynGalaxySyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnKnown;
+end;
+
+procedure TSynGalaxySyn.Next;
+begin
+  FTokenPos := Run;
+  if FRange = rsMessageStyle then
+    MessageStyleProc
+  else
+    case FLine[Run] of
+      ';': PointCommaProc;                                      
+      #13: CRProc;
+      '#','A'..'Z', 'a'..'z', '_': IdentProc;
+      #10: LFProc;
+      #0: NullProc;
+      #1..#9, #11, #12, #14..#32: SpaceProc;
+      '@': StringProc;
+      else UnknownProc;
+    end;
+  inherited;
+end;
+
+function TSynGalaxySyn.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_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynGalaxySyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynGalaxySyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynGalaxySyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynGalaxySyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkMessage: Result := FMessageAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkUnknown: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynGalaxySyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynGalaxySyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynGalaxySyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynGalaxySyn.SetKeyWords(const Value: TUnicodeStrings);
+var
+  i: Integer;
+begin
+  if Value <> nil then
+    begin
+      Value.BeginUpdate;
+      for i := 0 to Value.Count - 1 do
+        Value[i] := SynWideUpperCase(Value[i]);
+      Value.EndUpdate;
+    end;
+  FKeyWords.Assign(Value);
+  DefHighLightChange(nil);
+end;
+
+function TSynGalaxySyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterGalaxy;
+end;
+
+class function TSynGalaxySyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGalaxy;
+end;
+
+function TSynGalaxySyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKeyReadOnly(Key) then
+    begin
+      if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords');
+      Result := inherited LoadFromRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+function TSynGalaxySyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKey(Key,true) then
+    begin
+      {$IFNDEF SYN_COMPILER_25_UP}
+      Result := true;
+      {$ENDIF}
+      r.WriteString('KeyWords', KeyWords.Text);
+      Result := inherited SaveToRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+class function TSynGalaxySyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGalaxy;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynGalaxySyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterGeneral.pas b/Source/VCL/SynEdit/Source/SynHighlighterGeneral.pas
index f18a4580..4eb6666f 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterGeneral.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterGeneral.pas
@@ -1,810 +1,861 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterGeneral.pas, released 2000-04-07.
-The Original Code is based on the mwGeneralSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Martin Waldenburg.
-Portions written by Martin Waldenburg are copyright 1999 Martin Waldenburg.
-Unicode translation by Maël Hörz.
-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: SynHighlighterGeneral.pas,v 1.12 2011/04/14 15:12:54 Egg Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a customizable highlighter for SynEdit)
-@author(Martin Waldenburg, converted to SynEdit by Michael Hieke)
-@created(1999)
-@lastmod(2000-06-23)
-The SynHighlighterGeneral unit provides a customizable highlighter for SynEdit.
-}
-
-unit SynHighlighterGeneral;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber,
-    tkPreprocessor, tkSpace, tkString, tkSymbol, tkUnknown);
-
-  TCommentStyle = (csAnsiStyle, csPasStyle, csCStyle, csAsmStyle, csBasStyle,
-    csCPPStyle);
-  TCommentStyles = set of TCommentStyle;
-
-  TRangeState = (rsANil, rsAnsi, rsPasStyle, rsCStyle, rsUnKnown);
-
-  TStringDelim = (sdSingleQuote, sdDoubleQuote, sdSingleAndDoubleQuote);
-
-  TGetTokenAttributeEvent = procedure (attribute : TSynHighlighterAttributes) of object;
-
-const
-   cDefaultIdentChars = '_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
-                         'abcdefghijklmnopqrstuvwxyz';
-
-type
-  TSynGeneralSyn = class(TSynCustomHighlighter)
-  private
-    fIdentChars: string;
-    fRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fPreprocessorAttri: TSynHighlighterAttributes;                         
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fKeyWords: TStrings;
-    fComments: TCommentStyles;
-    fStringDelim: TStringDelim;
-    fDetectPreprocessor: Boolean;
-    fOnGetTokenAttribute: TGetTokenAttributeEvent;
-    FStringMultiLine : Boolean;
-    procedure AsciiCharProc;
-    procedure BraceOpenProc;
-    procedure PointCommaProc;
-    procedure CRProc;
-    procedure IdentProc;
-    procedure IntegerProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure RoundOpenProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure UnknownProc;
-    procedure AnsiProc;
-    procedure PasStyleProc;
-    procedure CStyleProc;
-    procedure SetKeyWords(const Value: TStrings);
-    procedure SetComments(Value: TCommentStyles);
-    function GetStringDelim: TStringDelim;
-    procedure SetStringDelim(const Value: TStringDelim);
-    function GetIdentifierChars: string;
-    procedure SetIdentifierChars(const Value: string);
-    function StoreIdentChars : Boolean;
-    procedure SetDetectPreprocessor(Value: boolean);
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-    function IsStringDelim(aChar : WideChar) : Boolean;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetCharBeforeToken(offset : Integer = -1) : WideChar;
-    function GetCharAfterToken(offset : Integer = 1) : WideChar;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    function IsKeyword(const AKeyword: string): Boolean; override;
-    function IsWordBreakChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-    procedure ResetRange; override;
-    procedure SetRange(Value: Pointer); override;
-    function SaveToRegistry(RootKey: HKEY; Key: string): boolean; override;
-    function LoadFromRegistry(RootKey: HKEY; Key: string): boolean; override;
-    property OnGetTokenAttribute : TGetTokenAttributeEvent read fOnGetTokenAttribute write fOnGetTokenAttribute;
-    property StringMultiLine : Boolean read FStringMultiLine write FStringMultiLine;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property Comments: TCommentStyles read fComments write SetComments default [];
-    property DetectPreprocessor: boolean read fDetectPreprocessor
-      write SetDetectPreprocessor;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property IdentifierChars: string read GetIdentifierChars
-      write SetIdentifierChars stored StoreIdentChars;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property KeyWords: TStrings read fKeyWords write SetKeyWords;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
-      write fNumberAttri;
-    property PreprocessorAttri: TSynHighlighterAttributes
-      read fPreprocessorAttri write fPreprocessorAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri
-      write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property StringDelim: TStringDelim read GetStringDelim write SetStringDelim
-      default sdSingleQuote;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-function TSynGeneralSyn.IsIdentChar(AChar: WideChar): Boolean;
-var
-  i: Integer;
-begin
-  Result := False;
-  for i := 1 to Length(fIdentChars) do
-    if AChar = fIdentChars[i] then
-    begin
-      Result := True;
-      Exit;
-    end;
-end;
-
-function TSynGeneralSyn.IsKeyword(const AKeyword: string): Boolean;
-var
-  First, Last, I, Compare: Integer;
-  Token: string;
-begin
-  First := 0;
-  Last := fKeywords.Count - 1;
-  Result := False;
-  Token := SysUtils.AnsiUpperCase(AKeyword);
-  while First <= Last do
-  begin
-    I := (First + Last) shr 1;
-    Compare := WideCompareText(fKeywords[i], Token);
-    if Compare = 0 then
-    begin
-      Result := True;
-      break;
-    end
-    else if Compare < 0 then
-      First := I + 1
-    else
-      Last := I - 1;
-  end;
-end; { IsKeyWord }
-
-function TSynGeneralSyn.IsWordBreakChar(AChar: WideChar): Boolean;
-begin
-  Result := inherited IsWordBreakChar(AChar) and not IsIdentChar(AChar);
-end;
-
-constructor TSynGeneralSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  fKeyWords := TStringList.Create;
-  TStringList(fKeyWords).Sorted := True;
-  TStringList(fKeyWords).Duplicates := dupIgnore;
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(fPreprocessorAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  fStringDelim := sdSingleQuote;
-  fIdentChars := cDefaultIdentChars;
-  fRange := rsUnknown;
-end; { Create }
-
-destructor TSynGeneralSyn.Destroy;
-begin
-  fKeyWords.Free;
-  inherited Destroy;
-end; { Destroy }
-
-procedure TSynGeneralSyn.AnsiProc;
-begin
-  case fLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-  else
-    fTokenID := tkComment;
-    repeat
-      if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then
-      begin
-        fRange := rsUnKnown;
-        Inc(Run, 2);
-        break;
-      end;
-      Inc(Run);
-    until IsLineEnd(Run);
-  end;
-end;
-
-procedure TSynGeneralSyn.PasStyleProc;
-begin
-  case fLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-  else
-    fTokenID := tkComment;
-    repeat
-      if fLine[Run] = '}' then
-      begin
-        fRange := rsUnKnown;
-        Inc(Run);
-        break;
-      end;
-      Inc(Run);
-    until IsLineEnd(Run);
-  end;
-end;
-
-procedure TSynGeneralSyn.CStyleProc;
-begin
-  case fLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-  else
-    fTokenID := tkComment;
-    repeat
-      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then
-      begin
-        fRange := rsUnKnown;
-        Inc(Run, 2);
-        break;
-      end;
-      Inc(Run);
-    until IsLineEnd(Run);
-  end;
-end;
-
-procedure TSynGeneralSyn.AsciiCharProc;
-begin
-  if fDetectPreprocessor then
-  begin
-    fTokenID := tkPreprocessor;
-    repeat
-      inc(Run);
-    until IsLineEnd(Run);
-  end
-  else
-  begin
-    fTokenID := tkString;
-    repeat
-      inc(Run);
-    until not CharInSet(fLine[Run], ['0'..'9']);
-  end;
-end;
-
-procedure TSynGeneralSyn.BraceOpenProc;
-begin
-  if csPasStyle in fComments then
-  begin
-    fTokenID := tkComment;
-    fRange := rsPasStyle;
-    inc(Run);
-    while FLine[Run] <> #0 do
-      case FLine[Run] of
-        '}':
-          begin
-            fRange := rsUnKnown;
-            inc(Run);
-            break;
-          end;
-        #10: break;
-
-        #13: break;
-      else
-        inc(Run);
-      end;
-  end
-  else
-  begin
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynGeneralSyn.PointCommaProc;
-begin
-  if (csASmStyle in fComments) or (csBasStyle in fComments) then
-  begin
-    fTokenID := tkComment;
-    fRange := rsUnknown;
-    inc(Run);
-    while FLine[Run] <> #0 do
-    begin
-      fTokenID := tkComment;
-      inc(Run);
-    end;
-  end
-  else
-  begin
-    inc(Run);
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynGeneralSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynGeneralSyn.IdentProc;
-begin
-  while IsIdentChar(fLine[Run]) do inc(Run);
-  if IsKeyWord(GetToken) then
-    fTokenId := tkKey
-  else
-    fTokenId := tkIdentifier;
-end;
-
-procedure TSynGeneralSyn.IntegerProc;
-
-  function IsIntegerChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsIntegerChar do inc(Run);
-end;
-
-procedure TSynGeneralSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynGeneralSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynGeneralSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E', 'x':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      'x': begin // handle C style hex numbers
-             IntegerProc;
-             break;
-           end;
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynGeneralSyn.RoundOpenProc;
-begin
-  inc(Run);
-  if csAnsiStyle in fComments then
-  begin
-    case fLine[Run] of
-      '*':
-        begin
-          fTokenID := tkComment;
-          fRange := rsAnsi;
-          inc(Run);
-          while fLine[Run] <> #0 do
-            case fLine[Run] of
-              '*':
-                if fLine[Run + 1] = ')' then
-                begin
-                  fRange := rsUnKnown;
-                  inc(Run, 2);
-                  break;
-                end else inc(Run);
-              #10: break;
-              #13: break;
-            else inc(Run);
-            end;
-        end;
-      '.':
-        begin
-          inc(Run);
-          fTokenID := tkSymbol;
-        end;
-    else
-      begin
-        FTokenID := tkSymbol;
-      end;
-    end;
-  end else fTokenId := tkSymbol;
-end;
-
-procedure TSynGeneralSyn.SlashProc;
-begin
-  Inc(Run);
-  case FLine[Run] of
-    '/':
-      begin
-        if csCPPStyle in fComments then
-        begin
-          fTokenID := tkComment;
-          Inc(Run);
-          while FLine[Run] <> #0 do
-          begin
-            case FLine[Run] of
-              #10, #13: break;
-            end;
-            inc(Run);
-          end;
-        end
-        else
-          fTokenId := tkSymbol;
-      end;
-    '*':
-      begin
-        if csCStyle in fComments then
-        begin
-          fTokenID := tkComment;
-          fRange := rsCStyle;
-          Inc(Run);
-          while fLine[Run] <> #0 do
-            case fLine[Run] of
-              '*':
-                if fLine[Run + 1] = '/' then
-                begin
-                  fRange := rsUnKnown;
-                  inc(Run, 2);
-                  break;
-                end else inc(Run);
-              #10, #13:
-                break;
-              else
-                Inc(Run);
-            end;
-        end
-        else
-          fTokenId := tkSymbol;
-      end;
-    else
-      fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynGeneralSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynGeneralSyn.StringProc;
-var
-   delim : WideChar;
-begin
-  fTokenID := tkString;
-  if IsStringDelim(fLine[Run + 1]) and IsStringDelim(fLine[Run + 2]) then
-    Inc(Run, 2);
-  delim:=fLine[Run];
-  repeat
-    case FLine[Run] of
-      #0 :  break;
-      #10, #13: if not StringMultiLine then break;
-    end;
-    inc(Run);
-  until FLine[Run] = delim;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynGeneralSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynGeneralSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsAnsi: AnsiProc;
-    rsPasStyle: PasStyleProc;
-    rsCStyle: CStyleProc;
-  else
-    if IsStringDelim(fLine[Run]) then
-      StringProc
-    else
-      case fLine[Run] of
-        '#': AsciiCharProc;
-        '{': BraceOpenProc;
-        ';': PointCommaProc;
-        #13: CRProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        '$': IntegerProc;
-        #10: LFProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '(': RoundOpenProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        else UnknownProc;
-      end;
-  end;
-  inherited;
-end;
-
-function TSynGeneralSyn.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 TSynGeneralSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynGeneralSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynGeneralSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-// GetCharBeforeToken
-//
-function TSynGeneralSyn.GetCharBeforeToken(offset : Integer = -1) : WideChar;
-begin
-   if fTokenPos+offset>=0 then
-      Result:=FLine[fTokenPos+offset]
-   else Result:=#0;
-end;
-
-// GetCharAfterToken
-//
-function TSynGeneralSyn.GetCharAfterToken(offset : Integer = 1) : WideChar;
-begin
-   Result:=FLine[fTokenPos+offset];
-end;
-
-function TSynGeneralSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkPreprocessor: Result := fPreprocessorAttri;                         
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-  if Assigned(fOnGetTokenAttribute) then
-    fOnGetTokenAttribute(Result);
-end;
-
-function TSynGeneralSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-procedure TSynGeneralSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynGeneralSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynGeneralSyn.SetKeyWords(const Value: TStrings);
-var
-  i: Integer;
-begin
-  if Value <> nil then
-    begin 
-      Value.BeginUpdate;
-      for i := 0 to Value.Count - 1 do
-        Value[i] := SysUtils.AnsiUpperCase(Value[i]);
-      Value.EndUpdate;
-    end;
-
-  TStringList(fKeyWords).Sorted:=False;
-  fKeyWords.Assign(Value);
-  TStringList(fKeyWords).Sorted:=True;
-
-  DefHighLightChange(nil);
-end;
-
-procedure TSynGeneralSyn.SetComments(Value: TCommentStyles);
-begin
-  if fComments <> Value then
-  begin
-    fComments := Value;
-    DefHighLightChange(Self);
-  end;
-end;
-
-class function TSynGeneralSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGeneral;
-end;
-
-function TSynGeneralSyn.LoadFromRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r:= TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKeyReadOnly(Key) then begin
-      if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords');
-      Result := inherited LoadFromRegistry(RootKey, Key);
-    end
-    else Result := false;
-  finally r.Free; end;
-end;
-
-function TSynGeneralSyn.SaveToRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r:= TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKey(Key,true) then
-    begin
-      r.WriteString('KeyWords', KeyWords.Text);
-      Result := inherited SaveToRegistry(RootKey, Key);
-    end
-    else Result := false;
-  finally r.Free; end;
-end;
-
-function TSynGeneralSyn.GetStringDelim: TStringDelim;
-begin
-  Result:=fStringDelim;
-end;
-
-procedure TSynGeneralSyn.SetStringDelim(const Value: TStringDelim);
-begin
-   fStringDelim:=Value;
-end;
-
-function TSynGeneralSyn.GetIdentifierChars: string;
-begin
-  Result := fIdentChars;
-end;
-
-procedure TSynGeneralSyn.SetIdentifierChars(const Value: string);
-begin
-  fIdentChars := Value;
-end;
-
-function TSynGeneralSyn.StoreIdentChars : Boolean;
-begin
-   Result := (fIdentChars<>cDefaultIdentChars);
-end;
-
-procedure TSynGeneralSyn.SetDetectPreprocessor(Value: boolean);
-begin
-  if Value <> fDetectPreprocessor then
-  begin
-    fDetectPreprocessor := Value;
-    DefHighlightChange(Self);
-  end;
-end;
-
-class function TSynGeneralSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangGeneral;
-end;
-
-// IsStringDelim
-//
-function TSynGeneralSyn.IsStringDelim(aChar : WideChar) : Boolean;
-begin
-   case fStringDelim of
-      sdSingleQuote : Result:=(aChar='''');
-      sdDoubleQuote : Result:=(aChar='"');
-   else
-      Result:=(aChar='''') or (aChar='"');
-   end;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynGeneralSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterGeneral.pas, released 2000-04-07.
+The Original Code is based on the mwGeneralSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Martin Waldenburg.
+Portions written by Martin Waldenburg are copyright 1999 Martin Waldenburg.
+Unicode translation by Maël Hörz.
+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: SynHighlighterGeneral.pas,v 1.12 2011/04/14 15:12:54 Egg Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a customizable highlighter for SynEdit)
+@author(Martin Waldenburg, converted to SynEdit by Michael Hieke)
+@created(1999)
+@lastmod(2000-06-23)
+The SynHighlighterGeneral unit provides a customizable highlighter for SynEdit.
+}
+
+unit SynHighlighterGeneral;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber,
+    tkPreprocessor, tkSpace, tkString, tkSymbol, tkUnknown);
+
+  TCommentStyle = (csAnsiStyle, csPasStyle, csCStyle, csAsmStyle, csBasStyle,
+    csCPPStyle);
+  TCommentStyles = set of TCommentStyle;
+
+  TRangeState = (rsANil, rsAnsi, rsPasStyle, rsCStyle, rsString, rsUnknown);
+
+  TStringDelim = (sdSingleQuote, sdDoubleQuote, sdSingleAndDoubleQuote);
+
+  TGetTokenAttributeEvent = procedure (attribute : TSynHighlighterAttributes) of object;
+
+const
+   cDefaultIdentChars = '_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
+                         'abcdefghijklmnopqrstuvwxyz';
+
+type
+  TSynGeneralSyn = class(TSynCustomHighlighter)
+  private
+    FIdentChars: UnicodeString;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FPreprocessorAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FKeyWords: TUnicodeStrings;
+    FComments: TCommentStyles;
+    FStringDelim: TStringDelim;
+    FDetectPreprocessor: Boolean;
+    FOnGetTokenAttribute: TGetTokenAttributeEvent;
+    FStringMultiLine : Boolean;
+    FStringDelimChar: WideChar;
+    procedure AsciiCharProc;
+    procedure BraceOpenProc;
+    procedure PointCommaProc;
+    procedure CRProc;
+    procedure IdentProc;
+    procedure IntegerProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure RoundOpenProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure UnknownProc;
+    procedure AnsiProc;
+    procedure PasStyleProc;
+    procedure CStyleProc;
+    procedure SetKeyWords(const Value: TUnicodeStrings);
+    procedure SetComments(Value: TCommentStyles);
+    function GetStringDelim: TStringDelim;
+    procedure SetStringDelim(const Value: TStringDelim);
+    function GetIdentifierChars: UnicodeString;
+    procedure SetIdentifierChars(const Value: UnicodeString);
+    function StoreIdentChars : Boolean;
+    procedure SetDetectPreprocessor(Value: Boolean);
+    procedure SetStringMultiLine(const Value: Boolean);
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+    function IsStringDelim(aChar : WideChar) : Boolean;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetCharBeforeToken(offset : Integer = -1) : WideChar;
+    function GetCharAfterToken(offset : Integer = 1) : WideChar;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    function IsKeyword(const AKeyword: UnicodeString): Boolean; override;
+    function IsWordBreakChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+    procedure ResetRange; override;
+    procedure SetRange(Value: Pointer); override;
+
+    function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
+    function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
+
+    property OnGetTokenAttribute : TGetTokenAttributeEvent read FOnGetTokenAttribute write FOnGetTokenAttribute;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
+    property Comments: TCommentStyles read FComments write SetComments default [];
+    property DetectPreprocessor: Boolean read FDetectPreprocessor write SetDetectPreprocessor;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
+    property IdentifierChars: UnicodeString read GetIdentifierChars write SetIdentifierChars stored StoreIdentChars;
+    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
+    property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords;
+    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
+    property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri;
+    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
+    property StringDelim: TStringDelim read GetStringDelim write SetStringDelim default sdSingleQuote;
+    property StringMultiLine: Boolean read FStringMultiLine write SetStringMultiLine;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+constructor TSynGeneralSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FKeyWords := TUnicodeStringList.Create;
+  TUnicodeStringList(FKeyWords).Sorted := True;
+  TUnicodeStringList(FKeyWords).Duplicates := dupIgnore;
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style := [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(FPreprocessorAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  FStringDelim := sdSingleQuote;
+  FIdentChars := cDefaultIdentChars;
+  FRange := rsUnknown;
+end; { Create }
+
+destructor TSynGeneralSyn.Destroy;
+begin
+  FKeyWords.Free;
+  inherited Destroy;
+end; { Destroy }
+
+function TSynGeneralSyn.IsIdentChar(AChar: WideChar): Boolean;
+var
+  i: Integer;
+begin
+  Result := False;
+  for i := 1 to Length(FIdentChars) do
+    if AChar = FIdentChars[i] then
+    begin
+      Result := True;
+      Exit;
+    end;
+end;
+
+function TSynGeneralSyn.IsKeyword(const AKeyword: UnicodeString): Boolean;
+var
+  First, Last, I, Compare: Integer;
+  Token: UnicodeString;
+begin
+  First := 0;
+  Last := FKeyWords.Count - 1;
+  Result := False;
+  Token := SynWideUpperCase(AKeyword);
+  while First <= Last do
+  begin
+    I := (First + Last) shr 1;
+    Compare := WideCompareText(FKeyWords[i], Token);
+    if Compare = 0 then
+    begin
+      Result := True;
+      Break;
+    end
+    else if Compare < 0 then
+      First := I + 1
+    else
+      Last := I - 1;
+  end;
+end; { IsKeyWord }
+
+function TSynGeneralSyn.IsWordBreakChar(AChar: WideChar): Boolean;
+begin
+  Result := inherited IsWordBreakChar(AChar) and not IsIdentChar(AChar);
+end;
+
+procedure TSynGeneralSyn.AnsiProc;
+begin
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+  else
+    FTokenID := tkComment;
+    repeat
+      if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then
+      begin
+        FRange := rsUnknown;
+        Inc(Run, 2);
+        Break;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run);
+  end;
+end;
+
+procedure TSynGeneralSyn.PasStyleProc;
+begin
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+  else
+    FTokenID := tkComment;
+    repeat
+      if FLine[Run] = '}' then
+      begin
+        FRange := rsUnknown;
+        Inc(Run);
+        Break;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run);
+  end;
+end;
+
+procedure TSynGeneralSyn.CStyleProc;
+begin
+  case FLine[Run] of
+     #0: NullProc;
+    #10: LFProc;
+    #13: CRProc;
+  else
+    FTokenID := tkComment;
+    repeat
+      if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+      begin
+        FRange := rsUnknown;
+        Inc(Run, 2);
+        Break;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run);
+  end;
+end;
+
+procedure TSynGeneralSyn.AsciiCharProc;
+begin
+  if FDetectPreprocessor then
+  begin
+    FTokenID := tkPreprocessor;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end
+  else
+  begin
+    FTokenID := tkString;
+    repeat
+      Inc(Run);
+    until not CharInSet(FLine[Run], ['0'..'9']);
+  end;
+end;
+
+procedure TSynGeneralSyn.BraceOpenProc;
+begin
+  if csPasStyle in FComments then
+  begin
+    FTokenID := tkComment;
+    FRange := rsPasStyle;
+    Inc(Run);
+    while FLine[Run] <> #0 do
+      case FLine[Run] of
+        '}':
+          begin
+            FRange := rsUnknown;
+            Inc(Run);
+            Break;
+          end;
+        #10, #13:
+          Break;
+      else
+        Inc(Run);
+      end;
+  end
+  else
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynGeneralSyn.PointCommaProc;
+begin
+  if (csASmStyle in FComments) or (csBasStyle in FComments) then
+  begin
+    FTokenID := tkComment;
+    FRange := rsUnknown;
+    Inc(Run);
+    while FLine[Run] <> #0 do
+    begin
+      FTokenID := tkComment;
+      Inc(Run);
+    end;
+  end
+  else
+  begin
+    Inc(Run);
+    FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynGeneralSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynGeneralSyn.IdentProc;
+begin
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+  if IsKeyWord(GetToken) then
+    FTokenID := tkKey
+  else
+    FTokenID := tkIdentifier;
+end;
+
+procedure TSynGeneralSyn.IntegerProc;
+
+  function IsIntegerChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsIntegerChar do Inc(Run);
+end;
+
+procedure TSynGeneralSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynGeneralSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynGeneralSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', '.', 'e', 'E', 'x':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      'x':
+        begin // handle C style hex numbers
+          IntegerProc;
+          Break;
+        end;
+      '.':
+        if FLine[Run + 1] = '.' then Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynGeneralSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  if csAnsiStyle in FComments then
+  begin
+    case FLine[Run] of
+      '*':
+        begin
+          FTokenID := tkComment;
+          FRange := rsAnsi;
+          Inc(Run);
+          while FLine[Run] <> #0 do
+            case FLine[Run] of
+              '*':
+                if FLine[Run + 1] = ')' then
+                begin
+                  FRange := rsUnknown;
+                  Inc(Run, 2);
+                  Break;
+                end else Inc(Run);
+              #10, #13:
+                Break;
+              else
+                Inc(Run);
+            end;
+        end;
+      '.':
+        begin
+          Inc(Run);
+          FTokenID := tkSymbol;
+        end;
+    else
+      begin
+        FTokenID := tkSymbol;
+      end;
+    end;
+  end else FTokenID := tkSymbol;
+end;
+
+procedure TSynGeneralSyn.SlashProc;
+begin
+  Inc(Run);
+  case FLine[Run] of
+    '/':
+      begin
+        if csCPPStyle in FComments then
+        begin
+          FTokenID := tkComment;
+          Inc(Run);
+          while FLine[Run] <> #0 do
+          begin
+            case FLine[Run] of
+              #10, #13: Break;
+            end;
+            Inc(Run);
+          end;
+        end
+        else
+          FTokenID := tkSymbol;
+      end;
+    '*':
+      begin
+        if csCStyle in FComments then
+        begin
+          FTokenID := tkComment;
+          FRange := rsCStyle;
+          Inc(Run);
+          while FLine[Run] <> #0 do
+            case FLine[Run] of
+              '*':
+                if FLine[Run + 1] = '/' then
+                begin
+                  FRange := rsUnknown;
+                  Inc(Run, 2);
+                  Break;
+                end else Inc(Run);
+              #10, #13:
+                Break;
+              else
+                Inc(Run);
+            end;
+        end
+        else
+          FTokenID := tkSymbol;
+      end;
+    else
+      FTokenID := tkSymbol;
+  end;
+end;
+
+procedure TSynGeneralSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynGeneralSyn.StringProc;
+begin
+  FTokenID := tkString;
+  FRange := rsString;
+  if IsStringDelim(FLine[Run + 1]) and IsStringDelim(FLine[Run + 2]) then
+    Inc(Run, 2);
+
+  // eventualy store the string delimiter
+  if FStringDelimChar = #0 then
+    FStringDelimChar := FLine[Run];
+
+  Inc(Run);
+  while not IsLineEnd(Run) do
+  begin
+    if FLine[Run] = FStringDelimChar then
+    begin
+      Inc(Run);
+      if FLine[Run] <> FStringDelimChar then
+      begin
+        FRange := rsUnknown;
+        FStringDelimChar := #0;
+        Break;
+      end;
+    end;
+    Inc(Run);
+  end;
+
+  if IsLineEnd(Run) and (not FStringMultiLine) then
+  begin
+    FRange := rsUnknown;
+    FStringDelimChar := #0;
+  end;
+end;
+
+procedure TSynGeneralSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynGeneralSyn.Next;
+begin
+  FTokenPos := Run;
+  case FRange of
+    rsAnsi: AnsiProc;
+    rsPasStyle: PasStyleProc;
+    rsCStyle: CStyleProc;
+    rsString: StringProc;
+  else
+    if IsStringDelim(FLine[Run]) then
+      StringProc
+    else
+      case FLine[Run] of
+        '#':
+          AsciiCharProc;
+        '{':
+          BraceOpenProc;
+        ';':
+          PointCommaProc;
+        #13:
+          CRProc;
+        'A'..'Z', 'a'..'z', '_':
+          IdentProc;
+        '$':
+          IntegerProc;
+        #10:
+          LFProc;
+        #0:
+          NullProc;
+        '0'..'9':
+          NumberProc;
+        '(':
+          RoundOpenProc;
+        '/':
+          SlashProc;
+        #1..#9, #11, #12, #14..#32:
+          SpaceProc;
+        else
+          UnknownProc;
+      end;
+  end;
+  inherited;
+end;
+
+function TSynGeneralSyn.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 TSynGeneralSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynGeneralSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynGeneralSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+// GetCharBeforeToken
+//
+function TSynGeneralSyn.GetCharBeforeToken(offset: Integer = -1): WideChar;
+begin
+  if FTokenPos + offset >= 0 then
+    Result := FLine[FTokenPos + offset]
+  else
+    Result := #0;
+end;
+
+// GetCharAfterToken
+//
+function TSynGeneralSyn.GetCharAfterToken(offset: Integer = 1): WideChar;
+begin
+  Result := FLine[FTokenPos + offset];
+end;
+
+function TSynGeneralSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkPreprocessor: Result := FPreprocessorAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FSymbolAttri;
+  else
+    Result := nil;
+  end;
+  if Assigned(FOnGetTokenAttribute) then
+    FOnGetTokenAttribute(Result);
+end;
+
+function TSynGeneralSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+procedure TSynGeneralSyn.ResetRange;
+begin
+  FRange := rsUnknown;
+end;
+
+procedure TSynGeneralSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynGeneralSyn.SetKeyWords(const Value: TUnicodeStrings);
+var
+  i: Integer;
+begin
+  if Value <> nil then
+  begin
+    Value.BeginUpdate;
+    for i := 0 to Value.Count - 1 do
+      Value[i] := SynWideUpperCase(Value[i]);
+    Value.EndUpdate;
+  end;
+
+  TUnicodeStringList(FKeyWords).Sorted := False;
+  FKeyWords.Assign(Value);
+  TUnicodeStringList(FKeyWords).Sorted := True;
+
+  DefHighLightChange(nil);
+end;
+
+procedure TSynGeneralSyn.SetComments(Value: TCommentStyles);
+begin
+  if FComments <> Value then
+  begin
+    FComments := Value;
+    DefHighLightChange(Self);
+  end;
+end;
+
+class function TSynGeneralSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGeneral;
+end;
+
+function TSynGeneralSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKeyReadOnly(Key) then begin
+      if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords');
+      Result := inherited LoadFromRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+function TSynGeneralSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKey(Key,true) then begin
+      {$IFNDEF SYN_COMPILER_25_UP}
+      Result := true;
+      {$ENDIF}
+      r.WriteString('KeyWords', KeyWords.Text);
+      Result := inherited SaveToRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+function TSynGeneralSyn.GetStringDelim: TStringDelim;
+begin
+  Result := FStringDelim;
+end;
+
+procedure TSynGeneralSyn.SetStringDelim(const Value: TStringDelim);
+begin
+  if FStringDelim <> Value then
+  begin
+    FStringDelim := Value;
+    DefHighLightChange(Self);
+  end;
+end;
+
+procedure TSynGeneralSyn.SetStringMultiLine(const Value: Boolean);
+begin
+  if FStringMultiLine <> Value then
+  begin
+    FStringMultiLine := Value;
+    DefHighLightChange(Self);
+  end;
+end;
+
+function TSynGeneralSyn.GetIdentifierChars: UnicodeString;
+begin
+  Result := FIdentChars;
+end;
+
+procedure TSynGeneralSyn.SetIdentifierChars(const Value: UnicodeString);
+begin
+  FIdentChars := Value;
+end;
+
+function TSynGeneralSyn.StoreIdentChars : Boolean;
+begin
+  Result := (FIdentChars <> cDefaultIdentChars);
+end;
+
+procedure TSynGeneralSyn.SetDetectPreprocessor(Value: Boolean);
+begin
+  if Value <> FDetectPreprocessor then
+  begin
+    FDetectPreprocessor := Value;
+    DefHighlightChange(Self);
+  end;
+end;
+
+class function TSynGeneralSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGeneral;
+end;
+
+// IsStringDelim
+//
+function TSynGeneralSyn.IsStringDelim(aChar : WideChar): Boolean;
+begin
+  case FStringDelim of
+    sdSingleQuote:
+      Result := (aChar = '''');
+    sdDoubleQuote:
+      Result := (aChar = '"');
+  else
+    Result := (aChar = '''') or (aChar = '"');
+  end;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}                                                    
+  RegisterPlaceableHighlighter(TSynGeneralSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterGo.pas b/Source/VCL/SynEdit/Source/SynHighlighterGo.pas
new file mode 100644
index 00000000..8818b41c
--- /dev/null
+++ b/Source/VCL/SynEdit/Source/SynHighlighterGo.pas
@@ -0,0 +1,959 @@
+{-------------------------------------------------------------------------------
+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: SynHighlighterGo.pas, released 2017-06-01.
+Description: Syntax Parser/Highlighter
+The initial author of this file is Christian-W. Budde.
+Copyright (c) 2017, 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
+
+-------------------------------------------------------------------------------}
+
+unit SynHighlighterGo;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (
+    tkComment,
+    tkIdentifier,
+    tkFloat,
+    tkKey,
+    tkNull,
+    tkNumber,
+    tkSpace,
+    tkString,
+    tkSymbol,
+    tkUnknown);
+
+  TRangeState = (rsUnknown, rsSingleString, rsDoubleString, rsExtraString);
+
+  TProcTableProc = procedure of object;
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+type
+  TSynGoSyn = class(TSynCustomHighlighter)
+  private
+    fRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fIdentFuncTable: array[0..88] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    function HashKey(Str: PWideChar): Cardinal;
+    function FuncBool(Index: Integer): TtkTokenKind;
+    function FuncBreak(Index: Integer): TtkTokenKind;
+    function FuncByte(Index: Integer): TtkTokenKind;
+    function FuncCase(Index: Integer): TtkTokenKind;
+    function FuncChan(Index: Integer): TtkTokenKind;
+    function FuncComplex128(Index: Integer): TtkTokenKind;
+    function FuncComplex64(Index: Integer): TtkTokenKind;
+    function FuncConst(Index: Integer): TtkTokenKind;
+    function FuncContinue(Index: Integer): TtkTokenKind;
+    function FuncDefault(Index: Integer): TtkTokenKind;
+    function FuncDefer(Index: Integer): TtkTokenKind;
+    function FuncElse(Index: Integer): TtkTokenKind;
+    function FuncFallthrough(Index: Integer): TtkTokenKind;
+    function FuncFloat32(Index: Integer): TtkTokenKind;
+    function FuncFloat64(Index: Integer): TtkTokenKind;
+    function FuncFor(Index: Integer): TtkTokenKind;
+    function FuncFunc(Index: Integer): TtkTokenKind;
+    function FuncGo(Index: Integer): TtkTokenKind;
+    function FuncGoto(Index: Integer): TtkTokenKind;
+    function FuncIf(Index: Integer): TtkTokenKind;
+    function FuncImport(Index: Integer): TtkTokenKind;
+    function FuncInt(Index: Integer): TtkTokenKind;
+    function FuncInt16(Index: Integer): TtkTokenKind;
+    function FuncInt32(Index: Integer): TtkTokenKind;
+    function FuncInt64(Index: Integer): TtkTokenKind;
+    function FuncInt8(Index: Integer): TtkTokenKind;
+    function FuncInterface(Index: Integer): TtkTokenKind;
+    function FuncMap(Index: Integer): TtkTokenKind;
+    function FuncPackage(Index: Integer): TtkTokenKind;
+    function FuncRange(Index: Integer): TtkTokenKind;
+    function FuncReturn(Index: Integer): TtkTokenKind;
+    function FuncRune(Index: Integer): TtkTokenKind;
+    function FuncSelect(Index: Integer): TtkTokenKind;
+    function FuncString(Index: Integer): TtkTokenKind;
+    function FuncStruct(Index: Integer): TtkTokenKind;
+    function FuncSwitch(Index: Integer): TtkTokenKind;
+    function FuncType(Index: Integer): TtkTokenKind;
+    function FuncUint(Index: Integer): TtkTokenKind;
+    function FuncUint16(Index: Integer): TtkTokenKind;
+    function FuncUint32(Index: Integer): TtkTokenKind;
+    function FuncUint64(Index: Integer): TtkTokenKind;
+    function FuncUint8(Index: Integer): TtkTokenKind;
+    function FuncUintptr(Index: Integer): TtkTokenKind;
+    function FuncVar(Index: Integer): TtkTokenKind;
+    procedure IdentProc;
+    procedure UnknownProc;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    procedure InitIdent;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure CRProc;
+    procedure LFProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure StringProc;
+    procedure SymbolProc;
+  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 CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  // as this language is case-insensitive keywords *must* be in lowercase
+  KeyWords: array[0..43] of UnicodeString = (
+    'bool', 'break', 'byte', 'case', 'chan', 'complex128', 'complex64', 'const', 
+    'continue', 'default', 'defer', 'else', 'fallthrough', 'float32', 'float64', 
+    'for', 'func', 'go', 'goto', 'if', 'import', 'int', 'int16', 'int32', 
+    'int64', 'int8', 'interface', 'map', 'package', 'range', 'return', 'rune', 
+    'select', 'string', 'struct', 'switch', 'type', 'uint', 'uint16', 'uint32', 
+    'uint64', 'uint8', 'uintptr', 'var' 
+  );
+
+  KeyIndices: array[0..88] of Integer = (
+    29, 24, -1, -1, -1, 7, -1, 37, 11, -1, 22, 14, -1, 21, 1, -1, -1, -1, 39, 
+    31, -1, -1, -1, 28, -1, -1, 17, -1, -1, -1, 32, 30, 26, 41, 23, -1, 34, -1, 
+    -1, -1, -1, -1, -1, 9, 13, 20, -1, 35, -1, 3, -1, -1, 15, -1, -1, 25, -1, 
+    27, 4, 6, -1, 5, -1, -1, 10, 2, 16, -1, -1, -1, 43, -1, -1, 8, 40, 36, 33, 
+    -1, -1, -1, -1, 18, 19, 38, -1, 42, 12, -1, 0 
+  );
+
+procedure TSynGoSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[88] := FuncBool;
+  fIdentFuncTable[14] := FuncBreak;
+  fIdentFuncTable[65] := FuncByte;
+  fIdentFuncTable[49] := FuncCase;
+  fIdentFuncTable[58] := FuncChan;
+  fIdentFuncTable[61] := FuncComplex128;
+  fIdentFuncTable[59] := FuncComplex64;
+  fIdentFuncTable[5] := FuncConst;
+  fIdentFuncTable[73] := FuncContinue;
+  fIdentFuncTable[43] := FuncDefault;
+  fIdentFuncTable[64] := FuncDefer;
+  fIdentFuncTable[8] := FuncElse;
+  fIdentFuncTable[86] := FuncFallthrough;
+  fIdentFuncTable[44] := FuncFloat32;
+  fIdentFuncTable[11] := FuncFloat64;
+  fIdentFuncTable[52] := FuncFor;
+  fIdentFuncTable[66] := FuncFunc;
+  fIdentFuncTable[26] := FuncGo;
+  fIdentFuncTable[81] := FuncGoto;
+  fIdentFuncTable[82] := FuncIf;
+  fIdentFuncTable[45] := FuncImport;
+  fIdentFuncTable[13] := FuncInt;
+  fIdentFuncTable[10] := FuncInt16;
+  fIdentFuncTable[34] := FuncInt32;
+  fIdentFuncTable[1] := FuncInt64;
+  fIdentFuncTable[55] := FuncInt8;
+  fIdentFuncTable[32] := FuncInterface;
+  fIdentFuncTable[57] := FuncMap;
+  fIdentFuncTable[23] := FuncPackage;
+  fIdentFuncTable[0] := FuncRange;
+  fIdentFuncTable[31] := FuncReturn;
+  fIdentFuncTable[19] := FuncRune;
+  fIdentFuncTable[30] := FuncSelect;
+  fIdentFuncTable[76] := FuncString;
+  fIdentFuncTable[36] := FuncStruct;
+  fIdentFuncTable[47] := FuncSwitch;
+  fIdentFuncTable[75] := FuncType;
+  fIdentFuncTable[7] := FuncUint;
+  fIdentFuncTable[83] := FuncUint16;
+  fIdentFuncTable[18] := FuncUint32;
+  fIdentFuncTable[74] := FuncUint64;
+  fIdentFuncTable[33] := FuncUint8;
+  fIdentFuncTable[85] := FuncUintptr;
+  fIdentFuncTable[70] := FuncVar;
+end;
+
+{$Q-}
+function TSynGoSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 345 + Ord(Str^) * 670;
+    inc(Str);
+  end;
+  Result := Result mod 89;
+  fStringLen := Str - fToIdent;
+end;
+{$Q+}
+
+function TSynGoSyn.FuncBool(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncBreak(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncByte(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncCase(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncChan(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncComplex128(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncComplex64(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncConst(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncContinue(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncDefault(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncDefer(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncElse(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncFallthrough(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncFloat32(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncFloat64(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncFor(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncGo(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncGoto(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncIf(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncImport(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInt(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInt16(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInt32(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInt64(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInt8(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncInterface(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncMap(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncPackage(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncRange(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncReturn(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncRune(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncSelect(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncString(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncStruct(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncSwitch(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncType(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUint(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUint16(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUint32(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUint64(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUint8(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncUintptr(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.FuncVar(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier;
+end;
+
+function TSynGoSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynGoSyn.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 TSynGoSyn.SpaceProc;
+begin
+  inc(Run);
+  fTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
+end;
+
+procedure TSynGoSyn.StringProc;
+var
+  StringChar: WideChar;
+begin
+  fTokenID := tkString;
+  StringChar := fLine[Run];
+  repeat
+    inc(Run);
+  until IsLineEnd(Run) or (fLine[Run] = StringChar);
+
+  if FLine[Run] = #34 then
+    inc(Run);
+end;
+
+procedure TSynGoSyn.NullProc;
+begin
+  fTokenID := tkNull;
+  inc(Run);
+end;
+
+procedure TSynGoSyn.CRProc;
+begin
+  fTokenID := tkSpace;
+  inc(Run);
+  if fLine[Run] = #10 then
+    inc(Run);
+end;
+
+procedure TSynGoSyn.LFProc;
+begin
+  fTokenID := tkSpace;
+  inc(Run);
+end;
+
+procedure TSynGoSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '/':
+      begin
+        fTokenID := tkComment;
+        inc(Run, 2);
+        while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '*':
+      begin
+        fTokenID := tkComment;
+        inc(Run, 2);
+        while fLine[Run] <> #0 do
+          case fLine[Run] of
+            '*':
+              if fLine[Run + 1] = '/' then
+              begin
+                inc(Run, 2);
+                break;
+              end else inc(Run);
+            #10, #13:
+                break;
+          else inc(Run);
+          end;
+      end;
+    '=':
+      begin
+        inc(Run, 2);
+        fTokenID := tkSymbol;
+      end;
+  else
+    begin
+      inc(Run);
+      fTokenID := tkSymbol;
+    end;
+  end;
+end;
+
+constructor TSynGoSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  fCommentAttri.Foreground := clNavy;
+  AddAttribute(fCommentAttri);
+
+  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+
+  fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  fNumberAttri.Foreground := $666666;
+  AddAttribute(fNumberAttri);
+
+  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Foreground := $214195;
+  AddAttribute(fKeyAttri);
+
+  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+
+  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  fStringAttri.Foreground := $619121;
+  AddAttribute(fStringAttri);
+
+  fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  fSymbolAttri.Foreground := $666666;
+  AddAttribute(fSymbolAttri);
+
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  fDefaultFilter := SYNS_FilterGo;
+  fRange := rsUnknown;
+end;
+
+procedure TSynGoSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case fLine[Run] of
+      '0'..'9', '.', 'e', 'E', '-', '+':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  fTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case fLine[Run] of
+      '.':
+        if fLine[Run + 1] = '.' then
+          Break
+        else
+          fTokenID := tkFloat;
+      'e', 'E': fTokenID := tkFloat;
+      '-', '+':
+        begin
+          if fTokenID <> tkFloat then // arithmetic
+            Break;
+          if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then
+            Break; //float, but it ends here
+        end;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynGoSyn.IdentProc;
+begin
+  fTokenID := IdentKind((fLine + Run));
+  inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do inc(Run);
+end;
+
+procedure TSynGoSyn.SymbolProc;
+begin
+  inc(Run);
+  fTokenID := tkSymbol;
+end;
+
+procedure TSynGoSyn.UnknownProc;
+begin
+  inc(Run);
+  fTokenID := tkUnknown;
+end;
+
+procedure TSynGoSyn.Next;
+begin
+  fTokenPos := Run;
+  case fLine[Run] of
+    #0:
+      NullProc;
+    #10:
+      LFProc;
+    #13:
+      CRProc;
+    '/':
+      SlashProc;
+    #34:
+      StringProc;
+    #39:
+      StringProc;
+    #180:
+      StringProc;
+    #1..#9, #11, #12, #14..#32:
+      SpaceProc;
+    '0'..'9':
+      NumberProc;
+    'A'..'Z', 'a'..'z', '_':
+      IdentProc;
+    ':', '=', '+', '-', '.', ',':
+      SymbolProc;
+    '(', ')', '[', ']', '{', '}':
+      UnknownProc;
+  else
+    UnknownProc;
+  end;
+
+  inherited;
+end;
+
+function TSynGoSyn.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_SYMBOL: Result := fSymbolAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynGoSyn.GetEol: Boolean;
+begin
+  Result := Run = fLineLen + 1;
+end;
+
+function TSynGoSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+begin
+  Result := 
+    'bool,break,byte,case,chan,complex128,complex64,const,continue,default' +
+    ',defer,else,fallthrough,float32,float64,for,func,go,goto,if,import,int' +
+    ',int16,int32,int64,int8,interface,map,package,range,return,rune,select' +
+    ',string,struct,switch,type,uint,uint16,uint32,uint64,uint8,uintptr,var';
+end;
+
+function TSynGoSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := fTokenId;
+end;
+
+function TSynGoSyn.GetTokenAttribute: TSynHighLighterAttributes;
+begin
+  case GetTokenID of
+    tkComment:
+      Result := fCommentAttri;
+    tkIdentifier:
+      Result := fIdentifierAttri;
+    tkNumber, tkFloat:
+      Result := fNumberAttri;
+    tkKey:
+      Result := fKeyAttri;
+    tkSpace:
+      Result := fSpaceAttri;
+    tkString:
+      Result := fStringAttri;
+    tkSymbol:
+      Result := fSymbolAttri;
+    tkUnknown:
+      Result := fIdentifierAttri;
+  else
+    Result := nil;
+  end;
+end;
+
+function TSynGoSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(fTokenId);
+end;
+
+function TSynGoSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '_', '0'..'9', 'a'..'z', 'A'..'Z':
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+function TSynGoSyn.GetSampleSource: UnicodeString;
+begin
+  Result := 
+    #13#10 +
+    '/* Sample source for the go highlighter */'#13#10 +
+    #13#10 +
+    'package main'#13#10 +
+    #13#10 +
+    'import "fmt"'#13#10 +
+    #13#10 +
+    'func main() {'#13#10 +
+    '  fmt.Println("hello world")'#13#10+'}';
+end;
+
+function TSynGoSyn.IsFilterStored: Boolean;
+begin
+  Result := fDefaultFilter <> SYNS_FilterGo;
+end;
+
+class function TSynGoSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangGo;
+end;
+
+class function TSynGoSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangGo;
+end;
+
+procedure TSynGoSyn.ResetRange;
+begin
+  fRange := rsUnknown;
+end;
+
+procedure TSynGoSyn.SetRange(Value: Pointer);
+begin
+  fRange := TRangeState(Value);
+end;
+
+function TSynGoSyn.GetRange: Pointer;
+begin
+  Result := Pointer(fRange);
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynGoSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterHC11.pas b/Source/VCL/SynEdit/Source/SynHighlighterHC11.pas
index d4bd82de..1aae4ab6 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterHC11.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterHC11.pas
@@ -1,498 +1,501 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterHC11.pas, released 2000-04-21.
-The Original Code is based on the CIHC11Syn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Nils Springob.
-Unicode translation by Maël Hörz.
-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: SynHighlighterHC11.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a 68HC11 Assembler Language syntax highlighter for SynEdit)
-@author(Nils Springob , converted to SynEdit by Bruno Mikkelsen )
-@created(January 2000, converted to SynEdit April 21, 2000)
-@lastmod(2000-06-23)
-The SynHighlighterHC11 unit provides SynEdit with a 68HC11 Assembler (.asm) highlighter.
-The highlighter supports all 68HC11 op codes.
-Thanks to Martin Waldenburg, David Muir, Hideo Koiso and Nick Hoddinott.
-}
-
-unit SynHighlighterHC11;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditHighlighter,
-  SynEditTypes,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
-    tkSpace, tkString, tkSymbol, tkUnknown);
-
-  TkwKeyWordType = (kwNone, kwOperand, kwOperandOver, kwNoOperand);
-
-  PHashListEntry = ^THashListEntry;
-  THashListEntry = record
-    Next: PHashListEntry;
-    Token: string;
-    Kind: TtkTokenKind;
-    Op: Boolean;
-  end;
-
-  TSynHC11Syn = class(TSynCustomHighLighter)
-  private
-    FTokenID: TtkTokenKind;
-    FKeyWordType: TkwKeyWordType;
-    fCommentAttri: TSynHighlighterAttributes;
-    fDirecAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fInvalidAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
-    function HashKey(Str: PWideChar): Integer;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure SymAsciiCharProc;
-    procedure SymbolProc;
-    procedure SymDollarProc;
-    procedure SymCRProc;
-    procedure SymIdentProc;
-    procedure SymLFProc;
-    procedure SymPercentProc;
-    procedure SymNullProc;
-    procedure SymNumberProc;
-    procedure SymSpaceProc;
-    procedure SymStarProc;
-    procedure SymStringProc;
-    procedure SymUnknownProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
-      write fDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri
-      write fInvalidAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  { TODO: seems as if the Ansi version ignores the underscores and therfore
-    highlights more KeyWords than this(=Unicode) version.
-    Also the SampleSource uses EQU_ and EQU, so it isn't clear what is
-    the correct syntax: with other without the underscores.
-  }
-  KeyWords: string = (
-    'ABA,ABX,ABY,ADCA_,ADCB_,ADDA_,ADDB_,ADDD_,ANDA_,ANDB_,ASLA,ASLB,' +
-    'ASL_,ASLD,ASRA,ASRB,ASR_,BCC_,BCLR_,BCS_,BEQ_,BGE_,BGT_,BHI_,BHS' +
-    '_,BITA_,BITB_,BLE_,BLO_,BLS_,BLT_,BMI_,BNE_,BPL_,BRA_,BRCLR_,BRN' +
-    '_,BRSET_,BSET_,BSR_,BVC_,BVS_,CBA,CLC,CLI,CLRA,CLRB,CLR_,CLV,CMP' +
-    'A_,CMPB_,COMA,COMB,COM_,CPD_,CPX_,CPY_,DAA,DECA,DECB,DEC_,DES,DE' +
-    'X,DEY,EORA_,EORB_,FDIV,IDIV,INCA,INCB,INC_,INS,INX,INY,JMP_,JSR_' +
-    ',LDAA_,LDAB_,LDD_,LDS_,LDX_,LDY_,LSLA,LSLB,LSL_,LSLD,LSRA,LSRB,L' +
-    'SR_,LSRD,MUL,NEGA,NEGB,NEG_,NOP,ORAA_,ORAB_,PSHA,PSHB,PSHX,PSHY,' +
-    'PULA,PULB,PULX,PULY,ROLA,ROLB,ROL_,RORA,RORB,ROR_,RTI,RTS,SBA,SB' +
-    'CA_,SBCB_,SEC,SEI,SEV,STAA_,STAB_,STD_,STOP,STS_,STX_,STY_,SUBA_' +
-    ',SUBB_,SUBD_,SWI,TAB,TAP,TBA,TEST,' +
-    'TPA,TSTA,TSTB,TST_,TSX,TSY,TXS,TYS,WAI,XGDX,XGDY,' + // end commands
-    'FCC_,FCB_,BSZ_,FDB_' // codegenerating directives
-  );
-
-  Directives: string = (
-    'EQU_,OPT_,PAGE,ORG_,RMB_,END'  // directives
-  );
-
-procedure TSynHC11Syn.DoAddKeyword(AKeyword: string; AKind: Integer);
-var
-  HashValue: Integer;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-function TSynHC11Syn.HashKey(Str: PWideChar): Integer;
-
-  function GetOrd: Integer;
-  begin
-    case Str^ of
-      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
-      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
-      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
-      '_': Result := 27;
-      else Result := 0;
-    end
-  end;
-
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-{$IFOPT Q-}
-    Result := 7 * Result + GetOrd;
-{$ELSE}
-    Result := (7 * Result + GetOrd) and $FFFFFF;
-{$ENDIF}
-    Inc(Str);
-  end;
-  Result := Result and $FF; // 255
-  fStringLen := Str - fToIdent;
-end;
-
-function TSynHC11Syn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Entry: TSynHashEntry;
-begin
-  fToIdent := MayBe;
-  Entry := fKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > fStringLen then
-      break
-    else if Entry.KeywordLen = fStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
-end;
-
-constructor TSynHC11Syn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fKeywords := TSynHashEntryList.Create;
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style:= [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(fInvalidAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(fDirecAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkDirective), Directives, IsIdentChar, DoAddKeyword);
-  fDefaultFilter := SYNS_FilterAsm68HC11;
-end; { Create }
-
-destructor TSynHC11Syn.Destroy;
-begin
-  fKeywords.Free;
-  inherited Destroy;
-end;
-
-procedure TSynHC11Syn.SymAsciiCharProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13:
-      begin
-        FKeyWordType:=kwNone;
-        break;
-      end;
-    end;
-    inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynHC11Syn.SymbolProc;
-begin
-  fTokenID := tkSymbol;
-  inc(Run);
-end;
-
-procedure TSynHC11Syn.SymDollarProc;
-begin
-  fTokenID := tkNumber;
-  inc(Run);
-  while CharInSet(FLine[Run], ['0'..'9', 'A'..'F', 'a'..'f']) do
-  begin
-    inc(Run);
-  end;
-end;
-
-procedure TSynHC11Syn.SymCRProc;
-begin
-  fTokenID := tkSpace;
-  FKeyWordType := kwNone;
-  inc(Run);
-  if fLine[Run] = #10 then inc(Run);
-end;
-
-procedure TSynHC11Syn.SymIdentProc;
-begin
-  fTokenID := IdentKind(fLine + Run);
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynHC11Syn.SymLFProc;
-begin
-  FKeyWordType := kwNone;
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynHC11Syn.SymPercentProc;
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while CharInSet(FLine[Run], ['0'..'1']) do
-    inc(Run);
-end;
-
-procedure TSynHC11Syn.SymNullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynHC11Syn.SymNumberProc;
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while CharInSet(FLine[Run], ['0'..'9']) do
-    inc(Run);
-end;
-
-procedure TSynHC11Syn.SymSpaceProc;
-begin
-  inc(Run);
-  if FKeyWordType in [kwOperandOver, kwNoOperand] then
-  begin
-    FKeyWordType := kwNone;
-    fTokenID := tkComment;
-    while not IsLineEnd(Run) do
-      Inc(Run);
-  end
-  else
-  begin
-    if FKeyWordType = kwOperand then
-      FKeyWordType := kwOperandOver;
-    fTokenID := tkSpace;
-    while (fLine[Run] <= #32) and not IsLineEnd(Run) do
-      inc(Run);
-  end;
-end;
-
-procedure TSynHC11Syn.SymStarProc;
-begin
-  inc(Run);
-  if FKeyWordType = kwOperandOver then
-    fTokenID := tkSymbol
-  else
-  begin
-    fTokenID := tkComment;
-    while not IsLineEnd(Run) do
-      inc(Run);
-  end;
-end;
-
-procedure TSynHC11Syn.SymStringProc;
-begin
-  fTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: break;
-    end;
-    inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then inc(Run);
-end;
-
-procedure TSynHC11Syn.SymUnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynHC11Syn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    #39: SymAsciiCharProc;
-    '$': SymDollarProc;
-    #13: SymCRProc;
-    'A'..'Z', 'a'..'z', '_': SymIdentProc;
-    #10: SymLFProc;
-    '%': SymPercentProc;
-    #0: SymNullProc;
-    '0'..'9': SymNumberProc;
-    #1..#9, #11, #12, #14..#32: SymSpaceProc;
-    '*': SymStarProc;
-    #34: SymStringProc;
-    '#', ':', ',', ';', '(', ')': SymbolProc;
-    else SymUnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynHC11Syn.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 TSynHC11Syn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynHC11Syn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkDirective: Result := fDirecAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkUnknown: Result := fIdentifierAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynHC11Syn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynHC11Syn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynHC11Syn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterAsm68HC11;
-end;
-
-class function TSynHC11Syn.GetLanguageName: string;
-begin
-  Result := SYNS_Lang68HC11;
-end;
-
-function TSynHC11Syn.GetSampleSource: string;
-begin
-  Result :=
-    '* TX.ASM'#13#10 +
-    'MAINORG EQU_    $F800'#13#10 +
-    '        ORG     $F800'#13#10 +
-    'MAIN    EQU     *        ;Start assembling here'#13#10 +
-    '        STAA    SCCR2'#13#10 +
-    'loop:'#13#10 +
-    '        LDAA    #$05'#13#10 +
-    '	BRA	loop		;Do it again'#13#10 +
-    '	ORG	$FFFE		;Reset vector interrupt setup'#13#10 +
-    '	END';
-end;
-
-class function TSynHC11Syn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLang68HC11;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynHC11Syn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterHC11.pas, released 2000-04-21.
+The Original Code is based on the CIHC11Syn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Nils Springob.
+Unicode translation by Maël Hörz.
+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: SynHighlighterHC11.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a 68HC11 Assembler Language syntax highlighter for SynEdit)
+@author(Nils Springob , converted to SynEdit by Bruno Mikkelsen )
+@created(January 2000, converted to SynEdit April 21, 2000)
+@lastmod(2000-06-23)
+The SynHighlighterHC11 unit provides SynEdit with a 68HC11 Assembler (.asm) highlighter.
+The highlighter supports all 68HC11 op codes.
+Thanks to Martin Waldenburg, David Muir, Hideo Koiso and Nick Hoddinott.
+}
+
+unit SynHighlighterHC11;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditHighlighter,
+  SynEditTypes,
+  SynHighlighterHashEntries,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
+    tkSpace, tkString, tkSymbol, tkUnknown);
+
+  TkwKeyWordType = (kwNone, kwOperand, kwOperandOver, kwNoOperand);
+
+  PHashListEntry = ^THashListEntry;
+  THashListEntry = record
+    Next: PHashListEntry;
+    Token: UnicodeString;
+    Kind: TtkTokenKind;
+    Op: Boolean;
+  end;
+
+  TSynHC11Syn = class(TSynCustomHighLighter)
+  private
+    FTokenID: TtkTokenKind;
+    FKeyWordType: TkwKeyWordType;
+    FCommentAttri: TSynHighlighterAttributes;
+    FDirecAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FInvalidAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TSynHashEntryList;
+    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    function HashKey(Str: PWideChar): Integer;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure SymAsciiCharProc;
+    procedure SymbolProc;
+    procedure SymDollarProc;
+    procedure SymCRProc;
+    procedure SymIdentProc;
+    procedure SymLFProc;
+    procedure SymPercentProc;
+    procedure SymNullProc;
+    procedure SymNumberProc;
+    procedure SymSpaceProc;
+    procedure SymStarProc;
+    procedure SymStringProc;
+    procedure SymUnknownProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    procedure Next; override;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
+      write FDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
+      write FIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
+      write FInvalidAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  SynEditStrConst;
+
+const
+  { TODO: seems as if the Ansi version ignores the underscores and therfore
+    highlights more KeyWords than this(=Unicode) version.
+    Also the SampleSource uses EQU_ and EQU, so it isn't clear what is
+    the correct syntax: with other without the underscores.
+  }
+  KeyWords: UnicodeString = (
+    'ABA,ABX,ABY,ADCA_,ADCB_,ADDA_,ADDB_,ADDD_,ANDA_,ANDB_,ASLA,ASLB,' +
+    'ASL_,ASLD,ASRA,ASRB,ASR_,BCC_,BCLR_,BCS_,BEQ_,BGE_,BGT_,BHI_,BHS' +
+    '_,BITA_,BITB_,BLE_,BLO_,BLS_,BLT_,BMI_,BNE_,BPL_,BRA_,BRCLR_,BRN' +
+    '_,BRSET_,BSET_,BSR_,BVC_,BVS_,CBA,CLC,CLI,CLRA,CLRB,CLR_,CLV,CMP' +
+    'A_,CMPB_,COMA,COMB,COM_,CPD_,CPX_,CPY_,DAA,DECA,DECB,DEC_,DES,DE' +
+    'X,DEY,EORA_,EORB_,FDIV,IDIV,INCA,INCB,INC_,INS,INX,INY,JMP_,JSR_' +
+    ',LDAA_,LDAB_,LDD_,LDS_,LDX_,LDY_,LSLA,LSLB,LSL_,LSLD,LSRA,LSRB,L' +
+    'SR_,LSRD,MUL,NEGA,NEGB,NEG_,NOP,ORAA_,ORAB_,PSHA,PSHB,PSHX,PSHY,' +
+    'PULA,PULB,PULX,PULY,ROLA,ROLB,ROL_,RORA,RORB,ROR_,RTI,RTS,SBA,SB' +
+    'CA_,SBCB_,SEC,SEI,SEV,STAA_,STAB_,STD_,STOP,STS_,STX_,STY_,SUBA_' +
+    ',SUBB_,SUBD_,SWI,TAB,TAP,TBA,TEST,' +
+    'TPA,TSTA,TSTB,TST_,TSX,TSY,TXS,TYS,WAI,XGDX,XGDY,' + // end commands
+    'FCC_,FCB_,BSZ_,FDB_' // codegenerating directives
+  );
+
+  Directives: UnicodeString = (
+    'EQU_,OPT_,PAGE,ORG_,RMB_,END'  // directives
+  );
+
+procedure TSynHC11Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+var
+  HashValue: Integer;
+begin
+  HashValue := HashKey(PWideChar(AKeyword));
+  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+end;
+
+function TSynHC11Syn.HashKey(Str: PWideChar): Integer;
+
+  function GetOrd: Integer;
+  begin
+    case Str^ of
+      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
+      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
+      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
+      '_': Result := 27;
+      else Result := 0;
+    end
+  end;
+
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+{$IFOPT Q-}
+    Result := 7 * Result + GetOrd;
+{$ELSE}
+    Result := (7 * Result + GetOrd) and $FFFFFF;
+{$ENDIF}
+    Inc(Str);
+  end;
+  Result := Result and $FF; // 255
+  FStringLen := Str - FToIdent;
+end;
+
+function TSynHC11Syn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+var
+  Entry: TSynHashEntry;
+begin
+  FToIdent := MayBe;
+  Entry := FKeywords[HashKey(MayBe)];
+  while Assigned(Entry) do
+  begin
+    if Entry.KeywordLen > FStringLen then
+      Break
+    else if Entry.KeywordLen = FStringLen then
+      if IsCurrentToken(Entry.Keyword) then
+      begin
+        Result := TtkTokenKind(Entry.Kind);
+        Exit;
+      end;
+    Entry := Entry.Next;
+  end;
+  Result := tkIdentifier;
+end;
+
+constructor TSynHC11Syn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FKeywords := TSynHashEntryList.Create;
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style:= [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(FInvalidAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(FDirecAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword);
+  EnumerateKeywords(Ord(tkDirective), Directives, IsIdentChar, DoAddKeyword);
+  FDefaultFilter := SYNS_FilterAsm68HC11;
+end; { Create }
+
+destructor TSynHC11Syn.Destroy;
+begin
+  FKeywords.Free;
+  inherited Destroy;
+end;
+
+procedure TSynHC11Syn.SymAsciiCharProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+      begin
+        FKeyWordType:=kwNone;
+        Break;
+      end;
+    end;
+    Inc(Run);
+  until FLine[Run] = #39;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymbolProc;
+begin
+  FTokenID := tkSymbol;
+  Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymDollarProc;
+begin
+  FTokenID := tkNumber;
+  Inc(Run);
+  while CharInSet(FLine[Run], ['0'..'9', 'A'..'F', 'a'..'f']) do
+  begin
+    Inc(Run);
+  end;
+end;
+
+procedure TSynHC11Syn.SymCRProc;
+begin
+  FTokenID := tkSpace;
+  FKeyWordType := kwNone;
+  Inc(Run);
+  if FLine[Run] = #10 then Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymIdentProc;
+begin
+  FTokenID := IdentKind(FLine + Run);
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymLFProc;
+begin
+  FKeyWordType := kwNone;
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymPercentProc;
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while CharInSet(FLine[Run], ['0'..'1']) do
+    Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymNullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymNumberProc;
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while CharInSet(FLine[Run], ['0'..'9']) do
+    Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymSpaceProc;
+begin
+  Inc(Run);
+  if FKeyWordType in [kwOperandOver, kwNoOperand] then
+  begin
+    FKeyWordType := kwNone;
+    FTokenID := tkComment;
+    while not IsLineEnd(Run) do
+      Inc(Run);
+  end
+  else
+  begin
+    if FKeyWordType = kwOperand then
+      FKeyWordType := kwOperandOver;
+    FTokenID := tkSpace;
+    while (FLine[Run] <= #32) and not IsLineEnd(Run) do
+      Inc(Run);
+  end;
+end;
+
+procedure TSynHC11Syn.SymStarProc;
+begin
+  Inc(Run);
+  if FKeyWordType = kwOperandOver then
+    FTokenID := tkSymbol
+  else
+  begin
+    FTokenID := tkComment;
+    while not IsLineEnd(Run) do
+      Inc(Run);
+  end;
+end;
+
+procedure TSynHC11Syn.SymStringProc;
+begin
+  FTokenID := tkString;
+  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
+  repeat
+    case FLine[Run] of
+      #0, #10, #13:
+        Break;
+    end;
+    Inc(Run);
+  until FLine[Run] = #34;
+  if FLine[Run] <> #0 then Inc(Run);
+end;
+
+procedure TSynHC11Syn.SymUnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynHC11Syn.Next;
+begin
+  FTokenPos := Run;
+  case FLine[Run] of
+    #39: SymAsciiCharProc;
+    '$': SymDollarProc;
+    #13: SymCRProc;
+    'A'..'Z', 'a'..'z', '_': SymIdentProc;
+    #10: SymLFProc;
+    '%': SymPercentProc;
+    #0: SymNullProc;
+    '0'..'9': SymNumberProc;
+    #1..#9, #11, #12, #14..#32: SymSpaceProc;
+    '*': SymStarProc;
+    #34: SymStringProc;
+    '#', ':', ',', ';', '(', ')': SymbolProc;
+    else SymUnknownProc;
+  end;
+  inherited;
+end;
+
+function TSynHC11Syn.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 TSynHC11Syn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynHC11Syn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkDirective: Result := FDirecAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    tkUnknown: Result := FIdentifierAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynHC11Syn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTokenID);
+end;
+
+function TSynHC11Syn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynHC11Syn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterAsm68HC11;
+end;
+
+class function TSynHC11Syn.GetLanguageName: string;
+begin
+  Result := SYNS_Lang68HC11;
+end;
+
+function TSynHC11Syn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '* TX.ASM'#13#10 +
+    'MAINORG EQU_    $F800'#13#10 +
+    '        ORG     $F800'#13#10 +
+    'MAIN    EQU     *        ;Start assembling here'#13#10 +
+    '        STAA    SCCR2'#13#10 +
+    'loop:'#13#10 +
+    '        LDAA    #$05'#13#10 +
+    '	BRA	loop		;Do it again'#13#10 +
+    '	ORG	$FFFE		;Reset vector interrupt setup'#13#10 +
+    '	END';
+end;
+
+class function TSynHC11Syn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLang68HC11;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynHC11Syn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterHP48.pas b/Source/VCL/SynEdit/Source/SynHighlighterHP48.pas
index c19c421c..688eb1ed 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterHP48.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterHP48.pas
@@ -1,1019 +1,1033 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterHP48.pas, released 2000-06-23.
-The Original Code is based on the cbHPSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Cyrille de Brebisson.
-Unicode translation by Maël Hörz.
-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: SynHighlighterHP48.pas,v 1.10.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides SynEdit with a HP48 assembler syntax highlighter.)
-@author(Cyrille de Brebisson , converted to SynEdit by David Muir )
-@created(1998-12, converted to SynEdit 2000-06-23)
-@lastmod(2012-09-12)
-The unit SynHighlighterHP48 provides SynEdit with a HP48 assembler highlighter.
-}
-
-unit SynHighlighterHP48;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Windows,
-  Graphics,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-const
-  NbSubList = 128;
-
-type
-  TSpeedStringList = class;
-
-  TSpeedListObject = class
-  protected
-    FName: string;
-    FSpeedList: TSpeedStringList;
-    FObject: TObject;
-    procedure SetName(const Value: string); virtual;
-  public
-    property Name: string read FName write SetName;
-    constructor Create(name: string);
-    destructor Destroy; override;
-    property SpeedList: TSpeedStringList read FSpeedList write FSpeedList;
-    property Pointer: TObject read FObject write FObject;
-  end;
-
-  PSpeedListObjects = ^TSpeedListObjects;
-  TSpeedListObjects = array[0..0] of TSpeedListObject;
-
-  TSpeedStringList = class
-  private
-    function GetText: string;
-    procedure SetText(const Value: string);
-    function GetInObject(Index: Integer): TObject;
-    procedure SetInObject(Index: Integer; const Value: TObject);
-  protected
-    FOnChange: TNotifyEvent;
-    SumOfUsed: array[0..NbSubList - 1] of Integer;
-    DatasUsed: array[0..NbSubList - 1] of Integer;
-    Datas: array[0..NbSubList - 1] of PSpeedListObjects;
-    LengthDatas: array[0..NbSubList - 1] of Integer;
-    procedure Changed; virtual;
-    function Get(Index: Integer): string; virtual;
-    function GetObject(Index: Integer): TSpeedListObject;
-    function GetCount: Integer;
-    function GetStringList: TStrings;
-    procedure SetStringList(const Value: TStrings);
-  public
-    procedure NameChange(const obj: TSpeedListObject; const NewName: string);
-    procedure ObjectDeleted(const obj: TSpeedListObject);
-
-    destructor Destroy; override;
-    constructor Create;
-    function AddObj(const Value: TSpeedListObject): Integer;
-    function Add(const Value: string): TSpeedListObject;
-    procedure Clear;
-    function Find(const Name: string): TSpeedListObject;
-    property OnChange: TNotifyEvent read FOnChange write FOnChange;
-    property Objects[Index: Integer]: TSpeedListObject read GetObject;
-    property InObject[Index: Integer]: TObject read GetInObject write SetInObject;
-    property Strings[Index: Integer]: string read Get; default;
-    property Count: Integer read GetCount;
-    property StringList: TStrings read GetStringList write SetStringList;
-    property Text: string read GetText write SetText;
-  end;
-
-  TtkTokenKind = (tkNull, tkAsmKey, tkAsm, tkAsmComment, tksAsmKey, tksAsm,
-    tksAsmComment, tkRplKey, tkRpl, tkRplComment);
-
-  TRangeState = (rsRpl, rsComRpl, rssasm1, rssasm2, rssasm3, rsAsm, rsComAsm2,
-    rsComAsm1);
-
-  TSynHP48Syn = class(TSynCustomHighLighter)
-  private
-    fTockenKind: TtkTokenKind;
-    fRange: TRangeState;
-    Attribs: array[TtkTokenKind] of TSynHighlighterAttributes;
-    FRplKeyWords: TSpeedStringList;
-    FAsmKeyWords: TSpeedStringList;
-    FSAsmNoField: TSpeedStringList;
-    FBaseRange: TRangeState;
-    function GetAttrib(Index: integer): TSynHighlighterAttributes;
-    procedure SetAttrib(Index: integer; Value: TSynHighlighterAttributes);
-
-    function NullProc: TtkTokenKind;
-    function SpaceProc: TtkTokenKind;
-    function ParOpenProc: TtkTokenKind;
-    function RplComProc: TtkTokenKind;
-    function AsmComProc(c: WideChar): TtkTokenKind;
-    function PersentProc: TtkTokenKind;
-    function IdentProc: TtkTokenKind;
-    function SlashProc: TtkTokenKind;
-    function SasmProc1: TtkTokenKind;
-    function SasmProc2: TtkTokenKind;
-    function SasmProc3: TtkTokenKind;
-    procedure EndOfToken;
-    procedure SetHighLightChange;
-    function Next1: TtkTokenKind;
-    procedure Next2(tkk: TtkTokenKind);
-    function GetTokenFromRange: TtkTokenKind;
-    function StarProc: TtkTokenKind;
-  protected
-    function GetAttribCount: integer; override;
-    function GetAttribute(idx: integer): TSynHighlighterAttributes; override;
-    function IsFilterStored: Boolean; override;
-    function IsLineEnd(Run: Integer): Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    procedure DoSetLine(const Value: string; LineNumber: Integer); override;
-    procedure Next; override;
-
-    function GetToken: string; override;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-
-    function GetRange: Pointer; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    function SaveToRegistry(RootKey: HKEY; Key: string): boolean; override;
-    function LoadFromRegistry(RootKey: HKEY; Key: string): boolean; override;
-    procedure Assign(Source: TPersistent); override;
-    property AsmKeyWords: TSpeedStringList read FAsmKeyWords;
-    property SAsmFoField: TSpeedStringList read FSAsmNoField;
-    property RplKeyWords: TSpeedStringList read FRplKeyWords;
-  published
-    property AsmKey: TSynHighlighterAttributes index Ord(tkAsmKey)
-      read GetAttrib write SetAttrib;
-    property AsmTxt: TSynHighlighterAttributes index Ord(tkAsm)
-      read GetAttrib write SetAttrib;
-    property AsmComment: TSynHighlighterAttributes index Ord(tkAsmComment)
-      read GetAttrib write SetAttrib;
-    property sAsmKey: TSynHighlighterAttributes index Ord(tksAsmKey)
-      read GetAttrib write SetAttrib;
-    property sAsmTxt: TSynHighlighterAttributes index Ord(tksAsm)
-      read GetAttrib write SetAttrib;
-    property sAsmComment: TSynHighlighterAttributes index Ord(tksAsmComment)
-      read GetAttrib write SetAttrib;
-    property RplKey: TSynHighlighterAttributes index Ord(tkRplKey)
-      read GetAttrib write SetAttrib;
-    property RplTxt: TSynHighlighterAttributes index Ord(tkRpl)
-      read GetAttrib write SetAttrib;
-    property RplComment: TSynHighlighterAttributes index Ord(tkRplComment)
-      read GetAttrib write SetAttrib;
-    property BaseRange: TRangeState read FBaseRange write FBaseRange;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  DefaultAsmKeyWords: string = '!RPL'#13#10'ENDCODE'#13#10'{'#13#10'}'#13#10 +
-  'GOTO'#13#10'GOSUB'#13#10'GOSBVL'#13#10'GOVLNG'#13#10'GOLONG'#13#10'SKIP' +
-    #13#10'SKIPYES' + #13#10'->'#13#10'SKUB'#13#10'SKUBL'#13#10'SKC'#13#10'SKNC'#13#10'SKELSE' +
-    #13#10'SKEC'#13#10'SKENC'#13#10'SKLSE'#13#10 + 'GOTOL'#13#10'GOSUBL'#13#10 +
-    'RTN'#13#10'RTNC'#13#10'RTNNC'#13#10'RTNSC'#13#10'RTNCC'#13#10'RTNSXM'#13#10'RTI';
-  OtherAsmKeyWords: array[0..5] of string = ('UP', 'EXIT', 'UPC', 'EXITC', 'UPNC', 'EXITNC');
-  DefaultRplKeyWords: string =
-    'CODEM'#13#10'ASSEMBLEM'#13#10'CODE'#13#10'ASSEMBLE'#13#10'IT'#13#10'ITE'#13#10'case'#13#10'::'#13#10';'#13#10'?SEMI'#13#10''''#13#10'#=case'#13#10'{'#13#10'}'#13#10'NAMELESS'#13#10'LOCAL'#13#10'LOCALNAME'#13#10'LABEL'#13#10 +
-    'LOCALLABEL'#13#10'xNAME'#13#10'tNAME' + 'COLA'#13#10'NULLNAME'#13#10'xROMID'#13#10'#0=ITE'#13#10'#ITE'#13#10'2''RCOLARPITE'#13#10'ANDITE'#13#10'COLAITE'#13#10'COLARPITE'#13#10'DUP#0=ITE'#13#10 +
-    'EQITE'#13#10'ITE'#13#10'RPITE'#13#10'SysITE'#13#10'UNxSYMRPITE'#13#10'UserITE'#13#10'snnSYMRPITE'#13#10'snsSYMRPITE'#13#10'ssnSYMRPITE'#13#10'sssSYMRPITE'#13#10'$_EXIT'#13#10'DA1OK?NOTIT'#13#10'DA2aOK?NOTIT'#13#10 +
-    'DA2bOK?NOTIT'#13#10'DA3OK?NOTIT'#13#10'DO#EXIT'#13#10'DO$EXIT'#13#10'DO%EXIT'#13#10'DOHXSEXIT'#13#10'DUP#0=IT'#13#10'EQIT'#13#10'GCDHEULPEXIT'#13#10'GSPLIT'#13#10'NOT_IT'#13#10'POINTEXIT'#13#10'POLYARIT'#13#10'RPIT'#13#10 +
-    'parleftIT'#13#10'parrightIT'#13#10''''#13#10'IT'#13#10'ITE'#13#10'SEMI'#13#10'UNTIL'#13#10'LOOP'#13#10'?SEMI'#13#10'NOT?SEMI'#13#10'#0=case'#13#10'#1=case'#13#10'#<>case'#13#10'#2case'#13#10'#>33case'#13#10'#>case'#13#10'%-1=case'#13#10'%0=case'#13#10'%1=case'#13#10'%2=case'#13#10'AEQ1stcase'#13#10'AEQopscase'#13#10'ANDNOTcase'#13#10'ANDcase'#13#10'C%-1=case'#13#10 +
-    'C%0=case'#13#10'C%1=case'#13#10'C%2=case'#13#10'COLANOTcase'#13#10'COLAcase'#13#10'DUP#0=case'#13#10'EQUALNOTcase'#13#10'EQUALcase'#13#10'EQUALcasedrop'#13#10'EQUALcasedrp'#13#10'EQcase'#13#10'EQcaseDROP'#13#10 +
-    'EQcasedrop'#13#10'EnvNGcase'#13#10'M-1stcasechs'#13#10'MEQ*case'#13#10'MEQ+case'#13#10'MEQ-case'#13#10'MEQ/case'#13#10'MEQ1stcase'#13#10'MEQCHScase'#13#10'MEQFCNcase'#13#10'MEQINVcase'#13#10'MEQSQcase'#13#10'MEQ^case'#13#10 +
-    'MEQopscase'#13#10'Mid1stcase'#13#10'NOTBAKcase'#13#10'NOTLIBcase'#13#10'NOTLISTcase'#13#10'NOTMATRIXcase'#13#10'NOTROMPcase'#13#10'NOTSECOcase'#13#10'NOTTYPEcase'#13#10'NOTcase'#13#10'NOTcase2DROP'#13#10'NOTcase2drop'#13#10 +
-    'NOTcaseDROP'#13#10'NOTcaseFALSE'#13#10'NOTcaseTRUE'#13#10'NOTcasedrop'#13#10'NULLargcase'#13#10'NcaseSIZEERR'#13#10'NcaseTYPEERR'#13#10'NoEdit?case'#13#10'ORcase'#13#10'OVER#=case'#13#10'REALcase'#13#10'REQcase'#13#10 +
-    'REQcasedrop'#13#10'Z-1=case'#13#10'Z0=case'#13#10'Z1=case'#13#10'accNBAKcase'#13#10'accNLIBcase'#13#10'case'#13#10'case2DROP'#13#10'case2drop'#13#10'case2drpfls'#13#10'caseDEADKEY'#13#10'caseDROP'#13#10'caseDoBadKey'#13#10 +
-    'caseDrpBadKy'#13#10'caseERRJMP'#13#10'caseFALSE'#13#10'caseSIZEERR'#13#10'caseTRUE'#13#10'casedrop'#13#10'casedrpfls'#13#10'casedrptru'#13#10'caseout'#13#10'cxcasecheck'#13#10'dARRYcase'#13#10'dIDNTNcase'#13#10'dLISTcase'#13#10 +
-    'dMATRIXcase'#13#10'dREALNcase'#13#10'dREALcase'#13#10'dZINTNcase'#13#10'delimcase'#13#10'estcase'#13#10'idntcase'#13#10'idntlamcase'#13#10'j#-1=case'#13#10'j#0=case'#13#10'j#1=case'#13#10'j%-1=case'#13#10'j%0=case'#13#10 +
-    'j%1=case'#13#10'jEQcase'#13#10'jZ-1=case'#13#10'jZ0=case'#13#10'jZ1=case'#13#10'namelscase'#13#10'need''case'#13#10'negrealcase'#13#10'ngsizecase'#13#10'nonopcase'#13#10'nonrmcase'#13#10'num#-1=case'#13#10'num#0=case'#13#10 +
-    'num#1=case'#13#10'num-1=case'#13#10'num0=case'#13#10'num0case'#13#10'num1=case'#13#10'num2=case'#13#10'numb1stcase'#13#10'rebuildcase'#13#10'tok=casedrop'#13#10'wildcase'#13#10'zerdercase'#13#10;
-  SasmNoField: string = 'LOOP'#13#10'RTNSXM'#13#10'RTN'#13#10'RTNSC'#13#10'RTNCC'#13#10'SETDEC'#13#10'SETHEX'#13#10'RSTK=C'#13#10'C=RSTK'#13#10'CLRST'#13#10'C=ST'#13#10'ST=C'#13#10'CSTEX'#13#10 +
-  'RTI'#13#10'R0=A'#13#10'R1=A'#13#10'R2=A'#13#10'R3=A'#13#10'R4=A'#13#10'R0=C'#13#10'R1=C'#13#10'R2=C'#13#10'R3=C'#13#10'R4=C'#13#10'A=R0'#13#10'A=R1'#13#10'A=R2'#13#10'A=R3'#13#10'A=R4'#13#10 +
-    'C=R0'#13#10'C=R1'#13#10'C=R2'#13#10'C=R3'#13#10'C=R4'#13#10'AR0EX'#13#10'AR1EX'#13#10'AR2EX'#13#10'AR3EX'#13#10'AR4EX'#13#10'CR0EX'#13#10'CR1EX'#13#10'CR2EX'#13#10'CR3EX'#13#10'CR4EX'#13#10 +
-    'D0=A'#13#10'D0=C'#13#10'D1=A'#13#10'D1=C'#13#10'AD0EX'#13#10'AD1EX'#13#10'CD0EX'#13#10'CD1EX'#13#10'D0=AS'#13#10'D1=AS'#13#10'D0=CS'#13#10'D1=CD'#13#10'CD1XS'#13#10'CD0XS'#13#10'AD1XS'#13#10'AD0XS'#13#10 +
-    'RTNC'#13#10'RTNNC'#13#10'OUT=CS'#13#10'OUT=C'#13#10'A=IN'#13#10'C=IN'#13#10'SHUTDN'#13#10'INTON'#13#10'C=ID'#13#10'CONFIG'#13#10'UNCNFG'#13#10'RSI'#13#10'PC=(A)'#13#10'PC=(C)'#13#10'INTOFF'#13#10 +
-    'C+P+1'#13#10'RESET'#13#10'SREQ?'#13#10'ASLC'#13#10'BSLC'#13#10'CSLC'#13#10'DSLC'#13#10'ASRC'#13#10'BSRC'#13#10'CSRC'#13#10'DSRC'#13#10'ASRB'#13#10'BSRB'#13#10'CSRB'#13#10'DSRB'#13#10'PC=A'#13#10'PC=C'#13#10 +
-    'A=PC'#13#10'C=PC'#13#10'APCEX'#13#10'CPCEX'#13#10'XM=0'#13#10'SB=0'#13#10'SR=0'#13#10'MP=0'#13#10'CLRHST'#13#10'?XM=0'#13#10'?SR=0'#13#10'?MP=0'#13#10'?SB=0'#13#10'RTNYES'#13#10'SKIPYES{'#13#10'{'#13#10'}'#13#10'UP'#13#10'EXIT'#13#10'EXITNC'#13#10'EXITC'#13#10'UPC'#13#10'UPNC' +
-    '}SKELSE{'#13#10'SKC{'#13#10'SKNC{'#13#10'SKUB{'#13#10'SKUBL{'#13#10'SKIPC{'#13#10'SKIPNC{'#13#10'EXIT2'#13#10'EXIT3'#13#10'UP2'#13#10'UP3'#13#10'}SKLSE{'#13#10'}SKEC{'#13#10'}SKENC{'#13#10;
-
-function StringCrc(S: string): integer;
-var
-  i: integer;
-begin
-  result := 0;
-  for i := 1 to length(s) do begin
-    result := (result shr 4) xor (((result xor ord(s[i])) and $F) * $1081);
-    result := (result shr 4) xor (((result xor (ord(s[i]) shr 4)) and $F) * $1081);
-  end;
-end;
-
-{ TSpeedListObject }
-
-constructor TSpeedListObject.create(name: string);
-begin
-  inherited create;
-  FName := name;
-end;
-
-destructor TSpeedListObject.destroy;
-begin
-  if Assigned(FSpeedList) then
-    FSpeedList.ObjectDeleted(Self);
-  inherited destroy;
-end;
-
-procedure TSpeedListObject.SetName(const Value: string);
-begin
-  FName := Value;
-  if FSpeedList <> nil then
-    FSpeedList.NameChange(Self, Value);
-end;
-
-{ TSpeedStringList }
-
-function TSpeedStringList.AddObj(const Value: TSpeedListObject): Integer;
-var
-  crc: integer;
-  i: integer;
-begin
-  crc := StringCrc(Value.Name) mod High(Datas) + 1;
-  if DatasUsed[crc] = lengthDatas[crc] then begin
-    ReallocMem(datas[crc], (lengthDatas[crc] * 2 + 1) * SizeOf(datas[1][0]));
-    lengthDatas[crc] := lengthDatas[crc] * 2 + 1;
-  end;
-  Datas[crc][DatasUsed[crc]] := Value;
-  result := SumOfUsed[crc] + DatasUsed[crc];
-  inc(DatasUsed[crc]);
-  for i := crc + 1 to High(SumOfUsed) do
-    inc(SumOfUsed[i]);
-  Value.SpeedList := Self;
-end;
-
-function TSpeedStringList.Add(const Value: string): TSpeedListObject;
-begin
-  result := TSpeedListObject.Create(value);
-  AddObj(Result);
-end;
-
-procedure TSpeedStringList.Changed;
-begin
-  if Assigned(FOnChange) then
-    FOnChange(Self);
-end;
-
-procedure TSpeedStringList.Clear;
-var
-  i, j: integer;
-begin
-  for i := low(datas) to high(datas) do begin
-    for j := 0 to DatasUsed[i] - 1 do
-      datas[i][j].free;
-    datasUsed[i] := 0;
-    ReallocMem(datas[i], 0);
-    lengthDatas[i] := 0;
-    SumOfUsed[i] := 0;
-  end;
-  Changed;
-end;
-
-constructor TSpeedStringList.create;
-var
-  i: integer;
-begin
-  inherited Create;
-  for i := Low(Datas) to high(datas) do begin
-    SumOfUsed[i] := 0;
-    DatasUsed[i] := 0;
-    lengthDatas[i] := 0;
-    datas[i] := nil;
-  end;
-end;
-
-destructor TSpeedStringList.Destroy;
-begin
-  Clear;
-  inherited destroy;
-end;
-
-function TSpeedStringList.Find(const name: string): TSpeedListObject;
-var
-  crc: integer;
-  i: integer;
-begin
-  crc := StringCrc(name) mod High(Datas) + 1;
-  for i := 0 to DatasUsed[crc] - 1 do
-    if Datas[crc][i].name = name then begin
-      result := Datas[crc][i];
-      exit;
-    end;
-  result := nil;
-end;
-
-function TSpeedStringList.Get(Index: Integer): string;
-var
-  i: integer;
-begin
-  for i := low(SumOfUsed) + 1 to High(SumOfUsed) do
-    if Index > SumOfUsed[i] then begin
-      result := Datas[i - 1][Index - SumOfUsed[i - 1]].name;
-      exit;
-    end;
-  result := '';
-end;
-
-function TSpeedStringList.GetCount: integer;
-begin
-  result := SumOfUsed[High(datas)] + DatasUsed[High(Datas)];
-end;
-
-function TSpeedStringList.GetInObject(Index: Integer): TObject;
-var
-  i: integer;
-begin
-  for i := low(SumOfUsed) + 1 to High(SumOfUsed) do
-    if Index > SumOfUSed[i] then begin
-      result := Datas[i - 1][Index - SumOfUsed[i - 1]].pointer;
-      exit;
-    end;
-  result := nil;
-end;
-
-function TSpeedStringList.GetObject(Index: Integer): TSpeedListObject;
-var
-  i: integer;
-begin
-  for i := low(SumOfUsed) + 1 to High(SumOfUsed) do
-    if Index > SumOfUSed[i] then begin
-      result := Datas[i - 1][Index - SumOfUsed[i - 1]];
-      exit;
-    end;
-  result := nil;
-end;
-
-function TSpeedStringList.GetStringList: TStrings;
-var
-  i, j: integer;
-begin
-  result := TStringList.Create;
-  for i := Low(Datas) to High(Datas) do
-    for j := 0 to DatasUsed[i] - 1 do
-      result.add(datas[i][j].name);
-end;
-
-function TSpeedStringList.GetText: string;
-begin
-  with StringList do begin
-    result := Text;
-    free;
-  end;
-end;
-
-procedure TSpeedStringList.NameChange(const Obj: TSpeedListObject; const NewName: string);
-var
-  crc: integer;
-  i: integer;
-  j: integer;
-begin
-  crc := StringCrc(obj.Name) mod High(Datas) + 1;
-  for i := 0 to DatasUsed[crc] - 1 do
-    if Datas[crc][i] = Obj then begin
-      for j := i + 1 to DatasUsed[crc] - 1 do
-        Datas[i - 1] := Datas[i];
-      for j := crc + 1 to High(Datas) do
-        dec(SumOfUsed[j]);
-      if DatasUsed[crc] < lengthDatas[crc] div 2 then begin
-        ReallocMem(Datas[crc], DatasUsed[crc] * SizeOf(Datas[crc][0]));
-        lengthDatas[crc] := DatasUsed[crc];
-      end;
-      AddObj(Obj);
-      exit;
-    end;
-end;
-
-procedure TSpeedStringList.ObjectDeleted(const obj: TSpeedListObject);
-var
-  crc: integer;
-  i: integer;
-  j: integer;
-begin
-  crc := StringCrc(obj.Name) mod High(Datas) + 1;
-  for i := 0 to DatasUsed[crc] - 1 do
-    if Datas[crc][i] = Obj then begin
-      for j := i + 1 to DatasUsed[crc] - 1 do
-        if i > 0 then
-          Datas[i - 1] := Datas[i];
-      for j := crc + 1 to High(Datas) do
-        dec(SumOfUsed[j]);
-      Obj.FSpeedList := nil;
-      exit;
-    end;
-end;
-
-procedure TSpeedStringList.SetInObject(Index: Integer;
-  const Value: TObject);
-var
-  i: integer;
-begin
-  for i := low(SumOfUsed) + 1 to High(SumOfUsed) do
-    if Index > SumOfUSed[i] then begin
-      Datas[i - 1][Index - SumOfUsed[i - 1]].pointer := value;
-      exit;
-    end;
-end;
-
-procedure TSpeedStringList.SetStringList(const value: TStrings);
-var
-  i: integer;
-begin
-  clear;
-  for i := 0 to Value.Count - 1 do
-    AddObj(TSpeedListObject.Create(value[i]));
-end;
-
-procedure TSpeedStringList.SetText(const Value: string);
-var
-  s: TStrings;
-begin
-  s := TStringList.Create;
-  try
-    s.Text := Value;
-    StringList := s;
-  finally
-    s.Free;
-  end;
-end;
-
-{ TSynHP48Syn }
-
-constructor TSynHP48Syn.Create(AOwner: TComponent);
-var
-  j, k: integer;
-begin
-  Attribs[tkNull] := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
-  Attribs[tkAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrAsmKey, SYNS_FriendlyAttrAsmKey);
-  Attribs[tkAsm] := TSynHighlighterAttributes.Create(SYNS_AttrAsm, SYNS_FriendlyAttrAsm);
-  Attribs[tkAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrAsmComment, SYNS_FriendlyAttrAsmComment);
-  Attribs[tksAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrSASMKey, SYNS_FriendlyAttrSASMKey);
-  Attribs[tksAsm] := TSynHighlighterAttributes.Create(SYNS_AttrSASM, SYNS_FriendlyAttrSASM);
-  Attribs[tksAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrSASMComment, SYNS_FriendlyAttrSASMComment);
-  Attribs[tkRplKey] := TSynHighlighterAttributes.Create(SYNS_AttrRplKey, SYNS_FriendlyAttrRplKey);
-  Attribs[tkRpl] := TSynHighlighterAttributes.Create(SYNS_AttrRpl, SYNS_FriendlyAttrRpl);
-  Attribs[tkRplComment] := TSynHighlighterAttributes.Create(SYNS_AttrRplComment, SYNS_FriendlyAttrRplComment);
-
-  inherited Create(AOwner);
-  SetHighlightChange;
-  FAsmKeyWords := TSpeedStringList.Create;
-  FAsmKeyWords.Text := DefaultAsmKeyWords;
-  for j := low(OtherAsmKeyWords) to High(OtherAsmKeyWords) do begin
-    FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j]));
-    for k := 1 to 8 do
-      FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j] + IntToStr(k)));
-  end;
-  FRplKeyWords := TSpeedStringList.Create;
-  FRplKeyWords.Text := DefaultRplKeyWords;
-  FSAsmNoField := TSpeedStringList.Create;
-  FSAsmNoField.Text := SAsmNoField;
-  BaseRange := rsRpl;
-  fRange := rsRpl;
-  fDefaultFilter := SYNS_FilterHP48;
-end; { Create }
-
-destructor TSynHP48Syn.Destroy;
-var
-  i: TtkTokenKind;
-begin
-  for i := low(TtkTokenKind) to High(TtkTokenKind) do
-    Attribs[i].Free;
-  FAsmKeyWords.Free;
-  FRplKeyWords.Free;
-  FSAsmNoField.free;
-  inherited Destroy;
-end; { Destroy }
-
-function TSynHP48Syn.AsmComProc(c: WideChar): TtkTokenKind;
-begin
-  Result := tkAsmComment;
-  if (Run > Length(fLineStr)) then
-    Result := NullProc
-  else
-    while Run <= Length(fLineStr) do
-      if ((run = 1) or (fLineStr[run - 1] <= ' ')) and
-        (fLineStr[Run] = '*') and
-        ((run < Length(fLineStr)) and (fLineStr[run + 1] = c)) and
-        ((run + 1 = Length(fLineStr)) or (fLineStr[run + 2] <= ' ')) then begin
-        inc(run, 2);
-        fRange := rsAsm;
-        break;
-      end
-      else
-        inc(Run);
-end;
-
-function TSynHP48Syn.RplComProc: TtkTokenKind;
-begin
-  Result := tkRplComment;
-  if (Run > Length(fLineStr)) then
-    Result := NullProc
-  else
-    while Run <= Length(fLineStr) do
-      if fLineStr[Run] = ')' then begin
-        inc(run);
-        fRange := rsRpl;
-        break;
-      end
-      else
-        inc(Run);
-end;
-
-function TSynHP48Syn.SlashProc: TtkTokenKind;
-begin
-  if fRange = rsRpl then
-    Result := IdentProc
-  else if ((Run = 1) or (fLineStr[Run - 1] <= ' ')) and
-    (fLineStr[Run] = '/') and
-    (run < Length(fLineStr)) and
-    (fLineStr[run + 1] = '*') and
-    ((run + 1 = Length(fLineStr)) or (fLineStr[Run + 2] <= ' ')) then begin
-    inc(Run, 2);
-    Result := tkAsmComment;
-    fRange := rsComAsm2;
-  end
-  else if (run < Length(fLineStr)) and (fLineStr[Run + 1] = '/') then begin
-    inc(Run, 2);
-    Result := tkAsmComment;
-    while (run <= Length(fLineStr)) do
-      if CharInSet(fLineStr[Run], [#10, #13]) then
-      begin
-        inc(Run);
-        break;
-      end
-      else
-        inc(Run);
-  end
-  else
-    Result := IdentProc
-end;
-
-function TSynHP48Syn.ParOpenProc: TtkTokenKind;
-begin
-  if fRange = rsRpl then
-    if ((Run = 1) and ((Length(fLineStr) = 1) or (fLineStr[Run + 1] <= ' '))) or
-      ((fLineStr[Run - 1] <= ' ') and ((Length(fLineStr) = Run) or (fLineStr[Run + 1] <= ' '))) then begin
-      inc(Run);
-      Result := tkRplComment;
-      fRange := rsComRpl;
-    end
-    else
-      Result := IdentProc
-  else if ((run = 1) or (fLineStr[run - 1] <= ' ')) and
-    (fLineStr[Run] = '(') and
-    (run < Length(fLineStr)) and
-    (fLineStr[run + 1] = '*') and
-    ((run + 2 > Length(fLineStr)) or (fLineStr[run + 2] <= ' ')) then begin
-    inc(Run, 2);
-    Result := tkAsmComment;
-    fRange := rsComAsm1;
-  end
-  else
-    Result := IdentProc
-end;
-
-function TSynHP48Syn.PersentProc: TtkTokenKind;
-begin
-  if fRange = rsAsm then begin
-    inc(Run);
-    Result := tkAsmComment;
-    while (run <= Length(fLineStr)) do
-      case fLineStr[Run] of
-        #10, #13: begin
-            inc(Run);
-            break;
-          end;
-      else
-        inc(Run);
-      end;
-  end
-  else
-    Result := IdentProc;
-end;
-
-function TSynHP48Syn.StarProc: TtkTokenKind;
-begin
-  if fRange = rsRpl then begin
-    inc(Run);
-    Result := tkRplComment;
-    while (run <= Length(fLineStr)) do
-      case fLineStr[Run] of
-        #10, #13: begin
-            inc(Run);
-            break;
-          end;
-      else
-        inc(Run);
-      end;
-  end
-  else
-    Result := IdentProc;
-end;
-
-function TSynHP48Syn.IdentProc: TtkTokenKind;
-var
-  i: integer;
-  s: string;
-begin
-  i := Run;
-  EndOfToken;
-  s := Copy(fLineStr, i, run - i);
-  if fRange = rsAsm then
-    if FAsmKeyWords.Find(s) <> nil then
-      if (s = '!RPL') or (s = 'ENDCODE') then begin
-        fRange := rsRpl;
-        result := tkAsmKey;
-      end
-      else
-        result := tkAsmKey
-    else if fLineStr[i] <> '*' then
-      result := tkAsm
-    else
-      result := tkAsmKey
-  else if FRplKeyWords.Find(s) <> nil then
-    if (s = 'CODEM') or (s = 'ASSEMBLEM') then begin
-      fRange := rsAsm;
-      result := tkAsmKey;
-    end
-    else if (s = 'CODE') or (s = 'ASSEMBLE') then begin
-      fRange := rssAsm1;
-      result := tksAsmKey;
-    end
-    else
-      result := tkRplKey
-  else
-    result := tkRpl;
-end;
-
-function TSynHP48Syn.GetTokenFromRange: TtkTokenKind;
-begin
-  case frange of
-    rsAsm: result := tkAsm;
-    rssAsm1: result := tksAsmKey;
-    rssAsm2: result := tksAsm;
-    rssAsm3: result := tksAsmComment;
-    rsRpl: result := tkRpl;
-    rsComRpl: result := tkRplComment;
-    rsComAsm1, rsComAsm2: result := tkAsmComment;
-  else
-    result := tkNull;
-  end;
-end;
-
-function TSynHP48Syn.NullProc: TtkTokenKind;
-begin
-  Result := tkNull;
-  inc(Run);
-end;
-
-function TSynHP48Syn.SpaceProc: TtkTokenKind;
-begin
-  inc(Run);
-  while (Run <= Length(fLineStr)) and CharInSet(fLineStr[Run], [#1..#32]) do
-    inc(Run);
-  result := GetTokenFromRange;
-end;
-
-function TSynHP48Syn.Next1: TtkTokenKind;
-begin
-  fTokenPos := Run - 1;
-  if Run > Length(fLineStr) then
-    result := NullProc
-  else if fRange = rsComRpl then
-    result := RplComProc
-  else if fRange = rsComAsm1 then
-    result := AsmComProc(')')
-  else if fRange = rsComAsm2 then
-    result := AsmComProc('/')
-  else if frange = rssasm1 then
-    result := SasmProc1
-  else if frange = rssasm2 then
-    result := sasmproc2
-  else if frange = rssasm3 then
-    result := sasmproc3
-  else if CharInSet(fLineStr[Run], [#1..#32]) then
-    result := SpaceProc
-  else if fLineStr[Run] = '(' then
-    result := ParOpenProc
-  else if fLineStr[Run] = '%' then
-    result := PersentProc
-  else if fLineStr[Run] = '/' then
-    result := SlashProc
-  else if (run = 1) and (fRange = rsRpl) and (fLineStr[1] = '*') then
-    result := StarProc
-  else
-    result := IdentProc;
-end;
-
-procedure TSynHP48Syn.Next2(tkk: TtkTokenKind);
-begin
-  fTockenKind := tkk;
-end;
-
-procedure TSynHP48Syn.Next;
-begin
-  Next2(Next1);
-  inherited;
-end;
-
-function TSynHP48Syn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 2;
-end;
-
-function TSynHP48Syn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-procedure TSynHP48Syn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynHP48Syn.ResetRange;
-begin
-  fRange := BaseRange;
-end;
-
-function TSynHP48Syn.GetAttrib(Index: integer): TSynHighlighterAttributes;
-begin
-  Result := Attribs[TtkTokenKind(Index)];
-end;
-
-procedure TSynHP48Syn.SetAttrib(Index: integer; Value: TSynHighlighterAttributes);
-begin
-  Attribs[TtkTokenKind(Index)].Assign(Value);
-end;
-
-procedure TSynHP48Syn.EndOfToken;
-begin
-  while (Run <= Length(fLineStr)) and (fLineStr[Run] > ' ') do
-    Inc(Run);
-end;
-
-function TSynHP48Syn.LoadFromRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r := TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKeyReadOnly(Key) then begin
-      if r.ValueExists('AsmKeyWordList')
-        then AsmKeywords.Text := r.ReadString('AsmKeyWordList');
-      if r.ValueExists('RplKeyWordList')
-        then RplKeywords.Text := r.ReadString('RplKeyWordList');
-      Result := inherited LoadFromRegistry(RootKey, Key);
-    end
-    else
-      Result := false;
-  finally r.Free;
-  end;
-end;
-
-function TSynHP48Syn.SaveToRegistry(RootKey: HKEY; Key: string): boolean;
-var
-  r: TBetterRegistry;
-begin
-  r := TBetterRegistry.Create;
-  try
-    r.RootKey := RootKey;
-    if r.OpenKey(Key, true) then
-    begin
-      r.WriteString('AsmKeyWordList', AsmKeywords.Text);
-      r.WriteString('RplKeyWordList', RplKeywords.Text);
-      Result := inherited SaveToRegistry(RootKey, Key);
-    end
-    else
-      Result := false;
-  finally r.Free;
-  end;
-end;
-
-procedure TSynHP48Syn.Assign(Source: TPersistent);
-var
-  i: TtkTokenKind;
-begin
-  if Source is TSynHP48Syn then begin
-    for i := Low(Attribs) to High(Attribs) do begin
-      Attribs[i].Background := TSynHP48Syn(source).Attribs[i].Background;
-      Attribs[i].Foreground := TSynHP48Syn(source).Attribs[i].Foreground;
-      Attribs[i].Style := TSynHP48Syn(source).Attribs[i].Style;
-    end;
-    AsmKeyWords.Text := TSynHP48Syn(source).AsmKeyWords.Text;
-    RplKeyWords.Text := TSynHP48Syn(source).RplKeyWords.Text;
-  end
-  else
-    inherited Assign(Source);
-end;
-
-function TSynHP48Syn.GetAttribCount: integer;
-begin
-  Result := Ord(High(Attribs)) - Ord(Low(Attribs)) + 1;
-end;
-
-function TSynHP48Syn.GetAttribute(idx: integer): TSynHighlighterAttributes;
-begin // sorted by name
-  if (idx <= Ord(High(TtkTokenKind))) then
-    Result := Attribs[TtkTokenKind(idx)]
-  else
-    Result := nil;
-end;
-
-function TSynHP48Syn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterHP48;
-end;
-
-class function TSynHP48Syn.GetLanguageName: string;
-begin
-  Result := SYNS_LangHP48;
-end;
-
-procedure TSynHP48Syn.SetHighLightChange;
-var
-  i: TtkTokenKind;
-begin
-  for i := Low(Attribs) to High(Attribs) do begin
-    Attribs[i].OnChange := DefHighLightChange;
-    Attribs[i].InternalSaveDefaultValues;
-  end;
-end;
-
-function TSynHP48Syn.SasmProc1: TtkTokenKind;
-var
-  i: integer;
-  s: string;
-begin
-  Result := tksAsmKey;
-  if run > Length(fLineStr) then
-    exit;
-  if fLineStr[Run] = '*' then begin
-    frange := rssasm3;
-    result := tksAsmComment;
-    exit;
-  end;
-  if fLineStr[Run] >= ' ' then begin
-    i := run;
-    while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
-      inc(run);
-    s := Copy(fLineStr, i, run - i);
-    if (s = 'RPL') or (s = 'ENDCODE') then begin
-      frange := rsRpl;
-      exit;
-    end;
-  end;
-  while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
-    inc(run);
-  if run <= Length(fLineStr) then
-    frange := rssasm2
-  else
-    frange := rssasm1;
-end;
-
-function TSynHP48Syn.SasmProc2: TtkTokenKind;
-var
-  i: integer;
-  s: string;
-begin
-  Result := tksAsm;
-  while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
-    inc(run);
-  if run > 30 then begin
-    frange := rssasm3;
-    exit;
-  end;
-  i := run;
-  while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
-    inc(run);
-  s := Copy(fLineStr, i, run - i);
-  if (s = 'ENDCODE') or (s = 'RPL') then begin
-    frange := rsRpl;
-    result := tksAsmKey;
-  end
-  else begin
-    if FSAsmNoField.Find(s) = nil then begin
-      while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
-        inc(run);
-      while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
-        inc(run);
-      while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
-        inc(run);
-    end;
-    if run <= Length(fLineStr) then
-      frange := rssasm3
-    else
-      frange := rssasm1;
-  end;
-end;
-
-function TSynHP48Syn.SasmProc3: TtkTokenKind;
-begin
-  Result := tksAsmComment;
-  while (run <= Length(fLineStr)) and (fLineStr[run] <> #10) do
-    inc(run);
-  if run <= Length(fLineStr) then inc(run);
-  frange := rssasm1;
-end;
-
-function TSynHP48Syn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  Result := GetAttrib(Ord(fTockenKind));
-end;
-
-function TSynHP48Syn.GetTokenKind: integer;
-begin
-  Result := Ord(fTockenKind);
-end;
-
-function TSynHP48Syn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-begin
-  Result := nil;
-end;
-
-// reimplement functions to handle the non-standard use of 1-based Run
-// (instead of the standard 0-based Run)
-
-procedure TSynHP48Syn.DoSetLine(const Value: string;
-  LineNumber: Integer);
-begin
-  inherited;
-  Run := 1;
-  fOldRun := Run;
-end;
-
-function TSynHP48Syn.GetToken: string;
-var
-  Len: Integer;
-begin
-  Len := (Run - 1) - fTokenPos;
-  SetLength(Result, Len);
-  if Len > 0 then
-    StrLCopy(@Result[1], fCasedLine + fTokenPos, Len);
-end;
-
-function TSynHP48Syn.IsLineEnd(Run: Integer): Boolean;
-begin
-  Result := (Run - 1 >= fLineLen) or (fLine[Run - 1] = #10) or (fLine[Run - 1] = #13);
-end;
-
-class function TSynHP48Syn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangHP48;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynHP48Syn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterHP48.pas, released 2000-06-23.
+The Original Code is based on the cbHPSyn.pas file from the
+mwEdit component suite by Martin Waldenburg and other developers, the Initial
+Author of this file is Cyrille de Brebisson.
+Unicode translation by Maël Hörz.
+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: SynHighlighterHP48.pas,v 1.10.2.9 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides SynEdit with a HP48 assembler syntax highlighter.)
+@author(Cyrille de Brebisson , converted to SynEdit by David Muir )
+@created(1998-12, converted to SynEdit 2000-06-23)
+@lastmod(2012-09-12)
+The unit SynHighlighterHP48 provides SynEdit with a HP48 assembler highlighter.
+}
+
+unit SynHighlighterHP48;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Windows,
+  Graphics,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+const
+  NbSubList = 128;
+
+type
+  TSpeedStringList = class;
+
+  TSpeedListObject = class
+  protected
+    FName: UnicodeString;
+    FSpeedList: TSpeedStringList;
+    FObject: TObject;
+    procedure SetName(const Value: UnicodeString); virtual;
+  public
+    property Name: UnicodeString read FName write SetName;
+    constructor Create(name: UnicodeString);
+    destructor Destroy; override;
+    property SpeedList: TSpeedStringList read FSpeedList write FSpeedList;
+    property Pointer: TObject read FObject write FObject;
+  end;
+
+  PSpeedListObjects = ^TSpeedListObjects;
+  TSpeedListObjects = array[0..0] of TSpeedListObject;
+
+  TSpeedStringList = class
+  private
+    function GetText: UnicodeString;
+    procedure SetText(const Value: UnicodeString);
+    function GetInObject(Index: Integer): TObject;
+    procedure SetInObject(Index: Integer; const Value: TObject);
+  protected
+    FOnChange: TNotifyEvent;
+    FSumOfUsed: array[0..NbSubList - 1] of Integer;
+    FDatasUsed: array[0..NbSubList - 1] of Integer;
+    FDatas: array[0..NbSubList - 1] of PSpeedListObjects;
+    FLengthDatas: array[0..NbSubList - 1] of Integer;
+    procedure Changed; virtual;
+    function Get(Index: Integer): UnicodeString; virtual;
+    function GetObject(Index: Integer): TSpeedListObject;
+    function GetCount: Integer;
+    function GetStringList: TUnicodeStrings;
+    procedure SetStringList(const Value: TUnicodeStrings);
+  public
+    procedure NameChange(const obj: TSpeedListObject; const NewName: UnicodeString);
+    procedure ObjectDeleted(const obj: TSpeedListObject);
+
+    destructor Destroy; override;
+    constructor Create;
+    function AddObj(const Value: TSpeedListObject): Integer;
+    function Add(const Value: UnicodeString): TSpeedListObject;
+    procedure Clear;
+    function Find(const Name: UnicodeString): TSpeedListObject;
+    property OnChange: TNotifyEvent read FOnChange write FOnChange;
+    property Objects[Index: Integer]: TSpeedListObject read GetObject;
+    property InObject[Index: Integer]: TObject read GetInObject write SetInObject;
+    property Strings[Index: Integer]: UnicodeString read Get; default;
+    property Count: Integer read GetCount;
+    property StringList: TUnicodeStrings read GetStringList write SetStringList;
+    property Text: UnicodeString read GetText write SetText;
+  end;
+
+  TtkTokenKind = (tkNull, tkAsmKey, tkAsm, tkAsmComment, tksAsmKey, tksAsm,
+    tksAsmComment, tkRplKey, tkRpl, tkRplComment);
+
+  TRangeState = (rsRpl, rsComRpl, rssasm1, rssasm2, rssasm3, rsAsm, rsComAsm2,
+    rsComAsm1);
+
+  TSynHP48Syn = class(TSynCustomHighLighter)
+  private
+    FTockenKind: TtkTokenKind;
+    FRange: TRangeState;
+    FAttribs: array[TtkTokenKind] of TSynHighlighterAttributes;
+    FRplKeyWords: TSpeedStringList;
+    FAsmKeyWords: TSpeedStringList;
+    FSAsmNoField: TSpeedStringList;
+    FBaseRange: TRangeState;
+    function GetAttrib(Index: Integer): TSynHighlighterAttributes;
+    procedure SetAttrib(Index: Integer; Value: TSynHighlighterAttributes);
+
+    function NullProc: TtkTokenKind;
+    function SpaceProc: TtkTokenKind;
+    function ParOpenProc: TtkTokenKind;
+    function RplComProc: TtkTokenKind;
+    function AsmComProc(c: WideChar): TtkTokenKind;
+    function PersentProc: TtkTokenKind;
+    function IdentProc: TtkTokenKind;
+    function SlashProc: TtkTokenKind;
+    function SasmProc1: TtkTokenKind;
+    function SasmProc2: TtkTokenKind;
+    function SasmProc3: TtkTokenKind;
+    procedure EndOfToken;
+    procedure SetHighLightChange;
+    function Next1: TtkTokenKind;
+    procedure Next2(tkk: TtkTokenKind);
+    function GetTokenFromRange: TtkTokenKind;
+    function StarProc: TtkTokenKind;
+  protected
+    function GetAttribCount: Integer; override;
+    function GetAttribute(idx: Integer): TSynHighlighterAttributes; override;
+    function IsFilterStored: Boolean; override;
+    function IsLineEnd(Run: Integer): Boolean; override;
+  public
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); override;
+    procedure Next; override;
+
+    function GetToken: UnicodeString; override;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+
+    function GetRange: Pointer; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+
+    function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
+    function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
+
+    procedure Assign(Source: TPersistent); override;
+    property AsmKeyWords: TSpeedStringList read FAsmKeyWords;
+    property SAsmFoField: TSpeedStringList read FSAsmNoField;
+    property RplKeyWords: TSpeedStringList read FRplKeyWords;
+  published
+    property AsmKey: TSynHighlighterAttributes index Ord(tkAsmKey)
+      read GetAttrib write SetAttrib;
+    property AsmTxt: TSynHighlighterAttributes index Ord(tkAsm)
+      read GetAttrib write SetAttrib;
+    property AsmComment: TSynHighlighterAttributes index Ord(tkAsmComment)
+      read GetAttrib write SetAttrib;
+    property sAsmKey: TSynHighlighterAttributes index Ord(tksAsmKey)
+      read GetAttrib write SetAttrib;
+    property sAsmTxt: TSynHighlighterAttributes index Ord(tksAsm)
+      read GetAttrib write SetAttrib;
+    property sAsmComment: TSynHighlighterAttributes index Ord(tksAsmComment)
+      read GetAttrib write SetAttrib;
+    property RplKey: TSynHighlighterAttributes index Ord(tkRplKey)
+      read GetAttrib write SetAttrib;
+    property RplTxt: TSynHighlighterAttributes index Ord(tkRpl)
+      read GetAttrib write SetAttrib;
+    property RplComment: TSynHighlighterAttributes index Ord(tkRplComment)
+      read GetAttrib write SetAttrib;
+    property BaseRange: TRangeState read FBaseRange write FBaseRange;
+  end;
+
+implementation
+
+uses
+{$IFDEF UNICODE}
+  WideStrUtils,
+{$ENDIF}
+  SynEditStrConst;
+
+const
+  DefaultAsmKeyWords: UnicodeString = '!RPL'#13#10'ENDCODE'#13#10'{'#13#10'}'#13#10 +
+  'GOTO'#13#10'GOSUB'#13#10'GOSBVL'#13#10'GOVLNG'#13#10'GOLONG'#13#10'SKIP' +
+    #13#10'SKIPYES' + #13#10'->'#13#10'SKUB'#13#10'SKUBL'#13#10'SKC'#13#10'SKNC'#13#10'SKELSE' +
+    #13#10'SKEC'#13#10'SKENC'#13#10'SKLSE'#13#10 + 'GOTOL'#13#10'GOSUBL'#13#10 +
+    'RTN'#13#10'RTNC'#13#10'RTNNC'#13#10'RTNSC'#13#10'RTNCC'#13#10'RTNSXM'#13#10'RTI';
+  OtherAsmKeyWords: array[0..5] of UnicodeString = ('UP', 'EXIT', 'UPC', 'EXITC', 'UPNC', 'EXITNC');
+  DefaultRplKeyWords: UnicodeString =
+    'CODEM'#13#10'ASSEMBLEM'#13#10'CODE'#13#10'ASSEMBLE'#13#10'IT'#13#10'ITE'#13#10'case'#13#10'::'#13#10';'#13#10'?SEMI'#13#10''''#13#10'#=case'#13#10'{'#13#10'}'#13#10'NAMELESS'#13#10'LOCAL'#13#10'LOCALNAME'#13#10'LABEL'#13#10 +
+    'LOCALLABEL'#13#10'xNAME'#13#10'tNAME' + 'COLA'#13#10'NULLNAME'#13#10'xROMID'#13#10'#0=ITE'#13#10'#ITE'#13#10'2''RCOLARPITE'#13#10'ANDITE'#13#10'COLAITE'#13#10'COLARPITE'#13#10'DUP#0=ITE'#13#10 +
+    'EQITE'#13#10'ITE'#13#10'RPITE'#13#10'SysITE'#13#10'UNxSYMRPITE'#13#10'UserITE'#13#10'snnSYMRPITE'#13#10'snsSYMRPITE'#13#10'ssnSYMRPITE'#13#10'sssSYMRPITE'#13#10'$_EXIT'#13#10'DA1OK?NOTIT'#13#10'DA2aOK?NOTIT'#13#10 +
+    'DA2bOK?NOTIT'#13#10'DA3OK?NOTIT'#13#10'DO#EXIT'#13#10'DO$EXIT'#13#10'DO%EXIT'#13#10'DOHXSEXIT'#13#10'DUP#0=IT'#13#10'EQIT'#13#10'GCDHEULPEXIT'#13#10'GSPLIT'#13#10'NOT_IT'#13#10'POINTEXIT'#13#10'POLYARIT'#13#10'RPIT'#13#10 +
+    'parleftIT'#13#10'parrightIT'#13#10''''#13#10'IT'#13#10'ITE'#13#10'SEMI'#13#10'UNTIL'#13#10'LOOP'#13#10'?SEMI'#13#10'NOT?SEMI'#13#10'#0=case'#13#10'#1=case'#13#10'#<>case'#13#10'#2case'#13#10'#>33case'#13#10'#>case'#13#10'%-1=case'#13#10'%0=case'#13#10'%1=case'#13#10'%2=case'#13#10'AEQ1stcase'#13#10'AEQopscase'#13#10'ANDNOTcase'#13#10'ANDcase'#13#10'C%-1=case'#13#10 +
+    'C%0=case'#13#10'C%1=case'#13#10'C%2=case'#13#10'COLANOTcase'#13#10'COLAcase'#13#10'DUP#0=case'#13#10'EQUALNOTcase'#13#10'EQUALcase'#13#10'EQUALcasedrop'#13#10'EQUALcasedrp'#13#10'EQcase'#13#10'EQcaseDROP'#13#10 +
+    'EQcasedrop'#13#10'EnvNGcase'#13#10'M-1stcasechs'#13#10'MEQ*case'#13#10'MEQ+case'#13#10'MEQ-case'#13#10'MEQ/case'#13#10'MEQ1stcase'#13#10'MEQCHScase'#13#10'MEQFCNcase'#13#10'MEQINVcase'#13#10'MEQSQcase'#13#10'MEQ^case'#13#10 +
+    'MEQopscase'#13#10'Mid1stcase'#13#10'NOTBAKcase'#13#10'NOTLIBcase'#13#10'NOTLISTcase'#13#10'NOTMATRIXcase'#13#10'NOTROMPcase'#13#10'NOTSECOcase'#13#10'NOTTYPEcase'#13#10'NOTcase'#13#10'NOTcase2DROP'#13#10'NOTcase2drop'#13#10 +
+    'NOTcaseDROP'#13#10'NOTcaseFALSE'#13#10'NOTcaseTRUE'#13#10'NOTcasedrop'#13#10'NULLargcase'#13#10'NcaseSIZEERR'#13#10'NcaseTYPEERR'#13#10'NoEdit?case'#13#10'ORcase'#13#10'OVER#=case'#13#10'REALcase'#13#10'REQcase'#13#10 +
+    'REQcasedrop'#13#10'Z-1=case'#13#10'Z0=case'#13#10'Z1=case'#13#10'accNBAKcase'#13#10'accNLIBcase'#13#10'case'#13#10'case2DROP'#13#10'case2drop'#13#10'case2drpfls'#13#10'caseDEADKEY'#13#10'caseDROP'#13#10'caseDoBadKey'#13#10 +
+    'caseDrpBadKy'#13#10'caseERRJMP'#13#10'caseFALSE'#13#10'caseSIZEERR'#13#10'caseTRUE'#13#10'casedrop'#13#10'casedrpfls'#13#10'casedrptru'#13#10'caseout'#13#10'cxcasecheck'#13#10'dARRYcase'#13#10'dIDNTNcase'#13#10'dLISTcase'#13#10 +
+    'dMATRIXcase'#13#10'dREALNcase'#13#10'dREALcase'#13#10'dZINTNcase'#13#10'delimcase'#13#10'estcase'#13#10'idntcase'#13#10'idntlamcase'#13#10'j#-1=case'#13#10'j#0=case'#13#10'j#1=case'#13#10'j%-1=case'#13#10'j%0=case'#13#10 +
+    'j%1=case'#13#10'jEQcase'#13#10'jZ-1=case'#13#10'jZ0=case'#13#10'jZ1=case'#13#10'namelscase'#13#10'need''case'#13#10'negrealcase'#13#10'ngsizecase'#13#10'nonopcase'#13#10'nonrmcase'#13#10'num#-1=case'#13#10'num#0=case'#13#10 +
+    'num#1=case'#13#10'num-1=case'#13#10'num0=case'#13#10'num0case'#13#10'num1=case'#13#10'num2=case'#13#10'numb1stcase'#13#10'rebuildcase'#13#10'tok=casedrop'#13#10'wildcase'#13#10'zerdercase'#13#10;
+  SasmNoField: UnicodeString = 'LOOP'#13#10'RTNSXM'#13#10'RTN'#13#10'RTNSC'#13#10'RTNCC'#13#10'SETDEC'#13#10'SETHEX'#13#10'RSTK=C'#13#10'C=RSTK'#13#10'CLRST'#13#10'C=ST'#13#10'ST=C'#13#10'CSTEX'#13#10 +
+  'RTI'#13#10'R0=A'#13#10'R1=A'#13#10'R2=A'#13#10'R3=A'#13#10'R4=A'#13#10'R0=C'#13#10'R1=C'#13#10'R2=C'#13#10'R3=C'#13#10'R4=C'#13#10'A=R0'#13#10'A=R1'#13#10'A=R2'#13#10'A=R3'#13#10'A=R4'#13#10 +
+    'C=R0'#13#10'C=R1'#13#10'C=R2'#13#10'C=R3'#13#10'C=R4'#13#10'AR0EX'#13#10'AR1EX'#13#10'AR2EX'#13#10'AR3EX'#13#10'AR4EX'#13#10'CR0EX'#13#10'CR1EX'#13#10'CR2EX'#13#10'CR3EX'#13#10'CR4EX'#13#10 +
+    'D0=A'#13#10'D0=C'#13#10'D1=A'#13#10'D1=C'#13#10'AD0EX'#13#10'AD1EX'#13#10'CD0EX'#13#10'CD1EX'#13#10'D0=AS'#13#10'D1=AS'#13#10'D0=CS'#13#10'D1=CD'#13#10'CD1XS'#13#10'CD0XS'#13#10'AD1XS'#13#10'AD0XS'#13#10 +
+    'RTNC'#13#10'RTNNC'#13#10'OUT=CS'#13#10'OUT=C'#13#10'A=IN'#13#10'C=IN'#13#10'SHUTDN'#13#10'INTON'#13#10'C=ID'#13#10'CONFIG'#13#10'UNCNFG'#13#10'RSI'#13#10'PC=(A)'#13#10'PC=(C)'#13#10'INTOFF'#13#10 +
+    'C+P+1'#13#10'RESET'#13#10'SREQ?'#13#10'ASLC'#13#10'BSLC'#13#10'CSLC'#13#10'DSLC'#13#10'ASRC'#13#10'BSRC'#13#10'CSRC'#13#10'DSRC'#13#10'ASRB'#13#10'BSRB'#13#10'CSRB'#13#10'DSRB'#13#10'PC=A'#13#10'PC=C'#13#10 +
+    'A=PC'#13#10'C=PC'#13#10'APCEX'#13#10'CPCEX'#13#10'XM=0'#13#10'SB=0'#13#10'SR=0'#13#10'MP=0'#13#10'CLRHST'#13#10'?XM=0'#13#10'?SR=0'#13#10'?MP=0'#13#10'?SB=0'#13#10'RTNYES'#13#10'SKIPYES{'#13#10'{'#13#10'}'#13#10'UP'#13#10'EXIT'#13#10'EXITNC'#13#10'EXITC'#13#10'UPC'#13#10'UPNC' +
+    '}SKELSE{'#13#10'SKC{'#13#10'SKNC{'#13#10'SKUB{'#13#10'SKUBL{'#13#10'SKIPC{'#13#10'SKIPNC{'#13#10'EXIT2'#13#10'EXIT3'#13#10'UP2'#13#10'UP3'#13#10'}SKLSE{'#13#10'}SKEC{'#13#10'}SKENC{'#13#10;
+
+function StringCrc(S: UnicodeString): Integer;
+var
+  i: Integer;
+begin
+  Result := 0;
+  for i := 1 to length(s) do begin
+    Result := (Result shr 4) xor (((Result xor ord(s[i])) and $F) * $1081);
+    Result := (Result shr 4) xor (((Result xor (ord(s[i]) shr 4)) and $F) * $1081);
+  end;
+end;
+
+{ TSpeedListObject }
+
+constructor TSpeedListObject.create(name: UnicodeString);
+begin
+  inherited create;
+  FName := name;
+end;
+
+destructor TSpeedListObject.destroy;
+begin
+  if Assigned(FSpeedList) then
+    FSpeedList.ObjectDeleted(Self);
+  inherited destroy;
+end;
+
+procedure TSpeedListObject.SetName(const Value: UnicodeString);
+begin
+  FName := Value;
+  if FSpeedList <> nil then
+    FSpeedList.NameChange(Self, Value);
+end;
+
+{ TSpeedStringList }
+
+function TSpeedStringList.AddObj(const Value: TSpeedListObject): Integer;
+var
+  crc: Integer;
+  i: Integer;
+begin
+  crc := StringCrc(Value.Name) mod High(FDatas) + 1;
+  if FDatasUsed[crc] = FLengthDatas[crc] then
+  begin
+    ReallocMem(FDatas[crc], (FLengthDatas[crc] * 2 + 1) * SizeOf(FDatas[1][0]));
+    FLengthDatas[crc] := FLengthDatas[crc] * 2 + 1;
+  end;
+  FDatas[crc][FDatasUsed[crc]] := Value;
+  Result := FSumOfUsed[crc] + FDatasUsed[crc];
+  Inc(FDatasUsed[crc]);
+  for i := crc + 1 to High(FSumOfUsed) do
+    Inc(FSumOfUsed[i]);
+  Value.SpeedList := Self;
+end;
+
+function TSpeedStringList.Add(const Value: UnicodeString): TSpeedListObject;
+begin
+  Result := TSpeedListObject.Create(value);
+  AddObj(Result);
+end;
+
+procedure TSpeedStringList.Changed;
+begin
+  if Assigned(FOnChange) then
+    FOnChange(Self);
+end;
+
+procedure TSpeedStringList.Clear;
+var
+  i, j: Integer;
+begin
+  for i := Low(FDatas) to High(FDatas) do
+  begin
+    for j := 0 to FDatasUsed[i] - 1 do
+      FDatas[i][j].Free;
+    FDatasUsed[i] := 0;
+    ReallocMem(FDatas[i], 0);
+    FLengthDatas[i] := 0;
+    FSumOfUsed[i] := 0;
+  end;
+  Changed;
+end;
+
+constructor TSpeedStringList.create;
+var
+  i: Integer;
+begin
+  inherited Create;
+  for i := Low(FDatas) to high(FDatas) do
+  begin
+    FSumOfUsed[i] := 0;
+    FDatasUsed[i] := 0;
+    FLengthDatas[i] := 0;
+    FDatas[i] := nil;
+  end;
+end;
+
+destructor TSpeedStringList.Destroy;
+begin
+  Clear;
+  inherited destroy;
+end;
+
+function TSpeedStringList.Find(const name: UnicodeString): TSpeedListObject;
+var
+  crc: Integer;
+  i: Integer;
+begin
+  crc := StringCrc(name) mod High(FDatas) + 1;
+  for i := 0 to FDatasUsed[crc] - 1 do
+    if FDatas[crc][i].name = name then begin
+      Result := FDatas[crc][i];
+      Exit;
+    end;
+  Result := nil;
+end;
+
+function TSpeedStringList.Get(Index: Integer): UnicodeString;
+var
+  i: Integer;
+begin
+  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
+    if Index > FSumOfUsed[i] then begin
+      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]].name;
+      Exit;
+    end;
+  Result := '';
+end;
+
+function TSpeedStringList.GetCount: Integer;
+begin
+  Result := FSumOfUsed[High(FDatas)] + FDatasUsed[High(FDatas)];
+end;
+
+function TSpeedStringList.GetInObject(Index: Integer): TObject;
+var
+  i: Integer;
+begin
+  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
+    if Index > FSumOfUsed[i] then begin
+      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]].Pointer;
+      Exit;
+    end;
+  Result := nil;
+end;
+
+function TSpeedStringList.GetObject(Index: Integer): TSpeedListObject;
+var
+  i: Integer;
+begin
+  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
+    if Index > FSumOfUsed[i] then begin
+      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]];
+      Exit;
+    end;
+  Result := nil;
+end;
+
+function TSpeedStringList.GetStringList: TUnicodeStrings;
+var
+  i, j: Integer;
+begin
+  Result := TUnicodeStringList.Create;
+  for i := Low(FDatas) to High(FDatas) do
+    for j := 0 to FDatasUsed[i] - 1 do
+      Result.add(FDatas[i][j].name);
+end;
+
+function TSpeedStringList.GetText: UnicodeString;
+begin
+  with StringList do begin
+    Result := Text;
+    Free;
+  end;
+end;
+
+procedure TSpeedStringList.NameChange(const Obj: TSpeedListObject; const NewName: UnicodeString);
+var
+  crc: Integer;
+  i: Integer;
+  j: Integer;
+begin
+  crc := StringCrc(obj.Name) mod High(FDatas) + 1;
+  for i := 0 to FDatasUsed[crc] - 1 do
+    if FDatas[crc][i] = Obj then begin
+      for j := i + 1 to FDatasUsed[crc] - 1 do
+        FDatas[i - 1] := FDatas[i];
+      for j := crc + 1 to High(FDatas) do
+        Dec(FSumOfUsed[j]);
+      if FDatasUsed[crc] < FLengthDatas[crc] div 2 then begin
+        ReallocMem(FDatas[crc], FDatasUsed[crc] * SizeOf(FDatas[crc][0]));
+        FLengthDatas[crc] := FDatasUsed[crc];
+      end;
+      AddObj(Obj);
+      Exit;
+    end;
+end;
+
+procedure TSpeedStringList.ObjectDeleted(const obj: TSpeedListObject);
+var
+  crc: Integer;
+  i: Integer;
+  j: Integer;
+begin
+  crc := StringCrc(obj.Name) mod High(FDatas) + 1;
+  for i := 0 to FDatasUsed[crc] - 1 do
+    if FDatas[crc][i] = Obj then begin
+      for j := i + 1 to FDatasUsed[crc] - 1 do
+        if i > 0 then
+          FDatas[i - 1] := FDatas[i];
+      for j := crc + 1 to High(FDatas) do
+        Dec(FSumOfUsed[j]);
+      Obj.FSpeedList := nil;
+      Exit;
+    end;
+end;
+
+procedure TSpeedStringList.SetInObject(Index: Integer;
+  const Value: TObject);
+var
+  i: Integer;
+begin
+  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
+    if Index > FSumOfUsed[i] then begin
+      FDatas[i - 1][Index - FSumOfUsed[i - 1]].Pointer := value;
+      Exit;
+    end;
+end;
+
+procedure TSpeedStringList.SetStringList(const value: TUnicodeStrings);
+var
+  i: Integer;
+begin
+  clear;
+  for i := 0 to Value.Count - 1 do
+    AddObj(TSpeedListObject.Create(value[i]));
+end;
+
+procedure TSpeedStringList.SetText(const Value: UnicodeString);
+var
+  s: TUnicodeStrings;
+begin
+  s := TUnicodeStringList.Create;
+  try
+    s.Text := Value;
+    StringList := s;
+  finally
+    s.Free;
+  end;
+end;
+
+{ TSynHP48Syn }
+
+constructor TSynHP48Syn.Create(AOwner: TComponent);
+var
+  j, k: Integer;
+begin
+  FAttribs[tkNull] := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
+  FAttribs[tkAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrAsmKey, SYNS_FriendlyAttrAsmKey);
+  FAttribs[tkAsm] := TSynHighlighterAttributes.Create(SYNS_AttrAsm, SYNS_FriendlyAttrAsm);
+  FAttribs[tkAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrAsmComment, SYNS_FriendlyAttrAsmComment);
+  FAttribs[tksAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrSASMKey, SYNS_FriendlyAttrSASMKey);
+  FAttribs[tksAsm] := TSynHighlighterAttributes.Create(SYNS_AttrSASM, SYNS_FriendlyAttrSASM);
+  FAttribs[tksAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrSASMComment, SYNS_FriendlyAttrSASMComment);
+  FAttribs[tkRplKey] := TSynHighlighterAttributes.Create(SYNS_AttrRplKey, SYNS_FriendlyAttrRplKey);
+  FAttribs[tkRpl] := TSynHighlighterAttributes.Create(SYNS_AttrRpl, SYNS_FriendlyAttrRpl);
+  FAttribs[tkRplComment] := TSynHighlighterAttributes.Create(SYNS_AttrRplComment, SYNS_FriendlyAttrRplComment);
+
+  inherited Create(AOwner);
+  SetHighlightChange;
+  FAsmKeyWords := TSpeedStringList.Create;
+  FAsmKeyWords.Text := DefaultAsmKeyWords;
+  for j := Low(OtherAsmKeyWords) to High(OtherAsmKeyWords) do begin
+    FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j]));
+    for k := 1 to 8 do
+      FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j] + IntToStr(k)));
+  end;
+  FRplKeyWords := TSpeedStringList.Create;
+  FRplKeyWords.Text := DefaultRplKeyWords;
+  FSAsmNoField := TSpeedStringList.Create;
+  FSAsmNoField.Text := SAsmNoField;
+  BaseRange := rsRpl;
+  FRange := rsRpl;
+  FDefaultFilter := SYNS_FilterHP48;
+end; { Create }
+
+destructor TSynHP48Syn.Destroy;
+var
+  i: TtkTokenKind;
+begin
+  for i := Low(TtkTokenKind) to High(TtkTokenKind) do
+    FAttribs[i].Free;
+  FAsmKeyWords.Free;
+  FRplKeyWords.Free;
+  FSAsmNoField.Free;
+  inherited Destroy;
+end; { Destroy }
+
+function TSynHP48Syn.AsmComProc(c: WideChar): TtkTokenKind;
+begin
+  Result := tkAsmComment;
+  if (Run > Length(FLineStr)) then
+    Result := NullProc
+  else
+    while Run <= Length(FLineStr) do
+      if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
+        (FLineStr[Run] = '*') and
+        ((Run < Length(FLineStr)) and (FLineStr[Run + 1] = c)) and
+        ((Run + 1 = Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
+        Inc(Run, 2);
+        FRange := rsAsm;
+        Break;
+      end
+      else
+        Inc(Run);
+end;
+
+function TSynHP48Syn.RplComProc: TtkTokenKind;
+begin
+  Result := tkRplComment;
+  if (Run > Length(FLineStr)) then
+    Result := NullProc
+  else
+    while Run <= Length(FLineStr) do
+      if FLineStr[Run] = ')' then begin
+        Inc(Run);
+        FRange := rsRpl;
+        Break;
+      end
+      else
+        Inc(Run);
+end;
+
+function TSynHP48Syn.SlashProc: TtkTokenKind;
+begin
+  if FRange = rsRpl then
+    Result := IdentProc
+  else if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
+    (FLineStr[Run] = '/') and
+    (Run < Length(FLineStr)) and
+    (FLineStr[Run + 1] = '*') and
+    ((Run + 1 = Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
+    Inc(Run, 2);
+    Result := tkAsmComment;
+    FRange := rsComAsm2;
+  end
+  else if (Run < Length(FLineStr)) and (FLineStr[Run + 1] = '/') then begin
+    Inc(Run, 2);
+    Result := tkAsmComment;
+    while (Run <= Length(FLineStr)) do
+      if CharInSet(FLineStr[Run], [#10, #13]) then
+      begin
+        Inc(Run);
+        Break;
+      end
+      else
+        Inc(Run);
+  end
+  else
+    Result := IdentProc
+end;
+
+function TSynHP48Syn.ParOpenProc: TtkTokenKind;
+begin
+  if FRange = rsRpl then
+    if ((Run = 1) and ((Length(FLineStr) = 1) or (FLineStr[Run + 1] <= ' '))) or
+      ((FLineStr[Run - 1] <= ' ') and ((Length(FLineStr) = Run) or (FLineStr[Run + 1] <= ' '))) then begin
+      Inc(Run);
+      Result := tkRplComment;
+      FRange := rsComRpl;
+    end
+    else
+      Result := IdentProc
+  else if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
+    (FLineStr[Run] = '(') and
+    (Run < Length(FLineStr)) and
+    (FLineStr[Run + 1] = '*') and
+    ((Run + 2 > Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
+    Inc(Run, 2);
+    Result := tkAsmComment;
+    FRange := rsComAsm1;
+  end
+  else
+    Result := IdentProc
+end;
+
+function TSynHP48Syn.PersentProc: TtkTokenKind;
+begin
+  if FRange = rsAsm then begin
+    Inc(Run);
+    Result := tkAsmComment;
+    while (Run <= Length(FLineStr)) do
+      case FLineStr[Run] of
+        #10, #13: begin
+            Inc(Run);
+            Break;
+          end;
+      else
+        Inc(Run);
+      end;
+  end
+  else
+    Result := IdentProc;
+end;
+
+function TSynHP48Syn.StarProc: TtkTokenKind;
+begin
+  if FRange = rsRpl then begin
+    Inc(Run);
+    Result := tkRplComment;
+    while (Run <= Length(FLineStr)) do
+      case FLineStr[Run] of
+        #10, #13: begin
+            Inc(Run);
+            Break;
+          end;
+      else
+        Inc(Run);
+      end;
+  end
+  else
+    Result := IdentProc;
+end;
+
+function TSynHP48Syn.IdentProc: TtkTokenKind;
+var
+  i: Integer;
+  s: UnicodeString;
+begin
+  i := Run;
+  EndOfToken;
+  s := Copy(FLineStr, i, Run - i);
+  if FRange = rsAsm then
+    if FAsmKeyWords.Find(s) <> nil then
+      if (s = '!RPL') or (s = 'ENDCODE') then begin
+        FRange := rsRpl;
+        Result := tkAsmKey;
+      end
+      else
+        Result := tkAsmKey
+    else if FLineStr[i] <> '*' then
+      Result := tkAsm
+    else
+      Result := tkAsmKey
+  else if FRplKeyWords.Find(s) <> nil then
+    if (s = 'CODEM') or (s = 'ASSEMBLEM') then begin
+      FRange := rsAsm;
+      Result := tkAsmKey;
+    end
+    else if (s = 'CODE') or (s = 'ASSEMBLE') then begin
+      FRange := rssAsm1;
+      Result := tksAsmKey;
+    end
+    else
+      Result := tkRplKey
+  else
+    Result := tkRpl;
+end;
+
+function TSynHP48Syn.GetTokenFromRange: TtkTokenKind;
+begin
+  case FRange of
+    rsAsm: Result := tkAsm;
+    rssAsm1: Result := tksAsmKey;
+    rssAsm2: Result := tksAsm;
+    rssAsm3: Result := tksAsmComment;
+    rsRpl: Result := tkRpl;
+    rsComRpl: Result := tkRplComment;
+    rsComAsm1, rsComAsm2: Result := tkAsmComment;
+  else
+    Result := tkNull;
+  end;
+end;
+
+function TSynHP48Syn.NullProc: TtkTokenKind;
+begin
+  Result := tkNull;
+  Inc(Run);
+end;
+
+function TSynHP48Syn.SpaceProc: TtkTokenKind;
+begin
+  Inc(Run);
+  while (Run <= Length(FLineStr)) and CharInSet(FLineStr[Run], [#1..#32]) do
+    Inc(Run);
+  Result := GetTokenFromRange;
+end;
+
+function TSynHP48Syn.Next1: TtkTokenKind;
+begin
+  FTokenPos := Run - 1;
+  if Run > Length(FLineStr) then
+    Result := NullProc
+  else if FRange = rsComRpl then
+    Result := RplComProc
+  else if FRange = rsComAsm1 then
+    Result := AsmComProc(')')
+  else if FRange = rsComAsm2 then
+    Result := AsmComProc('/')
+  else if FRange = rssasm1 then
+    Result := SasmProc1
+  else if FRange = rssasm2 then
+    Result := sasmproc2
+  else if FRange = rssasm3 then
+    Result := sasmproc3
+  else if CharInSet(FLineStr[Run], [#1..#32]) then
+    Result := SpaceProc
+  else if FLineStr[Run] = '(' then
+    Result := ParOpenProc
+  else if FLineStr[Run] = '%' then
+    Result := PersentProc
+  else if FLineStr[Run] = '/' then
+    Result := SlashProc
+  else if (Run = 1) and (FRange = rsRpl) and (FLineStr[1] = '*') then
+    Result := StarProc
+  else
+    Result := IdentProc;
+end;
+
+procedure TSynHP48Syn.Next2(tkk: TtkTokenKind);
+begin
+  FTockenKind := tkk;
+end;
+
+procedure TSynHP48Syn.Next;
+begin
+  Next2(Next1);
+  inherited;
+end;
+
+function TSynHP48Syn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 2;
+end;
+
+function TSynHP48Syn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+procedure TSynHP48Syn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynHP48Syn.ResetRange;
+begin
+  FRange := BaseRange;
+end;
+
+function TSynHP48Syn.GetAttrib(Index: Integer): TSynHighlighterAttributes;
+begin
+  Result := FAttribs[TtkTokenKind(Index)];
+end;
+
+procedure TSynHP48Syn.SetAttrib(Index: Integer; Value: TSynHighlighterAttributes);
+begin
+  FAttribs[TtkTokenKind(Index)].Assign(Value);
+end;
+
+procedure TSynHP48Syn.EndOfToken;
+begin
+  while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
+    Inc(Run);
+end;
+
+function TSynHP48Syn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKeyReadOnly(Key) then begin
+      if r.ValueExists('AsmKeyWordList')
+        then AsmKeywords.Text := r.ReadString('AsmKeyWordList');
+      if r.ValueExists('RplKeyWordList')
+        then RplKeywords.Text := r.ReadString('RplKeyWordList');
+      Result := inherited LoadFromRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+function TSynHP48Syn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
+var
+  r: TBetterRegistry;
+begin
+  r := TBetterRegistry.Create;
+  try
+    r.RootKey := RootKey;
+    if r.OpenKey(Key, true) then begin
+      {$IFNDEF SYN_COMPILER_25_UP}
+      Result := true;
+      {$ENDIF}
+      r.WriteString('AsmKeyWordList', AsmKeywords.Text);
+      r.WriteString('RplKeyWordList', RplKeywords.Text);
+      Result := inherited SaveToRegistry(RootKey, Key);
+    end
+    else
+      Result := False;
+  finally
+    r.Free;
+  end;
+end;
+
+procedure TSynHP48Syn.Assign(Source: TPersistent);
+var
+  i: TtkTokenKind;
+begin
+  if Source is TSynHP48Syn then begin
+    for i := Low(FAttribs) to High(FAttribs) do begin
+      FAttribs[i].Background := TSynHP48Syn(source).FAttribs[i].Background;
+      FAttribs[i].Foreground := TSynHP48Syn(source).FAttribs[i].Foreground;
+      FAttribs[i].Style := TSynHP48Syn(source).FAttribs[i].Style;
+    end;
+    AsmKeyWords.Text := TSynHP48Syn(source).AsmKeyWords.Text;
+    RplKeyWords.Text := TSynHP48Syn(source).RplKeyWords.Text;
+  end
+  else
+    inherited Assign(Source);
+end;
+
+function TSynHP48Syn.GetAttribCount: Integer;
+begin
+  Result := Ord(High(FAttribs)) - Ord(Low(FAttribs)) + 1;
+end;
+
+function TSynHP48Syn.GetAttribute(idx: Integer): TSynHighlighterAttributes;
+begin // sorted by name
+  if (idx <= Ord(High(TtkTokenKind))) then
+    Result := FAttribs[TtkTokenKind(idx)]
+  else
+    Result := nil;
+end;
+
+function TSynHP48Syn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterHP48;
+end;
+
+class function TSynHP48Syn.GetLanguageName: string;
+begin
+  Result := SYNS_LangHP48;
+end;
+
+procedure TSynHP48Syn.SetHighLightChange;
+var
+  i: TtkTokenKind;
+begin
+  for i := Low(FAttribs) to High(FAttribs) do begin
+    FAttribs[i].OnChange := DefHighLightChange;
+    FAttribs[i].InternalSaveDefaultValues;
+  end;
+end;
+
+function TSynHP48Syn.SasmProc1: TtkTokenKind;
+var
+  i: Integer;
+  s: UnicodeString;
+begin
+  Result := tksAsmKey;
+  if Run > Length(FLineStr) then
+    Exit;
+  if FLineStr[Run] = '*' then begin
+    FRange := rssasm3;
+    Result := tksAsmComment;
+    Exit;
+  end;
+  if FLineStr[Run] >= ' ' then begin
+    i := Run;
+    while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
+      Inc(Run);
+    s := Copy(FLineStr, i, Run - i);
+    if (s = 'RPL') or (s = 'ENDCODE') then begin
+      FRange := rsRpl;
+      Exit;
+    end;
+  end;
+  while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
+    Inc(Run);
+  if Run <= Length(FLineStr) then
+    FRange := rssasm2
+  else
+    FRange := rssasm1;
+end;
+
+function TSynHP48Syn.SasmProc2: TtkTokenKind;
+var
+  i: Integer;
+  s: UnicodeString;
+begin
+  Result := tksAsm;
+  while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
+    Inc(Run);
+  if Run > 30 then begin
+    FRange := rssasm3;
+    Exit;
+  end;
+  i := Run;
+  while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
+    Inc(Run);
+  s := Copy(FLineStr, i, Run - i);
+  if (s = 'ENDCODE') or (s = 'RPL') then begin
+    FRange := rsRpl;
+    Result := tksAsmKey;
+  end
+  else begin
+    if FSAsmNoField.Find(s) = nil then begin
+      while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
+        Inc(Run);
+      while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
+        Inc(Run);
+      while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
+        Inc(Run);
+    end;
+    if Run <= Length(FLineStr) then
+      FRange := rssasm3
+    else
+      FRange := rssasm1;
+  end;
+end;
+
+function TSynHP48Syn.SasmProc3: TtkTokenKind;
+begin
+  Result := tksAsmComment;
+  while (Run <= Length(FLineStr)) and (FLineStr[Run] <> #10) do
+    Inc(Run);
+  if Run <= Length(FLineStr) then Inc(Run);
+  FRange := rssasm1;
+end;
+
+function TSynHP48Syn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  Result := GetAttrib(Ord(FTockenKind));
+end;
+
+function TSynHP48Syn.GetTokenKind: Integer;
+begin
+  Result := Ord(FTockenKind);
+end;
+
+function TSynHP48Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+begin
+  Result := nil;
+end;
+
+// reimplement functions to handle the non-standard use of 1-based Run
+// (instead of the standard 0-based Run)
+
+procedure TSynHP48Syn.DoSetLine(const Value: UnicodeString;
+  LineNumber: Integer);
+begin
+  inherited;
+  Run := 1;
+  fOldRun := Run;
+end;
+
+function TSynHP48Syn.GetToken: UnicodeString;
+var
+  Len: Integer;
+begin
+  Len := (Run - 1) - FTokenPos;
+  SetLength(Result, Len);
+  if Len > 0 then
+    WStrLCopy(@Result[1], fCasedLine + FTokenPos, Len);
+end;
+
+function TSynHP48Syn.IsLineEnd(Run: Integer): Boolean;
+begin
+  Result := (Run - 1 >= FLineLen) or (FLine[Run - 1] = #10) or (FLine[Run - 1] = #13);
+end;
+
+class function TSynHP48Syn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangHP48;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynHP48Syn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterHashEntries.pas b/Source/VCL/SynEdit/Source/SynHighlighterHashEntries.pas
index ca0c965c..d7c4b8a7 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterHashEntries.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterHashEntries.pas
@@ -1,225 +1,251 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterHashEntries.pas, released 2000-04-21.
-
-The Initial Author of this file is Michael Hieke.
-Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit project 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: SynHighlighterHashEntries.pas,v 1.5.2.3 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-
-{
-@abstract(Support classes for SynEdit highlighters that create the keyword lists at runtime.)
-@author(Michael Hieke)
-@created(2000-04-21)
-@lastmod(2001-09-07)
-The classes in this unit can be used to use the hashing algorithm while still
-having the ability to change the set of keywords.
-}
-
-unit SynHighlighterHashEntries;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  SynEditTypes,
-  SynUnicode,
-  Classes;
-
-type
-  { Class to hold the keyword to recognize, its length and its token kind. The
-    keywords that have the same hashvalue are stored in a single-linked list,
-    with the Next property pointing to the next entry. The entries are ordered
-    over the keyword length. }
-  TSynHashEntry = class(TObject)
-  protected
-    { Points to the next keyword entry with the same hashvalue. }
-    fNext: TSynHashEntry;
-    { Length of the keyword. }
-    fKeyLen: integer;
-    { The keyword itself. }
-    fKeyword: string;
-    { Keyword token kind, has to be typecasted to the real token kind type. }
-    fKind: integer;
-  public
-    { Adds a keyword entry with the same hashvalue. Depending on the length of
-      the two keywords it might return Self and store NewEntry in the Next
-      pointer, or return NewEntry and make the Next property of NewEntry point
-      to Self. This way the order of keyword length is preserved. }
-    function AddEntry(NewEntry: TSynHashEntry): TSynHashEntry; virtual;
-    { Creates a keyword entry for the given keyword and token kind. }
-    constructor Create(const AKey: string; AKind: integer);
-    { Destroys the keyword entry and all other keyword entries Next points to. }
-    destructor Destroy; override;
-  public
-    { The keyword itself. }
-    property Keyword: string read fKeyword;
-    { Length of the keyword. }
-    property KeywordLen: integer read fKeyLen;
-    { Keyword token kind, has to be typecasted to the real token kind type. }
-    property Kind: integer read fKind;
-    { Points to the next keyword entry with the same hashvalue. }
-    property Next: TSynHashEntry read fNext;
-  end;
-
-  { A list of keyword entries, stored as single-linked lists under the hashvalue
-    of the keyword. }
-  TSynHashEntryList = class(TList)
-  protected
-    { Returns the first keyword entry for a given hashcalue, or nil. }
-    function Get(HashKey: Integer): TSynHashEntry;
-    { Adds a keyword entry under its hashvalue. Will grow the list count when
-      necessary, so the maximum hashvalue should be limited outside. The correct
-      order of keyword entries is maintained. }
-    procedure Put(HashKey: Integer; Entry: TSynHashEntry);
-  public
-    { Clears the list and frees all contained keyword entries. }
-    procedure Clear; override;
-  public
-    { Type-safe access to the first keyword entry for a hashvalue. }
-    property Items[Index: integer]: TSynHashEntry read Get write Put; default;
-  end;
-
-  { Procedural type for adding keyword entries to a TSynHashEntryList when
-    iterating over all the keywords contained in a string. }
-  TEnumerateKeywordEvent = procedure(AKeyword: string; AKind: integer)
-    of object;
-
-{ This procedure will call AKeywordProc for all keywords in KeywordList. A
-  keyword is considered any number of successive chars that are contained in
-  Identifiers, with chars not contained in Identifiers before and after them. }
-procedure EnumerateKeywords(AKind: integer; KeywordList: string;
-  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
-
-implementation
-
-uses
-  SysUtils;
-
-procedure EnumerateKeywords(AKind: integer; KeywordList: string;
-  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
-var
-  pStart, pEnd: PWideChar;
-  Keyword: string;
-begin
-  if Assigned(AKeywordProc) and (KeywordList <> '') then
-  begin
-    pEnd := PWideChar(KeywordList);
-    pStart := pEnd;
-    repeat
-      // skip over chars that are not in Identifiers
-      while (pStart^ <> #0) and not IsIdentChar(pStart^) do
-        Inc(pStart);
-      if pStart^ = #0 then break;
-      // find the last char that is in Identifiers
-      pEnd := pStart + 1;
-      while (pEnd^ <> #0) and IsIdentChar(pEnd^) do
-        Inc(pEnd);
-      // call the AKeywordProc with the keyword
-      SetString(Keyword, pStart, pEnd - pStart);
-      AKeywordProc(Keyword, AKind);
-      Keyword := '';
-      // pEnd points to a char not in Identifiers, restart after that
-      pStart := pEnd + 1;
-    until (pStart^ = #0) or (pEnd^ = #0);
-  end;
-end;
-
-{ TSynHashEntry }
-
-constructor TSynHashEntry.Create(const AKey: string; AKind: integer);
-begin
-  inherited Create;
-  fKeyLen := Length(AKey);
-  fKeyword := AKey;
-  fKind := AKind;
-end;
-
-destructor TSynHashEntry.Destroy;
-begin
-  fNext.Free;
-  inherited Destroy;
-end;
-
-function TSynHashEntry.AddEntry(NewEntry: TSynHashEntry): TSynHashEntry;
-begin
-  Result := Self;
-  if Assigned(NewEntry) then
-  begin
-    if WideCompareText(NewEntry.Keyword, fKeyword) = 0 then
-      raise Exception.CreateFmt('Keyword "%s" already in list', [fKeyword]);
-    if NewEntry.fKeyLen < fKeyLen then
-    begin
-      NewEntry.fNext := Self;
-      Result := NewEntry;
-    end else if Assigned(fNext) then
-      fNext := fNext.AddEntry(NewEntry)
-    else
-      fNext := NewEntry;
-  end;
-end;
-
-{ TSynHashEntryList }
-
-procedure TSynHashEntryList.Clear ;
-var
-  i: integer;
-begin
-  for i := 0 to Count - 1 do
-    TSynHashEntry(Items[i]).Free;
-  inherited Clear;
-end;
-
-function TSynHashEntryList.Get(HashKey: Integer): TSynHashEntry;
-begin
-  if (HashKey >= 0) and (HashKey < Count) then
-    Result := inherited Items[HashKey]
-  else
-    Result := nil;
-end;
-
-procedure TSynHashEntryList.Put(HashKey: Integer; Entry: TSynHashEntry);
-var
-  ListEntry: TSynHashEntry;
-begin
-  if HashKey >= Count then
-    Count := HashKey + 1;
-  ListEntry := TSynHashEntry(inherited Items[HashKey]);
-  // if there is already a hashentry for this hashvalue let it decide
-  // where to put the new entry in its single linked list
-  if Assigned(ListEntry) then
-    Entry := ListEntry.AddEntry(Entry);
-  inherited Items[HashKey] := Entry;
-end;
-
-end.
-
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterHashEntries.pas, released 2000-04-21.
+
+The Initial Author of this file is Michael Hieke.
+Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
+Unicode translation by Maël Hörz.
+All Rights Reserved.
+
+Contributors to the SynEdit project 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: SynHighlighterHashEntries.pas,v 1.5.2.3 2008/09/14 16:25:00 maelh Exp $
+
+You may retrieve the latest version of this file at the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+Known Issues:
+-------------------------------------------------------------------------------}
+
+{
+@abstract(Support classes for SynEdit highlighters that create the keyword lists at runtime.)
+@author(Michael Hieke)
+@created(2000-04-21)
+@lastmod(2001-09-07)
+The classes in this unit can be used to use the hashing algorithm while still
+having the ability to change the set of keywords.
+}
+
+unit SynHighlighterHashEntries;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  SynEditTypes,
+  SynUnicode,
+  Classes;
+
+type
+  { Class to hold the keyword to recognize, its length and its token kind. The
+    keywords that have the same hashvalue are stored in a single-linked list,
+    with the Next property pointing to the next entry. The entries are ordered
+    over the keyword length. }
+  TSynHashEntry = class(TObject)
+  protected
+    { Points to the next keyword entry with the same hashvalue. }
+    FNext: TSynHashEntry;
+    { Length of the keyword. }
+    FKeyLen: Integer;
+    { The keyword itself. }
+    FKeyword: UnicodeString;
+    { Keyword token kind, has to be typecasted to the real token kind type. }
+    fKind: Integer;
+  public
+    { Adds a keyword entry with the same hashvalue. Depending on the length of
+      the two keywords it might return Self and store NewEntry in the Next
+      pointer, or return NewEntry and make the Next property of NewEntry point
+      to Self. This way the order of keyword length is preserved. }
+    function AddEntry(NewEntry: TSynHashEntry): TSynHashEntry; virtual;
+    { Creates a keyword entry for the given keyword and token kind. }
+    constructor Create(const AKey: UnicodeString; AKind: Integer);
+    { Destroys the keyword entry and all other keyword entries Next points to. }
+    destructor Destroy; override;
+  public
+    { The keyword itself. }
+    property Keyword: UnicodeString read FKeyword;
+    { Length of the keyword. }
+    property KeywordLen: Integer read FKeyLen;
+    { Keyword token kind, has to be typecasted to the real token kind type. }
+    property Kind: Integer read fKind;
+    { Points to the next keyword entry with the same hashvalue. }
+    property Next: TSynHashEntry read FNext;
+  end;
+
+
+{$IFNDEF SYN_COMPILER_4_UP}
+  {$IFNDEF SYN_CPPB_3}
+    {$DEFINE LIST_CLEAR_NOT_VIRTUAL}
+  {$ENDIF}
+{$ENDIF}
+
+  { A list of keyword entries, stored as single-linked lists under the hashvalue
+    of the keyword. }
+  TSynHashEntryList = class(TList)
+  protected
+    { Returns the first keyword entry for a given hashcalue, or nil. }
+    function Get(HashKey: Integer): TSynHashEntry;
+    { Adds a keyword entry under its hashvalue. Will grow the list count when
+      necessary, so the maximum hashvalue should be limited outside. The correct
+      order of keyword entries is maintained. }
+    procedure Put(HashKey: Integer; Entry: TSynHashEntry);
+  public
+{$IFDEF LIST_CLEAR_NOT_VIRTUAL}
+    { Overridden destructor clears the list and frees all contained keyword
+      entries. }
+    destructor Destroy; override;
+    { Clears the list and frees all contained keyword entries. }
+    procedure DeleteEntries;
+{$ELSE}
+    { Clears the list and frees all contained keyword entries. }
+    procedure Clear; override;
+{$ENDIF}
+  public
+    { Type-safe access to the first keyword entry for a hashvalue. }
+    property Items[Index: Integer]: TSynHashEntry read Get write Put; default;
+  end;
+
+  { Procedural type for adding keyword entries to a TSynHashEntryList when
+    iterating over all the keywords contained in a string. }
+  TEnumerateKeywordEvent = procedure(AKeyword: UnicodeString; AKind: Integer)
+    of object;
+
+{ This procedure will call AKeywordProc for all keywords in KeywordList. A
+  keyword is considered any number of successive chars that are contained in
+  Identifiers, with chars not contained in Identifiers before and after them. }
+procedure EnumerateKeywords(AKind: Integer; KeywordList: UnicodeString;
+  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
+
+implementation
+
+uses
+  SysUtils;
+
+procedure EnumerateKeywords(AKind: Integer; KeywordList: UnicodeString;
+  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
+var
+  pStart, pEnd: PWideChar;
+  Keyword: UnicodeString;
+begin
+  if Assigned(AKeywordProc) and (KeywordList <> '') then
+  begin
+    pEnd := PWideChar(KeywordList);
+    pStart := pEnd;
+    repeat
+      // skip over chars that are not in Identifiers
+      while (pStart^ <> #0) and not IsIdentChar(pStart^) do
+        Inc(pStart);
+      if pStart^ = #0 then
+        Break;
+      // find the last char that is in Identifiers
+      pEnd := pStart + 1;
+      while (pEnd^ <> #0) and IsIdentChar(pEnd^) do
+        Inc(pEnd);
+      // call the AKeywordProc with the keyword
+      SetString(Keyword, pStart, pEnd - pStart);
+      AKeywordProc(Keyword, AKind);
+      Keyword := '';
+      // pEnd points to a char not in Identifiers, restart after that
+      pStart := pEnd + 1;
+    until (pStart^ = #0) or (pEnd^ = #0);
+  end;
+end;
+
+{ TSynHashEntry }
+
+constructor TSynHashEntry.Create(const AKey: UnicodeString; AKind: Integer);
+begin
+  inherited Create;
+  FKeyLen := Length(AKey);
+  FKeyword := AKey;
+  fKind := AKind;
+end;
+
+destructor TSynHashEntry.Destroy;
+begin
+  FNext.Free;
+  inherited Destroy;
+end;
+
+function TSynHashEntry.AddEntry(NewEntry: TSynHashEntry): TSynHashEntry;
+begin
+  Result := Self;
+  if Assigned(NewEntry) then
+  begin
+    if WideCompareText(NewEntry.Keyword, FKeyword) = 0 then
+      raise Exception.CreateFmt('Keyword "%s" already in list', [FKeyword]);
+    if NewEntry.FKeyLen < FKeyLen then
+    begin
+      NewEntry.FNext := Self;
+      Result := NewEntry;
+    end else if Assigned(FNext) then
+      FNext := FNext.AddEntry(NewEntry)
+    else
+      FNext := NewEntry;
+  end;
+end;
+
+{ TSynHashEntryList }
+
+{$IFDEF LIST_CLEAR_NOT_VIRTUAL}
+destructor TSynHashEntryList.Destroy;
+begin
+  DeleteEntries;
+  inherited Destroy;
+end;
+
+procedure TSynHashEntryList.DeleteEntries;
+{$ELSE}
+procedure TSynHashEntryList.Clear;
+{$ENDIF}
+var
+  i: Integer;
+begin
+  for i := 0 to Count - 1 do
+    TSynHashEntry(Items[i]).Free;
+  inherited Clear;
+end;
+
+function TSynHashEntryList.Get(HashKey: Integer): TSynHashEntry;
+begin
+  if (HashKey >= 0) and (HashKey < Count) then
+    Result := inherited Items[HashKey]
+  else
+    Result := nil;
+end;
+
+procedure TSynHashEntryList.Put(HashKey: Integer; Entry: TSynHashEntry);
+var
+  ListEntry: TSynHashEntry;
+begin
+  if HashKey >= Count then
+    Count := HashKey + 1;
+  ListEntry := TSynHashEntry(inherited Items[HashKey]);
+  // if there is already a hashentry for this hashvalue let it decide
+  // where to put the new entry in its single linked list
+  if Assigned(ListEntry) then
+    Entry := ListEntry.AddEntry(Entry);
+  inherited Items[HashKey] := Entry;
+end;
+
+end.
+
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterHaskell.pas b/Source/VCL/SynEdit/Source/SynHighlighterHaskell.pas
index c0c11e2d..ce173269 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterHaskell.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterHaskell.pas
@@ -1,961 +1,965 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterHaskell.pas, released 2001-10-28
-The Original Code is based on the SynHighlighterCpp.pas, released 2000-04-10
-which in turn was based on the dcjCppSyn.pas file from the mwEdit component
-suite by Martin Waldenburg and other developers, the Initial Author of this file
-is Michael Trier.
-Unicode translation by Maël Hörz.
-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.
-
-You may retrieve the latest version of SynEdit from the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-You may retrieve the latest version of this file from
-http://www.ashleybrown.co.uk/synedit/
-
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a Haskell syntax highlighter for SynEdit)
-@author(Ashley Brown)
-@created(2001)
-@lastmod(2000-10-26)
-The SynHighlighterHaskell unit provides SynEdit with a Haskell syntax highlighter.
-Based on SynHighlighterCpp.
-
-http://haskell.org/
-http://www.ashleybrown.co.uk/
-ashley@ashleybrown.co.uk
-}
-
-unit SynHighlighterHaskell;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown);
-
-  TxtkTokenKind = (
-    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
-    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
-    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
-    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
-    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
-    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
-    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
-    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
-    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
-    xtkXorAssign);
-
-  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
-    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynHaskellSyn = class(TSynCustomHighlighter)
-  private
-    fAsmStart: Boolean;
-    fRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FExtTokenID: TxtkTokenKind;
-    fIdentFuncTable: array[0..28] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AnsiCProc;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-  protected
-    function GetSampleSource: string; override;
-    function GetExtTokenID: TxtkTokenKind;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetCapabilities: TSynHighlighterCapabilities; override;
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-    procedure EnumUserSettings(settings: TStrings); override;
-    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    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;
-  end;
-
-implementation
-
-uses
-  Windows,
-  SynEditStrConst;
-
-const
-  KeyWords: array[0..23] of string = (
-    'Bool', 'Char', 'class', 'data', 'deriving', 'Double', 'else', 'False', 
-    'Float', 'if', 'import', 'in', 'instance', 'Int', 'Integer', 'IO', 'let', 
-    'module', 'otherwise', 'String', 'then', 'True', 'type', 'where' 
-  );
-
-  KeyIndices: array[0..28] of Integer = (
-    2, 23, 10, 16, 7, -1, 22, 8, 14, 17, 5, 4, 11, -1, 1, 9, 12, 0, -1, 6, -1, 
-    3, 15, 18, 20, -1, 13, 19, 21 
-  );
-
-{$Q-}
-function TSynHaskellSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 904 + Ord(Str^) * 779;
-    inc(Str);
-  end;
-  Result := Result mod 29;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynHaskellSyn.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 TSynHaskellSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynHaskellSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynHaskellSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-constructor TSynHaskellSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := True;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  AddAttribute(fCommentAttri);
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style:= [fsBold];
-  AddAttribute(fKeyAttri);
-  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(fNumberAttri);
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(fStringAttri);
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(fSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fRange := rsUnknown;
-  fAsmStart := False;
-  fDefaultFilter := SYNS_FilterHaskell;
-end; { Create }
-
-procedure TSynHaskellSyn.AnsiCProc;
-begin
-  fTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        if fLine[Run + 1] = '/' then
-        begin
-          inc(Run, 2);
-          if fRange = rsAnsiCAsm then
-            fRange := rsAsm
-          else if fRange = rsAnsiCAsmBlock then
-            fRange := rsAsmBlock
-          else if fRange = rsDirectiveComment then
-            fRange := rsDirective
-          else
-            fRange := rsUnKnown;
-          break;
-        end else
-          inc(Run);
-      #10: break;
-      #13: break;
-    else inc(Run);
-    end;
-end;
-
-procedure TSynHaskellSyn.AndSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAndAssign;
-      end;
-    '&':                               {logical and}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogAnd;
-      end;
-  else                                 {and}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAnd;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.AsciiCharProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      if CharInSet(fLine[Run + 1], [#39, '\']) then
-        inc(Run);
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #39);
-  if fLine[Run] = #39 then
-    inc(Run);
-end;
-
-procedure TSynHaskellSyn.AtSymbolProc;
-begin
-  fTokenID := tkUnknown;
-  inc(Run);
-end;
-
-procedure TSynHaskellSyn.BraceCloseProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceClose;
-  if fRange = rsAsmBlock then fRange := rsUnknown;
-end;
-
-procedure TSynHaskellSyn.BraceOpenProc;
-begin
-  inc(Run);
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBraceOpen;
-  if fRange = rsAsm then
-  begin
-    fRange := rsAsmBlock;
-    fAsmStart := True;
-  end;
-end;
-
-procedure TSynHaskellSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run + 1] = #10 then Inc(Run);
-end;
-
-procedure TSynHaskellSyn.ColonProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkScopeResolution;
-      end;
-  else                                 {colon}
-    begin
-      inc(Run);
-      FExtTokenID := xtkColon;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.CommaProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkComma;
-end;
-
-procedure TSynHaskellSyn.EqualProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogEqual;
-      end;
-  else                                 {assign}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAssign;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.GreaterProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkGreaterThanEqual;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftRightAssign;
-        end
-        else                           {shift right}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftRight;
-        end;
-      end;
-  else                                 {greater than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkGreaterThan;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.QuestionProc;
-begin
-  fTokenID := tkSymbol;                {conditional}
-  FExtTokenID := xtkQuestion;
-  inc(Run);
-end;
-
-procedure TSynHaskellSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynHaskellSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynHaskellSyn.LowerProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLessThanEqual;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-        begin
-          inc(Run, 3);
-          FExtTokenID := xtkShiftLeftAssign;
-        end
-        else                           {shift left}
-        begin
-          inc(Run, 2);
-          FExtTokenID := xtkShiftLeft;
-        end;
-      end;
-  else                                 {less than}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLessThan;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.MinusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkSubtractAssign;
-      end;
-    '-':                               {decrement}
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-        while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '>':                               {arrow}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkArrow;
-      end;
-  else                                 {subtract}
-    begin
-      inc(Run);
-      FExtTokenID := xtkSubtract;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.ModSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkModAssign;
-      end;
-  else                                 {mod}
-    begin
-      inc(Run);
-      FExtTokenID := xtkMod;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.NotSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkNotEqual;
-      end;
-  else                                 {not}
-    begin
-      inc(Run);
-      FExtTokenID := xtkLogComplement;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynHaskellSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then break;
-    end;
-    inc(Run);
-  end;
-end;
-
-procedure TSynHaskellSyn.OrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {or assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncOrAssign;
-      end;
-    '|':                               {logical or}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkLogOr;
-      end;
-  else                                 {or}
-    begin
-      inc(Run);
-      FExtTokenID := xtkIncOr;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.PlusProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkAddAssign;
-      end;
-    '+':                               {increment}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkIncrement;
-      end;
-  else                                 {add}
-    begin
-      inc(Run);
-      FExtTokenID := xtkAdd;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.PointProc;
-begin
-  fTokenID := tkSymbol;
-  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
-    begin                              {ellipse}
-      inc(Run, 3);
-      FExtTokenID := xtkEllipse;
-    end
-  else                                 {point}
-    begin
-      inc(Run);
-      FExtTokenID := xtkPoint;
-    end;
-end;
-
-procedure TSynHaskellSyn.RoundCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkRoundClose;
-end;
-
-procedure TSynHaskellSyn.RoundOpenProc;
-begin
-  inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundOpen;
-end;
-
-procedure TSynHaskellSyn.SemiColonProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSemiColon;
-  if fRange = rsAsm then fRange := rsUnknown;
-end;
-
-procedure TSynHaskellSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '=':                               {divide assign}
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-        FExtTokenID := xtkDivideAssign;
-      end;
-  else                                 {divide}
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-      FExtTokenID := xtkDivide;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynHaskellSyn.SquareCloseProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareClose;
-end;
-
-procedure TSynHaskellSyn.SquareOpenProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-  FExtTokenID := xtkSquareOpen;
-end;
-
-procedure TSynHaskellSyn.StarProc;
-begin
-  fTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkMultiplyAssign;
-      end;
-  else                                 {star}
-    begin
-      inc(Run);
-      FExtTokenID := xtkStar;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.StringProc;
-begin
-  fTokenID := tkString;
-  repeat
-    if fLine[Run] = '\' then begin
-      if CharInSet(fLine[Run + 1], [#34, '\']) then
-        Inc(Run);
-    end;
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = #34);
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynHaskellSyn.TildeProc;
-begin
-  inc(Run);                            {bitwise complement}
-  fTokenId := tkSymbol;
-  FExtTokenID := xtkBitComplement;
-end;
-
-procedure TSynHaskellSyn.XOrSymbolProc;
-begin
-  fTokenID := tkSymbol;
-  Case FLine[Run + 1] of
-    '=':                               {xor assign}
-      begin
-        inc(Run, 2);
-        FExtTokenID := xtkXorAssign;
-      end;
-  else                                 {xor}
-    begin
-      inc(Run);
-      FExtTokenID := xtkXor;
-    end;
-  end;
-end;
-
-procedure TSynHaskellSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynHaskellSyn.Next;
-begin
-  fAsmStart := False;
-  fTokenPos := Run;
-  case fRange of
-    rsAnsiC, rsAnsiCAsm,
-    rsAnsiCAsmBlock: AnsiCProc;
-  else
-    begin
-      fRange := rsUnknown;
-      case fLine[Run] of
-        '&': AndSymbolProc;
-        #39: AsciiCharProc;
-        '@': AtSymbolProc;
-        '}': BraceCloseProc;
-        '{': BraceOpenProc;
-        #13: CRProc;
-        ':': ColonProc;
-        ',': CommaProc;
-        '=': EqualProc;
-        '>': GreaterProc;
-        '?': QuestionProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        #10: LFProc;
-        '<': LowerProc;
-        '-': MinusProc;
-        '%': ModSymbolProc;
-        '!': NotSymbolProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '|': OrSymbolProc;
-        '+': PlusProc;
-        '.': PointProc;
-        ')': RoundCloseProc;
-        '(': RoundOpenProc;
-        ';': SemiColonProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        ']': SquareCloseProc;
-        '[': SquareOpenProc;
-        '*': StarProc;
-        #34: StringProc;
-        '~': TildeProc;
-        '^': XOrSymbolProc;
-        else UnknownProc;
-      end;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynHaskellSyn.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 TSynHaskellSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynHaskellSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-function TSynHaskellSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynHaskellSyn.GetExtTokenID: TxtkTokenKind;
-begin
-  Result := FExtTokenID;
-end;
-
-function TSynHaskellSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkNumber: Result := fNumberAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkString: Result := fStringAttri;
-    tkSymbol: Result := fSymbolAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynHaskellSyn.GetTokenKind: integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-procedure TSynHaskellSyn.ResetRange;
-begin
-  fRange:= rsUnknown;
-end;
-
-procedure TSynHaskellSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynHaskellSyn.EnumUserSettings(settings: TStrings);
-begin
-  { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
-  begin
-    try
-      RootKey := HKEY_LOCAL_MACHINE;
-      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
-      begin
-        try
-          GetKeyNames(settings);
-        finally
-          CloseKey;
-        end;
-      end;
-    finally
-      Free;
-    end;
-  end;
-end;
-
-function TSynHaskellSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterHaskell;
-end;
-
-function TSynHaskellSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '_', '0'..'9', 'a'..'z', 'A'..'Z', #39:
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-class function TSynHaskellSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangHaskell;
-end;
-
-class function TSynHaskellSyn.GetCapabilities: TSynHighlighterCapabilities;
-begin
-  Result := inherited GetCapabilities + [hcUserSettings];
-end;
-
-function TSynHaskellSyn.GetSampleSource: string;
-begin
-  Result := '-- Haskell Sample Source'#13#10 +
-            'tail :: [a] -> [a]'#13#10 +
-            'tail (x:xs) = xs'#13#10 +
-            '';
-end;
-
-class function TSynHaskellSyn.GetFriendlyLanguageName: string;
-begin
-  Result := SYNS_FriendlyLangHaskell;
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynHaskellSyn);
-end.
+{-------------------------------------------------------------------------------
+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.
+
+The Original Code is: SynHighlighterHaskell.pas, released 2001-10-28
+The Original Code is based on the SynHighlighterCpp.pas, released 2000-04-10
+which in turn was based on the dcjCppSyn.pas file from the mwEdit component
+suite by Martin Waldenburg and other developers, the Initial Author of this file
+is Michael Trier.
+Unicode translation by Maël Hörz.
+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.
+
+You may retrieve the latest version of SynEdit from the SynEdit home page,
+located at http://SynEdit.SourceForge.net
+
+You may retrieve the latest version of this file from
+http://www.ashleybrown.co.uk/synedit/
+
+-------------------------------------------------------------------------------}
+{
+@abstract(Provides a Haskell syntax highlighter for SynEdit)
+@author(Ashley Brown)
+@created(2001)
+@lastmod(2000-10-26)
+The SynHighlighterHaskell unit provides SynEdit with a Haskell syntax highlighter.
+Based on SynHighlighterCpp.
+
+http://haskell.org/
+http://www.ashleybrown.co.uk/
+ashley@ashleybrown.co.uk
+}
+
+unit SynHighlighterHaskell;
+
+{$I SynEdit.inc}
+
+interface
+
+uses
+  Graphics,
+  SynEditTypes,
+  SynEditHighlighter,
+  SynUnicode,
+  SysUtils,
+  Classes;
+
+type
+  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull,
+    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown);
+
+  TxtkTokenKind = (
+    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
+    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
+    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
+    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
+    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
+    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
+    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
+    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
+    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
+    xtkXorAssign);
+
+  TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
+    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39);
+
+  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
+  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
+
+  TSynHaskellSyn = class(TSynCustomHighlighter)
+  private
+    FAsmStart: Boolean;
+    FRange: TRangeState;
+    FTokenID: TtkTokenKind;
+    FExtTokenID: TxtkTokenKind;
+    FIdentFuncTable: array[0..28] of TIdentFuncTableFunc;
+    FCommentAttri: TSynHighlighterAttributes;
+    FIdentifierAttri: TSynHighlighterAttributes;
+    FKeyAttri: TSynHighlighterAttributes;
+    FNumberAttri: TSynHighlighterAttributes;
+    FSpaceAttri: TSynHighlighterAttributes;
+    FStringAttri: TSynHighlighterAttributes;
+    FSymbolAttri: TSynHighlighterAttributes;
+    function AltFunc(Index: Integer): TtkTokenKind;
+    function KeyWordFunc(Index: Integer): TtkTokenKind;
+    function HashKey(Str: PWideChar): Cardinal;
+    function IdentKind(MayBe: PWideChar): TtkTokenKind;
+    procedure InitIdent;
+    procedure AnsiCProc;
+    procedure AndSymbolProc;
+    procedure AsciiCharProc;
+    procedure AtSymbolProc;
+    procedure BraceCloseProc;
+    procedure BraceOpenProc;
+    procedure CRProc;
+    procedure ColonProc;
+    procedure CommaProc;
+    procedure EqualProc;
+    procedure GreaterProc;
+    procedure IdentProc;
+    procedure LFProc;
+    procedure LowerProc;
+    procedure MinusProc;
+    procedure ModSymbolProc;
+    procedure NotSymbolProc;
+    procedure NullProc;
+    procedure NumberProc;
+    procedure OrSymbolProc;
+    procedure PlusProc;
+    procedure PointProc;
+    procedure QuestionProc;
+    procedure RoundCloseProc;
+    procedure RoundOpenProc;
+    procedure SemiColonProc;
+    procedure SlashProc;
+    procedure SpaceProc;
+    procedure SquareCloseProc;
+    procedure SquareOpenProc;
+    procedure StarProc;
+    procedure StringProc;
+    procedure TildeProc;
+    procedure XOrSymbolProc;
+    procedure UnknownProc;
+  protected
+    function GetSampleSource: UnicodeString; override;
+    function GetExtTokenID: TxtkTokenKind;
+    function IsFilterStored: Boolean; override;
+  public
+    class function GetCapabilities: TSynHighlighterCapabilities; override;
+    class function GetLanguageName: string; override;
+    class function GetFriendlyLanguageName: UnicodeString; override;
+  public
+    constructor Create(AOwner: TComponent); override;
+    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
+      override;
+    function GetEol: Boolean; override;
+    function GetRange: Pointer; override;
+    function GetTokenID: TtkTokenKind;
+    function GetTokenAttribute: TSynHighlighterAttributes; override;
+    function GetTokenKind: Integer; override;
+    function IsIdentChar(AChar: WideChar): Boolean; override;
+    procedure Next; override;
+    procedure SetRange(Value: Pointer); override;
+    procedure ResetRange; override;
+    procedure EnumUserSettings(settings: TStrings); override;
+    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+  published
+    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
+      write FCommentAttri;
+    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;
+  end;
+
+implementation
+
+uses
+  Windows,
+  SynEditStrConst;
+
+const
+  KeyWords: array[0..23] of UnicodeString = (
+    'Bool', 'Char', 'class', 'data', 'deriving', 'Double', 'else', 'False', 
+    'Float', 'if', 'import', 'in', 'instance', 'Int', 'Integer', 'IO', 'let', 
+    'module', 'otherwise', 'String', 'then', 'True', 'type', 'where' 
+  );
+
+  KeyIndices: array[0..28] of Integer = (
+    2, 23, 10, 16, 7, -1, 22, 8, 14, 17, 5, 4, 11, -1, 1, 9, 12, 0, -1, 6, -1, 
+    3, 15, 18, 20, -1, 13, 19, 21 
+  );
+
+{$Q-}
+function TSynHaskellSyn.HashKey(Str: PWideChar): Cardinal;
+begin
+  Result := 0;
+  while IsIdentChar(Str^) do
+  begin
+    Result := Result * 904 + Ord(Str^) * 779;
+    Inc(Str);
+  end;
+  Result := Result mod 29;
+  FStringLen := Str - FToIdent;
+end;
+{$Q+}
+
+function TSynHaskellSyn.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 TSynHaskellSyn.InitIdent;
+var
+  i: Integer;
+begin
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if KeyIndices[i] = -1 then
+      FIdentFuncTable[i] := AltFunc;
+
+  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+    if @FIdentFuncTable[i] = nil then
+      FIdentFuncTable[i] := KeyWordFunc;
+end;
+
+function TSynHaskellSyn.AltFunc(Index: Integer): TtkTokenKind;
+begin
+  Result := tkIdentifier;
+end;
+
+function TSynHaskellSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkKey
+  else
+    Result := tkIdentifier
+end;
+
+constructor TSynHaskellSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+
+  FCaseSensitive := True;
+
+  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  FCommentAttri.Style := [fsItalic];
+  AddAttribute(FCommentAttri);
+  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(FIdentifierAttri);
+  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  FKeyAttri.Style:= [fsBold];
+  AddAttribute(FKeyAttri);
+  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(FNumberAttri);
+  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(FSpaceAttri);
+  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(FStringAttri);
+  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(FSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  InitIdent;
+  FRange := rsUnknown;
+  FAsmStart := False;
+  FDefaultFilter := SYNS_FilterHaskell;
+end; { Create }
+
+procedure TSynHaskellSyn.AnsiCProc;
+begin
+  FTokenID := tkComment;
+  case FLine[Run] of
+    #0:
+      begin
+        NullProc;
+        Exit;
+      end;
+    #10:
+      begin
+        LFProc;
+        Exit;
+      end;
+    #13:
+      begin
+        CRProc;
+        Exit;
+      end;
+  end;
+
+  while FLine[Run] <> #0 do
+    case FLine[Run] of
+      '*':
+        if FLine[Run + 1] = '/' then
+        begin
+          Inc(Run, 2);
+          if FRange = rsAnsiCAsm then
+            FRange := rsAsm
+          else if FRange = rsAnsiCAsmBlock then
+            FRange := rsAsmBlock
+          else if FRange = rsDirectiveComment then
+            FRange := rsDirective
+          else
+            FRange := rsUnknown;
+          Break;
+        end else
+          Inc(Run);
+      #10, #13:
+        Break;
+    else Inc(Run);
+    end;
+end;
+
+procedure TSynHaskellSyn.AndSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {and assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAndAssign;
+      end;
+    '&':                               {logical and}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogAnd;
+      end;
+  else                                 {and}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAnd;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.AsciiCharProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#39, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #39);
+  if FLine[Run] = #39 then
+    Inc(Run);
+end;
+
+procedure TSynHaskellSyn.AtSymbolProc;
+begin
+  FTokenID := tkUnknown;
+  Inc(Run);
+end;
+
+procedure TSynHaskellSyn.BraceCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceClose;
+  if FRange = rsAsmBlock then FRange := rsUnknown;
+end;
+
+procedure TSynHaskellSyn.BraceOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBraceOpen;
+  if FRange = rsAsm then
+  begin
+    FRange := rsAsmBlock;
+    FAsmStart := True;
+  end;
+end;
+
+procedure TSynHaskellSyn.CRProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+  if FLine[Run + 1] = #10 then Inc(Run);
+end;
+
+procedure TSynHaskellSyn.ColonProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    ':':                               {scope resolution operator}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkScopeResolution;
+      end;
+  else                                 {colon}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkColon;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.CommaProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkComma;
+end;
+
+procedure TSynHaskellSyn.EqualProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {logical equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogEqual;
+      end;
+  else                                 {assign}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAssign;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.GreaterProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {greater than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkGreaterThanEqual;
+      end;
+    '>':
+      begin
+        if FLine[Run + 2] = '=' then   {shift right assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftRightAssign;
+        end
+        else                           {shift right}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftRight;
+        end;
+      end;
+  else                                 {greater than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkGreaterThan;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.QuestionProc;
+begin
+  FTokenID := tkSymbol;                {conditional}
+  FExtTokenID := xtkQuestion;
+  Inc(Run);
+end;
+
+procedure TSynHaskellSyn.IdentProc;
+begin
+  FTokenID := IdentKind((FLine + Run));
+  Inc(Run, FStringLen);
+  while IsIdentChar(FLine[Run]) do Inc(Run);
+end;
+
+procedure TSynHaskellSyn.LFProc;
+begin
+  FTokenID := tkSpace;
+  Inc(Run);
+end;
+
+procedure TSynHaskellSyn.LowerProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {less than or equal to}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLessThanEqual;
+      end;
+    '<':
+      begin
+        if FLine[Run + 2] = '=' then   {shift left assign}
+        begin
+          Inc(Run, 3);
+          FExtTokenID := xtkShiftLeftAssign;
+        end
+        else                           {shift left}
+        begin
+          Inc(Run, 2);
+          FExtTokenID := xtkShiftLeft;
+        end;
+      end;
+  else                                 {less than}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLessThan;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.MinusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {subtract assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkSubtractAssign;
+      end;
+    '-':                               {decrement}
+      begin
+        FTokenID := tkComment;
+        Inc(Run, 2);
+        while not IsLineEnd(Run) do Inc(Run);
+      end;
+    '>':                               {arrow}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkArrow;
+      end;
+  else                                 {subtract}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkSubtract;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.ModSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {mod assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkModAssign;
+      end;
+  else                                 {mod}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkMod;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.NotSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {not equal}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkNotEqual;
+      end;
+  else                                 {not}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkLogComplement;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.NullProc;
+begin
+  FTokenID := tkNull;
+  Inc(Run);
+end;
+
+procedure TSynHaskellSyn.NumberProc;
+
+  function IsNumberChar: Boolean;
+  begin
+    case FLine[Run] of
+      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
+        Result := True;
+      else
+        Result := False;
+    end;
+  end;
+
+begin
+  Inc(Run);
+  FTokenID := tkNumber;
+  while IsNumberChar do
+  begin
+    case FLine[Run] of
+      '.':
+        if FLine[Run + 1] = '.' then
+          Break;
+    end;
+    Inc(Run);
+  end;
+end;
+
+procedure TSynHaskellSyn.OrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {or assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncOrAssign;
+      end;
+    '|':                               {logical or}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkLogOr;
+      end;
+  else                                 {or}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkIncOr;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.PlusProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {add assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkAddAssign;
+      end;
+    '+':                               {increment}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkIncrement;
+      end;
+  else                                 {add}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkAdd;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.PointProc;
+begin
+  FTokenID := tkSymbol;
+  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
+    begin                              {ellipse}
+      Inc(Run, 3);
+      FExtTokenID := xtkEllipse;
+    end
+  else                                 {point}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkPoint;
+    end;
+end;
+
+procedure TSynHaskellSyn.RoundCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundClose;
+end;
+
+procedure TSynHaskellSyn.RoundOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkRoundOpen;
+end;
+
+procedure TSynHaskellSyn.SemiColonProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSemiColon;
+  if FRange = rsAsm then FRange := rsUnknown;
+end;
+
+procedure TSynHaskellSyn.SlashProc;
+begin
+  case FLine[Run + 1] of
+    '=':                               {divide assign}
+      begin
+        Inc(Run, 2);
+        FTokenID := tkSymbol;
+        FExtTokenID := xtkDivideAssign;
+      end;
+  else                                 {divide}
+    begin
+      Inc(Run);
+      FTokenID := tkSymbol;
+      FExtTokenID := xtkDivide;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.SpaceProc;
+begin
+  Inc(Run);
+  FTokenID := tkSpace;
+  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+end;
+
+procedure TSynHaskellSyn.SquareCloseProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareClose;
+end;
+
+procedure TSynHaskellSyn.SquareOpenProc;
+begin
+  Inc(Run);
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkSquareOpen;
+end;
+
+procedure TSynHaskellSyn.StarProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {multiply assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkMultiplyAssign;
+      end;
+  else                                 {star}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkStar;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.StringProc;
+begin
+  FTokenID := tkString;
+  repeat
+    if FLine[Run] = '\' then begin
+      if CharInSet(FLine[Run + 1], [#34, '\']) then
+        Inc(Run);
+    end;
+    Inc(Run);
+  until IsLineEnd(Run) or (FLine[Run] = #34);
+  if FLine[Run] = #34 then
+    Inc(Run);
+end;
+
+procedure TSynHaskellSyn.TildeProc;
+begin
+  Inc(Run);                            {bitwise complement}
+  FTokenID := tkSymbol;
+  FExtTokenID := xtkBitComplement;
+end;
+
+procedure TSynHaskellSyn.XOrSymbolProc;
+begin
+  FTokenID := tkSymbol;
+  case FLine[Run + 1] of
+    '=':                               {xor assign}
+      begin
+        Inc(Run, 2);
+        FExtTokenID := xtkXorAssign;
+      end;
+  else                                 {xor}
+    begin
+      Inc(Run);
+      FExtTokenID := xtkXor;
+    end;
+  end;
+end;
+
+procedure TSynHaskellSyn.UnknownProc;
+begin
+  Inc(Run);
+  FTokenID := tkUnknown;
+end;
+
+procedure TSynHaskellSyn.Next;
+begin
+  FAsmStart := False;
+  FTokenPos := Run;
+  case FRange of
+    rsAnsiC, rsAnsiCAsm,
+    rsAnsiCAsmBlock: AnsiCProc;
+  else
+    begin
+      FRange := rsUnknown;
+      case FLine[Run] of
+        '&': AndSymbolProc;
+        #39: AsciiCharProc;
+        '@': AtSymbolProc;
+        '}': BraceCloseProc;
+        '{': BraceOpenProc;
+        #13: CRProc;
+        ':': ColonProc;
+        ',': CommaProc;
+        '=': EqualProc;
+        '>': GreaterProc;
+        '?': QuestionProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        #10: LFProc;
+        '<': LowerProc;
+        '-': MinusProc;
+        '%': ModSymbolProc;
+        '!': NotSymbolProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '|': OrSymbolProc;
+        '+': PlusProc;
+        '.': PointProc;
+        ')': RoundCloseProc;
+        '(': RoundOpenProc;
+        ';': SemiColonProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        ']': SquareCloseProc;
+        '[': SquareOpenProc;
+        '*': StarProc;
+        #34: StringProc;
+        '~': TildeProc;
+        '^': XOrSymbolProc;
+        else UnknownProc;
+      end;
+    end;
+  end;
+  inherited;
+end;
+
+function TSynHaskellSyn.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 TSynHaskellSyn.GetEol: Boolean;
+begin
+  Result := Run = FLineLen + 1;
+end;
+
+function TSynHaskellSyn.GetRange: Pointer;
+begin
+  Result := Pointer(FRange);
+end;
+
+function TSynHaskellSyn.GetTokenID: TtkTokenKind;
+begin
+  Result := FTokenID;
+end;
+
+function TSynHaskellSyn.GetExtTokenID: TxtkTokenKind;
+begin
+  Result := FExtTokenID;
+end;
+
+function TSynHaskellSyn.GetTokenAttribute: TSynHighlighterAttributes;
+begin
+  case FTokenID of
+    tkComment: Result := FCommentAttri;
+    tkIdentifier: Result := FIdentifierAttri;
+    tkKey: Result := FKeyAttri;
+    tkNumber: Result := FNumberAttri;
+    tkSpace: Result := FSpaceAttri;
+    tkString: Result := FStringAttri;
+    tkSymbol: Result := FSymbolAttri;
+    else Result := nil;
+  end;
+end;
+
+function TSynHaskellSyn.GetTokenKind: Integer;
+begin
+  Result := Ord(GetTokenID);
+end;
+
+procedure TSynHaskellSyn.ResetRange;
+begin
+  FRange:= rsUnknown;
+end;
+
+procedure TSynHaskellSyn.SetRange(Value: Pointer);
+begin
+  FRange := TRangeState(Value);
+end;
+
+procedure TSynHaskellSyn.EnumUserSettings(settings: TStrings);
+begin
+  { returns the user settings that exist in the registry }
+  with TBetterRegistry.Create do
+  begin
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+      if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then
+      begin
+        try
+          GetKeyNames(settings);
+        finally
+          CloseKey;
+        end;
+      end;
+    finally
+      Free;
+    end;
+  end;
+end;
+
+function TSynHaskellSyn.IsFilterStored: Boolean;
+begin
+  Result := FDefaultFilter <> SYNS_FilterHaskell;
+end;
+
+function TSynHaskellSyn.IsIdentChar(AChar: WideChar): Boolean;
+begin
+  case AChar of
+    '_', '0'..'9', 'a'..'z', 'A'..'Z', #39:
+      Result := True;
+    else
+      Result := False;
+  end;
+end;
+
+class function TSynHaskellSyn.GetLanguageName: string;
+begin
+  Result := SYNS_LangHaskell;
+end;
+
+class function TSynHaskellSyn.GetCapabilities: TSynHighlighterCapabilities;
+begin
+  Result := inherited GetCapabilities + [hcUserSettings];
+end;
+
+function TSynHaskellSyn.GetSampleSource: UnicodeString;
+begin
+  Result :=
+    '-- Haskell Sample Source'#13#10 +
+    'tail :: [a] -> [a]'#13#10 +
+    'tail (x:xs) = xs'#13#10 +
+    '';
+end;
+
+class function TSynHaskellSyn.GetFriendlyLanguageName: UnicodeString;
+begin
+  Result := SYNS_FriendlyLangHaskell;
+end;
+
+initialization
+{$IFNDEF SYN_CPPB_1}
+  RegisterPlaceableHighlighter(TSynHaskellSyn);
+{$ENDIF}
+end.
diff --git a/Source/VCL/SynEdit/Source/SynHighlighterHtml.pas b/Source/VCL/SynEdit/Source/SynHighlighterHtml.pas
index 471c5eb0..76dc679b 100644
--- a/Source/VCL/SynEdit/Source/SynHighlighterHtml.pas
+++ b/Source/VCL/SynEdit/Source/SynHighlighterHtml.pas
@@ -1,1216 +1,1225 @@
-{-------------------------------------------------------------------------------
-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.
-
-The Original Code is: SynHighlighterHTML.pas, released 2000-04-10.
-The Original Code is based on the hkHTMLSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Hideo Koiso.
-Unicode translation by Maël Hörz.
-HTML5 tags added by CodehunterWorks
-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.
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides an HTML highlighter for SynEdit)
-@author(Hideo Koiso, converted to SynEdit by Michael Hieke)
-@created(1999-11-02, converted to SynEdit 2000-04-10)
-@lastmod(2012-09-13)
-The SynHighlighterHTML unit provides SynEdit with an HTML highlighter.
-}
-
-unit SynHighlighterHtml;
-
-interface
-
-{$I SynEdit.inc}
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-const
-  MAX_ESCAPEAMPS = 249;
-
-  EscapeAmps: array[0..MAX_ESCAPEAMPS - 1] of PWideChar = (
-    ('Α'),         { ?        }  { greek capital alpha }
-    ('Β'),          { ?        }  { greek capital beta }
-    ('Γ'),         { G        }  { greek capital gamma }
-    ('Δ'),         { ?        }  { greek capital delta }
-    ('Ε'),       { ?        }  { greek capital epsilon }
-    ('Ζ'),          { ?        }  { greek capital zeta }
-    ('Η'),           { ?        }  { greek capital eta }
-    ('Θ'),         { T        }  { greek capital theta }
-    ('Ι'),          { ?        }  { greek capital iota }
-    ('Κ'),         { ?        }  { greek capital kappa }
-    ('Λ'),        { ?        }  { greek capital lambda }
-    ('Μ'),            { ?        }  { greek capital mu }
-    ('Ν'),            { ?        }  { greek capital nu }
-    ('Ξ'),            { ?        }  { greek capital xi }
-    ('Ο'),       { ?        }  { greek capital omicron }
-    ('Π'),            { ?        }  { greek capital pi }
-    ('Ρ'),           { ?        }  { greek capital rho }
-    ('Σ'),         { S        }  { greek capital sigma }
-    ('Τ'),           { ?        }  { greek capital tau }
-    ('Υ'),       { ?        }  { greek capital upsilon }
-    ('Φ'),           { F        }  { greek capital phi }
-    ('Χ'),           { ?        }  { greek capital chi }
-    ('Ψ'),           { ?        }  { greek capital psi }
-    ('Ω'),         { O        }  { greek capital omega }
-    ('α'),         { a        }  { greek small alpha }
-    ('β'),          { ß        }  { greek small beta }
-    ('γ'),         { ?        }  { greek small gamma }
-    ('δ'),         { d        }  { greek small delta }
-    ('ε'),       { e        }  { greek small epsilon }
-    ('ζ'),          { ?        }  { greek small zeta }
-    ('η'),           { ?        }  { greek small eta }
-    ('θ'),         { ?        }  { greek small theta }
-    ('ι'),          { ?        }  { greek small iota }
-    ('κ'),         { ?        }  { greek small kappa }
-    ('λ'),        { ?        }  { greek small lambda }
-    ('μ'),            { µ        }  { greek small mu }
-    ('ν'),            { ?        }  { greek small nu }
-    ('ξ'),            { ?        }  { greek small xi }
-    ('ο'),       { ?        }  { greek small omicron }
-    ('π'),            { p        }  { greek small pi }
-    ('ρ'),           { ?        }  { greek small rho }
-    ('ς'),        { ?        }  { greek small final sigma }
-    ('σ'),         { s        }  { greek small sigma }
-    ('τ'),           { t        }  { greek small tau }
-    ('υ'),       { ?        }  { greek small upsilon }
-    ('φ'),           { f        }  { greek small phi }
-    ('χ'),           { ?        }  { greek small chi }
-    ('ψ'),           { ?        }  { greek small psi }
-    ('ω'),         { ?        }  { greek small omega }
-    ('ϑ'),      { ?        }  { greek small theta symbol }
-    ('ϒ'),         { ?        }  { greek upsilon with hook symbol }
-    ('ϖ'),           { ?        }  { greek pi symbol }
-    ('•'),          { •        }  { bullet }
-    ('…'),        { …        }  { horizontal ellipsis }
-    ('′'),         { '        }  { prime }
-    ('″'),         { "        }  { double prime }
-    ('‾'),         { ?        }  { overline, = spacing overscore }
-    ('⁄'),         { /        }  { fraction slash }
-    ('℘'),        { P        }  { script capital P }
-    ('ℑ'),         { I        }  { imaginary part }
-    ('ℜ'),          { R        }  { real part }
-    ('™'),         { ™        }  { trademark sign }
-    ('ℵ'),       { ?        }  { first transfinite cardinal }
-    ('←'),          { ?        }  { leftwards arrow }
-    ('↑'),          { ?        }  { upwards arrow }
-    ('→'),          { ?        }  { rightwards arrow }
-    ('↓'),          { ?        }  { downwards arrow }
-    ('↔'),          { ?        }  { left right arrow }
-    ('↵'),         { ?        }  { carriage return arrow }
-    ('⇐'),          { ?        }  { leftwards double arrow }
-    ('⇑'),          { ?        }  { upwards double arrow }
-    ('⇒'),          { ?        }  { rightwards double arrow }
-    ('⇓'),          { ?        }  { downwards double arrow }
-    ('⇔'),          { ?        }  { left right double arrow }
-    ('∀'),        { ?        }  { for all }
-    ('∂'),          { ?        }  { partial differential }
-    ('∃'),         { ?        }  { there exists }
-    ('∅'),         { Ø        }  { empty set }
-    ('∇'),         { ?        }  { backward difference }
-    ('∈'),          { ?        }  { element of }
-    ('∉'),         { ?        }  { not an element of }
-    ('∋'),            { ?        }  { contains as member }
-    ('∏'),          { ?        }  { n-ary product }
-    ('∑'),           { ?        }  { n-ary sumation }
-    ('−'),         { -        }  { minus sign }
-    ('∗'),        { *        }  { asterisk operator }
-    ('√'),         { v        }  { square root }
-    ('∝'),          { ?        }  { proportional to }
-    ('∞'),         { 8        }  { infinity }
-    ('∠'),           { ?        }  { angle }
-    ('∧'),           { ?        }  { logical and }
-    ('∨'),            { ?        }  { logical or }
-    ('∩'),           { n        }  { intersection }
-    ('∪'),           { ?        }  { union }
-    ('∫'),           { ?        }  { integral }
-    ('∴'),        { ?        }  { therefore }
-    ('∼'),           { ~        }  { similar to = tilde operator }
-    ('≅'),          { ?        }  { approximately equal to }
-    ('≈'),         { ˜        }  { almost euqal to }
-    ('≠'),            { ?        }  { not equal to }
-    ('≡'),         { =        }  { identical to }
-    ('≤'),            { =        }  { less-than or equal to }
-    ('≥'),            { =        }  { greater-than or equal to }
-    ('⊂'),           { ?        }  { subset of }
-    ('⊃'),           { ?        }  { superset of }
-    ('⊄'),          { ?        }  { not a subset of }
-    ('⊆'),          { ?        }  { subset of or equal to }
-    ('⊇'),          { ?        }  { superset of or equal to }
-    ('⊕'),         { ?        }  { circled plus }
-    ('⊗'),        { ?        }  { circled times }
-    ('⊥'),          { ?        }  { orthogonal to = perpendicular }
-    ('⋅'),          { ·        }  { dot operator }
-    ('⌈'),         { ?        }  { left ceiling }
-    ('⌉'),         { ?        }  { right ceiling }
-    ('⌊'),        { ?        }  { left floor }
-    ('⌋'),        { ?        }  { right floor }
-    ('⟨'),          { <        }  { left-pointing angle bracket }
-    ('⟩'),          { >        }  { right-pointing angle bracket }
-    ('◊'),           { ?        }  { lozenge }
-    ('♠'),        { ?        }  { black spade suit }
-    ('♣'),         { ?        }  { black club suit }
-    ('♥'),        { ?        }  { black heart suit }
-    ('♦'),         { ?        }  { black diamond suit }
-    ('‘'),         { ‘        }  { left single quote  }
-    ('’'),         { ’        }  { right single quote }
-    ('‚'),         { ‚        }  { single low-9 quote }
-    ('“'),         { “        }  { left double quote }
-    ('”'),         { ”        }  { right double quote }
-    ('„'),         { „        }  { double low-9 quote }
-    ('†'),        { †        }  { dagger }
-    ('‡'),        { ‡        }  { double dagger }
-    ('‰'),        { ‰        }  { per mill sign }
-    ('‹'),        { ‹        }  { single left-pointing angle quote }
-    ('›'),        { ›        }  { single right-pointing angle quote }
-    ('"'),          { " " }  { double quotation mark }
-    ('&'),           { & & }  { ampersand }
-    ('<'),            { < < }  { less-than sign }
-    ('>'),            { >        }  { greater-than sign }
-    ('–'),         { – – }  { en dash }
-    ('—'),         { — — }  { em dash }
-    (' '),          {     }  { nonbreaking space }
-    (' '),        {          }  { thin space }
-    (' '),          {          }  { en space }
-    (' '),          {          }  { em space }
-    ('¡'),         { ¡ ! }  { inverted exclamation }
-    ('¢'),          { ¢ c }  { cent sign }
-    ('£'),         { £ L }  { pound sterling }
-    ('¤'),        { ¤ ¤ }  { general currency sign }
-    ('¥'),           { ¥ Y }  { yen sign }
-    ('¦'),        { ¦ ¦ }  { broken vertical bar }
-    ('&brkbar;'),        { ¦ ¦ }  { broken vertical bar }
-    ('§'),          { § § }  { section sign }
-    ('¨'),           { ¨ ¨ }  { umlaut }
-    ('¨'),           { ¨ ¨ }  { umlaut }
-    ('©'),          { © © }  { copyright }
-    ('ª'),          { ª a }  { feminine ordinal }
-    ('«'),         { « « }  { left angle quote }
-    ('¬'),           { ¬ ¬ }  { not sign }
-    ('­'),           { ­ ­ }  { soft hyphen }
-    ('®'),           { ® ® }  { registered trademark }
-    ('¯'),          { ¯ — }  { macron accent }
-    ('&hibar;'),         { ¯ — }  { macron accent }
-    ('°'),           { ° ° }  { degree sign }
-    ('±'),        { ± ± }  { plus or minus }
-    ('²'),          { ² 2 }  { superscript two }
-    ('³'),          { ³ 3 }  { superscript three }
-    ('´'),         { ´ ´ }  { acute accent }
-    ('µ'),         { µ µ }  { micro sign }
-    ('¶'),          { ¶ ¶ }  { paragraph sign }
-    ('·'),        { · · }  { middle dot }
-    ('¸'),         { ¸ ¸ }  { cedilla }
-    ('¹'),          { ¹ 1 }  { superscript one }
-    ('º'),          { º o }  { masculine ordinal }
-    ('»'),         { » » }  { right angle quote }
-    ('¼'),        { ¼ 1 }  { one-fourth }
-    ('½'),        { ½ 1 }  { one-half }
-    ('¾'),        { ¾ 3 }  { three-fourths }
-    ('¿'),        { ¿ ? }  { inverted question mark }
-    ('À'),        { À A }  { uppercase A, grave accent }
-    ('Á'),        { Á Á }  { uppercase A, acute accent }
-    ('Â'),         { Â Â }  { uppercase A, circumflex accent }
-    ('Ã'),        { Ã A }  { uppercase A, tilde }
-    ('Ä'),          { Ä Ä }  { uppercase A, umlaut }
-    ('Å'),         { Å A }  { uppercase A, ring }
-    ('Æ'),         { Æ A }  { uppercase AE }
-    ('Ç'),        { Ç Ç }  { uppercase C, cedilla }
-    ('È'),        { È E }  { uppercase E, grave accent }
-    ('É'),        { É É }  { uppercase E, acute accent }
-    ('Ê'),         { Ê E }  { uppercase E, circumflex accent }
-    ('Ë'),          { Ë Ë }  { uppercase E, umlaut }
-    ('Ì'),        { Ì I }  { uppercase I, grave accent }
-    ('Í'),        { Í Í }  { uppercase I, acute accent }
-    ('Î'),         { Î Î }  { uppercase I, circumflex accent }
-    ('Ï'),          { Ï I }  { uppercase I, umlaut }
-    ('Ð'),           { Ð ? }  { uppercase Eth, Icelandic }
-    ('Ñ'),        { Ñ N }  { uppercase N, tilde }
-    ('Ò'),        { Ò O }  { uppercase O, grave accent }
-    ('Ó'),        { Ó Ó }  { uppercase O, acute accent }
-    ('Ô'),         { Ô Ô }  { uppercase O, circumflex accent }
-    ('Õ'),        { Õ O }  { uppercase O, tilde }
-    ('Ö'),          { Ö Ö }  { uppercase O, umlaut }
-    ('×'),         { × × }  { multiplication sign }
-    ('Ø'),        { Ø O }  { uppercase O, slash }
-    ('Ù'),        { Ù U }  { uppercase U, grave accent }
-    ('Ú'),        { Ú Ú }  { uppercase U, acute accent }
-    ('Û'),         { Û U }  { uppercase U, circumflex accent }
-    ('Ü'),          { Ü Ü }  { uppercase U, umlaut }
-    ('Ý'),        { Ý Ý }  { uppercase Y, acute accent }
-    ('Þ'),         { Þ ? }  { uppercase THORN, Icelandic }
-    ('ß'),         { ß ß }  { lowercase sharps, German }
-    ('à'),        { à à }  { lowercase a, grave accent }
-    ('á'),        { á á }  { lowercase a, acute accent }
-    ('â'),         { â â }  { lowercase a, circumflex accent }
-    ('ã'),        { ã ã }  { lowercase a, tilde }
-    ('ä'),          { ä ä }  { lowercase a, umlaut }
-    ('å'),         { å å }  { lowercase a, ring }
-    ('æ'),         { æ a }  { lowercase ae }
-    ('ç'),        { ç ç }  { lowercase c, cedilla }
-    ('è'),        { è e }  { lowercase e, grave accent }
-    ('é'),        { é é }  { lowercase e, acute accent }
-    ('ê'),         { ê ê }  { lowercase e, circumflex accent }
-    ('ë'),          { ë ë }  { lowercase e, umlaut }
-    ('ì'),        { ì i }  { lowercase i, grave accent }
-    ('í'),        { í í }  { lowercase i, acute accent }
-    ('î'),         { î î }  { lowercase i, circumflex accent }
-    ('ï'),          { ï i }  { lowercase i, umlaut }
-    ('ð'),           { ð ? }  { lowercase eth, Icelandic }
-    ('ñ'),        { ñ ñ }  { lowercase n, tilde }
-    ('ò'),        { ò o }  { lowercase o, grave accent }
-    ('ó'),        { ó ó }  { lowercase o, acute accent }
-    ('ô'),         { ô ô }  { lowercase o, circumflex accent }
-    ('õ'),        { õ o }  { lowercase o, tilde }
-    ('ö'),          { ö ö }  { lowercase o, umlaut }
-    ('÷'),        { ÷ ÷ }  { division sign }
-    ('ø'),        { ø o }  { lowercase o, slash }
-    ('ù'),        { ù u }  { lowercase u, grave accent }
-    ('ú'),        { ú ú }  { lowercase u, acute accent }
-    ('û'),         { û u }  { lowercase u, circumflex accent }
-    ('ü'),          { ü ü }  { lowercase u, umlaut }
-    ('ý'),        { ý ý }  { lowercase y, acute accent }
-    ('þ'),         { þ ? }  { lowercase thorn, Icelandic }
-    ('ÿ'),          { ÿ y }  { lowercase y, umlaut }
-    ('€'),          { €        }  { euro sign }
-    ('Œ'),         { Œ        }  { capital ligature OE }
-    ('œ'),         { œ        }  { small ligature oe }
-    ('š'),        { š        }  { small S with caron }
-    ('Š'),        { Š        }  { capital S with caron }
-    ('ƒ'),          { ƒ        }  { function }
-    ('ˆ')           { ˆ        }  { circumflex accent }
-  );
-
-
-type
-  TtkTokenKind = (tkAmpersand, tkComment, tkIdentifier, tkKey, tkNull,
-    tkSpace, tkSymbol, tkText, tkUndefKey, tkValue);
-
-  TRangeState = (rsAmpersand, rsComment, rsKey, rsParam, rsText,
-    rsUnKnown, rsValue, rsQuoteValue, rsDoubleQuoteValue);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-  TSynHTMLSyn = class(TSynCustomHighlighter)
-  private
-    fAndCode: Integer;
-    fRange: TRangeState;
-//    fIdentFuncTable: array[0..1542] of TIdentFuncTableFunc;
-    fIdentFuncTable: array[0..2178] of TIdentFuncTableFunc;
-    fTokenID: TtkTokenKind;
-    fAndAttri: TSynHighlighterAttributes;
-    fCommentAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    fTextAttri: TSynHighlighterAttributes;
-    fUndefKeyAttri: TSynHighlighterAttributes;
-    fValueAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure TextProc;
-    procedure CommentProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure EqualProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure AmpersandProc;
-  protected
-    function GetSampleSource: string; override;
-    function IsFilterStored: Boolean; override;
-    procedure NextProcedure;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: string; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-  published
-    property AndAttri: TSynHighlighterAttributes read fAndAttri write fAndAttri;
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
-      write fCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
-      write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
-      write fSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
-      write fSymbolAttri;
-    property TextAttri: TSynHighlighterAttributes read fTextAttri
-      write fTextAttri;
-    property UndefKeyAttri: TSynHighlighterAttributes read fUndefKeyAttri
-      write fUndefKeyAttri;
-    property ValueAttri: TSynHighlighterAttributes read fValueAttri
-      write fValueAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-//  KeyWords: array[0..201] of string = (
-//    '!doctype', '/a', '/abbr', '/acronym', '/address', '/applet', '/b', '/bdo',
-//    '/big', '/blink', '/blockquote', '/body', '/button', '/caption', '/center',
-//    '/cite', '/code', '/colgroup', '/comment', '/dd', '/del', '/dfn', '/dir',
-//    '/div', '/dl', '/dt', '/em', '/embed', '/fieldset', '/font', '/form',
-//    '/frameset', '/h1', '/h2', '/h3', '/h4', '/h5', '/h6', '/head', '/html',
-//    '/i', '/iframe', '/ilayer', '/ins', '/kbd', '/label', '/layer', '/legend',
-//    '/li', '/listing', '/map', '/marquee', '/menu', '/multicol', '/nobr',
-//    '/noembed', '/noframes', '/nolayer', '/noscript', '/object', '/ol',
-//    '/optgroup', '/option', '/p', '/pre', '/q', '/s', '/samp', '/script',
-//    '/select', '/server', '/small', '/span', '/strike', '/strong', '/style',
-//    '/sub', '/sup', '/table', '/tbody', '/td', '/textarea', '/tfoot', '/th',
-//    '/thead', '/title', '/tr', '/tt', '/u', '/ul', '/var', '/xmp', 'a', 'abbr',
-//    'acronym', 'address', 'applet', 'area', 'b', 'base', 'basefont', 'bdo',
-//    'bgsound', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'caption',
-//    'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'dd', 'del', 'dfn',
-//    'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'font', 'form',
-//    'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr',
-//    'html', 'i', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'kbd',
-//    'keygen', 'label', 'layer', 'legend', 'li', 'link', 'listing', 'map',
-//    'marquee', 'menu', 'meta', 'multicol', 'nextid', 'nobr', 'noembed',
-//    'noframes', 'nolayer', 'noscript', 'object', 'ol', 'optgroup', 'option',
-//    'p', 'param', 'plaintext', 'pre', 'q', 's', 'samp', 'script', 'select',
-//    'server', 'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub',
-//    'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title',
-//    'tr', 'tt', 'u', 'ul', 'var', 'wbr', 'xmp'
-//  );
-//
-//  KeyIndices: array[0..1542] of Integer = (
-//    -1, -1, 182, -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, 33, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, 137, 189, -1, -1,
-//    -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, -1, -1, 52, 170, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, 5, 55, -1, 83, -1, -1, 34, -1, 198, -1, -1, -1,
-//    -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, 74, 111, -1, 62, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, 35, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130,
-//    190, -1, 117, -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, 36, -1, -1, 157, -1, -1, -1,
-//    -1, -1, 13, 114, -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, 21, -1, -1,
-//    -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1,
-//    -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1,
-//    132, 103, -1, -1, -1, 199, -1, -1, -1, -1, -1, -1, -1, 129, -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, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, 54,
-//    -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1,
-//    148, -1, -1, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, 134,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 183, -1, -1, 168, -1, 45,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, 63, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, 4, -1, -1, 39, -1, -1, -1, -1, 128, 20, -1, -1, 51, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    180, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107,
-//    -1, -1, -1, -1, 66, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, 8, -1, -1, -1, -1, -1, -1, 166, -1,
-//    -1, -1, 169, 141, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, -1,
-//    -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, 19, -1, -1, 41, -1, 173, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, 88, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186,
-//    -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1,
-//    -1, -1, 87, 181, -1, -1, -1, -1, 119, -1, -1, -1, 57, -1, -1, -1, 104, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, 26, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, 201, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    58, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, 101,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, 113, 187, -1, -1,
-//    -1, 94, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
-//    -1, -1, 167, -1, -1, 163, -1, -1, 197, -1, -1, -1, -1, 78, -1, 68, -1, -1,
-//    -1, -1, -1, -1, 145, -1, -1, 196, -1, -1, -1, -1, 12, -1, -1, -1, 160, -1,
-//    61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123,
-//    -1, -1, -1, -1, -1, -1, 76, 120, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, 10, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1,
-//    -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, 171,
-//    -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    22, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    24, -1, 70, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, 177, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -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,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1,
-//    -1, 121, 159, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, 149, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, 81, 2, -1, 110, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    178, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, 143, -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, -1, -1, -1, 164, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, 9,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, 6, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, 73, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64,
-//    79, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, 18, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, 184, -1, -1, -1, 175, -1, -1, 193, -1, 92, 151, 154, -1, -1, -1, -1,
-//    106, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, -1, -1, -1, -1, -1,
-//    -1, 75, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1,
-//    -1, -1, 98, -1, 80, -1, -1, -1, 85, -1, -1, -1, -1, 67, -1, 118, -1, -1, -1,
-//    -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, 77, -1, -1, 122, 44, -1, -1,
-//    -1, -1, -1, 89, -1, -1, -1, 115, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1,
-//    16, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-//    158, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91,
-//    -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-//  );
-
-  KeyWords: array[0..256] of string = (
-    '!doctype', '/!doctype', '/a', '/abbr', '/acronym', '/address', '/applet',
-    '/area', '/article', '/aside', '/audio', '/b', '/base', '/basefont', '/bb',
-    '/bdo', '/big', '/blockquote', '/body', '/button', '/canvas', '/caption',
-    '/center', '/cite', '/code', '/col', '/colgroup', '/command', '/datalist',
-    '/dd', '/del', '/details', '/dfn', '/dialog', '/dir', '/div', '/dl', '/dt',
-    '/em', '/embed', '/fieldset', '/figcaption', '/figure', '/font', '/footer',
-    '/form', '/frame', '/frameset', '/h1', '/h2', '/h3', '/h4', '/h5', '/h6',
-    '/head', '/header', '/hgroup', '/html', '/i', '/iframe', '/img', '/input',
-    '/ins', '/kbd', '/keygen', '/label', '/layer', '/legend', '/li', '/link',
-    '/map', '/mark', '/marquee', '/menu', '/meta', '/meter', '/multicol',
-    '/nav', '/nobr', '/noembed', '/noframes', '/nolayer', '/noscript',
-    '/object', '/ol', '/optgroup', '/option', '/output', '/p', '/param', '/pre',
-    '/progress', '/q', '/rp', '/rt', '/ruby', '/s', '/samp', '/script',
-    '/section', '/select', '/server', '/small', '/source', '/span', '/strike',
-    '/strong', '/style', '/sub', '/summary', '/sup', '/table', '/tbody', '/td',
-    '/textarea', '/tfoot', '/th', '/thead', '/time', '/title', '/tr', '/track',
-    '/tt', '/u', '/ul', '/var', '/video', '/wbr', '/xmp', 'a', 'abbr',
-    'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b',
-    'base', 'basefont', 'bb', 'bdo', 'big', 'blockquote', 'body', 'button',
-    'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command',
-    'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl',
-    'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer',
-    'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head',
-    'header', 'hgroup', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd',
-    'keygen', 'label', 'layer', 'legend', 'li', 'link', 'map', 'mark',
-    'marquee', 'menu', 'meta', 'meter', 'multicol', 'nav', 'nobr', 'noembed',
-    'noframes', 'nolayer', 'noscript', 'object', 'ol', 'optgroup', 'option',
-    'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's',
-    'samp', 'script', 'section', 'select', 'server', 'small', 'source', 'span',
-    'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'synedit', 'table',
-    'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr',
-    'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'xmp'
-  );
-
-  KeyIndices: array[0..2178] of Integer = (
-    -1, -1, -1, 3, -1, -1, 231, 250, -1, -1, -1, 212, -1, -1, -1, -1, -1, -1,
-    -1, -1, 175, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, 155, -1, -1, -1, -1,
-    -1, -1, -1, 83, -1, 201, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 48, -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, 70, -1, -1, -1, -1, -1, -1, 183, -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, -1, -1, 216, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1,
-    -1, 89, -1, -1, -1, 234, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, 107,
-    -1, -1, 61, -1, -1, -1, -1, -1, 21, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 225, -1, -1, 150, -1, -1, 91, -1, -1, -1, 88, -1,
-    -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
-    -1, -1, 137, 12, -1, 67, -1, -1, 47, -1, -1, -1, -1, -1, 10, -1, -1, 135,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 218, -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,
-    174, -1, 7, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, 133, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, 178, -1, -1, -1, -1, -1,
-    -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, -1, 162,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, 237, -1, -1, -1,
-    17, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    210, -1, -1, -1, 104, -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, 165, -1, -1, -1, -1,
-    -1, -1, -1, 254, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 126, -1, -1,
-    -1, -1, -1, -1, -1, 24, -1, -1, 238, -1, 96, -1, 38, -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, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, 156, -1, 103, -1, -1,
-    -1, -1, -1, -1, -1, -1, 239, 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    111, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, 29, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 71, 84, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, 186, -1,
-    -1, -1, -1, -1, -1, -1, -1, 243, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1,
-    115, -1, -1, -1, -1, -1, -1, 26, 138, -1, -1, -1, -1, -1, -1, -1, 163, -1,
-    -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 181, 22, -1, -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, 36, -1, -1, 240,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
-    153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1,
-    -1, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256,
-    -1, 164, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, 145, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, 197,
-    63, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 202, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 44, -1, 200, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
-    -1, -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, 193, 176, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, 220, -1, -1, -1,
-    141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, 93, 76, -1, -1, 14, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 230, -1, 198, -1,
-    -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, -1, 208, -1, -1, -1,
-    -1, -1, -1, -1, 100, 203, 5, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, 45, 92, -1, -1, -1, -1, 80, 204, -1,
-    -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 132, -1, 249, -1, -1, -1, -1, -1,
-    -1, -1, 82, -1, 16, -1, 121, 86, -1, -1, -1, 224, -1, 195, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 159, -1, -1, 54,
-    -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, 68, -1, -1, -1, -1, -1, -1,
-    252, -1, 233, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1,
-    -1, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, 18, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90,
-    171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, 226, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 246, -1, -1, -1, -1, -1, -1, -1, -1, -1, 196,
-    -1, -1, -1, -1, -1, -1, 199, -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, 6, -1, -1,
-    -1, -1, 0, -1, -1, 229, -1, -1, 228, -1, -1, -1, -1, -1, 215, -1, 125, 102,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 227, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1,
-    -1, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 213, -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, -1, -1, -1, -1,
-    -1, 205, -1, -1, 190, -1, -1, -1, 97, -1, -1, -1, -1, -1, 33, -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, -1, -1, -1, -1, -1, -1, -1, 247, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 55, -1, 19, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1,
-    95, -1, 136, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1,
-    118, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1,
-    -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, 214, -1, 166,
-    60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 147, -1, -1,
-    -1, -1, -1, 15, -1, -1, 167, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, 131,
-    -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, -1,
-    -1, -1, -1, -1, -1, -1, 149, -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, 235, 35, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1,
-    27, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, 30, -1,
-    217, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    182, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, 98, -1, -1, -1, -1, 129,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 180, -1, -1,
-    245, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, 117, -1, 221, -1, -1, -1,
-    -1, -1, 23, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, 1, -1, -1,
-    -1, -1, -1, -1, -1, 113, -1, -1, 134, -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, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, 109, -1, -1, -1,
-    -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 127, -1, -1, -1, 28, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
-    -1, 236, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1
-  );
-
-{$Q-}
-function TSynHTMLSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-//  Result := 0;
-//  while IsIdentChar(Str^) or CharInSet(Str^, ['!', '/']) do
-//  begin
-//    Result := Result * 932 + Ord(Str^) * 46;
-//    inc(Str);
-//  end;
-//  Result := Result mod 1543;
-//  fStringLen := Str - fToIdent;
-
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 627 + Ord(Str^) * 829;
-    inc(Str);
-  end;
-  Result := Result mod 2179;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynHTMLSyn.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 TSynHTMLSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if @fIdentFuncTable[i] = nil then
-      fIdentFuncTable[i] := KeyWordFunc;
-end;
-
-function TSynHTMLSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkUndefKey;
-end;
-
-function TSynHTMLSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkUndefKey;
-end;
-
-constructor TSynHTMLSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  fIdentifierAttri.Style := [fsBold];
-  AddAttribute(fIdentifierAttri);
-
-  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Style := [fsBold];
-  fKeyAttri.Foreground := $00ff0080;
-  AddAttribute(fKeyAttri);
-
-  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  fSymbolAttri.Style := [fsBold];
-  AddAttribute(fSymbolAttri);
-
-  fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
-  AddAttribute(fTextAttri);
-
-  fUndefKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
-  fUndefKeyAttri.Style := [fsBold];
-  fUndefKeyAttri.Foreground := clRed;
-  AddAttribute(fUndefKeyAttri);
-
-  fValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  fValueAttri.Foreground := $00ff8000;
-  AddAttribute(fValueAttri);
-
-  fAndAttri := TSynHighlighterAttributes.Create(SYNS_AttrEscapeAmpersand, SYNS_FriendlyAttrEscapeAmpersand);
-  fAndAttri.Style := [fsBold];
-  fAndAttri.Foreground := $0000ff00;
-  AddAttribute(fAndAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  InitIdent;
-  fRange := rsText;
-  fDefaultFilter := SYNS_FilterHTML;
-  fAndCode := -1;
-end;
-
-procedure TSynHTMLSyn.BraceCloseProc;
-begin
-  fRange := rsText;
-  fTokenId := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynHTMLSyn.CommentProc;
-begin
-  fTokenID := tkComment;
-
-  if IsLineEnd(Run) then
-  begin
-    NextProcedure;
-    Exit;
-  end;
-
-  while not IsLineEnd(Run) do
-  begin
-    if (fLine[Run] = '>') and (fLine[Run - 1] = '-') and (fLine[Run - 2] = '-') then
-    begin
-      fRange := rsText;
-      Inc(Run);
-      break;
-    end;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynHTMLSyn.BraceOpenProc;
-begin
-  Inc(Run);
-  if (fLine[Run] = '!') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '-') then
-  begin
-    fRange := rsComment;
-    fTokenID := tkComment;
-    Inc(Run, 3);
-  end
-  else
-  begin
-    fRange := rsKey;
-    fTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynHTMLSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-  if fLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynHTMLSyn.EqualProc;
-begin
-  fRange := rsValue;
-  fTokenID := tkSymbol;
-  Inc(Run);
-end;
-
-procedure TSynHTMLSyn.IdentProc;
-begin
-  case fRange of
-  rsKey:
-    begin
-      fRange := rsParam;
-      fTokenID := IdentKind((fLine + Run));
-      Inc(Run, fStringLen);
-    end;
-  rsValue:
-    begin
-      fRange := rsParam;
-      fTokenID := tkValue;
-      repeat
-        Inc(Run);
-      until (fLine[Run] <= #32) or (fLine[Run] = '>');
-    end;
-  else
-    fTokenID := tkIdentifier;
-    repeat
-      Inc(Run);
-    until (fLine[Run] <= #32) or (fLine[Run] = '=') or (fLine[Run] = '"') or
-      (fLine[Run] = '>');
-  end;
-end;
-
-procedure TSynHTMLSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynHTMLSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynHTMLSyn.TextProc;
-
-  function IsStopChar: Boolean;
-  begin
-    case fLine[Run] of
-      #0..#31, '<', '&':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-var
-  i: Integer;
-begin
-  if CharInSet(fLine[Run], [#0..#31, '<']) then
-  begin
-    NextProcedure;
-    exit;
-  end;
-
-  fTokenID := tkText;
-
-  while True do
-  begin
-    while not IsStopChar do Inc(Run);
-
-    if (fLine[Run] = '&') then
-    begin
-      if (fLine[Run + 1] = '#') then
-      begin
-        fAndCode := -1;
-        i := Run;
-        inc(Run, 2);
-        if CharInSet(fLine[Run], ['X', 'x']) then
-        begin
-          inc(Run);
-          while IsNumberChar do
-            inc(Run);
-        end
-        else
-          while CharInSet(fLine[Run], ['0'..'9']) do
-            inc(Run);
-        if (fLine[Run] = ';') then
-        begin
-          inc(Run);
-          Run := i;
-          fRange := rsAmpersand;
-        end;
-        break;
-      end
-      else
-        for i := Low(EscapeAmps) To High(EscapeAmps) do
-          if (AnsiStrLComp((fLine + Run), EscapeAmps[i], Length(EscapeAmps[i])) = 0) then
-          begin
-            fAndCode := i;
-            fRange := rsAmpersand;
-            Exit;
-          end;
-
-      Inc(Run);
-    end
-    else
-      Break;
-  end;
-end;
-
-procedure TSynHTMLSyn.AmpersandProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  if fRange <> rsAmpersand then
-  begin
-    if fRange = rsKey then
-    begin
-      Inc(Run);
-      fRange := rsText;
-      fTokenID := tkText;
-    end
-    else
-      IdentProc;
-    Exit;
-  end;
-
-  case fAndCode of
-  Low(EscapeAmps)..High(EscapeAmps):
-    begin
-      fTokenID := tkAmpersand;
-      Inc(Run, Length(EscapeAmps[fAndCode]));
-    end;
-    else begin
-      if (fLine[Run + 1] = '#') then
-      begin
-        fAndCode := -1;
-        inc(Run, 2);
-        if CharInSet(fLine[Run], ['X', 'x']) then
-        begin
-          inc(Run);
-          while IsNumberChar do
-            inc(Run);
-        end
-        else
-          while CharInSet(fLine[Run], ['0'..'9']) do
-            inc(Run);
-        if (fLine[Run] = ';') then begin
-          inc(Run);
-          fTokenID := tkAmpersand;
-        end else
-          fTokenID := tkText;
-      end;
-    end;
-  end;
-  fAndCode := -1;
-  fRange := rsText;
-end;
-
-procedure TSynHTMLSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while fLine[Run] <= #32 do
-  begin
-    if CharInSet(fLine[Run], [#0, #9, #10, #13]) then break;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynHTMLSyn.StringProc;
-var
-  iOpenChar: WideChar;
-begin
-  case fRange of
-    rsQuoteValue:
-      begin
-        iOpenChar := #39;
-        fTokenID := tkValue;
-      end;
-    rsDoubleQuoteValue:
-      begin
-        iOpenChar := '"';
-        fTokenID := tkValue;
-      end;
-    else
-    begin
-      iOpenChar := fLine[Run];
-      if fRange = rsValue then
-      begin
-        if iOpenChar = '"' then
-          fRange := rsDoubleQuoteValue
-        else
-          fRange := rsQuoteValue;
-        fTokenID := tkValue;
-      end else
-      begin
-        IdentProc;
-        Exit;
-      end;
-      Inc(Run); { jumps over the opening char }
-    end;
-  end;
-
-  while not IsLineEnd(Run) do
-  begin
-    if fLine[Run] = iOpenChar then
-    begin
-      Inc(Run);  { jumps over the closing char }
-      if fRange in [rsDoubleQuoteValue, rsQuoteValue] then
-        fRange := rsParam
-      else
-        fRange := rsText;
-      break;
-    end;
-    Inc(Run);
-  end;
-end;
-
-function TSynHTMLSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '_', '/', '0'..'9', 'A'..'Z', 'a'..'z':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-
-procedure TSynHTMLSyn.Next;
-begin
-  fTokenPos := Run;
-  case fRange of
-    rsText:
-      TextProc;
-    rsComment:
-      CommentProc;
-    rsQuoteValue, rsDoubleQuoteValue:
-      if IsLineEnd(Run) then
-        NextProcedure
-      else
-        StringProc;
-    else
-      NextProcedure;
-  end;
-
-  // ensure that one call of Next is enough to reach next token
-  if (fOldRun = Run) and not GetEol then Next;
-
-  inherited;
-end;
-
-procedure TSynHTMLSyn.NextProcedure;
-begin
-  case fLine[Run] of
-    #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '&': AmpersandProc;
-    '"', #39: StringProc;
-    '<': BraceOpenProc;
-    '>': BraceCloseProc;
-    '=': EqualProc;
-    else IdentProc;
-  end;
-end;
-
-function TSynHTMLSyn.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_WHITESPACE: Result := fSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynHTMLSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynHTMLSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynHTMLSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case fTokenID of
-    tkAmpersand: Result := fAndAttri;
-    tkComment: Result := fCommentAttri;
-    tkIdentifier: Result := fIdentifierAttri;
-    tkKey: Result := fKeyAttri;
-    tkSpace: Result := fSpaceAttri;
-    tkSymbol: Result := fSymbolAttri;
-    tkText: Result := fTextAttri;
-    tkUndefKey: Result := fUndefKeyAttri;
-    tkValue: Result := fValueAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynHTMLSyn.GetTokenKind: integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynHTMLSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-procedure TSynHTMLSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-procedure TSynHTMLSyn.ResetRange;
-begin
-  fRange:= rsText;
-end;
-
-function TSynHTMLSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterHTML;
-end;
-
-class function TSynHTMLSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangHTML;
-end;
-
-function TSynHTMLSyn.GetSampleSource: string;
-begin
-  Result := ''#13#10 +
-            #13#10 +
-            ''#13#10 +
-            ''#13#10 +
-            '  
'#13#10 + - ' '#13#10 + - '
'#13#10 + - ' Sample HTML code © 2001'#13#10 + - ''#13#10 + - ''; -end; - -class function TSynHTMLSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangHTML; -end; - -initialization - RegisterPlaceableHighlighter(TSynHTMLSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterHTML.pas, released 2000-04-10. +The Original Code is based on the hkHTMLSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Hideo Koiso. +Unicode translation by Maël Hörz. +HTML5 tags added by CodehunterWorks +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: SynHighlighterHtml.pas,v 1.24.3 2012/09/13 12:05:00 codehunterworks Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides an HTML highlighter for SynEdit) +@author(Hideo Koiso, converted to SynEdit by Michael Hieke) +@created(1999-11-02, converted to SynEdit 2000-04-10) +@lastmod(2012-09-13) +The SynHighlighterHTML unit provides SynEdit with an HTML highlighter. +} + +unit SynHighlighterHtml; + +interface + +{$I SynEdit.inc} + +uses +{$IFDEF UNICODE} + WideStrUtils, +{$ENDIF} + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +const + MAX_ESCAPEAMPS = 249; + + EscapeAmps: array[0..MAX_ESCAPEAMPS - 1] of PWideChar = ( + ('Α'), { ? } { greek capital alpha } + ('Β'), { ? } { greek capital beta } + ('Γ'), { G } { greek capital gamma } + ('Δ'), { ? } { greek capital delta } + ('Ε'), { ? } { greek capital epsilon } + ('Ζ'), { ? } { greek capital zeta } + ('Η'), { ? } { greek capital eta } + ('Θ'), { T } { greek capital theta } + ('Ι'), { ? } { greek capital iota } + ('Κ'), { ? } { greek capital kappa } + ('Λ'), { ? } { greek capital lambda } + ('Μ'), { ? } { greek capital mu } + ('Ν'), { ? } { greek capital nu } + ('Ξ'), { ? } { greek capital xi } + ('Ο'), { ? } { greek capital omicron } + ('Π'), { ? } { greek capital pi } + ('Ρ'), { ? } { greek capital rho } + ('Σ'), { S } { greek capital sigma } + ('Τ'), { ? } { greek capital tau } + ('Υ'), { ? } { greek capital upsilon } + ('Φ'), { F } { greek capital phi } + ('Χ'), { ? } { greek capital chi } + ('Ψ'), { ? } { greek capital psi } + ('Ω'), { O } { greek capital omega } + ('α'), { a } { greek small alpha } + ('β'), { ß } { greek small beta } + ('γ'), { ? } { greek small gamma } + ('δ'), { d } { greek small delta } + ('ε'), { e } { greek small epsilon } + ('ζ'), { ? } { greek small zeta } + ('η'), { ? } { greek small eta } + ('θ'), { ? } { greek small theta } + ('ι'), { ? } { greek small iota } + ('κ'), { ? } { greek small kappa } + ('λ'), { ? } { greek small lambda } + ('μ'), { µ } { greek small mu } + ('ν'), { ? } { greek small nu } + ('ξ'), { ? } { greek small xi } + ('ο'), { ? } { greek small omicron } + ('π'), { p } { greek small pi } + ('ρ'), { ? } { greek small rho } + ('ς'), { ? } { greek small final sigma } + ('σ'), { s } { greek small sigma } + ('τ'), { t } { greek small tau } + ('υ'), { ? } { greek small upsilon } + ('φ'), { f } { greek small phi } + ('χ'), { ? } { greek small chi } + ('ψ'), { ? } { greek small psi } + ('ω'), { ? } { greek small omega } + ('ϑ'), { ? } { greek small theta symbol } + ('ϒ'), { ? } { greek upsilon with hook symbol } + ('ϖ'), { ? } { greek pi symbol } + ('•'), { • } { bullet } + ('…'), { … } { horizontal ellipsis } + ('′'), { ' } { prime } + ('″'), { " } { double prime } + ('‾'), { ? } { overline, = spacing overscore } + ('⁄'), { / } { fraction slash } + ('℘'), { P } { script capital P } + ('ℑ'), { I } { imaginary part } + ('ℜ'), { R } { real part } + ('™'), { ™ } { trademark sign } + ('ℵ'), { ? } { first transfinite cardinal } + ('←'), { ? } { leftwards arrow } + ('↑'), { ? } { upwards arrow } + ('→'), { ? } { rightwards arrow } + ('↓'), { ? } { downwards arrow } + ('↔'), { ? } { left right arrow } + ('↵'), { ? } { carriage return arrow } + ('⇐'), { ? } { leftwards double arrow } + ('⇑'), { ? } { upwards double arrow } + ('⇒'), { ? } { rightwards double arrow } + ('⇓'), { ? } { downwards double arrow } + ('⇔'), { ? } { left right double arrow } + ('∀'), { ? } { for all } + ('∂'), { ? } { partial differential } + ('∃'), { ? } { there exists } + ('∅'), { Ø } { empty set } + ('∇'), { ? } { backward difference } + ('∈'), { ? } { element of } + ('∉'), { ? } { not an element of } + ('∋'), { ? } { contains as member } + ('∏'), { ? } { n-ary product } + ('∑'), { ? } { n-ary sumation } + ('−'), { - } { minus sign } + ('∗'), { * } { asterisk operator } + ('√'), { v } { square root } + ('∝'), { ? } { proportional to } + ('∞'), { 8 } { infinity } + ('∠'), { ? } { angle } + ('∧'), { ? } { logical and } + ('∨'), { ? } { logical or } + ('∩'), { n } { intersection } + ('∪'), { ? } { union } + ('∫'), { ? } { integral } + ('∴'), { ? } { therefore } + ('∼'), { ~ } { similar to = tilde operator } + ('≅'), { ? } { approximately equal to } + ('≈'), { ˜ } { almost euqal to } + ('≠'), { ? } { not equal to } + ('≡'), { = } { identical to } + ('≤'), { = } { less-than or equal to } + ('≥'), { = } { greater-than or equal to } + ('⊂'), { ? } { subset of } + ('⊃'), { ? } { superset of } + ('⊄'), { ? } { not a subset of } + ('⊆'), { ? } { subset of or equal to } + ('⊇'), { ? } { superset of or equal to } + ('⊕'), { ? } { circled plus } + ('⊗'), { ? } { circled times } + ('⊥'), { ? } { orthogonal to = perpendicular } + ('⋅'), { · } { dot operator } + ('⌈'), { ? } { left ceiling } + ('⌉'), { ? } { right ceiling } + ('⌊'), { ? } { left floor } + ('⌋'), { ? } { right floor } + ('⟨'), { < } { left-pointing angle bracket } + ('⟩'), { > } { right-pointing angle bracket } + ('◊'), { ? } { lozenge } + ('♠'), { ? } { black spade suit } + ('♣'), { ? } { black club suit } + ('♥'), { ? } { black heart suit } + ('♦'), { ? } { black diamond suit } + ('‘'), { ‘ } { left single quote } + ('’'), { ’ } { right single quote } + ('‚'), { ‚ } { single low-9 quote } + ('“'), { “ } { left double quote } + ('”'), { ” } { right double quote } + ('„'), { „ } { double low-9 quote } + ('†'), { † } { dagger } + ('‡'), { ‡ } { double dagger } + ('‰'), { ‰ } { per mill sign } + ('‹'), { ‹ } { single left-pointing angle quote } + ('›'), { › } { single right-pointing angle quote } + ('"'), { " " } { double quotation mark } + ('&'), { & & } { ampersand } + ('<'), { < < } { less-than sign } + ('>'), { > } { greater-than sign } + ('–'), { – – } { en dash } + ('—'), { — — } { em dash } + (' '), {   } { nonbreaking space } + (' '), { } { thin space } + (' '), { } { en space } + (' '), { } { em space } + ('¡'), { ¡ ! } { inverted exclamation } + ('¢'), { ¢ c } { cent sign } + ('£'), { £ L } { pound sterling } + ('¤'), { ¤ ¤ } { general currency sign } + ('¥'), { ¥ Y } { yen sign } + ('¦'), { ¦ ¦ } { broken vertical bar } + ('&brkbar;'), { ¦ ¦ } { broken vertical bar } + ('§'), { § § } { section sign } + ('¨'), { ¨ ¨ } { umlaut } + ('¨'), { ¨ ¨ } { umlaut } + ('©'), { © © } { copyright } + ('ª'), { ª a } { feminine ordinal } + ('«'), { « « } { left angle quote } + ('¬'), { ¬ ¬ } { not sign } + ('­'), { ­ ­ } { soft hyphen } + ('®'), { ® ® } { registered trademark } + ('¯'), { ¯ — } { macron accent } + ('&hibar;'), { ¯ — } { macron accent } + ('°'), { ° ° } { degree sign } + ('±'), { ± ± } { plus or minus } + ('²'), { ² 2 } { superscript two } + ('³'), { ³ 3 } { superscript three } + ('´'), { ´ ´ } { acute accent } + ('µ'), { µ µ } { micro sign } + ('¶'), { ¶ ¶ } { paragraph sign } + ('·'), { · · } { middle dot } + ('¸'), { ¸ ¸ } { cedilla } + ('¹'), { ¹ 1 } { superscript one } + ('º'), { º o } { masculine ordinal } + ('»'), { » » } { right angle quote } + ('¼'), { ¼ 1 } { one-fourth } + ('½'), { ½ 1 } { one-half } + ('¾'), { ¾ 3 } { three-fourths } + ('¿'), { ¿ ? } { inverted question mark } + ('À'), { À A } { uppercase A, grave accent } + ('Á'), { Á Á } { uppercase A, acute accent } + ('Â'), {   } { uppercase A, circumflex accent } + ('Ã'), { à A } { uppercase A, tilde } + ('Ä'), { Ä Ä } { uppercase A, umlaut } + ('Å'), { Å A } { uppercase A, ring } + ('Æ'), { Æ A } { uppercase AE } + ('Ç'), { Ç Ç } { uppercase C, cedilla } + ('È'), { È E } { uppercase E, grave accent } + ('É'), { É É } { uppercase E, acute accent } + ('Ê'), { Ê E } { uppercase E, circumflex accent } + ('Ë'), { Ë Ë } { uppercase E, umlaut } + ('Ì'), { Ì I } { uppercase I, grave accent } + ('Í'), { Í Í } { uppercase I, acute accent } + ('Î'), { Î Î } { uppercase I, circumflex accent } + ('Ï'), { Ï I } { uppercase I, umlaut } + ('Ð'), { Ð ? } { uppercase Eth, Icelandic } + ('Ñ'), { Ñ N } { uppercase N, tilde } + ('Ò'), { Ò O } { uppercase O, grave accent } + ('Ó'), { Ó Ó } { uppercase O, acute accent } + ('Ô'), { Ô Ô } { uppercase O, circumflex accent } + ('Õ'), { Õ O } { uppercase O, tilde } + ('Ö'), { Ö Ö } { uppercase O, umlaut } + ('×'), { × × } { multiplication sign } + ('Ø'), { Ø O } { uppercase O, slash } + ('Ù'), { Ù U } { uppercase U, grave accent } + ('Ú'), { Ú Ú } { uppercase U, acute accent } + ('Û'), { Û U } { uppercase U, circumflex accent } + ('Ü'), { Ü Ü } { uppercase U, umlaut } + ('Ý'), { Ý Ý } { uppercase Y, acute accent } + ('Þ'), { Þ ? } { uppercase THORN, Icelandic } + ('ß'), { ß ß } { lowercase sharps, German } + ('à'), { à à } { lowercase a, grave accent } + ('á'), { á á } { lowercase a, acute accent } + ('â'), { â â } { lowercase a, circumflex accent } + ('ã'), { ã ã } { lowercase a, tilde } + ('ä'), { ä ä } { lowercase a, umlaut } + ('å'), { å å } { lowercase a, ring } + ('æ'), { æ a } { lowercase ae } + ('ç'), { ç ç } { lowercase c, cedilla } + ('è'), { è e } { lowercase e, grave accent } + ('é'), { é é } { lowercase e, acute accent } + ('ê'), { ê ê } { lowercase e, circumflex accent } + ('ë'), { ë ë } { lowercase e, umlaut } + ('ì'), { ì i } { lowercase i, grave accent } + ('í'), { í í } { lowercase i, acute accent } + ('î'), { î î } { lowercase i, circumflex accent } + ('ï'), { ï i } { lowercase i, umlaut } + ('ð'), { ð ? } { lowercase eth, Icelandic } + ('ñ'), { ñ ñ } { lowercase n, tilde } + ('ò'), { ò o } { lowercase o, grave accent } + ('ó'), { ó ó } { lowercase o, acute accent } + ('ô'), { ô ô } { lowercase o, circumflex accent } + ('õ'), { õ o } { lowercase o, tilde } + ('ö'), { ö ö } { lowercase o, umlaut } + ('÷'), { ÷ ÷ } { division sign } + ('ø'), { ø o } { lowercase o, slash } + ('ù'), { ù u } { lowercase u, grave accent } + ('ú'), { ú ú } { lowercase u, acute accent } + ('û'), { û u } { lowercase u, circumflex accent } + ('ü'), { ü ü } { lowercase u, umlaut } + ('ý'), { ý ý } { lowercase y, acute accent } + ('þ'), { þ ? } { lowercase thorn, Icelandic } + ('ÿ'), { ÿ y } { lowercase y, umlaut } + ('€'), { € } { euro sign } + ('Œ'), { Œ } { capital ligature OE } + ('œ'), { œ } { small ligature oe } + ('š'), { š } { small S with caron } + ('Š'), { Š } { capital S with caron } + ('ƒ'), { ƒ } { function } + ('ˆ') { ˆ } { circumflex accent } + ); + + +type + TtkTokenKind = (tkAmpersand, tkComment, tkIdentifier, tkKey, tkNull, + tkSpace, tkSymbol, tkText, tkUndefKey, tkValue); + + TRangeState = (rsAmpersand, rsComment, rsKey, rsParam, rsText, + rsUnknown, rsValue, rsQuoteValue, rsDoubleQuoteValue); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynHTMLSyn = class(TSynCustomHighlighter) + private + FAndCode: Integer; + FRange: TRangeState; +// FIdentFuncTable: array[0..1542] of TIdentFuncTableFunc; + FIdentFuncTable: array[0..2178] of TIdentFuncTableFunc; + FTokenID: TtkTokenKind; + FAndAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FTextAttri: TSynHighlighterAttributes; + FUndefKeyAttri: TSynHighlighterAttributes; + FValueAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure TextProc; + procedure CommentProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure EqualProc; + procedure IdentProc; + procedure LFProc; + procedure NullProc; + procedure SpaceProc; + procedure StringProc; + procedure AmpersandProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + procedure NextProcedure; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property AndAttri: TSynHighlighterAttributes read FAndAttri write FAndAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property TextAttri: TSynHighlighterAttributes read FTextAttri + write FTextAttri; + property UndefKeyAttri: TSynHighlighterAttributes read FUndefKeyAttri + write FUndefKeyAttri; + property ValueAttri: TSynHighlighterAttributes read FValueAttri + write FValueAttri; + end; + +implementation + +uses + SynEditStrConst; + +const +// KeyWords: array[0..201] of UnicodeString = ( +// '!doctype', '/a', '/abbr', '/acronym', '/address', '/applet', '/b', '/bdo', +// '/big', '/blink', '/blockquote', '/body', '/button', '/caption', '/center', +// '/cite', '/code', '/colgroup', '/comment', '/dd', '/del', '/dfn', '/dir', +// '/div', '/dl', '/dt', '/em', '/embed', '/fieldset', '/font', '/form', +// '/frameset', '/h1', '/h2', '/h3', '/h4', '/h5', '/h6', '/head', '/html', +// '/i', '/iframe', '/ilayer', '/ins', '/kbd', '/label', '/layer', '/legend', +// '/li', '/listing', '/map', '/marquee', '/menu', '/multicol', '/nobr', +// '/noembed', '/noframes', '/nolayer', '/noscript', '/object', '/ol', +// '/optgroup', '/option', '/p', '/pre', '/q', '/s', '/samp', '/script', +// '/select', '/server', '/small', '/span', '/strike', '/strong', '/style', +// '/sub', '/sup', '/table', '/tbody', '/td', '/textarea', '/tfoot', '/th', +// '/thead', '/title', '/tr', '/tt', '/u', '/ul', '/var', '/xmp', 'a', 'abbr', +// 'acronym', 'address', 'applet', 'area', 'b', 'base', 'basefont', 'bdo', +// 'bgsound', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'caption', +// 'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'dd', 'del', 'dfn', +// 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'font', 'form', +// 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', +// 'html', 'i', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'kbd', +// 'keygen', 'label', 'layer', 'legend', 'li', 'link', 'listing', 'map', +// 'marquee', 'menu', 'meta', 'multicol', 'nextid', 'nobr', 'noembed', +// 'noframes', 'nolayer', 'noscript', 'object', 'ol', 'optgroup', 'option', +// 'p', 'param', 'plaintext', 'pre', 'q', 's', 'samp', 'script', 'select', +// 'server', 'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', +// 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', +// 'tr', 'tt', 'u', 'ul', 'var', 'wbr', 'xmp' +// ); +// +// KeyIndices: array[0..1542] of Integer = ( +// -1, -1, 182, -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, 33, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, 137, 189, -1, -1, +// -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, -1, -1, 52, 170, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, 5, 55, -1, 83, -1, -1, 34, -1, 198, -1, -1, -1, +// -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, 74, 111, -1, 62, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, 35, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, +// 190, -1, 117, -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, 36, -1, -1, 157, -1, -1, -1, +// -1, -1, 13, 114, -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, 21, -1, -1, +// -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, +// -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, +// 132, 103, -1, -1, -1, 199, -1, -1, -1, -1, -1, -1, -1, 129, -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, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, 54, +// -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, +// 148, -1, -1, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, 134, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 183, -1, -1, 168, -1, 45, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, 63, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, 4, -1, -1, 39, -1, -1, -1, -1, 128, 20, -1, -1, 51, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 180, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, +// -1, -1, -1, -1, 66, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, 8, -1, -1, -1, -1, -1, -1, 166, -1, +// -1, -1, 169, 141, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, -1, +// -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, 19, -1, -1, 41, -1, 173, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, 88, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186, +// -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, +// -1, -1, 87, 181, -1, -1, -1, -1, 119, -1, -1, -1, 57, -1, -1, -1, 104, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, 26, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, 201, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 58, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, 101, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, 113, 187, -1, -1, +// -1, 94, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, +// -1, -1, 167, -1, -1, 163, -1, -1, 197, -1, -1, -1, -1, 78, -1, 68, -1, -1, +// -1, -1, -1, -1, 145, -1, -1, 196, -1, -1, -1, -1, 12, -1, -1, -1, 160, -1, +// 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, +// -1, -1, -1, -1, -1, -1, 76, 120, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, 10, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, +// -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, 171, +// -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 22, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 24, -1, 70, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, 177, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -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, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, +// -1, 121, 159, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, 149, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, 81, 2, -1, 110, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 178, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, 143, -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, -1, -1, -1, 164, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, 9, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, 6, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, 73, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, +// 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, 18, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, 184, -1, -1, -1, 175, -1, -1, 193, -1, 92, 151, 154, -1, -1, -1, -1, +// 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, -1, -1, -1, -1, -1, +// -1, 75, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, +// -1, -1, 98, -1, 80, -1, -1, -1, 85, -1, -1, -1, -1, 67, -1, 118, -1, -1, -1, +// -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, 77, -1, -1, 122, 44, -1, -1, +// -1, -1, -1, 89, -1, -1, -1, 115, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1, +// 16, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// 158, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, +// -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +// ); + + KeyWords: array[0..256] of UnicodeString = ( + '!doctype', '/!doctype', '/a', '/abbr', '/acronym', '/address', '/applet', + '/area', '/article', '/aside', '/audio', '/b', '/base', '/basefont', '/bb', + '/bdo', '/big', '/blockquote', '/body', '/button', '/canvas', '/caption', + '/center', '/cite', '/code', '/col', '/colgroup', '/command', '/datalist', + '/dd', '/del', '/details', '/dfn', '/dialog', '/dir', '/div', '/dl', '/dt', + '/em', '/embed', '/fieldset', '/figcaption', '/figure', '/font', '/footer', + '/form', '/frame', '/frameset', '/h1', '/h2', '/h3', '/h4', '/h5', '/h6', + '/head', '/header', '/hgroup', '/html', '/i', '/iframe', '/img', '/input', + '/ins', '/kbd', '/keygen', '/label', '/layer', '/legend', '/li', '/link', + '/map', '/mark', '/marquee', '/menu', '/meta', '/meter', '/multicol', + '/nav', '/nobr', '/noembed', '/noframes', '/nolayer', '/noscript', + '/object', '/ol', '/optgroup', '/option', '/output', '/p', '/param', '/pre', + '/progress', '/q', '/rp', '/rt', '/ruby', '/s', '/samp', '/script', + '/section', '/select', '/server', '/small', '/source', '/span', '/strike', + '/strong', '/style', '/sub', '/summary', '/sup', '/table', '/tbody', '/td', + '/textarea', '/tfoot', '/th', '/thead', '/time', '/title', '/tr', '/track', + '/tt', '/u', '/ul', '/var', '/video', '/wbr', '/xmp', 'a', 'abbr', + 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', + 'base', 'basefont', 'bb', 'bdo', 'big', 'blockquote', 'body', 'button', + 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', + 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', + 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', + 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', + 'header', 'hgroup', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', + 'keygen', 'label', 'layer', 'legend', 'li', 'link', 'map', 'mark', + 'marquee', 'menu', 'meta', 'meter', 'multicol', 'nav', 'nobr', 'noembed', + 'noframes', 'nolayer', 'noscript', 'object', 'ol', 'optgroup', 'option', + 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', + 'samp', 'script', 'section', 'select', 'server', 'small', 'source', 'span', + 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'synedit', 'table', + 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', + 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'xmp' + ); + + KeyIndices: array[0..2178] of Integer = ( + -1, -1, -1, 3, -1, -1, 231, 250, -1, -1, -1, 212, -1, -1, -1, -1, -1, -1, + -1, -1, 175, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, 155, -1, -1, -1, -1, + -1, -1, -1, 83, -1, 201, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 48, -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, 70, -1, -1, -1, -1, -1, -1, 183, -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, -1, -1, 216, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, + -1, 89, -1, -1, -1, 234, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, 107, + -1, -1, 61, -1, -1, -1, -1, -1, 21, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 225, -1, -1, 150, -1, -1, 91, -1, -1, -1, 88, -1, + -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, 137, 12, -1, 67, -1, -1, 47, -1, -1, -1, -1, -1, 10, -1, -1, 135, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 218, -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, + 174, -1, 7, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, 133, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, 178, -1, -1, -1, -1, -1, + -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, -1, 162, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, 237, -1, -1, -1, + 17, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 210, -1, -1, -1, 104, -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, 165, -1, -1, -1, -1, + -1, -1, -1, 254, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 126, -1, -1, + -1, -1, -1, -1, -1, 24, -1, -1, 238, -1, 96, -1, 38, -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, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, 156, -1, 103, -1, -1, + -1, -1, -1, -1, -1, -1, 239, 211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 111, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, 29, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 71, 84, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, 186, -1, + -1, -1, -1, -1, -1, -1, -1, 243, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, + 115, -1, -1, -1, -1, -1, -1, 26, 138, -1, -1, -1, -1, -1, -1, -1, 163, -1, + -1, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 181, 22, -1, -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, 36, -1, -1, 240, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, + 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, + -1, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, + -1, 164, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, 145, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, 197, + 63, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 202, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 44, -1, 200, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, + -1, -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, 193, 176, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, 220, -1, -1, -1, + 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, 93, 76, -1, -1, 14, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 230, -1, 198, -1, + -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, -1, 208, -1, -1, -1, + -1, -1, -1, -1, 100, 203, 5, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, 45, 92, -1, -1, -1, -1, 80, 204, -1, + -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 132, -1, 249, -1, -1, -1, -1, -1, + -1, -1, 82, -1, 16, -1, 121, 86, -1, -1, -1, 224, -1, 195, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 159, -1, -1, 54, + -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, 68, -1, -1, -1, -1, -1, -1, + 252, -1, 233, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, + -1, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, 18, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, + 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, 226, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 246, -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, + -1, -1, -1, -1, -1, -1, 199, -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, 6, -1, -1, + -1, -1, 0, -1, -1, 229, -1, -1, 228, -1, -1, -1, -1, -1, 215, -1, 125, 102, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 227, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, + -1, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 213, -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, -1, -1, -1, -1, + -1, 205, -1, -1, 190, -1, -1, -1, 97, -1, -1, -1, -1, -1, 33, -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, -1, -1, -1, -1, -1, -1, -1, 247, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 55, -1, 19, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, + 95, -1, 136, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, + 118, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, + -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, 214, -1, 166, + 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 147, -1, -1, + -1, -1, -1, 15, -1, -1, 167, -1, -1, 173, -1, -1, -1, -1, -1, -1, -1, 131, + -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, + -1, -1, -1, -1, -1, -1, 149, -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, 235, 35, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, + 27, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, 30, -1, + 217, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 182, -1, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, 98, -1, -1, -1, -1, 129, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 180, -1, -1, + 245, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, 117, -1, 221, -1, -1, -1, + -1, -1, 23, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, 1, -1, -1, + -1, -1, -1, -1, -1, 113, -1, -1, 134, -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, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, 109, -1, -1, -1, + -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 127, -1, -1, -1, 28, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, + -1, 236, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1 + ); + +{$Q-} +function TSynHTMLSyn.HashKey(Str: PWideChar): Cardinal; +begin +// Result := 0; +// while IsIdentChar(Str^) or CharInSet(Str^, ['!', '/']) do +// begin +// Result := Result * 932 + Ord(Str^) * 46; +// Inc(Str); +// end; +// Result := Result mod 1543; +// FStringLen := Str - FToIdent; + + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 627 + Ord(Str^) * 829; + Inc(Str); + end; + Result := Result mod 2179; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynHTMLSyn.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 TSynHTMLSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynHTMLSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkUndefKey; +end; + +function TSynHTMLSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkUndefKey; +end; + +constructor TSynHTMLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + AddAttribute(FCommentAttri); + + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + FIdentifierAttri.Style := [fsBold]; + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + FKeyAttri.Foreground := $00ff0080; + AddAttribute(FKeyAttri); + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + FSymbolAttri.Style := [fsBold]; + AddAttribute(FSymbolAttri); + + FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + AddAttribute(FTextAttri); + + FUndefKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord); + FUndefKeyAttri.Style := [fsBold]; + FUndefKeyAttri.Foreground := clRed; + AddAttribute(FUndefKeyAttri); + + FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue); + FValueAttri.Foreground := $00ff8000; + AddAttribute(FValueAttri); + + FAndAttri := TSynHighlighterAttributes.Create(SYNS_AttrEscapeAmpersand, SYNS_FriendlyAttrEscapeAmpersand); + FAndAttri.Style := [fsBold]; + FAndAttri.Foreground := $0000ff00; + AddAttribute(FAndAttri); + SetAttributesOnChange(DefHighlightChange); + + InitIdent; + FRange := rsText; + FDefaultFilter := SYNS_FilterHTML; + FAndCode := -1; +end; + +procedure TSynHTMLSyn.BraceCloseProc; +begin + FRange := rsText; + FTokenID := tkSymbol; + Inc(Run); +end; + +procedure TSynHTMLSyn.CommentProc; +begin + FTokenID := tkComment; + + if IsLineEnd(Run) then + begin + NextProcedure; + Exit; + end; + + while not IsLineEnd(Run) do + begin + if (FLine[Run] = '>') and (FLine[Run - 1] = '-') and (FLine[Run - 2] = '-') then + begin + FRange := rsText; + Inc(Run); + Break; + end; + Inc(Run); + end; +end; + +procedure TSynHTMLSyn.BraceOpenProc; +begin + Inc(Run); + if (FLine[Run] = '!') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '-') then + begin + FRange := rsComment; + FTokenID := tkComment; + Inc(Run, 3); + end + else + begin + FRange := rsKey; + FTokenID := tkSymbol; + end; +end; + +procedure TSynHTMLSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynHTMLSyn.EqualProc; +begin + FRange := rsValue; + FTokenID := tkSymbol; + Inc(Run); +end; + +procedure TSynHTMLSyn.IdentProc; +begin + case FRange of + rsKey: + begin + FRange := rsParam; + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + end; + rsValue: + begin + FRange := rsParam; + FTokenID := tkValue; + repeat + Inc(Run); + until (FLine[Run] <= #32) or (FLine[Run] = '>'); + end; + else + FTokenID := tkIdentifier; + repeat + Inc(Run); + until (FLine[Run] <= #32) or (FLine[Run] = '=') or (FLine[Run] = '"') or + (FLine[Run] = '>'); + end; +end; + +procedure TSynHTMLSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynHTMLSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynHTMLSyn.TextProc; + + function IsStopChar: Boolean; + begin + case FLine[Run] of + #0..#31, '<', '&': + Result := True; + else + Result := False; + end; + end; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +var + i: Integer; +begin + if CharInSet(FLine[Run], [#0..#31, '<']) then + begin + NextProcedure; + Exit; + end; + + FTokenID := tkText; + + while True do + begin + while not IsStopChar do Inc(Run); + + if (FLine[Run] = '&') then + begin + if (FLine[Run + 1] = '#') then + begin + FAndCode := -1; + i := Run; + Inc(Run, 2); + if CharInSet(FLine[Run], ['X', 'x']) then + begin + Inc(Run); + while IsNumberChar do + Inc(Run); + end + else + while CharInSet(FLine[Run], ['0'..'9']) do + Inc(Run); + if (FLine[Run] = ';') then + begin + Inc(Run); + Run := i; + FRange := rsAmpersand; + end; + Break; + end + else + for i := Low(EscapeAmps) To High(EscapeAmps) do + if (WStrLComp((FLine + Run), EscapeAmps[i], WStrLen(EscapeAmps[i])) = 0) then + begin + FAndCode := i; + FRange := rsAmpersand; + Exit; + end; + + Inc(Run); + end + else + Break; + end; +end; + +procedure TSynHTMLSyn.AmpersandProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + if FRange <> rsAmpersand then + begin + if FRange = rsKey then + begin + Inc(Run); + FRange := rsText; + FTokenID := tkText; + end + else + IdentProc; + Exit; + end; + + case FAndCode of + Low(EscapeAmps)..High(EscapeAmps): + begin + FTokenID := tkAmpersand; + Inc(Run, WStrLen(EscapeAmps[FAndCode])); + end; + else begin + if (FLine[Run + 1] = '#') then + begin + FAndCode := -1; + Inc(Run, 2); + if CharInSet(FLine[Run], ['X', 'x']) then + begin + Inc(Run); + while IsNumberChar do + Inc(Run); + end + else + while CharInSet(FLine[Run], ['0'..'9']) do + Inc(Run); + if (FLine[Run] = ';') then begin + Inc(Run); + FTokenID := tkAmpersand; + end else + FTokenID := tkText; + end; + end; + end; + FAndCode := -1; + FRange := rsText; +end; + +procedure TSynHTMLSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while FLine[Run] <= #32 do + begin + if CharInSet(FLine[Run], [#0, #9, #10, #13]) then + Break; + Inc(Run); + end; +end; + +procedure TSynHTMLSyn.StringProc; +var + iOpenChar: WideChar; +begin + case FRange of + rsQuoteValue: + begin + iOpenChar := #39; + FTokenID := tkValue; + end; + rsDoubleQuoteValue: + begin + iOpenChar := '"'; + FTokenID := tkValue; + end; + else + begin + iOpenChar := FLine[Run]; + if FRange = rsValue then + begin + if iOpenChar = '"' then + FRange := rsDoubleQuoteValue + else + FRange := rsQuoteValue; + FTokenID := tkValue; + end else + begin + IdentProc; + Exit; + end; + Inc(Run); { jumps over the opening char } + end; + end; + + while not IsLineEnd(Run) do + begin + if FLine[Run] = iOpenChar then + begin + Inc(Run); { jumps over the closing char } + if FRange in [rsDoubleQuoteValue, rsQuoteValue] then + FRange := rsParam + else + FRange := rsText; + Break; + end; + Inc(Run); + end; +end; + +function TSynHTMLSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', '/', '0'..'9', 'A'..'Z', 'a'..'z': + Result := True; + else + Result := False; + end; +end; + + +procedure TSynHTMLSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsText: + TextProc; + rsComment: + CommentProc; + rsQuoteValue, rsDoubleQuoteValue: + if IsLineEnd(Run) then + NextProcedure + else + StringProc; + else + NextProcedure; + end; + + // ensure that one call of Next is enough to reach next token + if (fOldRun = Run) and not GetEol then Next; + + inherited; +end; + +procedure TSynHTMLSyn.NextProcedure; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '&': AmpersandProc; + '"', #39: StringProc; + '<': BraceOpenProc; + '>': BraceCloseProc; + '=': EqualProc; + else IdentProc; + end; +end; + +function TSynHTMLSyn.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_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynHTMLSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynHTMLSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynHTMLSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkAmpersand: Result := FAndAttri; + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkSpace: Result := FSpaceAttri; + tkSymbol: Result := FSymbolAttri; + tkText: Result := FTextAttri; + tkUndefKey: Result := FUndefKeyAttri; + tkValue: Result := FValueAttri; + else Result := nil; + end; +end; + +function TSynHTMLSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynHTMLSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +procedure TSynHTMLSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynHTMLSyn.ResetRange; +begin + FRange:= rsText; +end; + +function TSynHTMLSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterHTML; +end; + +class function TSynHTMLSyn.GetLanguageName: string; +begin + Result := SYNS_LangHTML; +end; + +function TSynHTMLSyn.GetSampleSource: UnicodeString; +begin + Result := + ''#13#10 + + #13#10 + + ''#13#10 + + ''#13#10 + + '
'#13#10 + + ' '#13#10 + + '
'#13#10 + + ' Sample HTML code © 2001'#13#10 + + ''#13#10 + + ''; +end; + +class function TSynHTMLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangHTML; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynHTMLSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterIDL.pas b/Source/VCL/SynEdit/Source/SynHighlighterIDL.pas index dea29053..d311048b 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterIDL.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterIDL.pas @@ -1,1054 +1,1056 @@ -{------------------------------------------------------------------------------- -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: SynHighlighterIDL.pas, released 2001-10-15. -Description: CORBA IDL Parser/Highlighter -The initial author of this file is P.L. Polak. -Unicode translation by Maël Hörz. -Copyright (c) 2001, 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: SynHighlighterIDL.pas,v 1.8.2.7 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -unit SynHighlighterIDL; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -Type - TtkTokenKind = ( - tkComment, - tkDatatype, - tkIdentifier, - tkKey, - tkNull, - tkNumber, - tkPreprocessor, - tkSpace, - tkString, - tkSymbol, - tkUnknown); - - TRangeState = (rsUnKnown, rsComment, rsString, rsChar); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynIdlSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..100] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fDatatypeAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fPreprocessorAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - procedure IdentProc; - procedure SymbolProc; - procedure UnknownProc; - function FuncAbstract(Index: Integer): TtkTokenKind; - function FuncAny(Index: Integer): TtkTokenKind; - function FuncAttribute(Index: Integer): TtkTokenKind; - function FuncBoolean(Index: Integer): TtkTokenKind; - function FuncCase(Index: Integer): TtkTokenKind; - function FuncChar(Index: Integer): TtkTokenKind; - function FuncConst(Index: Integer): TtkTokenKind; - function FuncContext(Index: Integer): TtkTokenKind; - function FuncCustom(Index: Integer): TtkTokenKind; - function FuncDefault(Index: Integer): TtkTokenKind; - function FuncDouble(Index: Integer): TtkTokenKind; - function FuncEnum(Index: Integer): TtkTokenKind; - function FuncException(Index: Integer): TtkTokenKind; - function FuncFactory(Index: Integer): TtkTokenKind; - function FuncFalse(Index: Integer): TtkTokenKind; - function FuncFixed(Index: Integer): TtkTokenKind; - function FuncFloat(Index: Integer): TtkTokenKind; - function FuncIn(Index: Integer): TtkTokenKind; - function FuncInout(Index: Integer): TtkTokenKind; - function FuncInterface(Index: Integer): TtkTokenKind; - function FuncLocal(Index: Integer): TtkTokenKind; - function FuncLong(Index: Integer): TtkTokenKind; - function FuncModule(Index: Integer): TtkTokenKind; - function FuncNative(Index: Integer): TtkTokenKind; - function FuncObject(Index: Integer): TtkTokenKind; - function FuncOctet(Index: Integer): TtkTokenKind; - function FuncOneway(Index: Integer): TtkTokenKind; - function FuncOut(Index: Integer): TtkTokenKind; - function FuncPrivate(Index: Integer): TtkTokenKind; - function FuncPublic(Index: Integer): TtkTokenKind; - function FuncRaises(Index: Integer): TtkTokenKind; - function FuncReadonly(Index: Integer): TtkTokenKind; - function FuncSequence(Index: Integer): TtkTokenKind; - function FuncShort(Index: Integer): TtkTokenKind; - function FuncString(Index: Integer): TtkTokenKind; - function FuncStruct(Index: Integer): TtkTokenKind; - function FuncSupports(Index: Integer): TtkTokenKind; - function FuncSwitch(Index: Integer): TtkTokenKind; - function FuncTrue(Index: Integer): TtkTokenKind; - function FuncTruncatable(Index: Integer): TtkTokenKind; - function FuncTypedef(Index: Integer): TtkTokenKind; - function FuncUnion(Index: Integer): TtkTokenKind; - function FuncUnsigned(Index: Integer): TtkTokenKind; - function FuncValuebase(Index: Integer): TtkTokenKind; - function FuncValuetype(Index: Integer): TtkTokenKind; - function FuncVoid(Index: Integer): TtkTokenKind; - function FuncWchar(Index: Integer): TtkTokenKind; - function FuncWstring(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure NullProc; - procedure NumberProc; - procedure SpaceProc; - procedure CRProc; - procedure LFProc; - procedure CommentOpenProc; - procedure CommentProc; - procedure StringOpenProc; - procedure StringProc; - procedure CharOpenProc; - procedure CharProc; - procedure PreProcessorProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - constructor Create(AOwner: TComponent); override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: 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 GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property DatatypeAttri: TSynHighlighterAttributes read fDatatypeAttri write fDatatypeAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; - property PreprocessorAttri: TSynHighlighterAttributes read fPreprocessorAttri write fPreprocessorAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..47] of string = ( - 'abstract', 'any', 'attribute', 'boolean', 'case', 'char', 'const', - 'context', 'custom', 'default', 'double', 'enum', 'exception', 'factory', - 'FALSE', 'fixed', 'float', 'in', 'inout', 'interface', 'local', 'long', - 'module', 'native', 'Object', 'octet', 'oneway', 'out', 'private', 'public', - 'raises', 'readonly', 'sequence', 'short', 'string', 'struct', 'supports', - 'switch', 'TRUE', 'truncatable', 'typedef', 'union', 'unsigned', - 'ValueBase', 'valuetype', 'void', 'wchar', 'wstring' - ); - - KeyIndices: array[0..100] of Integer = ( - 5, 19, 17, 7, -1, -1, -1, -1, -1, 15, 18, -1, 37, -1, 24, -1, -1, -1, 44, - -1, 11, 31, -1, 25, 33, -1, -1, 42, 39, -1, -1, 36, 46, -1, 27, -1, 43, 28, - 26, 20, -1, 1, 32, 6, -1, 14, 8, -1, -1, -1, -1, 0, 35, -1, -1, -1, -1, -1, - -1, -1, -1, 45, 22, 47, -1, -1, 12, 4, -1, -1, -1, 10, -1, -1, 3, -1, 9, -1, - 34, 30, 13, -1, 2, 21, 16, -1, 29, 40, -1, -1, -1, -1, -1, -1, -1, 23, -1, - 38, -1, -1, 41 - ); - -{$Q-} -function TSynIdlSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 612 + Ord(Str^) * 199; - inc(Str); - end; - Result := Result mod 101; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynIdlSyn.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 TSynIdlSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[51] := FuncAbstract; - fIdentFuncTable[41] := FuncAny; - fIdentFuncTable[82] := FuncAttribute; - fIdentFuncTable[74] := FuncBoolean; - fIdentFuncTable[67] := FuncCase; - fIdentFuncTable[0] := FuncChar; - fIdentFuncTable[43] := FuncConst; - fIdentFuncTable[3] := FuncContext; - fIdentFuncTable[46] := FuncCustom; - fIdentFuncTable[76] := FuncDefault; - fIdentFuncTable[71] := FuncDouble; - fIdentFuncTable[20] := FuncEnum; - fIdentFuncTable[66] := FuncException; - fIdentFuncTable[80] := FuncFactory; - fIdentFuncTable[45] := FuncFalse; - fIdentFuncTable[9] := FuncFixed; - fIdentFuncTable[84] := FuncFloat; - fIdentFuncTable[2] := FuncIn; - fIdentFuncTable[10] := FuncInout; - fIdentFuncTable[1] := FuncInterface; - fIdentFuncTable[39] := FuncLocal; - fIdentFuncTable[83] := FuncLong; - fIdentFuncTable[62] := FuncModule; - fIdentFuncTable[95] := FuncNative; - fIdentFuncTable[14] := FuncObject; - fIdentFuncTable[23] := FuncOctet; - fIdentFuncTable[38] := FuncOneway; - fIdentFuncTable[34] := FuncOut; - fIdentFuncTable[37] := FuncPrivate; - fIdentFuncTable[86] := FuncPublic; - fIdentFuncTable[79] := FuncRaises; - fIdentFuncTable[21] := FuncReadonly; - fIdentFuncTable[42] := FuncSequence; - fIdentFuncTable[24] := FuncShort; - fIdentFuncTable[78] := FuncString; - fIdentFuncTable[52] := FuncStruct; - fIdentFuncTable[31] := FuncSupports; - fIdentFuncTable[12] := FuncSwitch; - fIdentFuncTable[97] := FuncTrue; - fIdentFuncTable[28] := FuncTruncatable; - fIdentFuncTable[87] := FuncTypedef; - fIdentFuncTable[100] := FuncUnion; - fIdentFuncTable[27] := FuncUnsigned; - fIdentFuncTable[36] := FuncValuebase; - fIdentFuncTable[18] := FuncValuetype; - fIdentFuncTable[61] := FuncVoid; - fIdentFuncTable[32] := FuncWchar; - fIdentFuncTable[63] := FuncWstring; -end; - -function TSynIdlSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncAbstract(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncAny(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncAttribute(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncBoolean(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncCase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncChar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncConst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncContext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncCustom(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncDefault(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncDouble(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncEnum(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncException(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncFactory(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncFalse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncFixed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncFloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncIn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncInout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncInterface(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncLocal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncLong(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncModule(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncNative(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncObject(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncOctet(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncOneway(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncOut(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncPrivate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncPublic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncRaises(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncReadonly(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncSequence(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncShort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncString(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncStruct(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncSupports(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncSwitch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncTrue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncTruncatable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncTypedef(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncUnion(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncUnsigned(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncValuebase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncValuetype(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncVoid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncWchar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynIdlSyn.FuncWstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -procedure TSynIdlSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynIdlSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynIdlSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': if FLine[Run + 1] = '.' then - Break; - end; - inc(Run); - end; -end; { NumberProc } - - -procedure TSynIdlSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then - inc(Run); -end; - -procedure TSynIdlSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynIdlSyn.CommentOpenProc; -begin - Inc(Run); - if (fLine[Run] = '*') then - begin - fRange := rsComment; - CommentProc; - fTokenID := tkComment; - end - else if (fLine[Run] = '/') then - begin - while not IsLineEnd(Run) do - Inc(Run); - fTokenID := tkComment; - end - else - fTokenID := tkSymbol; -end; - -procedure TSynIdlSyn.CommentProc; -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 TSynIdlSyn.StringOpenProc; -begin - Inc(Run); - fRange := rsString; - StringProc; - fTokenID := tkString; -end; - -procedure TSynIdlSyn.StringProc; -begin - fTokenID := tkString; - repeat - if (fLine[Run] = '"') then - begin - Inc(Run); - fRange := rsUnKnown; - Break; - end - else if (fLine[Run] = '\') then - Inc(Run); - if not IsLineEnd(Run) then - Inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynIdlSyn.CharOpenProc; -begin - Inc(Run); - fRange := rsChar; - CharProc; - fTokenID := tkString; -end; - -procedure TSynIdlSyn.CharProc; -begin - fTokenID := tkString; - repeat - if (fLine[Run] = '''') then - begin - Inc(Run); - fRange := rsUnKnown; - Break; - end; - if not IsLineEnd(Run) then - Inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynIdlSyn.PreProcessorProc; - - function IsWhiteChar: Boolean; - begin - case fLine[Run] of - #0, #9, #10, #13, #32: - Result := True; - else - Result := False; - end; - end; - -var - Directive: String; -begin - Directive := ''; - while not IsWhiteChar do - begin - Directive := Directive + fLine[Run]; - Inc(Run); - end; - if (WideCompareStr(Directive, '#include') = 0) then - fTokenID := tkPreprocessor - else if (WideCompareStr(Directive, '#pragma') = 0) then - fTokenID := tkPreprocessor - else - fTokenID := tkIdentifier; -end; { PreProcessorProc } - - -constructor TSynIdlSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clNavy; - AddAttribute(fCommentAttri); - - fDatatypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrDatatype, SYNS_FriendlyAttrDatatype); - fDatatypeAttri.Style := [fsBold]; - fDatatypeAttri.Foreground := clTeal; - AddAttribute(fDatatypeAttri); - - fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - - fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clBlue; - AddAttribute(fNumberAttri); - - fPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - fPreprocessorAttri.Foreground := clRed; - AddAttribute(fPreprocessorAttri); - - fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; - AddAttribute(fStringAttri); - - fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterCORBAIDL; - fRange := rsUnknown; -end; - -procedure TSynIdlSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); -end; - -procedure TSynIdlSyn.SymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynIdlSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynIdlSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: CommentProc; - else - begin - fRange := rsUnknown; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - '/': CommentOpenProc; - '"': StringOpenProc; - '''': CharOpenProc; - '#': PreProcessorProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '0'..'9': NumberProc; - '-', '+', '*', '\', ',', '.', '[', ']', '{', '}', '<', '>', '(', ')', - '=', '?', ':', ';' : SymbolProc; - else - UnknownProc; - end; - end; - end; - inherited; -end; - -function TSynIdlSyn.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 TSynIdlSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynIdlSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynIdlSyn.GetTokenAttribute: TSynHighLighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkDatatype: Result := fDatatypeAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkPreprocessor: Result := fPreprocessorAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynIdlSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynIdlSyn.GetSampleSource: string; -begin - Result := '/* CORBA IDL sample source */'#13#10 + - '#include '#13#10 + - #13#10 + - 'const string TestString = "Hello World";'#13#10 + - 'const long TestLong = 10;'#13#10 + - #13#10 + - 'module TestModule {'#13#10 + - ' interface DemoInterface {'#13#10 + - ' boolean HelloWorld(in string Message);'#13#10 + - ' }'#13#10 + - '}'; -end; - -function TSynIdlSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterCORBAIDL; -end; - -function TSynIdlSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '_', 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; -end; - -class function TSynIdlSyn.GetLanguageName: string; -begin - Result := SYNS_LangCORBAIDL; -end; - -procedure TSynIdlSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynIdlSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynIdlSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -class function TSynIdlSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangCORBAIDL; -end; - -initialization - RegisterPlaceableHighlighter(TSynIdlSyn); -end. +{------------------------------------------------------------------------------- +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: SynHighlighterIDL.pas, released 2001-10-15. +Description: CORBA IDL Parser/Highlighter +The initial author of this file is P.L. Polak. +Unicode translation by Maël Hörz. +Copyright (c) 2001, 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: SynHighlighterIDL.pas,v 1.8.2.7 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +unit SynHighlighterIDL; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +Type + TtkTokenKind = ( + tkComment, + tkDatatype, + tkIdentifier, + tkKey, + tkNull, + tkNumber, + tkPreprocessor, + tkSpace, + tkString, + tkSymbol, + tkUnknown); + + TRangeState = (rsUnknown, rsComment, rsString, rsChar); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynIdlSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..100] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FDatatypeAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FPreprocessorAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + procedure IdentProc; + procedure SymbolProc; + procedure UnknownProc; + function FuncAbstract(Index: Integer): TtkTokenKind; + function FuncAny(Index: Integer): TtkTokenKind; + function FuncAttribute(Index: Integer): TtkTokenKind; + function FuncBoolean(Index: Integer): TtkTokenKind; + function FuncCase(Index: Integer): TtkTokenKind; + function FuncChar(Index: Integer): TtkTokenKind; + function FuncConst(Index: Integer): TtkTokenKind; + function FuncContext(Index: Integer): TtkTokenKind; + function FuncCustom(Index: Integer): TtkTokenKind; + function FuncDefault(Index: Integer): TtkTokenKind; + function FuncDouble(Index: Integer): TtkTokenKind; + function FuncEnum(Index: Integer): TtkTokenKind; + function FuncException(Index: Integer): TtkTokenKind; + function FuncFactory(Index: Integer): TtkTokenKind; + function FuncFalse(Index: Integer): TtkTokenKind; + function FuncFixed(Index: Integer): TtkTokenKind; + function FuncFloat(Index: Integer): TtkTokenKind; + function FuncIn(Index: Integer): TtkTokenKind; + function FuncInout(Index: Integer): TtkTokenKind; + function FuncInterface(Index: Integer): TtkTokenKind; + function FuncLocal(Index: Integer): TtkTokenKind; + function FuncLong(Index: Integer): TtkTokenKind; + function FuncModule(Index: Integer): TtkTokenKind; + function FuncNative(Index: Integer): TtkTokenKind; + function FuncObject(Index: Integer): TtkTokenKind; + function FuncOctet(Index: Integer): TtkTokenKind; + function FuncOneway(Index: Integer): TtkTokenKind; + function FuncOut(Index: Integer): TtkTokenKind; + function FuncPrivate(Index: Integer): TtkTokenKind; + function FuncPublic(Index: Integer): TtkTokenKind; + function FuncRaises(Index: Integer): TtkTokenKind; + function FuncReadonly(Index: Integer): TtkTokenKind; + function FuncSequence(Index: Integer): TtkTokenKind; + function FuncShort(Index: Integer): TtkTokenKind; + function FuncString(Index: Integer): TtkTokenKind; + function FuncStruct(Index: Integer): TtkTokenKind; + function FuncSupports(Index: Integer): TtkTokenKind; + function FuncSwitch(Index: Integer): TtkTokenKind; + function FuncTrue(Index: Integer): TtkTokenKind; + function FuncTruncatable(Index: Integer): TtkTokenKind; + function FuncTypedef(Index: Integer): TtkTokenKind; + function FuncUnion(Index: Integer): TtkTokenKind; + function FuncUnsigned(Index: Integer): TtkTokenKind; + function FuncValuebase(Index: Integer): TtkTokenKind; + function FuncValuetype(Index: Integer): TtkTokenKind; + function FuncVoid(Index: Integer): TtkTokenKind; + function FuncWchar(Index: Integer): TtkTokenKind; + function FuncWstring(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure NullProc; + procedure NumberProc; + procedure SpaceProc; + procedure CRProc; + procedure LFProc; + procedure CommentOpenProc; + procedure CommentProc; + procedure StringOpenProc; + procedure StringProc; + procedure CharOpenProc; + procedure CharProc; + procedure PreProcessorProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property DatatypeAttri: TSynHighlighterAttributes read FDatatypeAttri write FDatatypeAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; + property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..47] of UnicodeString = ( + 'abstract', 'any', 'attribute', 'boolean', 'case', 'char', 'const', + 'context', 'custom', 'default', 'double', 'enum', 'exception', 'factory', + 'FALSE', 'fixed', 'float', 'in', 'inout', 'interface', 'local', 'long', + 'module', 'native', 'Object', 'octet', 'oneway', 'out', 'private', 'public', + 'raises', 'readonly', 'sequence', 'short', 'string', 'struct', 'supports', + 'switch', 'TRUE', 'truncatable', 'typedef', 'union', 'unsigned', + 'ValueBase', 'valuetype', 'void', 'wchar', 'wstring' + ); + + KeyIndices: array[0..100] of Integer = ( + 5, 19, 17, 7, -1, -1, -1, -1, -1, 15, 18, -1, 37, -1, 24, -1, -1, -1, 44, + -1, 11, 31, -1, 25, 33, -1, -1, 42, 39, -1, -1, 36, 46, -1, 27, -1, 43, 28, + 26, 20, -1, 1, 32, 6, -1, 14, 8, -1, -1, -1, -1, 0, 35, -1, -1, -1, -1, -1, + -1, -1, -1, 45, 22, 47, -1, -1, 12, 4, -1, -1, -1, 10, -1, -1, 3, -1, 9, -1, + 34, 30, 13, -1, 2, 21, 16, -1, 29, 40, -1, -1, -1, -1, -1, -1, -1, 23, -1, + 38, -1, -1, 41 + ); + +{$Q-} +function TSynIdlSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 612 + Ord(Str^) * 199; + Inc(Str); + end; + Result := Result mod 101; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynIdlSyn.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 TSynIdlSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[51] := FuncAbstract; + FIdentFuncTable[41] := FuncAny; + FIdentFuncTable[82] := FuncAttribute; + FIdentFuncTable[74] := FuncBoolean; + FIdentFuncTable[67] := FuncCase; + FIdentFuncTable[0] := FuncChar; + FIdentFuncTable[43] := FuncConst; + FIdentFuncTable[3] := FuncContext; + FIdentFuncTable[46] := FuncCustom; + FIdentFuncTable[76] := FuncDefault; + FIdentFuncTable[71] := FuncDouble; + FIdentFuncTable[20] := FuncEnum; + FIdentFuncTable[66] := FuncException; + FIdentFuncTable[80] := FuncFactory; + FIdentFuncTable[45] := FuncFalse; + FIdentFuncTable[9] := FuncFixed; + FIdentFuncTable[84] := FuncFloat; + FIdentFuncTable[2] := FuncIn; + FIdentFuncTable[10] := FuncInout; + FIdentFuncTable[1] := FuncInterface; + FIdentFuncTable[39] := FuncLocal; + FIdentFuncTable[83] := FuncLong; + FIdentFuncTable[62] := FuncModule; + FIdentFuncTable[95] := FuncNative; + FIdentFuncTable[14] := FuncObject; + FIdentFuncTable[23] := FuncOctet; + FIdentFuncTable[38] := FuncOneway; + FIdentFuncTable[34] := FuncOut; + FIdentFuncTable[37] := FuncPrivate; + FIdentFuncTable[86] := FuncPublic; + FIdentFuncTable[79] := FuncRaises; + FIdentFuncTable[21] := FuncReadonly; + FIdentFuncTable[42] := FuncSequence; + FIdentFuncTable[24] := FuncShort; + FIdentFuncTable[78] := FuncString; + FIdentFuncTable[52] := FuncStruct; + FIdentFuncTable[31] := FuncSupports; + FIdentFuncTable[12] := FuncSwitch; + FIdentFuncTable[97] := FuncTrue; + FIdentFuncTable[28] := FuncTruncatable; + FIdentFuncTable[87] := FuncTypedef; + FIdentFuncTable[100] := FuncUnion; + FIdentFuncTable[27] := FuncUnsigned; + FIdentFuncTable[36] := FuncValuebase; + FIdentFuncTable[18] := FuncValuetype; + FIdentFuncTable[61] := FuncVoid; + FIdentFuncTable[32] := FuncWchar; + FIdentFuncTable[63] := FuncWstring; +end; + +function TSynIdlSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncAbstract(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncAny(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncAttribute(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncBoolean(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncCase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncChar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncConst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncContext(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncCustom(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncDefault(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncDouble(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncEnum(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncException(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncFactory(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncFalse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncFixed(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncFloat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncIn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncInout(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncInterface(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncLocal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncLong(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncModule(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncNative(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncObject(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncOctet(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncOneway(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncOut(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncPrivate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncPublic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncRaises(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncReadonly(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncSequence(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncShort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncString(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncStruct(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncSupports(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncSwitch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncTrue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncTruncatable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncTypedef(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncUnion(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncUnsigned(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncValuebase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncValuetype(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncVoid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncWchar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynIdlSyn.FuncWstring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +procedure TSynIdlSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynIdlSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynIdlSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; { NumberProc } + + +procedure TSynIdlSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynIdlSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynIdlSyn.CommentOpenProc; +begin + Inc(Run); + if (FLine[Run] = '*') then + begin + FRange := rsComment; + CommentProc; + FTokenID := tkComment; + end + else if (FLine[Run] = '/') then + begin + while not IsLineEnd(Run) do + Inc(Run); + FTokenID := tkComment; + end + else + FTokenID := tkSymbol; +end; + +procedure TSynIdlSyn.CommentProc; +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 TSynIdlSyn.StringOpenProc; +begin + Inc(Run); + FRange := rsString; + StringProc; + FTokenID := tkString; +end; + +procedure TSynIdlSyn.StringProc; +begin + FTokenID := tkString; + repeat + if (FLine[Run] = '"') then + begin + Inc(Run); + FRange := rsUnknown; + Break; + end + else if (FLine[Run] = '\') then + Inc(Run); + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynIdlSyn.CharOpenProc; +begin + Inc(Run); + FRange := rsChar; + CharProc; + FTokenID := tkString; +end; + +procedure TSynIdlSyn.CharProc; +begin + FTokenID := tkString; + repeat + if (FLine[Run] = '''') then + begin + Inc(Run); + FRange := rsUnknown; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynIdlSyn.PreProcessorProc; + + function IsWhiteChar: Boolean; + begin + case FLine[Run] of + #0, #9, #10, #13, #32: + Result := True; + else + Result := False; + end; + end; + +var + Directive: String; +begin + Directive := ''; + while not IsWhiteChar do + begin + Directive := Directive + FLine[Run]; + Inc(Run); + end; + if (WideCompareStr(Directive, '#include') = 0) then + FTokenID := tkPreprocessor + else if (WideCompareStr(Directive, '#pragma') = 0) then + FTokenID := tkPreprocessor + else + FTokenID := tkIdentifier; +end; { PreProcessorProc } + + +constructor TSynIdlSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clNavy; + AddAttribute(FCommentAttri); + + FDatatypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrDatatype, SYNS_FriendlyAttrDatatype); + FDatatypeAttri.Style := [fsBold]; + FDatatypeAttri.Foreground := clTeal; + AddAttribute(FDatatypeAttri); + + FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + + FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clBlue; + AddAttribute(FNumberAttri); + + FPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + FPreprocessorAttri.Foreground := clRed; + AddAttribute(FPreprocessorAttri); + + FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Foreground := clBlue; + AddAttribute(FStringAttri); + + FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterCORBAIDL; + FRange := rsUnknown; +end; + +procedure TSynIdlSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynIdlSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynIdlSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynIdlSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: CommentProc; + else + begin + FRange := rsUnknown; + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + '/': CommentOpenProc; + '"': StringOpenProc; + '''': CharOpenProc; + '#': PreProcessorProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '0'..'9': NumberProc; + '-', '+', '*', '\', ',', '.', '[', ']', '{', '}', '<', '>', '(', ')', + '=', '?', ':', ';' : SymbolProc; + else + UnknownProc; + end; + end; + end; + inherited; +end; + +function TSynIdlSyn.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 TSynIdlSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynIdlSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynIdlSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkDatatype: Result := FDatatypeAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkPreprocessor: Result := FPreprocessorAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynIdlSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynIdlSyn.GetSampleSource: UnicodeString; +begin + Result := '/* CORBA IDL sample source */'#13#10 + + '#include '#13#10 + + #13#10 + + 'const string TestString = "Hello World";'#13#10 + + 'const long TestLong = 10;'#13#10 + + #13#10 + + 'module TestModule {'#13#10 + + ' interface DemoInterface {'#13#10 + + ' boolean HelloWorld(in string Message);'#13#10 + + ' }'#13#10 + + '}'; +end; + +function TSynIdlSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterCORBAIDL; +end; + +function TSynIdlSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +class function TSynIdlSyn.GetLanguageName: string; +begin + Result := SYNS_LangCORBAIDL; +end; + +procedure TSynIdlSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynIdlSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynIdlSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +class function TSynIdlSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangCORBAIDL; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynIdlSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterIni.pas b/Source/VCL/SynEdit/Source/SynHighlighterIni.pas index ab9ec815..d4fbbe0c 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterIni.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterIni.pas @@ -1,427 +1,434 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterIni.pas, released 2000-04-21. -The Original Code is based on the izIniSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Igor P. Zenkov. -Unicode translation by Maël Hörz. -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: SynHighlighterIni.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides an Ini-files highlighter for SynEdit) -@author(Igor P. Zenkov, converted to SynEdit by Bruno Mikkelsen ) -@created(1999-11-02, converted to SynEdit 2000-04-21) -@lastmod(2000-04-21) -The SynHighlighterIni unit provides SynEdit with an Ini-files highlighter. -Thanks to Primoz Gabrijelcic, Martin Waldenburg and Michael Hieke. -} - -unit SynHighlighterIni; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - Classes; - -type - TtkTokenKind = (tkComment, tkText, tkSection, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown); - -type - TSynIniSyn = class(TSynCustomHighlighter) - private - FTokenID: TtkTokenKind; - fCommentAttri: TSynHighlighterAttributes; - fTextAttri: TSynHighlighterAttributes; - fSectionAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - procedure SectionOpenProc; - procedure KeyProc; - procedure CRProc; - procedure EqualProc; - procedure TextProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure SemiColonProc; - procedure SpaceProc; - procedure StringProc; // "" - procedure StringProc1; // '' - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property TextAttri: TSynHighlighterAttributes read fTextAttri - write fTextAttri; - property SectionAttri: TSynHighlighterAttributes read fSectionAttri - write fSectionAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -constructor TSynIniSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clGreen; - AddAttribute(fCommentAttri); - fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); - AddAttribute(fTextAttri); - fSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); - fSectionAttri.Style := [fsBold]; - AddAttribute(fSectionAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - - fDefaultFilter := SYNS_FilterINI; -end; { Create } - -procedure TSynIniSyn.SectionOpenProc; -begin - // if it is not column 0 mark as tkText and get out of here - if Run > 0 then - begin - fTokenID := tkText; - inc(Run); - Exit; - end; - - // this is column 0 ok it is a Section - fTokenID := tkSection; - inc(Run); - while FLine[Run] <> #0 do - case FLine[Run] of - ']': - begin - inc(Run); - break - end; - #10: break; - #13: break; - else inc(Run); - end; -end; - -procedure TSynIniSyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynIniSyn.EqualProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynIniSyn.KeyProc; -begin - fTokenID := tkKey; - inc(Run); - while FLine[Run] <> #0 do - case FLine[Run] of - '=': break; - #10: break; - #13: break; - else inc(Run); - end; -end; - -procedure TSynIniSyn.TextProc; - - function IsTextChar: Boolean; - begin - case fLine[Run] of - 'a'..'z', 'A'..'Z', '0'..'9': - Result := True; - else - Result := False; - end; - end; - -begin - if Run = 0 then - KeyProc - else - begin - fTokenID := tkText; - inc(Run); - while FLine[Run] <> #0 do - if IsTextChar then - inc(Run) - else - break; - end; -end; - -procedure TSynIniSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynIniSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynIniSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - - function IsAlphaChar: Boolean; - begin - case fLine[Run] of - 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; - end; - -begin - if Run = 0 then - KeyProc - else - begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do inc(Run); - if IsAlphaChar then TextProc; - end; -end; - -// ; -procedure TSynIniSyn.SemiColonProc; -begin - // if it is not column 0 mark as tkText and get out of here - if Run > 0 then - begin - fTokenID := tkText; - inc(Run); - Exit; - end; - - // this is column 0 ok it is a comment - fTokenID := tkComment; - inc(Run); - while FLine[Run] <> #0 do - case FLine[Run] of - #10: break; - #13: break; - else inc(Run); - end; -end; - -procedure TSynIniSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -// "" -procedure TSynIniSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = #34; - if FLine[Run] <> #0 then inc(Run); -end; - -// '' -procedure TSynIniSyn.StringProc1; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then inc(Run, 2); - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = #39; - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynIniSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #34: StringProc; - #39: StringProc1; - '0'..'9': NumberProc; - #59: SemiColonProc; - #61: EqualProc; - #91: SectionOpenProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - else TextProc; - end; - inherited; -end; - -function TSynIniSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - 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 TSynIniSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynIniSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynIniSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkText: Result := fTextAttri; - tkSection: Result := fSectionAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fTextAttri; - else Result := nil; - end; -end; - -function TSynIniSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynIniSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterINI; -end; - -class function TSynIniSyn.GetLanguageName: string; -begin - Result := SYNS_LangINI; -end; - -function TSynIniSyn.GetSampleSource: string; -begin - Result := '; Syntax highlighting'#13#10+ - '[Section]'#13#10+ - 'Key=value'#13#10+ - 'String="Arial"'#13#10+ - 'Number=123456'; -end; - -class function TSynIniSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangINI; -end; - -initialization - RegisterPlaceableHighlighter(TSynIniSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterIni.pas, released 2000-04-21. +The Original Code is based on the izIniSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Igor P. Zenkov. +Unicode translation by Maël Hörz. +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: SynHighlighterIni.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides an Ini-files highlighter for SynEdit) +@author(Igor P. Zenkov, converted to SynEdit by Bruno Mikkelsen ) +@created(1999-11-02, converted to SynEdit 2000-04-21) +@lastmod(2000-04-21) +The SynHighlighterIni unit provides SynEdit with an Ini-files highlighter. +Thanks to Primoz Gabrijelcic, Martin Waldenburg and Michael Hieke. +} + +unit SynHighlighterIni; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + Classes; + +type + TtkTokenKind = (tkComment, tkText, tkSection, tkKey, tkNull, tkNumber, + tkSpace, tkString, tkSymbol, tkUnknown); + +type + TSynIniSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FTextAttri: TSynHighlighterAttributes; + FSectionAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + procedure SectionOpenProc; + procedure KeyProc; + procedure CRProc; + procedure EqualProc; + procedure TextProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure SemiColonProc; + procedure SpaceProc; + procedure StringProc; // "" + procedure StringProc1; // '' + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property TextAttri: TSynHighlighterAttributes read FTextAttri + write FTextAttri; + property SectionAttri: TSynHighlighterAttributes read FSectionAttri + write FSectionAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +constructor TSynIniSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clGreen; + AddAttribute(FCommentAttri); + FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + AddAttribute(FTextAttri); + FSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); + FSectionAttri.Style := [fsBold]; + AddAttribute(FSectionAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + + FDefaultFilter := SYNS_FilterINI; +end; { Create } + +procedure TSynIniSyn.SectionOpenProc; +begin + // if it is not column 0 mark as tkText and get out of here + if Run > 0 then + begin + FTokenID := tkText; + Inc(Run); + Exit; + end; + + // this is column 0 ok it is a Section + FTokenID := tkSection; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + ']': + begin + Inc(Run); + Break + end; + #10, #13: + Break; + else Inc(Run); + end; +end; + +procedure TSynIniSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else Inc(Run); + end; +end; + +procedure TSynIniSyn.EqualProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynIniSyn.KeyProc; +begin + FTokenID := tkKey; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + '=': + Break; + #10, #13: + Break; + else Inc(Run); + end; +end; + +procedure TSynIniSyn.TextProc; + + function IsTextChar: Boolean; + begin + case fLine[Run] of + 'a'..'z', 'A'..'Z', '0'..'9': + Result := True; + else + Result := False; + end; + end; + +begin + if Run = 0 then + KeyProc + else + begin + FTokenID := tkText; + Inc(Run); + while FLine[Run] <> #0 do + if IsTextChar then + Inc(Run) + else + Break; + end; +end; + +procedure TSynIniSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynIniSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynIniSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case fLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + + function IsAlphaChar: Boolean; + begin + case fLine[Run] of + 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; + end; + +begin + if Run = 0 then + KeyProc + else + begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do Inc(Run); + if IsAlphaChar then TextProc; + end; +end; + +// ; +procedure TSynIniSyn.SemiColonProc; +begin + // if it is not column 0 mark as tkText and get out of here + if Run > 0 then + begin + FTokenID := tkText; + Inc(Run); + Exit; + end; + + // this is column 0 ok it is a comment + FTokenID := tkComment; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + #10, #13: + Break; + else + Inc(Run); + end; +end; + +procedure TSynIniSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +// "" +procedure TSynIniSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = #34; + if FLine[Run] <> #0 then Inc(Run); +end; + +// '' +procedure TSynIniSyn.StringProc1; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2); + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = #39; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynIniSyn.Next; +begin + FTokenPos := Run; + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #34: StringProc; + #39: StringProc1; + '0'..'9': NumberProc; + #59: SemiColonProc; + #61: EqualProc; + #91: SectionOpenProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + else TextProc; + end; + inherited; +end; + +function TSynIniSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + 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 TSynIniSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynIniSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynIniSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkText: Result := FTextAttri; + tkSection: Result := FSectionAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FTextAttri; + else Result := nil; + end; +end; + +function TSynIniSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynIniSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterINI; +end; + +class function TSynIniSyn.GetLanguageName: string; +begin + Result := SYNS_LangINI; +end; + +function TSynIniSyn.GetSampleSource: UnicodeString; +begin + Result := + '; Syntax highlighting'#13#10+ + '[Section]'#13#10+ + 'Key=value'#13#10+ + 'String="Arial"'#13#10+ + 'Number=123456'; +end; + +class function TSynIniSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangINI; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynIniSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterInno.pas b/Source/VCL/SynEdit/Source/SynHighlighterInno.pas index 5eaf0509..985d96de 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterInno.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterInno.pas @@ -1,604 +1,606 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterInno.pas, released 2000-05-01. -The Initial Author of this file is Satya. -Portions created by Satya are Copyright 2000 Satya. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynHighlighterInno.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides an Inno script file highlighter for SynEdit) -@author(Satya) -@created(2000-05-01) -@lastmod(2001-01-23) -The SynHighlighterInno unit provides an Inno script file highlighter for SynEdit. -Check out http://www.jrsoftware.org for the free Inno Setup program, -and http://www.wintax.nl/isx/ for My Inno Setup Extensions. -} - -unit SynHighlighterInno; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkConstant, tkIdentifier, tkKey, tkKeyOrParameter, - tkNull, tkNumber, tkParameter, tkSection, tkSpace, tkString, tkSymbol, - tkUnknown); - - TSynInnoSyn = class(TSynCustomHighlighter) - private - fTokenID: TtkTokenKind; - fConstantAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fSectionAttri: TSynHighlighterAttributes; - fParamAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fInvalidAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fKeywords: TSynHashEntryList; - function HashKey(Str: PWideChar): Integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure SymbolProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure SectionProc; - procedure SpaceProc; - procedure EqualProc; - procedure ConstantProc; - procedure SemiColonProc; - procedure StringProc; - procedure UnknownProc; - procedure DoAddKeyword(AKeyword: string; AKind: integer); - protected - function IsCurrentToken(const Token: string): Boolean; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenID: TtkTokenKind; - function GetTokenKind: integer; override; - procedure Next; override; - published - property ConstantAttri: TSynHighlighterAttributes read fConstantAttri - write fConstantAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri - write fInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property ParameterAttri: TSynHighlighterAttributes read fParamAttri - write fParamAttri; - property SectionAttri: TSynHighlighterAttributes read fSectionAttri - write fSectionAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - {Note: new 'Section names' and the new 'Constants' need not be added - as they are highlighted automatically} - - {Ref: Keywords and Parameters are updated as they last appeared in - Inno Setup / ISX version 1.3.26} - - Keywords: string = - 'adminprivilegesrequired,allownoicons,allowrootdirectory,allowuncpath,' + - 'alwayscreateuninstallicon,alwaysrestart,alwaysshowcomponentslist,' + - 'alwaysshowdironreadypage,alwaysshowgrouponreadypage,' + - 'alwaysusepersonalgroup,appcopyright,appid,appmutex,appname,apppublisher,' + - 'apppublisherurl,appsupporturl,appupdatesurl,appvername,appversion,' + - 'attribs,backcolor,backcolor2,backcolordirection,backsolid,bits,' + - 'changesassociations,check,codefile,comment,components,compression,compresslevel,copymode,'+ - 'createappdir,createuninstallregkey,defaultdirname,defaultgroupname,' + - 'description,destdir,destname,direxistswarning,disableappenddir,' + - 'disabledirexistswarning,disabledirpage,disablefinishedpage,' + - 'disableprogramgrouppage,disablereadymemo,disablereadypage,' + - 'disablestartupprompt,diskclustersize,disksize,diskspacemblabel,' + - 'diskspanning,dontmergeduplicatefiles,enabledirdoesntexistwarning,' + - 'extradiskspacerequired,filename,flags,flatcomponentslist,fontinstall,' + - 'groupdescription,hotkey,iconfilename,iconindex,infoafterfile,infobeforefile,' + - 'installmode,internalcompresslevel,key,licensefile,messagesfile,minversion,name,' + - 'onlybelowversion,outputbasefilename,outputdir,overwriteuninstregentries,' + - 'parameters,password,reservebytes,root,runonceid,section,' + - 'showcomponentsizes,source,sourcedir,statusmsg,subkey,tasks,type,types,' + - 'uninstalldisplayicon,uninstalldisplayname,uninstallfilesdir,' + - 'uninstalliconname,uninstalllogmode,uninstallstyle,uninstallable,' + - 'updateuninstalllogappname,usepreviousappdir,usepreviousgroup,' + - 'useprevioustasks,useprevioussetuptype,usesetupldr,valuedata,valuename,' + - 'valuetype,windowresizable,windowshowcaption,windowstartmaximized,' + - 'windowvisible,wizardimagebackcolor,wizardimagefile,wizardsmallimagefile,' + - 'wizardstyle,workingdir'; - - Parameters: string = - 'hkcc,hkcr,hkcu,hklm,hku,alwaysoverwrite,alwaysskipifsameorolder,append,' + - 'binary,classic,closeonexit,comparetimestampalso,confirmoverwrite,' + - 'createkeyifdoesntexist,createonlyiffileexists,createvalueifdoesntexist,' + - 'deleteafterinstall,deletekey,deletevalue,dirifempty,dontcloseonexit,' + - 'dontcreatekey,disablenouninstallwarning,dword,exclusive,expandsz,' + - 'external,files,filesandordirs,fixed,fontisnttruetype,iscustom,isreadme,' + - 'modern,multisz,new,noerror,none,normal,nowait,onlyifdestfileexists,' + - 'onlyifdoesntexist,overwrite,overwritereadonly,postinstall,' + - 'preservestringtype,regserver,regtypelib,restart,restartreplace,' + - 'runmaximized,runminimized,sharedfile,shellexec,showcheckbox,' + - 'skipifnotsilent,skipifsilent,silent,skipifdoesntexist,' + - 'skipifsourcedoesntexist,unchecked,uninsalwaysuninstall,' + - 'uninsclearvalue,uninsdeleteentry,uninsdeletekey,uninsdeletekeyifempty,' + - 'uninsdeletesection,uninsdeletesectionifempty,uninsdeletevalue,' + - 'uninsneveruninstall,useapppaths,verysilent,waituntilidle'; - - KeyOrParameter: string = 'string'; - -function TSynInnoSyn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - '_': Result := 1; - 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); - else Result := 0; - end; - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - inc(Str); - end; - Result := Result and $1FF; // 511 - fStringLen := Str - fToIdent; -end; - -function TSynInnoSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - fToIdent := MayBe; - Entry := fKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > fStringLen then - break - else if Entry.KeywordLen = fStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; -end; - -function TSynInnoSyn.IsCurrentToken(const Token: string): Boolean; - var - I: Integer; - Temp: PWideChar; -begin - Temp := fToIdent; - if Length(Token) = fStringLen then - begin - Result := True; - for i := 1 to fStringLen do - begin - if SysUtils.AnsiLowerCase(Temp^)[1] <> SysUtils.AnsiLowerCase(Token[i])[1] then - begin - Result := False; - break; - end; - inc(Temp); - end; - end - else - Result := False; -end; - -constructor TSynInnoSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fCaseSensitive := False; - - fKeywords := TSynHashEntryList.Create; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clGray; - AddAttribute(fCommentAttri); - - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(fInvalidAttri); - - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - fKeyAttri.Foreground := clNavy; - AddAttribute(fKeyAttri); - - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clMaroon; - AddAttribute(fNumberAttri); - - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; - AddAttribute(fStringAttri); - - fConstantAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - fConstantAttri.Style := [fsBold, fsItalic]; - fConstantAttri.Foreground := clTeal; - AddAttribute(fConstantAttri); - - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - - //Parameters - fParamAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - fParamAttri.Style := [fsBold]; - fParamAttri.Foreground := clOlive; - AddAttribute(fParamAttri); - - fSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); - fSectionAttri.Style := [fsBold]; - fSectionAttri.Foreground := clRed; - AddAttribute(fSectionAttri); - - SetAttributesOnChange(DefHighlightChange); - EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkParameter), Parameters, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkKeyOrParameter), KeyOrParameter, IsIdentChar, - DoAddKeyword); - fDefaultFilter := SYNS_FilterInno; -end; - -destructor TSynInnoSyn.Destroy; -begin - fKeywords.Free; - inherited Destroy; -end; - -procedure TSynInnoSyn.SymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); -end; - -procedure TSynInnoSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynInnoSyn.EqualProc; -begin -// If any word has equal (=) symbol, -// then the immediately followed text is treated as string -// (though it does not have quotes) - fTokenID := tkString; - repeat - Inc(Run); - if fLine[Run] = ';' then - begin - Inc(Run); - break; - end; - until IsLineEnd(Run); -end; - -procedure TSynInnoSyn.IdentProc; -var - LookAhead: integer; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - if fTokenID = tkKeyOrParameter then - begin - LookAhead := Run; - while CharInSet(fLine[LookAhead], [#9, ' ']) do - Inc(LookAhead); - if fLine[LookAhead] = ':' then - fTokenID := tkKey - else - fTokenID := tkParameter; - end; -end; - -procedure TSynInnoSyn.SectionProc; -begin - // if it is not column 0 mark as tkParameter and get out of here - if Run > 0 then - begin - fTokenID := tkUnknown; - inc(Run); - Exit; - end; - - // this is column 0 ok it is a Section - fTokenID := tkSection; - repeat - Inc(Run); - if fLine[Run] = ']' then - begin - Inc(Run); - break; - end; - until IsLineEnd(Run); -end; - -procedure TSynInnoSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynInnoSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynInnoSyn.NumberProc; -begin - fTokenID := tkNumber; - repeat - Inc(Run); - until not CharInSet(fLine[Run], ['0'..'9']); -end; - -procedure TSynInnoSyn.ConstantProc; -var - BraceLevel, LastOpenBrace: Integer; -begin - { Much of this is based on code from the SkipPastConst function in IS's - CmnFunc2 unit. [jr] } - if fLine[Run + 1] = '{' then - begin - { '{{' is not a constant } - fTokenID := tkUnknown; - Inc(Run, 2); - Exit; - end; - fTokenID := tkConstant; - BraceLevel := 1; - LastOpenBrace := Low(Integer); - repeat - Inc(Run); - case fLine[Run] of - '{': begin - if LastOpenBrace <> Run - 1 then - begin - Inc(BraceLevel); - LastOpenBrace := Run; - end - else - { Skip over '{{' when in an embedded constant } - Dec(BraceLevel); - end; - '}': begin - Dec (BraceLevel); - if BraceLevel = 0 then - begin - Inc(Run); - Break; - end; - end; - end; - until IsLineEnd(Run); -end; - -procedure TSynInnoSyn.SpaceProc; -begin - fTokenID := tkSpace; - repeat - Inc(Run); - until (fLine[Run] > #32) or IsLineEnd(Run); -end; - -procedure TSynInnoSyn.SemiColonProc; -var - I: Integer; -begin - for I := Run-1 downto 0 do - if fLine[I] > ' ' then begin - // If the semicolon is not the first non-whitespace character on the - // line, then it isn't the start of a comment. - fTokenID := tkUnknown; - inc(Run); - Exit; - end; - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynInnoSyn.StringProc; -begin - fTokenID := tkString; - repeat - Inc(Run); - if fLine[Run] = '"' then begin - Inc(Run); - if fLine[Run] <> '"' then // embedded "" does not end the string - break; - end; - until IsLineEnd(Run); -end; - -procedure TSynInnoSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynInnoSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #59 {';'}: SemiColonProc; - #61 {'='}: EqualProc; - #34: StringProc; - '#', ':', ',', '(', ')': SymbolProc; - '{': ConstantProc; - #91 {'['} : SectionProc; - else UnknownProc; - end; - inherited; -end; - -function TSynInnoSyn.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 TSynInnoSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynInnoSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkParameter: Result := fParamAttri; - tkSection: Result := fSectionAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkConstant: Result := fConstantAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynInnoSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynInnoSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynInnoSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterInno; -end; - -class function TSynInnoSyn.GetLanguageName: string; -begin - Result := SYNS_LangInno; -end; - -procedure TSynInnoSyn.DoAddKeyword(AKeyword: string; AKind: integer); -var - HashValue: Integer; -begin - HashValue := HashKey(PWideChar(AKeyword)); - fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -class function TSynInnoSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangInno; -end; - -initialization - RegisterPlaceableHighlighter(TSynInnoSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterInno.pas, released 2000-05-01. +The Initial Author of this file is Satya. +Portions created by Satya are Copyright 2000 Satya. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynHighlighterInno.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides an Inno script file highlighter for SynEdit) +@author(Satya) +@created(2000-05-01) +@lastmod(2001-01-23) +The SynHighlighterInno unit provides an Inno script file highlighter for SynEdit. +Check out http://www.jrsoftware.org for the free Inno Setup program, +and http://www.wintax.nl/isx/ for My Inno Setup Extensions. +} + +unit SynHighlighterInno; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynHighlighterHashEntries, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkConstant, tkIdentifier, tkKey, tkKeyOrParameter, + tkNull, tkNumber, tkParameter, tkSection, tkSpace, tkString, tkSymbol, + tkUnknown); + + TSynInnoSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FConstantAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FSectionAttri: TSynHighlighterAttributes; + FParamAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FInvalidAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FKeywords: TSynHashEntryList; + function HashKey(Str: PWideChar): Integer; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure SymbolProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure SectionProc; + procedure SpaceProc; + procedure EqualProc; + procedure ConstantProc; + procedure SemiColonProc; + procedure StringProc; + procedure UnknownProc; + procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + protected + function IsCurrentToken(const Token: UnicodeString): Boolean; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenID: TtkTokenKind; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property ConstantAttri: TSynHighlighterAttributes read FConstantAttri + write FConstantAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri + write FInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property ParameterAttri: TSynHighlighterAttributes read FParamAttri + write FParamAttri; + property SectionAttri: TSynHighlighterAttributes read FSectionAttri + write FSectionAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + {Note: new 'Section names' and the new 'Constants' need not be added + as they are highlighted automatically} + + {Ref: Keywords and Parameters are updated as they last appeared in + Inno Setup / ISX version 1.3.26} + + Keywords: UnicodeString = + 'adminprivilegesrequired,allownoicons,allowrootdirectory,allowuncpath,' + + 'alwayscreateuninstallicon,alwaysrestart,alwaysshowcomponentslist,' + + 'alwaysshowdironreadypage,alwaysshowgrouponreadypage,' + + 'alwaysusepersonalgroup,appcopyright,appid,appmutex,appname,apppublisher,' + + 'apppublisherurl,appsupporturl,appupdatesurl,appvername,appversion,' + + 'attribs,backcolor,backcolor2,backcolordirection,backsolid,bits,' + + 'changesassociations,check,codefile,comment,components,compression,compresslevel,copymode,'+ + 'createappdir,createuninstallregkey,defaultdirname,defaultgroupname,' + + 'description,destdir,destname,direxistswarning,disableappenddir,' + + 'disabledirexistswarning,disabledirpage,disablefinishedpage,' + + 'disableprogramgrouppage,disablereadymemo,disablereadypage,' + + 'disablestartupprompt,diskclustersize,disksize,diskspacemblabel,' + + 'diskspanning,dontmergeduplicatefiles,enabledirdoesntexistwarning,' + + 'extradiskspacerequired,filename,flags,flatcomponentslist,fontinstall,' + + 'groupdescription,hotkey,iconfilename,iconindex,infoafterfile,infobeforefile,' + + 'installmode,internalcompresslevel,key,licensefile,messagesfile,minversion,name,' + + 'onlybelowversion,outputbasefilename,outputdir,overwriteuninstregentries,' + + 'parameters,password,reservebytes,root,runonceid,section,' + + 'showcomponentsizes,source,sourcedir,statusmsg,subkey,tasks,type,types,' + + 'uninstalldisplayicon,uninstalldisplayname,uninstallfilesdir,' + + 'uninstalliconname,uninstalllogmode,uninstallstyle,uninstallable,' + + 'updateuninstalllogappname,usepreviousappdir,usepreviousgroup,' + + 'useprevioustasks,useprevioussetuptype,usesetupldr,valuedata,valuename,' + + 'valuetype,windowresizable,windowshowcaption,windowstartmaximized,' + + 'windowvisible,wizardimagebackcolor,wizardimagefile,wizardsmallimagefile,' + + 'wizardstyle,workingdir'; + + Parameters: UnicodeString = + 'hkcc,hkcr,hkcu,hklm,hku,alwaysoverwrite,alwaysskipifsameorolder,append,' + + 'binary,classic,closeonexit,comparetimestampalso,confirmoverwrite,' + + 'createkeyifdoesntexist,createonlyiffileexists,createvalueifdoesntexist,' + + 'deleteafterinstall,deletekey,deletevalue,dirifempty,dontcloseonexit,' + + 'dontcreatekey,disablenouninstallwarning,dword,exclusive,expandsz,' + + 'external,files,filesandordirs,fixed,fontisnttruetype,iscustom,isreadme,' + + 'modern,multisz,new,noerror,none,normal,nowait,onlyifdestfileexists,' + + 'onlyifdoesntexist,overwrite,overwritereadonly,postinstall,' + + 'preservestringtype,regserver,regtypelib,restart,restartreplace,' + + 'runmaximized,runminimized,sharedfile,shellexec,showcheckbox,' + + 'skipifnotsilent,skipifsilent,silent,skipifdoesntexist,' + + 'skipifsourcedoesntexist,unchecked,uninsalwaysuninstall,' + + 'uninsclearvalue,uninsdeleteentry,uninsdeletekey,uninsdeletekeyifempty,' + + 'uninsdeletesection,uninsdeletesectionifempty,uninsdeletevalue,' + + 'uninsneveruninstall,useapppaths,verysilent,waituntilidle'; + + KeyOrParameter: UnicodeString = 'string'; + +function TSynInnoSyn.HashKey(Str: PWideChar): Integer; + + function GetOrd: Integer; + begin + case Str^ of + '_': Result := 1; + 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); + 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); + else Result := 0; + end; + end; + +begin + Result := 0; + while IsIdentChar(Str^) do + begin +{$IFOPT Q-} + Result := 7 * Result + GetOrd; +{$ELSE} + Result := (7 * Result + GetOrd) and $FFFFFF; +{$ENDIF} + Inc(Str); + end; + Result := Result and $1FF; // 511 + FStringLen := Str - FToIdent; +end; + +function TSynInnoSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Entry: TSynHashEntry; +begin + FToIdent := MayBe; + Entry := FKeywords[HashKey(MayBe)]; + while Assigned(Entry) do + begin + if Entry.KeywordLen > FStringLen then + Break + else if Entry.KeywordLen = FStringLen then + if IsCurrentToken(Entry.Keyword) then + begin + Result := TtkTokenKind(Entry.Kind); + Exit; + end; + Entry := Entry.Next; + end; + Result := tkIdentifier; +end; + +function TSynInnoSyn.IsCurrentToken(const Token: UnicodeString): Boolean; + var + I: Integer; + Temp: PWideChar; +begin + Temp := FToIdent; + if Length(Token) = FStringLen then + begin + Result := True; + for i := 1 to FStringLen do + begin + if SynWideLowerCase(Temp^)[1] <> SynWideLowerCase(Token[i])[1] then + begin + Result := False; + Break; + end; + Inc(Temp); + end; + end + else + Result := False; +end; + +constructor TSynInnoSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCaseSensitive := False; + + FKeywords := TSynHashEntryList.Create; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clGray; + AddAttribute(FCommentAttri); + + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(FInvalidAttri); + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + FKeyAttri.Foreground := clNavy; + AddAttribute(FKeyAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clMaroon; + AddAttribute(FNumberAttri); + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Foreground := clBlue; + AddAttribute(FStringAttri); + + FConstantAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + FConstantAttri.Style := [fsBold, fsItalic]; + FConstantAttri.Foreground := clTeal; + AddAttribute(FConstantAttri); + + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + + //Parameters + FParamAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + FParamAttri.Style := [fsBold]; + FParamAttri.Foreground := clOlive; + AddAttribute(FParamAttri); + + FSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); + FSectionAttri.Style := [fsBold]; + FSectionAttri.Foreground := clRed; + AddAttribute(FSectionAttri); + + SetAttributesOnChange(DefHighlightChange); + EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkParameter), Parameters, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkKeyOrParameter), KeyOrParameter, IsIdentChar, + DoAddKeyword); + FDefaultFilter := SYNS_FilterInno; +end; + +destructor TSynInnoSyn.Destroy; +begin + FKeywords.Free; + inherited Destroy; +end; + +procedure TSynInnoSyn.SymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); +end; + +procedure TSynInnoSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynInnoSyn.EqualProc; +begin +// If any word has equal (=) symbol, +// then the immediately followed text is treated as string +// (though it does not have quotes) + FTokenID := tkString; + repeat + Inc(Run); + if FLine[Run] = ';' then + begin + Inc(Run); + Break; + end; + until IsLineEnd(Run); +end; + +procedure TSynInnoSyn.IdentProc; +var + LookAhead: Integer; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + if FTokenID = tkKeyOrParameter then + begin + LookAhead := Run; + while CharInSet(FLine[LookAhead], [#9, ' ']) do + Inc(LookAhead); + if FLine[LookAhead] = ':' then + FTokenID := tkKey + else + FTokenID := tkParameter; + end; +end; + +procedure TSynInnoSyn.SectionProc; +begin + // if it is not column 0 mark as tkParameter and get out of here + if Run > 0 then + begin + FTokenID := tkUnknown; + Inc(Run); + Exit; + end; + + // this is column 0 ok it is a Section + FTokenID := tkSection; + repeat + Inc(Run); + if FLine[Run] = ']' then + begin + Inc(Run); + Break; + end; + until IsLineEnd(Run); +end; + +procedure TSynInnoSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynInnoSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynInnoSyn.NumberProc; +begin + FTokenID := tkNumber; + repeat + Inc(Run); + until not CharInSet(FLine[Run], ['0'..'9']); +end; + +procedure TSynInnoSyn.ConstantProc; +var + BraceLevel, LastOpenBrace: Integer; +begin + { Much of this is based on code from the SkipPastConst function in IS's + CmnFunc2 unit. [jr] } + if FLine[Run + 1] = '{' then + begin + { '{{' is not a constant } + FTokenID := tkUnknown; + Inc(Run, 2); + Exit; + end; + FTokenID := tkConstant; + BraceLevel := 1; + LastOpenBrace := Low(Integer); + repeat + Inc(Run); + case FLine[Run] of + '{': begin + if LastOpenBrace <> Run - 1 then + begin + Inc(BraceLevel); + LastOpenBrace := Run; + end + else + { Skip over '{{' when in an embedded constant } + Dec(BraceLevel); + end; + '}': begin + Dec (BraceLevel); + if BraceLevel = 0 then + begin + Inc(Run); + Break; + end; + end; + end; + until IsLineEnd(Run); +end; + +procedure TSynInnoSyn.SpaceProc; +begin + FTokenID := tkSpace; + repeat + Inc(Run); + until (FLine[Run] > #32) or IsLineEnd(Run); +end; + +procedure TSynInnoSyn.SemiColonProc; +var + I: Integer; +begin + for I := Run-1 downto 0 do + if FLine[I] > ' ' then begin + // If the semicolon is not the first non-whitespace character on the + // line, then it isn't the start of a comment. + FTokenID := tkUnknown; + Inc(Run); + Exit; + end; + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynInnoSyn.StringProc; +begin + FTokenID := tkString; + repeat + Inc(Run); + if FLine[Run] = '"' then begin + Inc(Run); + if FLine[Run] <> '"' then // embedded "" does not end the string + Break; + end; + until IsLineEnd(Run); +end; + +procedure TSynInnoSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynInnoSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #59 {';'}: SemiColonProc; + #61 {'='}: EqualProc; + #34: StringProc; + '#', ':', ',', '(', ')': SymbolProc; + '{': ConstantProc; + #91 {'['} : SectionProc; + else UnknownProc; + end; + inherited; +end; + +function TSynInnoSyn.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 TSynInnoSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynInnoSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkParameter: Result := FParamAttri; + tkSection: Result := FSectionAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkConstant: Result := FConstantAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynInnoSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynInnoSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynInnoSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterInno; +end; + +class function TSynInnoSyn.GetLanguageName: string; +begin + Result := SYNS_LangInno; +end; + +procedure TSynInnoSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +var + HashValue: Integer; +begin + HashValue := HashKey(PWideChar(AKeyword)); + FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); +end; + +class function TSynInnoSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangInno; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynInnoSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterJSON.pas b/Source/VCL/SynEdit/Source/SynHighlighterJSON.pas index 2e8e2a1e..7cee7f56 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterJSON.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterJSON.pas @@ -31,6 +31,8 @@ unit SynHighlighterJSON; +{$I SynEdit.inc} + interface uses @@ -39,11 +41,7 @@ interface SynEditTypes, SynEditHighlighter, SynUnicode, - //++ CodeFolding - SynEditCodeFolding, - //++ CodeFolding - SysUtils, - Classes; + SysUtils, Classes; type TtkTokenKind = (tkString, tkReserved, tkNull, tkNumber, tkSpace, @@ -52,9 +50,7 @@ interface TRangeState = (rsUnknown, rsAttribute, rsObjectValue, rsArrayValue); type -//++ CodeFolding - TSynJSONSyn = class(TSynCustomCodeFoldingHighlighter) -//-- CodeFolding + TSynJSONSyn = class(TSynCustomHighLighter) private FRange: TRangeState; FTokenID: TtkTokenKind; @@ -80,27 +76,23 @@ TSynJSONSyn = class(TSynCustomCodeFoldingHighlighter) procedure SymbolProc; procedure UnknownProc; protected - function GetSampleSource: string; override; + function GetSampleSource: UnicodeString; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; public constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; function GetRange: Pointer; override; function GetTokenID: TtkTokenKind; function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; + function GetTokenKind: Integer; override; procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; -//++ CodeFolding - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -//-- CodeFolding published property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri write FAttributeAttri; @@ -121,6 +113,7 @@ implementation uses SynEditStrConst; + { TSynJSONSyn } constructor TSynJSONSyn.Create(AOwner: TComponent); @@ -347,7 +340,12 @@ procedure TSynJSONSyn.SpaceProc; procedure TSynJSONSyn.StringProc; - function IsHex(Digit: Char): Boolean; + function IsHex(Digit: AnsiChar): Boolean; overload; + begin + Result := CharInSet(Digit, ['0'..'9', 'A'..'F', 'a'..'f']); + end; + + function IsHex(Digit: WideChar): Boolean; overload; begin Result := CharInSet(Digit, ['0'..'9', 'A'..'F', 'a'..'f']); end; @@ -400,7 +398,7 @@ procedure TSynJSONSyn.UnknownProc; procedure TSynJSONSyn.Next; begin - fTokenPos := Run; + FTokenPos := Run; case FLine[Run] of #0: NullProc; #1..#9, #11, #12, #14..#32: SpaceProc; @@ -423,7 +421,7 @@ procedure TSynJSONSyn.Next; inherited; end; -function TSynJSONSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; +function TSynJSONSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of SYN_ATTR_KEYWORD: Result := FReservedAttri; @@ -438,7 +436,7 @@ function TSynJSONSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttribu function TSynJSONSyn.GetEol: Boolean; begin - Result := Run = fLineLen + 1; + Result := Run = FLineLen + 1; end; function TSynJSONSyn.GetRange: Pointer; @@ -468,7 +466,7 @@ function TSynJSONSyn.GetTokenAttribute: TSynHighlighterAttributes; end; end; -function TSynJSONSyn.GetTokenKind: integer; +function TSynJSONSyn.GetTokenKind: Integer; begin Result := Ord(FTokenID); end; @@ -478,87 +476,6 @@ procedure TSynJSONSyn.ResetRange; FRange := rsUnknown; end; -//++ CodeFolding -procedure TSynJSONSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - CurLine: String; - Line: Integer; - - function LineHasChar(Line: Integer; character: char; - StartCol : Integer): boolean; // faster than Pos! - var - i: Integer; - begin - result := false; - for I := StartCol to Length(CurLine) do begin - if CurLine[i] = character then begin - // Char must have proper highlighting (ignore stuff inside comments...) - if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> CommentAttribute then begin - result := true; - break; - end; - end; - end; - end; - - function FindBraces(Line: Integer; OpenBrace, CloseBrace: char; FoldType: integer) : Boolean; - Var - Col : Integer; - begin - Result := False; - - for Col := 1 to Length(CurLine) do - begin - // We've found a starting character - if CurLine[col] = OpenBrace then - begin - // Char must have proper highlighting (ignore stuff inside comments...) - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> CommentAttribute then - begin - // And ignore lines with both opening and closing chars in them - if not LineHasChar(Line, CloseBrace, col + 1) then begin - FoldRanges.StartFoldRange(Line + 1, FoldType); - Result := True; - end; - // Skip until a newline - break; - end; - end else if CurLine[col] = CloseBrace then - begin - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> CommentAttribute then - begin - // And ignore lines with both opening and closing chars in them - if not LineHasChar(Line, OpenBrace, col + 1) then begin - FoldRanges.StopFoldRange(Line + 1, FoldType); - Result := True; - end; - // Skip until a newline - break; - end; - end; - end; // for Col - end; - -begin - for Line := FromLine to ToLine do - begin - CurLine := LinesToScan[Line]; - - // Skip empty lines - if CurLine = '' then begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // Find an braces on this line (Fold Type 1) - if not FindBraces(Line, '{', '}', 1) then - if not FindBraces(Line, '[', ']', 2) then - FoldRanges.NoFoldInfo(Line + 1); - end; // while Line -end; -//-- CodeFolding - procedure TSynJSONSyn.SetRange(Value: Pointer); begin FRange := TRangeState(Value); @@ -574,7 +491,7 @@ class function TSynJSONSyn.GetLanguageName: string; Result := SYNS_LangJSON; end; -function TSynJSONSyn.GetSampleSource: string; +function TSynJSONSyn.GetSampleSource: UnicodeString; begin Result := '{'#13#10 + @@ -605,11 +522,13 @@ function TSynJSONSyn.GetSampleSource: string; '}'; end; -class function TSynJSONSyn.GetFriendlyLanguageName: string; +class function TSynJSONSyn.GetFriendlyLanguageName: UnicodeString; begin Result := SYNS_FriendlyLangJSON; end; initialization +{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynJSONSyn); +{$ENDIF} end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterJScript.pas b/Source/VCL/SynEdit/Source/SynHighlighterJScript.pas index e2c941e9..07718603 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterJScript.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterJScript.pas @@ -1,4895 +1,4900 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterJScript.pas, released 2000-04-14. -The Original Code is based on the mwJScript.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Tony de Buys. -Unicode translation by Maël Hörz. -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: SynHighlighterJScript.pas,v 1.21.2.8 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a JavaScript/JScript highlighter for SynEdit) -@author(Tony De Buys [tony@lad.co.za], converted to SynEdit by David Muir ) -@created(December 1999, converted to SynEdit April 14, 2000) -@lastmod(2000-06-23) -The SynHighlighterJScript unit provides SynEdit with a JScript/JavaScript (.js) highlighter. -The highlighter formats JavaScript source code highlighting keywords, strings, numbers and characters. -} - -unit SynHighlighterJScript; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes, -//++ CodeFolding - SynEditCodeFolding; -//++ CodeFolding - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown, tkNonReservedKey, tkEvent); - - TRangeState = (rsUnknown, rsANSI); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type -//++ CodeFolding - TSynJScriptSyn = class(TSynCustomCodeFoldingHighlighter) -//-- CodeFolding - private - fRange: TRangeState; - FTokenID: TtkTokenKind; - fIdentFuncTable: array[0..5152] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNonReservedKeyAttri: TSynHighlighterAttributes; - fEventAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncAbs(Index: Integer): TtkTokenKind; - function FuncAbstract(Index: Integer): TtkTokenKind; - function FuncAcos(Index: Integer): TtkTokenKind; - function FuncAction(Index: Integer): TtkTokenKind; - function FuncAlert(Index: Integer): TtkTokenKind; - function FuncAlign(Index: Integer): TtkTokenKind; - function FuncAlinkcolor(Index: Integer): TtkTokenKind; - function FuncAll(Index: Integer): TtkTokenKind; - function FuncAnchor(Index: Integer): TtkTokenKind; - function FuncAnchors(Index: Integer): TtkTokenKind; - function FuncAppcodename(Index: Integer): TtkTokenKind; - function FuncApplet(Index: Integer): TtkTokenKind; - function FuncApplets(Index: Integer): TtkTokenKind; - function FuncAppname(Index: Integer): TtkTokenKind; - function FuncAppversion(Index: Integer): TtkTokenKind; - function FuncArea(Index: Integer): TtkTokenKind; - function FuncArguments(Index: Integer): TtkTokenKind; - function FuncArray(Index: Integer): TtkTokenKind; - function FuncAsin(Index: Integer): TtkTokenKind; - function FuncAtan(Index: Integer): TtkTokenKind; - function FuncAtan2(Index: Integer): TtkTokenKind; - function FuncBack(Index: Integer): TtkTokenKind; - function FuncBackground(Index: Integer): TtkTokenKind; - function FuncBgcolor(Index: Integer): TtkTokenKind; - function FuncBig(Index: Integer): TtkTokenKind; - function FuncBlink(Index: Integer): TtkTokenKind; - function FuncBlur(Index: Integer): TtkTokenKind; - function FuncBody(Index: Integer): TtkTokenKind; - function FuncBold(Index: Integer): TtkTokenKind; - function FuncBoolean(Index: Integer): TtkTokenKind; - function FuncBoolean2(Index: Integer): TtkTokenKind; - function FuncBorder(Index: Integer): TtkTokenKind; - function FuncBottom(Index: Integer): TtkTokenKind; - function FuncBreak(Index: Integer): TtkTokenKind; - function FuncButton(Index: Integer): TtkTokenKind; - function FuncByte(Index: Integer): TtkTokenKind; - function FuncCall(Index: Integer): TtkTokenKind; - function FuncCallee(Index: Integer): TtkTokenKind; - function FuncCaller(Index: Integer): TtkTokenKind; - function FuncCaptureevents(Index: Integer): TtkTokenKind; - function FuncCase(Index: Integer): TtkTokenKind; - function FuncCatch(Index: Integer): TtkTokenKind; - function FuncCeil(Index: Integer): TtkTokenKind; - function FuncChar(Index: Integer): TtkTokenKind; - function FuncCharat(Index: Integer): TtkTokenKind; - function FuncCharcodeat(Index: Integer): TtkTokenKind; - function FuncCheckbox(Index: Integer): TtkTokenKind; - function FuncChecked(Index: Integer): TtkTokenKind; - function FuncClass(Index: Integer): TtkTokenKind; - function FuncClear(Index: Integer): TtkTokenKind; - function FuncClearinterval(Index: Integer): TtkTokenKind; - function FuncCleartimeout(Index: Integer): TtkTokenKind; - function FuncClick(Index: Integer): TtkTokenKind; - function FuncClose(Index: Integer): TtkTokenKind; - function FuncClosed(Index: Integer): TtkTokenKind; - function FuncColor(Index: Integer): TtkTokenKind; - function FuncComplete(Index: Integer): TtkTokenKind; - function FuncConcat(Index: Integer): TtkTokenKind; - function FuncConfirm(Index: Integer): TtkTokenKind; - function FuncConst(Index: Integer): TtkTokenKind; - function FuncConstructor(Index: Integer): TtkTokenKind; - function FuncContinue(Index: Integer): TtkTokenKind; - function FuncCookie(Index: Integer): TtkTokenKind; - function FuncCos(Index: Integer): TtkTokenKind; - function FuncCurrent(Index: Integer): TtkTokenKind; - function FuncDate(Index: Integer): TtkTokenKind; - function FuncDebugger(Index: Integer): TtkTokenKind; - function FuncDefault(Index: Integer): TtkTokenKind; - function FuncDefaultchecked(Index: Integer): TtkTokenKind; - function FuncDefaultselected(Index: Integer): TtkTokenKind; - function FuncDefaultstatus(Index: Integer): TtkTokenKind; - function FuncDefaultvalue(Index: Integer): TtkTokenKind; - function FuncDelete(Index: Integer): TtkTokenKind; - function FuncDescription(Index: Integer): TtkTokenKind; - function FuncDisplay(Index: Integer): TtkTokenKind; - function FuncDo(Index: Integer): TtkTokenKind; - function FuncDocument(Index: Integer): TtkTokenKind; - function FuncDomain(Index: Integer): TtkTokenKind; - function FuncDouble(Index: Integer): TtkTokenKind; - function FuncE(Index: Integer): TtkTokenKind; - function FuncElements(Index: Integer): TtkTokenKind; - function FuncElse(Index: Integer): TtkTokenKind; - function FuncEmbed(Index: Integer): TtkTokenKind; - function FuncEmbeds(Index: Integer): TtkTokenKind; - function FuncEnabledplugin(Index: Integer): TtkTokenKind; - function FuncEncoding(Index: Integer): TtkTokenKind; - function FuncEnum(Index: Integer): TtkTokenKind; - function FuncEscape(Index: Integer): TtkTokenKind; - function FuncEval(Index: Integer): TtkTokenKind; - function FuncEvent(Index: Integer): TtkTokenKind; - function FuncExp(Index: Integer): TtkTokenKind; - function FuncExport(Index: Integer): TtkTokenKind; - function FuncExtends(Index: Integer): TtkTokenKind; - function FuncFalse(Index: Integer): TtkTokenKind; - function FuncFgcolor(Index: Integer): TtkTokenKind; - function FuncFilename(Index: Integer): TtkTokenKind; - function FuncFileupload(Index: Integer): TtkTokenKind; - function FuncFinal(Index: Integer): TtkTokenKind; - function FuncFinally(Index: Integer): TtkTokenKind; - function FuncFind(Index: Integer): TtkTokenKind; - function FuncFixed(Index: Integer): TtkTokenKind; - function FuncFloat(Index: Integer): TtkTokenKind; - function FuncFloat2(Index: Integer): TtkTokenKind; - function FuncFloor(Index: Integer): TtkTokenKind; - function FuncFocus(Index: Integer): TtkTokenKind; - function FuncFontcolor(Index: Integer): TtkTokenKind; - function FuncFontsize(Index: Integer): TtkTokenKind; - function FuncFor(Index: Integer): TtkTokenKind; - function FuncForm(Index: Integer): TtkTokenKind; - function FuncForms(Index: Integer): TtkTokenKind; - function FuncForward(Index: Integer): TtkTokenKind; - function FuncFrame(Index: Integer): TtkTokenKind; - function FuncFrames(Index: Integer): TtkTokenKind; - function FuncFromcharcode(Index: Integer): TtkTokenKind; - function FuncFunction(Index: Integer): TtkTokenKind; - function FuncFunction2(Index: Integer): TtkTokenKind; - function FuncGetdate(Index: Integer): TtkTokenKind; - function FuncGetday(Index: Integer): TtkTokenKind; - function FuncGetelementbyid(Index: Integer): TtkTokenKind; - function FuncGetfullyear(Index: Integer): TtkTokenKind; - function FuncGethours(Index: Integer): TtkTokenKind; - function FuncGetmilliseconds(Index: Integer): TtkTokenKind; - function FuncGetminutes(Index: Integer): TtkTokenKind; - function FuncGetmonth(Index: Integer): TtkTokenKind; - function FuncGetseconds(Index: Integer): TtkTokenKind; - function FuncGettime(Index: Integer): TtkTokenKind; - function FuncGettimezoneoffset(Index: Integer): TtkTokenKind; - function FuncGetutcdate(Index: Integer): TtkTokenKind; - function FuncGetutcday(Index: Integer): TtkTokenKind; - function FuncGetutcfullyear(Index: Integer): TtkTokenKind; - function FuncGetutchours(Index: Integer): TtkTokenKind; - function FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; - function FuncGetutcminutes(Index: Integer): TtkTokenKind; - function FuncGetutcmonth(Index: Integer): TtkTokenKind; - function FuncGetutcseconds(Index: Integer): TtkTokenKind; - function FuncGetyear(Index: Integer): TtkTokenKind; - function FuncGlobal(Index: Integer): TtkTokenKind; - function FuncGo(Index: Integer): TtkTokenKind; - function FuncGoto(Index: Integer): TtkTokenKind; - function FuncHandleevent(Index: Integer): TtkTokenKind; - function FuncHash(Index: Integer): TtkTokenKind; - function FuncHeight(Index: Integer): TtkTokenKind; - function FuncHidden(Index: Integer): TtkTokenKind; - function FuncHistory(Index: Integer): TtkTokenKind; - function FuncHome(Index: Integer): TtkTokenKind; - function FuncHost(Index: Integer): TtkTokenKind; - function FuncHostname(Index: Integer): TtkTokenKind; - function FuncHref(Index: Integer): TtkTokenKind; - function FuncHspace(Index: Integer): TtkTokenKind; - function FuncIf(Index: Integer): TtkTokenKind; - function FuncImage(Index: Integer): TtkTokenKind; - function FuncImages(Index: Integer): TtkTokenKind; - function FuncImplements(Index: Integer): TtkTokenKind; - function FuncImport(Index: Integer): TtkTokenKind; - function FuncIn(Index: Integer): TtkTokenKind; - function FuncIndex(Index: Integer): TtkTokenKind; - function FuncIndexof(Index: Integer): TtkTokenKind; - function FuncInfinity(Index: Integer): TtkTokenKind; - function FuncInnerheight(Index: Integer): TtkTokenKind; - function FuncInnerwidth(Index: Integer): TtkTokenKind; - function FuncInput(Index: Integer): TtkTokenKind; - function FuncInstanceof(Index: Integer): TtkTokenKind; - function FuncInt(Index: Integer): TtkTokenKind; - function FuncInterface(Index: Integer): TtkTokenKind; - function FuncIsfinite(Index: Integer): TtkTokenKind; - function FuncIsnan(Index: Integer): TtkTokenKind; - function FuncItalics(Index: Integer): TtkTokenKind; - function FuncJava(Index: Integer): TtkTokenKind; - function FuncJavaenabled(Index: Integer): TtkTokenKind; - function FuncJoin(Index: Integer): TtkTokenKind; - function FuncLastindexof(Index: Integer): TtkTokenKind; - function FuncLastmodified(Index: Integer): TtkTokenKind; - function FuncLayer(Index: Integer): TtkTokenKind; - function FuncLayers(Index: Integer): TtkTokenKind; - function FuncLeft(Index: Integer): TtkTokenKind; - function FuncLength(Index: Integer): TtkTokenKind; - function FuncLink(Index: Integer): TtkTokenKind; - function FuncLinkcolor(Index: Integer): TtkTokenKind; - function FuncLinks(Index: Integer): TtkTokenKind; - function FuncLn10(Index: Integer): TtkTokenKind; - function FuncLn2(Index: Integer): TtkTokenKind; - function FuncLocation(Index: Integer): TtkTokenKind; - function FuncLocationbar(Index: Integer): TtkTokenKind; - function FuncLog(Index: Integer): TtkTokenKind; - function FuncLog10e(Index: Integer): TtkTokenKind; - function FuncLog2e(Index: Integer): TtkTokenKind; - function FuncLogon(Index: Integer): TtkTokenKind; - function FuncLong(Index: Integer): TtkTokenKind; - function FuncLowsrc(Index: Integer): TtkTokenKind; - function FuncMatch(Index: Integer): TtkTokenKind; - function FuncMath(Index: Integer): TtkTokenKind; - function FuncMax(Index: Integer): TtkTokenKind; - function FuncMax_value(Index: Integer): TtkTokenKind; - function FuncMenubar(Index: Integer): TtkTokenKind; - function FuncMethod(Index: Integer): TtkTokenKind; - function FuncMimetype(Index: Integer): TtkTokenKind; - function FuncMimetypes(Index: Integer): TtkTokenKind; - function FuncMin(Index: Integer): TtkTokenKind; - function FuncMin_value(Index: Integer): TtkTokenKind; - function FuncMoveby(Index: Integer): TtkTokenKind; - function FuncMoveto(Index: Integer): TtkTokenKind; - function FuncName(Index: Integer): TtkTokenKind; - function FuncNan(Index: Integer): TtkTokenKind; - function FuncNative(Index: Integer): TtkTokenKind; - function FuncNavigator(Index: Integer): TtkTokenKind; - function FuncNegative_infinity(Index: Integer): TtkTokenKind; - function FuncNetscape(Index: Integer): TtkTokenKind; - function FuncNew(Index: Integer): TtkTokenKind; - function FuncNext(Index: Integer): TtkTokenKind; - function FuncNull(Index: Integer): TtkTokenKind; - function FuncNull2(Index: Integer): TtkTokenKind; - function FuncNumber(Index: Integer): TtkTokenKind; - function FuncObject(Index: Integer): TtkTokenKind; - function FuncOnabort(Index: Integer): TtkTokenKind; - function FuncOnblur(Index: Integer): TtkTokenKind; - function FuncOnchange(Index: Integer): TtkTokenKind; - function FuncOnclick(Index: Integer): TtkTokenKind; - function FuncOndblclick(Index: Integer): TtkTokenKind; - function FuncOnerror(Index: Integer): TtkTokenKind; - function FuncOnfocus(Index: Integer): TtkTokenKind; - function FuncOnkeydown(Index: Integer): TtkTokenKind; - function FuncOnkeypress(Index: Integer): TtkTokenKind; - function FuncOnkeyup(Index: Integer): TtkTokenKind; - function FuncOnload(Index: Integer): TtkTokenKind; - function FuncOnmousedown(Index: Integer): TtkTokenKind; - function FuncOnmousemove(Index: Integer): TtkTokenKind; - function FuncOnmouseout(Index: Integer): TtkTokenKind; - function FuncOnmouseover(Index: Integer): TtkTokenKind; - function FuncOnmouseup(Index: Integer): TtkTokenKind; - function FuncOnreset(Index: Integer): TtkTokenKind; - function FuncOnselect(Index: Integer): TtkTokenKind; - function FuncOnsubmit(Index: Integer): TtkTokenKind; - function FuncOnunload(Index: Integer): TtkTokenKind; - function FuncOpen(Index: Integer): TtkTokenKind; - function FuncOpener(Index: Integer): TtkTokenKind; - function FuncOption(Index: Integer): TtkTokenKind; - function FuncOptions(Index: Integer): TtkTokenKind; - function FuncOuterheight(Index: Integer): TtkTokenKind; - function FuncOuterwidth(Index: Integer): TtkTokenKind; - function FuncPackage(Index: Integer): TtkTokenKind; - function FuncPackages(Index: Integer): TtkTokenKind; - function FuncPagex(Index: Integer): TtkTokenKind; - function FuncPagexoffset(Index: Integer): TtkTokenKind; - function FuncPagey(Index: Integer): TtkTokenKind; - function FuncPageyoffset(Index: Integer): TtkTokenKind; - function FuncParent(Index: Integer): TtkTokenKind; - function FuncParse(Index: Integer): TtkTokenKind; - function FuncParsefloat(Index: Integer): TtkTokenKind; - function FuncParseint(Index: Integer): TtkTokenKind; - function FuncPassword(Index: Integer): TtkTokenKind; - function FuncPathname(Index: Integer): TtkTokenKind; - function FuncPersonalbar(Index: Integer): TtkTokenKind; - function FuncPi(Index: Integer): TtkTokenKind; - function FuncPlatform(Index: Integer): TtkTokenKind; - function FuncPlugin(Index: Integer): TtkTokenKind; - function FuncPlugins(Index: Integer): TtkTokenKind; - function FuncPort(Index: Integer): TtkTokenKind; - function FuncPositive_infinity(Index: Integer): TtkTokenKind; - function FuncPow(Index: Integer): TtkTokenKind; - function FuncPrevious(Index: Integer): TtkTokenKind; - function FuncPrint(Index: Integer): TtkTokenKind; - function FuncPrivate(Index: Integer): TtkTokenKind; - function FuncPrompt(Index: Integer): TtkTokenKind; - function FuncProtected(Index: Integer): TtkTokenKind; - function FuncProtocol(Index: Integer): TtkTokenKind; - function FuncPrototype(Index: Integer): TtkTokenKind; - function FuncPublic(Index: Integer): TtkTokenKind; - function FuncRadio(Index: Integer): TtkTokenKind; - function FuncRandom(Index: Integer): TtkTokenKind; - function FuncReferrer(Index: Integer): TtkTokenKind; - function FuncRefresh(Index: Integer): TtkTokenKind; - function FuncRegexp(Index: Integer): TtkTokenKind; - function FuncReleaseevents(Index: Integer): TtkTokenKind; - function FuncReload(Index: Integer): TtkTokenKind; - function FuncReplace(Index: Integer): TtkTokenKind; - function FuncReset(Index: Integer): TtkTokenKind; - function FuncResizeby(Index: Integer): TtkTokenKind; - function FuncResizeto(Index: Integer): TtkTokenKind; - function FuncReturn(Index: Integer): TtkTokenKind; - function FuncReverse(Index: Integer): TtkTokenKind; - function FuncRight(Index: Integer): TtkTokenKind; - function FuncRound(Index: Integer): TtkTokenKind; - function FuncRouteevent(Index: Integer): TtkTokenKind; - function FuncScreen(Index: Integer): TtkTokenKind; - function FuncScroll(Index: Integer): TtkTokenKind; - function FuncScrollbars(Index: Integer): TtkTokenKind; - function FuncScrollby(Index: Integer): TtkTokenKind; - function FuncScrollto(Index: Integer): TtkTokenKind; - function FuncSearch(Index: Integer): TtkTokenKind; - function FuncSelect(Index: Integer): TtkTokenKind; - function FuncSelected(Index: Integer): TtkTokenKind; - function FuncSelectedindex(Index: Integer): TtkTokenKind; - function FuncSelf(Index: Integer): TtkTokenKind; - function FuncSetdate(Index: Integer): TtkTokenKind; - function FuncSetfullyear(Index: Integer): TtkTokenKind; - function FuncSethours(Index: Integer): TtkTokenKind; - function FuncSetinterval(Index: Integer): TtkTokenKind; - function FuncSetmilliseconds(Index: Integer): TtkTokenKind; - function FuncSetminutes(Index: Integer): TtkTokenKind; - function FuncSetmonth(Index: Integer): TtkTokenKind; - function FuncSetseconds(Index: Integer): TtkTokenKind; - function FuncSettime(Index: Integer): TtkTokenKind; - function FuncSettimeout(Index: Integer): TtkTokenKind; - function FuncSetutcdate(Index: Integer): TtkTokenKind; - function FuncSetutcfullyear(Index: Integer): TtkTokenKind; - function FuncSetutchours(Index: Integer): TtkTokenKind; - function FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; - function FuncSetutcminutes(Index: Integer): TtkTokenKind; - function FuncSetutcmonth(Index: Integer): TtkTokenKind; - function FuncSetutcseconds(Index: Integer): TtkTokenKind; - function FuncSetyear(Index: Integer): TtkTokenKind; - function FuncShort(Index: Integer): TtkTokenKind; - function FuncSin(Index: Integer): TtkTokenKind; - function FuncSlice(Index: Integer): TtkTokenKind; - function FuncSmall(Index: Integer): TtkTokenKind; - function FuncSort(Index: Integer): TtkTokenKind; - function FuncSplit(Index: Integer): TtkTokenKind; - function FuncSqrt(Index: Integer): TtkTokenKind; - function FuncSqrt1_2(Index: Integer): TtkTokenKind; - function FuncSqrt2(Index: Integer): TtkTokenKind; - function FuncSrc(Index: Integer): TtkTokenKind; - function FuncStart(Index: Integer): TtkTokenKind; - function FuncStatic(Index: Integer): TtkTokenKind; - function FuncStatus(Index: Integer): TtkTokenKind; - function FuncStatusbar(Index: Integer): TtkTokenKind; - function FuncStop(Index: Integer): TtkTokenKind; - function FuncStrike(Index: Integer): TtkTokenKind; - function FuncString(Index: Integer): TtkTokenKind; - function FuncStyle(Index: Integer): TtkTokenKind; - function FuncSub(Index: Integer): TtkTokenKind; - function FuncSubmit(Index: Integer): TtkTokenKind; - function FuncSubstr(Index: Integer): TtkTokenKind; - function FuncSubstring(Index: Integer): TtkTokenKind; - function FuncSuffixes(Index: Integer): TtkTokenKind; - function FuncSup(Index: Integer): TtkTokenKind; - function FuncSuper(Index: Integer): TtkTokenKind; - function FuncSwitch(Index: Integer): TtkTokenKind; - function FuncSynchronized(Index: Integer): TtkTokenKind; - function FuncTags(Index: Integer): TtkTokenKind; - function FuncTaint(Index: Integer): TtkTokenKind; - function FuncTaintenabled(Index: Integer): TtkTokenKind; - function FuncTan(Index: Integer): TtkTokenKind; - function FuncTarget(Index: Integer): TtkTokenKind; - function FuncText(Index: Integer): TtkTokenKind; - function FuncTextarea(Index: Integer): TtkTokenKind; - function FuncThis(Index: Integer): TtkTokenKind; - function FuncThrow(Index: Integer): TtkTokenKind; - function FuncThrows(Index: Integer): TtkTokenKind; - function FuncTitle(Index: Integer): TtkTokenKind; - function FuncTogmtstring(Index: Integer): TtkTokenKind; - function FuncTolocalestring(Index: Integer): TtkTokenKind; - function FuncTolowercase(Index: Integer): TtkTokenKind; - function FuncToolbar(Index: Integer): TtkTokenKind; - function FuncTop(Index: Integer): TtkTokenKind; - function FuncTosource(Index: Integer): TtkTokenKind; - function FuncTostring(Index: Integer): TtkTokenKind; - function FuncTouppercase(Index: Integer): TtkTokenKind; - function FuncToutcstring(Index: Integer): TtkTokenKind; - function FuncTransient(Index: Integer): TtkTokenKind; - function FuncTrue(Index: Integer): TtkTokenKind; - function FuncTry(Index: Integer): TtkTokenKind; - function FuncType(Index: Integer): TtkTokenKind; - function FuncTypeof(Index: Integer): TtkTokenKind; - function FuncUndefined(Index: Integer): TtkTokenKind; - function FuncUnescape(Index: Integer): TtkTokenKind; - function FuncUntaint(Index: Integer): TtkTokenKind; - function FuncUnwatch(Index: Integer): TtkTokenKind; - function FuncUrl(Index: Integer): TtkTokenKind; - function FuncUseragent(Index: Integer): TtkTokenKind; - function FuncUtc(Index: Integer): TtkTokenKind; - function FuncValue(Index: Integer): TtkTokenKind; - function FuncValueof(Index: Integer): TtkTokenKind; - function FuncVar(Index: Integer): TtkTokenKind; - function FuncVisibility(Index: Integer): TtkTokenKind; - function FuncVlinkcolor(Index: Integer): TtkTokenKind; - function FuncVoid(Index: Integer): TtkTokenKind; - function FuncVspace(Index: Integer): TtkTokenKind; - function FuncWatch(Index: Integer): TtkTokenKind; - function FuncWhile(Index: Integer): TtkTokenKind; - function FuncWidth(Index: Integer): TtkTokenKind; - function FuncWindow(Index: Integer): TtkTokenKind; - function FuncWith(Index: Integer): TtkTokenKind; - function FuncWrite(Index: Integer): TtkTokenKind; - function FuncWriteln(Index: Integer): TtkTokenKind; - function FuncZindex(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AndSymbolProc; - procedure CommentProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure MinusProc; - procedure ModSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure SlashProc; - procedure SpaceProc; - procedure StarProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; -//++ CodeFolding - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -//-- CodeFolding - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NonReservedKeyAttri: TSynHighlighterAttributes read fNonReservedKeyAttri write fNonReservedKeyAttri; - property EventAttri: TSynHighlighterAttributes read fEventAttri write fEventAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..398] of string = ( - 'abs', 'abstract', 'acos', 'action', 'alert', 'align', 'alinkColor', 'all', - 'All', 'anchor', 'Anchor', 'anchors', 'appCodeName', 'Applet', 'applets', - 'appName', 'appVersion', 'Area', 'arguments', 'Arguments', 'Array', 'asin', - 'atan', 'atan2', 'back', 'background', 'bgColor', 'big', 'blink', 'blur', - 'body', 'bold', 'boolean', 'Boolean', 'border', 'bottom', 'break', 'Button', - 'byte', 'call', 'callee', 'caller', 'captureEvents', 'case', 'catch', - 'ceil', 'char', 'charAt', 'charCodeAt', 'Checkbox', 'checked', 'class', - 'clear', 'clearInterval', 'clearTimeout', 'click', 'close', 'closed', - 'color', 'complete', 'concat', 'confirm', 'const', 'constructor', - 'continue', 'cookie', 'cos', 'current', 'Date', 'debugger', 'default', - 'defaultChecked', 'defaultSelected', 'defaultStatus', 'defaultValue', - 'delete', 'description', 'display', 'do', 'document', 'domain', 'double', - 'E', 'elements', 'else', 'Embed', 'embeds', 'enabledPlugin', 'encoding', - 'enum', 'escape', 'eval', 'event', 'exp', 'export', 'extends', 'false', - 'fgColor', 'filename', 'FileUpload', 'final', 'finally', 'find', 'fixed', - 'float', 'Float', 'floor', 'focus', 'fontcolor', 'fontsize', 'for', 'form', - 'Form', 'forms', 'forward', 'Frame', 'frames', 'fromCharCode', 'function', - 'Function', 'getDate', 'getDay', 'getElementById', 'getFullYear', - 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', - 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', - 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', - 'getUTCSeconds', 'getYear', 'Global', 'go', 'goto', 'handleEvent', 'hash', - 'height', 'Hidden', 'history', 'History', 'home', 'host', 'hostname', - 'href', 'hspace', 'if', 'Image', 'images', 'implements', 'import', 'in', - 'index', 'indexOf', 'Infinity', 'innerHeight', 'innerWidth', 'input', - 'instanceof', 'int', 'interface', 'isFinite', 'isNaN', 'italics', 'java', - 'javaEnabled', 'join', 'lastIndexOf', 'lastModified', 'Layer', 'layers', - 'left', 'length', 'link', 'Link', 'linkColor', 'links', 'LN10', 'LN2', - 'location', 'Location', 'locationbar', 'log', 'LOG10E', 'LOG2E', 'logon', - 'long', 'lowsrc', 'match', 'Math', 'max', 'MAX_VALUE', 'menubar', 'method', - 'MimeType', 'mimeTypes', 'min', 'MIN_VALUE', 'moveBy', 'moveTo', 'name', - 'NaN', 'native', 'navigator', 'Navigator', 'NEGATIVE_INFINITY', 'netscape', - 'new', 'next', 'null', 'Null', 'Number', 'Object', 'onAbort', 'onBlur', - 'onChange', 'onClick', 'onDblClick', 'onError', 'onFocus', 'onKeyDown', - 'onKeyPress', 'onKeyUp', 'onLoad', 'onMouseDown', 'onMouseMove', - 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onReset', 'onSelect', 'onSubmit', - 'onUnload', 'open', 'opener', 'Option', 'options', 'outerHeight', - 'outerWidth', 'package', 'Packages', 'pageX', 'pageXOffset', 'pageY', - 'pageYOffset', 'parent', 'parse', 'parseFloat', 'parseInt', 'Password', - 'pathname', 'personalbar', 'PI', 'platform', 'Plugin', 'plugins', 'port', - 'POSITIVE_INFINITY', 'pow', 'previous', 'print', 'private', 'prompt', - 'protected', 'protocol', 'prototype', 'public', 'Radio', 'random', - 'referrer', 'refresh', 'RegExp', 'releaseEvents', 'reload', 'replace', - 'reset', 'Reset', 'resizeBy', 'resizeTo', 'return', 'reverse', 'right', - 'round', 'routeEvent', 'screen', 'scroll', 'scrollbars', 'scrollBy', - 'scrollTo', 'search', 'select', 'Select', 'selected', 'selectedIndex', - 'self', 'setDate', 'setFullYear', 'setHours', 'setInterval', - 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', - 'setTimeout', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', - 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', - 'setYear', 'short', 'sin', 'slice', 'small', 'sort', 'split', 'sqrt', - 'SQRT1_2', 'SQRT2', 'src', 'start', 'static', 'status', 'statusbar', 'stop', - 'strike', 'String', 'style', 'sub', 'submit', 'Submit', 'substr', - 'substring', 'suffixes', 'sup', 'super', 'switch', 'synchronized', 'tags', - 'taint', 'taintEnabled', 'tan', 'target', 'text', 'Text', 'Textarea', - 'this', 'throw', 'throws', 'title', 'toGMTString', 'toLocaleString', - 'toLowerCase', 'toolbar', 'top', 'toSource', 'toString', 'toUpperCase', - 'toUTCString', 'transient', 'true', 'try', 'type', 'typeof', 'undefined', - 'Undefined', 'unescape', 'untaint', 'unwatch', 'URL', 'userAgent', 'UTC', - 'value', 'valueOf', 'var', 'visibility', 'vlinkColor', 'void', 'vspace', - 'watch', 'while', 'width', 'window', 'Window', 'with', 'write', 'writeln', - 'zIndex' - ); - - KeyIndices: array[0..5152] of Integer = ( - -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, -1, -1, -1, 296, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, - -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -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, -1, 295, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 75, 351, -1, -1, -1, -1, -1, -1, 315, 37, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, 326, -1, -1, -1, 31, - -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, 143, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 339, -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, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, - -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, -1, -1, -1, -1, -1, -1, -1, -1, 235, -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, -1, -1, -1, -1, -1, - -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, - -1, -1, 16, 52, 389, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 259, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, 30, -1, -1, -1, -1, -1, -1, - -1, 10, -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, 304, -1, 396, 2, -1, -1, 323, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, - -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, - -1, -1, -1, 203, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 83, -1, -1, - -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 268, -1, -1, -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, 246, 18, -1, - -1, -1, -1, -1, 209, -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, -1, -1, 220, 161, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 229, -1, -1, -1, -1, -1, -1, -1, 157, 319, -1, 210, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 381, 78, -1, - -1, -1, -1, -1, -1, -1, 257, -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, -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, 219, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 196, -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 309, -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, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 386, 146, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -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, 269, -1, -1, -1, 199, 172, -1, 15, 123, -1, -1, -1, -1, -1, -1, -1, 136, - -1, -1, -1, 128, -1, -1, -1, -1, 366, -1, -1, 185, -1, -1, -1, -1, 153, -1, - -1, -1, -1, 388, -1, -1, 165, -1, -1, -1, -1, -1, -1, 338, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 360, -1, -1, - 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 307, -1, -1, -1, -1, -1, -1, -1, 258, -1, - -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, 129, -1, -1, - -1, -1, -1, -1, -1, -1, 120, -1, -1, 95, -1, 233, -1, -1, -1, -1, -1, -1, - -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 90, 282, -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, 341, 232, 121, 155, -1, - -1, -1, -1, -1, 247, -1, -1, -1, -1, 67, -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, - -1, -1, -1, -1, -1, -1, -1, 327, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -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, -1, -1, -1, 170, -1, -1, -1, -1, 298, -1, - -1, -1, -1, -1, -1, -1, 114, -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, -1, -1, 271, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 70, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 91, -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, 106, -1, -1, 237, -1, -1, -1, -1, -1, 6, - -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, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 250, -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, -1, -1, -1, -1, -1, - -1, -1, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, - -1, -1, -1, -1, -1, 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, -1, -1, - -1, -1, -1, -1, -1, 227, -1, -1, 383, -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, - -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 29, 148, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 392, -1, -1, -1, -1, -1, 125, -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, -1, -1, -1, 201, -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, 135, -1, -1, 212, - -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, - -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 334, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 289, -1, -1, -1, -1, 312, -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, 385, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, 371, 76, - -1, -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, 156, -1, 23, -1, -1, -1, -1, -1, -1, - -1, -1, 280, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 277, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, 93, -1, - -1, -1, -1, -1, -1, -1, 202, -1, 5, 343, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 50, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 333, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, 139, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, - 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 278, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 302, 316, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, - 254, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, 345, -1, -1, 144, -1, -1, -1, 7, - -1, -1, 306, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, 308, -1, -1, -1, - -1, 357, -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, 36, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 361, -1, -1, -1, -1, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 387, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 376, -1, -1, -1, -1, 188, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 98, -1, -1, -1, - -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 299, -1, -1, -1, 369, -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, -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, -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, -1, -1, -1, -1, - -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 356, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 8, -1, 300, -1, -1, 228, 59, -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, -1, -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, - -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 350, -1, -1, -1, -1, - -1, -1, 284, -1, -1, -1, 256, -1, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, - 190, -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, -1, -1, 102, -1, 230, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, 71, 26, -1, -1, -1, -1, - -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 322, -1, -1, 175, -1, -1, 393, -1, 124, 85, -1, -1, -1, -1, - -1, -1, -1, -1, 150, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, - -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 111, -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, -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, -1, -1, -1, -1, -1, -1, -1, - 42, 244, -1, -1, -1, -1, -1, -1, -1, 47, 313, -1, 41, -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, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 294, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 245, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, -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, - -1, -1, 347, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, -1, -1, -1, - 217, -1, -1, -1, 87, -1, -1, -1, 329, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 39, -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, -1, 222, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 174, -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, -1, -1, - 274, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 382, -1, -1, -1, 138, 226, -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, -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, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, - -1, -1, 318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 335, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, 191, -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, -1, -1, -1, -1, -1, -1, -1, -1, 288, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, - 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 158, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, 57, - -1, -1, -1, 211, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, 264, -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, -1, -1, 321, -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, 207, -1, -1, - 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 149, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 293, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 242, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, - -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 92, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 325, 126, -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, -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, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 372, -1, -1, -1, 380, -1, -1, - 352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 263, -1, -1, -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 286, -1, 46, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, 19, - -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, -1, -1, 270, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 283, - -1, -1, -1, -1, -1, -1, -1, -1, 151, -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, 65, -1, -1, -1, - -1, -1, -1, -1, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 252, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 355, -1, -1, 365, -1, -1, -1, - -1, -1, -1, -1, -1, 28, -1, -1, 378, -1, -1, -1, -1, 354, -1, -1, -1, -1, - -1, -1, -1, -1, 349, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, 285, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 81, 394, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 358, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 224, -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, 181, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 375, - -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, -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, -1, - -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 9, -1, -1, -1, -1, -1, 305, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, - 281, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, - -1, -1, 261, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, 290, -1, 66, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 131, -1, 279, -1, -1, -1, 249, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, - 127, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 53, -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, -1, -1, - -1, -1, -1, -1, -1, -1, 364, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 395, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 310, -1, 218, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, 390, -1, -1, -1, -1, -1, -1, -1, - 328, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, 311, -1, -1, -1, -1, - -1, -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 344, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 337, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, - -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, -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, -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, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, - -1, -1, -1, -1, -1, -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, 346, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 348, 159, -1, -1, -1, -1, -1, -1, -1, - 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 370, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, 314, -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, -1, -1, 291, -1, -1, -1, -1, -1, -1, 384, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, 340, -1, -1, - -1, -1, -1, -1, 317, -1, 79, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, - 353, -1, 301, -1, -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 186, -1, -1, -1 - ); - -{$Q-} -function TSynJScriptSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 751 + Ord(Str^) * 148; - inc(Str); - end; - Result := Result mod 5153; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynJScriptSyn.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 TSynJScriptSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[4966] := FuncAbs; - fIdentFuncTable[2170] := FuncAbstract; - fIdentFuncTable[520] := FuncAcos; - fIdentFuncTable[319] := FuncAction; - fIdentFuncTable[4368] := FuncAlert; - fIdentFuncTable[2070] := FuncAlign; - fIdentFuncTable[1500] := FuncAlinkcolor; - fIdentFuncTable[2362] := FuncAll; - fIdentFuncTable[2706] := FuncAll; - fIdentFuncTable[4383] := FuncAnchor; - fIdentFuncTable[491] := FuncAnchor; - fIdentFuncTable[2516] := FuncAnchors; - fIdentFuncTable[2207] := FuncAppcodename; - fIdentFuncTable[1993] := FuncApplet; - fIdentFuncTable[1805] := FuncApplets; - fIdentFuncTable[965] := FuncAppname; - fIdentFuncTable[416] := FuncAppversion; - fIdentFuncTable[2052] := FuncArea; - fIdentFuncTable[618] := FuncArguments; - fIdentFuncTable[3950] := FuncArguments; - fIdentFuncTable[2987] := FuncArray; - fIdentFuncTable[4131] := FuncAsin; - fIdentFuncTable[5117] := FuncAtan; - fIdentFuncTable[1999] := FuncAtan2; - fIdentFuncTable[3356] := FuncBack; - fIdentFuncTable[3954] := FuncBackground; - fIdentFuncTable[2882] := FuncBgcolor; - fIdentFuncTable[1824] := FuncBig; - fIdentFuncTable[4067] := FuncBlink; - fIdentFuncTable[1709] := FuncBlur; - fIdentFuncTable[483] := FuncBody; - fIdentFuncTable[243] := FuncBold; - fIdentFuncTable[4200] := FuncBoolean; - fIdentFuncTable[3265] := FuncBoolean2; - fIdentFuncTable[563] := FuncBorder; - fIdentFuncTable[2857] := FuncBottom; - fIdentFuncTable[2410] := FuncBreak; - fIdentFuncTable[223] := FuncButton; - fIdentFuncTable[575] := FuncByte; - fIdentFuncTable[3204] := FuncCall; - fIdentFuncTable[1125] := FuncCallee; - fIdentFuncTable[3049] := FuncCaller; - fIdentFuncTable[3037] := FuncCaptureevents; - fIdentFuncTable[2101] := FuncCase; - fIdentFuncTable[2105] := FuncCatch; - fIdentFuncTable[4662] := FuncCeil; - fIdentFuncTable[3938] := FuncChar; - fIdentFuncTable[3046] := FuncCharat; - fIdentFuncTable[3724] := FuncCharcodeat; - fIdentFuncTable[4522] := FuncCheckbox; - fIdentFuncTable[2127] := FuncChecked; - fIdentFuncTable[1908] := FuncClass; - fIdentFuncTable[417] := FuncClear; - fIdentFuncTable[4574] := FuncClearinterval; - fIdentFuncTable[2626] := FuncCleartimeout; - fIdentFuncTable[55] := FuncClick; - fIdentFuncTable[3783] := FuncClose; - fIdentFuncTable[3615] := FuncClosed; - fIdentFuncTable[1688] := FuncColor; - fIdentFuncTable[2712] := FuncComplete; - fIdentFuncTable[2889] := FuncConcat; - fIdentFuncTable[3503] := FuncConfirm; - fIdentFuncTable[820] := FuncConst; - fIdentFuncTable[3079] := FuncConstructor; - fIdentFuncTable[3092] := FuncContinue; - fIdentFuncTable[4022] := FuncCookie; - fIdentFuncTable[4452] := FuncCos; - fIdentFuncTable[1188] := FuncCurrent; - fIdentFuncTable[1955] := FuncDate; - fIdentFuncTable[1095] := FuncDebugger; - fIdentFuncTable[1389] := FuncDefault; - fIdentFuncTable[2881] := FuncDefaultchecked; - fIdentFuncTable[2879] := FuncDefaultselected; - fIdentFuncTable[3607] := FuncDefaultstatus; - fIdentFuncTable[1234] := FuncDefaultvalue; - fIdentFuncTable[214] := FuncDelete; - fIdentFuncTable[1929] := FuncDescription; - fIdentFuncTable[1046] := FuncDisplay; - fIdentFuncTable[748] := FuncDo; - fIdentFuncTable[5075] := FuncDocument; - fIdentFuncTable[4671] := FuncDomain; - fIdentFuncTable[4176] := FuncDouble; - fIdentFuncTable[5059] := FuncE; - fIdentFuncTable[581] := FuncElements; - fIdentFuncTable[4413] := FuncElse; - fIdentFuncTable[2919] := FuncEmbed; - fIdentFuncTable[2346] := FuncEmbeds; - fIdentFuncTable[3190] := FuncEnabledplugin; - fIdentFuncTable[4627] := FuncEncoding; - fIdentFuncTable[3716] := FuncEnum; - fIdentFuncTable[1147] := FuncEscape; - fIdentFuncTable[1465] := FuncEval; - fIdentFuncTable[3807] := FuncEvent; - fIdentFuncTable[2060] := FuncExp; - fIdentFuncTable[1298] := FuncExport; - fIdentFuncTable[1114] := FuncExtends; - fIdentFuncTable[1069] := FuncFalse; - fIdentFuncTable[4097] := FuncFgcolor; - fIdentFuncTable[2508] := FuncFilename; - fIdentFuncTable[271] := FuncFileupload; - fIdentFuncTable[3365] := FuncFinal; - fIdentFuncTable[587] := FuncFinally; - fIdentFuncTable[2843] := FuncFind; - fIdentFuncTable[931] := FuncFixed; - fIdentFuncTable[1921] := FuncFloat; - fIdentFuncTable[730] := FuncFloat2; - fIdentFuncTable[1491] := FuncFloor; - fIdentFuncTable[4111] := FuncFocus; - fIdentFuncTable[4774] := FuncFontcolor; - fIdentFuncTable[4932] := FuncFontsize; - fIdentFuncTable[407] := FuncFor; - fIdentFuncTable[2968] := FuncForm; - fIdentFuncTable[4469] := FuncForm; - fIdentFuncTable[2370] := FuncForms; - fIdentFuncTable[1279] := FuncForward; - fIdentFuncTable[4402] := FuncFrame; - fIdentFuncTable[2522] := FuncFrames; - fIdentFuncTable[3737] := FuncFromcharcode; - fIdentFuncTable[2666] := FuncFunction; - fIdentFuncTable[1982] := FuncFunction2; - fIdentFuncTable[1111] := FuncGetdate; - fIdentFuncTable[1176] := FuncGetday; - fIdentFuncTable[553] := FuncGetelementbyid; - fIdentFuncTable[966] := FuncGetfullyear; - fIdentFuncTable[2918] := FuncGethours; - fIdentFuncTable[1735] := FuncGetmilliseconds; - fIdentFuncTable[3823] := FuncGetminutes; - fIdentFuncTable[4549] := FuncGetmonth; - fIdentFuncTable[978] := FuncGetseconds; - fIdentFuncTable[1102] := FuncGettime; - fIdentFuncTable[4707] := FuncGettimezoneoffset; - fIdentFuncTable[4493] := FuncGetutcdate; - fIdentFuncTable[3536] := FuncGetutcday; - fIdentFuncTable[5080] := FuncGetutcfullyear; - fIdentFuncTable[671] := FuncGetutchours; - fIdentFuncTable[1795] := FuncGetutcmilliseconds; - fIdentFuncTable[974] := FuncGetutcminutes; - fIdentFuncTable[2302] := FuncGetutcmonth; - fIdentFuncTable[3282] := FuncGetutcseconds; - fIdentFuncTable[2212] := FuncGetyear; - fIdentFuncTable[2940] := FuncGlobal; - fIdentFuncTable[4400] := FuncGo; - fIdentFuncTable[4552] := FuncGoto; - fIdentFuncTable[269] := FuncHandleevent; - fIdentFuncTable[2358] := FuncHash; - fIdentFuncTable[380] := FuncHeight; - fIdentFuncTable[911] := FuncHidden; - fIdentFuncTable[2645] := FuncHistory; - fIdentFuncTable[1710] := FuncHistory; - fIdentFuncTable[3710] := FuncHome; - fIdentFuncTable[2928] := FuncHost; - fIdentFuncTable[3996] := FuncHostname; - fIdentFuncTable[2246] := FuncHref; - fIdentFuncTable[991] := FuncHspace; - fIdentFuncTable[3785] := FuncIf; - fIdentFuncTable[1177] := FuncImage; - fIdentFuncTable[1997] := FuncImages; - fIdentFuncTable[706] := FuncImplements; - fIdentFuncTable[3582] := FuncImport; - fIdentFuncTable[4969] := FuncIn; - fIdentFuncTable[1137] := FuncIndex; - fIdentFuncTable[656] := FuncIndexof; - fIdentFuncTable[4918] := FuncInfinity; - fIdentFuncTable[5096] := FuncInnerheight; - fIdentFuncTable[5008] := FuncInnerwidth; - fIdentFuncTable[999] := FuncInput; - fIdentFuncTable[3585] := FuncInstanceof; - fIdentFuncTable[545] := FuncInt; - fIdentFuncTable[124] := FuncInterface; - fIdentFuncTable[2465] := FuncIsfinite; - fIdentFuncTable[1266] := FuncIsnan; - fIdentFuncTable[1711] := FuncItalics; - fIdentFuncTable[963] := FuncJava; - fIdentFuncTable[4225] := FuncJavaenabled; - fIdentFuncTable[3229] := FuncJoin; - fIdentFuncTable[2913] := FuncLastindexof; - fIdentFuncTable[2778] := FuncLastmodified; - fIdentFuncTable[3139] := FuncLayer; - fIdentFuncTable[2021] := FuncLayers; - fIdentFuncTable[2770] := FuncLeft; - fIdentFuncTable[1083] := FuncLength; - fIdentFuncTable[4263] := FuncLink; - fIdentFuncTable[611] := FuncLink; - fIdentFuncTable[2947] := FuncLinkcolor; - fIdentFuncTable[3943] := FuncLinks; - fIdentFuncTable[986] := FuncLn10; - fIdentFuncTable[5149] := FuncLn2; - fIdentFuncTable[4694] := FuncLocation; - fIdentFuncTable[2489] := FuncLocation; - fIdentFuncTable[3213] := FuncLocationbar; - fIdentFuncTable[2812] := FuncLog; - fIdentFuncTable[3420] := FuncLog10e; - fIdentFuncTable[3346] := FuncLog2e; - fIdentFuncTable[3808] := FuncLogon; - fIdentFuncTable[1030] := FuncLong; - fIdentFuncTable[2430] := FuncLowsrc; - fIdentFuncTable[830] := FuncMatch; - fIdentFuncTable[1454] := FuncMath; - fIdentFuncTable[4163] := FuncMax; - fIdentFuncTable[962] := FuncMax_value; - fIdentFuncTable[165] := FuncMenubar; - fIdentFuncTable[1767] := FuncMethod; - fIdentFuncTable[2068] := FuncMimetype; - fIdentFuncTable[568] := FuncMimetypes; - fIdentFuncTable[398] := FuncMin; - fIdentFuncTable[1580] := FuncMin_value; - fIdentFuncTable[3868] := FuncMoveby; - fIdentFuncTable[3688] := FuncMoveto; - fIdentFuncTable[147] := FuncName; - fIdentFuncTable[624] := FuncNan; - fIdentFuncTable[709] := FuncNative; - fIdentFuncTable[3619] := FuncNavigator; - fIdentFuncTable[1798] := FuncNavigator; - fIdentFuncTable[2749] := FuncNegative_infinity; - fIdentFuncTable[2232] := FuncNetscape; - fIdentFuncTable[4150] := FuncNew; - fIdentFuncTable[3691] := FuncNext; - fIdentFuncTable[3186] := FuncNull; - fIdentFuncTable[4687] := FuncNull2; - fIdentFuncTable[811] := FuncNumber; - fIdentFuncTable[655] := FuncObject; - fIdentFuncTable[4718] := FuncOnabort; - fIdentFuncTable[3216] := FuncOnblur; - fIdentFuncTable[4506] := FuncOnchange; - fIdentFuncTable[4236] := FuncOnclick; - fIdentFuncTable[1962] := FuncOndblclick; - fIdentFuncTable[3283] := FuncOnerror; - fIdentFuncTable[1618] := FuncOnfocus; - fIdentFuncTable[2711] := FuncOnkeydown; - fIdentFuncTable[698] := FuncOnkeypress; - fIdentFuncTable[2845] := FuncOnkeyup; - fIdentFuncTable[9] := FuncOnload; - fIdentFuncTable[1175] := FuncOnmousedown; - fIdentFuncTable[1116] := FuncOnmousemove; - fIdentFuncTable[720] := FuncOnmouseout; - fIdentFuncTable[356] := FuncOnmouseover; - fIdentFuncTable[2930] := FuncOnmouseup; - fIdentFuncTable[1494] := FuncOnreset; - fIdentFuncTable[1591] := FuncOnselect; - fIdentFuncTable[233] := FuncOnsubmit; - fIdentFuncTable[1527] := FuncOnunload; - fIdentFuncTable[309] := FuncOpen; - fIdentFuncTable[3742] := FuncOpener; - fIdentFuncTable[3624] := FuncOption; - fIdentFuncTable[3038] := FuncOptions; - fIdentFuncTable[3129] := FuncOuterheight; - fIdentFuncTable[617] := FuncOuterwidth; - fIdentFuncTable[1183] := FuncPackage; - fIdentFuncTable[4634] := FuncPackages; - fIdentFuncTable[4499] := FuncPagex; - fIdentFuncTable[1543] := FuncPagexoffset; - fIdentFuncTable[4647] := FuncPagey; - fIdentFuncTable[4043] := FuncPageyoffset; - fIdentFuncTable[4818] := FuncParent; - fIdentFuncTable[2306] := FuncParse; - fIdentFuncTable[2092] := FuncParsefloat; - fIdentFuncTable[2800] := FuncParseint; - fIdentFuncTable[756] := FuncPassword; - fIdentFuncTable[1065] := FuncPathname; - fIdentFuncTable[433] := FuncPersonalbar; - fIdentFuncTable[3413] := FuncPi; - fIdentFuncTable[4421] := FuncPlatform; - fIdentFuncTable[4802] := FuncPlugin; - fIdentFuncTable[3917] := FuncPlugins; - fIdentFuncTable[3630] := FuncPort; - fIdentFuncTable[4426] := FuncPositive_infinity; - fIdentFuncTable[5137] := FuncPow; - fIdentFuncTable[4810] := FuncPrevious; - fIdentFuncTable[602] := FuncPrint; - fIdentFuncTable[958] := FuncPrivate; - fIdentFuncTable[3968] := FuncPrompt; - fIdentFuncTable[1326] := FuncProtected; - fIdentFuncTable[1815] := FuncProtocol; - fIdentFuncTable[4437] := FuncPrototype; - fIdentFuncTable[3260] := FuncPublic; - fIdentFuncTable[1600] := FuncRadio; - fIdentFuncTable[2803] := FuncRandom; - fIdentFuncTable[2045] := FuncReferrer; - fIdentFuncTable[2270] := FuncRefresh; - fIdentFuncTable[4495] := FuncRegexp; - fIdentFuncTable[2008] := FuncReleaseevents; - fIdentFuncTable[4401] := FuncReload; - fIdentFuncTable[1148] := FuncReplace; - fIdentFuncTable[3987] := FuncReset; - fIdentFuncTable[2796] := FuncReset; - fIdentFuncTable[4116] := FuncResizeby; - fIdentFuncTable[3936] := FuncResizeto; - fIdentFuncTable[1610] := FuncReturn; - fIdentFuncTable[3457] := FuncReverse; - fIdentFuncTable[1857] := FuncRight; - fIdentFuncTable[4450] := FuncRound; - fIdentFuncTable[5041] := FuncRouteevent; - fIdentFuncTable[100] := FuncScreen; - fIdentFuncTable[3727] := FuncScroll; - fIdentFuncTable[3112] := FuncScrollbars; - fIdentFuncTable[195] := FuncScrollby; - fIdentFuncTable[15] := FuncScrollto; - fIdentFuncTable[4544] := FuncSearch; - fIdentFuncTable[1271] := FuncSelect; - fIdentFuncTable[2532] := FuncSelect; - fIdentFuncTable[2708] := FuncSelected; - fIdentFuncTable[5089] := FuncSelectedindex; - fIdentFuncTable[2283] := FuncSelf; - fIdentFuncTable[4756] := FuncSetdate; - fIdentFuncTable[517] := FuncSetfullyear; - fIdentFuncTable[4389] := FuncSethours; - fIdentFuncTable[2365] := FuncSetinterval; - fIdentFuncTable[1057] := FuncSetmilliseconds; - fIdentFuncTable[2377] := FuncSetminutes; - fIdentFuncTable[867] := FuncSetmonth; - fIdentFuncTable[4685] := FuncSetseconds; - fIdentFuncTable[4747] := FuncSettime; - fIdentFuncTable[1862] := FuncSettimeout; - fIdentFuncTable[3047] := FuncSetutcdate; - fIdentFuncTable[5010] := FuncSetutcfullyear; - fIdentFuncTable[222] := FuncSetutchours; - fIdentFuncTable[2284] := FuncSetutcmilliseconds; - fIdentFuncTable[5073] := FuncSetutcminutes; - fIdentFuncTable[3374] := FuncSetutcmonth; - fIdentFuncTable[707] := FuncSetutcseconds; - fIdentFuncTable[2225] := FuncSetyear; - fIdentFuncTable[3661] := FuncShort; - fIdentFuncTable[2910] := FuncSin; - fIdentFuncTable[523] := FuncSlice; - fIdentFuncTable[1345] := FuncSmall; - fIdentFuncTable[3822] := FuncSort; - fIdentFuncTable[239] := FuncSplit; - fIdentFuncTable[1224] := FuncSqrt; - fIdentFuncTable[4716] := FuncSqrt1_2; - fIdentFuncTable[3194] := FuncSqrt2; - fIdentFuncTable[1932] := FuncSrc; - fIdentFuncTable[482] := FuncStart; - fIdentFuncTable[684] := FuncStatic; - fIdentFuncTable[2201] := FuncStatus; - fIdentFuncTable[1836] := FuncStatusbar; - fIdentFuncTable[3389] := FuncStop; - fIdentFuncTable[4740] := FuncStrike; - fIdentFuncTable[4796] := FuncString; - fIdentFuncTable[1006] := FuncStyle; - fIdentFuncTable[283] := FuncSub; - fIdentFuncTable[5066] := FuncSubmit; - fIdentFuncTable[1174] := FuncSubmit; - fIdentFuncTable[3496] := FuncSubstr; - fIdentFuncTable[2071] := FuncSubstring; - fIdentFuncTable[4785] := FuncSuffixes; - fIdentFuncTable[2355] := FuncSup; - fIdentFuncTable[4953] := FuncSuper; - fIdentFuncTable[3170] := FuncSwitch; - fIdentFuncTable[4968] := FuncSynchronized; - fIdentFuncTable[4084] := FuncTags; - fIdentFuncTable[2789] := FuncTaint; - fIdentFuncTable[215] := FuncTaintenabled; - fIdentFuncTable[3896] := FuncTan; - fIdentFuncTable[5087] := FuncTarget; - fIdentFuncTable[4075] := FuncText; - fIdentFuncTable[4055] := FuncText; - fIdentFuncTable[2681] := FuncTextarea; - fIdentFuncTable[2382] := FuncThis; - fIdentFuncTable[4217] := FuncThrow; - fIdentFuncTable[2507] := FuncThrows; - fIdentFuncTable[1027] := FuncTitle; - fIdentFuncTable[2422] := FuncTogmtstring; - fIdentFuncTable[4448] := FuncTolocalestring; - fIdentFuncTable[857] := FuncTolowercase; - fIdentFuncTable[4611] := FuncToolbar; - fIdentFuncTable[4058] := FuncTop; - fIdentFuncTable[983] := FuncTosource; - fIdentFuncTable[3962] := FuncTostring; - fIdentFuncTable[4977] := FuncTouppercase; - fIdentFuncTable[2536] := FuncToutcstring; - fIdentFuncTable[4990] := FuncTransient; - fIdentFuncTable[1928] := FuncTrue; - fIdentFuncTable[3889] := FuncTry; - fIdentFuncTable[3925] := FuncType; - fIdentFuncTable[3121] := FuncTypeof; - fIdentFuncTable[4305] := FuncUndefined; - fIdentFuncTable[2484] := FuncUndefined; - fIdentFuncTable[3518] := FuncUnescape; - fIdentFuncTable[4070] := FuncUntaint; - fIdentFuncTable[836] := FuncUnwatch; - fIdentFuncTable[3893] := FuncUrl; - fIdentFuncTable[747] := FuncUseragent; - fIdentFuncTable[3278] := FuncUtc; - fIdentFuncTable[1621] := FuncValue; - fIdentFuncTable[5048] := FuncValueof; - fIdentFuncTable[1890] := FuncVar; - fIdentFuncTable[910] := FuncVisibility; - fIdentFuncTable[2454] := FuncVlinkcolor; - fIdentFuncTable[996] := FuncVoid; - fIdentFuncTable[418] := FuncVspace; - fIdentFuncTable[4708] := FuncWatch; - fIdentFuncTable[3178] := FuncWhile; - fIdentFuncTable[1729] := FuncWidth; - fIdentFuncTable[2916] := FuncWindow; - fIdentFuncTable[4177] := FuncWindow; - fIdentFuncTable[4646] := FuncWith; - fIdentFuncTable[519] := FuncWrite; - fIdentFuncTable[4841] := FuncWriteln; - fIdentFuncTable[4030] := FuncZindex; -end; - -function TSynJScriptSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAbs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAbstract(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAcos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAction(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlert(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlign(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAll(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAnchor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAnchors(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppcodename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncApplet(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncApplets(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppversion(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArea(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArguments(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAsin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAtan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAtan2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBackground(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBgcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBlur(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBody(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBold(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBoolean(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBoolean2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - - -function TSynJScriptSyn.FuncBorder(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBottom(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBreak(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncButton(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncByte(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCallee(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCaller(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCaptureevents(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCeil(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncChar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCharat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCharcodeat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCheckbox(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncChecked(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClass(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClearinterval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCleartimeout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClosed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncColor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncComplete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConcat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConfirm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConstructor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncContinue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCookie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCurrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDebugger(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefault(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultchecked(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultselected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultstatus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultvalue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDelete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDescription(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDisplay(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDocument(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDomain(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDouble(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncE(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncElements(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncElse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEmbed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEmbeds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEnabledplugin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEncoding(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEnum(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEscape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEvent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExtends(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFalse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFgcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFilename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFileupload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFinal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFinally(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFind(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFixed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloat2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFocus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFontcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFontsize(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForms(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForward(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFrame(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFrames(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFromcharcode(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFunction(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFunction2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetday(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetelementbyid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGethours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGettime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGettimezoneoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcday(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutchours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGlobal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGoto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHandleevent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHash(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHeight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHidden(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHistory(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHome(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHost(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHostname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHref(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHspace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImages(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImplements(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIndex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIndexof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInfinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInnerheight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInnerwidth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInput(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInstanceof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInterface(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIsfinite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIsnan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncItalics(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJava(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJavaenabled(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJoin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLastindexof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLastmodified(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLayer(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLayers(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLeft(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLength(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLinks(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLn10(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLn2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLocation(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLocationbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog10e(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog2e(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLogon(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLong(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLowsrc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMath(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMax(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMax_value(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMenubar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMethod(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMimetype(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMimetypes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMin_value(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMoveby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMoveto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncName(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNative(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNavigator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNegative_infinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNetscape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNew(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNull(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNull2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNumber(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncObject(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnabort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnblur(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnchange(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnclick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOndblclick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnerror(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnfocus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeydown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeypress(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeyup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmousedown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmousemove(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseover(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnreset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnselect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnsubmit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnunload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOpen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOpener(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOption(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOptions(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOuterheight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOuterwidth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPackage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPackages(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagexoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagey(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPageyoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParsefloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParseint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPassword(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPathname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPersonalbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPi(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlatform(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlugin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlugins(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPositive_infinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrevious(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrivate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrompt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncProtected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncProtocol(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrototype(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPublic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRadio(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRandom(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReferrer(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRefresh(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRegexp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReleaseevents(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReplace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncResizeby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncResizeto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReturn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReverse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRound(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRouteevent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScreen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScroll(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollbars(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSearch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelectedindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSethours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetinterval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSettime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSettimeout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutchours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncShort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSlice(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSmall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSplit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt1_2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSrc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStart(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatusbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStrike(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncString(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStyle(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSub(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubmit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubstr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSuffixes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSuper(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSwitch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSynchronized(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTags(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTaint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTaintenabled(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTarget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncText(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTextarea(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThis(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThrow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThrows(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTitle(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTogmtstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTolocalestring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTolowercase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncToolbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTosource(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTostring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTouppercase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncToutcstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTransient(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTrue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTry(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncType(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTypeof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUndefined(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUnescape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUntaint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUnwatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUrl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUseragent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUtc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncValue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncValueof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncVar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncVisibility(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncVlinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncVoid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncVspace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWhile(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWidth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWindow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWith(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncWriteln(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncZindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -constructor TSynJScriptSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - AddAttribute(fNonReservedKeyAttri); - fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - AddAttribute(fEventAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterJScript; - fRange := rsUnknown; -end; - -procedure TSynJScriptSyn.AndSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '&']) then inc(Run); -end; - -procedure TSynJScriptSyn.CommentProc; -begin - if fLine[Run] = #0 then - NullProc - else - begin - fTokenID := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then - begin - fRange := rsUnKnown; - inc(Run, 2); - break; - end; - inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynJScriptSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynJScriptSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynJScriptSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynJScriptSyn.MinusProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '-', '>']) then inc(Run); -end; - -procedure TSynJScriptSyn.ModSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynJScriptSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynJScriptSyn.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 TSynJScriptSyn.OrSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '|']) then inc(Run); -end; - -procedure TSynJScriptSyn.PlusProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '+']) then inc(Run); -end; - -procedure TSynJScriptSyn.PointProc; -begin - fTokenID := tkSymbol; - inc(Run); - if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then inc(Run, 2); -end; - -procedure TSynJScriptSyn.SlashProc; -begin - Inc(Run); - case fLine[Run] of - '/': begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end; - '*': begin - fTokenID := tkComment; - fRange := rsAnsi; - repeat - Inc(Run); - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - fRange := rsUnKnown; - Inc(Run, 2); - break; - end; - until IsLineEnd(Run); - end; - '=': begin - Inc(Run); - fTokenID := tkSymbol; - end; - else - fTokenID := tkSymbol; - end; -end; - -procedure TSynJScriptSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynJScriptSyn.StarProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynJScriptSyn.StringProc; -var - l_strChar: string; -begin - fTokenID := tkString; - l_strChar := FLine[Run]; // We could have '"' or #39 - if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); - if not IsLineEnd(Run) then - Inc(Run); -end; - -procedure TSynJScriptSyn.SymbolProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynJScriptSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynJScriptSyn.Next; -begin - fTokenPos := Run; - if fRange = rsANSI then - CommentProc - else - case fLine[Run] of - '&': AndSymbolProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '-': MinusProc; - '%': ModSymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '*': StarProc; - '"', #39: StringProc; - '~', '{', '}', ',', '(', ')', '[', ']', '<', '>', ':', '?', ';', '!', '=': - SymbolProc; - else UnknownProc; - end; - inherited; -end; - -function TSynJScriptSyn.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 TSynJScriptSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynJScriptSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynJScriptSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynJScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNonReservedKey: Result := fNonReservedKeyAttri; - tkEvent: Result := fEventAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynJScriptSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynJScriptSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -//++ CodeFolding -procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - CurLine: String; - Line: Integer; - - function LineHasChar(Line: Integer; character: char; - StartCol : Integer): boolean; // faster than Pos! - var - i: Integer; - begin - result := false; - for I := StartCol to Length(CurLine) do begin - if CurLine[i] = character then begin - // Char must have proper highlighting (ignore stuff inside comments...) - if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin - result := true; - break; - end; - end; - end; - end; - - function FindBraces(Line: Integer) : Boolean; - Var - Col : Integer; - begin - Result := False; - - for Col := 1 to Length(CurLine) do - begin - // We've found a starting character - if CurLine[col] = '{' then - begin - // Char must have proper highlighting (ignore stuff inside comments...) - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then - begin - // And ignore lines with both opening and closing chars in them - if not LineHasChar(Line, '}', col + 1) then begin - FoldRanges.StartFoldRange(Line + 1, 1); - Result := True; - end; - // Skip until a newline - break; - end; - end else if CurLine[col] = '}' then - begin - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then - begin - // And ignore lines with both opening and closing chars in them - if not LineHasChar(Line, '{', col + 1) then begin - FoldRanges.StopFoldRange(Line + 1, 1); - Result := True; - end; - // Skip until a newline - break; - end; - end; - end; // for Col - end; - - function FoldRegion(Line: Integer): Boolean; - Var - S : string; - begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 9)) = '//#REGION' then - begin - FoldRanges.StartFoldRange(Line + 1, FoldRegionType); - Result := True; - end - else if Uppercase(Copy(S, 1, 12)) = '//#ENDREGION' then - begin - FoldRanges.StopFoldRange(Line + 1, FoldRegionType); - Result := True; - end; - end; - -begin - for Line := FromLine to ToLine do - begin - // Deal first with Multiline comments (Fold Type 2) - if TRangeState(GetLineRange(LinesToScan, Line)) = rsANSI then - begin - if TRangeState(GetLineRange(LinesToScan, Line - 1)) <> rsANSI then - FoldRanges.StartFoldRange(Line + 1, 2) - else - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end - else if TRangeState(GetLineRange(LinesToScan, Line - 1)) = rsANSI then - begin - FoldRanges.StopFoldRange(Line + 1, 2); - Continue; - end; - - CurLine := LinesToScan[Line]; - - // Skip empty lines - if CurLine = '' then begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // Find Fold regions - if FoldRegion(Line) then - Continue; - - // Find an braces on this line (Fold Type 1) - if not FindBraces(Line) then - FoldRanges.NoFoldInfo(Line + 1); - end; // while Line -end; -//-- CodeFolding - -procedure TSynJScriptSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynJScriptSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterJScript; -end; - -class function TSynJScriptSyn.GetLanguageName: string; -begin - Result := SYNS_LangJScript; -end; - -function TSynJScriptSyn.GetSampleSource: string; -begin - Result := '// Syntax highlighting'#13#10+ - 'function printNumber()'#13#10+ - '{'#13#10+ - ' var number = 1234;'#13#10+ - ' var x;'#13#10+ - ' document.write("The number is " + number);'#13#10+ - ' for (var i = 0; i <= number; i++)'#13#10+ - ' {'#13#10+ - ' x++;'#13#10+ - ' x--;'#13#10+ - ' x += 1.0;'#13#10+ - ' }'#13#10+ - ' i += @; // illegal character'#13#10+ - '}'#13#10+ - 'body.onLoad = printNumber;'; -end; - -class function TSynJScriptSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangJScript; -end; - -initialization - RegisterPlaceableHighlighter(TSynJScriptSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterJScript.pas, released 2000-04-14. +The Original Code is based on the mwJScript.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Tony de Buys. +Unicode translation by Maël Hörz. +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: SynHighlighterJScript.pas,v 1.21.2.8 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a JavaScript/JScript highlighter for SynEdit) +@author(Tony De Buys [tony@lad.co.za], converted to SynEdit by David Muir ) +@created(December 1999, converted to SynEdit April 14, 2000) +@lastmod(2000-06-23) +The SynHighlighterJScript unit provides SynEdit with a JScript/JavaScript (.js) highlighter. +The highlighter formats JavaScript source code highlighting keywords, strings, numbers and characters. +} + +unit SynHighlighterJScript; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynUnicode, +{$IFDEF SYN_CodeFolding} + SynEditCodeFolding, +{$ENDIF} + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, + tkString, tkSymbol, tkUnknown, tkNonReservedKey, tkEvent); + + TRangeState = (rsUnknown, rsANSI); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type +{$IFDEF SYN_CodeFolding} + TSynJScriptSyn = class(TSynCustomCodeFoldingHighlighter) +{$ELSE} + TSynJScriptSyn = class(TSynCustomHighLighter) +{$ENDIF} + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..5152] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNonReservedKeyAttri: TSynHighlighterAttributes; + FEventAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function FuncAbs(Index: Integer): TtkTokenKind; + function FuncAbstract(Index: Integer): TtkTokenKind; + function FuncAcos(Index: Integer): TtkTokenKind; + function FuncAction(Index: Integer): TtkTokenKind; + function FuncAlert(Index: Integer): TtkTokenKind; + function FuncAlign(Index: Integer): TtkTokenKind; + function FuncAlinkcolor(Index: Integer): TtkTokenKind; + function FuncAll(Index: Integer): TtkTokenKind; + function FuncAnchor(Index: Integer): TtkTokenKind; + function FuncAnchors(Index: Integer): TtkTokenKind; + function FuncAppcodename(Index: Integer): TtkTokenKind; + function FuncApplet(Index: Integer): TtkTokenKind; + function FuncApplets(Index: Integer): TtkTokenKind; + function FuncAppname(Index: Integer): TtkTokenKind; + function FuncAppversion(Index: Integer): TtkTokenKind; + function FuncArea(Index: Integer): TtkTokenKind; + function FuncArguments(Index: Integer): TtkTokenKind; + function FuncArray(Index: Integer): TtkTokenKind; + function FuncAsin(Index: Integer): TtkTokenKind; + function FuncAtan(Index: Integer): TtkTokenKind; + function FuncAtan2(Index: Integer): TtkTokenKind; + function FuncBack(Index: Integer): TtkTokenKind; + function FuncBackground(Index: Integer): TtkTokenKind; + function FuncBgcolor(Index: Integer): TtkTokenKind; + function FuncBig(Index: Integer): TtkTokenKind; + function FuncBlink(Index: Integer): TtkTokenKind; + function FuncBlur(Index: Integer): TtkTokenKind; + function FuncBody(Index: Integer): TtkTokenKind; + function FuncBold(Index: Integer): TtkTokenKind; + function FuncBoolean(Index: Integer): TtkTokenKind; + function FuncBoolean2(Index: Integer): TtkTokenKind; + function FuncBorder(Index: Integer): TtkTokenKind; + function FuncBottom(Index: Integer): TtkTokenKind; + function FuncBreak(Index: Integer): TtkTokenKind; + function FuncButton(Index: Integer): TtkTokenKind; + function FuncByte(Index: Integer): TtkTokenKind; + function FuncCall(Index: Integer): TtkTokenKind; + function FuncCallee(Index: Integer): TtkTokenKind; + function FuncCaller(Index: Integer): TtkTokenKind; + function FuncCaptureevents(Index: Integer): TtkTokenKind; + function FuncCase(Index: Integer): TtkTokenKind; + function FuncCatch(Index: Integer): TtkTokenKind; + function FuncCeil(Index: Integer): TtkTokenKind; + function FuncChar(Index: Integer): TtkTokenKind; + function FuncCharat(Index: Integer): TtkTokenKind; + function FuncCharcodeat(Index: Integer): TtkTokenKind; + function FuncCheckbox(Index: Integer): TtkTokenKind; + function FuncChecked(Index: Integer): TtkTokenKind; + function FuncClass(Index: Integer): TtkTokenKind; + function FuncClear(Index: Integer): TtkTokenKind; + function FuncClearinterval(Index: Integer): TtkTokenKind; + function FuncCleartimeout(Index: Integer): TtkTokenKind; + function FuncClick(Index: Integer): TtkTokenKind; + function FuncClose(Index: Integer): TtkTokenKind; + function FuncClosed(Index: Integer): TtkTokenKind; + function FuncColor(Index: Integer): TtkTokenKind; + function FuncComplete(Index: Integer): TtkTokenKind; + function FuncConcat(Index: Integer): TtkTokenKind; + function FuncConfirm(Index: Integer): TtkTokenKind; + function FuncConst(Index: Integer): TtkTokenKind; + function FuncConstructor(Index: Integer): TtkTokenKind; + function FuncContinue(Index: Integer): TtkTokenKind; + function FuncCookie(Index: Integer): TtkTokenKind; + function FuncCos(Index: Integer): TtkTokenKind; + function FuncCurrent(Index: Integer): TtkTokenKind; + function FuncDate(Index: Integer): TtkTokenKind; + function FuncDebugger(Index: Integer): TtkTokenKind; + function FuncDefault(Index: Integer): TtkTokenKind; + function FuncDefaultchecked(Index: Integer): TtkTokenKind; + function FuncDefaultselected(Index: Integer): TtkTokenKind; + function FuncDefaultstatus(Index: Integer): TtkTokenKind; + function FuncDefaultvalue(Index: Integer): TtkTokenKind; + function FuncDelete(Index: Integer): TtkTokenKind; + function FuncDescription(Index: Integer): TtkTokenKind; + function FuncDisplay(Index: Integer): TtkTokenKind; + function FuncDo(Index: Integer): TtkTokenKind; + function FuncDocument(Index: Integer): TtkTokenKind; + function FuncDomain(Index: Integer): TtkTokenKind; + function FuncDouble(Index: Integer): TtkTokenKind; + function FuncE(Index: Integer): TtkTokenKind; + function FuncElements(Index: Integer): TtkTokenKind; + function FuncElse(Index: Integer): TtkTokenKind; + function FuncEmbed(Index: Integer): TtkTokenKind; + function FuncEmbeds(Index: Integer): TtkTokenKind; + function FuncEnabledplugin(Index: Integer): TtkTokenKind; + function FuncEncoding(Index: Integer): TtkTokenKind; + function FuncEnum(Index: Integer): TtkTokenKind; + function FuncEscape(Index: Integer): TtkTokenKind; + function FuncEval(Index: Integer): TtkTokenKind; + function FuncEvent(Index: Integer): TtkTokenKind; + function FuncExp(Index: Integer): TtkTokenKind; + function FuncExport(Index: Integer): TtkTokenKind; + function FuncExtends(Index: Integer): TtkTokenKind; + function FuncFalse(Index: Integer): TtkTokenKind; + function FuncFgcolor(Index: Integer): TtkTokenKind; + function FuncFilename(Index: Integer): TtkTokenKind; + function FuncFileupload(Index: Integer): TtkTokenKind; + function FuncFinal(Index: Integer): TtkTokenKind; + function FuncFinally(Index: Integer): TtkTokenKind; + function FuncFind(Index: Integer): TtkTokenKind; + function FuncFixed(Index: Integer): TtkTokenKind; + function FuncFloat(Index: Integer): TtkTokenKind; + function FuncFloat2(Index: Integer): TtkTokenKind; + function FuncFloor(Index: Integer): TtkTokenKind; + function FuncFocus(Index: Integer): TtkTokenKind; + function FuncFontcolor(Index: Integer): TtkTokenKind; + function FuncFontsize(Index: Integer): TtkTokenKind; + function FuncFor(Index: Integer): TtkTokenKind; + function FuncForm(Index: Integer): TtkTokenKind; + function FuncForms(Index: Integer): TtkTokenKind; + function FuncForward(Index: Integer): TtkTokenKind; + function FuncFrame(Index: Integer): TtkTokenKind; + function FuncFrames(Index: Integer): TtkTokenKind; + function FuncFromcharcode(Index: Integer): TtkTokenKind; + function FuncFunction(Index: Integer): TtkTokenKind; + function FuncFunction2(Index: Integer): TtkTokenKind; + function FuncGetdate(Index: Integer): TtkTokenKind; + function FuncGetday(Index: Integer): TtkTokenKind; + function FuncGetelementbyid(Index: Integer): TtkTokenKind; + function FuncGetfullyear(Index: Integer): TtkTokenKind; + function FuncGethours(Index: Integer): TtkTokenKind; + function FuncGetmilliseconds(Index: Integer): TtkTokenKind; + function FuncGetminutes(Index: Integer): TtkTokenKind; + function FuncGetmonth(Index: Integer): TtkTokenKind; + function FuncGetseconds(Index: Integer): TtkTokenKind; + function FuncGettime(Index: Integer): TtkTokenKind; + function FuncGettimezoneoffset(Index: Integer): TtkTokenKind; + function FuncGetutcdate(Index: Integer): TtkTokenKind; + function FuncGetutcday(Index: Integer): TtkTokenKind; + function FuncGetutcfullyear(Index: Integer): TtkTokenKind; + function FuncGetutchours(Index: Integer): TtkTokenKind; + function FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; + function FuncGetutcminutes(Index: Integer): TtkTokenKind; + function FuncGetutcmonth(Index: Integer): TtkTokenKind; + function FuncGetutcseconds(Index: Integer): TtkTokenKind; + function FuncGetyear(Index: Integer): TtkTokenKind; + function FuncGlobal(Index: Integer): TtkTokenKind; + function FuncGo(Index: Integer): TtkTokenKind; + function FuncGoto(Index: Integer): TtkTokenKind; + function FuncHandleevent(Index: Integer): TtkTokenKind; + function FuncHash(Index: Integer): TtkTokenKind; + function FuncHeight(Index: Integer): TtkTokenKind; + function FuncHidden(Index: Integer): TtkTokenKind; + function FuncHistory(Index: Integer): TtkTokenKind; + function FuncHome(Index: Integer): TtkTokenKind; + function FuncHost(Index: Integer): TtkTokenKind; + function FuncHostname(Index: Integer): TtkTokenKind; + function FuncHref(Index: Integer): TtkTokenKind; + function FuncHspace(Index: Integer): TtkTokenKind; + function FuncIf(Index: Integer): TtkTokenKind; + function FuncImage(Index: Integer): TtkTokenKind; + function FuncImages(Index: Integer): TtkTokenKind; + function FuncImplements(Index: Integer): TtkTokenKind; + function FuncImport(Index: Integer): TtkTokenKind; + function FuncIn(Index: Integer): TtkTokenKind; + function FuncIndex(Index: Integer): TtkTokenKind; + function FuncIndexof(Index: Integer): TtkTokenKind; + function FuncInfinity(Index: Integer): TtkTokenKind; + function FuncInnerheight(Index: Integer): TtkTokenKind; + function FuncInnerwidth(Index: Integer): TtkTokenKind; + function FuncInput(Index: Integer): TtkTokenKind; + function FuncInstanceof(Index: Integer): TtkTokenKind; + function FuncInt(Index: Integer): TtkTokenKind; + function FuncInterface(Index: Integer): TtkTokenKind; + function FuncIsfinite(Index: Integer): TtkTokenKind; + function FuncIsnan(Index: Integer): TtkTokenKind; + function FuncItalics(Index: Integer): TtkTokenKind; + function FuncJava(Index: Integer): TtkTokenKind; + function FuncJavaenabled(Index: Integer): TtkTokenKind; + function FuncJoin(Index: Integer): TtkTokenKind; + function FuncLastindexof(Index: Integer): TtkTokenKind; + function FuncLastmodified(Index: Integer): TtkTokenKind; + function FuncLayer(Index: Integer): TtkTokenKind; + function FuncLayers(Index: Integer): TtkTokenKind; + function FuncLeft(Index: Integer): TtkTokenKind; + function FuncLength(Index: Integer): TtkTokenKind; + function FuncLink(Index: Integer): TtkTokenKind; + function FuncLinkcolor(Index: Integer): TtkTokenKind; + function FuncLinks(Index: Integer): TtkTokenKind; + function FuncLn10(Index: Integer): TtkTokenKind; + function FuncLn2(Index: Integer): TtkTokenKind; + function FuncLocation(Index: Integer): TtkTokenKind; + function FuncLocationbar(Index: Integer): TtkTokenKind; + function FuncLog(Index: Integer): TtkTokenKind; + function FuncLog10e(Index: Integer): TtkTokenKind; + function FuncLog2e(Index: Integer): TtkTokenKind; + function FuncLogon(Index: Integer): TtkTokenKind; + function FuncLong(Index: Integer): TtkTokenKind; + function FuncLowsrc(Index: Integer): TtkTokenKind; + function FuncMatch(Index: Integer): TtkTokenKind; + function FuncMath(Index: Integer): TtkTokenKind; + function FuncMax(Index: Integer): TtkTokenKind; + function FuncMax_value(Index: Integer): TtkTokenKind; + function FuncMenubar(Index: Integer): TtkTokenKind; + function FuncMethod(Index: Integer): TtkTokenKind; + function FuncMimetype(Index: Integer): TtkTokenKind; + function FuncMimetypes(Index: Integer): TtkTokenKind; + function FuncMin(Index: Integer): TtkTokenKind; + function FuncMin_value(Index: Integer): TtkTokenKind; + function FuncMoveby(Index: Integer): TtkTokenKind; + function FuncMoveto(Index: Integer): TtkTokenKind; + function FuncName(Index: Integer): TtkTokenKind; + function FuncNan(Index: Integer): TtkTokenKind; + function FuncNative(Index: Integer): TtkTokenKind; + function FuncNavigator(Index: Integer): TtkTokenKind; + function FuncNegative_infinity(Index: Integer): TtkTokenKind; + function FuncNetscape(Index: Integer): TtkTokenKind; + function FuncNew(Index: Integer): TtkTokenKind; + function FuncNext(Index: Integer): TtkTokenKind; + function FuncNull(Index: Integer): TtkTokenKind; + function FuncNull2(Index: Integer): TtkTokenKind; + function FuncNumber(Index: Integer): TtkTokenKind; + function FuncObject(Index: Integer): TtkTokenKind; + function FuncOnabort(Index: Integer): TtkTokenKind; + function FuncOnblur(Index: Integer): TtkTokenKind; + function FuncOnchange(Index: Integer): TtkTokenKind; + function FuncOnclick(Index: Integer): TtkTokenKind; + function FuncOndblclick(Index: Integer): TtkTokenKind; + function FuncOnerror(Index: Integer): TtkTokenKind; + function FuncOnfocus(Index: Integer): TtkTokenKind; + function FuncOnkeydown(Index: Integer): TtkTokenKind; + function FuncOnkeypress(Index: Integer): TtkTokenKind; + function FuncOnkeyup(Index: Integer): TtkTokenKind; + function FuncOnload(Index: Integer): TtkTokenKind; + function FuncOnmousedown(Index: Integer): TtkTokenKind; + function FuncOnmousemove(Index: Integer): TtkTokenKind; + function FuncOnmouseout(Index: Integer): TtkTokenKind; + function FuncOnmouseover(Index: Integer): TtkTokenKind; + function FuncOnmouseup(Index: Integer): TtkTokenKind; + function FuncOnreset(Index: Integer): TtkTokenKind; + function FuncOnselect(Index: Integer): TtkTokenKind; + function FuncOnsubmit(Index: Integer): TtkTokenKind; + function FuncOnunload(Index: Integer): TtkTokenKind; + function FuncOpen(Index: Integer): TtkTokenKind; + function FuncOpener(Index: Integer): TtkTokenKind; + function FuncOption(Index: Integer): TtkTokenKind; + function FuncOptions(Index: Integer): TtkTokenKind; + function FuncOuterheight(Index: Integer): TtkTokenKind; + function FuncOuterwidth(Index: Integer): TtkTokenKind; + function FuncPackage(Index: Integer): TtkTokenKind; + function FuncPackages(Index: Integer): TtkTokenKind; + function FuncPagex(Index: Integer): TtkTokenKind; + function FuncPagexoffset(Index: Integer): TtkTokenKind; + function FuncPagey(Index: Integer): TtkTokenKind; + function FuncPageyoffset(Index: Integer): TtkTokenKind; + function FuncParent(Index: Integer): TtkTokenKind; + function FuncParse(Index: Integer): TtkTokenKind; + function FuncParsefloat(Index: Integer): TtkTokenKind; + function FuncParseint(Index: Integer): TtkTokenKind; + function FuncPassword(Index: Integer): TtkTokenKind; + function FuncPathname(Index: Integer): TtkTokenKind; + function FuncPersonalbar(Index: Integer): TtkTokenKind; + function FuncPi(Index: Integer): TtkTokenKind; + function FuncPlatform(Index: Integer): TtkTokenKind; + function FuncPlugin(Index: Integer): TtkTokenKind; + function FuncPlugins(Index: Integer): TtkTokenKind; + function FuncPort(Index: Integer): TtkTokenKind; + function FuncPositive_infinity(Index: Integer): TtkTokenKind; + function FuncPow(Index: Integer): TtkTokenKind; + function FuncPrevious(Index: Integer): TtkTokenKind; + function FuncPrint(Index: Integer): TtkTokenKind; + function FuncPrivate(Index: Integer): TtkTokenKind; + function FuncPrompt(Index: Integer): TtkTokenKind; + function FuncProtected(Index: Integer): TtkTokenKind; + function FuncProtocol(Index: Integer): TtkTokenKind; + function FuncPrototype(Index: Integer): TtkTokenKind; + function FuncPublic(Index: Integer): TtkTokenKind; + function FuncRadio(Index: Integer): TtkTokenKind; + function FuncRandom(Index: Integer): TtkTokenKind; + function FuncReferrer(Index: Integer): TtkTokenKind; + function FuncRefresh(Index: Integer): TtkTokenKind; + function FuncRegexp(Index: Integer): TtkTokenKind; + function FuncReleaseevents(Index: Integer): TtkTokenKind; + function FuncReload(Index: Integer): TtkTokenKind; + function FuncReplace(Index: Integer): TtkTokenKind; + function FuncReset(Index: Integer): TtkTokenKind; + function FuncResizeby(Index: Integer): TtkTokenKind; + function FuncResizeto(Index: Integer): TtkTokenKind; + function FuncReturn(Index: Integer): TtkTokenKind; + function FuncReverse(Index: Integer): TtkTokenKind; + function FuncRight(Index: Integer): TtkTokenKind; + function FuncRound(Index: Integer): TtkTokenKind; + function FuncRouteevent(Index: Integer): TtkTokenKind; + function FuncScreen(Index: Integer): TtkTokenKind; + function FuncScroll(Index: Integer): TtkTokenKind; + function FuncScrollbars(Index: Integer): TtkTokenKind; + function FuncScrollby(Index: Integer): TtkTokenKind; + function FuncScrollto(Index: Integer): TtkTokenKind; + function FuncSearch(Index: Integer): TtkTokenKind; + function FuncSelect(Index: Integer): TtkTokenKind; + function FuncSelected(Index: Integer): TtkTokenKind; + function FuncSelectedindex(Index: Integer): TtkTokenKind; + function FuncSelf(Index: Integer): TtkTokenKind; + function FuncSetdate(Index: Integer): TtkTokenKind; + function FuncSetfullyear(Index: Integer): TtkTokenKind; + function FuncSethours(Index: Integer): TtkTokenKind; + function FuncSetinterval(Index: Integer): TtkTokenKind; + function FuncSetmilliseconds(Index: Integer): TtkTokenKind; + function FuncSetminutes(Index: Integer): TtkTokenKind; + function FuncSetmonth(Index: Integer): TtkTokenKind; + function FuncSetseconds(Index: Integer): TtkTokenKind; + function FuncSettime(Index: Integer): TtkTokenKind; + function FuncSettimeout(Index: Integer): TtkTokenKind; + function FuncSetutcdate(Index: Integer): TtkTokenKind; + function FuncSetutcfullyear(Index: Integer): TtkTokenKind; + function FuncSetutchours(Index: Integer): TtkTokenKind; + function FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; + function FuncSetutcminutes(Index: Integer): TtkTokenKind; + function FuncSetutcmonth(Index: Integer): TtkTokenKind; + function FuncSetutcseconds(Index: Integer): TtkTokenKind; + function FuncSetyear(Index: Integer): TtkTokenKind; + function FuncShort(Index: Integer): TtkTokenKind; + function FuncSin(Index: Integer): TtkTokenKind; + function FuncSlice(Index: Integer): TtkTokenKind; + function FuncSmall(Index: Integer): TtkTokenKind; + function FuncSort(Index: Integer): TtkTokenKind; + function FuncSplit(Index: Integer): TtkTokenKind; + function FuncSqrt(Index: Integer): TtkTokenKind; + function FuncSqrt1_2(Index: Integer): TtkTokenKind; + function FuncSqrt2(Index: Integer): TtkTokenKind; + function FuncSrc(Index: Integer): TtkTokenKind; + function FuncStart(Index: Integer): TtkTokenKind; + function FuncStatic(Index: Integer): TtkTokenKind; + function FuncStatus(Index: Integer): TtkTokenKind; + function FuncStatusbar(Index: Integer): TtkTokenKind; + function FuncStop(Index: Integer): TtkTokenKind; + function FuncStrike(Index: Integer): TtkTokenKind; + function FuncString(Index: Integer): TtkTokenKind; + function FuncStyle(Index: Integer): TtkTokenKind; + function FuncSub(Index: Integer): TtkTokenKind; + function FuncSubmit(Index: Integer): TtkTokenKind; + function FuncSubstr(Index: Integer): TtkTokenKind; + function FuncSubstring(Index: Integer): TtkTokenKind; + function FuncSuffixes(Index: Integer): TtkTokenKind; + function FuncSup(Index: Integer): TtkTokenKind; + function FuncSuper(Index: Integer): TtkTokenKind; + function FuncSwitch(Index: Integer): TtkTokenKind; + function FuncSynchronized(Index: Integer): TtkTokenKind; + function FuncTags(Index: Integer): TtkTokenKind; + function FuncTaint(Index: Integer): TtkTokenKind; + function FuncTaintenabled(Index: Integer): TtkTokenKind; + function FuncTan(Index: Integer): TtkTokenKind; + function FuncTarget(Index: Integer): TtkTokenKind; + function FuncText(Index: Integer): TtkTokenKind; + function FuncTextarea(Index: Integer): TtkTokenKind; + function FuncThis(Index: Integer): TtkTokenKind; + function FuncThrow(Index: Integer): TtkTokenKind; + function FuncThrows(Index: Integer): TtkTokenKind; + function FuncTitle(Index: Integer): TtkTokenKind; + function FuncTogmtstring(Index: Integer): TtkTokenKind; + function FuncTolocalestring(Index: Integer): TtkTokenKind; + function FuncTolowercase(Index: Integer): TtkTokenKind; + function FuncToolbar(Index: Integer): TtkTokenKind; + function FuncTop(Index: Integer): TtkTokenKind; + function FuncTosource(Index: Integer): TtkTokenKind; + function FuncTostring(Index: Integer): TtkTokenKind; + function FuncTouppercase(Index: Integer): TtkTokenKind; + function FuncToutcstring(Index: Integer): TtkTokenKind; + function FuncTransient(Index: Integer): TtkTokenKind; + function FuncTrue(Index: Integer): TtkTokenKind; + function FuncTry(Index: Integer): TtkTokenKind; + function FuncType(Index: Integer): TtkTokenKind; + function FuncTypeof(Index: Integer): TtkTokenKind; + function FuncUndefined(Index: Integer): TtkTokenKind; + function FuncUnescape(Index: Integer): TtkTokenKind; + function FuncUntaint(Index: Integer): TtkTokenKind; + function FuncUnwatch(Index: Integer): TtkTokenKind; + function FuncUrl(Index: Integer): TtkTokenKind; + function FuncUseragent(Index: Integer): TtkTokenKind; + function FuncUtc(Index: Integer): TtkTokenKind; + function FuncValue(Index: Integer): TtkTokenKind; + function FuncValueof(Index: Integer): TtkTokenKind; + function FuncVar(Index: Integer): TtkTokenKind; + function FuncVisibility(Index: Integer): TtkTokenKind; + function FuncVlinkcolor(Index: Integer): TtkTokenKind; + function FuncVoid(Index: Integer): TtkTokenKind; + function FuncVspace(Index: Integer): TtkTokenKind; + function FuncWatch(Index: Integer): TtkTokenKind; + function FuncWhile(Index: Integer): TtkTokenKind; + function FuncWidth(Index: Integer): TtkTokenKind; + function FuncWindow(Index: Integer): TtkTokenKind; + function FuncWith(Index: Integer): TtkTokenKind; + function FuncWrite(Index: Integer): TtkTokenKind; + function FuncWriteln(Index: Integer): TtkTokenKind; + function FuncZindex(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AndSymbolProc; + procedure CommentProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure MinusProc; + procedure ModSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure SlashProc; + procedure SpaceProc; + procedure StarProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; +{$IFDEF SYN_CodeFolding} + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +{$ENDIF} + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NonReservedKeyAttri: TSynHighlighterAttributes read FNonReservedKeyAttri write FNonReservedKeyAttri; + property EventAttri: TSynHighlighterAttributes read FEventAttri write FEventAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..398] of UnicodeString = ( + 'abs', 'abstract', 'acos', 'action', 'alert', 'align', 'alinkColor', 'all', + 'All', 'anchor', 'Anchor', 'anchors', 'appCodeName', 'Applet', 'applets', + 'appName', 'appVersion', 'Area', 'arguments', 'Arguments', 'Array', 'asin', + 'atan', 'atan2', 'back', 'background', 'bgColor', 'big', 'blink', 'blur', + 'body', 'bold', 'boolean', 'Boolean', 'border', 'bottom', 'break', 'Button', + 'byte', 'call', 'callee', 'caller', 'captureEvents', 'case', 'catch', + 'ceil', 'char', 'charAt', 'charCodeAt', 'Checkbox', 'checked', 'class', + 'clear', 'clearInterval', 'clearTimeout', 'click', 'close', 'closed', + 'color', 'complete', 'concat', 'confirm', 'const', 'constructor', + 'continue', 'cookie', 'cos', 'current', 'Date', 'debugger', 'default', + 'defaultChecked', 'defaultSelected', 'defaultStatus', 'defaultValue', + 'delete', 'description', 'display', 'do', 'document', 'domain', 'double', + 'E', 'elements', 'else', 'Embed', 'embeds', 'enabledPlugin', 'encoding', + 'enum', 'escape', 'eval', 'event', 'exp', 'export', 'extends', 'false', + 'fgColor', 'filename', 'FileUpload', 'final', 'finally', 'find', 'fixed', + 'float', 'Float', 'floor', 'focus', 'fontcolor', 'fontsize', 'for', 'form', + 'Form', 'forms', 'forward', 'Frame', 'frames', 'fromCharCode', 'function', + 'Function', 'getDate', 'getDay', 'getElementById', 'getFullYear', + 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', + 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', + 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', + 'getUTCSeconds', 'getYear', 'Global', 'go', 'goto', 'handleEvent', 'hash', + 'height', 'Hidden', 'history', 'History', 'home', 'host', 'hostname', + 'href', 'hspace', 'if', 'Image', 'images', 'implements', 'import', 'in', + 'index', 'indexOf', 'Infinity', 'innerHeight', 'innerWidth', 'input', + 'instanceof', 'int', 'interface', 'isFinite', 'isNaN', 'italics', 'java', + 'javaEnabled', 'join', 'lastIndexOf', 'lastModified', 'Layer', 'layers', + 'left', 'length', 'link', 'Link', 'linkColor', 'links', 'LN10', 'LN2', + 'location', 'Location', 'locationbar', 'log', 'LOG10E', 'LOG2E', 'logon', + 'long', 'lowsrc', 'match', 'Math', 'max', 'MAX_VALUE', 'menubar', 'method', + 'MimeType', 'mimeTypes', 'min', 'MIN_VALUE', 'moveBy', 'moveTo', 'name', + 'NaN', 'native', 'navigator', 'Navigator', 'NEGATIVE_INFINITY', 'netscape', + 'new', 'next', 'null', 'Null', 'Number', 'Object', 'onAbort', 'onBlur', + 'onChange', 'onClick', 'onDblClick', 'onError', 'onFocus', 'onKeyDown', + 'onKeyPress', 'onKeyUp', 'onLoad', 'onMouseDown', 'onMouseMove', + 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onReset', 'onSelect', 'onSubmit', + 'onUnload', 'open', 'opener', 'Option', 'options', 'outerHeight', + 'outerWidth', 'package', 'Packages', 'pageX', 'pageXOffset', 'pageY', + 'pageYOffset', 'parent', 'parse', 'parseFloat', 'parseInt', 'Password', + 'pathname', 'personalbar', 'PI', 'platform', 'Plugin', 'plugins', 'port', + 'POSITIVE_INFINITY', 'pow', 'previous', 'print', 'private', 'prompt', + 'protected', 'protocol', 'prototype', 'public', 'Radio', 'random', + 'referrer', 'refresh', 'RegExp', 'releaseEvents', 'reload', 'replace', + 'reset', 'Reset', 'resizeBy', 'resizeTo', 'return', 'reverse', 'right', + 'round', 'routeEvent', 'screen', 'scroll', 'scrollbars', 'scrollBy', + 'scrollTo', 'search', 'select', 'Select', 'selected', 'selectedIndex', + 'self', 'setDate', 'setFullYear', 'setHours', 'setInterval', + 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', + 'setTimeout', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', + 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', + 'setYear', 'short', 'sin', 'slice', 'small', 'sort', 'split', 'sqrt', + 'SQRT1_2', 'SQRT2', 'src', 'start', 'static', 'status', 'statusbar', 'stop', + 'strike', 'String', 'style', 'sub', 'submit', 'Submit', 'substr', + 'substring', 'suffixes', 'sup', 'super', 'switch', 'synchronized', 'tags', + 'taint', 'taintEnabled', 'tan', 'target', 'text', 'Text', 'Textarea', + 'this', 'throw', 'throws', 'title', 'toGMTString', 'toLocaleString', + 'toLowerCase', 'toolbar', 'top', 'toSource', 'toString', 'toUpperCase', + 'toUTCString', 'transient', 'true', 'try', 'type', 'typeof', 'undefined', + 'Undefined', 'unescape', 'untaint', 'unwatch', 'URL', 'userAgent', 'UTC', + 'value', 'valueOf', 'var', 'visibility', 'vlinkColor', 'void', 'vspace', + 'watch', 'while', 'width', 'window', 'Window', 'with', 'write', 'writeln', + 'zIndex' + ); + + KeyIndices: array[0..5152] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, -1, -1, -1, 296, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, + -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -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, -1, 295, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 75, 351, -1, -1, -1, -1, -1, -1, 315, 37, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, 326, -1, -1, -1, 31, + -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, 143, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 339, -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, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, + -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, -1, -1, -1, -1, -1, -1, -1, -1, 235, -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, -1, -1, -1, -1, -1, + -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, + -1, -1, 16, 52, 389, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 259, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, 30, -1, -1, -1, -1, -1, -1, + -1, 10, -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, 304, -1, 396, 2, -1, -1, 323, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, + -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, + -1, -1, -1, 203, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 83, -1, -1, + -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 268, -1, -1, -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, 246, 18, -1, + -1, -1, -1, -1, 209, -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, -1, -1, 220, 161, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 229, -1, -1, -1, -1, -1, -1, -1, 157, 319, -1, 210, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 381, 78, -1, + -1, -1, -1, -1, -1, -1, 257, -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, -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, 219, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 196, -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 309, -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, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 386, 146, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -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, 269, -1, -1, -1, 199, 172, -1, 15, 123, -1, -1, -1, -1, -1, -1, -1, 136, + -1, -1, -1, 128, -1, -1, -1, -1, 366, -1, -1, 185, -1, -1, -1, -1, 153, -1, + -1, -1, -1, 388, -1, -1, 165, -1, -1, -1, -1, -1, -1, 338, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 360, -1, -1, + 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 307, -1, -1, -1, -1, -1, -1, -1, 258, -1, + -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, 129, -1, -1, + -1, -1, -1, -1, -1, -1, 120, -1, -1, 95, -1, 233, -1, -1, -1, -1, -1, -1, + -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 90, 282, -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, 341, 232, 121, 155, -1, + -1, -1, -1, -1, 247, -1, -1, -1, -1, 67, -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, + -1, -1, -1, -1, -1, -1, -1, 327, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -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, -1, -1, -1, 170, -1, -1, -1, -1, 298, -1, + -1, -1, -1, -1, -1, -1, 114, -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, -1, -1, 271, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 70, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 91, -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, 106, -1, -1, 237, -1, -1, -1, -1, -1, 6, + -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, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 250, -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, -1, -1, -1, -1, -1, + -1, -1, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, + -1, -1, -1, -1, -1, 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, -1, -1, + -1, -1, -1, -1, -1, 227, -1, -1, 383, -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, + -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 29, 148, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 392, -1, -1, -1, -1, -1, 125, -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, -1, -1, -1, 201, -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, 135, -1, -1, 212, + -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, + -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 334, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 289, -1, -1, -1, -1, 312, -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, 385, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, 371, 76, + -1, -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, 156, -1, 23, -1, -1, -1, -1, -1, -1, + -1, -1, 280, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 277, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, 93, -1, + -1, -1, -1, -1, -1, -1, 202, -1, 5, 343, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 50, -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, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 333, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, 139, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, + 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 278, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 302, 316, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, + 254, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, 345, -1, -1, 144, -1, -1, -1, 7, + -1, -1, 306, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, 308, -1, -1, -1, + -1, 357, -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, 36, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 361, -1, -1, -1, -1, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 376, -1, -1, -1, -1, 188, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 98, -1, -1, -1, + -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 299, -1, -1, -1, 369, -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, -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, -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, -1, -1, -1, -1, + -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 356, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 8, -1, 300, -1, -1, 228, 59, -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, -1, -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, + -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 350, -1, -1, -1, -1, + -1, -1, 284, -1, -1, -1, 256, -1, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, + 190, -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, -1, -1, 102, -1, 230, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, 71, 26, -1, -1, -1, -1, + -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 322, -1, -1, 175, -1, -1, 393, -1, 124, 85, -1, -1, -1, -1, + -1, -1, -1, -1, 150, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, + -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 111, -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, -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, -1, -1, -1, -1, -1, -1, -1, + 42, 244, -1, -1, -1, -1, -1, -1, -1, 47, 313, -1, 41, -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, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 294, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 245, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, -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, + -1, -1, 347, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, -1, -1, -1, + 217, -1, -1, -1, 87, -1, -1, -1, 329, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, -1, 222, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 174, -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, -1, -1, + 274, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 382, -1, -1, -1, 138, 226, -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, -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, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, + -1, -1, 318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 335, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, 191, -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, -1, -1, -1, -1, -1, -1, -1, -1, 288, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 158, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, 57, + -1, -1, -1, 211, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, 264, -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, -1, -1, 321, -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, 207, -1, -1, + 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 149, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 293, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 242, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, + -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 92, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 325, 126, -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, -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, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 372, -1, -1, -1, 380, -1, -1, + 352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 263, -1, -1, -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 286, -1, 46, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, 19, + -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, -1, -1, 270, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 283, + -1, -1, -1, -1, -1, -1, -1, -1, 151, -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, 65, -1, -1, -1, + -1, -1, -1, -1, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 252, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 355, -1, -1, 365, -1, -1, -1, + -1, -1, -1, -1, -1, 28, -1, -1, 378, -1, -1, -1, -1, 354, -1, -1, -1, -1, + -1, -1, -1, -1, 349, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, 285, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 81, 394, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 358, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 224, -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, 181, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 375, + -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, -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, -1, + -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 9, -1, -1, -1, -1, -1, 305, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, + 281, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, + -1, -1, 261, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, 290, -1, 66, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 131, -1, 279, -1, -1, -1, 249, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, + 127, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 53, -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, -1, -1, + -1, -1, -1, -1, -1, -1, 364, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 395, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 310, -1, 218, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, 390, -1, -1, -1, -1, -1, -1, -1, + 328, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, 311, -1, -1, -1, -1, + -1, -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 344, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 337, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, + -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, -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, -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, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, + -1, -1, -1, -1, -1, -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, 346, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 348, 159, -1, -1, -1, -1, -1, -1, -1, + 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 370, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, 314, -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, -1, -1, 291, -1, -1, -1, -1, -1, -1, 384, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, 340, -1, -1, + -1, -1, -1, -1, 317, -1, 79, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, + 353, -1, 301, -1, -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 186, -1, -1, -1 + ); + +{$Q-} +function TSynJScriptSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 751 + Ord(Str^) * 148; + Inc(Str); + end; + Result := Result mod 5153; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynJScriptSyn.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 TSynJScriptSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[4966] := FuncAbs; + FIdentFuncTable[2170] := FuncAbstract; + FIdentFuncTable[520] := FuncAcos; + FIdentFuncTable[319] := FuncAction; + FIdentFuncTable[4368] := FuncAlert; + FIdentFuncTable[2070] := FuncAlign; + FIdentFuncTable[1500] := FuncAlinkcolor; + FIdentFuncTable[2362] := FuncAll; + FIdentFuncTable[2706] := FuncAll; + FIdentFuncTable[4383] := FuncAnchor; + FIdentFuncTable[491] := FuncAnchor; + FIdentFuncTable[2516] := FuncAnchors; + FIdentFuncTable[2207] := FuncAppcodename; + FIdentFuncTable[1993] := FuncApplet; + FIdentFuncTable[1805] := FuncApplets; + FIdentFuncTable[965] := FuncAppname; + FIdentFuncTable[416] := FuncAppversion; + FIdentFuncTable[2052] := FuncArea; + FIdentFuncTable[618] := FuncArguments; + FIdentFuncTable[3950] := FuncArguments; + FIdentFuncTable[2987] := FuncArray; + FIdentFuncTable[4131] := FuncAsin; + FIdentFuncTable[5117] := FuncAtan; + FIdentFuncTable[1999] := FuncAtan2; + FIdentFuncTable[3356] := FuncBack; + FIdentFuncTable[3954] := FuncBackground; + FIdentFuncTable[2882] := FuncBgcolor; + FIdentFuncTable[1824] := FuncBig; + FIdentFuncTable[4067] := FuncBlink; + FIdentFuncTable[1709] := FuncBlur; + FIdentFuncTable[483] := FuncBody; + FIdentFuncTable[243] := FuncBold; + FIdentFuncTable[4200] := FuncBoolean; + FIdentFuncTable[3265] := FuncBoolean2; + FIdentFuncTable[563] := FuncBorder; + FIdentFuncTable[2857] := FuncBottom; + FIdentFuncTable[2410] := FuncBreak; + FIdentFuncTable[223] := FuncButton; + FIdentFuncTable[575] := FuncByte; + FIdentFuncTable[3204] := FuncCall; + FIdentFuncTable[1125] := FuncCallee; + FIdentFuncTable[3049] := FuncCaller; + FIdentFuncTable[3037] := FuncCaptureevents; + FIdentFuncTable[2101] := FuncCase; + FIdentFuncTable[2105] := FuncCatch; + FIdentFuncTable[4662] := FuncCeil; + FIdentFuncTable[3938] := FuncChar; + FIdentFuncTable[3046] := FuncCharat; + FIdentFuncTable[3724] := FuncCharcodeat; + FIdentFuncTable[4522] := FuncCheckbox; + FIdentFuncTable[2127] := FuncChecked; + FIdentFuncTable[1908] := FuncClass; + FIdentFuncTable[417] := FuncClear; + FIdentFuncTable[4574] := FuncClearinterval; + FIdentFuncTable[2626] := FuncCleartimeout; + FIdentFuncTable[55] := FuncClick; + FIdentFuncTable[3783] := FuncClose; + FIdentFuncTable[3615] := FuncClosed; + FIdentFuncTable[1688] := FuncColor; + FIdentFuncTable[2712] := FuncComplete; + FIdentFuncTable[2889] := FuncConcat; + FIdentFuncTable[3503] := FuncConfirm; + FIdentFuncTable[820] := FuncConst; + FIdentFuncTable[3079] := FuncConstructor; + FIdentFuncTable[3092] := FuncContinue; + FIdentFuncTable[4022] := FuncCookie; + FIdentFuncTable[4452] := FuncCos; + FIdentFuncTable[1188] := FuncCurrent; + FIdentFuncTable[1955] := FuncDate; + FIdentFuncTable[1095] := FuncDebugger; + FIdentFuncTable[1389] := FuncDefault; + FIdentFuncTable[2881] := FuncDefaultchecked; + FIdentFuncTable[2879] := FuncDefaultselected; + FIdentFuncTable[3607] := FuncDefaultstatus; + FIdentFuncTable[1234] := FuncDefaultvalue; + FIdentFuncTable[214] := FuncDelete; + FIdentFuncTable[1929] := FuncDescription; + FIdentFuncTable[1046] := FuncDisplay; + FIdentFuncTable[748] := FuncDo; + FIdentFuncTable[5075] := FuncDocument; + FIdentFuncTable[4671] := FuncDomain; + FIdentFuncTable[4176] := FuncDouble; + FIdentFuncTable[5059] := FuncE; + FIdentFuncTable[581] := FuncElements; + FIdentFuncTable[4413] := FuncElse; + FIdentFuncTable[2919] := FuncEmbed; + FIdentFuncTable[2346] := FuncEmbeds; + FIdentFuncTable[3190] := FuncEnabledplugin; + FIdentFuncTable[4627] := FuncEncoding; + FIdentFuncTable[3716] := FuncEnum; + FIdentFuncTable[1147] := FuncEscape; + FIdentFuncTable[1465] := FuncEval; + FIdentFuncTable[3807] := FuncEvent; + FIdentFuncTable[2060] := FuncExp; + FIdentFuncTable[1298] := FuncExport; + FIdentFuncTable[1114] := FuncExtends; + FIdentFuncTable[1069] := FuncFalse; + FIdentFuncTable[4097] := FuncFgcolor; + FIdentFuncTable[2508] := FuncFilename; + FIdentFuncTable[271] := FuncFileupload; + FIdentFuncTable[3365] := FuncFinal; + FIdentFuncTable[587] := FuncFinally; + FIdentFuncTable[2843] := FuncFind; + FIdentFuncTable[931] := FuncFixed; + FIdentFuncTable[1921] := FuncFloat; + FIdentFuncTable[730] := FuncFloat2; + FIdentFuncTable[1491] := FuncFloor; + FIdentFuncTable[4111] := FuncFocus; + FIdentFuncTable[4774] := FuncFontcolor; + FIdentFuncTable[4932] := FuncFontsize; + FIdentFuncTable[407] := FuncFor; + FIdentFuncTable[2968] := FuncForm; + FIdentFuncTable[4469] := FuncForm; + FIdentFuncTable[2370] := FuncForms; + FIdentFuncTable[1279] := FuncForward; + FIdentFuncTable[4402] := FuncFrame; + FIdentFuncTable[2522] := FuncFrames; + FIdentFuncTable[3737] := FuncFromcharcode; + FIdentFuncTable[2666] := FuncFunction; + FIdentFuncTable[1982] := FuncFunction2; + FIdentFuncTable[1111] := FuncGetdate; + FIdentFuncTable[1176] := FuncGetday; + FIdentFuncTable[553] := FuncGetelementbyid; + FIdentFuncTable[966] := FuncGetfullyear; + FIdentFuncTable[2918] := FuncGethours; + FIdentFuncTable[1735] := FuncGetmilliseconds; + FIdentFuncTable[3823] := FuncGetminutes; + FIdentFuncTable[4549] := FuncGetmonth; + FIdentFuncTable[978] := FuncGetseconds; + FIdentFuncTable[1102] := FuncGettime; + FIdentFuncTable[4707] := FuncGettimezoneoffset; + FIdentFuncTable[4493] := FuncGetutcdate; + FIdentFuncTable[3536] := FuncGetutcday; + FIdentFuncTable[5080] := FuncGetutcfullyear; + FIdentFuncTable[671] := FuncGetutchours; + FIdentFuncTable[1795] := FuncGetutcmilliseconds; + FIdentFuncTable[974] := FuncGetutcminutes; + FIdentFuncTable[2302] := FuncGetutcmonth; + FIdentFuncTable[3282] := FuncGetutcseconds; + FIdentFuncTable[2212] := FuncGetyear; + FIdentFuncTable[2940] := FuncGlobal; + FIdentFuncTable[4400] := FuncGo; + FIdentFuncTable[4552] := FuncGoto; + FIdentFuncTable[269] := FuncHandleevent; + FIdentFuncTable[2358] := FuncHash; + FIdentFuncTable[380] := FuncHeight; + FIdentFuncTable[911] := FuncHidden; + FIdentFuncTable[2645] := FuncHistory; + FIdentFuncTable[1710] := FuncHistory; + FIdentFuncTable[3710] := FuncHome; + FIdentFuncTable[2928] := FuncHost; + FIdentFuncTable[3996] := FuncHostname; + FIdentFuncTable[2246] := FuncHref; + FIdentFuncTable[991] := FuncHspace; + FIdentFuncTable[3785] := FuncIf; + FIdentFuncTable[1177] := FuncImage; + FIdentFuncTable[1997] := FuncImages; + FIdentFuncTable[706] := FuncImplements; + FIdentFuncTable[3582] := FuncImport; + FIdentFuncTable[4969] := FuncIn; + FIdentFuncTable[1137] := FuncIndex; + FIdentFuncTable[656] := FuncIndexof; + FIdentFuncTable[4918] := FuncInfinity; + FIdentFuncTable[5096] := FuncInnerheight; + FIdentFuncTable[5008] := FuncInnerwidth; + FIdentFuncTable[999] := FuncInput; + FIdentFuncTable[3585] := FuncInstanceof; + FIdentFuncTable[545] := FuncInt; + FIdentFuncTable[124] := FuncInterface; + FIdentFuncTable[2465] := FuncIsfinite; + FIdentFuncTable[1266] := FuncIsnan; + FIdentFuncTable[1711] := FuncItalics; + FIdentFuncTable[963] := FuncJava; + FIdentFuncTable[4225] := FuncJavaenabled; + FIdentFuncTable[3229] := FuncJoin; + FIdentFuncTable[2913] := FuncLastindexof; + FIdentFuncTable[2778] := FuncLastmodified; + FIdentFuncTable[3139] := FuncLayer; + FIdentFuncTable[2021] := FuncLayers; + FIdentFuncTable[2770] := FuncLeft; + FIdentFuncTable[1083] := FuncLength; + FIdentFuncTable[4263] := FuncLink; + FIdentFuncTable[611] := FuncLink; + FIdentFuncTable[2947] := FuncLinkcolor; + FIdentFuncTable[3943] := FuncLinks; + FIdentFuncTable[986] := FuncLn10; + FIdentFuncTable[5149] := FuncLn2; + FIdentFuncTable[4694] := FuncLocation; + FIdentFuncTable[2489] := FuncLocation; + FIdentFuncTable[3213] := FuncLocationbar; + FIdentFuncTable[2812] := FuncLog; + FIdentFuncTable[3420] := FuncLog10e; + FIdentFuncTable[3346] := FuncLog2e; + FIdentFuncTable[3808] := FuncLogon; + FIdentFuncTable[1030] := FuncLong; + FIdentFuncTable[2430] := FuncLowsrc; + FIdentFuncTable[830] := FuncMatch; + FIdentFuncTable[1454] := FuncMath; + FIdentFuncTable[4163] := FuncMax; + FIdentFuncTable[962] := FuncMax_value; + FIdentFuncTable[165] := FuncMenubar; + FIdentFuncTable[1767] := FuncMethod; + FIdentFuncTable[2068] := FuncMimetype; + FIdentFuncTable[568] := FuncMimetypes; + FIdentFuncTable[398] := FuncMin; + FIdentFuncTable[1580] := FuncMin_value; + FIdentFuncTable[3868] := FuncMoveby; + FIdentFuncTable[3688] := FuncMoveto; + FIdentFuncTable[147] := FuncName; + FIdentFuncTable[624] := FuncNan; + FIdentFuncTable[709] := FuncNative; + FIdentFuncTable[3619] := FuncNavigator; + FIdentFuncTable[1798] := FuncNavigator; + FIdentFuncTable[2749] := FuncNegative_infinity; + FIdentFuncTable[2232] := FuncNetscape; + FIdentFuncTable[4150] := FuncNew; + FIdentFuncTable[3691] := FuncNext; + FIdentFuncTable[3186] := FuncNull; + FIdentFuncTable[4687] := FuncNull2; + FIdentFuncTable[811] := FuncNumber; + FIdentFuncTable[655] := FuncObject; + FIdentFuncTable[4718] := FuncOnabort; + FIdentFuncTable[3216] := FuncOnblur; + FIdentFuncTable[4506] := FuncOnchange; + FIdentFuncTable[4236] := FuncOnclick; + FIdentFuncTable[1962] := FuncOndblclick; + FIdentFuncTable[3283] := FuncOnerror; + FIdentFuncTable[1618] := FuncOnfocus; + FIdentFuncTable[2711] := FuncOnkeydown; + FIdentFuncTable[698] := FuncOnkeypress; + FIdentFuncTable[2845] := FuncOnkeyup; + FIdentFuncTable[9] := FuncOnload; + FIdentFuncTable[1175] := FuncOnmousedown; + FIdentFuncTable[1116] := FuncOnmousemove; + FIdentFuncTable[720] := FuncOnmouseout; + FIdentFuncTable[356] := FuncOnmouseover; + FIdentFuncTable[2930] := FuncOnmouseup; + FIdentFuncTable[1494] := FuncOnreset; + FIdentFuncTable[1591] := FuncOnselect; + FIdentFuncTable[233] := FuncOnsubmit; + FIdentFuncTable[1527] := FuncOnunload; + FIdentFuncTable[309] := FuncOpen; + FIdentFuncTable[3742] := FuncOpener; + FIdentFuncTable[3624] := FuncOption; + FIdentFuncTable[3038] := FuncOptions; + FIdentFuncTable[3129] := FuncOuterheight; + FIdentFuncTable[617] := FuncOuterwidth; + FIdentFuncTable[1183] := FuncPackage; + FIdentFuncTable[4634] := FuncPackages; + FIdentFuncTable[4499] := FuncPagex; + FIdentFuncTable[1543] := FuncPagexoffset; + FIdentFuncTable[4647] := FuncPagey; + FIdentFuncTable[4043] := FuncPageyoffset; + FIdentFuncTable[4818] := FuncParent; + FIdentFuncTable[2306] := FuncParse; + FIdentFuncTable[2092] := FuncParsefloat; + FIdentFuncTable[2800] := FuncParseint; + FIdentFuncTable[756] := FuncPassword; + FIdentFuncTable[1065] := FuncPathname; + FIdentFuncTable[433] := FuncPersonalbar; + FIdentFuncTable[3413] := FuncPi; + FIdentFuncTable[4421] := FuncPlatform; + FIdentFuncTable[4802] := FuncPlugin; + FIdentFuncTable[3917] := FuncPlugins; + FIdentFuncTable[3630] := FuncPort; + FIdentFuncTable[4426] := FuncPositive_infinity; + FIdentFuncTable[5137] := FuncPow; + FIdentFuncTable[4810] := FuncPrevious; + FIdentFuncTable[602] := FuncPrint; + FIdentFuncTable[958] := FuncPrivate; + FIdentFuncTable[3968] := FuncPrompt; + FIdentFuncTable[1326] := FuncProtected; + FIdentFuncTable[1815] := FuncProtocol; + FIdentFuncTable[4437] := FuncPrototype; + FIdentFuncTable[3260] := FuncPublic; + FIdentFuncTable[1600] := FuncRadio; + FIdentFuncTable[2803] := FuncRandom; + FIdentFuncTable[2045] := FuncReferrer; + FIdentFuncTable[2270] := FuncRefresh; + FIdentFuncTable[4495] := FuncRegexp; + FIdentFuncTable[2008] := FuncReleaseevents; + FIdentFuncTable[4401] := FuncReload; + FIdentFuncTable[1148] := FuncReplace; + FIdentFuncTable[3987] := FuncReset; + FIdentFuncTable[2796] := FuncReset; + FIdentFuncTable[4116] := FuncResizeby; + FIdentFuncTable[3936] := FuncResizeto; + FIdentFuncTable[1610] := FuncReturn; + FIdentFuncTable[3457] := FuncReverse; + FIdentFuncTable[1857] := FuncRight; + FIdentFuncTable[4450] := FuncRound; + FIdentFuncTable[5041] := FuncRouteevent; + FIdentFuncTable[100] := FuncScreen; + FIdentFuncTable[3727] := FuncScroll; + FIdentFuncTable[3112] := FuncScrollbars; + FIdentFuncTable[195] := FuncScrollby; + FIdentFuncTable[15] := FuncScrollto; + FIdentFuncTable[4544] := FuncSearch; + FIdentFuncTable[1271] := FuncSelect; + FIdentFuncTable[2532] := FuncSelect; + FIdentFuncTable[2708] := FuncSelected; + FIdentFuncTable[5089] := FuncSelectedindex; + FIdentFuncTable[2283] := FuncSelf; + FIdentFuncTable[4756] := FuncSetdate; + FIdentFuncTable[517] := FuncSetfullyear; + FIdentFuncTable[4389] := FuncSethours; + FIdentFuncTable[2365] := FuncSetinterval; + FIdentFuncTable[1057] := FuncSetmilliseconds; + FIdentFuncTable[2377] := FuncSetminutes; + FIdentFuncTable[867] := FuncSetmonth; + FIdentFuncTable[4685] := FuncSetseconds; + FIdentFuncTable[4747] := FuncSettime; + FIdentFuncTable[1862] := FuncSettimeout; + FIdentFuncTable[3047] := FuncSetutcdate; + FIdentFuncTable[5010] := FuncSetutcfullyear; + FIdentFuncTable[222] := FuncSetutchours; + FIdentFuncTable[2284] := FuncSetutcmilliseconds; + FIdentFuncTable[5073] := FuncSetutcminutes; + FIdentFuncTable[3374] := FuncSetutcmonth; + FIdentFuncTable[707] := FuncSetutcseconds; + FIdentFuncTable[2225] := FuncSetyear; + FIdentFuncTable[3661] := FuncShort; + FIdentFuncTable[2910] := FuncSin; + FIdentFuncTable[523] := FuncSlice; + FIdentFuncTable[1345] := FuncSmall; + FIdentFuncTable[3822] := FuncSort; + FIdentFuncTable[239] := FuncSplit; + FIdentFuncTable[1224] := FuncSqrt; + FIdentFuncTable[4716] := FuncSqrt1_2; + FIdentFuncTable[3194] := FuncSqrt2; + FIdentFuncTable[1932] := FuncSrc; + FIdentFuncTable[482] := FuncStart; + FIdentFuncTable[684] := FuncStatic; + FIdentFuncTable[2201] := FuncStatus; + FIdentFuncTable[1836] := FuncStatusbar; + FIdentFuncTable[3389] := FuncStop; + FIdentFuncTable[4740] := FuncStrike; + FIdentFuncTable[4796] := FuncString; + FIdentFuncTable[1006] := FuncStyle; + FIdentFuncTable[283] := FuncSub; + FIdentFuncTable[5066] := FuncSubmit; + FIdentFuncTable[1174] := FuncSubmit; + FIdentFuncTable[3496] := FuncSubstr; + FIdentFuncTable[2071] := FuncSubstring; + FIdentFuncTable[4785] := FuncSuffixes; + FIdentFuncTable[2355] := FuncSup; + FIdentFuncTable[4953] := FuncSuper; + FIdentFuncTable[3170] := FuncSwitch; + FIdentFuncTable[4968] := FuncSynchronized; + FIdentFuncTable[4084] := FuncTags; + FIdentFuncTable[2789] := FuncTaint; + FIdentFuncTable[215] := FuncTaintenabled; + FIdentFuncTable[3896] := FuncTan; + FIdentFuncTable[5087] := FuncTarget; + FIdentFuncTable[4075] := FuncText; + FIdentFuncTable[4055] := FuncText; + FIdentFuncTable[2681] := FuncTextarea; + FIdentFuncTable[2382] := FuncThis; + FIdentFuncTable[4217] := FuncThrow; + FIdentFuncTable[2507] := FuncThrows; + FIdentFuncTable[1027] := FuncTitle; + FIdentFuncTable[2422] := FuncTogmtstring; + FIdentFuncTable[4448] := FuncTolocalestring; + FIdentFuncTable[857] := FuncTolowercase; + FIdentFuncTable[4611] := FuncToolbar; + FIdentFuncTable[4058] := FuncTop; + FIdentFuncTable[983] := FuncTosource; + FIdentFuncTable[3962] := FuncTostring; + FIdentFuncTable[4977] := FuncTouppercase; + FIdentFuncTable[2536] := FuncToutcstring; + FIdentFuncTable[4990] := FuncTransient; + FIdentFuncTable[1928] := FuncTrue; + FIdentFuncTable[3889] := FuncTry; + FIdentFuncTable[3925] := FuncType; + FIdentFuncTable[3121] := FuncTypeof; + FIdentFuncTable[4305] := FuncUndefined; + FIdentFuncTable[2484] := FuncUndefined; + FIdentFuncTable[3518] := FuncUnescape; + FIdentFuncTable[4070] := FuncUntaint; + FIdentFuncTable[836] := FuncUnwatch; + FIdentFuncTable[3893] := FuncUrl; + FIdentFuncTable[747] := FuncUseragent; + FIdentFuncTable[3278] := FuncUtc; + FIdentFuncTable[1621] := FuncValue; + FIdentFuncTable[5048] := FuncValueof; + FIdentFuncTable[1890] := FuncVar; + FIdentFuncTable[910] := FuncVisibility; + FIdentFuncTable[2454] := FuncVlinkcolor; + FIdentFuncTable[996] := FuncVoid; + FIdentFuncTable[418] := FuncVspace; + FIdentFuncTable[4708] := FuncWatch; + FIdentFuncTable[3178] := FuncWhile; + FIdentFuncTable[1729] := FuncWidth; + FIdentFuncTable[2916] := FuncWindow; + FIdentFuncTable[4177] := FuncWindow; + FIdentFuncTable[4646] := FuncWith; + FIdentFuncTable[519] := FuncWrite; + FIdentFuncTable[4841] := FuncWriteln; + FIdentFuncTable[4030] := FuncZindex; +end; + +function TSynJScriptSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAbs(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAbstract(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAcos(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAction(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAlert(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAlign(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAlinkcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAll(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAnchor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAnchors(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAppcodename(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncApplet(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncApplets(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAppname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAppversion(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncArea(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncArguments(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncArray(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAsin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAtan(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncAtan2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBack(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBackground(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBgcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBlink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBlur(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBody(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBold(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBoolean(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBoolean2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + + +function TSynJScriptSyn.FuncBorder(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBottom(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncBreak(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncButton(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncByte(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCall(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCallee(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCaller(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCaptureevents(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCeil(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncChar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCharat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCharcodeat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCheckbox(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncChecked(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClass(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClearinterval(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCleartimeout(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClick(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClose(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncClosed(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncColor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncComplete(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncConcat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncConfirm(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncConst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncConstructor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncContinue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCookie(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCos(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncCurrent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDebugger(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDefault(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDefaultchecked(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDefaultselected(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDefaultstatus(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDefaultvalue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDelete(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDescription(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDisplay(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDocument(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDomain(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncDouble(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncE(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncElements(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncElse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEmbed(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEmbeds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEnabledplugin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEncoding(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEnum(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEscape(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEval(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncEvent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncExp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncExport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncExtends(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFalse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFgcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFilename(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFileupload(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFinal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFinally(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFind(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFixed(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFloat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFloat2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFloor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFocus(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFontcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFontsize(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncForm(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncForms(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncForward(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFrame(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFrames(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFromcharcode(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFunction(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncFunction2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetdate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetday(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetelementbyid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetfullyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGethours(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetmilliseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetminutes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetmonth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGettime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGettimezoneoffset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcdate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcday(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcfullyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutchours(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcminutes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcmonth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetutcseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGetyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGlobal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncGoto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHandleevent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHash(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHeight(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHidden(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHistory(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHome(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHost(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHostname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHref(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncHspace(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncImage(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncImages(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncImplements(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncImport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIndex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIndexof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInfinity(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInnerheight(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInnerwidth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInput(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInstanceof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncInterface(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIsfinite(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncIsnan(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncItalics(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncJava(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncJavaenabled(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncJoin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLastindexof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLastmodified(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLayer(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLayers(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLeft(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLength(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLinkcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLinks(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLn10(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLn2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLocation(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLocationbar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLog(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLog10e(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLog2e(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLogon(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLong(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncLowsrc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMath(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMax(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMax_value(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMenubar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMethod(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMimetype(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMimetypes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMin_value(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMoveby(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncMoveto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncName(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNan(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNative(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNavigator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNegative_infinity(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNetscape(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNew(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNext(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNull(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNull2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncNumber(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncObject(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnabort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnblur(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnchange(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnclick(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOndblclick(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnerror(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnfocus(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnkeydown(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnkeypress(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnkeyup(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnload(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnmousedown(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnmousemove(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnmouseout(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnmouseover(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnmouseup(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnreset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnselect(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnsubmit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOnunload(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkEvent + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOpen(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOpener(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOption(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOptions(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOuterheight(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncOuterwidth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPackage(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPackages(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPagex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPagexoffset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPagey(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPageyoffset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncParent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncParse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncParsefloat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncParseint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPassword(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPathname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPersonalbar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPi(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPlatform(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPlugin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPlugins(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPositive_infinity(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPow(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPrevious(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPrint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPrivate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPrompt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncProtected(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncProtocol(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPrototype(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncPublic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRadio(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRandom(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReferrer(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRefresh(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRegexp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReleaseevents(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReload(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReplace(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncResizeby(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncResizeto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReturn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncReverse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRight(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRound(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncRouteevent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncScreen(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncScroll(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncScrollbars(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncScrollby(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncScrollto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSearch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSelect(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSelected(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSelectedindex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSelf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetdate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetfullyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSethours(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetinterval(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetmilliseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetminutes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetmonth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSettime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSettimeout(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcdate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcfullyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutchours(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcminutes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcmonth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetutcseconds(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSetyear(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncShort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSlice(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSmall(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSplit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSqrt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSqrt1_2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSqrt2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSrc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStart(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStatic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStatus(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStatusbar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStrike(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncString(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncStyle(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSub(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSubmit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSubstr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSubstring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSuffixes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSup(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSuper(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSwitch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncSynchronized(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTags(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTaint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTaintenabled(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTan(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTarget(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncText(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTextarea(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncThis(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncThrow(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncThrows(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTitle(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTogmtstring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTolocalestring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTolowercase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncToolbar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTosource(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTostring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTouppercase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncToutcstring(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTransient(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTrue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTry(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncType(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncTypeof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUndefined(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUnescape(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUntaint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUnwatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUrl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUseragent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncUtc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncValue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncValueof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncVar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncVisibility(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncVlinkcolor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncVoid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncVspace(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWhile(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWidth(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWindow(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWith(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWrite(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncWriteln(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +function TSynJScriptSyn.FuncZindex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkNonReservedKey + else + Result := tkIdentifier; +end; + +constructor TSynJScriptSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + AddAttribute(FNonReservedKeyAttri); + FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + AddAttribute(FEventAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterJScript; + FRange := rsUnknown; +end; + +procedure TSynJScriptSyn.AndSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); +end; + +procedure TSynJScriptSyn.CommentProc; +begin + if FLine[Run] = #0 then + NullProc + else + begin + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynJScriptSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynJScriptSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynJScriptSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynJScriptSyn.MinusProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run); +end; + +procedure TSynJScriptSyn.ModSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynJScriptSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynJScriptSyn.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 TSynJScriptSyn.OrSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); +end; + +procedure TSynJScriptSyn.PlusProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); +end; + +procedure TSynJScriptSyn.PointProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2); +end; + +procedure TSynJScriptSyn.SlashProc; +begin + Inc(Run); + case FLine[Run] of + '/': begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; + '*': begin + FTokenID := tkComment; + FRange := rsAnsi; + repeat + Inc(Run); + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end; + until IsLineEnd(Run); + end; + '=': begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + FTokenID := tkSymbol; + end; +end; + +procedure TSynJScriptSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynJScriptSyn.StarProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynJScriptSyn.StringProc; +var + l_strChar: UnicodeString; +begin + FTokenID := tkString; + l_strChar := FLine[Run]; // We could have '"' or #39 + if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); + if not IsLineEnd(Run) then + Inc(Run); +end; + +procedure TSynJScriptSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynJScriptSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynJScriptSyn.Next; +begin + FTokenPos := Run; + if FRange = rsANSI then + CommentProc + else + case FLine[Run] of + '&': AndSymbolProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '-': MinusProc; + '%': ModSymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '*': StarProc; + '"', #39: StringProc; + '~', '{', '}', ',', '(', ')', '[', ']', '<', '>', ':', '?', ';', '!', '=': + SymbolProc; + else UnknownProc; + end; + inherited; +end; + +function TSynJScriptSyn.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 TSynJScriptSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynJScriptSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynJScriptSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynJScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNonReservedKey: Result := FNonReservedKeyAttri; + tkEvent: Result := FEventAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynJScriptSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynJScriptSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +{$IFDEF SYN_CodeFolding} +procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: String; + Line: Integer; + + function LineHasChar(Line: Integer; character: char; + StartCol : Integer): boolean; // faster than Pos! + var + i: Integer; + begin + result := false; + for I := StartCol to Length(CurLine) do begin + if CurLine[i] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin + result := true; + break; + end; + end; + end; + end; + + function FindBraces(Line: Integer) : Boolean; + Var + Col : Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + break; + end; + end else if CurLine[col] = '}' then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + break; + end; + end; + end; // for Col + end; + + function FoldRegion(Line: Integer): Boolean; + Var + S : string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 9)) = '//#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 12)) = '//#ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline comments (Fold Type 2) + if TRangeState(GetLineRange(LinesToScan, Line)) = rsANSI then + begin + if TRangeState(GetLineRange(LinesToScan, Line - 1)) <> rsANSI then + FoldRanges.StartFoldRange(Line + 1, 2) + else + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end + else if TRangeState(GetLineRange(LinesToScan, Line - 1)) = rsANSI then + begin + FoldRanges.StopFoldRange(Line + 1, 2); + Continue; + end; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; +{$ENDIF} + +procedure TSynJScriptSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynJScriptSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterJScript; +end; + +class function TSynJScriptSyn.GetLanguageName: string; +begin + Result := SYNS_LangJScript; +end; + +function TSynJScriptSyn.GetSampleSource: UnicodeString; +begin + Result := '// Syntax highlighting'#13#10+ + 'function printNumber()'#13#10+ + '{'#13#10+ + ' var number = 1234;'#13#10+ + ' var x;'#13#10+ + ' document.write("The number is " + number);'#13#10+ + ' for (var i = 0; i <= number; i++)'#13#10+ + ' {'#13#10+ + ' x++;'#13#10+ + ' x--;'#13#10+ + ' x += 1.0;'#13#10+ + ' }'#13#10+ + ' i += @; // illegal character'#13#10+ + '}'#13#10+ + 'body.onLoad = printNumber;'; +end; + +class function TSynJScriptSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangJScript; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynJScriptSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterJava.pas b/Source/VCL/SynEdit/Source/SynHighlighterJava.pas index 4492b312..98a6e357 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterJava.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterJava.pas @@ -1,1002 +1,1010 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterJava.pas, released 2000-04-10. -The Original Code is based on the DcjSynJava.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Trier. -Unicode translation by Maël Hörz. -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: SynHighlighterJava.pas,v 1.18.2.10 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Java highlighter for SynEdit) -@author(Michael Trier) -@created(December 1998, converted to SynEdit 2000-04-10 by Michael Hieke) -@lastmod(2000-06-23) -The SynHighlighterJava unit provides SynEdit with a Java source (.java) highlighter. -} - -unit SynHighlighterJava; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, Classes; - -type - TtkTokenKind = (tkComment, tkDocument, tkIdentifier, tkInvalid, tkKey, - tkNull, tkNumber, tkSpace, tkString, tkSymbol, tkUnknown); - - TxtkTokenKind = ( - xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkAssign, xtkBitComplement, - xtkBraceClose, xtkBraceOpen, xtkColon, xtkCondAnd, xtkCondOr, xtkDecrement, - xtkDivide, xtkDivideAssign, xtkGreaterThan, xtkGreaterThanEqual, xtkIncOr, - xtkIncOrAssign, xtkIncrement, xtkLessThan, xtkLessThanEqual, - xtkLogComplement, xtkLogEqual, xtkMultiply, xtkMultiplyAssign, xtkNotEqual, - xtkPoint, xtkQuestion, xtkRemainder, xtkRemainderAssign, xtkRoundClose, - xtkRoundOpen, xtkSemiColon, xtkShiftLeft, xtkShiftLeftAssign, xtkShiftRight, - xtkShiftRightAssign, xtkSquareClose, xtkSquareOpen, xtkSubtract, - xtkSubtractAssign, xtkUnsignShiftRight, xtkUnsignShiftRightAssign, xtkXor, - xtkXorAssign, xtkComma); - - TRangeState = (rsANil, rsComment, rsDocument, rsUnknown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynJavaSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - FRoundCount: Integer; - FSquareCount: Integer; - FTokenID: TtkTokenKind; - FExtTokenID: TxtkTokenKind; - fIdentFuncTable: array[0..112] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fDocumentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fInvalidAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure CommentProc; - procedure AndSymbolProc; - procedure AsciiCharProc; - procedure AtSymbolProc; - procedure BraceCloseProc; - procedure BraceOpenProc; - procedure CRProc; - procedure ColonProc; - procedure CommaProc; - procedure EqualProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure MultiplyProc; - procedure NotSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure PoundProc; - procedure QuestionProc; - procedure RemainderSymbolProc; - procedure RoundCloseProc; - procedure RoundOpenProc; - procedure SemiColonProc; - procedure SlashProc; - procedure SpaceProc; - procedure SquareCloseProc; - procedure SquareOpenProc; - procedure StringProc; - procedure TildeProc; - procedure XOrSymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function GetExtTokenID: TxtkTokenKind; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - property ExtTokenID: TxtkTokenKind read GetExtTokenID; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property DocumentAttri: TSynHighlighterAttributes read fDocumentAttri - write fDocumentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri - write fInvalidAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..51] of string = ( - 'abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', - 'class', 'const', 'continue', 'default', 'do', 'double', 'else', 'extends', - 'false', 'final', 'finally', 'float', 'for', 'goto', 'if', 'implements', - 'import', 'instanceof', 'int', 'interface', 'long', 'native', 'new', 'null', - 'package', 'private', 'protected', 'public', 'return', 'short', 'static', - 'strictfp', 'super', 'switch', 'synchronized', 'this', 'throw', 'throws', - 'transient', 'true', 'try', 'void', 'volatile', 'while' - ); - - KeyIndices: array[0..112] of Integer = ( - 1, -1, -1, 45, -1, -1, 39, -1, -1, -1, 9, 36, 26, -1, -1, 4, 27, 5, 50, 25, - 33, -1, 18, -1, 17, 6, 28, -1, -1, -1, 51, -1, -1, -1, -1, 21, 48, -1, 7, 3, - -1, -1, -1, 49, 41, -1, 35, -1, 46, 40, -1, -1, -1, 42, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, -1, -1, 13, 24, -1, 37, -1, -1, 31, 11, -1, 22, -1, -1, - -1, 44, -1, 10, 19, 8, -1, -1, 38, 15, -1, -1, 34, -1, 14, -1, -1, -1, 0, - 12, -1, 20, -1, 23, -1, 47, -1, -1, 29, 30, -1, -1, 16, 32, 2 - ); - -{$Q-} -function TSynJavaSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 598 + Ord(Str^) * 349; - inc(Str); - end; - Result := Result mod 113; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynJavaSyn.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 TSynJavaSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynJavaSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynJavaSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -constructor TSynJavaSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fDocumentAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); - fDocumentAttri.Style := [fsItalic]; - AddAttribute(fDocumentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrInvalidSymbol, SYNS_FriendlyAttrInvalidSymbol); - AddAttribute(fInvalidAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fRange := rsUnknown; - SetAttributesOnChange(DefHighlightChange); - - InitIdent; - fDefaultFilter := SYNS_FilterJava; -end; { Create } - -procedure TSynJavaSyn.CommentProc; -begin - if fRange = rsComment then - fTokenID := tkComment - else - fTokenID := tkDocument; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - case FLine[Run] of - '*': - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - fRange := rsUnknown; - break; - end - else inc(Run); - else inc(Run); - end; -end; - -procedure TSynJavaSyn.AndSymbolProc; -begin - case FLine[Run + 1] of - '=': {and assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkAndAssign; - end; - '&': {conditional and} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkCondAnd; - end; - else {and} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkAnd; - end; - end; -end; - -procedure TSynJavaSyn.AsciiCharProc; -begin - fTokenID := tkString; - repeat - if IsLineEnd(Run) then break; - if fLine[Run] = #92 then - Inc(Run); // backslash, if we have an escaped single character, skip to the next - if not IsLineEnd(Run) then inc(Run); //Add check here to prevent overrun from backslash being last char - until FLine[Run] = #39; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynJavaSyn.AtSymbolProc; -begin - fTokenID := tkInvalid; - inc(Run); -end; - -procedure TSynJavaSyn.BraceCloseProc; -begin - inc(Run); - fTokenId := tkSymbol; - FExtTokenID := xtkBraceClose; -end; - -procedure TSynJavaSyn.BraceOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; - FExtTokenID := xtkBraceOpen; -end; - -procedure TSynJavaSyn.CRProc; -begin - fTokenID := tkSpace; - Case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynJavaSyn.ColonProc; -begin - inc(Run); {colon - conditional} - fTokenID := tkSymbol; - FExtTokenID := xtkColon; -end; - -procedure TSynJavaSyn.CommaProc; -begin - inc(Run); - fTokenID := tkSymbol; - fExtTokenID := xtkComma; -end; - -procedure TSynJavaSyn.EqualProc; -begin - case FLine[Run + 1] of - '=': {logical equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkLogEqual; - end; - else {assign} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkAssign; - end; - end; -end; - -procedure TSynJavaSyn.GreaterProc; -begin - Case FLine[Run + 1] of - '=': {greater than or equal to} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkGreaterThanEqual; - end; - '>': - begin - Case FLine[Run + 2] of - '=': {shift right assign} - begin - inc(Run, 3); - FExtTokenID := xtkShiftRightAssign; - end; - '>': - if FLine[Run + 3] = '=' then - begin - inc(Run, 4); {unsigned shift right assign} - FExtTokenID := xtkUnsignShiftRightAssign; - end - else - begin - inc(Run, 3); {unsigned shift right} - FExtTokenID := xtkUnsignShiftRight; - end; - else {shift right} - begin - inc(Run, 2); - FExtTokenID := xtkShiftRight; - end; - end; - fTokenID := tkSymbol; - end; - else {greater than} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkGreaterThan; - end; - end; -end; - -procedure TSynJavaSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynJavaSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynJavaSyn.LowerProc; -begin - case FLine[Run + 1] of - '=': {less than or equal to} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkLessThanEqual; - end; - '<': - begin - if FLine[Run + 2] = '=' then {shift left assign} - begin - inc(Run, 3); - FExtTokenID := xtkShiftLeftAssign; - end - else {shift left} - begin - inc(Run, 2); - FExtTokenID := xtkShiftLeft; - end; - fTokenID := tkSymbol; - end; - else {less than} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkLessThan; - end; - end; -end; - -procedure TSynJavaSyn.MinusProc; -begin - case FLine[Run + 1] of - '=': {subtract assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkSubtractAssign; - end; - '-': {decrement} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkDecrement; - end; - else {subtract} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSubtract; - end; - end; -end; - -procedure TSynJavaSyn.MultiplyProc; -begin - case FLine[Run + 1] of - '=': {multiply assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkMultiplyAssign; - end; - else {multiply} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkMultiply; - end; - end; -end; - -procedure TSynJavaSyn.NotSymbolProc; -begin - case FLine[Run + 1] of - '=': {not equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkNotEqual; - end; - else {logical complement} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkLogComplement; - end; - end; -end; - -procedure TSynJavaSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynJavaSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynJavaSyn.OrSymbolProc; -begin - case FLine[Run + 1] of - '=': {inclusive or assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkIncOrAssign; - end; - '|': {conditional or} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkCondOr; - end; - else {inclusive or} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkIncOr; - end; - end; -end; - -procedure TSynJavaSyn.PlusProc; -begin - case FLine[Run + 1] of - '=': {add assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkAddAssign; - end; - '+': {increment} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkIncrement; - end; - else {add} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkAdd; - end; - end; -end; - -procedure TSynJavaSyn.PointProc; -begin - inc(Run); {point} - if CharInSet(FLine[Run], ['0'..'9']) then - begin - NumberProc; - Exit; - end; - fTokenID := tkSymbol; - FExtTokenID := xtkPoint; -end; - -procedure TSynJavaSyn.PoundProc; -begin - inc(Run); - fTokenID := tkInvalid; -end; - -procedure TSynJavaSyn.QuestionProc; -begin - fTokenID := tkSymbol; {question mark - conditional} - FExtTokenID := xtkQuestion; - inc(Run); -end; - -procedure TSynJavaSyn.RemainderSymbolProc; -begin - case FLine[Run + 1] of - '=': {remainder assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkRemainderAssign; - end; - else {remainder} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkRemainder; - end; - end; -end; - -procedure TSynJavaSyn.RoundCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkRoundClose; - dec(FRoundCount); -end; - -procedure TSynJavaSyn.RoundOpenProc; -begin - inc(Run); - FTokenID := tkSymbol; - FExtTokenID := xtkRoundOpen; - inc(FRoundCount); -end; - -procedure TSynJavaSyn.SemiColonProc; -begin - inc(Run); {semicolon} - fTokenID := tkSymbol; - FExtTokenID := xtkSemiColon; -end; - -procedure TSynJavaSyn.SlashProc; -begin - case FLine[Run + 1] of - '/': {c++ style comments} - begin - inc(Run, 2); - fTokenID := tkComment; - while not IsLineEnd(Run) do - begin - inc(Run); - end; - end; - '*': - begin - if (fLine[Run+2] = '*') and (fLine[Run+3] <> '/')then {documentation comment} - begin - fRange := rsDocument; - fTokenID := tkDocument; - inc(Run); - end - else {c style comment} - begin - fRange := rsComment; - fTokenID := tkComment; - end; - - inc(Run, 2); - while not IsLineEnd(Run) do - case fLine[Run] of - '*': - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - fRange := rsUnknown; - break; - end else inc(Run); - else - inc(Run); - end; - end; - '=': {division assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkDivideAssign; - end; - else {division} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkDivide; - end; - end; -end; - -procedure TSynJavaSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynJavaSyn.SquareCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSquareClose; - dec(FSquareCount); -end; - -procedure TSynJavaSyn.SquareOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSquareOpen; - inc(FSquareCount); -end; - -procedure TSynJavaSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - case FLine[Run] of - #92: Inc(Run); // Backslash, if we have an escaped charcter it can be skipped - end; - if not IsLineEnd(Run) then inc(Run); //Add check here to prevent overrun from backslash being last char - until FLine[Run] = #34; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynJavaSyn.TildeProc; -begin - inc(Run); {bitwise complement} - fTokenId := tkSymbol; - FExtTokenID := xtkBitComplement; -end; - -procedure TSynJavaSyn.XOrSymbolProc; -begin - Case FLine[Run + 1] of - '=': {xor assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkXorAssign; - end; - else {xor} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkXor; - end; - end; -end; - -procedure TSynJavaSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynJavaSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: CommentProc; - rsDocument: CommentProc; - else - begin - fRange := rsUnknown; - case fLine[Run] of - '&': AndSymbolProc; - #39: AsciiCharProc; - '@': AtSymbolProc; - '}': BraceCloseProc; - '{': BraceOpenProc; - #13: CRProc; - ':': ColonProc; - ',': CommaProc; - '=': EqualProc; - '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_', '$', 'À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': MinusProc; - '*': MultiplyProc; - '!': NotSymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - '#': PoundProc; - '?': QuestionProc; - '%': RemainderSymbolProc; - ')': RoundCloseProc; - '(': RoundOpenProc; - ';': SemiColonProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - ']': SquareCloseProc; - '[': SquareOpenProc; - #34: StringProc; - '~': TildeProc; - '^': XOrSymbolProc; - else UnknownProc; - end; - end; - end; - - inherited; -end; - -function TSynJavaSyn.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 TSynJavaSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynJavaSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -procedure TSynJavaSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynJavaSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynJavaSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynJavaSyn.GetExtTokenID: TxtkTokenKind; -begin - Result := FExtTokenID; -end; - -function TSynJavaSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkDocument: Result := fDocumentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkInvalid: Result := fInvalidAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fInvalidAttri; - else Result := nil; - end; -end; - -function TSynJavaSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynJavaSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterJava; -end; - -function TSynJavaSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '_', '$', '0'..'9', 'a'..'z', 'A'..'Z', 'À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': - Result := True; - else - Result := False; - end; -end; - -class function TSynJavaSyn.GetLanguageName: string; -begin - Result := SYNS_LangJava; -end; - -function TSynJavaSyn.GetSampleSource: string; -begin - Result := '/* Java syntax highlighting */'#13#10 + - 'import java.util.*;'#13#10 + - #13#10 + - '/** Example class */'#13#10 + - 'public class Sample {'#13#10 + - ' public static void main(String[] args) {'#13#10 + - ' int i = 0;'#13#10 + - ' for(i = 0; i < 10; i++)'#13#10 + - ' System.out.println("Hello world");'#13#10 + - ' }'#13#10 + - '}'; -end; - -class function TSynJavaSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangJava; -end; - -initialization - RegisterPlaceableHighlighter(TSynJavaSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterJava.pas, released 2000-04-10. +The Original Code is based on the DcjSynJava.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Michael Trier. +Unicode translation by Maël Hörz. +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: SynHighlighterJava.pas,v 1.18.2.10 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Java highlighter for SynEdit) +@author(Michael Trier) +@created(December 1998, converted to SynEdit 2000-04-10 by Michael Hieke) +@lastmod(2000-06-23) +The SynHighlighterJava unit provides SynEdit with a Java source (.java) highlighter. +} + +unit SynHighlighterJava; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, Classes; + +type + TtkTokenKind = (tkComment, tkDocument, tkIdentifier, tkInvalid, tkKey, + tkNull, tkNumber, tkSpace, tkString, tkSymbol, tkUnknown); + + TxtkTokenKind = ( + xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkAssign, xtkBitComplement, + xtkBraceClose, xtkBraceOpen, xtkColon, xtkCondAnd, xtkCondOr, xtkDecrement, + xtkDivide, xtkDivideAssign, xtkGreaterThan, xtkGreaterThanEqual, xtkIncOr, + xtkIncOrAssign, xtkIncrement, xtkLessThan, xtkLessThanEqual, + xtkLogComplement, xtkLogEqual, xtkMultiply, xtkMultiplyAssign, xtkNotEqual, + xtkPoint, xtkQuestion, xtkRemainder, xtkRemainderAssign, xtkRoundClose, + xtkRoundOpen, xtkSemiColon, xtkShiftLeft, xtkShiftLeftAssign, xtkShiftRight, + xtkShiftRightAssign, xtkSquareClose, xtkSquareOpen, xtkSubtract, + xtkSubtractAssign, xtkUnsignShiftRight, xtkUnsignShiftRightAssign, xtkXor, + xtkXorAssign, xtkComma); + + TRangeState = (rsANil, rsComment, rsDocument, rsUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynJavaSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FRoundCount: Integer; + FSquareCount: Integer; + FTokenID: TtkTokenKind; + FExtTokenID: TxtkTokenKind; + FIdentFuncTable: array[0..112] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FDocumentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FInvalidAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure CommentProc; + procedure AndSymbolProc; + procedure AsciiCharProc; + procedure AtSymbolProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure ColonProc; + procedure CommaProc; + procedure EqualProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure MultiplyProc; + procedure NotSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure PoundProc; + procedure QuestionProc; + procedure RemainderSymbolProc; + procedure RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StringProc; + procedure TildeProc; + procedure XOrSymbolProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function GetExtTokenID: TxtkTokenKind; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + property ExtTokenID: TxtkTokenKind read GetExtTokenID; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property DocumentAttri: TSynHighlighterAttributes read FDocumentAttri + write FDocumentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri + write FInvalidAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..51] of UnicodeString = ( + 'abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', + 'class', 'const', 'continue', 'default', 'do', 'double', 'else', 'extends', + 'false', 'final', 'finally', 'float', 'for', 'goto', 'if', 'implements', + 'import', 'instanceof', 'int', 'interface', 'long', 'native', 'new', 'null', + 'package', 'private', 'protected', 'public', 'return', 'short', 'static', + 'strictfp', 'super', 'switch', 'synchronized', 'this', 'throw', 'throws', + 'transient', 'true', 'try', 'void', 'volatile', 'while' + ); + + KeyIndices: array[0..112] of Integer = ( + 1, -1, -1, 45, -1, -1, 39, -1, -1, -1, 9, 36, 26, -1, -1, 4, 27, 5, 50, 25, + 33, -1, 18, -1, 17, 6, 28, -1, -1, -1, 51, -1, -1, -1, -1, 21, 48, -1, 7, 3, + -1, -1, -1, 49, 41, -1, 35, -1, 46, 40, -1, -1, -1, 42, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, -1, -1, 13, 24, -1, 37, -1, -1, 31, 11, -1, 22, -1, -1, + -1, 44, -1, 10, 19, 8, -1, -1, 38, 15, -1, -1, 34, -1, 14, -1, -1, -1, 0, + 12, -1, 20, -1, 23, -1, 47, -1, -1, 29, 30, -1, -1, 16, 32, 2 + ); + +{$Q-} +function TSynJavaSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 598 + Ord(Str^) * 349; + Inc(Str); + end; + Result := Result mod 113; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynJavaSyn.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 TSynJavaSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynJavaSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynJavaSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +constructor TSynJavaSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FDocumentAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); + FDocumentAttri.Style := [fsItalic]; + AddAttribute(FDocumentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrInvalidSymbol, SYNS_FriendlyAttrInvalidSymbol); + AddAttribute(FInvalidAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FRange := rsUnknown; + SetAttributesOnChange(DefHighlightChange); + + InitIdent; + FDefaultFilter := SYNS_FilterJava; +end; { Create } + +procedure TSynJavaSyn.CommentProc; +begin + if FRange = rsComment then + FTokenID := tkComment + else + FTokenID := tkDocument; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end + else Inc(Run); + else Inc(Run); + end; +end; + +procedure TSynJavaSyn.AndSymbolProc; +begin + case FLine[Run + 1] of + '=': {and assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkAndAssign; + end; + '&': {conditional and} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkCondAnd; + end; + else {and} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkAnd; + end; + end; +end; + +procedure TSynJavaSyn.AsciiCharProc; +begin + FTokenID := tkString; + repeat + if IsLineEnd(Run) then Break; + if FLine[Run] = #92 then + Inc(Run); // backslash, if we have an escaped single character, skip to the next + if not IsLineEnd(Run) then Inc(Run); //Add check here to prevent overrun from backslash being last char + until FLine[Run] = #39; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynJavaSyn.AtSymbolProc; +begin + FTokenID := tkInvalid; + Inc(Run); +end; + +procedure TSynJavaSyn.BraceCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkBraceClose; +end; + +procedure TSynJavaSyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkBraceOpen; +end; + +procedure TSynJavaSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else + Inc(Run); + end; +end; + +procedure TSynJavaSyn.ColonProc; +begin + Inc(Run); {colon - conditional} + FTokenID := tkSymbol; + FExtTokenID := xtkColon; +end; + +procedure TSynJavaSyn.CommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkComma; +end; + +procedure TSynJavaSyn.EqualProc; +begin + case FLine[Run + 1] of + '=': {logical equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkLogEqual; + end; + else {assign} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkAssign; + end; + end; +end; + +procedure TSynJavaSyn.GreaterProc; +begin + case FLine[Run + 1] of + '=': {greater than or equal to} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkGreaterThanEqual; + end; + '>': + begin + case FLine[Run + 2] of + '=': {shift right assign} + begin + Inc(Run, 3); + FExtTokenID := xtkShiftRightAssign; + end; + '>': + if FLine[Run + 3] = '=' then + begin + Inc(Run, 4); {unsigned shift right assign} + FExtTokenID := xtkUnsignShiftRightAssign; + end + else + begin + Inc(Run, 3); {unsigned shift right} + FExtTokenID := xtkUnsignShiftRight; + end; + else {shift right} + begin + Inc(Run, 2); + FExtTokenID := xtkShiftRight; + end; + end; + FTokenID := tkSymbol; + end; + else {greater than} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkGreaterThan; + end; + end; +end; + +procedure TSynJavaSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynJavaSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynJavaSyn.LowerProc; +begin + case FLine[Run + 1] of + '=': {less than or equal to} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkLessThanEqual; + end; + '<': + begin + if FLine[Run + 2] = '=' then {shift left assign} + begin + Inc(Run, 3); + FExtTokenID := xtkShiftLeftAssign; + end + else {shift left} + begin + Inc(Run, 2); + FExtTokenID := xtkShiftLeft; + end; + FTokenID := tkSymbol; + end; + else {less than} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkLessThan; + end; + end; +end; + +procedure TSynJavaSyn.MinusProc; +begin + case FLine[Run + 1] of + '=': {subtract assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkSubtractAssign; + end; + '-': {decrement} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkDecrement; + end; + else {subtract} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSubtract; + end; + end; +end; + +procedure TSynJavaSyn.MultiplyProc; +begin + case FLine[Run + 1] of + '=': {multiply assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkMultiplyAssign; + end; + else {multiply} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkMultiply; + end; + end; +end; + +procedure TSynJavaSyn.NotSymbolProc; +begin + case FLine[Run + 1] of + '=': {not equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkNotEqual; + end; + else {logical complement} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkLogComplement; + end; + end; +end; + +procedure TSynJavaSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynJavaSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynJavaSyn.OrSymbolProc; +begin + case FLine[Run + 1] of + '=': {inclusive or assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkIncOrAssign; + end; + '|': {conditional or} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkCondOr; + end; + else {inclusive or} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkIncOr; + end; + end; +end; + +procedure TSynJavaSyn.PlusProc; +begin + case FLine[Run + 1] of + '=': {add assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkAddAssign; + end; + '+': {increment} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkIncrement; + end; + else {add} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkAdd; + end; + end; +end; + +procedure TSynJavaSyn.PointProc; +begin + Inc(Run); {point} + if CharInSet(FLine[Run], ['0'..'9']) then + begin + NumberProc; + Exit; + end; + FTokenID := tkSymbol; + FExtTokenID := xtkPoint; +end; + +procedure TSynJavaSyn.PoundProc; +begin + Inc(Run); + FTokenID := tkInvalid; +end; + +procedure TSynJavaSyn.QuestionProc; +begin + FTokenID := tkSymbol; {question mark - conditional} + FExtTokenID := xtkQuestion; + Inc(Run); +end; + +procedure TSynJavaSyn.RemainderSymbolProc; +begin + case FLine[Run + 1] of + '=': {remainder assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkRemainderAssign; + end; + else {remainder} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkRemainder; + end; + end; +end; + +procedure TSynJavaSyn.RoundCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkRoundClose; + Dec(FRoundCount); +end; + +procedure TSynJavaSyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkRoundOpen; + Inc(FRoundCount); +end; + +procedure TSynJavaSyn.SemiColonProc; +begin + Inc(Run); {semicolon} + FTokenID := tkSymbol; + FExtTokenID := xtkSemiColon; +end; + +procedure TSynJavaSyn.SlashProc; +begin + case FLine[Run + 1] of + '/': {c++ style comments} + begin + Inc(Run, 2); + FTokenID := tkComment; + while not IsLineEnd(Run) do + begin + Inc(Run); + end; + end; + '*': + begin + if (FLine[Run+2] = '*') and (FLine[Run+3] <> '/')then {documentation comment} + begin + FRange := rsDocument; + FTokenID := tkDocument; + Inc(Run); + end + else {c style comment} + begin + FRange := rsComment; + FTokenID := tkComment; + end; + + Inc(Run, 2); + while not IsLineEnd(Run) do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end else Inc(Run); + else + Inc(Run); + end; + end; + '=': {division assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkDivideAssign; + end; + else {division} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkDivide; + end; + end; +end; + +procedure TSynJavaSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynJavaSyn.SquareCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSquareClose; + Dec(FSquareCount); +end; + +procedure TSynJavaSyn.SquareOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSquareOpen; + Inc(FSquareCount); +end; + +procedure TSynJavaSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then Break; + case FLine[Run] of + #92: Inc(Run); // Backslash, if we have an escaped charcter it can be skipped + end; + if not IsLineEnd(Run) then Inc(Run); //Add check here to prevent overrun from backslash being last char + until FLine[Run] = #34; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynJavaSyn.TildeProc; +begin + Inc(Run); {bitwise complement} + FTokenID := tkSymbol; + FExtTokenID := xtkBitComplement; +end; + +procedure TSynJavaSyn.XOrSymbolProc; +begin + case FLine[Run + 1] of + '=': {xor assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkXorAssign; + end; + else {xor} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkXor; + end; + end; +end; + +procedure TSynJavaSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynJavaSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: CommentProc; + rsDocument: CommentProc; + else + begin + FRange := rsUnknown; + case FLine[Run] of + '&': AndSymbolProc; + #39: AsciiCharProc; + '@': AtSymbolProc; + '}': BraceCloseProc; + '{': BraceOpenProc; + #13: CRProc; + ':': ColonProc; + ',': CommaProc; + '=': EqualProc; + '>': GreaterProc; + 'A'..'Z', 'a'..'z', '_', '$', + WideChar(#$00C0)..WideChar(#$00D6), + WideChar(#$00D8)..WideChar(#$00F6), + WideChar(#$00F8)..WideChar(#$00FF): IdentProc; + #10: LFProc; + '<': LowerProc; + '-': MinusProc; + '*': MultiplyProc; + '!': NotSymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + '#': PoundProc; + '?': QuestionProc; + '%': RemainderSymbolProc; + ')': RoundCloseProc; + '(': RoundOpenProc; + ';': SemiColonProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + ']': SquareCloseProc; + '[': SquareOpenProc; + #34: StringProc; + '~': TildeProc; + '^': XOrSymbolProc; + else UnknownProc; + end; + end; + end; + + inherited; +end; + +function TSynJavaSyn.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 TSynJavaSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynJavaSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +procedure TSynJavaSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynJavaSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynJavaSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynJavaSyn.GetExtTokenID: TxtkTokenKind; +begin + Result := FExtTokenID; +end; + +function TSynJavaSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkDocument: Result := FDocumentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkInvalid: Result := FInvalidAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FInvalidAttri; + else Result := nil; + end; +end; + +function TSynJavaSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynJavaSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterJava; +end; + +function TSynJavaSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', '$', '0'..'9', 'a'..'z', 'A'..'Z', WideChar(#$00C0)..WideChar(#$00D6), + WideChar(#$00D8)..WideChar(#$00F6), WideChar(#$00F8)..WideChar(#$00FF): + Result := True; + else + Result := False; + end; +end; + +class function TSynJavaSyn.GetLanguageName: string; +begin + Result := SYNS_LangJava; +end; + +function TSynJavaSyn.GetSampleSource: UnicodeString; +begin + Result := + '/* Java syntax highlighting */'#13#10 + + 'import java.util.*;'#13#10 + + #13#10 + + '/** Example class */'#13#10 + + 'public class Sample {'#13#10 + + ' public static void main(String[] args) {'#13#10 + + ' int i = 0;'#13#10 + + ' for(i = 0; i < 10; i++)'#13#10 + + ' System.out.println("Hello world");'#13#10 + + ' }'#13#10 + + '}'; +end; + +class function TSynJavaSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangJava; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynJavaSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterKix.pas b/Source/VCL/SynEdit/Source/SynHighlighterKix.pas index f4863c50..941e7e6e 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterKix.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterKix.pas @@ -1,529 +1,534 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterKix.pas, released 2000-05-05. -The Original Code is based on the jsKixSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Jeff D. Smith. -Unicode translation by Maël Hörz. -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: SynHighlighterKix.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Kix syntax highlighter for SynEdit) -@author(Jeff D. Smith) -@created(1999, converted to SynEdit 2000-05-05) -@lastmod(2000-06-23) -The SynHighlighterKix unit provides SynEdit with a Kix script file syntax highlighter. -} - -unit SynHighlighterKix; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkMiscellaneous, tkNull, - tkNumber, tkSpace, tkString, tkSymbol, tkVariable, tkUnknown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynKixSyn = class(TSynCustomHighlighter) - private - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..970] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fMiscellaneousAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fVariableAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AsciiCharProc; - procedure VariableProc; - procedure CRProc; - procedure IdentProc; - procedure MacroProc; - procedure PrintProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure CommentProc; - procedure SpaceProc; - procedure StringProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property MiscellaneousAttri: TSynHighlighterAttributes - read fMiscellaneousAttri write fMiscellaneousAttri; - 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 VariableAttri: TSynHighlighterAttributes read fVariableAttri - write fVariableAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..168] of string = ( - 'addkey', 'addprinterconnection', 'addprogramgroup', 'addprogramitem', - 'address', 'asc', 'at', 'backupeventlog', 'beep', 'big', 'box', 'break', - 'call', 'case', 'cd', 'chr', 'cleareventlog', 'close', 'cls', 'color', - 'comment', 'comparefiletimes', 'cookie1', 'copy', 'curdir', 'date', 'day', - 'dectohex', 'del', 'delkey', 'delprinterconnection', 'delprogramgroup', - 'delprogramitem', 'deltree', 'delvalue', 'dim', 'dir', 'display', 'do', - 'domain', 'dos', 'else', 'endif', 'endselect', 'enumgroup', 'enumkey', - 'enumlocalgroup', 'enumvalue', 'error', 'execute', 'exist', 'existkey', - 'exit', 'expandenvironmentvars', 'flushkb', 'fullname', 'get', - 'getdiskspace', 'getfileattr', 'getfilesize', 'getfiletime', - 'getfileversion', 'gets', 'global', 'go', 'gosub', 'goto', 'homedir', - 'homedrive', 'homeshr', 'hostname', 'if', 'ingroup', 'instr', 'inwin', - 'ipaddress', 'kix', 'lanroot', 'lcase', 'ldomain', 'ldrive', 'len', 'lm', - 'loadhive', 'loadkey', 'logevent', 'logoff', 'longhomedir', 'loop', - 'lserver', 'ltrim', 'maxpwage', 'md', 'mdayno', 'messagebox', 'month', - 'monthno', 'olecallfunc', 'olecallproc', 'olecreateobject', 'oleenumobject', - 'olegetobject', 'olegetproperty', 'olegetsubobject', 'oleputproperty', - 'olereleaseobject', 'open', 'password', 'play', 'primarygroup', 'priv', - 'pwage', 'quit', 'ras', 'rd', 'readline', 'readprofilestring', 'readtype', - 'readvalue', 'redirectoutput', 'return', 'rnd', 'rserver', 'rtrim', 'run', - 'savekey', 'scriptdir', 'select', 'sendkeys', 'sendmessage', 'serror', - 'set', 'setascii', 'setconsole', 'setdefaultprinter', 'setfileattr', - 'setfocus', 'setl', 'setm', 'settime', 'setwallpaper', 'shell', - 'showprogramgroup', 'shutdown', 'sid', 'site', 'sleep', 'small', 'srnd', - 'startdir', 'substr', 'syslang', 'time', 'ucase', 'unloadhive', 'until', - 'use', 'userid', 'userlang', 'val', 'wdayno', 'while', 'wksta', 'writeline', - 'writeprofilestring', 'writevalue', 'wuserid', 'ydayno', 'year' - ); - - KeyIndices: array[0..970] of Integer = ( - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, 10, - -1, 29, 25, -1, -1, -1, 151, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, 64, -1, - -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, 135, -1, -1, -1, 89, - -1, -1, -1, -1, -1, 48, -1, -1, -1, 164, -1, -1, -1, -1, -1, -1, -1, 52, -1, - -1, -1, -1, -1, 153, -1, 17, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 67, -1, -1, 101, -1, -1, -1, -1, -1, -1, 111, 159, - -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, - 0, -1, -1, -1, -1, -1, 96, -1, -1, 133, -1, -1, 117, 129, -1, -1, -1, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 36, -1, -1, 88, -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, 11, -1, -1, -1, - -1, -1, 150, -1, 72, -1, -1, -1, -1, -1, -1, 142, 94, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 137, -1, -1, 118, -1, -1, 112, - -1, 85, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, 70, 30, -1, -1, -1, -1, -1, - -1, -1, -1, 157, -1, 90, -1, 24, 91, -1, 131, -1, -1, -1, -1, -1, 147, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, 165, -1, -1, - -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 127, 158, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, - -1, -1, 116, 100, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, - -1, -1, 93, -1, -1, -1, -1, -1, -1, 41, 79, -1, 156, -1, -1, 7, -1, -1, -1, - -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, 81, -1, - 31, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, - 32, -1, 121, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, 105, -1, -1, -1, -1, - -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, - -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, 160, -1, -1, -1, -1, - -1, -1, -1, 26, -1, 14, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 132, -1, -1, 50, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, 130, 84, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, 45, - 107, 13, -1, -1, -1, 65, -1, -1, -1, -1, 34, -1, -1, -1, -1, 143, -1, -1, - -1, 128, -1, 73, 134, 27, -1, -1, -1, -1, -1, 120, -1, 57, -1, -1, -1, 51, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 123, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, - 54, 77, -1, -1, 98, -1, -1, -1, -1, -1, 113, -1, -1, 104, -1, 1, -1, -1, -1, - -1, -1, -1, -1, -1, 163, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, 19, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 102, - -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 92, -1, -1, -1, -1, -1, -1, -1, -1, 146, -1, -1, -1, -1, 103, -1, 99, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, -1, 155, 56, 115, -1, -1, - -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 125, -1, -1, -1, -1, 42, 58, -1, -1, -1, -1, -1, -1, -1, 167, -1, - -1, -1, 87, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, - 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, 154, -1, 75, -1, 110, -1, 83, - -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, 144, -1, -1, 8, -1, -1, -1, 114, - -1, -1, -1, 152, -1, -1, -1, -1, 20, 145, 60, -1, -1, 28, -1, 55, -1, -1, - -1, -1, -1, 124, -1, -1, -1, -1, 106, -1, -1, -1, -1, 139, -1, -1, -1, 69, - -1, -1, 122, 166, -1, 62, 149, 21, 37, -1, -1, -1, -1, 40, -1, -1, -1, -1, - -1, -1, -1 - ); - -{$Q-} -function TSynKixSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 949 + Ord(Str^) * 246; - inc(Str); - end; - Result := Result mod 971; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynKixSyn.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 TSynKixSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynKixSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynKixSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -constructor TSynKixSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fMiscellaneousAttri := TSynHighlighterAttributes.Create(SYNS_AttrMiscellaneous, SYNS_FriendlyAttrMiscellaneous); - AddAttribute(fMiscellaneousAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(fVariableAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterKIX; -end; - -procedure TSynKixSyn.AsciiCharProc; -begin - fTokenID := tkString; - inc(Run); - while CharInSet(FLine[Run], ['0'..'9']) do inc(Run); -end; - -procedure TSynKixSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynKixSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynKixSyn.MacroProc; - - function IsMacroChar: Boolean; - begin - case fLine[Run] of - '0'..'9', 'A'..'Z', 'a'..'z': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkMiscellaneous; - while IsMacroChar do inc(Run); -end; - -procedure TSynKixSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynKixSyn.PrintProc; -begin - fTokenID := tkKey; - inc(Run); -end; - -procedure TSynKixSyn.VariableProc; -begin - fTokenId := tkVariable; - inc(run); - while IsIdentChar(FLine[Run]) do inc(run); -end; - -procedure TSynKixSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynKixSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynKixSyn.CommentProc; -begin - fTokenID := tkComment; - repeat - inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynKixSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynKixSyn.StringProc; -var - C: WideChar; -begin - fTokenID := tkString; - C := fline[run]; - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = C; - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynKixSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynKixSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - '#': AsciiCharProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - ';': CommentProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '"','''': StringProc; - '@': MacroProc; - '?': PrintProc; - '$': VariableProc; - else UnknownProc; - end; - inherited; -end; - -function TSynKixSyn.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 TSynKixSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynKixSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynKixSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkMiscellaneous: Result := fMiscellaneousAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkVariable: Result := fVariableAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynKixSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -class function TSynKixSyn.GetLanguageName: string; -begin - Result := SYNS_LangKIX; -end; - -function TSynKixSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterKIX; -end; - -function TSynKixSyn.GetSampleSource: string; -begin - Result := '; KiXtart sample source'#13#10 + - 'break on'#13#10 + - 'color b/n'#13#10 + - #13#10 + - 'AT(1, 30) "Hello World!"'#13#10 + - '$USERID = @USERID'#13#10 + - 'AT(1, 30) $USERID'; -end; - -class function TSynKixSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangKIX; -end; - -initialization - RegisterPlaceableHighlighter(TSynKixSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterKix.pas, released 2000-05-05. +The Original Code is based on the jsKixSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Jeff D. Smith. +Unicode translation by Maël Hörz. +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: SynHighlighterKix.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Kix syntax highlighter for SynEdit) +@author(Jeff D. Smith) +@created(1999, converted to SynEdit 2000-05-05) +@lastmod(2000-06-23) +The SynHighlighterKix unit provides SynEdit with a Kix script file syntax highlighter. +} + +unit SynHighlighterKix; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkMiscellaneous, tkNull, + tkNumber, tkSpace, tkString, tkSymbol, tkVariable, tkUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynKixSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..970] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FMiscellaneousAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FVariableAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AsciiCharProc; + procedure VariableProc; + procedure CRProc; + procedure IdentProc; + procedure MacroProc; + procedure PrintProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure CommentProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property MiscellaneousAttri: TSynHighlighterAttributes + read FMiscellaneousAttri write FMiscellaneousAttri; + 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 VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..168] of UnicodeString = ( + 'addkey', 'addprinterconnection', 'addprogramgroup', 'addprogramitem', + 'address', 'asc', 'at', 'backupeventlog', 'beep', 'big', 'box', 'break', + 'call', 'case', 'cd', 'chr', 'cleareventlog', 'close', 'cls', 'color', + 'comment', 'comparefiletimes', 'cookie1', 'copy', 'curdir', 'date', 'day', + 'dectohex', 'del', 'delkey', 'delprinterconnection', 'delprogramgroup', + 'delprogramitem', 'deltree', 'delvalue', 'dim', 'dir', 'display', 'do', + 'domain', 'dos', 'else', 'endif', 'endselect', 'enumgroup', 'enumkey', + 'enumlocalgroup', 'enumvalue', 'error', 'execute', 'exist', 'existkey', + 'exit', 'expandenvironmentvars', 'flushkb', 'fullname', 'get', + 'getdiskspace', 'getfileattr', 'getfilesize', 'getfiletime', + 'getfileversion', 'gets', 'global', 'go', 'gosub', 'goto', 'homedir', + 'homedrive', 'homeshr', 'hostname', 'if', 'ingroup', 'instr', 'inwin', + 'ipaddress', 'kix', 'lanroot', 'lcase', 'ldomain', 'ldrive', 'len', 'lm', + 'loadhive', 'loadkey', 'logevent', 'logoff', 'longhomedir', 'loop', + 'lserver', 'ltrim', 'maxpwage', 'md', 'mdayno', 'messagebox', 'month', + 'monthno', 'olecallfunc', 'olecallproc', 'olecreateobject', 'oleenumobject', + 'olegetobject', 'olegetproperty', 'olegetsubobject', 'oleputproperty', + 'olereleaseobject', 'open', 'password', 'play', 'primarygroup', 'priv', + 'pwage', 'quit', 'ras', 'rd', 'readline', 'readprofilestring', 'readtype', + 'readvalue', 'redirectoutput', 'return', 'rnd', 'rserver', 'rtrim', 'run', + 'savekey', 'scriptdir', 'select', 'sendkeys', 'sendmessage', 'serror', + 'set', 'setascii', 'setconsole', 'setdefaultprinter', 'setfileattr', + 'setfocus', 'setl', 'setm', 'settime', 'setwallpaper', 'shell', + 'showprogramgroup', 'shutdown', 'sid', 'site', 'sleep', 'small', 'srnd', + 'startdir', 'substr', 'syslang', 'time', 'ucase', 'unloadhive', 'until', + 'use', 'userid', 'userlang', 'val', 'wdayno', 'while', 'wksta', 'writeline', + 'writeprofilestring', 'writevalue', 'wuserid', 'ydayno', 'year' + ); + + KeyIndices: array[0..970] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, 10, + -1, 29, 25, -1, -1, -1, 151, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, 64, -1, + -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, 135, -1, -1, -1, 89, + -1, -1, -1, -1, -1, 48, -1, -1, -1, 164, -1, -1, -1, -1, -1, -1, -1, 52, -1, + -1, -1, -1, -1, 153, -1, 17, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 67, -1, -1, 101, -1, -1, -1, -1, -1, -1, 111, 159, + -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, + 0, -1, -1, -1, -1, -1, 96, -1, -1, 133, -1, -1, 117, 129, -1, -1, -1, 9, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 36, -1, -1, 88, -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, 11, -1, -1, -1, + -1, -1, 150, -1, 72, -1, -1, -1, -1, -1, -1, 142, 94, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 137, -1, -1, 118, -1, -1, 112, + -1, 85, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, 70, 30, -1, -1, -1, -1, -1, + -1, -1, -1, 157, -1, 90, -1, 24, 91, -1, 131, -1, -1, -1, -1, -1, 147, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, 165, -1, -1, + -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 127, 158, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, + -1, -1, 116, 100, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, + -1, -1, 93, -1, -1, -1, -1, -1, -1, 41, 79, -1, 156, -1, -1, 7, -1, -1, -1, + -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, 81, -1, + 31, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, + 32, -1, 121, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, 105, -1, -1, -1, -1, + -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, + -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, 160, -1, -1, -1, -1, + -1, -1, -1, 26, -1, 14, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 132, -1, -1, 50, -1, -1, 126, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, 130, 84, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, 45, + 107, 13, -1, -1, -1, 65, -1, -1, -1, -1, 34, -1, -1, -1, -1, 143, -1, -1, + -1, 128, -1, 73, 134, 27, -1, -1, -1, -1, -1, 120, -1, 57, -1, -1, -1, 51, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 123, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, + 54, 77, -1, -1, 98, -1, -1, -1, -1, -1, 113, -1, -1, 104, -1, 1, -1, -1, -1, + -1, -1, -1, -1, -1, 163, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, 19, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 102, + -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 92, -1, -1, -1, -1, -1, -1, -1, -1, 146, -1, -1, -1, -1, 103, -1, 99, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, -1, -1, -1, 155, 56, 115, -1, -1, + -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 125, -1, -1, -1, -1, 42, 58, -1, -1, -1, -1, -1, -1, -1, 167, -1, + -1, -1, 87, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, + 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, 154, -1, 75, -1, 110, -1, 83, + -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, 144, -1, -1, 8, -1, -1, -1, 114, + -1, -1, -1, 152, -1, -1, -1, -1, 20, 145, 60, -1, -1, 28, -1, 55, -1, -1, + -1, -1, -1, 124, -1, -1, -1, -1, 106, -1, -1, -1, -1, 139, -1, -1, -1, 69, + -1, -1, 122, 166, -1, 62, 149, 21, 37, -1, -1, -1, -1, 40, -1, -1, -1, -1, + -1, -1, -1 + ); + +{$Q-} +function TSynKixSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 949 + Ord(Str^) * 246; + Inc(Str); + end; + Result := Result mod 971; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynKixSyn.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 TSynKixSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynKixSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynKixSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +constructor TSynKixSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FMiscellaneousAttri := TSynHighlighterAttributes.Create(SYNS_AttrMiscellaneous, SYNS_FriendlyAttrMiscellaneous); + AddAttribute(FMiscellaneousAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(FVariableAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterKIX; +end; + +procedure TSynKixSyn.AsciiCharProc; +begin + FTokenID := tkString; + Inc(Run); + while CharInSet(FLine[Run], ['0'..'9']) do Inc(Run); +end; + +procedure TSynKixSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynKixSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynKixSyn.MacroProc; + + function IsMacroChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'Z', 'a'..'z': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkMiscellaneous; + while IsMacroChar do Inc(Run); +end; + +procedure TSynKixSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynKixSyn.PrintProc; +begin + FTokenID := tkKey; + Inc(Run); +end; + +procedure TSynKixSyn.VariableProc; +begin + FTokenID := tkVariable; + Inc(run); + while IsIdentChar(FLine[Run]) do Inc(run); +end; + +procedure TSynKixSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynKixSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynKixSyn.CommentProc; +begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynKixSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynKixSyn.StringProc; +var + C: WideChar; +begin + FTokenID := tkString; + C := FLine[run]; + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = C; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynKixSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynKixSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + '#': AsciiCharProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + ';': CommentProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '"','''': StringProc; + '@': MacroProc; + '?': PrintProc; + '$': VariableProc; + else UnknownProc; + end; + inherited; +end; + +function TSynKixSyn.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 TSynKixSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynKixSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynKixSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkMiscellaneous: Result := FMiscellaneousAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkVariable: Result := FVariableAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynKixSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +class function TSynKixSyn.GetLanguageName: string; +begin + Result := SYNS_LangKIX; +end; + +function TSynKixSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterKIX; +end; + +function TSynKixSyn.GetSampleSource: UnicodeString; +begin + Result := + '; KiXtart sample source'#13#10 + + 'break on'#13#10 + + 'color b/n'#13#10 + + #13#10 + + 'AT(1, 30) "Hello World!"'#13#10 + + '$USERID = @USERID'#13#10 + + 'AT(1, 30) $USERID'; +end; + +class function TSynKixSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangKIX; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynKixSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterLDraw.pas b/Source/VCL/SynEdit/Source/SynHighlighterLDraw.pas index 22c1c206..f5ccdc16 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterLDraw.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterLDraw.pas @@ -1,490 +1,492 @@ -{------------------------------------------------------------------------------- -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: SynHighlighterLDraw.pas, released 2003-04-12. -Description: LDraw Parser/Highlighter -The initial author of this file is Orion Pobursky. -Copyright (c) 2003, all rights reserved. -Unicode translation by Maël Hörz. - -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: SynHighlighterLDraw.pas,v 1.7.2.7 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} -{ -@abstract(Provides an LDraw syntax highlighter for SynEdit) -@author(Orion Pobursky) -@created(03/01/2003) -@lastmod(07/05/2003) -The SynHighlighterLDraw unit provides SynEdit with a LEGO LDraw (.ldr / .dat) highlighter. -} - -unit SynHighlighterLDraw; - -{$I SynEdit.inc} - -interface - -uses - Windows, Controls, Graphics, - SynEditHighlighter, SynEditTypes, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = ( - tkColor, - tkComment, - tkFirstTri, - tkFourthTri, - tkIdentifier, - tkKey, - tkLine, - tkNull, - tkOpLine, - tkQuad, - tkSecondTri, - tkThirdTri, - tkTriangle, - tkUnknown); - - TRangeState = (rsUnKnown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynLDRSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..1] of TIdentFuncTableFunc; - fColorAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fFirstTriAttri: TSynHighlighterAttributes; - fFourthTriAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fLineAttri: TSynHighlighterAttributes; - fOpLineAttri: TSynHighlighterAttributes; - fQuadAttri: TSynHighlighterAttributes; - fSecondTriAttri: TSynHighlighterAttributes; - fThirdTriAttri: TSynHighlighterAttributes; - fTriangleAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncAuthor(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure IdentProc; - procedure Number1Proc; - procedure UnknownProc; - procedure NullProc; - procedure CRProc; - procedure LFProc; - function FirstChar(DatLine: PWideChar): WideChar; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - constructor Create(AOwner: TComponent); override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: 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): string; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property ColorAttri: TSynHighlighterAttributes read fColorAttri write fColorAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property FirstTriAttri: TSynHighlighterAttributes read fFirstTriAttri write fFirstTriAttri; - property FourthTriAttri: TSynHighlighterAttributes read fFourthTriAttri write fFourthTriAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property LineAttri: TSynHighlighterAttributes read fLineAttri write fLineAttri; - property OpLineAttri: TSynHighlighterAttributes read fOpLineAttri write fOpLineAttri; - property QuadAttri: TSynHighlighterAttributes read fQuadAttri write fQuadAttri; - property SecondTriAttri: TSynHighlighterAttributes read fSecondTriAttri write fSecondTriAttri; - property ThirdTriAttri: TSynHighlighterAttributes read fThirdTriAttri write fThirdTriAttri; - property TriangleAttri: TSynHighlighterAttributes read fTriangleAttri write fTriangleAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..0] of string = ( - 'author' - ); - - KeyIndices: array[0..1] of Integer = ( - -1, 0 - ); - -{$Q-} -function TSynLDRSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result + Ord(Str^); - inc(Str); - end; - Result := Result mod 2; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynLDRSyn.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 TSynLDRSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[1] := FuncAuthor; -end; - -function TSynLDRSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynLDRSyn.FuncAuthor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -procedure TSynLDRSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynLDRSyn.CRProc; -begin - fTokenID := tkUnknown; - inc(Run); - if fLine[Run] = #10 then - inc(Run); -end; - -procedure TSynLDRSyn.LFProc; -begin - fTokenID := tkUnknown; - inc(Run); -end; - -constructor TSynLDRSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fColorAttri := TSynHighLighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor); - fColorAttri.Foreground := clNavy; - AddAttribute(fColorAttri); - - fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clBlue; - AddAttribute(fCommentAttri); - - fFirstTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFirstTri, SYNS_FriendlyAttrFirstTri); - fFirstTriAttri.Foreground := RGB(206,111,73); - AddAttribute(fFirstTriAttri); - - fFourthTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFourthTri, SYNS_FriendlyAttrFourthTri); - fFourthTriAttri.Foreground := RGB(54,99,12); - AddAttribute(fFourthTriAttri); - - fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - - fLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrLine, SYNS_FriendlyAttrLine); - fLineAttri.Foreground := clBlack; - AddAttribute(fLineAttri); - - fOpLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrOpLine, SYNS_FriendlyAttrOpLine); - fOpLineAttri.Foreground := clBlack; - AddAttribute(fOpLineAttri); - - fQuadAttri := TSynHighLighterAttributes.Create(SYNS_AttrQuad, SYNS_FriendlyAttrQuad); - fQuadAttri.Foreground := clRed; - AddAttribute(fQuadAttri); - - fSecondTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondTri, SYNS_FriendlyAttrSecondTri); - fSecondTriAttri.Foreground := RGB(54,99,12); - AddAttribute(fSecondTriAttri); - - fThirdTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrThirdTri, SYNS_FriendlyAttrThirdTri); - fThirdTriAttri.Foreground := RGB(206,111,73); - AddAttribute(fThirdTriAttri); - - fTriangleAttri := TSynHighLighterAttributes.Create(SYNS_AttrTriangle, SYNS_FriendlyAttrTriangle); - fTriangleAttri.Foreground := clBlack; - AddAttribute(fTriangleAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterLDraw; - fRange := rsUnknown; -end; - -function TSynLDRSyn.FirstChar(DatLine: PWideChar): WideChar; -var - i: Integer; -begin - i := 0; - while DatLine[i] = ' ' do inc(i); - Result := DatLine[i]; -end; - -procedure TSynLDRSyn.IdentProc; -begin - if FirstChar(fLine) = '0' then - begin - fTokenID := tkComment; - while (fLine[Run] <> #10) and (fLine[Run] <> #13) - and (fLine[Run] <> #0) do inc(Run); - end - else - begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); - end; -end; - -procedure TSynLDRSyn.Number1Proc; - - function ArgNumber(DatLine: PWideChar): Byte; - var - i: Integer; - b: Boolean; - begin - i := 0; - Result := 0; - b := False; - while i <= Run do - begin - if DatLine[i] = ' ' then - begin - inc(i); - b := False; - end - else - begin - if not b then inc(Result); - b := True; - inc(i) - end; - end; - end; - -begin - case ArgNumber(fLine) of - 1: begin - case fLine[Run] of - '0': fTokenID := tkComment; - '1': fTokenID := tkIdentifier; - '2': fTokenID := tkLine; - '3': fTokenID := tkTriangle; - '4': fTokenID := tkQuad; - '5': fTokenID := tkOpLine; - end; - end; - 2: if FirstChar(fLine) <> '0' then fTokenID := tkColor - else fTokenID := tkComment; - 3..5: if FirstChar(fLine) <> '0' then fTokenID := tkFirstTri - else fTokenID := tkComment; - 6..8: if FirstChar(fLine) <> '0' then fTokenID := tkSecondTri - else fTokenID := tkComment; - 9..11: if FirstChar(fLine) <> '0' then fTokenID := tkThirdTri - else fTokenID := tkComment; - 12..14: if FirstChar(fLine) <> '0' then fTokenID := tkFourthTri - else fTokenID := tkComment; - else - fTokenID := tkIdentifier; - end; - while CharInSet(FLine[Run], ['0'..'9', '.']) do inc(Run); -end; - -procedure TSynLDRSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynLDRSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '0'..'9': Number1Proc; - else UnknownProc; - end; - inherited; -end; - -function TSynLDRSyn.GetDefaultAttribute(Index: integer): TSynHighLighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; - SYN_ATTR_KEYWORD: Result := fKeyAttri; - else - Result := nil; - end; -end; - -function TSynLDRSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynLDRSyn.GetKeyWords(TokenKind: Integer): string; -begin - Result := 'Author'; -end; - -function TSynLDRSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynLDRSyn.GetTokenAttribute: TSynHighLighterAttributes; -begin - case GetTokenID of - tkColor: Result := fColorAttri; - tkComment: Result := fCommentAttri; - tkFirstTri: Result := fFirstTriAttri; - tkFourthTri: Result := fFourthTriAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkLine: Result := fLineAttri; - tkOpLine: Result := fOpLineAttri; - tkQuad: Result := fQuadAttri; - tkSecondTri: Result := fSecondTriAttri; - tkThirdTri: Result := fThirdTriAttri; - tkTriangle: Result := fTriangleAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynLDRSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynLDRSyn.GetSampleSource: string; -begin - Result := #13#10 + - 'Sample source for: '#13#10 + - 'Ldraw Parser/Highlighter'#13#10 + - '0 Comment'#13#10 + - '1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat'#13#10 + - '2 16 0 0 0 1 1 1'#13#10 + - '3 16 0 0 0 1 1 1 2 2 2'#13#10 + - '4 16 0 0 0 1 1 1 2 2 2 3 3 3'#13#10 + - '5 16 0 0 0 1 1 1 2 2 2 3 3 3'; -end; - -function TSynLDRSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterLDraw; -end; - -function TSynLDRSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '_', 'A'..'Z', 'a'..'z': - Result := True; - else - Result := False; - end; -end; - -class function TSynLDRSyn.GetLanguageName: string; -begin - Result := SYNS_LangLDraw; -end; - -procedure TSynLDRSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynLDRSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynLDRSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -class function TSynLDRSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangLDraw; -end; - -initialization - RegisterPlaceableHighlighter(TSynLDRSyn); -end. +{------------------------------------------------------------------------------- +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: SynHighlighterLDraw.pas, released 2003-04-12. +Description: LDraw Parser/Highlighter +The initial author of this file is Orion Pobursky. +Copyright (c) 2003, all rights reserved. +Unicode translation by Maël Hörz. + +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: SynHighlighterLDraw.pas,v 1.7.2.7 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} +{ +@abstract(Provides an LDraw syntax highlighter for SynEdit) +@author(Orion Pobursky) +@created(03/01/2003) +@lastmod(07/05/2003) +The SynHighlighterLDraw unit provides SynEdit with a LEGO LDraw (.ldr / .dat) highlighter. +} + +unit SynHighlighterLDraw; + +{$I SynEdit.inc} + +interface + +uses + Windows, Controls, Graphics, + SynEditHighlighter, SynEditTypes, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkColor, + tkComment, + tkFirstTri, + tkFourthTri, + tkIdentifier, + tkKey, + tkLine, + tkNull, + tkOpLine, + tkQuad, + tkSecondTri, + tkThirdTri, + tkTriangle, + tkUnknown); + + TRangeState = (rsUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynLDRSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..1] of TIdentFuncTableFunc; + FColorAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FFirstTriAttri: TSynHighlighterAttributes; + FFourthTriAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FLineAttri: TSynHighlighterAttributes; + FOpLineAttri: TSynHighlighterAttributes; + FQuadAttri: TSynHighlighterAttributes; + FSecondTriAttri: TSynHighlighterAttributes; + FThirdTriAttri: TSynHighlighterAttributes; + FTriangleAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function FuncAuthor(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure IdentProc; + procedure Number1Proc; + procedure UnknownProc; + procedure NullProc; + procedure CRProc; + procedure LFProc; + function FirstChar(DatLine: PWideChar): WideChar; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; 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 ColorAttri: TSynHighlighterAttributes read FColorAttri write FColorAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property FirstTriAttri: TSynHighlighterAttributes read FFirstTriAttri write FFirstTriAttri; + property FourthTriAttri: TSynHighlighterAttributes read FFourthTriAttri write FFourthTriAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property LineAttri: TSynHighlighterAttributes read FLineAttri write FLineAttri; + property OpLineAttri: TSynHighlighterAttributes read FOpLineAttri write FOpLineAttri; + property QuadAttri: TSynHighlighterAttributes read FQuadAttri write FQuadAttri; + property SecondTriAttri: TSynHighlighterAttributes read FSecondTriAttri write FSecondTriAttri; + property ThirdTriAttri: TSynHighlighterAttributes read FThirdTriAttri write FThirdTriAttri; + property TriangleAttri: TSynHighlighterAttributes read FTriangleAttri write FTriangleAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..0] of UnicodeString = ( + 'author' + ); + + KeyIndices: array[0..1] of Integer = ( + -1, 0 + ); + +{$Q-} +function TSynLDRSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result + Ord(Str^); + Inc(Str); + end; + Result := Result mod 2; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynLDRSyn.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 TSynLDRSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[1] := FuncAuthor; +end; + +function TSynLDRSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynLDRSyn.FuncAuthor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +procedure TSynLDRSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynLDRSyn.CRProc; +begin + FTokenID := tkUnknown; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynLDRSyn.LFProc; +begin + FTokenID := tkUnknown; + Inc(Run); +end; + +constructor TSynLDRSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FColorAttri := TSynHighLighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor); + FColorAttri.Foreground := clNavy; + AddAttribute(FColorAttri); + + FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clBlue; + AddAttribute(FCommentAttri); + + FFirstTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFirstTri, SYNS_FriendlyAttrFirstTri); + FFirstTriAttri.Foreground := RGB(206,111,73); + AddAttribute(FFirstTriAttri); + + FFourthTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFourthTri, SYNS_FriendlyAttrFourthTri); + FFourthTriAttri.Foreground := RGB(54,99,12); + AddAttribute(FFourthTriAttri); + + FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + + FLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrLine, SYNS_FriendlyAttrLine); + FLineAttri.Foreground := clBlack; + AddAttribute(FLineAttri); + + FOpLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrOpLine, SYNS_FriendlyAttrOpLine); + FOpLineAttri.Foreground := clBlack; + AddAttribute(FOpLineAttri); + + FQuadAttri := TSynHighLighterAttributes.Create(SYNS_AttrQuad, SYNS_FriendlyAttrQuad); + FQuadAttri.Foreground := clRed; + AddAttribute(FQuadAttri); + + FSecondTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondTri, SYNS_FriendlyAttrSecondTri); + FSecondTriAttri.Foreground := RGB(54,99,12); + AddAttribute(FSecondTriAttri); + + FThirdTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrThirdTri, SYNS_FriendlyAttrThirdTri); + FThirdTriAttri.Foreground := RGB(206,111,73); + AddAttribute(FThirdTriAttri); + + FTriangleAttri := TSynHighLighterAttributes.Create(SYNS_AttrTriangle, SYNS_FriendlyAttrTriangle); + FTriangleAttri.Foreground := clBlack; + AddAttribute(FTriangleAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterLDraw; + FRange := rsUnknown; +end; + +function TSynLDRSyn.FirstChar(DatLine: PWideChar): WideChar; +var + i: Integer; +begin + i := 0; + while DatLine[i] = ' ' do Inc(i); + Result := DatLine[i]; +end; + +procedure TSynLDRSyn.IdentProc; +begin + if FirstChar(FLine) = '0' then + begin + FTokenID := tkComment; + while (FLine[Run] <> #10) and (FLine[Run] <> #13) + and (FLine[Run] <> #0) do Inc(Run); + end + else + begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); + end; +end; + +procedure TSynLDRSyn.Number1Proc; + + function ArgNumber(DatLine: PWideChar): Byte; + var + i: Integer; + b: Boolean; + begin + i := 0; + Result := 0; + b := False; + while i <= Run do + begin + if DatLine[i] = ' ' then + begin + Inc(i); + b := False; + end + else + begin + if not b then Inc(Result); + b := True; + Inc(i) + end; + end; + end; + +begin + case ArgNumber(FLine) of + 1: begin + case FLine[Run] of + '0': FTokenID := tkComment; + '1': FTokenID := tkIdentifier; + '2': FTokenID := tkLine; + '3': FTokenID := tkTriangle; + '4': FTokenID := tkQuad; + '5': FTokenID := tkOpLine; + end; + end; + 2: if FirstChar(FLine) <> '0' then FTokenID := tkColor + else FTokenID := tkComment; + 3..5: if FirstChar(FLine) <> '0' then FTokenID := tkFirstTri + else FTokenID := tkComment; + 6..8: if FirstChar(FLine) <> '0' then FTokenID := tkSecondTri + else FTokenID := tkComment; + 9..11: if FirstChar(FLine) <> '0' then FTokenID := tkThirdTri + else FTokenID := tkComment; + 12..14: if FirstChar(FLine) <> '0' then FTokenID := tkFourthTri + else FTokenID := tkComment; + else + FTokenID := tkIdentifier; + end; + while CharInSet(FLine[Run], ['0'..'9', '.']) do Inc(Run); +end; + +procedure TSynLDRSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynLDRSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '0'..'9': Number1Proc; + else UnknownProc; + end; + inherited; +end; + +function TSynLDRSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; + SYN_ATTR_KEYWORD: Result := FKeyAttri; + else + Result := nil; + end; +end; + +function TSynLDRSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynLDRSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := 'Author'; +end; + +function TSynLDRSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynLDRSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkColor: Result := FColorAttri; + tkComment: Result := FCommentAttri; + tkFirstTri: Result := FFirstTriAttri; + tkFourthTri: Result := FFourthTriAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkLine: Result := FLineAttri; + tkOpLine: Result := FOpLineAttri; + tkQuad: Result := FQuadAttri; + tkSecondTri: Result := FSecondTriAttri; + tkThirdTri: Result := FThirdTriAttri; + tkTriangle: Result := FTriangleAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynLDRSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynLDRSyn.GetSampleSource: UnicodeString; +begin + Result := #13#10 + + 'Sample source for: '#13#10 + + 'Ldraw Parser/Highlighter'#13#10 + + '0 Comment'#13#10 + + '1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud.dat'#13#10 + + '2 16 0 0 0 1 1 1'#13#10 + + '3 16 0 0 0 1 1 1 2 2 2'#13#10 + + '4 16 0 0 0 1 1 1 2 2 2 3 3 3'#13#10 + + '5 16 0 0 0 1 1 1 2 2 2 3 3 3'; +end; + +function TSynLDRSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterLDraw; +end; + +function TSynLDRSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', 'A'..'Z', 'a'..'z': + Result := True; + else + Result := False; + end; +end; + +class function TSynLDRSyn.GetLanguageName: string; +begin + Result := SYNS_LangLDraw; +end; + +procedure TSynLDRSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynLDRSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynLDRSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +class function TSynLDRSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangLDraw; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynLDRSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterLLVM.pas b/Source/VCL/SynEdit/Source/SynHighlighterLLVM.pas index 0cbb44c2..9e8263df 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterLLVM.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterLLVM.pas @@ -169,7 +169,7 @@ implementation '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', + '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', diff --git a/Source/VCL/SynEdit/Source/SynHighlighterM3.pas b/Source/VCL/SynEdit/Source/SynHighlighterM3.pas index 12f7a8c8..70cd2727 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterM3.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterM3.pas @@ -1,653 +1,655 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterM3.pas, released 2000-11-23. -Unicode translation by Maël Hörz. - -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: SynHighlighterM3.pas,v 1.11.2.5 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Modula-3 syntax highlighter for SynEdit) -@author(Martin Pley ) -@created(January 2000, converted to SynEdit November 23, 2000) -@lastmod(2000-11-23) -The SynHighlighterM3 unit provides SynEdit with a Modula-3 (.m3) highlighter. -} - -unit SynHighlighterM3; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkPragma, - tkReserved, tkSpace, tkString, tkSymbol, tkUnknown, tkSyntaxError); - - TTokenRange = (trNone, trComment, trPragma); - - TRangeState = packed record - case Boolean of - False: (p: Pointer); - True: (TokenRange: Word; Level: Word); - end; - - TSynM3Syn = class(TSynCustomHighLighter) - private - fRange: TRangeState; - FTokenID: TtkTokenKind; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fPragmaAttri: TSynHighlighterAttributes; - fReservedAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fSyntaxErrorAttri: TSynHighlighterAttributes; - fKeywords: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: string; AKind: integer); - function HashKey(Str: PWideChar): integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure SymAsciiCharProc; - procedure SymCommentHelpProc; - procedure SymCRProc; - procedure SymIdentProc; - procedure SymLFProc; - procedure SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); - procedure SymNullProc; - procedure SymNumberProc; - procedure SymPragmaProc; - procedure SymPragmaHelpProc; - procedure SymRoundOpenProc; - procedure SymSpaceProc; - procedure SymStringProc; - procedure SymSymbolProc; - procedure SymUnknownProc; - protected - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; -{$IFDEF SYN_DEVELOPMENT_CHECKS} - public - property _Keywords: TSynHashEntryList read fKeywords; -{$ENDIF} - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property PragmaAttri: TSynHighlighterAttributes read fPragmaAttri - write fPragmaAttri; - property ReservedAttri: TSynHighlighterAttributes read fReservedAttri - write fReservedAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property SyntaxErrorAttri: TSynHighlighterAttributes read fSyntaxErrorAttri - write fSyntaxErrorAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - Keywords: string = - 'AS,AND,ANY,ARRAY,BEGIN,BITS,BRANDED,BY,CASE,CONST,DIV,DO,ELSE,ELSIF,END,' + - 'EVAL,EXCEPT,EXCEPTION,EXIT,EXPORTS,FINALLY,FOR,FROM,GENERIC,IF,IMPORT,' + - 'IN,INTERFACE,LOCK,LOOP,METHODS,MOD,MODULE,NOT,OBJECT,OF,OR,OVERRIDES,' + - 'PROCEDURE,RAISE,RAISES,READONLY,RECORD,REF,REPEAT,RETURN,REVEAL,ROOT,' + - 'SET,THEN,TO,TRY,TYPE,TYPECASE,UNSAFE,UNTIL,UNTRACED,VALUE,VAR,WHILE,WITH'; - - ReservedWords: string = - 'ABS,ADDRESS,ADR,ADRSIZE,BITSIZE,BOOLEAN,BYTESIZE,CARDINAL,CEILING,CHAR,' + - 'DEC,DISPOSE,FALSE,FIRST,FLOAT,FLOOR,INC,INTEGER,ISTYPE,LAST,LONGFLOAT,' + - 'LONGREAL,LOOPHOLE,MAX,MIN,MUTEX,NARROW,NEW,NIL,NULL,NUMBER,ORD,REAL,' + - 'REFANY,ROUND,SUBARRAY,TEXT,TRUE,TRUNC,TYPECODE,VAL'; - -procedure TSynM3Syn.DoAddKeyword(AKeyword: string; AKind: integer); -var - HashValue: integer; -begin - HashValue := HashKey(PWideChar(AKeyword)); - fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -function TSynM3Syn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 28 + Ord(Str^) - Ord('0'); - '_': Result := 27; - else Result := 0; - end - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $FF; // 255 - fStringLen := Str - fToIdent; -end; - -function TSynM3Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - fToIdent := MayBe; - Entry := fKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > fStringLen then - break - else if Entry.KeywordLen = fStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; -end; - -constructor TSynM3Syn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fKeywords := TSynHashEntryList.Create; - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - fPragmaAttri.Style:= [fsBold]; - AddAttribute(fPragmaAttri); - fReservedAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - AddAttribute(fReservedAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - fSyntaxErrorAttri.Foreground := clRed; - AddAttribute(fSyntaxErrorAttri); - SetAttributesOnChange(DefHighlightChange); - - EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkReserved), ReservedWords, IsIdentChar, DoAddKeyword); - fDefaultFilter := SYNS_FilterModula3; -end; - -destructor TSynM3Syn.Destroy; -begin - fKeywords.Free; - inherited Destroy; -end; - -procedure TSynM3Syn.SymAsciiCharProc; -begin - fTokenID := tkString; - Inc(Run); - while not IsLineEnd(Run) do - begin - case fLine[Run] of - '\': if fLine[Run + 1] = #39 then - Inc(Run); - #39: begin - Inc(Run); - if fLine[Run] <> #39 then - break; - end; - end; - Inc(Run); - end; -end; - -procedure TSynM3Syn.SymCommentHelpProc; -begin - fTokenID := tkComment; - SymNestedHelperProc('(', ')'); -end; - -procedure TSynM3Syn.SymCRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then - Inc(Run); -end; - -procedure TSynM3Syn.SymIdentProc; -begin - fTokenID := IdentKind(fLine + Run); - Inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); -end; - -procedure TSynM3Syn.SymLFProc; -begin - fTokenID := tkSpace; - Inc(Run); -end; - -procedure TSynM3Syn.SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); -begin - case fLine[Run] of - #0: SymNullProc; - #10: SymLFProc; - #13: SymCRProc; - else - repeat - if fLine[Run]= AOpenChar then - begin - Inc(Run); - if fLine[Run] = '*' then - begin - Inc(Run); - Inc(fRange.Level); - end; - end - else if fLine[Run] = '*' then - begin - Inc(Run); - if fLine[Run] = ACloseChar then - begin - Inc(Run); - if fRange.Level > 0 then - Dec(fRange.Level); - if fRange.Level = 0 then - begin - fRange.TokenRange := Ord(trNone); - break - end; - end; - end - else - Inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynM3Syn.SymNullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynM3Syn.SymNumberProc; -var - BasedNumber: Boolean; - MaxDigit: Integer; - - function IsValidDigit(AChar: WideChar): Boolean; - var - Digit: Integer; - begin - case AChar of - '0'..'9': Digit := Ord(AChar) - Ord('0'); - 'a'..'f': Digit := Ord(AChar) - Ord('a'); - 'A'..'F': Digit := Ord(AChar) - Ord('A'); - else Digit := -1; - end; - Result := (Digit >= 0) and (Digit <= MaxDigit); - end; - - function IsExponentChar: Boolean; - begin - case fLine[Run] of - 'd', 'D', 'e', 'E', 'x', 'X': - Result := True; - else - Result := False; - end; - end; - - -begin - fTokenID := tkNumber; - BasedNumber := False; - MaxDigit := 9; - // skip leading zeros, but they can be numbers too - while fLine[Run] = '0' do - Inc(Run); - if not IsIdentChar(fLine[Run]) then - exit; - // check for numbers with a base prefix - if CharInSet(fLine[Run], ['2'..'9']) and (fLine[Run + 1] = '_') then - begin - BasedNumber := True; - MaxDigit := Ord(fLine[Run]) - Ord('0') - 1; - Inc(Run, 2); - end - else if (fLine[Run] = '1') and CharInSet(fLine[Run + 1], ['0'..'6']) - and (fLine[Run + 2] = '_') then - begin - BasedNumber := True; - MaxDigit := 10 + Ord(fLine[Run + 1]) - Ord('0') - 1; - Inc(Run, 3); - end; - if BasedNumber then - begin - // advance over all valid digits, but at least one has to be there - if IsValidDigit(fLine[Run]) then - begin - repeat - Inc(Run); - until not IsValidDigit(fLine[Run]); - end - else - fTokenID := tkSyntaxError; - end - else - begin - // "normal" numbers - repeat - Inc(Run); - until not CharInSet(fLine[Run], ['0'..'9']); - // can include a decimal point and an exponent - if fLine[Run] = '.' then - begin - Inc(Run); - if CharInSet(fLine[Run], ['0'..'9']) then - begin - repeat - Inc(Run); - until not CharInSet(fLine[Run], ['0'..'9']); - end - else - fTokenID := tkSyntaxError; // must be a number after the '.' - end; - // can include an exponent - if IsExponentChar then - begin - Inc(Run); - if CharInSet(fLine[Run], ['+', '-']) then - Inc(Run); - if CharInSet(fLine[Run], ['0'..'9']) then - begin - repeat - Inc(Run); - until not CharInSet(fLine[Run], ['0'..'9']); - end - else // exponent must include a number - fTokenID := tkSyntaxError; - end; - end; - // it's a syntax error if there are any Identifier chars left - if IsIdentChar(fLine[Run]) then - begin - fTokenID := tkSyntaxError; - repeat - Inc(Run); - until not IsIdentChar(fLine[Run]); - end; -end; - -procedure TSynM3Syn.SymPragmaProc; -begin - Inc(Run); - if fLine[Run] = '*' then - begin - Inc(Run); - fRange.TokenRange := Ord(trPragma); - Inc(fRange.Level); - if IsLineEnd(Run) then - fTokenID := tkPragma - else - SymPragmaHelpProc; - end else - fTokenID := tkSymbol; -end; - -procedure TSynM3Syn.SymPragmaHelpProc; -begin - fTokenID := tkPragma; - SymNestedHelperProc('<', '>'); -end; - -procedure TSynM3Syn.SymRoundOpenProc; -begin - Inc(Run); - if fLine[Run] = '*' then - begin - Inc(Run); - fRange.TokenRange := Ord(trComment); - Inc(fRange.Level); - if IsLineEnd(Run) then - fTokenID := tkComment - else - SymCommentHelpProc; - end - else - begin - fTokenID := tkSymbol; - if fLine[Run] = '.' then - Inc(Run); - end; -end; - -procedure TSynM3Syn.SymSpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynM3Syn.SymStringProc; -begin - fTokenID := tkString; - Inc(Run); - while not IsLineEnd(Run) do - begin - case fLine[Run] of - #34: begin - Inc(Run); - break; - end; - '\': if CharInSet(fLine[Run + 1], [#34, '\']) then - Inc(Run); - end; - Inc(Run); - end; -end; - -procedure TSynM3Syn.SymSymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynM3Syn.SymUnknownProc; -begin - Inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynM3Syn.Next; -begin - fTokenPos := Run; - case TTokenRange(fRange.TokenRange) of - trComment: SymCommentHelpProc; - trPragma: SymPragmaHelpProc; - else - case fLine[Run] of - #39: SymAsciiCharProc; - #13: SymCRProc; - 'A'..'Z', 'a'..'z', '_': SymIdentProc; - #10: SymLFProc; - #0: SymNullProc; - '0'..'9': SymNumberProc; - '(': SymRoundOpenProc; - #1..#9, #11, #12, #14..#32: SymSpaceProc; - '{','}','|','!', #35..#38, #42..#47, #58, #59, #61..#64, #91..#94, ')': SymSymbolProc; - '<': SymPragmaProc; - #34: SymStringProc; - else SymUnknownProc; - end; - end; - inherited; -end; - -function TSynM3Syn.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 TSynM3Syn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynM3Syn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterModula3; -end; - -class function TSynM3Syn.GetLanguageName: string; -begin - Result := SYNS_LangModula3; -end; - -function TSynM3Syn.GetRange: pointer; -begin - result := fRange.p; -end; - -function TSynM3Syn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkPragma: Result:= fPragmaAttri; - tkReserved: Result := fReservedAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkSyntaxError: Result := fSyntaxErrorAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynM3Syn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynM3Syn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynM3Syn.ResetRange; -begin - fRange.p := nil; -end; - -procedure TSynM3Syn.SetRange(Value: pointer); -begin - fRange.p := Value; -end; - -class function TSynM3Syn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangModula3; -end; - -initialization - RegisterPlaceableHighlighter(TSynM3Syn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterM3.pas, released 2000-11-23. +Unicode translation by Maël Hörz. + +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: SynHighlighterM3.pas,v 1.11.2.5 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Modula-3 syntax highlighter for SynEdit) +@author(Martin Pley ) +@created(January 2000, converted to SynEdit November 23, 2000) +@lastmod(2000-11-23) +The SynHighlighterM3 unit provides SynEdit with a Modula-3 (.m3) highlighter. +} + +unit SynHighlighterM3; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynHighlighterHashEntries, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkPragma, + tkReserved, tkSpace, tkString, tkSymbol, tkUnknown, tkSyntaxError); + + TTokenRange = (trNone, trComment, trPragma); + + TRangeState = packed record + case Boolean of + False: (p: Pointer); + True: (TokenRange: Word; Level: Word); + end; + + TSynM3Syn = class(TSynCustomHighLighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FPragmaAttri: TSynHighlighterAttributes; + FReservedAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FSyntaxErrorAttri: TSynHighlighterAttributes; + FKeywords: TSynHashEntryList; + procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + function HashKey(Str: PWideChar): Integer; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure SymAsciiCharProc; + procedure SymCommentHelpProc; + procedure SymCRProc; + procedure SymIdentProc; + procedure SymLFProc; + procedure SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); + procedure SymNullProc; + procedure SymNumberProc; + procedure SymPragmaProc; + procedure SymPragmaHelpProc; + procedure SymRoundOpenProc; + procedure SymSpaceProc; + procedure SymStringProc; + procedure SymSymbolProc; + procedure SymUnknownProc; + protected + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; +{$IFDEF SYN_DEVELOPMENT_CHECKS} + public + property _Keywords: TSynHashEntryList read FKeywords; +{$ENDIF} + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property PragmaAttri: TSynHighlighterAttributes read FPragmaAttri + write FPragmaAttri; + property ReservedAttri: TSynHighlighterAttributes read FReservedAttri + write FReservedAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property SyntaxErrorAttri: TSynHighlighterAttributes read FSyntaxErrorAttri + write FSyntaxErrorAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + Keywords: UnicodeString = + 'AS,AND,ANY,ARRAY,BEGIN,BITS,BRANDED,BY,CASE,CONST,DIV,DO,ELSE,ELSIF,END,' + + 'EVAL,EXCEPT,EXCEPTION,EXIT,EXPORTS,FINALLY,FOR,FROM,GENERIC,IF,IMPORT,' + + 'IN,INTERFACE,LOCK,LOOP,METHODS,MOD,MODULE,NOT,OBJECT,OF,OR,OVERRIDES,' + + 'PROCEDURE,RAISE,RAISES,READONLY,RECORD,REF,REPEAT,RETURN,REVEAL,ROOT,' + + 'SET,THEN,TO,TRY,TYPE,TYPECASE,UNSAFE,UNTIL,UNTRACED,VALUE,VAR,WHILE,WITH'; + + ReservedWords: UnicodeString = + 'ABS,ADDRESS,ADR,ADRSIZE,BITSIZE,BOOLEAN,BYTESIZE,CARDINAL,CEILING,CHAR,' + + 'DEC,DISPOSE,FALSE,FIRST,FLOAT,FLOOR,INC,INTEGER,ISTYPE,LAST,LONGFLOAT,' + + 'LONGREAL,LOOPHOLE,MAX,MIN,MUTEX,NARROW,NEW,NIL,NULL,NUMBER,ORD,REAL,' + + 'REFANY,ROUND,SUBARRAY,TEXT,TRUE,TRUNC,TYPECODE,VAL'; + +procedure TSynM3Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +var + HashValue: Integer; +begin + HashValue := HashKey(PWideChar(AKeyword)); + FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); +end; + +function TSynM3Syn.HashKey(Str: PWideChar): Integer; + + function GetOrd: Integer; + begin + case Str^ of + 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); + 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); + '0'..'9': Result := 28 + Ord(Str^) - Ord('0'); + '_': Result := 27; + else Result := 0; + end + end; + +begin + Result := 0; + while IsIdentChar(Str^) do + begin +{$IFOPT Q-} + Result := 7 * Result + GetOrd; +{$ELSE} + Result := (7 * Result + GetOrd) and $FFFFFF; +{$ENDIF} + Inc(Str); + end; + Result := Result and $FF; // 255 + FStringLen := Str - FToIdent; +end; + +function TSynM3Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Entry: TSynHashEntry; +begin + FToIdent := MayBe; + Entry := FKeywords[HashKey(MayBe)]; + while Assigned(Entry) do + begin + if Entry.KeywordLen > FStringLen then + Break + else if Entry.KeywordLen = FStringLen then + if IsCurrentToken(Entry.Keyword) then + begin + Result := TtkTokenKind(Entry.Kind); + Exit; + end; + Entry := Entry.Next; + end; + Result := tkIdentifier; +end; + +constructor TSynM3Syn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FKeywords := TSynHashEntryList.Create; + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + FPragmaAttri.Style:= [fsBold]; + AddAttribute(FPragmaAttri); + FReservedAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + AddAttribute(FReservedAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + FSyntaxErrorAttri.Foreground := clRed; + AddAttribute(FSyntaxErrorAttri); + SetAttributesOnChange(DefHighlightChange); + + EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkReserved), ReservedWords, IsIdentChar, DoAddKeyword); + FDefaultFilter := SYNS_FilterModula3; +end; + +destructor TSynM3Syn.Destroy; +begin + FKeywords.Free; + inherited Destroy; +end; + +procedure TSynM3Syn.SymAsciiCharProc; +begin + FTokenID := tkString; + Inc(Run); + while not IsLineEnd(Run) do + begin + case FLine[Run] of + '\': if FLine[Run + 1] = #39 then + Inc(Run); + #39: begin + Inc(Run); + if FLine[Run] <> #39 then + Break; + end; + end; + Inc(Run); + end; +end; + +procedure TSynM3Syn.SymCommentHelpProc; +begin + FTokenID := tkComment; + SymNestedHelperProc('(', ')'); +end; + +procedure TSynM3Syn.SymCRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynM3Syn.SymIdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynM3Syn.SymLFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynM3Syn.SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); +begin + case FLine[Run] of + #0: SymNullProc; + #10: SymLFProc; + #13: SymCRProc; + else + repeat + if FLine[Run]= AOpenChar then + begin + Inc(Run); + if FLine[Run] = '*' then + begin + Inc(Run); + Inc(FRange.Level); + end; + end + else if FLine[Run] = '*' then + begin + Inc(Run); + if FLine[Run] = ACloseChar then + begin + Inc(Run); + if FRange.Level > 0 then + Dec(FRange.Level); + if FRange.Level = 0 then + begin + FRange.TokenRange := Ord(trNone); + Break + end; + end; + end + else + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynM3Syn.SymNullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynM3Syn.SymNumberProc; +var + BasedNumber: Boolean; + MaxDigit: Integer; + + function IsValidDigit(AChar: WideChar): Boolean; + var + Digit: Integer; + begin + case AChar of + '0'..'9': Digit := Ord(AChar) - Ord('0'); + 'a'..'f': Digit := Ord(AChar) - Ord('a'); + 'A'..'F': Digit := Ord(AChar) - Ord('A'); + else Digit := -1; + end; + Result := (Digit >= 0) and (Digit <= MaxDigit); + end; + + function IsExponentChar: Boolean; + begin + case FLine[Run] of + 'd', 'D', 'e', 'E', 'x', 'X': + Result := True; + else + Result := False; + end; + end; + + +begin + FTokenID := tkNumber; + BasedNumber := False; + MaxDigit := 9; + // skip leading zeros, but they can be numbers too + while FLine[Run] = '0' do + Inc(Run); + if not IsIdentChar(FLine[Run]) then + Exit; + // check for numbers with a base prefix + if CharInSet(FLine[Run], ['2'..'9']) and (FLine[Run + 1] = '_') then + begin + BasedNumber := True; + MaxDigit := Ord(FLine[Run]) - Ord('0') - 1; + Inc(Run, 2); + end + else if (FLine[Run] = '1') and CharInSet(FLine[Run + 1], ['0'..'6']) + and (FLine[Run + 2] = '_') then + begin + BasedNumber := True; + MaxDigit := 10 + Ord(FLine[Run + 1]) - Ord('0') - 1; + Inc(Run, 3); + end; + if BasedNumber then + begin + // advance over all valid digits, but at least one has to be there + if IsValidDigit(FLine[Run]) then + begin + repeat + Inc(Run); + until not IsValidDigit(FLine[Run]); + end + else + FTokenID := tkSyntaxError; + end + else + begin + // "normal" numbers + repeat + Inc(Run); + until not CharInSet(FLine[Run], ['0'..'9']); + // can include a decimal point and an exponent + if FLine[Run] = '.' then + begin + Inc(Run); + if CharInSet(FLine[Run], ['0'..'9']) then + begin + repeat + Inc(Run); + until not CharInSet(FLine[Run], ['0'..'9']); + end + else + FTokenID := tkSyntaxError; // must be a number after the '.' + end; + // can include an exponent + if IsExponentChar then + begin + Inc(Run); + if CharInSet(FLine[Run], ['+', '-']) then + Inc(Run); + if CharInSet(FLine[Run], ['0'..'9']) then + begin + repeat + Inc(Run); + until not CharInSet(FLine[Run], ['0'..'9']); + end + else // exponent must include a number + FTokenID := tkSyntaxError; + end; + end; + // it's a syntax error if there are any Identifier chars left + if IsIdentChar(FLine[Run]) then + begin + FTokenID := tkSyntaxError; + repeat + Inc(Run); + until not IsIdentChar(FLine[Run]); + end; +end; + +procedure TSynM3Syn.SymPragmaProc; +begin + Inc(Run); + if FLine[Run] = '*' then + begin + Inc(Run); + FRange.TokenRange := Ord(trPragma); + Inc(FRange.Level); + if IsLineEnd(Run) then + FTokenID := tkPragma + else + SymPragmaHelpProc; + end else + FTokenID := tkSymbol; +end; + +procedure TSynM3Syn.SymPragmaHelpProc; +begin + FTokenID := tkPragma; + SymNestedHelperProc('<', '>'); +end; + +procedure TSynM3Syn.SymRoundOpenProc; +begin + Inc(Run); + if FLine[Run] = '*' then + begin + Inc(Run); + FRange.TokenRange := Ord(trComment); + Inc(FRange.Level); + if IsLineEnd(Run) then + FTokenID := tkComment + else + SymCommentHelpProc; + end + else + begin + FTokenID := tkSymbol; + if FLine[Run] = '.' then + Inc(Run); + end; +end; + +procedure TSynM3Syn.SymSpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynM3Syn.SymStringProc; +begin + FTokenID := tkString; + Inc(Run); + while not IsLineEnd(Run) do + begin + case FLine[Run] of + #34: begin + Inc(Run); + Break; + end; + '\': if CharInSet(FLine[Run + 1], [#34, '\']) then + Inc(Run); + end; + Inc(Run); + end; +end; + +procedure TSynM3Syn.SymSymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynM3Syn.SymUnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynM3Syn.Next; +begin + FTokenPos := Run; + case TTokenRange(FRange.TokenRange) of + trComment: SymCommentHelpProc; + trPragma: SymPragmaHelpProc; + else + case FLine[Run] of + #39: SymAsciiCharProc; + #13: SymCRProc; + 'A'..'Z', 'a'..'z', '_': SymIdentProc; + #10: SymLFProc; + #0: SymNullProc; + '0'..'9': SymNumberProc; + '(': SymRoundOpenProc; + #1..#9, #11, #12, #14..#32: SymSpaceProc; + '{','}','|','!', #35..#38, #42..#47, #58, #59, #61..#64, #91..#94, ')': SymSymbolProc; + '<': SymPragmaProc; + #34: SymStringProc; + else SymUnknownProc; + end; + end; + inherited; +end; + +function TSynM3Syn.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 TSynM3Syn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynM3Syn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterModula3; +end; + +class function TSynM3Syn.GetLanguageName: string; +begin + Result := SYNS_LangModula3; +end; + +function TSynM3Syn.GetRange: Pointer; +begin + Result := FRange.p; +end; + +function TSynM3Syn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkPragma: Result:= FPragmaAttri; + tkReserved: Result := FReservedAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkSyntaxError: Result := FSyntaxErrorAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynM3Syn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynM3Syn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynM3Syn.ResetRange; +begin + FRange.p := nil; +end; + +procedure TSynM3Syn.SetRange(Value: Pointer); +begin + FRange.p := Value; +end; + +class function TSynM3Syn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangModula3; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynM3Syn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterManager.pas b/Source/VCL/SynEdit/Source/SynHighlighterManager.pas index 6beeff49..fdeab8aa 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterManager.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterManager.pas @@ -1,436 +1,449 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterManager.pas, released 2000-04-14. - -The Original Code is based on mwHighlighterManager.pas by Primoz Gabrijelcic, -part of the mwEdit component suite. -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: SynHighlighterManager.pas,v 1.7.2.2 2008/03/01 18:32:02 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - - does not work when dropped on a frame in Delphi 5 --------------------------------------------------------------------------------} -{ -@abstract(Provides a component to manage many highlighters in a single project.) -@author(Primoz Gabrijelcic) -@created(1999, converted to SynEdit 2000-04-14) -@lastmod(2000-04-14) -Provides a component to manage many highlighters in a single project. -} - -unit SynHighlighterManager; - -{$I SynEdit.inc} - -interface - -uses - Classes; - -type - {:Highlighter manager.

- Design-only component, designed to simplify work with highlighter components.

- When placed on the form, SynHighlighterManager scans the form for highlighter - components (descendants of TSynCustomHighlighter). Next it presents the user with - small form containing checkboxed list and some buttons. User can select (by - checking/unchecking list items) highlighter that should be placed onto the - form. After user clicks OK, SynHighlighterManager synchronises highlighter - components on the form with required state.

- Built-in tricks:
- - SynHighlighterManager never covers existing TComponent with a highlighter.
- - SynHighlighterManager scans the form for TSynCustomHighlighter descendants and - uses topmost and leftmost component as a starting point for insertion. If - no TSynCustomHighlighter components are found, first highlighter will be placed - at coordinates (8,8).

- Known issues:
- - If you place TSynHighlighterManager by double-clicking its icon in - component palette, it will function normally, except that when all is - done, Delphi will disply small window with title "Error" and message - "Operation aborted". Purely cosmetic issue for which there is no obvious - workaround. Live with it.

- Last change: 2000-01-21 - - @author Primoz Gabrijelcic - @version 0.1 - @component - @see TSynEditHighlighter - :} - TSynHighlighterManager = class(TComponent) - public - constructor Create(AOwner: TComponent); override; - published - end; - -implementation - -uses - DesignIntf, - Windows, - Forms, - Controls, - StdCtrls, - CheckLst, - SynEditHighlighter, - SynEditStrConst, - SysUtils; - -type - TSynHighlighterForm = class(TForm) - clbHighlighters: TCheckListBox; - btnSelectAll: TButton; - btnDeselectAll: TButton; - btnOK: TButton; - btnCancel: TButton; - Highlight: TSynHighlighterList; - constructor Create(highlighters: TSynHighlighterList); reintroduce; - procedure LoadForm; - procedure SelectAll(Sender: TObject); - procedure DeselectAll(Sender: TObject); - end; - - TDesignerClass = IDesigner; - -{ TSynHighlighterManager } - -constructor TSynHighlighterManager.Create(AOwner: TComponent); -var - form: TCustomForm; - dsgn: TDesignerClass; - highlight: TSynHighlighterList; - synForm: TSynHighlighterForm; - - procedure CheckExisting; - var - i: integer; - j: integer; - begin - for i := 0 to form.ComponentCount-1 do begin - j := highlight.FindByClass(form.Components[i]); - if j >= 0 then begin - j := synForm.clbHighlighters.Items.IndexOf(highlight[j].GetFriendlyLanguageName); - if j >= 0 then - synForm.clbHighlighters.Checked[j] := true; - end; - end; //for - end; - - function FindHighlighterComp(hlClass: TSynCustomHighlighterClass): integer; - var - i: integer; - begin - Result := -1; - for i := 0 to form.ComponentCount-1 do begin - if form.Components[i] is hlClass then begin - Result := i; - Exit; - end; - end; //for - end; - - procedure PlaceNew; - var - i: integer; - high: integer; - comp: integer; - xpos, ypos: integer; - xstart: integer; - - procedure GetStartCoordinates; - var - compTop: integer; - compLeft: integer; - i: integer; - begin - xpos := -1; - ypos := -1; - for i := 0 to form.ComponentCount-1 do begin - if form.Components[i] is TSynCustomHighlighterClass then begin - compLeft := LongRec(form.Components[i].DesignInfo).Lo; - compTop := LongRec(form.Components[i].DesignInfo).Hi; - if (xpos < 0) or (compLeft < xpos) then - xpos := compLeft; - if (ypos < 0) or (compTop < ypos) then - ypos := compTop; - end; - end; //for - if xpos < 0 then - xpos := 8; - if ypos < 0 then - ypos := 8; - xstart := xpos; - end; - - procedure IncCoordinates; - begin - Inc(xpos,32); - if (xpos+32) >= form.ClientWidth then begin - xpos := xstart; - Inc(ypos,32); - end; - end; - - function CoordinatesTaken: boolean; - var - compTop: integer; - compLeft: integer; - compRect: TRect; - testRect: TRect; - interRect: TRect; - i: integer; - begin - Result := false; - testRect := Rect(xpos,ypos,xpos+31,ypos+31); - for i := 0 to form.ComponentCount-1 do begin - if (form.Components[i] <> self) and (not (form.Components[i] is TControl)) then begin - compLeft := LongRec(form.Components[i].DesignInfo).Lo; - compTop := LongRec(form.Components[i].DesignInfo).Hi; - compRect := Rect(compLeft,compTop,compLeft+31,compTop+31); - if IntersectRect(interRect,testRect,compRect) then begin - Result := true; - Exit; - end; - end; - end; //for - end; - - procedure GetFreeCoordinates; - begin - while CoordinatesTaken do - IncCoordinates; - end; - - begin - GetStartCoordinates; - // Iterate over TCheckListBox, not over GetPlaceableHighlighters to ensure - // inserted highlighters to be sorted by name. - // Iterate twice - delete highlighters in first pass (to make place), create - // in second. - for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin - if not synForm.clbHighlighters.Checked[i] then begin // unchecked - remove - high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); - if high >= 0 then begin - comp := FindHighlighterComp(highlight[high]); - if comp >= 0 then - form.Components[comp].Free; - end; - end; - end; //for - for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin - if synForm.clbHighlighters.Checked[i] then begin // checked - add - high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); - if high >= 0 then begin - if FindHighlighterComp(highlight[high]) < 0 then begin - GetFreeCoordinates; - dsgn.CreateComponent(highlight[high],AOwner,xpos,ypos,24,24); - IncCoordinates; - end; - end; - end; - end; //for - end; - -begin - inherited; - if (csDesigning in ComponentState) and (AOwner is TCustomForm) then begin - form := TCustomForm(AOwner); - dsgn := form.Designer as TDesignerClass; - highlight := GetPlaceableHighlighters; - if highlight.Count = 0 then - Application.MessageBox('No highlighters found!','Highlighter Manager', MB_OK + MB_ICONEXCLAMATION) - else - begin - synForm := TSynHighlighterForm.Create(highlight); - try - CheckExisting; - if synForm.ShowModal = mrOK then - PlaceNew; - finally - synForm.Free; - end; - end; - end; - SysUtils.Abort; -end; - -{ TSynHighlighterForm } - -constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); -begin - CreateNew(nil); - Caption := 'Highlighter Manager'; - Width := 410; - Height := 243; - Position := poScreenCenter; - BorderStyle := bsDialog; - - Highlight := highlighters; - -//object clbHighlighters: TCheckListBox -// Left = 8 -// Top = 8 -// Width = 305 -// Height = 201 -// ItemHeight = 13 -// TabOrder = 0 -//end - -//object btnSelectAll: TButton -// Left = 320 -// Top = 8 -// Width = 75 -// Height = 25 -// Caption = '&Select All' -// TabOrder = 1 -//end - -//object btnDeselectAll: TButton -// Left = 320 -// Top = 40 -// Width = 75 -// Height = 25 -// Caption = '&Deselect All' -// TabOrder = 2 -//end - -//object btnOK: TButton -// Left = 320 -// Top = 152 -// Width = 75 -// Height = 25 -// Caption = 'OK' -// Default = True -// ModalResult = 1 -// TabOrder = 3 -//end - -//object btnCancel: TButton -// Left = 320 -// Top = 184 -// Width = 75 -// Height = 25 -// Caption = 'Cancel' -// ModalResult = 2 -// TabOrder = 4 -//end - - clbHighlighters := TCheckListBox.Create(Self); - btnSelectAll := TButton.Create(Self); - btnDeselectAll := TButton.Create(Self); - btnOK := TButton.Create(Self); - btnCancel := TButton.Create(Self); - with clbHighlighters do - begin - Name := 'clbHighlighters'; - Parent := Self; - Left := 8; - Top := 8; - Width := 305; - Height := 201; - ItemHeight := 13; - Sorted := true; - TabOrder := 0; - end; - with btnSelectAll do - begin - Name := 'btnSelectAll'; - Parent := Self; - Left := 320; - Top := 8; - Width := 75; - Height := 25; - Caption := '&Select All'; - TabOrder := 1; - OnClick := SelectAll; - end; - with btnDeselectAll do - begin - Name := 'btnDeselectAll'; - Parent := Self; - Left := 320; - Top := 40; - Width := 75; - Height := 25; - Caption := '&Deselect All'; - TabOrder := 2; - OnClick := DeselectAll; - end; - with btnOK do - begin - Name := 'btnOK'; - Parent := Self; - Left := 320; - Top := 152; - Width := 75; - Height := 25; - Caption := 'OK'; - Default := True; - ModalResult := 1; - TabOrder := 3; - end; - with btnCancel do - begin - Name := 'btnCancel'; - Parent := Self; - Left := 320; - Top := 184; - Width := 75; - Height := 25; - Caption := 'Cancel'; - ModalResult := 2; - TabOrder := 4; - end; - LoadForm; -end; - -procedure TSynHighlighterForm.DeselectAll(Sender: TObject); -var - i: integer; -begin - for i := 0 to clbHighlighters.Items.Count-1 do - clbHighlighters.Checked[i] := false; -end; - -procedure TSynHighlighterForm.LoadForm; -var - i: integer; -begin - clbHighlighters.Clear; - for i := 0 to Highlight.Count-1 do begin - clbHighlighters.Items.Add(Highlight[i].GetFriendlyLanguageName); - end; //for -end; - -procedure TSynHighlighterForm.SelectAll(Sender: TObject); -var - i: integer; -begin - for i := 0 to clbHighlighters.Items.Count-1 do - clbHighlighters.Checked[i] := true; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterManager.pas, released 2000-04-14. + +The Original Code is based on mwHighlighterManager.pas by Primoz Gabrijelcic, +part of the mwEdit component suite. +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: SynHighlighterManager.pas,v 1.7.2.2 2008/03/01 18:32:02 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - does not work when dropped on a frame in Delphi 5 +-------------------------------------------------------------------------------} +{ +@abstract(Provides a component to manage many highlighters in a single project.) +@author(Primoz Gabrijelcic) +@created(1999, converted to SynEdit 2000-04-14) +@lastmod(2000-04-14) +Provides a component to manage many highlighters in a single project. +} + +unit SynHighlighterManager; + +{$I SynEdit.inc} + +interface + +uses + Classes; + +type + {:Highlighter manager.

+ Design-only component, designed to simplify work with highlighter components.

+ When placed on the form, SynHighlighterManager scans the form for highlighter + components (descendants of TSynCustomHighlighter). Next it presents the user with + small form containing checkboxed list and some buttons. User can select (by + checking/unchecking list items) highlighter that should be placed onto the + form. After user clicks OK, SynHighlighterManager synchronises highlighter + components on the form with required state.

+ Built-in tricks:
+ - SynHighlighterManager never covers existing TComponent with a highlighter.
+ - SynHighlighterManager scans the form for TSynCustomHighlighter descendants and + uses topmost and leftmost component as a starting point for insertion. If + no TSynCustomHighlighter components are found, first highlighter will be placed + at coordinates (8,8).

+ Known issues:
+ - If you place TSynHighlighterManager by double-clicking its icon in + component palette, it will function normally, except that when all is + done, Delphi will disply small window with title "Error" and message + "Operation aborted". Purely cosmetic issue for which there is no obvious + workaround. Live with it.

+ Last change: 2000-01-21 + + @author Primoz Gabrijelcic + @version 0.1 + @component + @see TSynEditHighlighter + :} + TSynHighlighterManager = class(TComponent) + public + constructor Create(AOwner: TComponent); override; + published + end; + +implementation + +uses +{$IFDEF SYN_COMPILER_6_UP} + DesignIntf, +{$ELSE} + DsgnIntf, +{$ENDIF} + Windows, + Forms, + Controls, + StdCtrls, + CheckLst, + SynEditHighlighter, + SynEditStrConst, + SysUtils; + +type + TSynHighlighterForm = class(TForm) + clbHighlighters: TCheckListBox; + btnSelectAll: TButton; + btnDeselectAll: TButton; + btnOK: TButton; + btnCancel: TButton; + Highlight: TSynHighlighterList; + constructor Create(highlighters: TSynHighlighterList); + {$IFDEF SYN_COMPILER_4_UP}reintroduce;{$ENDIF} + procedure LoadForm; + procedure SelectAll(Sender: TObject); + procedure DeselectAll(Sender: TObject); + end; + + {$IFDEF SYN_COMPILER_4_UP} + {$IFDEF SYN_COMPILER_6_UP} + TDesignerClass = IDesigner; + {$ELSE} + TDesignerClass = IFormDesigner; + {$ENDIF} + {$ELSE} + TDesignerClass = TFormDesigner; + {$ENDIF} + +{ TSynHighlighterManager } + +constructor TSynHighlighterManager.Create(AOwner: TComponent); +var + form: TCustomForm; + dsgn: TDesignerClass; + highlight: TSynHighlighterList; + synForm: TSynHighlighterForm; + + procedure CheckExisting; + var + i: integer; + j: integer; + begin + for i := 0 to form.ComponentCount-1 do begin + j := highlight.FindByClass(form.Components[i]); + if j >= 0 then begin + j := synForm.clbHighlighters.Items.IndexOf(highlight[j].GetFriendlyLanguageName); + if j >= 0 then + synForm.clbHighlighters.Checked[j] := true; + end; + end; //for + end; + + function FindHighlighterComp(hlClass: TSynCustomHighlighterClass): integer; + var + i: integer; + begin + Result := -1; + for i := 0 to form.ComponentCount-1 do begin + if form.Components[i] is hlClass then begin + Result := i; + Exit; + end; + end; //for + end; + + procedure PlaceNew; + var + i: integer; + high: integer; + comp: integer; + xpos, ypos: integer; + xstart: integer; + + procedure GetStartCoordinates; + var + compTop: integer; + compLeft: integer; + i: integer; + begin + xpos := -1; + ypos := -1; + for i := 0 to form.ComponentCount-1 do begin + if form.Components[i] is TSynCustomHighlighterClass then begin + compLeft := LongRec(form.Components[i].DesignInfo).Lo; + compTop := LongRec(form.Components[i].DesignInfo).Hi; + if (xpos < 0) or (compLeft < xpos) then + xpos := compLeft; + if (ypos < 0) or (compTop < ypos) then + ypos := compTop; + end; + end; //for + if xpos < 0 then + xpos := 8; + if ypos < 0 then + ypos := 8; + xstart := xpos; + end; + + procedure IncCoordinates; + begin + Inc(xpos,32); + if (xpos+32) >= form.ClientWidth then begin + xpos := xstart; + Inc(ypos,32); + end; + end; + + function CoordinatesTaken: boolean; + var + compTop: integer; + compLeft: integer; + compRect: TRect; + testRect: TRect; + interRect: TRect; + i: integer; + begin + Result := false; + testRect := Rect(xpos,ypos,xpos+31,ypos+31); + for i := 0 to form.ComponentCount-1 do begin + if (form.Components[i] <> self) and (not (form.Components[i] is TControl)) then begin + compLeft := LongRec(form.Components[i].DesignInfo).Lo; + compTop := LongRec(form.Components[i].DesignInfo).Hi; + compRect := Rect(compLeft,compTop,compLeft+31,compTop+31); + if IntersectRect(interRect,testRect,compRect) then begin + Result := true; + Exit; + end; + end; + end; //for + end; + + procedure GetFreeCoordinates; + begin + while CoordinatesTaken do + IncCoordinates; + end; + + begin + GetStartCoordinates; + // Iterate over TCheckListBox, not over GetPlaceableHighlighters to ensure + // inserted highlighters to be sorted by name. + // Iterate twice - delete highlighters in first pass (to make place), create + // in second. + for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin + if not synForm.clbHighlighters.Checked[i] then begin // unchecked - remove + high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); + if high >= 0 then begin + comp := FindHighlighterComp(highlight[high]); + if comp >= 0 then + form.Components[comp].Free; + end; + end; + end; //for + for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin + if synForm.clbHighlighters.Checked[i] then begin // checked - add + high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); + if high >= 0 then begin + if FindHighlighterComp(highlight[high]) < 0 then begin + GetFreeCoordinates; + dsgn.CreateComponent(highlight[high],AOwner,xpos,ypos,24,24); + IncCoordinates; + end; + end; + end; + end; //for + end; + +begin + inherited; + if (csDesigning in ComponentState) and (AOwner is TCustomForm) then begin + form := TCustomForm(AOwner); + dsgn := form.Designer as TDesignerClass; + highlight := GetPlaceableHighlighters; + if highlight.Count = 0 then + Application.MessageBox('No highlighters found!','Highlighter Manager', MB_OK + MB_ICONEXCLAMATION) + else + begin + synForm := TSynHighlighterForm.Create(highlight); + try + CheckExisting; + if synForm.ShowModal = mrOK then + PlaceNew; + finally + synForm.Free; + end; + end; + end; + SysUtils.Abort; +end; + +{ TSynHighlighterForm } + +constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); +begin + CreateNew(nil); + Caption := 'Highlighter Manager'; + Width := 410; + Height := 243; + Position := poScreenCenter; + BorderStyle := bsDialog; + + Highlight := highlighters; + +//object clbHighlighters: TCheckListBox +// Left = 8 +// Top = 8 +// Width = 305 +// Height = 201 +// ItemHeight = 13 +// TabOrder = 0 +//end + +//object btnSelectAll: TButton +// Left = 320 +// Top = 8 +// Width = 75 +// Height = 25 +// Caption = '&Select All' +// TabOrder = 1 +//end + +//object btnDeselectAll: TButton +// Left = 320 +// Top = 40 +// Width = 75 +// Height = 25 +// Caption = '&Deselect All' +// TabOrder = 2 +//end + +//object btnOK: TButton +// Left = 320 +// Top = 152 +// Width = 75 +// Height = 25 +// Caption = 'OK' +// Default = True +// ModalResult = 1 +// TabOrder = 3 +//end + +//object btnCancel: TButton +// Left = 320 +// Top = 184 +// Width = 75 +// Height = 25 +// Caption = 'Cancel' +// ModalResult = 2 +// TabOrder = 4 +//end + + clbHighlighters := TCheckListBox.Create(Self); + btnSelectAll := TButton.Create(Self); + btnDeselectAll := TButton.Create(Self); + btnOK := TButton.Create(Self); + btnCancel := TButton.Create(Self); + with clbHighlighters do + begin + Name := 'clbHighlighters'; + Parent := Self; + Left := 8; + Top := 8; + Width := 305; + Height := 201; + ItemHeight := 13; + Sorted := true; + TabOrder := 0; + end; + with btnSelectAll do + begin + Name := 'btnSelectAll'; + Parent := Self; + Left := 320; + Top := 8; + Width := 75; + Height := 25; + Caption := '&Select All'; + TabOrder := 1; + OnClick := SelectAll; + end; + with btnDeselectAll do + begin + Name := 'btnDeselectAll'; + Parent := Self; + Left := 320; + Top := 40; + Width := 75; + Height := 25; + Caption := '&Deselect All'; + TabOrder := 2; + OnClick := DeselectAll; + end; + with btnOK do + begin + Name := 'btnOK'; + Parent := Self; + Left := 320; + Top := 152; + Width := 75; + Height := 25; + Caption := 'OK'; + Default := True; + ModalResult := 1; + TabOrder := 3; + end; + with btnCancel do + begin + Name := 'btnCancel'; + Parent := Self; + Left := 320; + Top := 184; + Width := 75; + Height := 25; + Caption := 'Cancel'; + ModalResult := 2; + TabOrder := 4; + end; + LoadForm; +end; + +procedure TSynHighlighterForm.DeselectAll(Sender: TObject); +var + i: integer; +begin + for i := 0 to clbHighlighters.Items.Count-1 do + clbHighlighters.Checked[i] := false; +end; + +procedure TSynHighlighterForm.LoadForm; +var + i: integer; +begin + clbHighlighters.Clear; + for i := 0 to Highlight.Count-1 do begin + clbHighlighters.Items.Add(Highlight[i].GetFriendlyLanguageName); + end; //for +end; + +procedure TSynHighlighterForm.SelectAll(Sender: TObject); +var + i: integer; +begin + for i := 0 to clbHighlighters.Items.Count-1 do + clbHighlighters.Checked[i] := true; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterModelica.pas b/Source/VCL/SynEdit/Source/SynHighlighterModelica.pas index e3affadc..1579478a 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterModelica.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterModelica.pas @@ -1,641 +1,643 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterModelica.pas, released 2000-11-09. -The Initial Author of this file is Falko Jens Wagner. -Portions created by Falko Jens Wagner are Copyright 2000 Falko Jens Wagner. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynHighlighterModelica.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynHighlighterModelica; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown); - - TRangeState = (rsUnknown, rsString39, rsString34, rsComment); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynModelicaSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..96] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fDirectiveAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AndSymbolProc; - procedure AsciiCharProc; - procedure CRProc; - procedure ColonProc; - procedure DirectiveProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure SymbolProc; - procedure SymbolProcWithEqual; - procedure UnknownProc; - procedure AnsiCProc; - procedure String34Proc; - procedure String39Proc; - protected - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property DirectiveAttri: TSynHighlighterAttributes read fDirectiveAttri - write fDirectiveAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..47] of string = ( - 'algorithm', 'and', 'annotation', 'assert', 'block', 'Boolean', 'class', - 'connect', 'connector', 'constant', 'der', 'discrete', 'else', 'elseif', - 'end', 'equation', 'extends', 'external', 'false', 'final', 'flow', 'for', - 'function', 'if', 'in', 'input', 'Integer', 'loop', 'model', 'nondiscrete', - 'not', 'or', 'output', 'package', 'parameter', 'partial', 'protected', - 'public', 'Real', 'record', 'redeclare', 'replaceable', 'terminate', 'then', - 'true', 'type', 'when', 'while' - ); - - KeyIndices: array[0..96] of Integer = ( - -1, 8, 41, 46, -1, 21, -1, 30, 5, -1, 45, -1, -1, 23, 7, -1, -1, 17, 15, -1, - -1, 10, -1, -1, -1, 3, -1, 18, -1, 28, -1, -1, 47, -1, -1, -1, -1, -1, 39, - 16, 27, 25, -1, 4, 22, -1, 43, -1, 37, 40, -1, -1, 31, -1, 42, -1, -1, 26, - 14, 24, 44, -1, -1, -1, -1, 11, 33, 0, -1, -1, -1, -1, 36, 19, -1, 38, -1, - 32, -1, -1, 29, -1, -1, -1, 6, 35, 12, 1, -1, -1, -1, 20, 34, -1, 13, 9, 2 - ); - -{$Q-} -function TSynModelicaSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 598 + Ord(Str^) * 127; - inc(Str); - end; - Result := Result mod 97; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynModelicaSyn.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 TSynModelicaSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynModelicaSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynModelicaSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -constructor TSynModelicaSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - AddAttribute(fDirectiveAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterModelica; - fRange := rsUnknown; -end; - -procedure TSynModelicaSyn.AndSymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if CharInSet(fLine[Run], ['=', '&']) then - Inc(Run); -end; - -procedure TSynModelicaSyn.AsciiCharProc; -begin - fRange := rsString39; - fTokenID := tkString; - repeat - Inc(Run); - until IsLineEnd(Run) or (fLine[Run] = #39); - if fLine[Run] = #39 then - begin - fRange := rsUnknown; - Inc(Run); - end; -end; - -procedure TSynModelicaSyn.CRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then - Inc(Run); -end; - -procedure TSynModelicaSyn.ColonProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if fLine[Run] = ':' then - Inc(Run); -end; - -procedure TSynModelicaSyn.DirectiveProc; -begin - fTokenID := tkDirective; - repeat - Inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynModelicaSyn.GreaterProc; -begin - Inc(Run); - fTokenID := tkSymbol; - case fLine[Run] of - '=': Inc(Run); - '>': begin - Inc(Run); - if fLine[Run] = '=' then - Inc(Run); - end; - end; -end; - -procedure TSynModelicaSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynModelicaSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynModelicaSyn.LowerProc; -begin - Inc(Run); - fTokenID := tkSymbol; - case fLine[Run] of - '=': Inc(Run); - '<': begin - Inc(Run); - if fLine[Run] = '=' then - Inc(Run); - end; - end; -end; - -procedure TSynModelicaSyn.MinusProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if CharInSet(fLine[Run], ['=', '-', '>']) then - Inc(Run); -end; - -procedure TSynModelicaSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynModelicaSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynModelicaSyn.OrSymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if CharInSet(fLine[Run], ['=', '|']) then - Inc(Run); -end; - -procedure TSynModelicaSyn.PlusProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if CharInSet(fLine[Run], ['=', '+']) then - Inc(Run); -end; - -procedure TSynModelicaSyn.PointProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then - Inc(Run, 2); -end; - -procedure TSynModelicaSyn.SlashProc; -begin - Inc(Run); - case fLine[Run] of - '/': - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end; - '*': - begin - fRange := rsComment; - inc(Run); - if IsLineEnd(Run) then - fTokenID := tkComment - else - AnsiCProc; - end; - else - fTokenID := tkSymbol; - if fLine[Run] = '=' then - Inc(Run); - end; -end; - -procedure TSynModelicaSyn.SpaceProc; -begin - fTokenID := tkSpace; - repeat - Inc(Run); - until (fLine[Run] > #32) or IsLineEnd(Run); -end; - -procedure TSynModelicaSyn.StringProc; -begin - fRange := rsString34; - Inc(Run); - if IsLineEnd(Run) then - fTokenID := tkString - else - String34Proc; -end; - -procedure TSynModelicaSyn.SymbolProc; -begin - Inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynModelicaSyn.SymbolProcWithEqual; -begin - Inc(Run); - fTokenID := tkSymbol; - if fLine[Run] = '=' then - Inc(Run); -end; - -procedure TSynModelicaSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynModelicaSyn.AnsiCProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - fTokenID := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - inc(Run, 2); - fRange := rsUnknown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynModelicaSyn.String39Proc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - fTokenID := tkString; - repeat - if fLine[Run] = #39 then begin - inc(Run); - fRange := rsUnknown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynModelicaSyn.String34Proc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - fTokenID := tkString; - repeat - case fLine[Run] of - #34: - begin - Inc(Run); - fRange := rsUnknown; - break; - end; - #92: - begin - Inc(Run); - if fLine[Run] = #34 then - Inc(Run); - end; - else - Inc(Run); - end; - until IsLineEnd(Run); - end; -end; - -procedure TSynModelicaSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: AnsiCProc; - rsString39: String39Proc; - rsString34: String34Proc; - else - fRange := rsUnknown; - case fLine[Run] of - '&': AndSymbolProc; - #39: AsciiCharProc; - #13: CRProc; - ':': ColonProc; - '#': DirectiveProc; - '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': MinusProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #34: StringProc; - '~', '[', ']', '@', '{', '}', '(', ')', ';', ',': SymbolProc; - '*', '^', '=', '%', '!': SymbolProcWithEqual; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynModelicaSyn.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 TSynModelicaSyn.GetEol: boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynModelicaSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynModelicaSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynModelicaSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkDirective: Result := fDirectiveAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynModelicaSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynModelicaSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynModelicaSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynModelicaSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterModelica; -end; - -class function TSynModelicaSyn.GetLanguageName: string; -begin - Result := SYNS_LangModelica; -end; - -class function TSynModelicaSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangModelica; -end; - -initialization - RegisterPlaceableHighlighter(TSynModelicaSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterModelica.pas, released 2000-11-09. +The Initial Author of this file is Falko Jens Wagner. +Portions created by Falko Jens Wagner are Copyright 2000 Falko Jens Wagner. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynHighlighterModelica.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynHighlighterModelica; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber, + tkSpace, tkString, tkSymbol, tkUnknown); + + TRangeState = (rsUnknown, rsString39, rsString34, rsComment); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynModelicaSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..96] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FDirectiveAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AndSymbolProc; + procedure AsciiCharProc; + procedure CRProc; + procedure ColonProc; + procedure DirectiveProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure SymbolProc; + procedure SymbolProcWithEqual; + procedure UnknownProc; + procedure AnsiCProc; + procedure String34Proc; + procedure String39Proc; + protected + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property DirectiveAttri: TSynHighlighterAttributes read FDirectiveAttri + write FDirectiveAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..47] of UnicodeString = ( + 'algorithm', 'and', 'annotation', 'assert', 'block', 'Boolean', 'class', + 'connect', 'connector', 'constant', 'der', 'discrete', 'else', 'elseif', + 'end', 'equation', 'extends', 'external', 'false', 'final', 'flow', 'for', + 'function', 'if', 'in', 'input', 'Integer', 'loop', 'model', 'nondiscrete', + 'not', 'or', 'output', 'package', 'parameter', 'partial', 'protected', + 'public', 'Real', 'record', 'redeclare', 'replaceable', 'terminate', 'then', + 'true', 'type', 'when', 'while' + ); + + KeyIndices: array[0..96] of Integer = ( + -1, 8, 41, 46, -1, 21, -1, 30, 5, -1, 45, -1, -1, 23, 7, -1, -1, 17, 15, -1, + -1, 10, -1, -1, -1, 3, -1, 18, -1, 28, -1, -1, 47, -1, -1, -1, -1, -1, 39, + 16, 27, 25, -1, 4, 22, -1, 43, -1, 37, 40, -1, -1, 31, -1, 42, -1, -1, 26, + 14, 24, 44, -1, -1, -1, -1, 11, 33, 0, -1, -1, -1, -1, 36, 19, -1, 38, -1, + 32, -1, -1, 29, -1, -1, -1, 6, 35, 12, 1, -1, -1, -1, 20, 34, -1, 13, 9, 2 + ); + +{$Q-} +function TSynModelicaSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 598 + Ord(Str^) * 127; + Inc(Str); + end; + Result := Result mod 97; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynModelicaSyn.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 TSynModelicaSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynModelicaSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynModelicaSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +constructor TSynModelicaSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + AddAttribute(FDirectiveAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterModelica; + FRange := rsUnknown; +end; + +procedure TSynModelicaSyn.AndSymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if CharInSet(FLine[Run], ['=', '&']) then + Inc(Run); +end; + +procedure TSynModelicaSyn.AsciiCharProc; +begin + FRange := rsString39; + FTokenID := tkString; + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = #39); + if FLine[Run] = #39 then + begin + FRange := rsUnknown; + Inc(Run); + end; +end; + +procedure TSynModelicaSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynModelicaSyn.ColonProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if FLine[Run] = ':' then + Inc(Run); +end; + +procedure TSynModelicaSyn.DirectiveProc; +begin + FTokenID := tkDirective; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynModelicaSyn.GreaterProc; +begin + Inc(Run); + FTokenID := tkSymbol; + case FLine[Run] of + '=': Inc(Run); + '>': begin + Inc(Run); + if FLine[Run] = '=' then + Inc(Run); + end; + end; +end; + +procedure TSynModelicaSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynModelicaSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynModelicaSyn.LowerProc; +begin + Inc(Run); + FTokenID := tkSymbol; + case FLine[Run] of + '=': Inc(Run); + '<': begin + Inc(Run); + if FLine[Run] = '=' then + Inc(Run); + end; + end; +end; + +procedure TSynModelicaSyn.MinusProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if CharInSet(FLine[Run], ['=', '-', '>']) then + Inc(Run); +end; + +procedure TSynModelicaSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynModelicaSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynModelicaSyn.OrSymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if CharInSet(FLine[Run], ['=', '|']) then + Inc(Run); +end; + +procedure TSynModelicaSyn.PlusProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if CharInSet(FLine[Run], ['=', '+']) then + Inc(Run); +end; + +procedure TSynModelicaSyn.PointProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then + Inc(Run, 2); +end; + +procedure TSynModelicaSyn.SlashProc; +begin + Inc(Run); + case FLine[Run] of + '/': + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; + '*': + begin + FRange := rsComment; + Inc(Run); + if IsLineEnd(Run) then + FTokenID := tkComment + else + AnsiCProc; + end; + else + FTokenID := tkSymbol; + if FLine[Run] = '=' then + Inc(Run); + end; +end; + +procedure TSynModelicaSyn.SpaceProc; +begin + FTokenID := tkSpace; + repeat + Inc(Run); + until (FLine[Run] > #32) or IsLineEnd(Run); +end; + +procedure TSynModelicaSyn.StringProc; +begin + FRange := rsString34; + Inc(Run); + if IsLineEnd(Run) then + FTokenID := tkString + else + String34Proc; +end; + +procedure TSynModelicaSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynModelicaSyn.SymbolProcWithEqual; +begin + Inc(Run); + FTokenID := tkSymbol; + if FLine[Run] = '=' then + Inc(Run); +end; + +procedure TSynModelicaSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynModelicaSyn.AnsiCProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynModelicaSyn.String39Proc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkString; + repeat + if FLine[Run] = #39 then begin + Inc(Run); + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynModelicaSyn.String34Proc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkString; + repeat + case FLine[Run] of + #34: + begin + Inc(Run); + FRange := rsUnknown; + Break; + end; + #92: + begin + Inc(Run); + if FLine[Run] = #34 then + Inc(Run); + end; + else + Inc(Run); + end; + until IsLineEnd(Run); + end; +end; + +procedure TSynModelicaSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: AnsiCProc; + rsString39: String39Proc; + rsString34: String34Proc; + else + FRange := rsUnknown; + case FLine[Run] of + '&': AndSymbolProc; + #39: AsciiCharProc; + #13: CRProc; + ':': ColonProc; + '#': DirectiveProc; + '>': GreaterProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + '-': MinusProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #34: StringProc; + '~', '[', ']', '@', '{', '}', '(', ')', ';', ',': SymbolProc; + '*', '^', '=', '%', '!': SymbolProcWithEqual; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynModelicaSyn.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 TSynModelicaSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynModelicaSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynModelicaSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynModelicaSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkDirective: Result := FDirectiveAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynModelicaSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynModelicaSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynModelicaSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynModelicaSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterModelica; +end; + +class function TSynModelicaSyn.GetLanguageName: string; +begin + Result := SYNS_LangModelica; +end; + +class function TSynModelicaSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangModelica; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynModelicaSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterMsg.pas b/Source/VCL/SynEdit/Source/SynHighlighterMsg.pas index e7d09721..948e0399 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterMsg.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterMsg.pas @@ -1,522 +1,524 @@ -{------------------------------------------------------------------------------- -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: SynHighlighterMsg.pas, released 2001-10-03. -Description: SynGen Msg file highlighter -The initial author of this file is P.L. Polak. -Copyright (c) 2001, all rights reserved. -Unicode translation by Maël Hörz. - -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: SynHighlighterMsg.pas,v 1.8.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -unit SynHighlighterMsg; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = ( - tkComment, - tkIdentifier, - tkKey, - tkNull, - tkSpace, - tkString, - tkSymbol, - tkTerminator, - tkUnknown); - - TRangeState = (rsUnKnown, rsBraceComment, rsString); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynMsgSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..6] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fTerminatorAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncBeginproc(Index: Integer): TtkTokenKind; - function FuncChars(Index: Integer): TtkTokenKind; - function FuncEnclosedby(Index: Integer): TtkTokenKind; - function FuncEndproc(Index: Integer): TtkTokenKind; - function FuncKeys(Index: Integer): TtkTokenKind; - function FuncSamplesource(Index: Integer): TtkTokenKind; - function FuncTokentypes(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure IdentProc; - procedure SymbolProc; - procedure TerminatorProc; - procedure UnknownProc; - procedure NullProc; - procedure SpaceProc; - procedure CRProc; - procedure LFProc; - procedure BraceCommentOpenProc; - procedure BraceCommentProc; - procedure StringOpenProc; - procedure StringProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - constructor Create(AOwner: TComponent); override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: 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 GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; - property TerminatorAttri: TSynHighlighterAttributes read fTerminatorAttri write fTerminatorAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..6] of string = ( - 'beginproc', 'chars', 'enclosedby', 'endproc', 'keys', 'samplesource', - 'tokentypes' - ); - - KeyIndices: array[0..6] of Integer = ( - 2, 1, 6, 4, 0, 5, 3 - ); - -{$Q-} -function TSynMsgSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 182 + Ord(Str^); - inc(Str); - end; - Result := Result mod 7; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynMsgSyn.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 TSynMsgSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[4] := FuncBeginproc; - fIdentFuncTable[1] := FuncChars; - fIdentFuncTable[0] := FuncEnclosedby; - fIdentFuncTable[6] := FuncEndproc; - fIdentFuncTable[3] := FuncKeys; - fIdentFuncTable[5] := FuncSamplesource; - fIdentFuncTable[2] := FuncTokentypes; -end; - -function TSynMsgSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncBeginproc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncChars(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncEnclosedby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncEndproc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncKeys(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncSamplesource(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynMsgSyn.FuncTokentypes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -procedure TSynMsgSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynMsgSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynMsgSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then - inc(Run); -end; - -procedure TSynMsgSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynMsgSyn.BraceCommentOpenProc; -begin - Inc(Run); - fRange := rsBraceComment; - BraceCommentProc; - fTokenID := tkComment; -end; - -procedure TSynMsgSyn.BraceCommentProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - begin - fTokenID := tkComment; - 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 TSynMsgSyn.StringOpenProc; -begin - Inc(Run); - fRange := rsString; - StringProc; - fTokenID := tkString; -end; - -procedure TSynMsgSyn.StringProc; -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; - -constructor TSynMsgSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clNavy; - AddAttribute(fCommentAttri); - - fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - - fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - - fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - - fTerminatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrTerminator, SYNS_FriendlyAttrTerminator); - AddAttribute(fTerminatorAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterSynGenMsgfiles; - fRange := rsUnknown; -end; - -procedure TSynMsgSyn.IdentProc; -begin - fTokenID := IdentKind(fLine + Run); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); -end; - -procedure TSynMsgSyn.SymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynMsgSyn.TerminatorProc; -begin - Inc(Run); - if (fLine[Run] = '>') and (fLine[Run + 1] = '<') and (fLine[Run + 2] = '|') then - begin - fTokenID := tkTerminator; - Inc(Run, 3); - end - else - fTokenID := tkSymbol; -end; - -procedure TSynMsgSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynMsgSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsBraceComment: BraceCommentProc; - else - begin - fRange := rsUnknown; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - '{': BraceCommentOpenProc; - '''': StringOpenProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '-', '+', '*', '/', '\', ',', '"', '[', ']', ':', ';': SymbolProc; - '|': TerminatorProc; - else UnknownProc; - end; - end; - end; - inherited; -end; - -function TSynMsgSyn.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 TSynMsgSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynMsgSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynMsgSyn.GetTokenAttribute: TSynHighLighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkTerminator: Result := fTerminatorAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynMsgSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynMsgSyn.GetSampleSource: string; -begin - Result := 'TSynSampleSyn {first identifier is the class name }'#13#10 + - 'tk {second identifier is the prefix }'#13#10 + - 'IdentStart ''a''..''z'':: ''a''..''z''::'#13#10 + - 'KEYS'#13#10 + - 'Sample'#13#10 + - 'Source'#13#10 + - '|><|'; -end; - -function TSynMsgSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterSynGenMsgfiles; -end; - -function TSynMsgSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '_', 'A'..'Z', 'a'..'z': - Result := True; - else - Result := False; - end; -end; - -class function TSynMsgSyn.GetLanguageName: string; -begin - Result := SYNS_LangSynGenMsgfiles; -end; - -procedure TSynMsgSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynMsgSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynMsgSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -class function TSynMsgSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangSynGenMsgfiles; -end; - -initialization - RegisterPlaceableHighlighter(TSynMsgSyn); -end. +{------------------------------------------------------------------------------- +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: SynHighlighterMsg.pas, released 2001-10-03. +Description: SynGen Msg file highlighter +The initial author of this file is P.L. Polak. +Copyright (c) 2001, all rights reserved. +Unicode translation by Maël Hörz. + +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: SynHighlighterMsg.pas,v 1.8.2.6 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +unit SynHighlighterMsg; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkComment, + tkIdentifier, + tkKey, + tkNull, + tkSpace, + tkString, + tkSymbol, + tkTerminator, + tkUnknown); + + TRangeState = (rsUnknown, rsBraceComment, rsString); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynMsgSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..6] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FTerminatorAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function FuncBeginproc(Index: Integer): TtkTokenKind; + function FuncChars(Index: Integer): TtkTokenKind; + function FuncEnclosedby(Index: Integer): TtkTokenKind; + function FuncEndproc(Index: Integer): TtkTokenKind; + function FuncKeys(Index: Integer): TtkTokenKind; + function FuncSamplesource(Index: Integer): TtkTokenKind; + function FuncTokentypes(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure IdentProc; + procedure SymbolProc; + procedure TerminatorProc; + procedure UnknownProc; + procedure NullProc; + procedure SpaceProc; + procedure CRProc; + procedure LFProc; + procedure BraceCommentOpenProc; + procedure BraceCommentProc; + procedure StringOpenProc; + procedure StringProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + constructor Create(AOwner: TComponent); override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + property TerminatorAttri: TSynHighlighterAttributes read FTerminatorAttri write FTerminatorAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..6] of UnicodeString = ( + 'beginproc', 'chars', 'enclosedby', 'endproc', 'keys', 'samplesource', + 'tokentypes' + ); + + KeyIndices: array[0..6] of Integer = ( + 2, 1, 6, 4, 0, 5, 3 + ); + +{$Q-} +function TSynMsgSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 182 + Ord(Str^); + Inc(Str); + end; + Result := Result mod 7; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynMsgSyn.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 TSynMsgSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[4] := FuncBeginproc; + FIdentFuncTable[1] := FuncChars; + FIdentFuncTable[0] := FuncEnclosedby; + FIdentFuncTable[6] := FuncEndproc; + FIdentFuncTable[3] := FuncKeys; + FIdentFuncTable[5] := FuncSamplesource; + FIdentFuncTable[2] := FuncTokentypes; +end; + +function TSynMsgSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncBeginproc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncChars(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncEnclosedby(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncEndproc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncKeys(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncSamplesource(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynMsgSyn.FuncTokentypes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +procedure TSynMsgSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynMsgSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynMsgSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynMsgSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynMsgSyn.BraceCommentOpenProc; +begin + Inc(Run); + FRange := rsBraceComment; + BraceCommentProc; + FTokenID := tkComment; +end; + +procedure TSynMsgSyn.BraceCommentProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + FTokenID := tkComment; + 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 TSynMsgSyn.StringOpenProc; +begin + Inc(Run); + FRange := rsString; + StringProc; + FTokenID := tkString; +end; + +procedure TSynMsgSyn.StringProc; +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; + +constructor TSynMsgSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clNavy; + AddAttribute(FCommentAttri); + + FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + + FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + + FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + + FTerminatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrTerminator, SYNS_FriendlyAttrTerminator); + AddAttribute(FTerminatorAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterSynGenMsgfiles; + FRange := rsUnknown; +end; + +procedure TSynMsgSyn.IdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynMsgSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynMsgSyn.TerminatorProc; +begin + Inc(Run); + if (FLine[Run] = '>') and (FLine[Run + 1] = '<') and (FLine[Run + 2] = '|') then + begin + FTokenID := tkTerminator; + Inc(Run, 3); + end + else + FTokenID := tkSymbol; +end; + +procedure TSynMsgSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynMsgSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsBraceComment: BraceCommentProc; + else + begin + FRange := rsUnknown; + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + '{': BraceCommentOpenProc; + '''': StringOpenProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '-', '+', '*', '/', '\', ',', '"', '[', ']', ':', ';': SymbolProc; + '|': TerminatorProc; + else UnknownProc; + end; + end; + end; + inherited; +end; + +function TSynMsgSyn.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 TSynMsgSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynMsgSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynMsgSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkTerminator: Result := FTerminatorAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynMsgSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynMsgSyn.GetSampleSource: UnicodeString; +begin + Result := 'TSynSampleSyn {first identifier is the class name }'#13#10 + + 'tk {second identifier is the prefix }'#13#10 + + 'IdentStart ''a''..''z'':: ''a''..''z''::'#13#10 + + 'KEYS'#13#10 + + 'Sample'#13#10 + + 'Source'#13#10 + + '|><|'; +end; + +function TSynMsgSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterSynGenMsgfiles; +end; + +function TSynMsgSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '_', 'A'..'Z', 'a'..'z': + Result := True; + else + Result := False; + end; +end; + +class function TSynMsgSyn.GetLanguageName: string; +begin + Result := SYNS_LangSynGenMsgfiles; +end; + +procedure TSynMsgSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynMsgSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynMsgSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +class function TSynMsgSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangSynGenMsgfiles; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynMsgSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterMulti.pas b/Source/VCL/SynEdit/Source/SynHighlighterMulti.pas index 7d6f098c..206d2fd9 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterMulti.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterMulti.pas @@ -1,1081 +1,1113 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterMulti.pas, released 2000-06-23. -The Original Code is based on mwMultiSyn.pas by Willo van der Merwe, part of the -mwEdit component suite. -Unicode translation by Maël Hörz. - -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: SynHighlighterMulti.pas,v 1.34.2.11 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Multiple-highlighter syntax highlighter for SynEdit) -@author(Willo van der Merwe , converted to SynEdit by David Muir ) -@created(1999, converted to SynEdit 2000-06-23) -@lastmod(2000-06-23) -The SynHighlighterMulti unit provides SynEdit with a multiple-highlighter syntax highlighter. -This highlighter can be used to highlight text in which several languages are present, such as HTML. -For example, in HTML as well as HTML tags there can also be JavaScript and/or VBScript present. -} - -unit SynHighlighterMulti; - -{$I SynEdit.inc} - -interface - -uses - Windows, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - Classes; - -type - TOnCheckMarker = procedure (Sender: TObject; var StartPos, MarkerLen: Integer; - var MarkerText: string; Line: Integer; const LineStr: string) of object; - - TScheme = class(TCollectionItem) - private - fEndExpr: string; - fStartExpr: string; - fHighlighter: TSynCustomHighLighter; - fMarkerAttri: TSynHighlighterAttributes; - fSchemeName: TComponentName; - fCaseSensitive: Boolean; - fOnCheckStartMarker: TOnCheckMarker; - fOnCheckEndMarker: TOnCheckMarker; - function ConvertExpression(const Value: string): string; - procedure MarkerAttriChanged(Sender: TObject); - procedure SetMarkerAttri(const Value: TSynHighlighterAttributes); - procedure SetHighlighter(const Value: TSynCustomHighlighter); - procedure SetEndExpr(const Value: string); - procedure SetStartExpr(const Value: string); - procedure SetCaseSensitive(const Value: Boolean); - protected - procedure DefineProperties(Filer: TFiler); override; - function GetDisplayName: string; override; - procedure SetDisplayName(const Value: string); override; - public - constructor Create(Collection: TCollection); override; - destructor Destroy; override; - published - property CaseSensitive: Boolean read fCaseSensitive write SetCaseSensitive - default True; - property StartExpr: string read fStartExpr write SetStartExpr; - property EndExpr: string read fEndExpr write SetEndExpr; - property Highlighter: TSynCustomHighlighter read fHighlighter - write SetHighlighter; - property MarkerAttri: TSynHighlighterAttributes read fMarkerAttri - write SetMarkerAttri; - property SchemeName: TComponentName read fSchemeName write fSchemeName; - property OnCheckStartMarker: TOnCheckMarker read fOnCheckStartMarker write fOnCheckStartMarker; - property OnCheckEndMarker: TOnCheckMarker read fOnCheckEndMarker write fOnCheckEndMarker; - end; - - TgmSchemeClass = class of TScheme; - - TSynMultiSyn = class; - - TSchemes = class(TCollection) - private - fOwner: TSynMultiSyn; - function GetItems(Index: integer): TScheme; - procedure SetItems(Index: integer; const Value: TScheme); - protected - function GetOwner: TPersistent; override; - procedure Update(Item: TCollectionItem); override; - public - constructor Create(aOwner: TSynMultiSyn); - property Items[aIndex: integer]: TScheme read GetItems write SetItems; - default; - end; - - TMarker = class - protected - fScheme: Integer; - fStartPos: Integer; - fMarkerLen: Integer; - fMarkerText: string; - fIsOpenMarker: Boolean; - public - constructor Create(aScheme, aStartPos, aMarkerLen: Integer; - aIsOpenMarker: Boolean; const aMarkerText: string); - end; - - - TRangeOperation = (roGet, roSet); - - TRangeUNativeInt = NativeUInt; - TRangeProc = procedure (Operation: TRangeOperation; var Range: TRangeUNativeInt) of object; - - TCustomRangeEvent = procedure (Sender: TSynMultiSyn; Operation: TRangeOperation; - var Range: pointer) of object; - - { - * Usage notes * - If you don't need to nest MultiSyns as Schemes, just as DefaultHighlighter, - you can nest up to 2 MultiSyns, each of them containing up to 7 Schemes. This - is the way MultiSyn works best. (implemented in NewRangeProc) - If you need to use a MultiSyn nested as Scheme, then you can nest up to - 5 MultiSyns, but Ranges aren't persisted across occurrences of Schemes that - have multiple lines. (implemented in OldRangeProc) - Clarification: when I say "you can nest up to X" MultiSyns, I mean having - X+1 levels of MultiSyns. - - MultiSyn doesn't work by default with dynamic highlighters; you must use - OnCustomRange. This is because dynamic highlighters' Ranges are pointers, - but MultiSyn needs Ranges to be ordinal values smaller than 16 (4 bits). - - OnCustomRange: - When Operation is roGet, user should store in the 'Range' parameter the - information to allow restoring the current state of the highlighter. - When Operation is roSet, user should restore highlighter state (CurrScheme, - DefaultHighlighter.Range and, if the case, Schemes[CurrScheme].Range) - according to 'Range' value. - CurrScheme: - Index of the scheme that is currently parsing. DefaultHighlighter maps to -1. - - * Implementation notes * - fTmpRange: - Using the OldRangeProc, fTmpRange was the only way to restore the Range - of the DefaultHighlighter after a Scheme spanned across multiple lines. - With the NewRangeProc, the only use for it is restoring DefaultHighLighter's - Range in case a nested MultiSyn uses the highlighter too. - } - - TSynMultiSyn = class(TSynCustomHighlighter) - private - fRangeProc: TRangeProc; - fDefaultLanguageName: string; - fMarkers: TList; - fMarker: TMarker; - fNextMarker: integer; - fCurrScheme: integer; - fTmpRange: pointer; - fOnCustomRange: TCustomRangeEvent; - fLineStr: string; - procedure SetDefaultHighlighter(const Value: TSynCustomHighLighter); - function GetMarkers(Index: Integer): TMarker; - property Markers[Index: Integer]: TMarker read GetMarkers; - procedure DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; - const MarkerText: string; Start: Boolean; Line: Integer; - const LineStr: string); - procedure SetOnCustomRange(const Value: TCustomRangeEvent); - protected - fSchemes: TSchemes; - fDefaultHighlighter: TSynCustomHighLighter; - fLineNumber: Integer; - fSampleSource: string; - procedure Loaded; override; - procedure SetSchemes(const Value: TSchemes); - procedure ClearMarkers; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; override; - function GetAttribCount: integer; override; - function GetAttribute(Index: integer): TSynHighlighterAttributes; override; - procedure HookHighlighter(aHL: TSynCustomHighlighter); - procedure UnhookHighlighter(aHL: TSynCustomHighlighter); - procedure Notification(aComp: TComponent; aOp: TOperation); override; - function GetSampleSource: string; override; - procedure SetSampleSource(Value: string); override; - procedure DoSetLine(const Value: string; LineNumber: Integer); override; - // - procedure OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); - procedure NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); - procedure UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetEol: Boolean; override; - function GetExpandedToken: string; override; - function GetRange: Pointer; override; - function GetToken: string; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - function UpdateRangeProcs: Boolean; - property CurrScheme: Integer read fCurrScheme write fCurrScheme; - property CurrLine: string read fLineStr; - function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; - function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - published - property Schemes: TSchemes read fSchemes write SetSchemes; - property DefaultHighlighter: TSynCustomHighLighter read fDefaultHighlighter - write SetDefaultHighlighter; - property DefaultLanguageName: string read fDefaultLanguageName - write fDefaultLanguageName; - property OnCustomRange: TCustomRangeEvent read fOnCustomRange write SetOnCustomRange; - end; - -implementation - -uses - Graphics, - SynEditMiscProcs, - SynEditStrConst, - RegularExpressions, - SysUtils; - -procedure CheckExpression(const Expr: string); -var - Parser: TRegEx; -begin - // will raise an exception if the expression is incorrect - Parser := TRegEx.Create(Expr, [roNotEmpty, roCompiled]); -end; - -{ TMarker } - -constructor TMarker.Create(aScheme, aStartPos, - aMarkerLen: Integer; aIsOpenMarker: Boolean; const aMarkerText: string); -begin - fScheme := aScheme; - fStartPos := aStartPos; - fMarkerLen := aMarkerLen; - fIsOpenMarker := aIsOpenMarker; - fMarkerText := aMarkerText; -end; - -{ TSynMultiSyn } - -procedure TSynMultiSyn.ClearMarkers; -var - i: Integer; -begin - for i := 0 to fMarkers.Count - 1 do - TObject(fMarkers[i]).Free; - fMarkers.Clear; -end; - -constructor TSynMultiSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fSchemes := TSchemes.Create(Self); - fCurrScheme := -1; - fMarkers := TList.Create; - fRangeProc := NewRangeProc; -end; - -destructor TSynMultiSyn.Destroy; -begin - ClearMarkers; - { unhook notification handlers } - Schemes.Clear; - DefaultHighlighter := nil; - inherited Destroy; - fSchemes.Free; - fMarkers.Free; -end; - -function TSynMultiSyn.GetAttribCount: Integer; -var - i: Integer; -begin - Result := Schemes.Count; - if DefaultHighlighter <> nil then - Inc(Result, DefaultHighlighter.AttrCount); - for i := 0 to Schemes.Count - 1 do - if Schemes[i].Highlighter <> nil then - Inc(Result, Schemes[i].Highlighter.AttrCount); -end; - -function TSynMultiSyn.GetAttribute(Index: Integer): TSynHighlighterAttributes; -var - i: Integer; - HL: TSynCustomHighlighter; -begin - if Index < Schemes.Count then - Result := Schemes[Index].MarkerAttri - else - begin - Dec(Index, Schemes.Count); - if DefaultHighlighter <> nil then - if Index < DefaultHighlighter.AttrCount then - begin - Result := DefaultHighlighter.Attribute[Index]; - Exit; - end - else - Dec(Index, DefaultHighlighter.AttrCount); - for i := 0 to Schemes.Count - 1 do - begin - HL := Schemes[i].Highlighter; - if HL <> nil then - if Index < HL.AttrCount then - begin - Result := HL.Attribute[Index]; - Exit; - end - else - Dec(Index, HL.AttrCount); - end; - Result := nil; - end; -end; - -function TSynMultiSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; -var - HL: TSynCustomHighlighter; -begin - if (CurrScheme >= 0) and (Schemes[CurrScheme].Highlighter <> nil) then - HL := Schemes[CurrScheme].Highlighter - else - HL := DefaultHighlighter; - { the typecast to TSynMultiSyn is only necessary because the - GetDefaultAttribute method is protected. - And don't worry: this really works } - if HL <> nil then - Result := TSynMultiSyn(HL).GetDefaultAttribute(Index) - else - Result := nil; -end; - -function TSynMultiSyn.GetEol: Boolean; -begin - if fMarker <> nil then - Result := False - else if fCurrScheme >= 0 then - Result := Schemes[CurrScheme].Highlighter.GetEol - else if DefaultHighlighter <> nil then - Result := DefaultHighlighter.GetEol - else - Result := Run > fLineLen + 1; -end; - -class function TSynMultiSyn.GetLanguageName: string; -begin - Result := SYNS_LangGeneralMulti; -end; - -function TSynMultiSyn.GetMarkers(Index: integer): TMarker; -begin - Result := TMarker(fMarkers[Index]); -end; - -procedure TSynMultiSyn.OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); -const - MaxNestedMultiSyn = 6; - { number of bits of the Range that will be used to store the SchemeIndex } - SchemeIndexSize = 4; - MaxSchemeCount = (1 shl SchemeIndexSize) - 1; - { number of bits of the Range that will be used to store the SchemeRange } - SchemeRangeSize = 8; - MaxSchemeRange = (1 shl SchemeRangeSize) - 1; -var - iHL: TSynCustomHighlighter; - iSchemeIndex: cardinal; - iSchemeRange: cardinal; -begin - if Operation = roGet then - begin - if (fCurrScheme < 0) then - iHL := DefaultHighlighter - else - iHL := Schemes[fCurrScheme].Highlighter; - iSchemeIndex := fCurrScheme + 2; - Assert(iSchemeIndex <= MaxSchemeCount); - if iHL <> nil then - begin - iSchemeRange := cardinal(iHL.GetRange); - Assert((iSchemeRange <= MaxSchemeRange) or (iHL is TSynMultiSyn)); - end - else - iSchemeRange := 0; - { checks the limit of nested MultiSyns } - Assert(iSchemeRange shr ((MaxNestedMultiSyn - 1) * SchemeIndexSize + SchemeRangeSize) = 0); - iSchemeRange := (iSchemeRange shl SchemeIndexSize) or iSchemeIndex; - Range := iSchemeRange; - end - else - begin - if Range = 0 then - Exit; - iSchemeRange := cardinal(Range); - fCurrScheme := integer(iSchemeRange and MaxSchemeCount) - 2; - iSchemeRange := iSchemeRange shr SchemeIndexSize; - if (CurrScheme < 0) then - begin - if DefaultHighlighter <> nil then - DefaultHighlighter.SetRange(pointer(iSchemeRange)); - end - else - Schemes[CurrScheme].Highlighter.SetRange(pointer(iSchemeRange)); - end; -end; - -function TSynMultiSyn.GetToken: string; -begin - if DefaultHighlighter = nil then - Result := fLineStr - else - Result := inherited GetToken; -end; - -function TSynMultiSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - if fMarker <> nil then - Result := Schemes[fMarker.fScheme].MarkerAttri - else if CurrScheme >= 0 then - Result := Schemes[CurrScheme].Highlighter.GetTokenAttribute - else if DefaultHighlighter <> nil then - Result := DefaultHighlighter.GetTokenAttribute - else - Result := nil; -end; - -function TSynMultiSyn.GetTokenKind: integer; -begin - if fMarker <> nil then - Result := 0 - else if fCurrScheme >= 0 then - Result := Schemes[fCurrScheme].Highlighter.GetTokenKind - else if DefaultHighlighter <> nil then - Result := DefaultHighlighter.GetTokenKind - else - Result := 0; -end; - -procedure TSynMultiSyn.HookHighlighter(aHL: TSynCustomHighlighter); -begin - aHL.FreeNotification(Self); - aHL.HookAttrChangeEvent(DefHighlightChange); -end; - -procedure TSynMultiSyn.Next; -var - iToken, TmpLine, ExpandedTmpLine: string; - iHL: TSynCustomHighlighter; -begin - if DefaultHighlighter = nil then - begin - if Run > 0 then - Inc(Run) - else - Run := Length(fLineStr) + 1; - inherited; - Exit; - end; - - if (fNextMarker < fMarkers.Count) and (Run + 1 >= Markers[fNextMarker].fStartPos) then - begin - fMarker := Markers[fNextMarker]; - if fMarker.fIsOpenMarker then - begin - fCurrScheme := fMarker.fScheme; - fTmpRange := DefaultHighlighter.GetRange; - Schemes[CurrScheme].Highlighter.ResetRange; - end; - Inc(fNextMarker); - fTokenPos := Run; - Inc(Run, fMarker.fMarkerLen); - inherited; - Exit; - end; - - if Run = 0 then - begin - if CurrScheme >= 0 then - iHL := Schemes[CurrScheme].Highlighter - else - iHL := DefaultHighlighter; - - if fMarkers.Count = 0 then - TmpLine := fLineStr - else - TmpLine := Copy(fLineStr, 1, Markers[fNextMarker].fStartPos - 1); - - if fExpandedLine <> nil then - begin - if fMarkers.Count = 0 then - ExpandedTmpLine := fExpandedLineStr - else - ExpandedTmpLine := Copy(fExpandedLineStr, 1, - PosToExpandedPos(Markers[fNextMarker].fStartPos - 1)); - iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, fLineNumber); - end - else - iHL.SetLine(TmpLine, fLineNumber); - end - else if fMarker <> nil then - begin - if not fMarker.fIsOpenMarker then - begin - fCurrScheme := -1; - DefaultHighlighter.SetRange(fTmpRange); - end; - fMarker := nil; - - if CurrScheme >= 0 then - iHL := Schemes[CurrScheme].Highlighter - else - iHL := DefaultHighlighter; - - if fNextMarker < fMarkers.Count then - TmpLine := Copy(fLineStr, Run + 1, Markers[fNextMarker].fStartPos - Run - 1) - else - TmpLine := Copy(fLineStr, Run + 1, MaxInt); - - if fExpandedLine <> nil then - begin - if fNextMarker < fMarkers.Count then - ExpandedTmpLine := Copy(fExpandedLineStr, ExpandedRun + 1, - PosToExpandedPos(Markers[fNextMarker].fStartPos - Run - 1)) - else - ExpandedTmpLine := Copy(fExpandedLineStr, ExpandedRun + 1, MaxInt); - - iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, fLineNumber); - end - else - iHL.SetLine(TmpLine, fLineNumber); - end - else - begin - if CurrScheme >= 0 then - iHL := Schemes[CurrScheme].Highlighter - else - iHL := DefaultHighlighter; - iHL.Next; - end; - - fTokenPos := iHL.GetTokenPos; - iToken := iHL.GetToken; - if fNextMarker > 0 then - with Markers[fNextMarker - 1] do - Inc(fTokenPos, fStartPos + fMarkerLen - 1); - Inc(Run, (fTokenPos - Run) + Length(iToken)); - inherited; -end; - -procedure TSynMultiSyn.Notification(aComp: TComponent; aOp: TOperation); -var - i: Integer; -begin - inherited; - // 'opRemove' doesn't mean the component is being destroyed. It means it's - // being removed from its Owner's list of Components. - if (aOp = opRemove) and (aComp is TSynCustomHighlighter) and - (csDestroying in aComp.ComponentState) then - begin - if DefaultHighlighter = aComp then - DefaultHighlighter := nil; - for i := 0 to Schemes.Count - 1 do - if Schemes[i].Highlighter = aComp then - Schemes[i].Highlighter := nil; - end; -end; - -procedure TSynMultiSyn.ResetRange; -begin - fCurrScheme := -1; - if DefaultHighlighter <> nil then - begin - DefaultHighlighter.ResetRange; - fTmpRange := DefaultHighlighter.GetRange; - end; -end; - -procedure TSynMultiSyn.SetDefaultHighlighter( - const Value: TSynCustomHighLighter); -const - sDefaultHlSetToSelf = 'A SynMultiSyn cannot be its own DefaultHighlighter.'; -begin - if DefaultHighlighter <> Value then begin - if Value = Self then - raise Exception.Create(sDefaultHlSetToSelf); - if DefaultHighlighter <> nil then - UnhookHighlighter(DefaultHighlighter); - fDefaultHighlighter := Value; - if DefaultHighlighter <> nil then - HookHighlighter(DefaultHighlighter); - DefHighlightChange(Self); - end; -end; - -procedure TSynMultiSyn.DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; - const MarkerText: string; Start: Boolean; Line: Integer; - const LineStr: string); -var - aStartPos: Integer; - aMarkerLen: Integer; - aMarkerText: string; -begin - aStartPos := StartPos; - aMarkerLen := MarkerLen; - aMarkerText := MarkerText; - if Start and Assigned(Scheme.OnCheckStartMarker) then - Scheme.OnCheckStartMarker(Self, aStartPos, aMarkerLen, aMarkerText, Line, LineStr) - else if not Start and Assigned(Scheme.OnCheckEndMarker) then - Scheme.OnCheckEndMarker(Self, aStartPos, aMarkerLen, aMarkerText, Line, LineStr); - if (aMarkerText <> '') and (aMarkerLen > 0) then - begin - fMarkers.Add(TMarker.Create(Scheme.Index, aStartPos, aMarkerLen, Start, - aMarkerText)); - end; -end; - -procedure TSynMultiSyn.SetSchemes(const Value: TSchemes); -begin - fSchemes.Assign(Value); -end; - -procedure TSynMultiSyn.UnhookHighlighter(aHL: TSynCustomHighlighter); -begin - aHL.UnhookAttrChangeEvent(DefHighlightChange); - aHL.RemoveFreeNotification(Self); -end; - -function TSynMultiSyn.GetSampleSource: string; -begin - Result := fSampleSource; -end; - -procedure TSynMultiSyn.SetSampleSource(Value: string); -begin - fSampleSource := Value; -end; - -function TSynMultiSyn.LoadFromRegistry(RootKey: HKEY; - Key: string): Boolean; -var - r: TBetterRegistry; - i: Integer; -begin - if DefaultHighlighter <> nil then - Result := DefaultHighlighter.LoadFromRegistry(RootKey, Key + '\DefaultHighlighter') - else - Result := False; - r := TBetterRegistry.Create; - try - r.RootKey := RootKey; - for i := 0 to Schemes.Count-1 do - if (Schemes[i].SchemeName <> '') and - r.OpenKeyReadOnly(Key + '\' + Schemes[i].SchemeName) then - begin - Result := Schemes[i].MarkerAttri.LoadFromRegistry(r) and Result; - r.CloseKey; - Result := (Schemes[i].Highlighter <> nil) and - Schemes[i].Highlighter.LoadFromRegistry(RootKey, - Key + '\' + Schemes[i].SchemeName) and Result; - end - else - Result := False; - finally - r.Free; - end; -end; - -function TSynMultiSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; -var - r: TBetterRegistry; - i: integer; -begin - if DefaultHighlighter <> nil then - Result := DefaultHighlighter.SaveToRegistry(RootKey, Key + '\DefaultHighlighter') - else - Result := False; - r := TBetterRegistry.Create; - try - r.RootKey := RootKey; - for i := 0 to Schemes.Count-1 do - if (Schemes[i].SchemeName <> '') and - r.OpenKey(Key + '\' + Schemes[i].SchemeName, True) then - begin - Result := Schemes[i].MarkerAttri.SaveToRegistry(r) and Result; - r.CloseKey; - Result := (Schemes[i].Highlighter <> nil) and - Schemes[i].Highlighter.SaveToRegistry(RootKey, - Key + '\' + Schemes[i].SchemeName) and Result; - end - else - Result := False; - finally - r.Free; - end; -end; - -function TSynMultiSyn.GetRange: Pointer; -begin - Result := nil; - fRangeProc(roGet, TRangeUNativeInt(Result)); -end; - -procedure TSynMultiSyn.SetRange(Value: Pointer); -begin - fRangeProc(roSet, TRangeUNativeInt(Value)); -end; - -procedure TSynMultiSyn.NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); -const - SchemeIndexSize = 3; - MaxSchemeCount = (1 shl SchemeIndexSize) - 1; - SchemeRangeSize = 4; - MaxSchemeRange = (1 shl SchemeRangeSize) - 1; -begin - if Operation = roGet then - begin - if DefaultHighlighter <> nil then - Range := cardinal(DefaultHighlighter.GetRange) - else - Range := 0; - if CurrScheme >= 0 then - begin - Assert(cardinal(Schemes[CurrScheme].Highlighter.GetRange) <= MaxSchemeRange); - Range := Range shl SchemeRangeSize; - Range := Range or cardinal(Schemes[CurrScheme].Highlighter.GetRange); - end; - Assert(CurrScheme <= MaxSchemeCount); - Range := Range shl SchemeIndexSize; - Range := Range or cardinal(CurrScheme + 1); - end - else - begin - CurrScheme := integer(Range and MaxSchemeCount) - 1; - Range := Range shr SchemeIndexSize; - if CurrScheme >= 0 then - begin - Schemes[CurrScheme].Highlighter.SetRange(pointer(Range and MaxSchemeRange)); - Range := Range shr SchemeRangeSize; - end; - if DefaultHighlighter <> nil then - begin - fTmpRange := pointer(Range); - DefaultHighlighter.SetRange(fTmpRange); - end; - end; -end; - -function TSynMultiSyn.UpdateRangeProcs: boolean; -// determines the appropriate RangeProcs and returns whether they were changed -var - i: Integer; - OldProc: TRangeProc; -begin - OldProc := fRangeProc; - if Assigned(OnCustomRange) then - fRangeProc := UserRangeProc - else begin - fRangeProc := NewRangeProc; - for i := 0 to Schemes.Count -1 do - if Schemes[i].Highlighter is TSynMultiSyn then - begin - fRangeProc := OldRangeProc; - break; - end; - end; - Result := TMethod(OldProc).Code <> TMethod(fRangeProc).Code; - if Result then - DefHighlightChange(Self); -end; - -procedure TSynMultiSyn.UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); -begin - OnCustomRange(Self, Operation, pointer(Range)); - if (Operation = roSet) and (DefaultHighlighter <> nil) then - fTmpRange := DefaultHighlighter.GetRange; -end; - -procedure TSynMultiSyn.SetOnCustomRange(const Value: TCustomRangeEvent); -begin - if (TMethod(OnCustomRange).Code <> TMethod(Value).Code) or - (TMethod(OnCustomRange).Data <> TMethod(Value).Data) then - begin - fOnCustomRange := Value; - UpdateRangeProcs; - end; -end; - -procedure TSynMultiSyn.Loaded; -begin - inherited; - DefHighlightChange(Self); -end; - -function TSynMultiSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - if CurrScheme >= 0 then - Result := Schemes[CurrScheme].Highlighter.IsIdentChar(AChar) - else if DefaultHighlighter <> nil then - Result := DefaultHighlighter.IsIdentChar(AChar) - else - Result := inherited IsIdentChar(AChar); -end; - -class function TSynMultiSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangGeneralMulti; -end; - -procedure TSynMultiSyn.DoSetLine(const Value: string; LineNumber: Integer); -var - iParser: TRegEx; - Match : TMatch; - iScheme: TScheme; - iExpr: string; - iLine: string; - iEaten: Integer; - i: Integer; -begin - ClearMarkers; - - iEaten := 0; - iLine := Value; - if CurrScheme >= 0 - then - iScheme := fSchemes[CurrScheme] - else - iScheme := nil; - while iLine <> '' do - if iScheme <> nil then - begin - if iScheme.CaseSensitive then - iParser.Create(iScheme.EndExpr, [roNotEmpty, roCompiled]) - else - iParser.Create(iScheme.EndExpr, [roNotEmpty, roIgnoreCase, roCompiled]); - Match := iParser.Match(iLine); - - if Match.Success then - begin - iExpr := Copy(Value, Match.Index + iEaten, Match.Length); - DoCheckMarker(iScheme, Match.Index + iEaten, Match.Length, - iExpr, False, LineNumber, Value); - Delete(iLine, 1, Match.Index - 1 + Match.Length); - Inc(iEaten, Match.Index - 1 + Match.Length); - iScheme := nil; - end - else - break; - end - else - begin - for i := 0 to Schemes.Count - 1 do - begin - iScheme := Schemes[i]; - if (iScheme.StartExpr = '') or (iScheme.EndExpr = '') or - (iScheme.Highlighter = nil) or (not iScheme.Highlighter.Enabled) then - begin - continue; - end; - if iScheme.CaseSensitive then - iParser.Create(iScheme.StartExpr, [roNotEmpty, roCompiled]) - else - iParser.Create(iScheme.StartExpr, [roNotEmpty, roIgnoreCase, roCompiled]); - Match := iParser.Match(iLine); - - if Match.Success then - begin - iExpr := Copy(Value, Match.Index + iEaten, Match.Length); - DoCheckMarker(iScheme, Match.Index + iEaten, Match.Length, - iExpr, True, LineNumber, Value); - Delete(iLine, 1, Match.Index - 1 + Match.Length); - Inc(iEaten, Match.Index - 1 + Match.Length); - break; - end; - end; {for} - if i >= Schemes.Count then - break; - end; {else} - - fLineStr := Value; - fLine := PWideChar(fLineStr); - fCasedLineStr := ''; - fCasedLine := PWideChar(fLineStr); - - fMarker := nil; - Run := 0; - ExpandedRun := 0; - fOldRun := Run; - fTokenPos := 0; - fExpandedTokenPos := 0; - fNextMarker := 0; - fLineNumber := LineNumber; -end; - -function TSynMultiSyn.GetExpandedToken: string; -begin - if (DefaultHighlighter = nil) and (fExpandedLine <> nil) then - Result := fExpandedLineStr - else - Result := inherited GetExpandedToken; -end; - -{ TSchemes } - -constructor TSchemes.Create(aOwner: TSynMultiSyn); -begin - inherited Create(TScheme); - fOwner := aOwner; -end; - -function TSchemes.GetItems(Index: Integer): TScheme; -begin - Result := inherited Items[Index] as TScheme; -end; - -function TSchemes.GetOwner: TPersistent; -begin - Result := fOwner; -end; - -procedure TSchemes.SetItems(Index: Integer; const Value: TScheme); -begin - inherited Items[Index] := Value; -end; - -procedure TSchemes.Update(Item: TCollectionItem); -begin - if Item <> nil then - fOwner.DefHighlightChange(Item) - else // pass the MultiSyn as the Sender so Editors reparse their text - fOwner.DefHighlightChange(fOwner); -end; - -{ TScheme } - -function TScheme.ConvertExpression(const Value: string): string; -begin - if not CaseSensitive then - Result := SysUtils.AnsiUpperCase(Value) - else - Result := Value; -end; - -constructor TScheme.Create(Collection: TCollection); -begin - inherited Create(Collection); - fCaseSensitive := True; - fMarkerAttri := TSynHighlighterAttributes.Create(SYNS_AttrMarker, SYNS_FriendlyAttrMarker); - fMarkerAttri.OnChange := MarkerAttriChanged; - MarkerAttri.Background := clYellow; - MarkerAttri.Style := [fsBold]; - MarkerAttri.InternalSaveDefaultValues; -end; - -destructor TScheme.Destroy; -begin - { unhook notification handlers } - Highlighter := nil; - inherited Destroy; - fMarkerAttri.Free; -end; - -procedure TScheme.DefineProperties(Filer: TFiler); -begin - inherited; -end; - -function TScheme.GetDisplayName: string; -begin - if SchemeName <> '' then - Result := SchemeName - else - Result := inherited GetDisplayName; -end; - -procedure TScheme.MarkerAttriChanged(Sender: TObject); -begin - Changed(False); -end; - -procedure TScheme.SetCaseSensitive(const Value: Boolean); -begin - if fCaseSensitive <> Value then - begin - fCaseSensitive := Value; - Changed(True); - end; -end; - -procedure TScheme.SetDisplayName(const Value: string); -begin - SchemeName := Value; -end; - -procedure TScheme.SetEndExpr(const Value: string); -var - OldValue: string; -begin - if fEndExpr <> Value then - begin - if Value <> '' then - CheckExpression(Value); - OldValue := fEndExpr; - fEndExpr := Value; - if ConvertExpression(OldValue) <> ConvertExpression(Value) then - Changed(True); - end; -end; - -procedure TScheme.SetHighlighter(const Value: TSynCustomHighLighter); -var - iOwner: TSynMultiSyn; - iAlreadyRepainted: Boolean; -begin - if Highlighter <> Value then - begin - iOwner := TSchemes(Collection).fOwner; - if (Highlighter <> nil) and (Highlighter <> iOwner) then - iOwner.UnhookHighlighter(Highlighter); - fHighlighter := Value; - if (Highlighter <> nil) and (Highlighter <> iOwner) then - iOwner.HookHighlighter(Highlighter); - if Highlighter is TSynMultiSyn then - iAlreadyRepainted := iOwner.UpdateRangeProcs - else - iAlreadyRepainted := False; - if not iAlreadyRepainted then - Changed(True); - end; -end; - -procedure TScheme.SetMarkerAttri(const Value: TSynHighlighterAttributes); -begin - fMarkerAttri.Assign(Value); -end; - -procedure TScheme.SetStartExpr(const Value: string); -var - OldValue: string; -begin - if fStartExpr <> Value then - begin - if Value <> '' then - CheckExpression(Value); - OldValue := fStartExpr; - fStartExpr := Value; - if ConvertExpression(Value) <> ConvertExpression(OldValue) then - Changed(True); - end; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterMulti.pas, released 2000-06-23. +The Original Code is based on mwMultiSyn.pas by Willo van der Merwe, part of the +mwEdit component suite. +Unicode translation by Maël Hörz. + +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: SynHighlighterMulti.pas,v 1.34.2.11 2008/09/14 16:25:00 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Multiple-highlighter syntax highlighter for SynEdit) +@author(Willo van der Merwe , converted to SynEdit by David Muir ) +@created(1999, converted to SynEdit 2000-06-23) +@lastmod(2000-06-23) +The SynHighlighterMulti unit provides SynEdit with a multiple-highlighter syntax highlighter. +This highlighter can be used to highlight text in which several languages are present, such as HTML. +For example, in HTML as well as HTML tags there can also be JavaScript and/or VBScript present. +} + +unit SynHighlighterMulti; + +{$I SynEdit.inc} + +interface + +uses + Windows, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + Classes; + +type + TOnCheckMarker = procedure (Sender: TObject; var StartPos, MarkerLen: Integer; + var MarkerText: UnicodeString; Line: Integer; const LineStr: string) of object; + + TScheme = class(TCollectionItem) + private + FEndExpr: UnicodeString; + FStartExpr: UnicodeString; + FHighlighter: TSynCustomHighLighter; + FMarkerAttri: TSynHighlighterAttributes; + FSchemeName: TComponentName; + FCaseSensitive: Boolean; + FOnCheckStartMarker: TOnCheckMarker; + FOnCheckEndMarker: TOnCheckMarker; + function ConvertExpression(const Value: UnicodeString): UnicodeString; + procedure MarkerAttriChanged(Sender: TObject); + procedure SetMarkerAttri(const Value: TSynHighlighterAttributes); + procedure SetHighlighter(const Value: TSynCustomHighlighter); + procedure SetEndExpr(const Value: UnicodeString); + procedure SetStartExpr(const Value: UnicodeString); + procedure SetCaseSensitive(const Value: Boolean); + protected + procedure DefineProperties(Filer: TFiler); override; +{$IFDEF SYN_COMPILER_3_UP} + function GetDisplayName: string; override; + procedure SetDisplayName(const Value: string); override; +{$ENDIF} + public + constructor Create(Collection: TCollection); override; + destructor Destroy; override; + published + property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive + default True; + property StartExpr: UnicodeString read FStartExpr write SetStartExpr; + property EndExpr: UnicodeString read FEndExpr write SetEndExpr; + property Highlighter: TSynCustomHighlighter read FHighlighter + write SetHighlighter; + property MarkerAttri: TSynHighlighterAttributes read FMarkerAttri + write SetMarkerAttri; + property SchemeName: TComponentName read FSchemeName write FSchemeName; + property OnCheckStartMarker: TOnCheckMarker read FOnCheckStartMarker write FOnCheckStartMarker; + property OnCheckEndMarker: TOnCheckMarker read FOnCheckEndMarker write FOnCheckEndMarker; + end; + + TgmSchemeClass = class of TScheme; + + TSynMultiSyn = class; + + TSchemes = class(TCollection) + private + FOwner: TSynMultiSyn; + function GetItems(Index: Integer): TScheme; + procedure SetItems(Index: Integer; const Value: TScheme); +{$IFDEF SYN_COMPILER_3_UP} + protected + function GetOwner: TPersistent; override; + procedure Update(Item: TCollectionItem); override; +{$ENDIF} + public + constructor Create(aOwner: TSynMultiSyn); + property Items[aIndex: Integer]: TScheme read GetItems write SetItems; + default; + end; + + TMarker = class + protected + FScheme: Integer; + FStartPos: Integer; + FMarkerLen: Integer; + FMarkerText: UnicodeString; + FIsOpenMarker: Boolean; + public + constructor Create(aScheme, aStartPos, aMarkerLen: Integer; + aIsOpenMarker: Boolean; const aMarkerText: UnicodeString); + end; + + + TRangeOperation = (roGet, roSet); + +{$IFDEF SYN_COMPILER_16_UP} + TRangeUNativeInt = NativeUInt; +{$ELSE} + TRangeUNativeInt = Cardinal; +{$ENDIF} + TRangeProc = procedure (Operation: TRangeOperation; var Range: TRangeUNativeInt) of object; + + TCustomRangeEvent = procedure (Sender: TSynMultiSyn; Operation: TRangeOperation; + var Range: Pointer) of object; + + { + * Usage notes * + If you don't need to nest MultiSyns as Schemes, just as DefaultHighlighter, + you can nest up to 2 MultiSyns, each of them containing up to 7 Schemes. This + is the way MultiSyn works best. (implemented in NewRangeProc) + If you need to use a MultiSyn nested as Scheme, then you can nest up to + 5 MultiSyns, but Ranges aren't persisted across occurrences of Schemes that + have multiple lines. (implemented in OldRangeProc) + Clarification: when I say "you can nest up to X" MultiSyns, I mean having + X+1 levels of MultiSyns. + + MultiSyn doesn't work by default with dynamic highlighters; you must use + OnCustomRange. This is because dynamic highlighters' Ranges are pointers, + but MultiSyn needs Ranges to be ordinal values smaller than 16 (4 bits). + + OnCustomRange: + When Operation is roGet, user should store in the 'Range' parameter the + information to allow restoring the current state of the highlighter. + When Operation is roSet, user should restore highlighter state (CurrScheme, + DefaultHighlighter.Range and, if the case, Schemes[CurrScheme].Range) + according to 'Range' value. + CurrScheme: + Index of the scheme that is currently parsing. DefaultHighlighter maps to -1. + + * Implementation notes * + FTmpRange: + Using the OldRangeProc, FTmpRange was the only way to restore the Range + of the DefaultHighlighter after a Scheme spanned across multiple lines. + With the NewRangeProc, the only use for it is restoring DefaultHighLighter's + Range in case a nested MultiSyn uses the highlighter too. + } + + TSynMultiSyn = class(TSynCustomHighlighter) + private + FRangeProc: TRangeProc; + FDefaultLanguageName: string; + FMarkers: TList; + FMarker: TMarker; + FNextMarker: Integer; + FCurrScheme: Integer; + FTmpRange: Pointer; + FOnCustomRange: TCustomRangeEvent; + FLineStr: UnicodeString; + procedure SetDefaultHighlighter(const Value: TSynCustomHighLighter); + function GetMarkers(Index: Integer): TMarker; + property Markers[Index: Integer]: TMarker read GetMarkers; + procedure DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; + const MarkerText: UnicodeString; Start: Boolean; Line: Integer; + const LineStr: string); + procedure SetOnCustomRange(const Value: TCustomRangeEvent); + protected + FSchemes: TSchemes; + FDefaultHighlighter: TSynCustomHighLighter; + FLineNumber: Integer; + FSampleSource: UnicodeString; + procedure Loaded; override; + procedure SetSchemes(const Value: TSchemes); + procedure ClearMarkers; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetAttribCount: Integer; override; + function GetAttribute(Index: Integer): TSynHighlighterAttributes; override; + procedure HookHighlighter(aHL: TSynCustomHighlighter); + procedure UnhookHighlighter(aHL: TSynCustomHighlighter); + procedure Notification(aComp: TComponent; aOp: TOperation); override; + function GetSampleSource: UnicodeString; override; + procedure SetSampleSource(Value: UnicodeString); override; + procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); override; + // + procedure OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); + procedure NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); + procedure UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetEol: Boolean; override; + function GetExpandedToken: UnicodeString; override; + function GetRange: Pointer; override; + function GetToken: UnicodeString; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + function UpdateRangeProcs: Boolean; + property CurrScheme: Integer read FCurrScheme write FCurrScheme; + property CurrLine: UnicodeString read FLineStr; + function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; + function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + published + property Schemes: TSchemes read FSchemes write SetSchemes; + property DefaultHighlighter: TSynCustomHighLighter read FDefaultHighlighter + write SetDefaultHighlighter; + property DefaultLanguageName: string read FDefaultLanguageName + write FDefaultLanguageName; + property OnCustomRange: TCustomRangeEvent read FOnCustomRange write SetOnCustomRange; + end; + +implementation + +uses + Graphics, + SynEditMiscProcs, + SynRegExpr, + SynEditStrConst, + SysUtils; + +procedure CheckExpression(const Expr: UnicodeString); +var + Parser: TRegExpr; +begin + Parser := TRegExpr.Create; + try + Parser.Expression := Expr; + try + Parser.Compile; + except + on E: ERegExpr do + begin + if E.ErrorCode < 1000 then + E.Message := Format('"%s" is not a valid Regular Expression.'#13'Error (pos %d): %s', + [Expr, E.CompilerErrorPos, Copy(Parser.ErrorMsg(E.ErrorCode), 16, MaxInt)]); + raise; + end; + end; + finally + Parser.Free; + end; +end; + +{ TMarker } + +constructor TMarker.Create(aScheme, aStartPos, + aMarkerLen: Integer; aIsOpenMarker: Boolean; const aMarkerText: UnicodeString); +begin + FScheme := aScheme; + FStartPos := aStartPos; + FMarkerLen := aMarkerLen; + FIsOpenMarker := aIsOpenMarker; + FMarkerText := aMarkerText; +end; + +{ TSynMultiSyn } + +procedure TSynMultiSyn.ClearMarkers; +var + i: Integer; +begin + for i := 0 to FMarkers.Count - 1 do + TObject(FMarkers[i]).Free; + FMarkers.Clear; +end; + +constructor TSynMultiSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FSchemes := TSchemes.Create(Self); + FCurrScheme := -1; + FMarkers := TList.Create; + FRangeProc := NewRangeProc; +end; + +destructor TSynMultiSyn.Destroy; +begin + ClearMarkers; + { unhook notification handlers } + Schemes.Clear; + DefaultHighlighter := nil; + inherited Destroy; + FSchemes.Free; + FMarkers.Free; +end; + +function TSynMultiSyn.GetAttribCount: Integer; +var + i: Integer; +begin + Result := Schemes.Count; + if DefaultHighlighter <> nil then + Inc(Result, DefaultHighlighter.AttrCount); + for i := 0 to Schemes.Count - 1 do + if Schemes[i].Highlighter <> nil then + Inc(Result, Schemes[i].Highlighter.AttrCount); +end; + +function TSynMultiSyn.GetAttribute(Index: Integer): TSynHighlighterAttributes; +var + i: Integer; + HL: TSynCustomHighlighter; +begin + if Index < Schemes.Count then + Result := Schemes[Index].MarkerAttri + else + begin + Dec(Index, Schemes.Count); + if DefaultHighlighter <> nil then + if Index < DefaultHighlighter.AttrCount then + begin + Result := DefaultHighlighter.Attribute[Index]; + Exit; + end + else + Dec(Index, DefaultHighlighter.AttrCount); + for i := 0 to Schemes.Count - 1 do + begin + HL := Schemes[i].Highlighter; + if HL <> nil then + if Index < HL.AttrCount then + begin + Result := HL.Attribute[Index]; + Exit; + end + else + Dec(Index, HL.AttrCount); + end; + Result := nil; + end; +end; + +function TSynMultiSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +var + HL: TSynCustomHighlighter; +begin + if (CurrScheme >= 0) and (Schemes[CurrScheme].Highlighter <> nil) then + HL := Schemes[CurrScheme].Highlighter + else + HL := DefaultHighlighter; + { the typecast to TSynMultiSyn is only necessary because the + GetDefaultAttribute method is protected. + And don't worry: this really works } + if HL <> nil then + Result := TSynMultiSyn(HL).GetDefaultAttribute(Index) + else + Result := nil; +end; + +function TSynMultiSyn.GetEol: Boolean; +begin + if FMarker <> nil then + Result := False + else if FCurrScheme >= 0 then + Result := Schemes[CurrScheme].Highlighter.GetEol + else if DefaultHighlighter <> nil then + Result := DefaultHighlighter.GetEol + else + Result := Run > FLineLen + 1; +end; + +class function TSynMultiSyn.GetLanguageName: string; +begin + Result := SYNS_LangGeneralMulti; +end; + +function TSynMultiSyn.GetMarkers(Index: Integer): TMarker; +begin + Result := TMarker(FMarkers[Index]); +end; + +procedure TSynMultiSyn.OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); +const + MaxNestedMultiSyn = 6; + { number of bits of the Range that will be used to store the SchemeIndex } + SchemeIndexSize = 4; + MaxSchemeCount = (1 shl SchemeIndexSize) - 1; + { number of bits of the Range that will be used to store the SchemeRange } + SchemeRangeSize = 8; + MaxSchemeRange = (1 shl SchemeRangeSize) - 1; +var + iHL: TSynCustomHighlighter; + iSchemeIndex: Cardinal; + iSchemeRange: Cardinal; +begin + if Operation = roGet then + begin + if (FCurrScheme < 0) then + iHL := DefaultHighlighter + else + iHL := Schemes[FCurrScheme].Highlighter; + iSchemeIndex := FCurrScheme + 2; + Assert(iSchemeIndex <= MaxSchemeCount); + if iHL <> nil then + begin + iSchemeRange := Cardinal(iHL.GetRange); + Assert((iSchemeRange <= MaxSchemeRange) or (iHL is TSynMultiSyn)); + end + else + iSchemeRange := 0; + { checks the limit of nested MultiSyns } + Assert(iSchemeRange shr ((MaxNestedMultiSyn - 1) * SchemeIndexSize + SchemeRangeSize) = 0); + iSchemeRange := (iSchemeRange shl SchemeIndexSize) or iSchemeIndex; + Range := iSchemeRange; + end + else + begin + if Range = 0 then + Exit; + iSchemeRange := Cardinal(Range); + FCurrScheme := Integer(iSchemeRange and MaxSchemeCount) - 2; + iSchemeRange := iSchemeRange shr SchemeIndexSize; + if (CurrScheme < 0) then + begin + if DefaultHighlighter <> nil then + DefaultHighlighter.SetRange(Pointer(iSchemeRange)); + end + else + Schemes[CurrScheme].Highlighter.SetRange(Pointer(iSchemeRange)); + end; +end; + +function TSynMultiSyn.GetToken: UnicodeString; +begin + if DefaultHighlighter = nil then + Result := FLineStr + else + Result := inherited GetToken; +end; + +function TSynMultiSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + if FMarker <> nil then + Result := Schemes[FMarker.FScheme].MarkerAttri + else if CurrScheme >= 0 then + Result := Schemes[CurrScheme].Highlighter.GetTokenAttribute + else if DefaultHighlighter <> nil then + Result := DefaultHighlighter.GetTokenAttribute + else + Result := nil; +end; + +function TSynMultiSyn.GetTokenKind: Integer; +begin + if FMarker <> nil then + Result := 0 + else if FCurrScheme >= 0 then + Result := Schemes[FCurrScheme].Highlighter.GetTokenKind + else if DefaultHighlighter <> nil then + Result := DefaultHighlighter.GetTokenKind + else + Result := 0; +end; + +procedure TSynMultiSyn.HookHighlighter(aHL: TSynCustomHighlighter); +begin + aHL.FreeNotification(Self); + aHL.HookAttrChangeEvent(DefHighlightChange); +end; + +procedure TSynMultiSyn.Next; +var + iToken, TmpLine, ExpandedTmpLine: UnicodeString; + iHL: TSynCustomHighlighter; +begin + if DefaultHighlighter = nil then + begin + if Run > 0 then + Inc(Run) + else + Run := Length(FLineStr) + 1; + inherited; + Exit; + end; + + if (FNextMarker < FMarkers.Count) and (Run + 1 >= Markers[FNextMarker].FStartPos) then + begin + FMarker := Markers[FNextMarker]; + if FMarker.FIsOpenMarker then + begin + FCurrScheme := FMarker.FScheme; + FTmpRange := DefaultHighlighter.GetRange; + Schemes[CurrScheme].Highlighter.ResetRange; + end; + Inc(FNextMarker); + FTokenPos := Run; + Inc(Run, FMarker.FMarkerLen); + inherited; + Exit; + end; + + if Run = 0 then + begin + if CurrScheme >= 0 then + iHL := Schemes[CurrScheme].Highlighter + else + iHL := DefaultHighlighter; + + if FMarkers.Count = 0 then + TmpLine := FLineStr + else + TmpLine := Copy(FLineStr, 1, Markers[FNextMarker].FStartPos - 1); + + if fExpandedLine <> nil then + begin + if FMarkers.Count = 0 then + ExpandedTmpLine := FExpandedLineStr + else + ExpandedTmpLine := Copy(FExpandedLineStr, 1, + PosToExpandedPos(Markers[FNextMarker].FStartPos - 1)); + iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, FLineNumber); + end + else + iHL.SetLine(TmpLine, FLineNumber); + end + else if FMarker <> nil then + begin + if not FMarker.FIsOpenMarker then + begin + FCurrScheme := -1; + DefaultHighlighter.SetRange(FTmpRange); + end; + FMarker := nil; + + if CurrScheme >= 0 then + iHL := Schemes[CurrScheme].Highlighter + else + iHL := DefaultHighlighter; + + if FNextMarker < FMarkers.Count then + TmpLine := Copy(FLineStr, Run + 1, Markers[FNextMarker].FStartPos - Run - 1) + else + TmpLine := Copy(FLineStr, Run + 1, MaxInt); + + if fExpandedLine <> nil then + begin + if FNextMarker < FMarkers.Count then + ExpandedTmpLine := Copy(FExpandedLineStr, FExpandedRun + 1, + PosToExpandedPos(Markers[FNextMarker].FStartPos - Run - 1)) + else + ExpandedTmpLine := Copy(FExpandedLineStr, FExpandedRun + 1, MaxInt); + + iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, FLineNumber); + end + else + iHL.SetLine(TmpLine, FLineNumber); + end + else + begin + if CurrScheme >= 0 then + iHL := Schemes[CurrScheme].Highlighter + else + iHL := DefaultHighlighter; + iHL.Next; + end; + + FTokenPos := iHL.GetTokenPos; + iToken := iHL.GetToken; + if FNextMarker > 0 then + with Markers[FNextMarker - 1] do + Inc(FTokenPos, FStartPos + FMarkerLen - 1); + Inc(Run, (FTokenPos - Run) + Length(iToken)); + inherited; +end; + +procedure TSynMultiSyn.Notification(aComp: TComponent; aOp: TOperation); +var + i: Integer; +begin + inherited; + // 'opRemove' doesn't mean the component is being destroyed. It means it's + // being removed from its Owner's list of Components. + if (aOp = opRemove) and (aComp is TSynCustomHighlighter) and + (csDestroying in aComp.ComponentState) then + begin + if DefaultHighlighter = aComp then + DefaultHighlighter := nil; + for i := 0 to Schemes.Count - 1 do + if Schemes[i].Highlighter = aComp then + Schemes[i].Highlighter := nil; + end; +end; + +procedure TSynMultiSyn.ResetRange; +begin + FCurrScheme := -1; + if DefaultHighlighter <> nil then + begin + DefaultHighlighter.ResetRange; + FTmpRange := DefaultHighlighter.GetRange; + end; +end; + +procedure TSynMultiSyn.SetDefaultHighlighter( + const Value: TSynCustomHighLighter); +const + sDefaultHlSetToSelf = 'A SynMultiSyn cannot be its own DefaultHighlighter.'; +begin + if DefaultHighlighter <> Value then begin + if Value = Self then + raise Exception.Create(sDefaultHlSetToSelf); + if DefaultHighlighter <> nil then + UnhookHighlighter(DefaultHighlighter); + FDefaultHighlighter := Value; + if DefaultHighlighter <> nil then + HookHighlighter(DefaultHighlighter); + DefHighlightChange(Self); + end; +end; + +procedure TSynMultiSyn.DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; + const MarkerText: UnicodeString; Start: Boolean; Line: Integer; + const LineStr: string); +var + aStartPos: Integer; + aMarkerLen: Integer; + aMarkerText: UnicodeString; +begin + aStartPos := StartPos; + aMarkerLen := MarkerLen; + aMarkerText := MarkerText; + if Start and Assigned(Scheme.OnCheckStartMarker) then + Scheme.OnCheckStartMarker(Self, aStartPos, aMarkerLen, aMarkerText, Line, LineStr) + else if not Start and Assigned(Scheme.OnCheckEndMarker) then + Scheme.OnCheckEndMarker(Self, aStartPos, aMarkerLen, aMarkerText, Line, LineStr); + if (aMarkerText <> '') and (aMarkerLen > 0) then + begin + FMarkers.Add(TMarker.Create(Scheme.Index, aStartPos, aMarkerLen, Start, + aMarkerText)); + end; +end; + +procedure TSynMultiSyn.SetSchemes(const Value: TSchemes); +begin + FSchemes.Assign(Value); +end; + +procedure TSynMultiSyn.UnhookHighlighter(aHL: TSynCustomHighlighter); +begin + aHL.UnhookAttrChangeEvent(DefHighlightChange); +{$IFDEF SYN_COMPILER_5_UP} + aHL.RemoveFreeNotification(Self); +{$ENDIF} +end; + +function TSynMultiSyn.GetSampleSource: UnicodeString; +begin + Result := FSampleSource; +end; + +procedure TSynMultiSyn.SetSampleSource(Value: UnicodeString); +begin + FSampleSource := Value; +end; + +function TSynMultiSyn.LoadFromRegistry(RootKey: HKEY; + Key: string): Boolean; +var + r: TBetterRegistry; + i: Integer; +begin + if DefaultHighlighter <> nil then + Result := DefaultHighlighter.LoadFromRegistry(RootKey, Key + '\DefaultHighlighter') + else + Result := False; + r := TBetterRegistry.Create; + try + r.RootKey := RootKey; + for i := 0 to Schemes.Count-1 do + if (Schemes[i].SchemeName <> '') and + r.OpenKeyReadOnly(Key + '\' + Schemes[i].SchemeName) then + begin + Result := Schemes[i].MarkerAttri.LoadFromRegistry(r) and Result; + r.CloseKey; + Result := (Schemes[i].Highlighter <> nil) and + Schemes[i].Highlighter.LoadFromRegistry(RootKey, + Key + '\' + Schemes[i].SchemeName) and Result; + end + else + Result := False; + finally + r.Free; + end; +end; + +function TSynMultiSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; +var + r: TBetterRegistry; + i: Integer; +begin + if DefaultHighlighter <> nil then + Result := DefaultHighlighter.SaveToRegistry(RootKey, Key + '\DefaultHighlighter') + else + Result := False; + r := TBetterRegistry.Create; + try + r.RootKey := RootKey; + for i := 0 to Schemes.Count-1 do + if (Schemes[i].SchemeName <> '') and + r.OpenKey(Key + '\' + Schemes[i].SchemeName, True) then + begin + Result := Schemes[i].MarkerAttri.SaveToRegistry(r) and Result; + r.CloseKey; + Result := (Schemes[i].Highlighter <> nil) and + Schemes[i].Highlighter.SaveToRegistry(RootKey, + Key + '\' + Schemes[i].SchemeName) and Result; + end + else + Result := False; + finally + r.Free; + end; +end; + +function TSynMultiSyn.GetRange: Pointer; +begin + Result := nil; + FRangeProc(roGet, TRangeUNativeInt(Result)); +end; + +procedure TSynMultiSyn.SetRange(Value: Pointer); +begin + FRangeProc(roSet, TRangeUNativeInt(Value)); +end; + +procedure TSynMultiSyn.NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); +const + SchemeIndexSize = 3; + MaxSchemeCount = (1 shl SchemeIndexSize) - 1; + SchemeRangeSize = 4; + MaxSchemeRange = (1 shl SchemeRangeSize) - 1; +begin + if Operation = roGet then + begin + if DefaultHighlighter <> nil then + Range := Cardinal(DefaultHighlighter.GetRange) + else + Range := 0; + if CurrScheme >= 0 then + begin + Assert(Cardinal(Schemes[CurrScheme].Highlighter.GetRange) <= MaxSchemeRange); + Range := Range shl SchemeRangeSize; + Range := Range or Cardinal(Schemes[CurrScheme].Highlighter.GetRange); + end; + Assert(CurrScheme <= MaxSchemeCount); + Range := Range shl SchemeIndexSize; + Range := Range or Cardinal(CurrScheme + 1); + end + else + begin + CurrScheme := Integer(Range and MaxSchemeCount) - 1; + Range := Range shr SchemeIndexSize; + if CurrScheme >= 0 then + begin + Schemes[CurrScheme].Highlighter.SetRange(Pointer(Range and MaxSchemeRange)); + Range := Range shr SchemeRangeSize; + end; + if DefaultHighlighter <> nil then + begin + FTmpRange := Pointer(Range); + DefaultHighlighter.SetRange(FTmpRange); + end; + end; +end; + +function TSynMultiSyn.UpdateRangeProcs: Boolean; +// determines the appropriate RangeProcs and returns whether they were changed +var + i: Integer; + OldProc: TRangeProc; +begin + OldProc := FRangeProc; + if Assigned(OnCustomRange) then + FRangeProc := UserRangeProc + else begin + FRangeProc := NewRangeProc; + for i := 0 to Schemes.Count -1 do + if Schemes[i].Highlighter is TSynMultiSyn then + begin + FRangeProc := OldRangeProc; + Break; + end; + end; + Result := TMethod(OldProc).Code <> TMethod(FRangeProc).Code; + if Result then + DefHighlightChange(Self); +end; + +procedure TSynMultiSyn.UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); +begin + OnCustomRange(Self, Operation, Pointer(Range)); + if (Operation = roSet) and (DefaultHighlighter <> nil) then + FTmpRange := DefaultHighlighter.GetRange; +end; + +procedure TSynMultiSyn.SetOnCustomRange(const Value: TCustomRangeEvent); +begin + if (TMethod(OnCustomRange).Code <> TMethod(Value).Code) or + (TMethod(OnCustomRange).Data <> TMethod(Value).Data) then + begin + FOnCustomRange := Value; + UpdateRangeProcs; + end; +end; + +procedure TSynMultiSyn.Loaded; +begin + inherited; + DefHighlightChange(Self); +end; + +function TSynMultiSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + if CurrScheme >= 0 then + Result := Schemes[CurrScheme].Highlighter.IsIdentChar(AChar) + else if DefaultHighlighter <> nil then + Result := DefaultHighlighter.IsIdentChar(AChar) + else + Result := inherited IsIdentChar(AChar); +end; + +class function TSynMultiSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangGeneralMulti; +end; + +procedure TSynMultiSyn.DoSetLine(const Value: UnicodeString; LineNumber: Integer); +var + iParser: TRegExpr; + iScheme: TScheme; + iExpr: UnicodeString; + iLine: UnicodeString; + iEaten: Integer; + i: Integer; +begin + ClearMarkers; + + iParser := TRegExpr.Create; + try + iEaten := 0; + iLine := Value; + if CurrScheme >= 0 + then + iScheme := FSchemes[CurrScheme] + else + iScheme := nil; + while iLine <> '' do + if iScheme <> nil then + begin + iParser.Expression := iScheme.EndExpr; + iParser.ModifierI := not iScheme.CaseSensitive; + if iParser.Exec(iLine) then + begin + iExpr := Copy(Value, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0]); + DoCheckMarker(iScheme, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0], + iExpr, False, LineNumber, Value); + Delete(iLine, 1, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); + Inc(iEaten, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); + iScheme := nil; + end + else + Break; + end + else + begin + for i := 0 to Schemes.Count - 1 do + begin + iScheme := Schemes[i]; + if (iScheme.StartExpr = '') or (iScheme.EndExpr = '') or + (iScheme.Highlighter = nil) or (not iScheme.Highlighter.Enabled) then + begin + continue; + end; + iParser.Expression := iScheme.StartExpr; + iParser.ModifierI := not iScheme.CaseSensitive; + if iParser.Exec(iLine) then begin + iExpr := Copy(Value, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0]); + DoCheckMarker(iScheme, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0], + iExpr, True, LineNumber, Value); + Delete(iLine, 1, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); + Inc(iEaten, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); + Break; + end; + end; {for} + if i >= Schemes.Count then + Break; + end; {else} + + finally + iParser.Free; + end; + + FLineStr := Value; + fLine := PWideChar(FLineStr); + fCasedLineStr := ''; + fCasedLine := PWideChar(FLineStr); + + FMarker := nil; + Run := 0; + FExpandedRun := 0; + fOldRun := Run; + FTokenPos := 0; + fExpandedTokenPos := 0; + FNextMarker := 0; + FLineNumber := LineNumber; +end; + +function TSynMultiSyn.GetExpandedToken: UnicodeString; +begin + if (DefaultHighlighter = nil) and (fExpandedLine <> nil) then + Result := FExpandedLineStr + else + Result := inherited GetExpandedToken; +end; + +{ TSchemes } + +constructor TSchemes.Create(aOwner: TSynMultiSyn); +begin + inherited Create(TScheme); + FOwner := aOwner; +end; + +function TSchemes.GetItems(Index: Integer): TScheme; +begin + Result := inherited Items[Index] as TScheme; +end; + +{$IFDEF SYN_COMPILER_3_UP} +function TSchemes.GetOwner: TPersistent; +begin + Result := FOwner; +end; +{$ENDIF} + +procedure TSchemes.SetItems(Index: Integer; const Value: TScheme); +begin + inherited Items[Index] := Value; +end; + +{$IFDEF SYN_COMPILER_3_UP} +procedure TSchemes.Update(Item: TCollectionItem); +begin + if Item <> nil then + FOwner.DefHighlightChange(Item) + else // pass the MultiSyn as the Sender so Editors reparse their text + FOwner.DefHighlightChange(FOwner); +end; +{$ENDIF} + +{ TScheme } + +function TScheme.ConvertExpression(const Value: UnicodeString): UnicodeString; +begin + if not CaseSensitive then + Result := SynWideUpperCase(Value) + else + Result := Value; +end; + +constructor TScheme.Create(Collection: TCollection); +begin + inherited Create(Collection); + FCaseSensitive := True; + FMarkerAttri := TSynHighlighterAttributes.Create(SYNS_AttrMarker, SYNS_FriendlyAttrMarker); + FMarkerAttri.OnChange := MarkerAttriChanged; + MarkerAttri.Background := clYellow; + MarkerAttri.Style := [fsBold]; + MarkerAttri.InternalSaveDefaultValues; +end; + +destructor TScheme.Destroy; +begin + { unhook notification handlers } + Highlighter := nil; + inherited Destroy; + FMarkerAttri.Free; +end; + +procedure TScheme.DefineProperties(Filer: TFiler); +begin + inherited; +{$IFNDEF UNICODE} + UnicodeDefineProperties(Filer, Self); +{$ENDIF} +end; + +{$IFDEF SYN_COMPILER_3_UP} +function TScheme.GetDisplayName: string; +begin + if SchemeName <> '' then + Result := SchemeName + else + Result := inherited GetDisplayName; +end; +{$ENDIF SYN_COMPILER_3_UP} + +procedure TScheme.MarkerAttriChanged(Sender: TObject); +begin + Changed(False); +end; + +procedure TScheme.SetCaseSensitive(const Value: Boolean); +begin + if FCaseSensitive <> Value then + begin + FCaseSensitive := Value; + Changed(True); + end; +end; + +{$IFDEF SYN_COMPILER_3_UP} +procedure TScheme.SetDisplayName(const Value: string); +begin + SchemeName := Value; +end; +{$ENDIF SYN_COMPILER_3_UP} + +procedure TScheme.SetEndExpr(const Value: UnicodeString); +var + OldValue: UnicodeString; +begin + if FEndExpr <> Value then + begin + if Value <> '' then + CheckExpression(Value); + OldValue := FEndExpr; + FEndExpr := Value; + if ConvertExpression(OldValue) <> ConvertExpression(Value) then + Changed(True); + end; +end; + +procedure TScheme.SetHighlighter(const Value: TSynCustomHighLighter); +var + iOwner: TSynMultiSyn; + iAlreadyRepainted: Boolean; +begin + if Highlighter <> Value then + begin + iOwner := TSchemes(Collection).FOwner; + if (Highlighter <> nil) and (Highlighter <> iOwner) then + iOwner.UnhookHighlighter(Highlighter); + FHighlighter := Value; + if (Highlighter <> nil) and (Highlighter <> iOwner) then + iOwner.HookHighlighter(Highlighter); + if Highlighter is TSynMultiSyn then + iAlreadyRepainted := iOwner.UpdateRangeProcs + else + iAlreadyRepainted := False; + if not iAlreadyRepainted then + Changed(True); + end; +end; + +procedure TScheme.SetMarkerAttri(const Value: TSynHighlighterAttributes); +begin + FMarkerAttri.Assign(Value); +end; + +procedure TScheme.SetStartExpr(const Value: UnicodeString); +var + OldValue: UnicodeString; +begin + if FStartExpr <> Value then + begin + if Value <> '' then + CheckExpression(Value); + OldValue := FStartExpr; + FStartExpr := Value; + if ConvertExpression(Value) <> ConvertExpression(OldValue) then + Changed(True); + end; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterPHP.pas b/Source/VCL/SynEdit/Source/SynHighlighterPHP.pas index f718b35a..013724af 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterPHP.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterPHP.pas @@ -1,1211 +1,1217 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterPHP.pas, released 2000-04-21. -The Original Code is based on the wmPHPSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Willo van der Merwe. -"Heredoc" syntax highlighting implementation by Marko Njezic. -Unicode translation by Ma?l H?rz. -PHP5 keywords added by CodehunterWorks. -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. - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a PHP syntax highlighter for SynEdit) -@author(Willo van der Merwe , converted to SynEdit by Bruno Mikkelsen ) -@created(1999, converted to SynEdit 2000-04-21) -@lastmod(2000-06-23) -The SynHighlighterPHP unit provides SynEdit with a PHP syntax highlighter. -Thanks to Martin Waldenburg. -} - -unit SynHighlighterPHP; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, - tkNumber, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); - -{$IFDEF SYN_HEREDOC} - TRangeState = (rsUnKnown, rsString39, rsString34, rsComment, rsVarExpansion, - rsHeredoc); - - TRangePointer = packed record - case Boolean of - True: (Ptr: Pointer); - False: (Range: Byte; Length: Byte; Checksum: Word); - end; -{$ELSE} - TRangeState = (rsUnKnown, rsString39, rsString34, rsComment, rsVarExpansion); -{$ENDIF} - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynPHPSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; -{$IFDEF SYN_HEREDOC} - fHeredocLength: Byte; - fHeredocChecksum: Word; -{$ENDIF} - FTokenID: TtkTokenKind; - fIdentFuncTable: array[0..255] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fVariableAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AndSymbolProc; - procedure AtSymbolProc; - procedure BraceCloseProc; - procedure BraceOpenProc; - procedure CRProc; - procedure ColonProc; - procedure CommaProc; - procedure EqualProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure MultiplyProc; - procedure NotSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure PoundProc; - procedure QuestionProc; - procedure RemainderSymbolProc; - procedure RoundCloseProc; - procedure RoundOpenProc; - procedure SemiColonProc; - procedure SlashProc; - procedure SpaceProc; - procedure SquareCloseProc; - procedure SquareOpenProc; - procedure StringProc; - procedure VarExpansionProc; - procedure TildeProc; - procedure VariableProc; - procedure XOrSymbolProc; - procedure UnknownProc; - procedure AnsiCProc; - procedure String39Proc; - procedure String34Proc; -{$IFDEF SYN_HEREDOC} - procedure HeredocProc; -{$ENDIF} - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - procedure NextProcedure; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - 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 VariableAttri: TSynHighlighterAttributes read fVariableAttri - write fVariableAttri; - end; - -implementation - -uses - SynEditMiscProcs, - SynEditStrConst; - -const - KeyWords: array[0..73] of string = ( - '__class__', '__dir__', '__file__', '__function__', '__halt_compiler', - '__line__', '__method__', '__namespace__', 'abstract', 'and', 'array', 'as', - 'break', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', - 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', - 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', - 'extends', 'false', 'final', 'for', 'foreach', 'function', 'global', 'goto', - 'if', 'implements', 'include', 'include_once', 'instanceof', 'interface', - 'isset', 'list', 'namespace', 'new', 'null', 'old_function', 'or', 'print', - 'private', 'protected', 'public', 'require', 'require_once', 'return', - 'static', 'switch', 'synedit', 'throw', 'true', 'try', 'unset', 'use', - 'var', 'while', 'xor' - ); - - KeyIndices: array[0..222] of Integer = ( - -1, -1, 69, -1, -1, 1, 19, -1, -1, -1, -1, -1, -1, 35, -1, 17, -1, -1, 53, - 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 52, 36, -1, -1, 66, -1, 62, -1, 38, 15, 44, -1, -1, -1, -1, 32, -1, -1, 24, - 48, -1, -1, 56, 45, 65, 40, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, - -1, 60, -1, -1, -1, -1, -1, 31, 11, -1, 33, 20, 49, -1, -1, -1, 21, -1, -1, - -1, 54, -1, -1, -1, -1, -1, 29, -1, 64, -1, 23, -1, -1, 14, -1, -1, 42, -1, - -1, 0, 25, 50, -1, 58, 4, 27, -1, -1, 7, -1, -1, -1, -1, -1, 63, -1, 34, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 13, 47, 51, -1, -1, 2, -1, 37, -1, -1, 71, - 3, -1, 30, -1, 43, -1, -1, -1, -1, 57, 8, -1, -1, -1, -1, 41, 10, -1, 12, - 72, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 5, -1, 22, -1, -1, -1, 70, - 9, 18, -1, -1, -1, -1, -1, 59, 26, -1, -1, 16, -1, 68, -1, 61, -1, -1, -1, - 39, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1 - ); - -{$Q-} -function TSynPHPSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 252 + Ord(Str^) * 595; - inc(Str); - end; - Result := Result mod 223; - fStringLen := Str - fToIdent; -end;{$Q+} - -function TSynPHPSyn.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 TSynPHPSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynPHPSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynPHPSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then begin - Result := tkKey; - end else begin - Result := tkIdentifier; - end; -end; - -constructor TSynPHPSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(fVariableAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterPHP; - fRange := rsUnknown; -end; - -procedure TSynPHPSyn.AndSymbolProc; -begin - case FLine[Run + 1] of - '=': {and assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '&': {conditional and} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {and} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.AtSymbolProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynPHPSyn.BraceCloseProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynPHPSyn.BraceOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynPHPSyn.CRProc; -begin - fTokenID := tkSpace; - Case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynPHPSyn.ColonProc; -begin - inc(Run); {colon - conditional} - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.CommaProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.EqualProc; -begin - case FLine[Run + 1] of - '=': {logical equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': {Hash operator} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {assign} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.GreaterProc; -begin - case FLine[Run + 1] of - '=': {greater than or equal to} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {greater than} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynPHPSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynPHPSyn.LowerProc; -{$IFDEF SYN_HEREDOC} -var - i, Len : Integer; -{$ENDIF} -begin - case FLine[Run + 1] of - '=': {less than or equal to} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '<': - begin - fTokenID := tkSymbol; -{$IFDEF SYN_HEREDOC} - if (FLine[Run + 2] = '<') and IsIdentChar(FLine[Run + 3]) then - begin - inc(Run, 3); - - i := Run; - while IsIdentChar(FLine[i]) do Inc(i); - Len := i - Run; - - if Len > 255 then - begin - fTokenID := tkUnknown; - Exit; - end; - - fRange := rsHeredoc; - fHeredocLength := Len; - fHeredocChecksum := CalcFCS(FLine[Run], Len); - - Inc(Run, Len); - fTokenID := tkString; - end - else -{$ENDIF} - if FLine[Run + 2] = '=' then {shift left assign} - begin - inc(Run, 3) - end - else {shift left} - begin - inc(Run, 2); - end; - end; - else {less than} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.MinusProc; -begin - case FLine[Run + 1] of - '=': {subtract assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '-': {decrement} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': {Class operator} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {subtract} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.MultiplyProc; -begin - case FLine[Run + 1] of - '=': {multiply assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {multiply} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.NotSymbolProc; -begin - case FLine[Run + 1] of - '=': {not equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {logical complement} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynPHPSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynPHPSyn.OrSymbolProc; -begin - case FLine[Run + 1] of - '=': {inclusive or assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '|': {conditional or} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {inclusive or} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.PlusProc; -begin - case FLine[Run + 1] of - '=': {add assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '+': {increment} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {add} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.PointProc; -begin - inc(Run); {point} - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.PoundProc; -begin - repeat - inc(Run); - until IsLineEnd(Run); - fTokenID := tkComment; -end; - -procedure TSynPHPSyn.QuestionProc; -begin - fTokenID := tkSymbol; {question mark - conditional} - inc(Run); -end; - -procedure TSynPHPSyn.RemainderSymbolProc; -begin - case FLine[Run + 1] of - '=': {remainder assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {remainder} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.RoundCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.RoundOpenProc; -begin - inc(Run); - FTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.SemiColonProc; -begin - inc(Run); {semicolon} - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.SlashProc; -begin - case FLine[Run + 1] of - '/': {c++ style comments} - begin - inc(Run, 2); - fTokenID := tkComment; - while not IsLineEnd(Run) do - inc(Run); - end; - '*': - begin - fRange := rsComment; - inc(Run); - fTokenID := tkComment; {c style comment} - - inc(Run); - while not IsLineEnd(Run) do - if fLine[Run] = '*' then - begin - if fLine[Run + 1] = '/' then - begin - fRange := rsUnKnown; - inc(Run, 2); - break; - end - else - inc(Run) - end - else - inc(Run); - end; - '=': {division assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {division} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynPHPSyn.SquareCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.SquareOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.StringProc; - - function IsEscaped: Boolean; - var - iFirstSlashPos: Integer; - begin - iFirstSlashPos := Run -1; - while (iFirstSlashPos > 0) and (FLine[iFirstSlashPos] = '\') do - Dec(iFirstSlashPos); - Result := (Run - iFirstSlashPos + 1) mod 2 <> 0; - end; - -var - iCloseChar: WideChar; -begin - if IsLineEnd(Run) and (fTokenPos = Run) then - begin - NextProcedure; - Exit; - end; - fTokenID := tkString; - if fRange = rsString39 then - iCloseChar := #39 - else - iCloseChar := #34; - while not IsLineEnd(Run) do - begin - if (FLine[Run] = iCloseChar) and not IsEscaped then - break; - if (FLine[Run] = '$') and (iCloseChar = '"') and - ((FLine[Run + 1] = '{') or IsIdentChar(FLine[Run + 1])) then - begin - if (Run > 1) and (FLine[Run -1] = '{') then { complex syntax } - Dec(Run); - if not IsEscaped then - begin - { break the token to process the variable } - fRange := rsVarExpansion; - Exit; - end - else if FLine[Run] = '{' then - Inc(Run); { restore Run if we previously deincremented it } - end; - Inc(Run); - end; - if (FLine[Run] = iCloseChar) then - fRange := rsUnKnown; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynPHPSyn.VarExpansionProc; -type - TExpansionSyntax = (esNormal, esComplex, esBrace); -var - iSyntax: TExpansionSyntax; - iOpenBraces: integer; - iOpenBrackets: integer; - iTempRun: integer; -begin - fRange := rsString34; { var expansion only occurs in double quoted strings } - FTokenID := tkVariable; - if FLine[Run] = '{' then - begin - iSyntax := esComplex; - Inc(Run, 2); { skips '{$' } - end - else - begin - Inc( Run ); - if FLine[Run] = '{' then - begin - iSyntax := esBrace; - Inc(Run); - end - else - iSyntax := esNormal; - end; - if iSyntax in [esBrace, esComplex] then - begin - iOpenBraces := 1; - while not IsLineEnd(Run) do - begin - if FLine[Run] = '}' then - begin - Dec(iOpenBraces); - if iOpenBraces = 0 then - begin - Inc(Run); - break; - end; - end; - if FLine[Run] = '{' then - Inc(iOpenBraces); - Inc(Run); - end; - end - else - begin - while IsIdentChar(FLine[Run]) do - Inc(Run); - iOpenBrackets := 0; - iTempRun := Run; - { process arrays and objects } - while not IsLineEnd(iTempRun) do - begin - if FLine[iTempRun] = '[' then - begin - Inc( iTempRun ); - if FLine[iTempRun] = #39 then - begin - Inc(iTempRun); - while not IsLineEnd(iTempRun) and (FLine[iTempRun] <> #39) do - Inc(iTempRun); - if (FLine[iTempRun] = #39) and (fLine[iTempRun + 1 ] = ']') then - begin - Inc(iTempRun, 2); - Run := iTempRun; - continue; - end - else - break; - end - else - Inc(iOpenBrackets); - end - else if (FLine[iTempRun] = '-') and (FLine[iTempRun +1] = '>') then - Inc(iTempRun, 2) - else - break; - - if not IsIdentChar(FLine[iTempRun]) then - break - else - repeat - Inc(iTempRun); - until not IsIdentChar(FLine[iTempRun]); - - while FLine[iTempRun] = ']' do - begin - if iOpenBrackets = 0 then - break; - Dec(iOpenBrackets); - Inc(iTempRun); - end; - if iOpenBrackets = 0 then - Run := iTempRun; - end; - end; -end; - -procedure TSynPHPSyn.TildeProc; -begin - inc(Run); {bitwise complement} - fTokenId := tkSymbol; -end; - -procedure TSynPHPSyn.VariableProc; -begin - fTokenID := tkVariable; - inc(Run); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynPHPSyn.XOrSymbolProc; -begin - Case FLine[Run + 1] of - '=': {xor assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {xor} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPHPSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynPHPSyn.AnsiCProc; -begin - fTokenID := tkComment; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - if FLine[Run] = '*' then - begin - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - fRange := rsUnKnown; - break; - end - else - inc(Run); - end - else - inc(Run); -end; - -procedure TSynPHPSyn.String39Proc; -begin - fRange := rsString39; - Inc( Run ); - StringProc; -end; - -procedure TSynPHPSyn.String34Proc; -begin - fRange := rsString34; - Inc( Run ); - StringProc; -end; - -{$IFDEF SYN_HEREDOC} -procedure TSynPHPSyn.HeredocProc; - - procedure SkipToEOL; - begin - case FLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - repeat - inc(Run); - until IsLineEnd(Run); - end; - end; - -var - i: Integer; -begin - if IsLineEnd(Run) and (fTokenPos = Run) then - begin - NextProcedure; - Exit; - end; - fTokenID := tkString; - - if Run = 0 then - begin - i := 0; - - while not (IsLineEnd(FLine[i]) or (FLine[i] = ';')) do - begin - if i > fHeredocLength then - begin - SkipToEOL; - Exit; - end; - Inc(i); - end; - - if i <> fHeredocLength then - begin - SkipToEOL; - Exit; - end; - - if (CalcFCS(FLine[0], i) = fHeredocChecksum) then - begin - fRange := rsUnknown; - Run := i; - Exit; - end; - end; - - SkipToEOL; -end; -{$ENDIF} - -procedure TSynPHPSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: AnsiCProc; - rsString39, rsString34: StringProc; - rsVarExpansion: VarExpansionProc; -{$IFDEF SYN_HEREDOC} - rsHeredoc: HeredocProc; -{$ENDIF} - else - begin - fRange := rsUnknown; - NextProcedure; - end; - end; - - // ensure that one call of Next is enough to reach next token - if (fOldRun = Run) and not GetEol then Next; - - inherited; -end; - -procedure TSynPHPSyn.NextProcedure; -begin - case fLine[Run] of - '&': AndSymbolProc; - #39: String39Proc; // single quote - '@': AtSymbolProc; - '}': BraceCloseProc; - '{': BraceOpenProc; - #13: CRProc; - ':': ColonProc; - ',': CommaProc; - '=': EqualProc; - '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': MinusProc; - '*': MultiplyProc; - '!': NotSymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - '#': PoundProc; - '?': QuestionProc; - '%': RemainderSymbolProc; - ')': RoundCloseProc; - '(': RoundOpenProc; - ';': SemiColonProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - ']': SquareCloseProc; - '[': SquareOpenProc; - #34: String34Proc; // double quote - '~': TildeProc; - '$': VariableProc; - '^': XOrSymbolProc; - else UnknownProc; - end; -end; - -function TSynPHPSyn.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 TSynPHPSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynPHPSyn.GetRange: Pointer; -{$IFDEF SYN_HEREDOC} -var - RangePointer: TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(fRange); - RangePointer.Length := 0; - RangePointer.Checksum := 0; - if fRange = rsHeredoc then - begin - RangePointer.Length := fHeredocLength; - RangePointer.Checksum := fHeredocChecksum; - end; - Result := RangePointer.Ptr; -{$ELSE} - Result := Pointer(fRange); -{$ENDIF} -end; - -function TSynPHPSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynPHPSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkVariable: Result := fVariableAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynPHPSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynPHPSyn.ResetRange; -begin - fRange := rsUnknown; -{$IFDEF SYN_HEREDOC} - fHeredocLength := 0; - fHeredocChecksum := 0; -{$ENDIF} -end; - -procedure TSynPHPSyn.SetRange(Value: Pointer); -{$IFDEF SYN_HEREDOC} -var - RangePointer: TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer := TRangePointer(Value); - fRange := TRangeState(RangePointer.Range); - fHeredocLength := 0; - fHeredocChecksum := 0; - if fRange = rsHeredoc then - begin - fHeredocLength := RangePointer.Length; - fHeredocChecksum := RangePointer.Checksum; - end; -{$ELSE} - fRange := TRangeState(Value); -{$ENDIF} -end; - -function TSynPHPSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterPHP; -end; - -class function TSynPHPSyn.GetLanguageName: string; -begin - Result := SYNS_LangPHP; -end; - -function TSynPHPSyn.GetSampleSource: string; -begin - Result := '// Syntax highlighting'#13#10+ - 'function printNumber()'#13#10+ - '{'#13#10+ - ' $number = 1234;'#13#10+ - ' print "The number is $number";'#13#10+ - ' for ($i = 0; $i <= $number; $i++)'#13#10+ - ' {'#13#10+ - ' $x++;'#13#10+ - ' $x--;'#13#10+ - ' $x += 1.0;'#13#10+ - ' }'#13#10+ - '}'; - -end; - -class function TSynPHPSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangPHP; -end; - -initialization - RegisterPlaceableHighlighter(TSynPHPSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterPHP.pas, released 2000-04-21. +The Original Code is based on the wmPHPSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Willo van der Merwe. +"Heredoc" syntax highlighting implementation by Marko Njezic. +Unicode translation by Ma?l H?rz. +PHP5 keywords added by CodehunterWorks. +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: SynHighlighterPHP.pas,v 1.22.3.0 2012/09/11 16:25:00 codehunterworks Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a PHP syntax highlighter for SynEdit) +@author(Willo van der Merwe , converted to SynEdit by Bruno Mikkelsen ) +@created(1999, converted to SynEdit 2000-04-21) +@lastmod(2000-06-23) +The SynHighlighterPHP unit provides SynEdit with a PHP syntax highlighter. +Thanks to Martin Waldenburg. +} + +unit SynHighlighterPHP; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, + tkNumber, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); + +{$IFDEF SYN_HEREDOC} + TRangeState = (rsUnknown, rsString39, rsString34, rsComment, rsVarExpansion, + rsHeredoc); + + TRangePointer = packed record + case Boolean of + True: (Ptr: Pointer); + False: (Range: Byte; Length: Byte; Checksum: Word); + end; +{$ELSE} + TRangeState = (rsUnknown, rsString39, rsString34, rsComment, rsVarExpansion); +{$ENDIF} + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynPHPSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; +{$IFDEF SYN_HEREDOC} + FHeredocLength: Byte; + FHeredocChecksum: Word; +{$ENDIF} + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..255] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FVariableAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AndSymbolProc; + procedure AtSymbolProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure ColonProc; + procedure CommaProc; + procedure EqualProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure MultiplyProc; + procedure NotSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure PoundProc; + procedure QuestionProc; + procedure RemainderSymbolProc; + procedure RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StringProc; + procedure VarExpansionProc; + procedure TildeProc; + procedure VariableProc; + procedure XOrSymbolProc; + procedure UnknownProc; + procedure AnsiCProc; + procedure String39Proc; + procedure String34Proc; +{$IFDEF SYN_HEREDOC} + procedure HeredocProc; +{$ENDIF} + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + procedure NextProcedure; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + 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 VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + end; + +implementation + +uses + SynEditMiscProcs, + SynEditStrConst; + +const + KeyWords: array[0..73] of UnicodeString = ( + '__class__', '__dir__', '__file__', '__function__', '__halt_compiler', + '__line__', '__method__', '__namespace__', 'abstract', 'and', 'array', 'as', + 'break', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', + 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', + 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', + 'extends', 'false', 'final', 'for', 'foreach', 'function', 'global', 'goto', + 'if', 'implements', 'include', 'include_once', 'instanceof', 'interface', + 'isset', 'list', 'namespace', 'new', 'null', 'old_function', 'or', 'print', + 'private', 'protected', 'public', 'require', 'require_once', 'return', + 'static', 'switch', 'synedit', 'throw', 'true', 'try', 'unset', 'use', + 'var', 'while', 'xor' + ); + + KeyIndices: array[0..222] of Integer = ( + -1, -1, 69, -1, -1, 1, 19, -1, -1, -1, -1, -1, -1, 35, -1, 17, -1, -1, 53, + 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, + 52, 36, -1, -1, 66, -1, 62, -1, 38, 15, 44, -1, -1, -1, -1, 32, -1, -1, 24, + 48, -1, -1, 56, 45, 65, 40, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, + -1, 60, -1, -1, -1, -1, -1, 31, 11, -1, 33, 20, 49, -1, -1, -1, 21, -1, -1, + -1, 54, -1, -1, -1, -1, -1, 29, -1, 64, -1, 23, -1, -1, 14, -1, -1, 42, -1, + -1, 0, 25, 50, -1, 58, 4, 27, -1, -1, 7, -1, -1, -1, -1, -1, 63, -1, 34, -1, + -1, -1, -1, -1, -1, -1, -1, 28, 13, 47, 51, -1, -1, 2, -1, 37, -1, -1, 71, + 3, -1, 30, -1, 43, -1, -1, -1, -1, 57, 8, -1, -1, -1, -1, 41, 10, -1, 12, + 72, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 5, -1, 22, -1, -1, -1, 70, + 9, 18, -1, -1, -1, -1, -1, 59, 26, -1, -1, 16, -1, 68, -1, 61, -1, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1 + ); + +{$Q-} +function TSynPHPSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 252 + Ord(Str^) * 595; + Inc(Str); + end; + Result := Result mod 223; + FStringLen := Str - FToIdent; +end;{$Q+} + +function TSynPHPSyn.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 TSynPHPSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynPHPSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynPHPSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then begin + Result := tkKey; + end else begin + Result := tkIdentifier; + end; +end; + +constructor TSynPHPSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(FVariableAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterPHP; + FRange := rsUnknown; +end; + +procedure TSynPHPSyn.AndSymbolProc; +begin + case FLine[Run + 1] of + '=': {and assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '&': {conditional and} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {and} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.AtSymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.BraceCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else + Inc(Run); + end; +end; + +procedure TSynPHPSyn.ColonProc; +begin + Inc(Run); {colon - conditional} + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.CommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.EqualProc; +begin + case FLine[Run + 1] of + '=': {logical equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': {Hash operator} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {assign} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.GreaterProc; +begin + case FLine[Run + 1] of + '=': {greater than or equal to} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {greater than} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynPHPSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynPHPSyn.LowerProc; +{$IFDEF SYN_HEREDOC} +var + i, Len : Integer; +{$ENDIF} +begin + case FLine[Run + 1] of + '=': {less than or equal to} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '<': + begin + FTokenID := tkSymbol; +{$IFDEF SYN_HEREDOC} + if (FLine[Run + 2] = '<') and IsIdentChar(FLine[Run + 3]) then + begin + Inc(Run, 3); + + i := Run; + while IsIdentChar(FLine[i]) do Inc(i); + Len := i - Run; + + if Len > 255 then + begin + FTokenID := tkUnknown; + Exit; + end; + + FRange := rsHeredoc; + FHeredocLength := Len; + FHeredocChecksum := CalcFCS(FLine[Run], Len); + + Inc(Run, Len); + FTokenID := tkString; + end + else +{$ENDIF} + if FLine[Run + 2] = '=' then {shift left assign} + begin + Inc(Run, 3) + end + else {shift left} + begin + Inc(Run, 2); + end; + end; + else {less than} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.MinusProc; +begin + case FLine[Run + 1] of + '=': {subtract assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '-': {decrement} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': {Class operator} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {subtract} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.MultiplyProc; +begin + case FLine[Run + 1] of + '=': {multiply assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {multiply} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.NotSymbolProc; +begin + case FLine[Run + 1] of + '=': {not equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {logical complement} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynPHPSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynPHPSyn.OrSymbolProc; +begin + case FLine[Run + 1] of + '=': {inclusive or assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '|': {conditional or} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {inclusive or} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.PlusProc; +begin + case FLine[Run + 1] of + '=': {add assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '+': {increment} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {add} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.PointProc; +begin + Inc(Run); {point} + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.PoundProc; +begin + repeat + Inc(Run); + until IsLineEnd(Run); + FTokenID := tkComment; +end; + +procedure TSynPHPSyn.QuestionProc; +begin + FTokenID := tkSymbol; {question mark - conditional} + Inc(Run); +end; + +procedure TSynPHPSyn.RemainderSymbolProc; +begin + case FLine[Run + 1] of + '=': {remainder assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {remainder} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.RoundCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.SemiColonProc; +begin + Inc(Run); {semicolon} + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.SlashProc; +begin + case FLine[Run + 1] of + '/': {c++ style comments} + begin + Inc(Run, 2); + FTokenID := tkComment; + while not IsLineEnd(Run) do + Inc(Run); + end; + '*': + begin + FRange := rsComment; + Inc(Run); + FTokenID := tkComment; {c style comment} + + Inc(Run); + while not IsLineEnd(Run) do + if FLine[Run] = '*' then + begin + if FLine[Run + 1] = '/' then + begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end + else + Inc(Run) + end + else + Inc(Run); + end; + '=': {division assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {division} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynPHPSyn.SquareCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.SquareOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.StringProc; + + function IsEscaped: Boolean; + var + iFirstSlashPos: Integer; + begin + iFirstSlashPos := Run -1; + while (iFirstSlashPos > 0) and (FLine[iFirstSlashPos] = '\') do + Dec(iFirstSlashPos); + Result := (Run - iFirstSlashPos + 1) mod 2 <> 0; + end; + +var + iCloseChar: WideChar; +begin + if IsLineEnd(Run) and (FTokenPos = Run) then + begin + NextProcedure; + Exit; + end; + FTokenID := tkString; + if FRange = rsString39 then + iCloseChar := #39 + else + iCloseChar := #34; + while not IsLineEnd(Run) do + begin + if (FLine[Run] = iCloseChar) and not IsEscaped then + Break; + if (FLine[Run] = '$') and (iCloseChar = '"') and + ((FLine[Run + 1] = '{') or IsIdentChar(FLine[Run + 1])) then + begin + if (Run > 1) and (FLine[Run -1] = '{') then { complex syntax } + Dec(Run); + if not IsEscaped then + begin + { break the token to process the variable } + FRange := rsVarExpansion; + Exit; + end + else if FLine[Run] = '{' then + Inc(Run); { restore Run if we previously deincremented it } + end; + Inc(Run); + end; + if (FLine[Run] = iCloseChar) then + FRange := rsUnknown; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynPHPSyn.VarExpansionProc; +type + TExpansionSyntax = (esNormal, esComplex, esBrace); +var + iSyntax: TExpansionSyntax; + iOpenBraces: Integer; + iOpenBrackets: Integer; + iTempRun: Integer; +begin + FRange := rsString34; { var expansion only occurs in double quoted strings } + FTokenID := tkVariable; + if FLine[Run] = '{' then + begin + iSyntax := esComplex; + Inc(Run, 2); { skips '{$' } + end + else + begin + Inc( Run ); + if FLine[Run] = '{' then + begin + iSyntax := esBrace; + Inc(Run); + end + else + iSyntax := esNormal; + end; + if iSyntax in [esBrace, esComplex] then + begin + iOpenBraces := 1; + while not IsLineEnd(Run) do + begin + if FLine[Run] = '}' then + begin + Dec(iOpenBraces); + if iOpenBraces = 0 then + begin + Inc(Run); + Break; + end; + end; + if FLine[Run] = '{' then + Inc(iOpenBraces); + Inc(Run); + end; + end + else + begin + while IsIdentChar(FLine[Run]) do + Inc(Run); + iOpenBrackets := 0; + iTempRun := Run; + { process arrays and objects } + while not IsLineEnd(iTempRun) do + begin + if FLine[iTempRun] = '[' then + begin + Inc( iTempRun ); + if FLine[iTempRun] = #39 then + begin + Inc(iTempRun); + while not IsLineEnd(iTempRun) and (FLine[iTempRun] <> #39) do + Inc(iTempRun); + if (FLine[iTempRun] = #39) and (FLine[iTempRun + 1 ] = ']') then + begin + Inc(iTempRun, 2); + Run := iTempRun; + continue; + end + else + Break; + end + else + Inc(iOpenBrackets); + end + else if (FLine[iTempRun] = '-') and (FLine[iTempRun +1] = '>') then + Inc(iTempRun, 2) + else + Break; + + if not IsIdentChar(FLine[iTempRun]) then + Break + else + repeat + Inc(iTempRun); + until not IsIdentChar(FLine[iTempRun]); + + while FLine[iTempRun] = ']' do + begin + if iOpenBrackets = 0 then + Break; + Dec(iOpenBrackets); + Inc(iTempRun); + end; + if iOpenBrackets = 0 then + Run := iTempRun; + end; + end; +end; + +procedure TSynPHPSyn.TildeProc; +begin + Inc(Run); {bitwise complement} + FTokenID := tkSymbol; +end; + +procedure TSynPHPSyn.VariableProc; +begin + FTokenID := tkVariable; + Inc(Run); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynPHPSyn.XOrSymbolProc; +begin + case FLine[Run + 1] of + '=': {xor assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {xor} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPHPSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynPHPSyn.AnsiCProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + if FLine[Run] = '*' then + begin + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end + else + Inc(Run); + end + else + Inc(Run); +end; + +procedure TSynPHPSyn.String39Proc; +begin + FRange := rsString39; + Inc( Run ); + StringProc; +end; + +procedure TSynPHPSyn.String34Proc; +begin + FRange := rsString34; + Inc( Run ); + StringProc; +end; + +{$IFDEF SYN_HEREDOC} +procedure TSynPHPSyn.HeredocProc; + + procedure SkipToEOL; + begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + repeat + Inc(Run); + until IsLineEnd(Run); + end; + end; + +var + i: Integer; +begin + if IsLineEnd(Run) and (FTokenPos = Run) then + begin + NextProcedure; + Exit; + end; + FTokenID := tkString; + + if Run = 0 then + begin + i := 0; + + while not (IsLineEnd(FLine[i]) or (FLine[i] = ';')) do + begin + if i > FHeredocLength then + begin + SkipToEOL; + Exit; + end; + Inc(i); + end; + + if i <> FHeredocLength then + begin + SkipToEOL; + Exit; + end; + + if (CalcFCS(FLine[0], i) = FHeredocChecksum) then + begin + FRange := rsUnknown; + Run := i; + Exit; + end; + end; + + SkipToEOL; +end; +{$ENDIF} + +procedure TSynPHPSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: AnsiCProc; + rsString39, rsString34: StringProc; + rsVarExpansion: VarExpansionProc; +{$IFDEF SYN_HEREDOC} + rsHeredoc: HeredocProc; +{$ENDIF} + else + begin + FRange := rsUnknown; + NextProcedure; + end; + end; + + // ensure that one call of Next is enough to reach next token + if (fOldRun = Run) and not GetEol then Next; + + inherited; +end; + +procedure TSynPHPSyn.NextProcedure; +begin + case FLine[Run] of + '&': AndSymbolProc; + #39: String39Proc; // single quote + '@': AtSymbolProc; + '}': BraceCloseProc; + '{': BraceOpenProc; + #13: CRProc; + ':': ColonProc; + ',': CommaProc; + '=': EqualProc; + '>': GreaterProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + '-': MinusProc; + '*': MultiplyProc; + '!': NotSymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + '#': PoundProc; + '?': QuestionProc; + '%': RemainderSymbolProc; + ')': RoundCloseProc; + '(': RoundOpenProc; + ';': SemiColonProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + ']': SquareCloseProc; + '[': SquareOpenProc; + #34: String34Proc; // double quote + '~': TildeProc; + '$': VariableProc; + '^': XOrSymbolProc; + else UnknownProc; + end; +end; + +function TSynPHPSyn.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 TSynPHPSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynPHPSyn.GetRange: Pointer; +{$IFDEF SYN_HEREDOC} +var + RangePointer: TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer.Range := Ord(FRange); + RangePointer.Length := 0; + RangePointer.Checksum := 0; + if FRange = rsHeredoc then + begin + RangePointer.Length := FHeredocLength; + RangePointer.Checksum := FHeredocChecksum; + end; + Result := RangePointer.Ptr; +{$ELSE} + Result := Pointer(FRange); +{$ENDIF} +end; + +function TSynPHPSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynPHPSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkVariable: Result := FVariableAttri; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynPHPSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynPHPSyn.ResetRange; +begin + FRange := rsUnknown; +{$IFDEF SYN_HEREDOC} + FHeredocLength := 0; + FHeredocChecksum := 0; +{$ENDIF} +end; + +procedure TSynPHPSyn.SetRange(Value: Pointer); +{$IFDEF SYN_HEREDOC} +var + RangePointer: TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer := TRangePointer(Value); + FRange := TRangeState(RangePointer.Range); + FHeredocLength := 0; + FHeredocChecksum := 0; + if FRange = rsHeredoc then + begin + FHeredocLength := RangePointer.Length; + FHeredocChecksum := RangePointer.Checksum; + end; +{$ELSE} + FRange := TRangeState(Value); +{$ENDIF} +end; + +function TSynPHPSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterPHP; +end; + +class function TSynPHPSyn.GetLanguageName: string; +begin + Result := SYNS_LangPHP; +end; + +function TSynPHPSyn.GetSampleSource: UnicodeString; +begin + Result := '// Syntax highlighting'#13#10+ + 'function printNumber()'#13#10+ + '{'#13#10+ + ' $number = 1234;'#13#10+ + ' print "The number is $number";'#13#10+ + ' for ($i = 0; $i <= $number; $i++)'#13#10+ + ' {'#13#10+ + ' $x++;'#13#10+ + ' $x--;'#13#10+ + ' $x += 1.0;'#13#10+ + ' }'#13#10+ + '}'; + +end; + +class function TSynPHPSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangPHP; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynPHPSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterPas.pas b/Source/VCL/SynEdit/Source/SynHighlighterPas.pas index 7dafcb40..7c300fb0 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterPas.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterPas.pas @@ -1,1582 +1,1608 @@ -{------------------------------------------------------------------------------ -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. - -The Original Code is: SynHighlighterPas.pas, released 2000-04-17. -The Original Code is based on the mwPasSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Martin Waldenburg. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -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: SynHighlighterPas.pas,v 1.27.2.10 2009/02/23 15:43:50 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Pascal/Delphi syntax highlighter for SynEdit) -@author(Martin Waldenburg) -@created(1998, converted to SynEdit 2000-04-07) -@lastmod(2004-03-19) -The SynHighlighterPas unit provides SynEdit with a Object Pascal syntax highlighter. -Two extra properties included (DelphiVersion, PackageSource): - DelphiVersion - Allows you to enable/disable the highlighting of various - language enhancements added in the different Delphi versions. - PackageSource - Allows you to enable/disable the highlighting of package keywords -} - -unit SynHighlighterPas; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, -//++ CodeFolding - SynEditCodeFolding, - RegularExpressions, -//-- CodeFolding - Classes; - -type - TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown, tkFloat, tkHex, tkDirec, tkChar); - - TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, - rsExports, rsDirective, rsDirectiveAsm, rsUnKnown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TDelphiVersion = (dvDelphi1, dvDelphi2, dvDelphi3, dvDelphi4, dvDelphi5, - dvDelphi6, dvDelphi7, dvDelphi8, dvDelphi2005); - -const - LastDelphiVersion = dvDelphi2005; - BDSVersionPrefix = 'BDS'; - -type -//++ CodeFolding - TSynPasSyn = class(TSynCustomCodeFoldingHighlighter) -//-- CodeFolding - private - fAsmStart: Boolean; - fRange: TRangeState; - fIdentFuncTable: array[0..388] of TIdentFuncTableFunc; - fTokenID: TtkTokenKind; - fStringAttri: TSynHighlighterAttributes; - fCharAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fFloatAttri: TSynHighlighterAttributes; - fHexAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fAsmAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fDirecAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fDelphiVersion: TDelphiVersion; - fPackageSource: Boolean; -//++ CodeFolding - RE_BlockBegin : TRegEx; - RE_BlockEnd : TRegEx; - RE_Code: TRegEx; -//-- CodeFolding - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function FuncAsm(Index: Integer): TtkTokenKind; - function FuncAutomated(Index: Integer): TtkTokenKind; - function FuncCdecl(Index: Integer): TtkTokenKind; - function FuncContains(Index: Integer): TtkTokenKind; - function FuncDeprecated(Index: Integer): TtkTokenKind; - function FuncDispid(Index: Integer): TtkTokenKind; - function FuncDispinterface(Index: Integer): TtkTokenKind; - function FuncEnd(Index: Integer): TtkTokenKind; - function FuncExports(Index: Integer): TtkTokenKind; - function FuncFinal(Index: Integer): TtkTokenKind; - function FuncFinalization(Index: Integer): TtkTokenKind; - function FuncHelper(Index: Integer): TtkTokenKind; - function FuncImplements(Index: Integer): TtkTokenKind; - function FuncIndex(Index: Integer): TtkTokenKind; - function FuncName(Index: Integer): TtkTokenKind; - function FuncNodefault(Index: Integer): TtkTokenKind; - function FuncOperator(Index: Integer): TtkTokenKind; - function FuncOverload(Index: Integer): TtkTokenKind; - function FuncPackage(Index: Integer): TtkTokenKind; - function FuncPlatform(Index: Integer): TtkTokenKind; - function FuncProperty(Index: Integer): TtkTokenKind; - function FuncRead(Index: Integer): TtkTokenKind; - function FuncReadonly(Index: Integer): TtkTokenKind; - function FuncReintroduce(Index: Integer): TtkTokenKind; - function FuncRequires(Index: Integer): TtkTokenKind; - function FuncResourcestring(Index: Integer): TtkTokenKind; - function FuncSafecall(Index: Integer): TtkTokenKind; - function FuncSealed(Index: Integer): TtkTokenKind; - function FuncStdcall(Index: Integer): TtkTokenKind; - function FuncStored(Index: Integer): TtkTokenKind; - function FuncStringresource(Index: Integer): TtkTokenKind; - function FuncThreadvar(Index: Integer): TtkTokenKind; - function FuncWrite(Index: Integer): TtkTokenKind; - function FuncWriteonly(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AddressOpProc; - procedure AsciiCharProc; - procedure AnsiProc; - procedure BorProc; - procedure BraceOpenProc; - procedure ColonOrGreaterProc; - procedure CRProc; - procedure IdentProc; - procedure IntegerProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure PointProc; - procedure RoundOpenProc; - procedure SemicolonProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - procedure SetDelphiVersion(const Value: TDelphiVersion); - procedure SetPackageSource(const Value: Boolean); - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetCapabilities: TSynHighlighterCapabilities; override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenID: TtkTokenKind; - function GetTokenKind: Integer; override; - procedure Next; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - function UseUserSettings(VersionIndex: Integer): Boolean; override; - procedure EnumUserSettings(DelphiVersions: TStrings); override; -//++ CodeFolding - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; - procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings); override; -//-- CodeFolding - published - property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property DirectiveAttri: TSynHighlighterAttributes read fDirecAttri - write fDirecAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property FloatAttri: TSynHighlighterAttributes read fFloatAttri - write fFloatAttri; - property HexAttri: TSynHighlighterAttributes read fHexAttri - write fHexAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property CharAttri: TSynHighlighterAttributes read fCharAttri - write fCharAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property DelphiVersion: TDelphiVersion read fDelphiVersion write SetDelphiVersion - default LastDelphiVersion; - property PackageSource: Boolean read fPackageSource write SetPackageSource default True; - end; - -implementation - -uses - SynEditStrConst; - -const - // if the language is case-insensitive keywords *must* be in lowercase - KeyWords: array[0..110] of string = ( - 'absolute', 'abstract', 'and', 'array', 'as', 'asm', 'assembler', - 'automated', 'begin', 'case', 'cdecl', 'class', 'const', 'constructor', - 'contains', 'default', 'deprecated', 'destructor', 'dispid', - 'dispinterface', 'div', 'do', 'downto', 'dynamic', 'else', 'end', 'except', - 'export', 'exports', 'external', 'far', 'file', 'final', 'finalization', - 'finally', 'for', 'forward', 'function', 'goto', 'helper', 'if', - 'implementation', 'implements', 'in', 'index', 'inherited', - 'initialization', 'inline', 'interface', 'is', 'label', 'library', - 'message', 'mod', 'name', 'near', 'nil', 'nodefault', 'not', 'object', 'of', - 'on', 'operator', 'or', 'out', 'overload', 'override', 'package', 'packed', - 'pascal', 'platform', 'private', 'procedure', 'program', 'property', - 'protected', 'public', 'published', 'raise', 'read', 'readonly', 'record', - 'register', 'reintroduce', 'repeat', 'requires', 'resourcestring', - 'safecall', 'sealed', 'set', 'shl', 'shr', 'stdcall', 'stored', 'string', - 'stringresource', 'then', 'threadvar', 'to', 'try', 'type', 'unit', 'until', - 'uses', 'var', 'virtual', 'while', 'with', 'write', 'writeonly', 'xor' - ); - - KeyIndices: array[0..388] of Integer = ( - -1, -1, -1, 105, -1, 51, -1, 108, -1, -1, -1, -1, -1, 75, -1, -1, 46, -1, - -1, 103, -1, -1, -1, -1, 55, -1, -1, -1, -1, 76, -1, -1, 96, 14, -1, 31, 3, - 102, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 25, -1, - -1, 56, 65, 95, -1, -1, -1, 34, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, 50, -1, -1, 109, 98, -1, - 86, -1, 13, -1, -1, -1, 107, -1, -1, 60, -1, 0, 64, -1, -1, -1, -1, 8, 10, - -1, -1, -1, 67, -1, -1, -1, 74, -1, 17, -1, 73, 69, -1, 68, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 16, -1, -1, 23, 39, -1, 35, 30, -1, -1, -1, 70, -1, 37, - -1, -1, 89, 71, 84, 72, -1, 29, 40, -1, -1, -1, 32, -1, -1, -1, 94, -1, -1, - 87, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 11, 57, 41, 6, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 97, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 12, -1, -1, 101, -1, 58, -1, -1, -1, 99, -1, -1, - -1, -1, 53, 20, -1, -1, -1, 36, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, 59, - -1, 110, -1, 15, -1, 52, -1, -1, -1, -1, 5, 48, -1, -1, -1, 81, -1, 28, -1, - -1, -1, 2, -1, 1, -1, 106, -1, -1, -1, -1, 90, -1, 83, -1, -1, -1, -1, -1, - 79, -1, -1, 33, 62, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, 88, - 61, 54, -1, 42, -1, -1, -1, 66, -1, -1, -1, 92, 100, -1, -1, -1, -1, -1, 18, - -1, -1, 26, 47, 38, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 9, -1, 91, -1, -1, -1, -1, -1, -1, 49, -1, 21, -1, -1, -1, -1, -1, -1, 43, - -1, 82, -1, 19, 104, -1, -1, -1, -1, -1 - ); - -{$Q-} -function TSynPasSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 812 + Ord(Str^) * 76; - inc(Str); - end; - Result := Result mod 389; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynPasSyn.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 TSynPasSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[275] := FuncAsm; - fIdentFuncTable[41] := FuncAutomated; - fIdentFuncTable[112] := FuncCdecl; - fIdentFuncTable[33] := FuncContains; - fIdentFuncTable[137] := FuncDeprecated; - fIdentFuncTable[340] := FuncDispid; - fIdentFuncTable[382] := FuncDispinterface; - fIdentFuncTable[54] := FuncEnd; - fIdentFuncTable[282] := FuncExports; - fIdentFuncTable[163] := FuncFinal; - fIdentFuncTable[306] := FuncFinalization; - fIdentFuncTable[141] := FuncHelper; - fIdentFuncTable[325] := FuncImplements; - fIdentFuncTable[214] := FuncIndex; - fIdentFuncTable[323] := FuncName; - fIdentFuncTable[185] := FuncNodefault; - fIdentFuncTable[307] := FuncOperator; - fIdentFuncTable[58] := FuncOverload; - fIdentFuncTable[116] := FuncPackage; - fIdentFuncTable[148] := FuncPlatform; - fIdentFuncTable[120] := FuncProperty; - fIdentFuncTable[303] := FuncRead; - fIdentFuncTable[83] := FuncReadonly; - fIdentFuncTable[297] := FuncReintroduce; - fIdentFuncTable[65] := FuncRequires; - fIdentFuncTable[94] := FuncResourcestring; - fIdentFuncTable[170] := FuncSafecall; - fIdentFuncTable[321] := FuncSealed; - fIdentFuncTable[333] := FuncStdcall; - fIdentFuncTable[348] := FuncStored; - fIdentFuncTable[59] := FuncStringresource; - fIdentFuncTable[204] := FuncThreadvar; - fIdentFuncTable[7] := FuncWrite; - fIdentFuncTable[91] := FuncWriteonly; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynPasSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier -end; - -function TSynPasSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -function TSynPasSyn.FuncAsm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - Result := tkKey; - fRange := rsAsm; - fAsmStart := True; - end - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncAutomated(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncCdecl(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncContains(Index: Integer): TtkTokenKind; -begin - if PackageSource and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncDeprecated(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi6) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncDispid(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncDispinterface(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncEnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - Result := tkKey; - fRange := rsUnknown; - end - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncExports(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - Result := tkKey; - fRange := rsExports; - end - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncFinal(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncFinalization(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncHelper(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncImplements(Index: Integer): TtkTokenKind; -begin - if (fRange = rsProperty) and (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncIndex(Index: Integer): TtkTokenKind; -begin - if (fRange in [rsProperty, rsExports]) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncName(Index: Integer): TtkTokenKind; -begin - if (fRange = rsExports) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncNodefault(Index: Integer): TtkTokenKind; -begin - if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncOperator(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncOverload(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncPackage(Index: Integer): TtkTokenKind; -begin - if PackageSource and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncPlatform(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi6) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncProperty(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - Result := tkKey; - fRange := rsProperty; - end - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncRead(Index: Integer): TtkTokenKind; -begin - if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncReadonly(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncReintroduce(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncRequires(Index: Integer): TtkTokenKind; -begin - if PackageSource and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncResourcestring(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncSafecall(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncSealed(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncStdcall(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncStored(Index: Integer): TtkTokenKind; -begin - if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncStringresource(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncThreadvar(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncWrite(Index: Integer): TtkTokenKind; -begin - if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPasSyn.FuncWriteonly(Index: Integer): TtkTokenKind; -begin - if (DelphiVersion >= dvDelphi3) and (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -constructor TSynPasSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fCaseSensitive := False; - - fDelphiVersion := LastDelphiVersion; - fPackageSource := True; - - fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); - AddAttribute(fAsmAttri); - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - fDirecAttri.Style:= [fsItalic]; - AddAttribute(fDirecAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); - AddAttribute(fFloatAttri); - fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); - AddAttribute(fHexAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); - AddAttribute(fCharAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - - InitIdent; - fRange := rsUnknown; - fAsmStart := False; - fDefaultFilter := SYNS_FilterPascal; - -//++ CodeFolding - RE_BlockBegin.Create('\b(begin|record|class)\b', [roNotEmpty, roIgnoreCase]); - RE_BlockEnd.Create('\bend\b', [roNotEmpty, roIgnoreCase]); - RE_Code.Create('^\s*(function|procedure)\b', [roNotEmpty, roIgnoreCase]); -//-- CodeFolding -end; - -procedure TSynPasSyn.AddressOpProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '@' then inc(Run); -end; - -procedure TSynPasSyn.AsciiCharProc; - - function IsAsciiChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '$', 'A'..'F', 'a'..'f': - Result := True; - else - Result := False; - end; - end; - -begin - fTokenID := tkChar; - Inc(Run); - while IsAsciiChar do - Inc(Run); -end; - -procedure TSynPasSyn.BorProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - begin - if fRange in [rsDirective, rsDirectiveAsm] then - fTokenID := tkDirec - else - fTokenID := tkComment; - repeat - if fLine[Run] = '}' then - begin - Inc(Run); - if fRange in [rsBorAsm, rsDirectiveAsm] then - fRange := rsAsm - else - fRange := rsUnKnown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; - -procedure TSynPasSyn.BraceOpenProc; -begin - if (fLine[Run + 1] = '$') then - begin - if fRange = rsAsm then - fRange := rsDirectiveAsm - else - fRange := rsDirective; - end - else - begin - if fRange = rsAsm then - fRange := rsBorAsm - else - fRange := rsBor; - end; - BorProc; -end; - -procedure TSynPasSyn.ColonOrGreaterProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynPasSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then - Inc(Run); -end; - -procedure TSynPasSyn.IdentProc; -begin - fTokenID := IdentKind(fLine + Run); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); -end; - -procedure TSynPasSyn.IntegerProc; - - function IsIntegerChar: Boolean; - begin - case fLine[Run] of - '0'..'9', 'A'..'F', 'a'..'f': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkHex; - while IsIntegerChar do - Inc(Run); -end; - -procedure TSynPasSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynPasSyn.LowerProc; -begin - fTokenID := tkSymbol; - inc(Run); - if (fLine[Run] = '=') or (fLine[Run] = '>') then - Inc(Run); -end; - -procedure TSynPasSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynPasSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E', '-', '+': - Result := True; - else - Result := False; - end; - end; - -begin - Inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case fLine[Run] of - '.': - if fLine[Run + 1] = '.' then - Break - else - fTokenID := tkFloat; - 'e', 'E': fTokenID := tkFloat; - '-', '+': - begin - if fTokenID <> tkFloat then // arithmetic - Break; - if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then - Break; //float, but it ends here - end; - end; - Inc(Run); - end; -end; - -procedure TSynPasSyn.PointProc; -begin - fTokenID := tkSymbol; - inc(Run); - if (fLine[Run] = '.') or (fLine[Run - 1] = ')') then - Inc(Run); -end; - -procedure TSynPasSyn.AnsiProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - fTokenID := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then begin - Inc(Run, 2); - if fRange = rsAnsiAsm then - fRange := rsAsm - else - fRange := rsUnKnown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynPasSyn.RoundOpenProc; -begin - Inc(Run); - case fLine[Run] of - '*': - begin - Inc(Run); - if fRange = rsAsm then - fRange := rsAnsiAsm - else - fRange := rsAnsi; - fTokenID := tkComment; - if not IsLineEnd(Run) then - AnsiProc; - end; - '.': - begin - inc(Run); - fTokenID := tkSymbol; - end; - else - fTokenID := tkSymbol; - end; -end; - -procedure TSynPasSyn.SemicolonProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if fRange in [rsProperty, rsExports] then - fRange := rsUnknown; -end; - -procedure TSynPasSyn.SlashProc; -begin - Inc(Run); - if (fLine[Run] = '/') and (fDelphiVersion > dvDelphi1) then - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end - else - fTokenID := tkSymbol; -end; - -procedure TSynPasSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynPasSyn.StringProc; -begin - fTokenID := tkString; - Inc(Run); - while not IsLineEnd(Run) do - begin - if fLine[Run] = #39 then begin - Inc(Run); - if fLine[Run] <> #39 then - break; - end; - Inc(Run); - end; -end; - -procedure TSynPasSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPasSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynPasSyn.Next; -begin - fAsmStart := False; - fTokenPos := Run; - case fRange of - rsAnsi, rsAnsiAsm: - AnsiProc; - rsBor, rsBorAsm, rsDirective, rsDirectiveAsm: - BorProc; - else - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '#': AsciiCharProc; - '$': IntegerProc; - #39: StringProc; - '0'..'9': NumberProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '{': BraceOpenProc; - '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': - begin - case fLine[Run] of - '(': RoundOpenProc; - '.': PointProc; - ';': SemicolonProc; - '/': SlashProc; - ':', '>': ColonOrGreaterProc; - '<': LowerProc; - '@': AddressOpProc; - else - SymbolProc; - end; - end; - else - UnknownProc; - end; - end; - inherited; -end; - -function TSynPasSyn.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 TSynPasSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynPasSyn.GetTokenID: TtkTokenKind; -begin - if not fAsmStart and (fRange = rsAsm) - and not (fTokenId in [tkNull, tkComment, tkDirec, tkSpace]) - then - Result := tkAsm - else - Result := fTokenId; -end; - -function TSynPasSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkAsm: Result := fAsmAttri; - tkComment: Result := fCommentAttri; - tkDirec: Result := fDirecAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkFloat: Result := fFloatAttri; - tkHex: Result := fHexAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkChar: Result := fCharAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynPasSyn.GetTokenKind: Integer; -begin - Result := Ord(GetTokenID); -end; - -function TSynPasSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -//++ CodeFolding -type - TRangeStates = set of TRangeState; - -Const - FT_Standard = 1; // begin end, class end, record end - FT_Comment = 11; - FT_Asm = 12; - FT_HereDocDouble = 13; - FT_HereDocSingle = 14; - FT_ConditionalDirective = 15; - FT_CodeDeclaration = 16; - FT_CodeDeclarationWithBody = 17; - FT_Implementation = 18; - -procedure TSynPasSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - CurLine: String; - Line: Integer; - - function BlockDelimiter(Line: Integer): Boolean; - var - Index: Integer; - Match : TMatch; - begin - Result := False; - - Match := RE_BlockBegin.Match(CurLine); - if Match.Success then - begin - // Char must have proper highlighting (ignore stuff inside comments...) - Index := Match.Index; - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then - begin - // And ignore lines with both opening and closing chars in them - if not RE_BlockEnd.IsMatch(CurLine, Index + 1) then begin - FoldRanges.StartFoldRange(Line + 1, FT_Standard); - Result := True; - end; - end; - end else begin - Match := RE_BlockEnd.Match(CurLine); - if Match.Success then begin - begin - Index := Match.Index; - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then - begin - FoldRanges.StopFoldRange(Line + 1, FT_Standard); - Result := True; - end; - end; - end; - end; - end; - - function FoldRegion(Line: Integer): Boolean; - var - S: string; - begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 8)) = '{$REGION' then - begin - FoldRanges.StartFoldRange(Line + 1, FoldRegionType); - Result := True; - end - else if Uppercase(Copy(S, 1, 11)) = '{$ENDREGION' then - begin - FoldRanges.StopFoldRange(Line + 1, FoldRegionType); - Result := True; - end; - end; - - function ConditionalDirective(Line: Integer): Boolean; - var - S: string; - begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 7)) = '{$IFDEF' then - begin - FoldRanges.StartFoldRange(Line + 1, FT_ConditionalDirective); - Result := True; - end - else if Uppercase(Copy(S, 1, 7)) = '{$ENDIF' then - begin - FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective); - Result := True; - end; - end; - - function IsMultiLineStatement(Line : integer; Ranges: TRangeStates; - Fold : Boolean; FoldType: Integer = 1): Boolean; - begin - Result := True; - if TRangeState(GetLineRange(LinesToScan, Line)) in Ranges then - begin - if Fold and not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then - FoldRanges.StartFoldRange(Line + 1, FoldType) - else - FoldRanges.NoFoldInfo(Line + 1); - end - else if Fold and (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then - begin - FoldRanges.StopFoldRange(Line + 1, FoldType); - end else - Result := False; - end; - -begin - for Line := FromLine to ToLine do - begin - // Deal first with Multiline statements - if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or - IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or - IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or - IsMultiLineStatement(Line, [rsDirective], False) - then - Continue; - - CurLine := LinesToScan[Line]; - - // Skip empty lines - if CurLine = '' then begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // Deal with ConditionalDirectives - if ConditionalDirective(Line) then - Continue; - - // Find Fold regions - if FoldRegion(Line) then - Continue; - - // Implementation - if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then - FoldRanges.StartFoldRange(Line +1, FT_Implementation) - // Functions and procedures - else if RE_Code.IsMatch(CurLine) then - FoldRanges.StartFoldRange(Line +1, FT_CodeDeclaration) - // Find begin or end (Fold Type 1) - else if not BlockDelimiter(Line) then - FoldRanges.NoFoldInfo(Line + 1); - end; //for Line -end; - -procedure TSynPasSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings); -{ - Provide folding for procedures and functions included nested ones. -} -Var - i, j, SkipTo: Integer; - ImplementationIndex: Integer; - FoldRange: TSynFoldRange; - Match : TMatch; -begin - ImplementationIndex := - 1; - for i := FoldRanges.Ranges.Count - 1 downto 0 do - begin - if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then - ImplementationIndex := i - else if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then - begin - if ImplementationIndex >= 0 then begin - // Code declaration in the Interface part of a unit - FoldRanges.Ranges.Delete(i); - Dec(ImplementationIndex); - continue; - end; - // Examine the following ranges - SkipTo := 0; - j := i + 1; - while J < FoldRanges.Ranges.Count do begin - FoldRange := FoldRanges.Ranges.List[j]; - Inc(j); - case FoldRange.FoldType of - // Nested procedure or function - FT_CodeDeclarationWithBody: - begin - SkipTo := FoldRange.ToLine; - continue; - end; - FT_Standard: - // possibly begin end; - if FoldRange.ToLine <= SkipTo then - Continue - else begin - Match := RE_BlockBegin.Match(LinesToScan[FoldRange.FromLine - 1]); - if Match.Success then - begin - if LowerCase(Match.Value) = 'begin' then - begin - // function or procedure followed by begin end block - // Adjust ToLine - FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine; - FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody; - break - end else - begin - // class or record declaration follows, so - FoldRanges.Ranges.Delete(i); - break; - end; - end else - Assert(False, 'TSynHighlighterPas.AdjustFoldRanges'); - end; - else - begin - if FoldRange.ToLine <= SkipTo then - Continue - else begin - // Otherwise delete - // eg. function definitions within a class definition - FoldRanges.Ranges.Delete(i); - break - end; - end; - end; - end; - end; - end; - if ImplementationIndex >= 0 then - // Looks better without it - //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; - FoldRanges.Ranges.Delete(ImplementationIndex); -end; -//-- CodeFolding - -procedure TSynPasSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynPasSyn.ResetRange; -begin - fRange:= rsUnknown; -end; - -procedure TSynPasSyn.EnumUserSettings(DelphiVersions: TStrings); - - procedure LoadKeyVersions(const Key, Prefix: string); - var - Versions: TStringList; - i: Integer; - begin - with TBetterRegistry.Create(KEY_READ or KEY_WOW64_32KEY) do - begin - try - RootKey := HKEY_LOCAL_MACHINE; - if OpenKeyReadOnly(Key) then - begin - try - Versions := TStringList.Create; - try - GetKeyNames(Versions); - for i := 0 to Versions.Count - 1 do - DelphiVersions.Add(Prefix + Versions[i]); - finally - FreeAndNil(Versions); - end; - finally - CloseKey; - end; - end; - finally - Free; - end; - end; - end; - -begin - LoadKeyVersions('\SOFTWARE\Borland\Delphi', ''); - LoadKeyVersions('\SOFTWARE\Borland\BDS', BDSVersionPrefix); - LoadKeyVersions('\SOFTWARE\CodeGear\BDS', BDSVersionPrefix); - LoadKeyVersions('\SOFTWARE\Embarcadero\BDS', BDSVersionPrefix); -end; - -function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; -// Possible parameter values: -// index into TStrings returned by EnumUserSettings -// Possible return values: -// True : settings were read and used -// False: problem reading settings or invalid version specified - old settings -// were preserved - - function ReadDelphiSettings(settingIndex: Integer): Boolean; - - function ReadDelphiSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - var - Version: Currency; - VersionStr: string; - - function ReadDelphi2Or3(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean; - var - i: Integer; - begin - for i := 1 to Length(name) do - if name[i] = ' ' then name[i] := '_'; - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Borland\Delphi\'+settingTag+'\Highlight',name,True); - end; { ReadDelphi2Or3 } - - function ReadDelphi4OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Borland\Delphi\'+settingTag+'\Editor\Highlight',key,False); - end; { ReadDelphi4OrMore } - - function ReadDelphi8To2007(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Borland\BDS\'+settingTag+'\Editor\Highlight',key,False); - end; { ReadDelphi8OrMore } - - function ReadDelphi2009OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\CodeGear\BDS\'+settingTag+'\Editor\Highlight',key,False); - end; { ReadDelphi2009OrMore } - - function ReadDelphiXEOrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Embarcadero\BDS\'+settingTag+'\Editor\Highlight',key,False); - end; { ReadDelphi2009OrMore } - - - begin { ReadDelphiSetting } - try - if Pos('BDS', settingTag) = 1 then // BDS product - begin - VersionStr := Copy(settingTag, Length(BDSVersionPrefix) + 1, 999); - Version := 0; - if not TryStrToCurr(StringReplace(VersionStr, '.', FormatSettings.DecimalSeparator, []), Version) then - begin - Result := False; - Exit; - end; - if Version >= 8 then - Result := ReadDelphiXEOrMore(VersionStr, attri, key) - else - if Version >= 6 then - Result := ReadDelphi2009OrMore(VersionStr, attri, key) - else - Result := ReadDelphi8To2007(VersionStr, attri, key); - end - else begin // Borland Delphi 7 or earlier - if (settingTag[1] = '2') or (settingTag[1] = '3') - then Result := ReadDelphi2Or3(settingTag, attri, key) - else Result := ReadDelphi4OrMore(settingTag, attri, key); - end; - except Result := False; end; - end; { ReadDelphiSetting } - - var - tmpAsmAttri, tmpCommentAttri, tmpIdentAttri, tmpKeyAttri, tmpNumberAttri, - tmpSpaceAttri, tmpStringAttri, tmpSymbolAttri: TSynHighlighterAttributes; - iVersions: TStringList; - iVersionTag: string; - begin { ReadDelphiSettings } - iVersions := TStringList.Create; - try - EnumUserSettings(iVersions); - if (settingIndex < 0) or (settingIndex >= iVersions.Count) then - begin - Result := False; - Exit; - end; - iVersionTag := iVersions[settingIndex]; - finally - iVersions.Free; - end; - tmpAsmAttri := TSynHighlighterAttributes.Create('', ''); - tmpCommentAttri := TSynHighlighterAttributes.Create('', ''); - tmpIdentAttri := TSynHighlighterAttributes.Create('', ''); - tmpKeyAttri := TSynHighlighterAttributes.Create('', ''); - tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); - tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); - tmpStringAttri := TSynHighlighterAttributes.Create('', ''); - tmpSymbolAttri := TSynHighlighterAttributes.Create('', ''); - - Result := ReadDelphiSetting(iVersionTag, tmpAsmAttri,'Assembler') and - ReadDelphiSetting(iVersionTag, tmpCommentAttri,'Comment') and - ReadDelphiSetting(iVersionTag, tmpIdentAttri,'Identifier') and - ReadDelphiSetting(iVersionTag, tmpKeyAttri,'Reserved word') and - ReadDelphiSetting(iVersionTag, tmpNumberAttri,'Number') and - ReadDelphiSetting(iVersionTag, tmpSpaceAttri,'Whitespace') and - ReadDelphiSetting(iVersionTag, tmpStringAttri,'String') and - ReadDelphiSetting(iVersionTag, tmpSymbolAttri,'Symbol'); - - if Result then - begin - fAsmAttri.AssignColorAndStyle(tmpAsmAttri); - fCharAttri.AssignColorAndStyle(tmpStringAttri); { Delphi lacks Char attribute } - fCommentAttri.AssignColorAndStyle(tmpCommentAttri); - fDirecAttri.AssignColorAndStyle(tmpCommentAttri); { Delphi lacks Directive attribute } - fFloatAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Float attribute } - fHexAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Hex attribute } - fIdentifierAttri.AssignColorAndStyle(tmpIdentAttri); - fKeyAttri.AssignColorAndStyle(tmpKeyAttri); - fNumberAttri.AssignColorAndStyle(tmpNumberAttri); - fSpaceAttri.AssignColorAndStyle(tmpSpaceAttri); - fStringAttri.AssignColorAndStyle(tmpStringAttri); - fSymbolAttri.AssignColorAndStyle(tmpSymbolAttri); - end; - tmpAsmAttri.Free; - tmpCommentAttri.Free; - tmpIdentAttri.Free; - tmpKeyAttri.Free; - tmpNumberAttri.Free; - tmpSpaceAttri.Free; - tmpStringAttri.Free; - tmpSymbolAttri.Free; - end; - -begin - Result := ReadDelphiSettings(VersionIndex); -end; - -function TSynPasSyn.GetSampleSource: string; -begin - Result := '{ Syntax highlighting }'#13#10 + - 'procedure TForm1.Button1Click(Sender: TObject);'#13#10 + - 'var'#13#10 + - ' Number, I, X: Integer;'#13#10 + - 'begin'#13#10 + - ' Number := 123456;'#13#10 + - ' Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 + - ' for I := 0 to Number do'#13#10 + - ' begin'#13#10 + - ' Inc(X);'#13#10 + - ' Dec(X);'#13#10 + - ' X := X + 1.0;'#13#10 + - ' X := X - $5E;'#13#10 + - ' end;'#13#10 + - ' {$R+}'#13#10 + - ' asm'#13#10 + - ' mov AX, 1234H'#13#10 + - ' mov Number, AX'#13#10 + - ' end;'#13#10 + - ' {$R-}'#13#10 + - 'end;'; -end; - - -class function TSynPasSyn.GetLanguageName: string; -begin - Result := SYNS_LangPascal; -end; - -class function TSynPasSyn.GetCapabilities: TSynHighlighterCapabilities; -begin - Result := inherited GetCapabilities + [hcUserSettings]; -end; - -function TSynPasSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterPascal; -end; - -procedure TSynPasSyn.SetDelphiVersion(const Value: TDelphiVersion); -begin - if fDelphiVersion <> Value then - begin - fDelphiVersion := Value; - if (fDelphiVersion < dvDelphi3) and fPackageSource then - fPackageSource := False; - DefHighlightChange(Self); - end; -end; - -procedure TSynPasSyn.SetPackageSource(const Value: Boolean); -begin - if fPackageSource <> Value then - begin - fPackageSource := Value; - if fPackageSource and (fDelphiVersion < dvDelphi3) then - fDelphiVersion := dvDelphi3; - DefHighlightChange(Self); - end; -end; - -class function TSynPasSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangPascal; -end; - -initialization - RegisterPlaceableHighlighter(TSynPasSyn); -end. - +{------------------------------------------------------------------------------ +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. + +The Original Code is: SynHighlighterPas.pas, released 2000-04-17. +The Original Code is based on the mwPasSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Martin Waldenburg. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +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: SynHighlighterPas.pas,v 1.27.2.10 2009/02/23 15:43:50 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Pascal/Delphi syntax highlighter for SynEdit) +@author(Martin Waldenburg) +@created(1998, converted to SynEdit 2000-04-07) +@lastmod(2004-03-19) +The SynHighlighterPas unit provides SynEdit with a Object Pascal syntax highlighter. +Two extra properties included (DelphiVersion, PackageSource): + DelphiVersion - Allows you to enable/disable the highlighting of various + language enhancements added in the different Delphi versions. + PackageSource - Allows you to enable/disable the highlighting of package keywords +} + +unit SynHighlighterPas; + +{$I SynEdit.inc} + +interface + +uses + Windows, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, +{$IFDEF SYN_CodeFolding} + SynEditCodeFolding, + SynRegExpr, +{$ENDIF} + Classes; + +type + TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, + tkSpace, tkString, tkSymbol, tkUnknown, tkFloat, tkHex, tkDirec, tkChar); + + TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, + rsExports, rsDirective, rsDirectiveAsm, rsUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TDelphiVersion = (dvDelphi1, dvDelphi2, dvDelphi3, dvDelphi4, dvDelphi5, + dvDelphi6, dvDelphi7, dvDelphi8, dvDelphi2005); + +const + LastDelphiVersion = dvDelphi2005; + BDSVersionPrefix = 'BDS'; + +type +{$IFDEF SYN_CodeFolding} + TSynPasSyn = class(TSynCustomCodeFoldingHighlighter) +{$ELSE} + TSynPasSyn = class(TSynCustomHighlighter) +{$ENDIF} + private + FAsmStart: Boolean; + FRange: TRangeState; + FIdentFuncTable: array[0..388] of TIdentFuncTableFunc; + FTokenID: TtkTokenKind; + FStringAttri: TSynHighlighterAttributes; + FCharAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FFloatAttri: TSynHighlighterAttributes; + FHexAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FAsmAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FDirecAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FDelphiVersion: TDelphiVersion; + FPackageSource: Boolean; +{$IFDEF SYN_CodeFolding} + RE_BlockBegin : TRegExpr; + RE_BlockEnd : TRegExpr; + RE_Code: TRegExpr; +{$ENDIF} + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function FuncAsm(Index: Integer): TtkTokenKind; + function FuncAutomated(Index: Integer): TtkTokenKind; + function FuncCdecl(Index: Integer): TtkTokenKind; + function FuncContains(Index: Integer): TtkTokenKind; + function FuncDeprecated(Index: Integer): TtkTokenKind; + function FuncDispid(Index: Integer): TtkTokenKind; + function FuncDispinterface(Index: Integer): TtkTokenKind; + function FuncEnd(Index: Integer): TtkTokenKind; + function FuncExports(Index: Integer): TtkTokenKind; + function FuncFinal(Index: Integer): TtkTokenKind; + function FuncFinalization(Index: Integer): TtkTokenKind; + function FuncHelper(Index: Integer): TtkTokenKind; + function FuncImplements(Index: Integer): TtkTokenKind; + function FuncIndex(Index: Integer): TtkTokenKind; + function FuncName(Index: Integer): TtkTokenKind; + function FuncNodefault(Index: Integer): TtkTokenKind; + function FuncOperator(Index: Integer): TtkTokenKind; + function FuncOverload(Index: Integer): TtkTokenKind; + function FuncPackage(Index: Integer): TtkTokenKind; + function FuncPlatform(Index: Integer): TtkTokenKind; + function FuncProperty(Index: Integer): TtkTokenKind; + function FuncRead(Index: Integer): TtkTokenKind; + function FuncReadonly(Index: Integer): TtkTokenKind; + function FuncReintroduce(Index: Integer): TtkTokenKind; + function FuncRequires(Index: Integer): TtkTokenKind; + function FuncResourcestring(Index: Integer): TtkTokenKind; + function FuncSafecall(Index: Integer): TtkTokenKind; + function FuncSealed(Index: Integer): TtkTokenKind; + function FuncStdcall(Index: Integer): TtkTokenKind; + function FuncStored(Index: Integer): TtkTokenKind; + function FuncStringresource(Index: Integer): TtkTokenKind; + function FuncThreadvar(Index: Integer): TtkTokenKind; + function FuncWrite(Index: Integer): TtkTokenKind; + function FuncWriteonly(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AddressOpProc; + procedure AsciiCharProc; + procedure AnsiProc; + procedure BorProc; + procedure BraceOpenProc; + procedure ColonOrGreaterProc; + procedure CRProc; + procedure IdentProc; + procedure IntegerProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure PointProc; + procedure RoundOpenProc; + procedure SemicolonProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + procedure SetDelphiVersion(const Value: TDelphiVersion); + procedure SetPackageSource(const Value: Boolean); + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetCapabilities: TSynHighlighterCapabilities; override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenID: TtkTokenKind; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + function UseUserSettings(VersionIndex: Integer): Boolean; override; + procedure EnumUserSettings(DelphiVersions: TStrings); override; +{$IFDEF SYN_CodeFolding} + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; + procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); override; +{$ENDIF} + published + property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property DirectiveAttri: TSynHighlighterAttributes read FDirecAttri + write FDirecAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property FloatAttri: TSynHighlighterAttributes read FFloatAttri + write FFloatAttri; + property HexAttri: TSynHighlighterAttributes read FHexAttri + write FHexAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property CharAttri: TSynHighlighterAttributes read FCharAttri + write FCharAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property DelphiVersion: TDelphiVersion read FDelphiVersion write SetDelphiVersion + default LastDelphiVersion; + property PackageSource: Boolean read FPackageSource write SetPackageSource default True; + end; + +implementation + +uses + SynEditStrConst; + +const + // if the language is case-insensitive keywords *must* be in lowercase + KeyWords: array[0..110] of UnicodeString = ( + 'absolute', 'abstract', 'and', 'array', 'as', 'asm', 'assembler', + 'automated', 'begin', 'case', 'cdecl', 'class', 'const', 'constructor', + 'contains', 'default', 'deprecated', 'destructor', 'dispid', + 'dispinterface', 'div', 'do', 'downto', 'dynamic', 'else', 'end', 'except', + 'export', 'exports', 'external', 'far', 'file', 'final', 'finalization', + 'finally', 'for', 'forward', 'function', 'goto', 'helper', 'if', + 'implementation', 'implements', 'in', 'index', 'inherited', + 'initialization', 'inline', 'interface', 'is', 'label', 'library', + 'message', 'mod', 'name', 'near', 'nil', 'nodefault', 'not', 'object', 'of', + 'on', 'operator', 'or', 'out', 'overload', 'override', 'package', 'packed', + 'pascal', 'platform', 'private', 'procedure', 'program', 'property', + 'protected', 'public', 'published', 'raise', 'read', 'readonly', 'record', + 'register', 'reintroduce', 'repeat', 'requires', 'resourcestring', + 'safecall', 'sealed', 'set', 'shl', 'shr', 'stdcall', 'stored', 'string', + 'stringresource', 'then', 'threadvar', 'to', 'try', 'type', 'unit', 'until', + 'uses', 'var', 'virtual', 'while', 'with', 'write', 'writeonly', 'xor' + ); + + KeyIndices: array[0..388] of Integer = ( + -1, -1, -1, 105, -1, 51, -1, 108, -1, -1, -1, -1, -1, 75, -1, -1, 46, -1, + -1, 103, -1, -1, -1, -1, 55, -1, -1, -1, -1, 76, -1, -1, 96, 14, -1, 31, 3, + 102, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 25, -1, + -1, 56, 65, 95, -1, -1, -1, 34, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, 50, -1, -1, 109, 98, -1, + 86, -1, 13, -1, -1, -1, 107, -1, -1, 60, -1, 0, 64, -1, -1, -1, -1, 8, 10, + -1, -1, -1, 67, -1, -1, -1, 74, -1, 17, -1, 73, 69, -1, 68, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 16, -1, -1, 23, 39, -1, 35, 30, -1, -1, -1, 70, -1, 37, + -1, -1, 89, 71, 84, 72, -1, 29, 40, -1, -1, -1, 32, -1, -1, -1, 94, -1, -1, + 87, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 11, 57, 41, 6, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 97, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 44, 12, -1, -1, 101, -1, 58, -1, -1, -1, 99, -1, -1, + -1, -1, 53, 20, -1, -1, -1, 36, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, 59, + -1, 110, -1, 15, -1, 52, -1, -1, -1, -1, 5, 48, -1, -1, -1, 81, -1, 28, -1, + -1, -1, 2, -1, 1, -1, 106, -1, -1, -1, -1, 90, -1, 83, -1, -1, -1, -1, -1, + 79, -1, -1, 33, 62, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, 88, + 61, 54, -1, 42, -1, -1, -1, 66, -1, -1, -1, 92, 100, -1, -1, -1, -1, -1, 18, + -1, -1, 26, 47, 38, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 9, -1, 91, -1, -1, -1, -1, -1, -1, 49, -1, 21, -1, -1, -1, -1, -1, -1, 43, + -1, 82, -1, 19, 104, -1, -1, -1, -1, -1 + ); + +{$Q-} +function TSynPasSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 812 + Ord(Str^) * 76; + Inc(Str); + end; + Result := Result mod 389; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynPasSyn.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 TSynPasSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[275] := FuncAsm; + FIdentFuncTable[41] := FuncAutomated; + FIdentFuncTable[112] := FuncCdecl; + FIdentFuncTable[33] := FuncContains; + FIdentFuncTable[137] := FuncDeprecated; + FIdentFuncTable[340] := FuncDispid; + FIdentFuncTable[382] := FuncDispinterface; + FIdentFuncTable[54] := FuncEnd; + FIdentFuncTable[282] := FuncExports; + FIdentFuncTable[163] := FuncFinal; + FIdentFuncTable[306] := FuncFinalization; + FIdentFuncTable[141] := FuncHelper; + FIdentFuncTable[325] := FuncImplements; + FIdentFuncTable[214] := FuncIndex; + FIdentFuncTable[323] := FuncName; + FIdentFuncTable[185] := FuncNodefault; + FIdentFuncTable[307] := FuncOperator; + FIdentFuncTable[58] := FuncOverload; + FIdentFuncTable[116] := FuncPackage; + FIdentFuncTable[148] := FuncPlatform; + FIdentFuncTable[120] := FuncProperty; + FIdentFuncTable[303] := FuncRead; + FIdentFuncTable[83] := FuncReadonly; + FIdentFuncTable[297] := FuncReintroduce; + FIdentFuncTable[65] := FuncRequires; + FIdentFuncTable[94] := FuncResourcestring; + FIdentFuncTable[170] := FuncSafecall; + FIdentFuncTable[321] := FuncSealed; + FIdentFuncTable[333] := FuncStdcall; + FIdentFuncTable[348] := FuncStored; + FIdentFuncTable[59] := FuncStringresource; + FIdentFuncTable[204] := FuncThreadvar; + FIdentFuncTable[7] := FuncWrite; + FIdentFuncTable[91] := FuncWriteonly; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynPasSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier +end; + +function TSynPasSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +function TSynPasSyn.FuncAsm(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + Result := tkKey; + FRange := rsAsm; + FAsmStart := True; + end + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncAutomated(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncCdecl(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncContains(Index: Integer): TtkTokenKind; +begin + if PackageSource and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncDeprecated(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi6) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncDispid(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncDispinterface(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncEnd(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + Result := tkKey; + FRange := rsUnknown; + end + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncExports(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + Result := tkKey; + FRange := rsExports; + end + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncFinal(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncFinalization(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncHelper(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncImplements(Index: Integer): TtkTokenKind; +begin + if (FRange = rsProperty) and (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncIndex(Index: Integer): TtkTokenKind; +begin + if (FRange in [rsProperty, rsExports]) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncName(Index: Integer): TtkTokenKind; +begin + if (FRange = rsExports) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncNodefault(Index: Integer): TtkTokenKind; +begin + if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncOperator(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncOverload(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncPackage(Index: Integer): TtkTokenKind; +begin + if PackageSource and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncPlatform(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi6) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncProperty(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + Result := tkKey; + FRange := rsProperty; + end + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncRead(Index: Integer): TtkTokenKind; +begin + if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncReadonly(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncReintroduce(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncRequires(Index: Integer): TtkTokenKind; +begin + if PackageSource and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncResourcestring(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncSafecall(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncSealed(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi8) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncStdcall(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi2) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncStored(Index: Integer): TtkTokenKind; +begin + if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncStringresource(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncThreadvar(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncWrite(Index: Integer): TtkTokenKind; +begin + if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPasSyn.FuncWriteonly(Index: Integer): TtkTokenKind; +begin + if (DelphiVersion >= dvDelphi3) and (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +constructor TSynPasSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCaseSensitive := False; + + FDelphiVersion := LastDelphiVersion; + FPackageSource := True; + + FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); + AddAttribute(FAsmAttri); + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + FDirecAttri.Style:= [fsItalic]; + AddAttribute(FDirecAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); + AddAttribute(FFloatAttri); + FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); + AddAttribute(FHexAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); + AddAttribute(FCharAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + + InitIdent; + FRange := rsUnknown; + FAsmStart := False; + FDefaultFilter := SYNS_FilterPascal; + +{$IFDEF SYN_CodeFolding} + RE_BlockBegin := TRegExpr.Create; + RE_BlockBegin.Expression := '\b(begin|record|class)\b'; + RE_BlockBegin.ModifierI := True; + + RE_BlockEnd := TRegExpr.Create; + RE_BlockEnd.Expression := '\bend\b'; + RE_BlockEnd.ModifierI := True; + + RE_Code := TRegExpr.Create; + RE_Code.Expression := '^\s*(function|procedure)\b'; + RE_Code.ModifierI := True; +{$ENDIF} +end; + +destructor TSynPasSyn.Destroy; +begin +{$IFDEF SYN_CodeFolding} + FreeAndNil(RE_BlockBegin); + FreeAndNil(RE_BlockEnd); + FreeAndNil(RE_Code); +{$ENDIF} + inherited; +end; + +procedure TSynPasSyn.AddressOpProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '@' then Inc(Run); +end; + +procedure TSynPasSyn.AsciiCharProc; + + function IsAsciiChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '$', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + FTokenID := tkChar; + Inc(Run); + while IsAsciiChar do + Inc(Run); +end; + +procedure TSynPasSyn.BorProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + if FRange in [rsDirective, rsDirectiveAsm] then + FTokenID := tkDirec + else + FTokenID := tkComment; + repeat + if FLine[Run] = '}' then + begin + Inc(Run); + if FRange in [rsBorAsm, rsDirectiveAsm] then + FRange := rsAsm + else + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynPasSyn.BraceOpenProc; +begin + if (FLine[Run + 1] = '$') then + begin + if FRange = rsAsm then + FRange := rsDirectiveAsm + else + FRange := rsDirective; + end + else + begin + if FRange = rsAsm then + FRange := rsBorAsm + else + FRange := rsBor; + end; + BorProc; +end; + +procedure TSynPasSyn.ColonOrGreaterProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynPasSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynPasSyn.IdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynPasSyn.IntegerProc; + + function IsIntegerChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkHex; + while IsIntegerChar do + Inc(Run); +end; + +procedure TSynPasSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynPasSyn.LowerProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if (FLine[Run] = '=') or (FLine[Run] = '>') then + Inc(Run); +end; + +procedure TSynPasSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynPasSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E', '-', '+': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break + else + FTokenID := tkFloat; + 'e', 'E': FTokenID := tkFloat; + '-', '+': + begin + if FTokenID <> tkFloat then // arithmetic + Break; + if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then + Break; //float, but it ends here + end; + end; + Inc(Run); + end; +end; + +procedure TSynPasSyn.PointProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if (FLine[Run] = '.') or (FLine[Run - 1] = ')') then + Inc(Run); +end; + +procedure TSynPasSyn.AnsiProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then begin + Inc(Run, 2); + if FRange = rsAnsiAsm then + FRange := rsAsm + else + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynPasSyn.RoundOpenProc; +begin + Inc(Run); + case FLine[Run] of + '*': + begin + Inc(Run); + if FRange = rsAsm then + FRange := rsAnsiAsm + else + FRange := rsAnsi; + FTokenID := tkComment; + if not IsLineEnd(Run) then + AnsiProc; + end; + '.': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + FTokenID := tkSymbol; + end; +end; + +procedure TSynPasSyn.SemicolonProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if FRange in [rsProperty, rsExports] then + FRange := rsUnknown; +end; + +procedure TSynPasSyn.SlashProc; +begin + Inc(Run); + if (FLine[Run] = '/') and (FDelphiVersion > dvDelphi1) then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + FTokenID := tkSymbol; +end; + +procedure TSynPasSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynPasSyn.StringProc; +begin + FTokenID := tkString; + Inc(Run); + while not IsLineEnd(Run) do + begin + if FLine[Run] = #39 then begin + Inc(Run); + if FLine[Run] <> #39 then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynPasSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPasSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynPasSyn.Next; +begin + FAsmStart := False; + FTokenPos := Run; + case FRange of + rsAnsi, rsAnsiAsm: + AnsiProc; + rsBor, rsBorAsm, rsDirective, rsDirectiveAsm: + BorProc; + else + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '#': AsciiCharProc; + '$': IntegerProc; + #39: StringProc; + '0'..'9': NumberProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '{': BraceOpenProc; + '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': + begin + case FLine[Run] of + '(': RoundOpenProc; + '.': PointProc; + ';': SemicolonProc; + '/': SlashProc; + ':', '>': ColonOrGreaterProc; + '<': LowerProc; + '@': AddressOpProc; + else + SymbolProc; + end; + end; + else + UnknownProc; + end; + end; + inherited; +end; + +function TSynPasSyn.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; + SYN_ATTR_CHAR: Result := fCharAttri; + else + Result := nil; + end; +end; + +function TSynPasSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynPasSyn.GetTokenID: TtkTokenKind; +begin + if not FAsmStart and (FRange = rsAsm) + and not (FTokenID in [tkNull, tkComment, tkDirec, tkSpace]) + then + Result := tkAsm + else + Result := FTokenID; +end; + +function TSynPasSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkAsm: Result := FAsmAttri; + tkComment: Result := FCommentAttri; + tkDirec: Result := FDirecAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkFloat: Result := FFloatAttri; + tkHex: Result := FHexAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkChar: Result := FCharAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynPasSyn.GetTokenKind: Integer; +begin + Result := Ord(GetTokenID); +end; + +function TSynPasSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +{$IFDEF SYN_CodeFolding} +type + TRangeStates = set of TRangeState; + +Const + FT_Standard = 1; // begin end, class end, record end + FT_Comment = 11; + FT_Asm = 12; + FT_HereDocDouble = 13; + FT_HereDocSingle = 14; + FT_ConditionalDirective = 15; + FT_CodeDeclaration = 16; + FT_CodeDeclarationWithBody = 17; + FT_Implementation = 18; + +procedure TSynPasSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: String; + Line: Integer; + + function BlockDelimiter(Line: Integer): Boolean; + var + Index: Integer; + begin + Result := False; + + if RE_BlockBegin.Exec(CurLine) then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + Index := RE_BlockBegin.MatchPos[0]; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + Re_BlockEnd.InputString := CurLine; + if not RE_BlockEnd.Exec(Index + 1) then begin + FoldRanges.StartFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end else if RE_BlockEnd.Exec(CurLine) then + begin + Index := RE_BlockEnd.MatchPos[0]; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + FoldRanges.StopFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 8)) = '{$REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 11)) = '{$ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + + function ConditionalDirective(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 7)) = '{$IFDEF' then + begin + FoldRanges.StartFoldRange(Line + 1, FT_ConditionalDirective); + Result := True; + end + else if Uppercase(Copy(S, 1, 7)) = '{$ENDIF' then + begin + FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective); + Result := True; + end; + end; + + function IsMultiLineStatement(Line : integer; Ranges: TRangeStates; + Fold : Boolean; FoldType: Integer = 1): Boolean; + begin + Result := True; + if TRangeState(GetLineRange(LinesToScan, Line)) in Ranges then + begin + if Fold and not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then + FoldRanges.StartFoldRange(Line + 1, FoldType) + else + FoldRanges.NoFoldInfo(Line + 1); + end + else if Fold and (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then + begin + FoldRanges.StopFoldRange(Line + 1, FoldType); + end else + Result := False; + end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline statements + if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or + IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or + IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or + IsMultiLineStatement(Line, [rsDirective], False) + then + Continue; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Deal with ConditionalDirectives + if ConditionalDirective(Line) then + Continue; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Implementation + if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then + FoldRanges.StartFoldRange(Line +1, FT_Implementation) + // Functions and procedures + else if RE_Code.Exec(CurLine) then + FoldRanges.StartFoldRange(Line + 1, FT_CodeDeclaration) + // Find begin or end (Fold Type 1) + else if not BlockDelimiter(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; //for Line +end; + +procedure TSynPasSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +{ + Provide folding for procedures and functions included nested ones. +} +Var + i, j, SkipTo: Integer; + ImplementationIndex: Integer; + FoldRange: TSynFoldRange; +begin + ImplementationIndex := - 1; + for i := FoldRanges.Ranges.Count - 1 downto 0 do + begin + if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then + ImplementationIndex := i + else if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then + begin + if ImplementationIndex >= 0 then begin + // Code declaration in the Interface part of a unit + FoldRanges.Ranges.Delete(i); + Dec(ImplementationIndex); + continue; + end; + // Examine the following ranges + SkipTo := 0; + j := i + 1; + while J < FoldRanges.Ranges.Count do begin + FoldRange := FoldRanges.Ranges.List[j]; + Inc(j); + case FoldRange.FoldType of + // Nested procedure or function + FT_CodeDeclarationWithBody: + begin + SkipTo := FoldRange.ToLine; + continue; + end; + FT_Standard: + // possibly begin end; + if FoldRange.ToLine <= SkipTo then + Continue + else if RE_BlockBegin.Exec(LinesToScan[FoldRange.FromLine - 1]) then + begin + if LowerCase(RE_BlockBegin.Match[0]) = 'begin' then + begin + // function or procedure followed by begin end block + // Adjust ToLine + FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine; + FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody; + break + end else + begin + // class or record declaration follows, so + FoldRanges.Ranges.Delete(i); + break; + end; + end else + Assert(False, 'TSynDWSSyn.AdjustFoldRanges'); + else + begin + if FoldRange.ToLine <= SkipTo then + Continue + else begin + // Otherwise delete + // eg. function definitions within a class definition + FoldRanges.Ranges.Delete(i); + break + end; + end; + end; + end; + end; + end; + if ImplementationIndex >= 0 then + // Looks better without it + //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; + FoldRanges.Ranges.Delete(ImplementationIndex); +end; +{$ENDIF} + +procedure TSynPasSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynPasSyn.ResetRange; +begin + FRange:= rsUnknown; +end; + +procedure TSynPasSyn.EnumUserSettings(DelphiVersions: TStrings); + +{$IFNDEF SYN_DELPHI_2006_UP} +const + KEY_WOW64_64KEY = $0100; + KEY_WOW64_32KEY = $0200; +{$ENDIF} + + procedure LoadKeyVersions(const Key, Prefix: string); + var + Versions: TStringList; + i: Integer; + begin + with TBetterRegistry.Create(KEY_READ or KEY_WOW64_32KEY) do + begin + try + RootKey := HKEY_LOCAL_MACHINE; + if OpenKeyReadOnly(Key) then + begin + try + Versions := TStringList.Create; + try + GetKeyNames(Versions); + for i := 0 to Versions.Count - 1 do + DelphiVersions.Add(Prefix + Versions[i]); + finally + FreeAndNil(Versions); + end; + finally + CloseKey; + end; + end; + finally + Free; + end; + end; + end; + +begin + LoadKeyVersions('\SOFTWARE\Borland\Delphi', ''); + LoadKeyVersions('\SOFTWARE\Borland\BDS', BDSVersionPrefix); + LoadKeyVersions('\SOFTWARE\CodeGear\BDS', BDSVersionPrefix); + LoadKeyVersions('\SOFTWARE\Embarcadero\BDS', BDSVersionPrefix); +end; + +function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; +// Possible parameter values: +// index into TStrings returned by EnumUserSettings +// Possible return values: +// True : settings were read and used +// False: problem reading settings or invalid version specified - old settings +// were preserved + + function ReadDelphiSettings(settingIndex: Integer): Boolean; + + function ReadDelphiSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + var + Version: Currency; + VersionStr: string; + + function ReadDelphi2Or3(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean; + var + i: Integer; + begin + for i := 1 to Length(name) do + if name[i] = ' ' then name[i] := '_'; + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\Borland\Delphi\'+settingTag+'\Highlight',name,True); + end; { ReadDelphi2Or3 } + + function ReadDelphi4OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + begin + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\Borland\Delphi\'+settingTag+'\Editor\Highlight',key,False); + end; { ReadDelphi4OrMore } + + function ReadDelphi8To2007(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + begin + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\Borland\BDS\'+settingTag+'\Editor\Highlight',key,False); + end; { ReadDelphi8OrMore } + + function ReadDelphi2009OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + begin + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\CodeGear\BDS\'+settingTag+'\Editor\Highlight',key,False); + end; { ReadDelphi2009OrMore } + + function ReadDelphiXEOrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + begin + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\Embarcadero\BDS\'+settingTag+'\Editor\Highlight',key,False); + end; { ReadDelphi2009OrMore } + + + begin { ReadDelphiSetting } + try + if Pos('BDS', settingTag) = 1 then // BDS product + begin + VersionStr := Copy(settingTag, Length(BDSVersionPrefix) + 1, 999); + Version := 0; + if not TryStrToCurr(StringReplace(VersionStr, '.', {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator, []), Version) then + begin + Result := False; + Exit; + end; + if Version >= 8 then + Result := ReadDelphiXEOrMore(VersionStr, attri, key) + else + if Version >= 6 then + Result := ReadDelphi2009OrMore(VersionStr, attri, key) + else + Result := ReadDelphi8To2007(VersionStr, attri, key); + end + else begin // Borland Delphi 7 or earlier + if (settingTag[1] = '2') or (settingTag[1] = '3') + then Result := ReadDelphi2Or3(settingTag, attri, key) + else Result := ReadDelphi4OrMore(settingTag, attri, key); + end; + except Result := False; end; + end; { ReadDelphiSetting } + + var + tmpAsmAttri, tmpCommentAttri, tmpIdentAttri, tmpKeyAttri, tmpNumberAttri, + tmpSpaceAttri, tmpStringAttri, tmpSymbolAttri: TSynHighlighterAttributes; + iVersions: TStringList; + iVersionTag: string; + begin { ReadDelphiSettings } + {$IFDEF SYN_COMPILER_7_UP} + {$IFNDEF SYN_COMPILER_9_UP} + Result := False; // Silence the compiler warning + {$ENDIF} + {$ENDIF} + iVersions := TStringList.Create; + try + EnumUserSettings(iVersions); + if (settingIndex < 0) or (settingIndex >= iVersions.Count) then + begin + Result := False; + Exit; + end; + iVersionTag := iVersions[settingIndex]; + finally + iVersions.Free; + end; + tmpAsmAttri := TSynHighlighterAttributes.Create('', ''); + tmpCommentAttri := TSynHighlighterAttributes.Create('', ''); + tmpIdentAttri := TSynHighlighterAttributes.Create('', ''); + tmpKeyAttri := TSynHighlighterAttributes.Create('', ''); + tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); + tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); + tmpStringAttri := TSynHighlighterAttributes.Create('', ''); + tmpSymbolAttri := TSynHighlighterAttributes.Create('', ''); + + Result := ReadDelphiSetting(iVersionTag, tmpAsmAttri,'Assembler') and + ReadDelphiSetting(iVersionTag, tmpCommentAttri,'Comment') and + ReadDelphiSetting(iVersionTag, tmpIdentAttri,'Identifier') and + ReadDelphiSetting(iVersionTag, tmpKeyAttri,'Reserved word') and + ReadDelphiSetting(iVersionTag, tmpNumberAttri,'Number') and + ReadDelphiSetting(iVersionTag, tmpSpaceAttri,'Whitespace') and + ReadDelphiSetting(iVersionTag, tmpStringAttri,'String') and + ReadDelphiSetting(iVersionTag, tmpSymbolAttri,'Symbol'); + + if Result then + begin + FAsmAttri.AssignColorAndStyle(tmpAsmAttri); + FCharAttri.AssignColorAndStyle(tmpStringAttri); { Delphi lacks Char attribute } + FCommentAttri.AssignColorAndStyle(tmpCommentAttri); + FDirecAttri.AssignColorAndStyle(tmpCommentAttri); { Delphi lacks Directive attribute } + FFloatAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Float attribute } + FHexAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Hex attribute } + FIdentifierAttri.AssignColorAndStyle(tmpIdentAttri); + FKeyAttri.AssignColorAndStyle(tmpKeyAttri); + FNumberAttri.AssignColorAndStyle(tmpNumberAttri); + FSpaceAttri.AssignColorAndStyle(tmpSpaceAttri); + FStringAttri.AssignColorAndStyle(tmpStringAttri); + FSymbolAttri.AssignColorAndStyle(tmpSymbolAttri); + end; + tmpAsmAttri.Free; + tmpCommentAttri.Free; + tmpIdentAttri.Free; + tmpKeyAttri.Free; + tmpNumberAttri.Free; + tmpSpaceAttri.Free; + tmpStringAttri.Free; + tmpSymbolAttri.Free; + end; + +begin + Result := ReadDelphiSettings(VersionIndex); +end; + +function TSynPasSyn.GetSampleSource: UnicodeString; +begin + Result := '{ Syntax highlighting }'#13#10 + + 'procedure TForm1.Button1Click(Sender: TObject);'#13#10 + + 'var'#13#10 + + ' Number, I, X: Integer;'#13#10 + + 'begin'#13#10 + + ' Number := 123456;'#13#10 + + ' Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 + + ' for I := 0 to Number do'#13#10 + + ' begin'#13#10 + + ' Inc(X);'#13#10 + + ' Dec(X);'#13#10 + + ' X := X + 1.0;'#13#10 + + ' X := X - $5E;'#13#10 + + ' end;'#13#10 + + ' {$R+}'#13#10 + + ' asm'#13#10 + + ' mov AX, 1234H'#13#10 + + ' mov Number, AX'#13#10 + + ' end;'#13#10 + + ' {$R-}'#13#10 + + 'end;'; +end; + + +class function TSynPasSyn.GetLanguageName: string; +begin + Result := SYNS_LangPascal; +end; + +class function TSynPasSyn.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := inherited GetCapabilities + [hcUserSettings]; +end; + +function TSynPasSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterPascal; +end; + +procedure TSynPasSyn.SetDelphiVersion(const Value: TDelphiVersion); +begin + if FDelphiVersion <> Value then + begin + FDelphiVersion := Value; + if (FDelphiVersion < dvDelphi3) and FPackageSource then + FPackageSource := False; + DefHighlightChange(Self); + end; +end; + +procedure TSynPasSyn.SetPackageSource(const Value: Boolean); +begin + if FPackageSource <> Value then + begin + FPackageSource := Value; + if FPackageSource and (FDelphiVersion < dvDelphi3) then + FDelphiVersion := dvDelphi3; + DefHighlightChange(Self); + end; +end; + +class function TSynPasSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangPascal; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynPasSyn); +{$ENDIF} +end. + diff --git a/Source/VCL/SynEdit/Source/SynHighlighterPerl.pas b/Source/VCL/SynEdit/Source/SynHighlighterPerl.pas index 0d936ae3..d9dc77e6 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterPerl.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterPerl.pas @@ -1,3843 +1,3848 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterPerl.pas, released 2000-04-10. -The Original Code is based on the DcjSynPerl.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Trier. -Unicode translation by Maël Hörz. -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: SynHighlighterPerl.pas,v 1.14.2.8 2008/09/14 16:25:01 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - - Using q, qq, qw, qx, m, s, tr will not properly parse the contained - information. - - Not very optimized. --------------------------------------------------------------------------------} -{ -@abstract(Provides a Perl syntax highlighter for SynEdit) -@author(Michael Trier) -@created(1999, converted to SynEdit 2000-04-10 by Michael Hieke) -@lastmod(2000-06-23) -The SynHighlighterPerl unit provides SynEdit with a Perl syntax highlighter. -} - -unit SynHighlighterPerl; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkOperator, - tkPragma, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynPerlSyn = class(TSynCustomHighlighter) - private - FTokenID: TtkTokenKind; - fIdentFuncTable: array[0..2422] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fInvalidAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fOperatorAttri: TSynHighlighterAttributes; - fPragmaAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fVariableAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function Func36accumulator(Index: Integer): TtkTokenKind; - function Func36arg(Index: Integer): TtkTokenKind; - function Func36argv(Index: Integer): TtkTokenKind; - function Func36basetime(Index: Integer): TtkTokenKind; - function Func36child95error(Index: Integer): TtkTokenKind; - function Func36debugging(Index: Integer): TtkTokenKind; - function Func36effective95group95id(Index: Integer): TtkTokenKind; - function Func36effective95user95id(Index: Integer): TtkTokenKind; - function Func36egid(Index: Integer): TtkTokenKind; - function Func36env(Index: Integer): TtkTokenKind; - function Func36errno(Index: Integer): TtkTokenKind; - function Func36euid(Index: Integer): TtkTokenKind; - function Func36eval95error(Index: Integer): TtkTokenKind; - function Func36executable95name(Index: Integer): TtkTokenKind; - function Func36format95formfeed(Index: Integer): TtkTokenKind; - function Func36format95line95break95characters(Index: Integer): TtkTokenKind; - function Func36format95lines95left(Index: Integer): TtkTokenKind; - function Func36format95lines95per95page(Index: Integer): TtkTokenKind; - function Func36format95name(Index: Integer): TtkTokenKind; - function Func36format95page95number(Index: Integer): TtkTokenKind; - function Func36format95top95name(Index: Integer): TtkTokenKind; - function Func36gid(Index: Integer): TtkTokenKind; - function Func36inplace95edit(Index: Integer): TtkTokenKind; - function Func36input95line95number(Index: Integer): TtkTokenKind; - function Func36input95record95separator(Index: Integer): TtkTokenKind; - function Func36last95paren95match(Index: Integer): TtkTokenKind; - function Func36list95separator(Index: Integer): TtkTokenKind; - function Func36match(Index: Integer): TtkTokenKind; - function Func36multiline95matching(Index: Integer): TtkTokenKind; - function Func36nr(Index: Integer): TtkTokenKind; - function Func36ofmt(Index: Integer): TtkTokenKind; - function Func36ors(Index: Integer): TtkTokenKind; - function Func36os95error(Index: Integer): TtkTokenKind; - function Func36output95autoflush(Index: Integer): TtkTokenKind; - function Func36output95field95separator(Index: Integer): TtkTokenKind; - function Func36perl95version(Index: Integer): TtkTokenKind; - function Func36perldb(Index: Integer): TtkTokenKind; - function Func36pid(Index: Integer): TtkTokenKind; - function Func36postmatch(Index: Integer): TtkTokenKind; - function Func36prematch(Index: Integer): TtkTokenKind; - function Func36process95id(Index: Integer): TtkTokenKind; - function Func36program95name(Index: Integer): TtkTokenKind; - function Func36real95group95id(Index: Integer): TtkTokenKind; - function Func36real95user95id(Index: Integer): TtkTokenKind; - function Func36rs(Index: Integer): TtkTokenKind; - function Func36sig(Index: Integer): TtkTokenKind; - function Func36subscript95separator(Index: Integer): TtkTokenKind; - function Func36subsep(Index: Integer): TtkTokenKind; - function Func36system95fd95max(Index: Integer): TtkTokenKind; - function Func36uid(Index: Integer): TtkTokenKind; - function Func36warning(Index: Integer): TtkTokenKind; - function Func37inc(Index: Integer): TtkTokenKind; - function Func64argv(Index: Integer): TtkTokenKind; - function Func64inc(Index: Integer): TtkTokenKind; - function FuncAbs(Index: Integer): TtkTokenKind; - function FuncAccept(Index: Integer): TtkTokenKind; - function FuncAlarm(Index: Integer): TtkTokenKind; - function FuncAnd(Index: Integer): TtkTokenKind; - function FuncAtan2(Index: Integer): TtkTokenKind; - function FuncBind(Index: Integer): TtkTokenKind; - function FuncBinmode(Index: Integer): TtkTokenKind; - function FuncBless(Index: Integer): TtkTokenKind; - function FuncCaller(Index: Integer): TtkTokenKind; - function FuncChdir(Index: Integer): TtkTokenKind; - function FuncChmod(Index: Integer): TtkTokenKind; - function FuncChomp(Index: Integer): TtkTokenKind; - function FuncChop(Index: Integer): TtkTokenKind; - function FuncChown(Index: Integer): TtkTokenKind; - function FuncChr(Index: Integer): TtkTokenKind; - function FuncChroot(Index: Integer): TtkTokenKind; - function FuncClose(Index: Integer): TtkTokenKind; - function FuncClosedir(Index: Integer): TtkTokenKind; - function FuncCmp(Index: Integer): TtkTokenKind; - function FuncConnect(Index: Integer): TtkTokenKind; - function FuncConstant(Index: Integer): TtkTokenKind; - function FuncCos(Index: Integer): TtkTokenKind; - function FuncCrypt(Index: Integer): TtkTokenKind; - function FuncDbmclose(Index: Integer): TtkTokenKind; - function FuncDbmopen(Index: Integer): TtkTokenKind; - function FuncDefined(Index: Integer): TtkTokenKind; - function FuncDelete(Index: Integer): TtkTokenKind; - function FuncDiagnostics(Index: Integer): TtkTokenKind; - function FuncDie(Index: Integer): TtkTokenKind; - function FuncDo(Index: Integer): TtkTokenKind; - function FuncDump(Index: Integer): TtkTokenKind; - function FuncEach(Index: Integer): TtkTokenKind; - function FuncElse(Index: Integer): TtkTokenKind; - function FuncElsif(Index: Integer): TtkTokenKind; - function FuncEndgrent(Index: Integer): TtkTokenKind; - function FuncEndhostent(Index: Integer): TtkTokenKind; - function FuncEndnetent(Index: Integer): TtkTokenKind; - function FuncEndprotoent(Index: Integer): TtkTokenKind; - function FuncEndpwent(Index: Integer): TtkTokenKind; - function FuncEndservent(Index: Integer): TtkTokenKind; - function FuncEof(Index: Integer): TtkTokenKind; - function FuncEq(Index: Integer): TtkTokenKind; - function FuncEval(Index: Integer): TtkTokenKind; - function FuncExec(Index: Integer): TtkTokenKind; - function FuncExists(Index: Integer): TtkTokenKind; - function FuncExit(Index: Integer): TtkTokenKind; - function FuncExp(Index: Integer): TtkTokenKind; - function FuncFcntl(Index: Integer): TtkTokenKind; - function FuncFileno(Index: Integer): TtkTokenKind; - function FuncFlock(Index: Integer): TtkTokenKind; - function FuncFor(Index: Integer): TtkTokenKind; - function FuncForeach(Index: Integer): TtkTokenKind; - function FuncFork(Index: Integer): TtkTokenKind; - function FuncFormat(Index: Integer): TtkTokenKind; - function FuncFormline(Index: Integer): TtkTokenKind; - function FuncGe(Index: Integer): TtkTokenKind; - function FuncGetc(Index: Integer): TtkTokenKind; - function FuncGetgrent(Index: Integer): TtkTokenKind; - function FuncGetgrgid(Index: Integer): TtkTokenKind; - function FuncGetgrnam(Index: Integer): TtkTokenKind; - function FuncGethostbyaddr(Index: Integer): TtkTokenKind; - function FuncGethostbyname(Index: Integer): TtkTokenKind; - function FuncGethostent(Index: Integer): TtkTokenKind; - function FuncGetlogin(Index: Integer): TtkTokenKind; - function FuncGetnetbyaddr(Index: Integer): TtkTokenKind; - function FuncGetnetbyname(Index: Integer): TtkTokenKind; - function FuncGetnetent(Index: Integer): TtkTokenKind; - function FuncGetpeername(Index: Integer): TtkTokenKind; - function FuncGetpgrp(Index: Integer): TtkTokenKind; - function FuncGetppid(Index: Integer): TtkTokenKind; - function FuncGetpriority(Index: Integer): TtkTokenKind; - function FuncGetprotobyname(Index: Integer): TtkTokenKind; - function FuncGetprotobynumber(Index: Integer): TtkTokenKind; - function FuncGetprotoent(Index: Integer): TtkTokenKind; - function FuncGetpwent(Index: Integer): TtkTokenKind; - function FuncGetpwnam(Index: Integer): TtkTokenKind; - function FuncGetpwuid(Index: Integer): TtkTokenKind; - function FuncGetservbyname(Index: Integer): TtkTokenKind; - function FuncGetservbyport(Index: Integer): TtkTokenKind; - function FuncGetservent(Index: Integer): TtkTokenKind; - function FuncGetsockname(Index: Integer): TtkTokenKind; - function FuncGetsockopt(Index: Integer): TtkTokenKind; - function FuncGlob(Index: Integer): TtkTokenKind; - function FuncGmtime(Index: Integer): TtkTokenKind; - function FuncGoto(Index: Integer): TtkTokenKind; - function FuncGrep(Index: Integer): TtkTokenKind; - function FuncGt(Index: Integer): TtkTokenKind; - function FuncHex(Index: Integer): TtkTokenKind; - function FuncIf(Index: Integer): TtkTokenKind; - function FuncImport(Index: Integer): TtkTokenKind; - function FuncIndex(Index: Integer): TtkTokenKind; - function FuncInt(Index: Integer): TtkTokenKind; - function FuncInteger(Index: Integer): TtkTokenKind; - function FuncIoctl(Index: Integer): TtkTokenKind; - function FuncJoin(Index: Integer): TtkTokenKind; - function FuncKeys(Index: Integer): TtkTokenKind; - function FuncKill(Index: Integer): TtkTokenKind; - function FuncLast(Index: Integer): TtkTokenKind; - function FuncLc(Index: Integer): TtkTokenKind; - function FuncLcfirst(Index: Integer): TtkTokenKind; - function FuncLe(Index: Integer): TtkTokenKind; - function FuncLength(Index: Integer): TtkTokenKind; - function FuncLess(Index: Integer): TtkTokenKind; - function FuncLink(Index: Integer): TtkTokenKind; - function FuncListen(Index: Integer): TtkTokenKind; - function FuncLocal(Index: Integer): TtkTokenKind; - function FuncLocale(Index: Integer): TtkTokenKind; - function FuncLocaltime(Index: Integer): TtkTokenKind; - function FuncLog(Index: Integer): TtkTokenKind; - function FuncLstat(Index: Integer): TtkTokenKind; - function FuncLt(Index: Integer): TtkTokenKind; - function FuncM(Index: Integer): TtkTokenKind; - function FuncMap(Index: Integer): TtkTokenKind; - function FuncMkdir(Index: Integer): TtkTokenKind; - function FuncMsgctl(Index: Integer): TtkTokenKind; - function FuncMsgget(Index: Integer): TtkTokenKind; - function FuncMsgrcv(Index: Integer): TtkTokenKind; - function FuncMsgsnd(Index: Integer): TtkTokenKind; - function FuncMy(Index: Integer): TtkTokenKind; - function FuncNe(Index: Integer): TtkTokenKind; - function FuncNext(Index: Integer): TtkTokenKind; - function FuncNo(Index: Integer): TtkTokenKind; - function FuncNot(Index: Integer): TtkTokenKind; - function FuncOct(Index: Integer): TtkTokenKind; - function FuncOpen(Index: Integer): TtkTokenKind; - function FuncOpendir(Index: Integer): TtkTokenKind; - function FuncOr(Index: Integer): TtkTokenKind; - function FuncOrd(Index: Integer): TtkTokenKind; - function FuncPack(Index: Integer): TtkTokenKind; - function FuncPackage(Index: Integer): TtkTokenKind; - function FuncPipe(Index: Integer): TtkTokenKind; - function FuncPop(Index: Integer): TtkTokenKind; - function FuncPos(Index: Integer): TtkTokenKind; - function FuncPrint(Index: Integer): TtkTokenKind; - function FuncPush(Index: Integer): TtkTokenKind; - function FuncQ(Index: Integer): TtkTokenKind; - function FuncQq(Index: Integer): TtkTokenKind; - function FuncQuotemeta(Index: Integer): TtkTokenKind; - function FuncQw(Index: Integer): TtkTokenKind; - function FuncQx(Index: Integer): TtkTokenKind; - function FuncRand(Index: Integer): TtkTokenKind; - function FuncRead(Index: Integer): TtkTokenKind; - function FuncReaddir(Index: Integer): TtkTokenKind; - function FuncReadlink(Index: Integer): TtkTokenKind; - function FuncRecv(Index: Integer): TtkTokenKind; - function FuncRedo(Index: Integer): TtkTokenKind; - function FuncRef(Index: Integer): TtkTokenKind; - function FuncRename(Index: Integer): TtkTokenKind; - function FuncRequire(Index: Integer): TtkTokenKind; - function FuncReset(Index: Integer): TtkTokenKind; - function FuncReturn(Index: Integer): TtkTokenKind; - function FuncReverse(Index: Integer): TtkTokenKind; - function FuncRewinddir(Index: Integer): TtkTokenKind; - function FuncRindex(Index: Integer): TtkTokenKind; - function FuncRmdir(Index: Integer): TtkTokenKind; - function FuncScalar(Index: Integer): TtkTokenKind; - function FuncSeek(Index: Integer): TtkTokenKind; - function FuncSeekdir(Index: Integer): TtkTokenKind; - function FuncSelect(Index: Integer): TtkTokenKind; - function FuncSemctl(Index: Integer): TtkTokenKind; - function FuncSemget(Index: Integer): TtkTokenKind; - function FuncSemop(Index: Integer): TtkTokenKind; - function FuncSend(Index: Integer): TtkTokenKind; - function FuncSetgrent(Index: Integer): TtkTokenKind; - function FuncSethostent(Index: Integer): TtkTokenKind; - function FuncSetnetent(Index: Integer): TtkTokenKind; - function FuncSetpgrp(Index: Integer): TtkTokenKind; - function FuncSetpriority(Index: Integer): TtkTokenKind; - function FuncSetprotoent(Index: Integer): TtkTokenKind; - function FuncSetpwent(Index: Integer): TtkTokenKind; - function FuncSetservent(Index: Integer): TtkTokenKind; - function FuncSetsockopt(Index: Integer): TtkTokenKind; - function FuncShift(Index: Integer): TtkTokenKind; - function FuncShmctl(Index: Integer): TtkTokenKind; - function FuncShmget(Index: Integer): TtkTokenKind; - function FuncShmread(Index: Integer): TtkTokenKind; - function FuncShmwrite(Index: Integer): TtkTokenKind; - function FuncShutdown(Index: Integer): TtkTokenKind; - function FuncSigtrap(Index: Integer): TtkTokenKind; - function FuncSin(Index: Integer): TtkTokenKind; - function FuncSleep(Index: Integer): TtkTokenKind; - function FuncSocket(Index: Integer): TtkTokenKind; - function FuncSocketpair(Index: Integer): TtkTokenKind; - function FuncSort(Index: Integer): TtkTokenKind; - function FuncSplice(Index: Integer): TtkTokenKind; - function FuncSplit(Index: Integer): TtkTokenKind; - function FuncSprintf(Index: Integer): TtkTokenKind; - function FuncSqrt(Index: Integer): TtkTokenKind; - function FuncSrand(Index: Integer): TtkTokenKind; - function FuncStat(Index: Integer): TtkTokenKind; - function FuncStrict(Index: Integer): TtkTokenKind; - function FuncStudy(Index: Integer): TtkTokenKind; - function FuncSub(Index: Integer): TtkTokenKind; - function FuncSubs(Index: Integer): TtkTokenKind; - function FuncSubstr(Index: Integer): TtkTokenKind; - function FuncSymlink(Index: Integer): TtkTokenKind; - function FuncSyscall(Index: Integer): TtkTokenKind; - function FuncSysread(Index: Integer): TtkTokenKind; - function FuncSystem(Index: Integer): TtkTokenKind; - function FuncSyswrite(Index: Integer): TtkTokenKind; - function FuncTell(Index: Integer): TtkTokenKind; - function FuncTelldir(Index: Integer): TtkTokenKind; - function FuncTie(Index: Integer): TtkTokenKind; - function FuncTime(Index: Integer): TtkTokenKind; - function FuncTimes(Index: Integer): TtkTokenKind; - function FuncTr(Index: Integer): TtkTokenKind; - function FuncTruncate(Index: Integer): TtkTokenKind; - function FuncUc(Index: Integer): TtkTokenKind; - function FuncUcfirst(Index: Integer): TtkTokenKind; - function FuncUmask(Index: Integer): TtkTokenKind; - function FuncUndef(Index: Integer): TtkTokenKind; - function FuncUnless(Index: Integer): TtkTokenKind; - function FuncUnlink(Index: Integer): TtkTokenKind; - function FuncUnpack(Index: Integer): TtkTokenKind; - function FuncUnshift(Index: Integer): TtkTokenKind; - function FuncUntie(Index: Integer): TtkTokenKind; - function FuncUse(Index: Integer): TtkTokenKind; - function FuncUtime(Index: Integer): TtkTokenKind; - function FuncValues(Index: Integer): TtkTokenKind; - function FuncVars(Index: Integer): TtkTokenKind; - function FuncVec(Index: Integer): TtkTokenKind; - function FuncWait(Index: Integer): TtkTokenKind; - function FuncWaitpid(Index: Integer): TtkTokenKind; - function FuncWantarray(Index: Integer): TtkTokenKind; - function FuncWarn(Index: Integer): TtkTokenKind; - function FuncWhile(Index: Integer): TtkTokenKind; - function FuncWrite(Index: Integer): TtkTokenKind; - function FuncXor(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AndSymbolProc; - procedure CRProc; - procedure ColonProc; - procedure CommentProc; - procedure EqualProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure NotSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure SlashProc; - procedure SpaceProc; - procedure StarProc; - procedure StringInterpProc; - procedure StringLiteralProc; - procedure SymbolProc; - procedure XOrSymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri - write fInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property OperatorAttri: TSynHighlighterAttributes read fOperatorAttri - write fOperatorAttri; - property PragmaAttri: TSynHighlighterAttributes read fPragmaAttri - write fPragmaAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property VariableAttri: TSynHighlighterAttributes read fVariableAttri - write fVariableAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..281] of string = ( - '$ACCUMULATOR', '$ARG', '$ARGV', '$BASETIME', '$CHILD_ERROR', '$DEBUGGING', - '$EFFECTIVE_GROUP_ID', '$EFFECTIVE_USER_ID', '$EGID', '$ENV', '$ERRNO', - '$EUID', '$EVAL_ERROR', '$EXECUTABLE_NAME', '$FORMAT_FORMFEED', - '$FORMAT_LINE_BREAK_CHARACTERS', '$FORMAT_LINES_LEFT', - '$FORMAT_LINES_PER_PAGE', '$FORMAT_NAME', '$FORMAT_PAGE_NUMBER', - '$FORMAT_TOP_NAME', '$GID', '$INPLACE_EDIT', '$INPUT_LINE_NUMBER', - '$INPUT_RECORD_SEPARATOR', '$LAST_PAREN_MATCH', '$LIST_SEPARATOR', '$MATCH', - '$MULTILINE_MATCHING', '$NR', '$OFMT', '$ORS', '$OS_ERROR', - '$OUTPUT_AUTOFLUSH', '$OUTPUT_FIELD_SEPARATOR', '$PERL_VERSION', '$PERLDB', - '$PID', '$POSTMATCH', '$PREMATCH', '$PROCESS_ID', '$PROGRAM_NAME', - '$REAL_GROUP_ID', '$REAL_USER_ID', '$RS', '$SIG', '$SUBSCRIPT_SEPARATOR', - '$SUBSEP', '$SYSTEM_FD_MAX', '$UID', '$WARNING', '%INC', '@ARGV', '@INC', - 'abs', 'accept', 'alarm', 'and', 'atan2', 'bind', 'binmode', 'bless', - 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', - 'close', 'closedir', 'cmp', 'connect', 'constant', 'cos', 'crypt', - 'dbmclose', 'dbmopen', 'defined', 'delete', 'diagnostics', 'die', 'do', - 'dump', 'each', 'else', 'elsif', 'endgrent', 'endhostent', 'endnetent', - 'endprotoent', 'endpwent', 'endservent', 'eof', 'eq', 'eval', 'exec', - 'exists', 'exit', 'exp', 'fcntl', 'fileno', 'flock', 'for', 'foreach', - 'fork', 'format', 'formline', 'ge', 'getc', 'getgrent', 'getgrgid', - 'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin', - 'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp', - 'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber', - 'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname', - 'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', - 'gmtime', 'goto', 'grep', 'gt', 'hex', 'if', 'import', 'index', 'int', - 'integer', 'ioctl', 'join', 'keys', 'kill', 'last', 'lc', 'lcfirst', 'le', - 'length', 'less', 'link', 'listen', 'local', 'locale', 'localtime', 'log', - 'lstat', 'lt', 'm', 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', - 'my', 'ne', 'next', 'no', 'not', 'oct', 'open', 'opendir', 'or', 'ord', - 'pack', 'package', 'pipe', 'pop', 'pos', 'print', 'push', 'q', 'qq', - 'quotemeta', 'qw', 'qx', 'rand', 'read', 'readdir', 'readlink', 'recv', - 'redo', 'ref', 'rename', 'require', 'reset', 'return', 'reverse', - 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir', 'select', - 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent', - 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent', - 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', - 'shutdown', 'sigtrap', 'sin', 'sleep', 'socket', 'socketpair', 'sort', - 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat', 'strict', 'study', - 'sub', 'subs', 'substr', 'symlink', 'syscall', 'sysread', 'system', - 'syswrite', 'tell', 'telldir', 'tie', 'time', 'times', 'tr', 'truncate', - 'uc', 'ucfirst', 'umask', 'undef', 'unless', 'unlink', 'unpack', 'unshift', - 'untie', 'use', 'utime', 'values', 'vars', 'vec', 'wait', 'waitpid', - 'wantarray', 'warn', 'while', 'write', 'xor' - ); - - KeyIndices: array[0..2422] of Integer = ( - -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 62, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, - -1, -1, -1, -1, 212, 189, -1, -1, -1, -1, -1, -1, -1, 111, -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, 55, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, 247, - -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, - 155, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, 254, -1, - -1, -1, -1, -1, -1, -1, -1, 253, -1, 273, -1, -1, -1, 180, -1, -1, -1, -1, - 41, -1, -1, 18, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, 132, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, 45, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 281, -1, 142, -1, -1, -1, -1, 233, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, 7, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 87, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 198, -1, -1, -1, -1, -1, 116, 124, -1, -1, 203, 47, -1, -1, -1, -1, - 150, -1, -1, -1, 205, -1, -1, 152, -1, -1, 271, -1, -1, -1, -1, 76, 92, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, 207, -1, -1, -1, - -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, 153, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, 170, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 258, -1, -1, -1, -1, 99, -1, -1, -1, -1, 22, -1, -1, 33, -1, - -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 259, 228, -1, -1, -1, -1, 115, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, 167, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 158, 40, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 169, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, 59, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, - 276, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, 101, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 38, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -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, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 190, -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, - 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 202, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, - -1, -1, -1, 112, -1, -1, 20, -1, -1, -1, -1, -1, 238, -1, -1, 8, -1, 249, - -1, -1, -1, -1, -1, -1, 246, -1, 232, 216, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 146, 54, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, - 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 214, -1, -1, -1, -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, 183, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 79, -1, -1, -1, - -1, -1, 86, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 267, 48, 131, 91, -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, 69, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, 270, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 166, -1, 73, -1, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, -1, -1, -1, 279, -1, 26, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 68, -1, 280, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 278, -1, 184, -1, -1, -1, -1, -1, -1, -1, -1, 206, -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, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 163, -1, -1, -1, -1, 52, -1, -1, -1, -1, -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, -1, -1, -1, - -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, - -1, -1, 129, -1, -1, -1, -1, -1, 95, -1, 234, -1, -1, -1, -1, -1, -1, -1, - -1, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, 138, -1, -1, - -1, -1, -1, 191, -1, 200, -1, -1, -1, 125, -1, -1, 268, 108, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, 66, - -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, 194, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 143, -1, 226, 182, -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, -1, -1, 16, - -1, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, - 113, -1, -1, -1, -1, -1, -1, -1, 37, -1, 71, -1, 15, -1, -1, -1, 154, 257, - -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 160, -1, -1, -1, 126, -1, -1, -1, -1, -1, 58, -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, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 240, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, 275, -1, -1, -1, - -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, - -1, -1, -1, 100, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, 130, -1, -1, 97, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, 196, -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, 114, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, 274, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 137, 35, 159, -1, -1, -1, -1, -1, -1, -1, 260, -1, - -1, -1, -1, -1, 24, -1, 118, 245, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, - -1, 211, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, 188, 147, - -1, 50, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 96, 181, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, - -1, 210, 27, -1, 136, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, 107, -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, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, -1, -1, - -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 164, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, - 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, - -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 213, -1, -1, -1, -1, 5, - -1, 219, -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, - -1, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 12, -1, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 56, -1, -1, -1, -1, 83, -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, 195, 225, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, 171, - -1, -1, -1, 157, 149, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 252, -1, -1, -1, 65, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 229, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, 105, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, 104, -1, -1, - -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, - -1, 220, 110, -1, -1, -1, 128, -1, -1, -1, -1, 235, 263, -1, -1, -1, -1, -1, - -1, -1, 201, -1, -1, -1, -1, -1, 29, -1, 156, -1, -1, -1, 19, -1, 123, -1, - 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 57, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, -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, -1, -1, 90, -1, -1, -1, -1, -1, - 80, -1, -1, -1, -1 - ); - -{$Q-} -function TSynPerlSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) or CharInSet(Str^, ['$', '%', '@']) do - begin - Result := Result * 975 + Ord(Str^) * 515; - inc(Str); - end; - Result := Result mod 2423; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynPerlSyn.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 TSynPerlSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[368] := Func36accumulator; - fIdentFuncTable[2] := Func36arg; - fIdentFuncTable[804] := Func36argv; - fIdentFuncTable[2272] := Func36basetime; - fIdentFuncTable[626] := Func36child95error; - fIdentFuncTable[2026] := Func36debugging; - fIdentFuncTable[981] := Func36effective95group95id; - fIdentFuncTable[317] := Func36effective95user95id; - fIdentFuncTable[876] := Func36egid; - fIdentFuncTable[141] := Func36env; - fIdentFuncTable[35] := Func36errno; - fIdentFuncTable[495] := Func36euid; - fIdentFuncTable[2067] := Func36eval95error; - fIdentFuncTable[1589] := Func36executable95name; - fIdentFuncTable[1835] := Func36format95formfeed; - fIdentFuncTable[1465] := Func36format95line95break95characters; - fIdentFuncTable[1415] := Func36format95lines95left; - fIdentFuncTable[201] := Func36format95lines95per95page; - fIdentFuncTable[172] := Func36format95name; - fIdentFuncTable[2319] := Func36format95page95number; - fIdentFuncTable[867] := Func36format95top95name; - fIdentFuncTable[1237] := Func36gid; - fIdentFuncTable[519] := Func36inplace95edit; - fIdentFuncTable[315] := Func36input95line95number; - fIdentFuncTable[1733] := Func36input95record95separator; - fIdentFuncTable[1923] := Func36last95paren95match; - fIdentFuncTable[1093] := Func36list95separator; - fIdentFuncTable[1841] := Func36match; - fIdentFuncTable[2201] := Func36multiline95matching; - fIdentFuncTable[2313] := Func36nr; - fIdentFuncTable[2149] := Func36ofmt; - fIdentFuncTable[955] := Func36ors; - fIdentFuncTable[648] := Func36os95error; - fIdentFuncTable[522] := Func36output95autoflush; - fIdentFuncTable[97] := Func36output95field95separator; - fIdentFuncTable[1718] := Func36perl95version; - fIdentFuncTable[1568] := Func36perldb; - fIdentFuncTable[1461] := Func36pid; - fIdentFuncTable[723] := Func36postmatch; - fIdentFuncTable[908] := Func36prematch; - fIdentFuncTable[594] := Func36process95id; - fIdentFuncTable[169] := Func36program95name; - fIdentFuncTable[2182] := Func36real95group95id; - fIdentFuncTable[1084] := Func36real95user95id; - fIdentFuncTable[238] := Func36rs; - fIdentFuncTable[220] := Func36sig; - fIdentFuncTable[261] := Func36subscript95separator; - fIdentFuncTable[427] := Func36subsep; - fIdentFuncTable[1016] := Func36system95fd95max; - fIdentFuncTable[856] := Func36uid; - fIdentFuncTable[1803] := Func36warning; - fIdentFuncTable[1992] := Func37inc; - fIdentFuncTable[1181] := Func64argv; - fIdentFuncTable[1004] := Func64inc; - fIdentFuncTable[899] := FuncAbs; - fIdentFuncTable[79] := FuncAccept; - fIdentFuncTable[2102] := FuncAlarm; - fIdentFuncTable[2365] := FuncAnd; - fIdentFuncTable[1501] := FuncAtan2; - fIdentFuncTable[630] := FuncBind; - fIdentFuncTable[125] := FuncBinmode; - fIdentFuncTable[1110] := FuncBless; - fIdentFuncTable[19] := FuncCaller; - fIdentFuncTable[992] := FuncChdir; - fIdentFuncTable[2236] := FuncChmod; - fIdentFuncTable[2200] := FuncChomp; - fIdentFuncTable[1341] := FuncChop; - fIdentFuncTable[1964] := FuncChown; - fIdentFuncTable[1103] := FuncChr; - fIdentFuncTable[1046] := FuncChroot; - fIdentFuncTable[846] := FuncClose; - fIdentFuncTable[1463] := FuncClosedir; - fIdentFuncTable[470] := FuncCmp; - fIdentFuncTable[1076] := FuncConnect; - fIdentFuncTable[2039] := FuncConstant; - fIdentFuncTable[720] := FuncCos; - fIdentFuncTable[447] := FuncCrypt; - fIdentFuncTable[111] := FuncDbmclose; - fIdentFuncTable[1988] := FuncDbmopen; - fIdentFuncTable[985] := FuncDefined; - fIdentFuncTable[2418] := FuncDelete; - fIdentFuncTable[1194] := FuncDiagnostics; - fIdentFuncTable[2120] := FuncDie; - fIdentFuncTable[2107] := FuncDo; - fIdentFuncTable[2381] := FuncDump; - fIdentFuncTable[1909] := FuncEach; - fIdentFuncTable[991] := FuncElse; - fIdentFuncTable[341] := FuncElsif; - fIdentFuncTable[1739] := FuncEndgrent; - fIdentFuncTable[967] := FuncEndhostent; - fIdentFuncTable[2412] := FuncEndnetent; - fIdentFuncTable[1018] := FuncEndprotoent; - fIdentFuncTable[448] := FuncEndpwent; - fIdentFuncTable[1681] := FuncEndservent; - fIdentFuncTable[1052] := FuncEof; - fIdentFuncTable[1278] := FuncEq; - fIdentFuncTable[1816] := FuncEval; - fIdentFuncTable[1618] := FuncExec; - fIdentFuncTable[2020] := FuncExists; - fIdentFuncTable[514] := FuncExit; - fIdentFuncTable[1586] := FuncExp; - fIdentFuncTable[686] := FuncFcntl; - fIdentFuncTable[115] := FuncFileno; - fIdentFuncTable[1810] := FuncFlock; - fIdentFuncTable[2265] := FuncFor; - fIdentFuncTable[2225] := FuncForeach; - fIdentFuncTable[1846] := FuncFork; - fIdentFuncTable[1854] := FuncFormat; - fIdentFuncTable[1319] := FuncFormline; - fIdentFuncTable[1072] := FuncGe; - fIdentFuncTable[2289] := FuncGetc; - fIdentFuncTable[51] := FuncGetgrent; - fIdentFuncTable[864] := FuncGetgrgid; - fIdentFuncTable[1453] := FuncGetgrnam; - fIdentFuncTable[1663] := FuncGethostbyaddr; - fIdentFuncTable[567] := FuncGethostbyname; - fIdentFuncTable[422] := FuncGethostent; - fIdentFuncTable[1243] := FuncGetlogin; - fIdentFuncTable[1735] := FuncGetnetbyaddr; - fIdentFuncTable[1749] := FuncGetnetbyname; - fIdentFuncTable[1647] := FuncGetnetent; - fIdentFuncTable[1970] := FuncGetpeername; - fIdentFuncTable[2348] := FuncGetpgrp; - fIdentFuncTable[2321] := FuncGetppid; - fIdentFuncTable[423] := FuncGetpriority; - fIdentFuncTable[1315] := FuncGetprotobyname; - fIdentFuncTable[1495] := FuncGetprotobynumber; - fIdentFuncTable[2168] := FuncGetprotoent; - fIdentFuncTable[2293] := FuncGetpwent; - fIdentFuncTable[1272] := FuncGetpwnam; - fIdentFuncTable[1615] := FuncGetpwuid; - fIdentFuncTable[1017] := FuncGetservbyname; - fIdentFuncTable[186] := FuncGetservbyport; - fIdentFuncTable[26] := FuncGetservent; - fIdentFuncTable[737] := FuncGetsockname; - fIdentFuncTable[531] := FuncGetsockopt; - fIdentFuncTable[1843] := FuncGlob; - fIdentFuncTable[1717] := FuncGmtime; - fIdentFuncTable[1303] := FuncGoto; - fIdentFuncTable[1577] := FuncGrep; - fIdentFuncTable[1528] := FuncGt; - fIdentFuncTable[1896] := FuncHex; - fIdentFuncTable[292] := FuncIf; - fIdentFuncTable[1381] := FuncImport; - fIdentFuncTable[708] := FuncIndex; - fIdentFuncTable[2368] := FuncInt; - fIdentFuncTable[898] := FuncInteger; - fIdentFuncTable[1801] := FuncIoctl; - fIdentFuncTable[1665] := FuncJoin; - fIdentFuncTable[2161] := FuncKeys; - fIdentFuncTable[432] := FuncKill; - fIdentFuncTable[2001] := FuncLast; - fIdentFuncTable[439] := FuncLc; - fIdentFuncTable[485] := FuncLcfirst; - fIdentFuncTable[1469] := FuncLe; - fIdentFuncTable[132] := FuncLength; - fIdentFuncTable[2315] := FuncLess; - fIdentFuncTable[2160] := FuncLink; - fIdentFuncTable[593] := FuncListen; - fIdentFuncTable[1719] := FuncLocal; - fIdentFuncTable[1491] := FuncLocale; - fIdentFuncTable[357] := FuncLocaltime; - fIdentFuncTable[2033] := FuncLog; - fIdentFuncTable[1176] := FuncLstat; - fIdentFuncTable[1925] := FuncLt; - fIdentFuncTable[406] := FuncM; - fIdentFuncTable[1074] := FuncMap; - fIdentFuncTable[578] := FuncMkdir; - fIdentFuncTable[1701] := FuncMsgctl; - fIdentFuncTable[613] := FuncMsgget; - fIdentFuncTable[497] := FuncMsgrcv; - fIdentFuncTable[2156] := FuncMsgsnd; - fIdentFuncTable[218] := FuncMy; - fIdentFuncTable[174] := FuncNe; - fIdentFuncTable[611] := FuncNext; - fIdentFuncTable[478] := FuncNo; - fIdentFuncTable[1217] := FuncNot; - fIdentFuncTable[1597] := FuncOct; - fIdentFuncTable[1330] := FuncOpen; - fIdentFuncTable[342] := FuncOpendir; - fIdentFuncTable[164] := FuncOr; - fIdentFuncTable[1817] := FuncOrd; - fIdentFuncTable[1384] := FuncPack; - fIdentFuncTable[968] := FuncPackage; - fIdentFuncTable[1125] := FuncPipe; - fIdentFuncTable[1338] := FuncPop; - fIdentFuncTable[460] := FuncPos; - fIdentFuncTable[1768] := FuncPrint; - fIdentFuncTable[1800] := FuncPush; - fIdentFuncTable[43] := FuncQ; - fIdentFuncTable[777] := FuncQq; - fIdentFuncTable[1309] := FuncQuotemeta; - fIdentFuncTable[1444] := FuncQw; - fIdentFuncTable[1959] := FuncQx; - fIdentFuncTable[1367] := FuncRand; - fIdentFuncTable[2133] := FuncRead; - fIdentFuncTable[1635] := FuncReaddir; - fIdentFuncTable[645] := FuncReadlink; - fIdentFuncTable[416] := FuncRecv; - fIdentFuncTable[2221] := FuncRedo; - fIdentFuncTable[1311] := FuncRef; - fIdentFuncTable[2307] := FuncRename; - fIdentFuncTable[843] := FuncRequire; - fIdentFuncTable[426] := FuncReset; - fIdentFuncTable[2323] := FuncReturn; - fIdentFuncTable[436] := FuncReverse; - fIdentFuncTable[1134] := FuncRewinddir; - fIdentFuncTable[464] := FuncRindex; - fIdentFuncTable[272] := FuncRmdir; - fIdentFuncTable[1475] := FuncScalar; - fIdentFuncTable[1840] := FuncSeek; - fIdentFuncTable[1748] := FuncSeekdir; - fIdentFuncTable[42] := FuncSelect; - fIdentFuncTable[2021] := FuncSemctl; - fIdentFuncTable[933] := FuncSemget; - fIdentFuncTable[570] := FuncSemop; - fIdentFuncTable[888] := FuncSend; - fIdentFuncTable[1789] := FuncSetgrent; - fIdentFuncTable[915] := FuncSethostent; - fIdentFuncTable[2028] := FuncSetnetent; - fIdentFuncTable[2288] := FuncSetpgrp; - fIdentFuncTable[2047] := FuncSetpriority; - fIdentFuncTable[1369] := FuncSetprotoent; - fIdentFuncTable[1608] := FuncSetpwent; - fIdentFuncTable[1629] := FuncSetservent; - fIdentFuncTable[2134] := FuncSetsockopt; - fIdentFuncTable[1383] := FuncShift; - fIdentFuncTable[540] := FuncShmctl; - fIdentFuncTable[562] := FuncShmget; - fIdentFuncTable[2213] := FuncShmread; - fIdentFuncTable[1301] := FuncShmwrite; - fIdentFuncTable[1289] := FuncShutdown; - fIdentFuncTable[887] := FuncSigtrap; - fIdentFuncTable[297] := FuncSin; - fIdentFuncTable[1280] := FuncSleep; - fIdentFuncTable[2298] := FuncSocket; - fIdentFuncTable[1891] := FuncSocketpair; - fIdentFuncTable[1795] := FuncSort; - fIdentFuncTable[873] := FuncSplice; - fIdentFuncTable[830] := FuncSplit; - fIdentFuncTable[1546] := FuncSprintf; - fIdentFuncTable[1553] := FuncSqrt; - fIdentFuncTable[81] := FuncSrand; - fIdentFuncTable[184] := FuncStat; - fIdentFuncTable[1266] := FuncStrict; - fIdentFuncTable[1736] := FuncStudy; - fIdentFuncTable[885] := FuncSub; - fIdentFuncTable[112] := FuncSubs; - fIdentFuncTable[2260] := FuncSubstr; - fIdentFuncTable[878] := FuncSymlink; - fIdentFuncTable[1258] := FuncSyscall; - fIdentFuncTable[1422] := FuncSysread; - fIdentFuncTable[2196] := FuncSystem; - fIdentFuncTable[158] := FuncSyswrite; - fIdentFuncTable[149] := FuncTell; - fIdentFuncTable[2069] := FuncTelldir; - fIdentFuncTable[387] := FuncTie; - fIdentFuncTable[1470] := FuncTime; - fIdentFuncTable[509] := FuncTimes; - fIdentFuncTable[561] := FuncTr; - fIdentFuncTable[1727] := FuncTruncate; - fIdentFuncTable[669] := FuncUc; - fIdentFuncTable[819] := FuncUcfirst; - fIdentFuncTable[2299] := FuncUmask; - fIdentFuncTable[1162] := FuncUndef; - fIdentFuncTable[1946] := FuncUnless; - fIdentFuncTable[681] := FuncUnlink; - fIdentFuncTable[1015] := FuncUnpack; - fIdentFuncTable[1318] := FuncUnshift; - fIdentFuncTable[2280] := FuncUntie; - fIdentFuncTable[1060] := FuncUse; - fIdentFuncTable[442] := FuncUtime; - fIdentFuncTable[2080] := FuncValues; - fIdentFuncTable[160] := FuncVars; - fIdentFuncTable[1705] := FuncVec; - fIdentFuncTable[1560] := FuncWait; - fIdentFuncTable[672] := FuncWaitpid; - fIdentFuncTable[938] := FuncWantarray; - fIdentFuncTable[1123] := FuncWarn; - fIdentFuncTable[1091] := FuncWhile; - fIdentFuncTable[1105] := FuncWrite; - fIdentFuncTable[290] := FuncXor; -end; - -function TSynPerlSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36accumulator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36arg(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36argv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36basetime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36child95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36debugging(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36effective95group95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36effective95user95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36egid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36env(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36errno(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36euid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36eval95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36executable95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95formfeed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95line95break95characters(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95lines95left(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95lines95per95page(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95page95number(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95top95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36gid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36inplace95edit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36input95line95number(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36input95record95separator(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36last95paren95match(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36list95separator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36match(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36multiline95matching(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36nr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36ofmt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36ors(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36os95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36output95autoflush(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36output95field95separator(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36perl95version(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36perldb(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36pid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36postmatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36prematch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36process95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36program95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36real95group95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36real95user95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36rs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36sig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36subscript95separator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36subsep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36system95fd95max(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36uid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36warning(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func37inc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func64argv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func64inc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAbs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAccept(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAlarm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAtan2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBind(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBinmode(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBless(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCaller(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChmod(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChomp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChroot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncClose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncClosedir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCmp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncConnect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncConstant(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCrypt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDbmclose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDbmopen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDefined(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDelete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDiagnostics(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDump(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncElse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncElsif(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndhostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEq(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExists(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFcntl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFileno(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFlock(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncForeach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFork(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFormat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFormline(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrgid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrnam(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostbyaddr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetlogin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetbyaddr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpeername(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpgrp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetppid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpriority(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotobyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotobynumber(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwnam(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwuid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservbyport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetsockname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetsockopt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGlob(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGmtime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGoto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGrep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncHex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncImport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIndex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncInt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncInteger(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIoctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncJoin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncKeys(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncKill(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLast(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLcfirst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLength(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLess(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncListen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocale(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocaltime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLog(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLstat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncM(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMap(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMkdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgrcv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgsnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMy(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOct(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOpen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOpendir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOrd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPackage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPipe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPrint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPush(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQ(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQq(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQuotemeta(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQw(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQx(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRand(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRead(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReaddir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReadlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRecv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRedo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRef(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRequire(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReturn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReverse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRewinddir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRmdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncScalar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSeek(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSeekdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSelect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSend(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSethostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpgrp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpriority(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetsockopt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShift(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmread(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmwrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShutdown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSigtrap(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSleep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSocket(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSocketpair(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSplice(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSplit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSprintf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSqrt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSrand(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStrict(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStudy(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSub(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSubs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSubstr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSymlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSyscall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSysread(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSystem(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSyswrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTell(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTelldir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTimes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTruncate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUcfirst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUmask(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUndef(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnless(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnpack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnshift(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUntie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUtime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncValues(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncVars(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncVec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWait(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWaitpid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWantarray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWarn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWhile(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncWrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncXor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -constructor TSynPerlSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(fInvalidAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); - AddAttribute(fOperatorAttri); - fPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPragma, SYNS_FriendlyAttrPragma); - fPragmaAttri.Style := [fsBold]; - AddAttribute(fPragmaAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - fVariableAttri.Style := [fsBold]; - AddAttribute(fVariableAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterPerl; -end; { Create } - -procedure TSynPerlSyn.AndSymbolProc; -begin - case FLine[Run + 1] of - '=': {bit and assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '&': - begin - if FLine[Run + 2] = '=' then {logical and assign} - inc(Run, 3) - else {logical and} - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {bit and} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.CRProc; -begin - fTokenID := tkSpace; - Case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynPerlSyn.ColonProc; -begin - Case FLine[Run + 1] of - ':': {double colon} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {colon} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.CommentProc; -begin - fTokenID := tkComment; - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = #0; -end; - -procedure TSynPerlSyn.EqualProc; -begin - case FLine[Run + 1] of - '=': {logical equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': {digraph} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '~': {bind scalar to pattern} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {assign} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.GreaterProc; -begin - Case FLine[Run + 1] of - '=': {greater than or equal to} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': - begin - if FLine[Run + 2] = '=' then {shift right assign} - inc(Run, 3) - else {shift right} - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {greater than} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.IdentProc; -begin - case FLine[Run] of - '$': - begin - Case FLine[Run + 1] of - '!'..'+', '-'..'@', '['..']', '_', '`', '|', '~': - begin {predefined variables} - inc(Run, 2); - fTokenID := tkVariable; - exit; - end; - '^': - begin - Case FLine[Run + 2] of - 'A', 'D', 'F', 'I', 'L', 'P', 'T', 'W', 'X': - begin {predefined variables} - inc(Run, 3); - fTokenID := tkVariable; - exit; - end; - #0, #10, #13: {predefined variables} - begin - inc(Run, 2); - fTokenID := tkVariable; - exit; - end; - end; - end; - end; - end; - '%': - begin - Case FLine[Run + 1] of - '=': {mod assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - exit; - end; - #0, #10, #13: {mod} - begin - inc(Run); - fTokenID := tkSymbol; - exit; - end; - end; - end; - 'x': - begin - Case FLine[Run + 1] of - '=': {repetition assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - exit; - end; - #0, #10, #13: {repetition} - begin - inc(Run); - fTokenID := tkSymbol; - exit; - end; - end; - end; - end; - {regular identifier} - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynPerlSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynPerlSyn.LowerProc; -begin - case FLine[Run + 1] of - '=': - begin - if FLine[Run + 2] = '>' then {compare - less than, equal, greater} - inc(Run, 3) - else {less than or equal to} - inc(Run, 2); - fTokenID := tkSymbol; - end; - '<': - begin - if FLine[Run + 2] = '=' then {shift left assign} - inc(Run, 3) - else {shift left} - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {less than} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.MinusProc; -begin - case FLine[Run + 1] of - '=': {subtract assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '-': {decrement} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': {arrow} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {subtract} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.NotSymbolProc; -begin - case FLine[Run + 1] of - '~': {logical negated bind like =~} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '=': {not equal} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {not} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynPerlSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '-', '_', '.', 'A'..'F', 'a'..'f', 'x', 'X': - Result := True; - else - Result := False; - end; - end; - -begin - if FLine[Run] = '.' then - begin - case FLine[Run + 1] of - '.': - begin - inc(Run, 2); - if FLine[Run] = '.' then {sed range} - inc(Run); - - fTokenID := tkSymbol; {range} - exit; - end; - '=': - begin - inc(Run, 2); - fTokenID := tkSymbol; {concatenation assign} - exit; - end; - 'a'..'z', 'A'..'Z', '_': - begin - fTokenID := tkSymbol; {concatenation} - inc(Run); - exit; - end; - end; - end; - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - '-': {check for e notation} - if not ((FLine[Run + 1] = 'e') or (FLine[Run + 1] = 'E')) then break; - end; - inc(Run); - end; -end; - -procedure TSynPerlSyn.OrSymbolProc; -begin - case FLine[Run + 1] of - '=': {bit or assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '|': - begin - if FLine[Run + 2] = '=' then {logical or assign} - inc(Run, 3) - else {logical or} - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {bit or} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.PlusProc; -begin - case FLine[Run + 1] of - '=': {add assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '+': {increment} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {add} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.SlashProc; -begin - case FLine[Run + 1] of - '=': {division assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {division} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynPerlSyn.StarProc; -begin - case FLine[Run + 1] of - '=': {multiply assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '*': - begin - if FLine[Run + 2] = '=' then {exponentiation assign} - inc(Run, 3) - else {exponentiation} - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {multiply} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.StringInterpProc; -var - fBackslashCount : Integer; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - case FLine[Run] of - #0, #10, #13: break; - #92: - { If we're looking at a backslash, and the following character is an - end quote, and it's preceeded by an odd number of backslashes, then - it shouldn't mark the end of the string. If it's preceeded by an - even number, then it should. } - if (FLine[Run + 1] = #34) then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = #92)) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run) - end; - end; - inc(Run); - until FLine[Run] = #34; - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynPerlSyn.StringLiteralProc; -begin - fTokenID := tkString; - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = #39; - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynPerlSyn.SymbolProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynPerlSyn.XOrSymbolProc; -begin - Case FLine[Run + 1] of - '=': {xor assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else {xor} - begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPerlSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynPerlSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - '&': AndSymbolProc; - #13: CRProc; - ':': ColonProc; - '#': CommentProc; - '=': EqualProc; - '>': GreaterProc; - '%', '@', '$', 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': MinusProc; - '!': NotSymbolProc; - #0: NullProc; - '0'..'9', '.': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '*': StarProc; - #34: StringInterpProc; - #39: StringLiteralProc; - '^': XOrSymbolProc; - '(', ')', '[', ']', '\', '{', '}', ',', ';', '?', '~': SymbolProc; - else UnknownProc; - end; - inherited; -end; - -function TSynPerlSyn.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 TSynPerlSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynPerlSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynPerlSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkOperator: Result := fOperatorAttri; - tkPragma: Result := fPragmaAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fInvalidAttri; - tkVariable: Result := fVariableAttri; - else Result := nil; - end; -end; - -function TSynPerlSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynPerlSyn.GetSampleSource: string; -begin - Result := - '#!/bin/perl'#13#10 + - 'require "cgi-lib.pl";'#13#10 + - 'use sigtrap;'#13#10 + - 'do ''envars.pl'';'#13#10 + - '$_ = $password1;'#13#10 + - 'sub WriteBack {'#13#10 + - ' while ($_ ne "fred") {'#13#10 + - ' sleep 5;'#13#10 + - ' }'#13#10 + - '}'; -end; - -function TSynPerlSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterPerl; -end; - -function TSynPerlSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '%', '@', '$', '_', '0'..'9', 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; -end; - -class function TSynPerlSyn.GetLanguageName: string; -begin - Result := SYNS_LangPerl; -end; - -class function TSynPerlSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangPerl; -end; - -initialization - RegisterPlaceableHighlighter(TSynPerlSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterPerl.pas, released 2000-04-10. +The Original Code is based on the DcjSynPerl.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Michael Trier. +Unicode translation by Maël Hörz. +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: SynHighlighterPerl.pas,v 1.14.2.8 2008/09/14 16:25:01 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - Using q, qq, qw, qx, m, s, tr will not properly parse the contained + information. + - Not very optimized. +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Perl syntax highlighter for SynEdit) +@author(Michael Trier) +@created(1999, converted to SynEdit 2000-04-10 by Michael Hieke) +@lastmod(2000-06-23) +The SynHighlighterPerl unit provides SynEdit with a Perl syntax highlighter. +} + +unit SynHighlighterPerl; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkOperator, + tkPragma, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynPerlSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..2422] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FInvalidAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FOperatorAttri: TSynHighlighterAttributes; + FPragmaAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FVariableAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function Func36accumulator(Index: Integer): TtkTokenKind; + function Func36arg(Index: Integer): TtkTokenKind; + function Func36argv(Index: Integer): TtkTokenKind; + function Func36basetime(Index: Integer): TtkTokenKind; + function Func36child95error(Index: Integer): TtkTokenKind; + function Func36debugging(Index: Integer): TtkTokenKind; + function Func36effective95group95id(Index: Integer): TtkTokenKind; + function Func36effective95user95id(Index: Integer): TtkTokenKind; + function Func36egid(Index: Integer): TtkTokenKind; + function Func36env(Index: Integer): TtkTokenKind; + function Func36errno(Index: Integer): TtkTokenKind; + function Func36euid(Index: Integer): TtkTokenKind; + function Func36eval95error(Index: Integer): TtkTokenKind; + function Func36executable95name(Index: Integer): TtkTokenKind; + function Func36format95formfeed(Index: Integer): TtkTokenKind; + function Func36format95line95break95characters(Index: Integer): TtkTokenKind; + function Func36format95lines95left(Index: Integer): TtkTokenKind; + function Func36format95lines95per95page(Index: Integer): TtkTokenKind; + function Func36format95name(Index: Integer): TtkTokenKind; + function Func36format95page95number(Index: Integer): TtkTokenKind; + function Func36format95top95name(Index: Integer): TtkTokenKind; + function Func36gid(Index: Integer): TtkTokenKind; + function Func36inplace95edit(Index: Integer): TtkTokenKind; + function Func36input95line95number(Index: Integer): TtkTokenKind; + function Func36input95record95separator(Index: Integer): TtkTokenKind; + function Func36last95paren95match(Index: Integer): TtkTokenKind; + function Func36list95separator(Index: Integer): TtkTokenKind; + function Func36match(Index: Integer): TtkTokenKind; + function Func36multiline95matching(Index: Integer): TtkTokenKind; + function Func36nr(Index: Integer): TtkTokenKind; + function Func36ofmt(Index: Integer): TtkTokenKind; + function Func36ors(Index: Integer): TtkTokenKind; + function Func36os95error(Index: Integer): TtkTokenKind; + function Func36output95autoflush(Index: Integer): TtkTokenKind; + function Func36output95field95separator(Index: Integer): TtkTokenKind; + function Func36perl95version(Index: Integer): TtkTokenKind; + function Func36perldb(Index: Integer): TtkTokenKind; + function Func36pid(Index: Integer): TtkTokenKind; + function Func36postmatch(Index: Integer): TtkTokenKind; + function Func36prematch(Index: Integer): TtkTokenKind; + function Func36process95id(Index: Integer): TtkTokenKind; + function Func36program95name(Index: Integer): TtkTokenKind; + function Func36real95group95id(Index: Integer): TtkTokenKind; + function Func36real95user95id(Index: Integer): TtkTokenKind; + function Func36rs(Index: Integer): TtkTokenKind; + function Func36sig(Index: Integer): TtkTokenKind; + function Func36subscript95separator(Index: Integer): TtkTokenKind; + function Func36subsep(Index: Integer): TtkTokenKind; + function Func36system95fd95max(Index: Integer): TtkTokenKind; + function Func36uid(Index: Integer): TtkTokenKind; + function Func36warning(Index: Integer): TtkTokenKind; + function Func37inc(Index: Integer): TtkTokenKind; + function Func64argv(Index: Integer): TtkTokenKind; + function Func64inc(Index: Integer): TtkTokenKind; + function FuncAbs(Index: Integer): TtkTokenKind; + function FuncAccept(Index: Integer): TtkTokenKind; + function FuncAlarm(Index: Integer): TtkTokenKind; + function FuncAnd(Index: Integer): TtkTokenKind; + function FuncAtan2(Index: Integer): TtkTokenKind; + function FuncBind(Index: Integer): TtkTokenKind; + function FuncBinmode(Index: Integer): TtkTokenKind; + function FuncBless(Index: Integer): TtkTokenKind; + function FuncCaller(Index: Integer): TtkTokenKind; + function FuncChdir(Index: Integer): TtkTokenKind; + function FuncChmod(Index: Integer): TtkTokenKind; + function FuncChomp(Index: Integer): TtkTokenKind; + function FuncChop(Index: Integer): TtkTokenKind; + function FuncChown(Index: Integer): TtkTokenKind; + function FuncChr(Index: Integer): TtkTokenKind; + function FuncChroot(Index: Integer): TtkTokenKind; + function FuncClose(Index: Integer): TtkTokenKind; + function FuncClosedir(Index: Integer): TtkTokenKind; + function FuncCmp(Index: Integer): TtkTokenKind; + function FuncConnect(Index: Integer): TtkTokenKind; + function FuncConstant(Index: Integer): TtkTokenKind; + function FuncCos(Index: Integer): TtkTokenKind; + function FuncCrypt(Index: Integer): TtkTokenKind; + function FuncDbmclose(Index: Integer): TtkTokenKind; + function FuncDbmopen(Index: Integer): TtkTokenKind; + function FuncDefined(Index: Integer): TtkTokenKind; + function FuncDelete(Index: Integer): TtkTokenKind; + function FuncDiagnostics(Index: Integer): TtkTokenKind; + function FuncDie(Index: Integer): TtkTokenKind; + function FuncDo(Index: Integer): TtkTokenKind; + function FuncDump(Index: Integer): TtkTokenKind; + function FuncEach(Index: Integer): TtkTokenKind; + function FuncElse(Index: Integer): TtkTokenKind; + function FuncElsif(Index: Integer): TtkTokenKind; + function FuncEndgrent(Index: Integer): TtkTokenKind; + function FuncEndhostent(Index: Integer): TtkTokenKind; + function FuncEndnetent(Index: Integer): TtkTokenKind; + function FuncEndprotoent(Index: Integer): TtkTokenKind; + function FuncEndpwent(Index: Integer): TtkTokenKind; + function FuncEndservent(Index: Integer): TtkTokenKind; + function FuncEof(Index: Integer): TtkTokenKind; + function FuncEq(Index: Integer): TtkTokenKind; + function FuncEval(Index: Integer): TtkTokenKind; + function FuncExec(Index: Integer): TtkTokenKind; + function FuncExists(Index: Integer): TtkTokenKind; + function FuncExit(Index: Integer): TtkTokenKind; + function FuncExp(Index: Integer): TtkTokenKind; + function FuncFcntl(Index: Integer): TtkTokenKind; + function FuncFileno(Index: Integer): TtkTokenKind; + function FuncFlock(Index: Integer): TtkTokenKind; + function FuncFor(Index: Integer): TtkTokenKind; + function FuncForeach(Index: Integer): TtkTokenKind; + function FuncFork(Index: Integer): TtkTokenKind; + function FuncFormat(Index: Integer): TtkTokenKind; + function FuncFormline(Index: Integer): TtkTokenKind; + function FuncGe(Index: Integer): TtkTokenKind; + function FuncGetc(Index: Integer): TtkTokenKind; + function FuncGetgrent(Index: Integer): TtkTokenKind; + function FuncGetgrgid(Index: Integer): TtkTokenKind; + function FuncGetgrnam(Index: Integer): TtkTokenKind; + function FuncGethostbyaddr(Index: Integer): TtkTokenKind; + function FuncGethostbyname(Index: Integer): TtkTokenKind; + function FuncGethostent(Index: Integer): TtkTokenKind; + function FuncGetlogin(Index: Integer): TtkTokenKind; + function FuncGetnetbyaddr(Index: Integer): TtkTokenKind; + function FuncGetnetbyname(Index: Integer): TtkTokenKind; + function FuncGetnetent(Index: Integer): TtkTokenKind; + function FuncGetpeername(Index: Integer): TtkTokenKind; + function FuncGetpgrp(Index: Integer): TtkTokenKind; + function FuncGetppid(Index: Integer): TtkTokenKind; + function FuncGetpriority(Index: Integer): TtkTokenKind; + function FuncGetprotobyname(Index: Integer): TtkTokenKind; + function FuncGetprotobynumber(Index: Integer): TtkTokenKind; + function FuncGetprotoent(Index: Integer): TtkTokenKind; + function FuncGetpwent(Index: Integer): TtkTokenKind; + function FuncGetpwnam(Index: Integer): TtkTokenKind; + function FuncGetpwuid(Index: Integer): TtkTokenKind; + function FuncGetservbyname(Index: Integer): TtkTokenKind; + function FuncGetservbyport(Index: Integer): TtkTokenKind; + function FuncGetservent(Index: Integer): TtkTokenKind; + function FuncGetsockname(Index: Integer): TtkTokenKind; + function FuncGetsockopt(Index: Integer): TtkTokenKind; + function FuncGlob(Index: Integer): TtkTokenKind; + function FuncGmtime(Index: Integer): TtkTokenKind; + function FuncGoto(Index: Integer): TtkTokenKind; + function FuncGrep(Index: Integer): TtkTokenKind; + function FuncGt(Index: Integer): TtkTokenKind; + function FuncHex(Index: Integer): TtkTokenKind; + function FuncIf(Index: Integer): TtkTokenKind; + function FuncImport(Index: Integer): TtkTokenKind; + function FuncIndex(Index: Integer): TtkTokenKind; + function FuncInt(Index: Integer): TtkTokenKind; + function FuncInteger(Index: Integer): TtkTokenKind; + function FuncIoctl(Index: Integer): TtkTokenKind; + function FuncJoin(Index: Integer): TtkTokenKind; + function FuncKeys(Index: Integer): TtkTokenKind; + function FuncKill(Index: Integer): TtkTokenKind; + function FuncLast(Index: Integer): TtkTokenKind; + function FuncLc(Index: Integer): TtkTokenKind; + function FuncLcfirst(Index: Integer): TtkTokenKind; + function FuncLe(Index: Integer): TtkTokenKind; + function FuncLength(Index: Integer): TtkTokenKind; + function FuncLess(Index: Integer): TtkTokenKind; + function FuncLink(Index: Integer): TtkTokenKind; + function FuncListen(Index: Integer): TtkTokenKind; + function FuncLocal(Index: Integer): TtkTokenKind; + function FuncLocale(Index: Integer): TtkTokenKind; + function FuncLocaltime(Index: Integer): TtkTokenKind; + function FuncLog(Index: Integer): TtkTokenKind; + function FuncLstat(Index: Integer): TtkTokenKind; + function FuncLt(Index: Integer): TtkTokenKind; + function FuncM(Index: Integer): TtkTokenKind; + function FuncMap(Index: Integer): TtkTokenKind; + function FuncMkdir(Index: Integer): TtkTokenKind; + function FuncMsgctl(Index: Integer): TtkTokenKind; + function FuncMsgget(Index: Integer): TtkTokenKind; + function FuncMsgrcv(Index: Integer): TtkTokenKind; + function FuncMsgsnd(Index: Integer): TtkTokenKind; + function FuncMy(Index: Integer): TtkTokenKind; + function FuncNe(Index: Integer): TtkTokenKind; + function FuncNext(Index: Integer): TtkTokenKind; + function FuncNo(Index: Integer): TtkTokenKind; + function FuncNot(Index: Integer): TtkTokenKind; + function FuncOct(Index: Integer): TtkTokenKind; + function FuncOpen(Index: Integer): TtkTokenKind; + function FuncOpendir(Index: Integer): TtkTokenKind; + function FuncOr(Index: Integer): TtkTokenKind; + function FuncOrd(Index: Integer): TtkTokenKind; + function FuncPack(Index: Integer): TtkTokenKind; + function FuncPackage(Index: Integer): TtkTokenKind; + function FuncPipe(Index: Integer): TtkTokenKind; + function FuncPop(Index: Integer): TtkTokenKind; + function FuncPos(Index: Integer): TtkTokenKind; + function FuncPrint(Index: Integer): TtkTokenKind; + function FuncPush(Index: Integer): TtkTokenKind; + function FuncQ(Index: Integer): TtkTokenKind; + function FuncQq(Index: Integer): TtkTokenKind; + function FuncQuotemeta(Index: Integer): TtkTokenKind; + function FuncQw(Index: Integer): TtkTokenKind; + function FuncQx(Index: Integer): TtkTokenKind; + function FuncRand(Index: Integer): TtkTokenKind; + function FuncRead(Index: Integer): TtkTokenKind; + function FuncReaddir(Index: Integer): TtkTokenKind; + function FuncReadlink(Index: Integer): TtkTokenKind; + function FuncRecv(Index: Integer): TtkTokenKind; + function FuncRedo(Index: Integer): TtkTokenKind; + function FuncRef(Index: Integer): TtkTokenKind; + function FuncRename(Index: Integer): TtkTokenKind; + function FuncRequire(Index: Integer): TtkTokenKind; + function FuncReset(Index: Integer): TtkTokenKind; + function FuncReturn(Index: Integer): TtkTokenKind; + function FuncReverse(Index: Integer): TtkTokenKind; + function FuncRewinddir(Index: Integer): TtkTokenKind; + function FuncRindex(Index: Integer): TtkTokenKind; + function FuncRmdir(Index: Integer): TtkTokenKind; + function FuncScalar(Index: Integer): TtkTokenKind; + function FuncSeek(Index: Integer): TtkTokenKind; + function FuncSeekdir(Index: Integer): TtkTokenKind; + function FuncSelect(Index: Integer): TtkTokenKind; + function FuncSemctl(Index: Integer): TtkTokenKind; + function FuncSemget(Index: Integer): TtkTokenKind; + function FuncSemop(Index: Integer): TtkTokenKind; + function FuncSend(Index: Integer): TtkTokenKind; + function FuncSetgrent(Index: Integer): TtkTokenKind; + function FuncSethostent(Index: Integer): TtkTokenKind; + function FuncSetnetent(Index: Integer): TtkTokenKind; + function FuncSetpgrp(Index: Integer): TtkTokenKind; + function FuncSetpriority(Index: Integer): TtkTokenKind; + function FuncSetprotoent(Index: Integer): TtkTokenKind; + function FuncSetpwent(Index: Integer): TtkTokenKind; + function FuncSetservent(Index: Integer): TtkTokenKind; + function FuncSetsockopt(Index: Integer): TtkTokenKind; + function FuncShift(Index: Integer): TtkTokenKind; + function FuncShmctl(Index: Integer): TtkTokenKind; + function FuncShmget(Index: Integer): TtkTokenKind; + function FuncShmread(Index: Integer): TtkTokenKind; + function FuncShmwrite(Index: Integer): TtkTokenKind; + function FuncShutdown(Index: Integer): TtkTokenKind; + function FuncSigtrap(Index: Integer): TtkTokenKind; + function FuncSin(Index: Integer): TtkTokenKind; + function FuncSleep(Index: Integer): TtkTokenKind; + function FuncSocket(Index: Integer): TtkTokenKind; + function FuncSocketpair(Index: Integer): TtkTokenKind; + function FuncSort(Index: Integer): TtkTokenKind; + function FuncSplice(Index: Integer): TtkTokenKind; + function FuncSplit(Index: Integer): TtkTokenKind; + function FuncSprintf(Index: Integer): TtkTokenKind; + function FuncSqrt(Index: Integer): TtkTokenKind; + function FuncSrand(Index: Integer): TtkTokenKind; + function FuncStat(Index: Integer): TtkTokenKind; + function FuncStrict(Index: Integer): TtkTokenKind; + function FuncStudy(Index: Integer): TtkTokenKind; + function FuncSub(Index: Integer): TtkTokenKind; + function FuncSubs(Index: Integer): TtkTokenKind; + function FuncSubstr(Index: Integer): TtkTokenKind; + function FuncSymlink(Index: Integer): TtkTokenKind; + function FuncSyscall(Index: Integer): TtkTokenKind; + function FuncSysread(Index: Integer): TtkTokenKind; + function FuncSystem(Index: Integer): TtkTokenKind; + function FuncSyswrite(Index: Integer): TtkTokenKind; + function FuncTell(Index: Integer): TtkTokenKind; + function FuncTelldir(Index: Integer): TtkTokenKind; + function FuncTie(Index: Integer): TtkTokenKind; + function FuncTime(Index: Integer): TtkTokenKind; + function FuncTimes(Index: Integer): TtkTokenKind; + function FuncTr(Index: Integer): TtkTokenKind; + function FuncTruncate(Index: Integer): TtkTokenKind; + function FuncUc(Index: Integer): TtkTokenKind; + function FuncUcfirst(Index: Integer): TtkTokenKind; + function FuncUmask(Index: Integer): TtkTokenKind; + function FuncUndef(Index: Integer): TtkTokenKind; + function FuncUnless(Index: Integer): TtkTokenKind; + function FuncUnlink(Index: Integer): TtkTokenKind; + function FuncUnpack(Index: Integer): TtkTokenKind; + function FuncUnshift(Index: Integer): TtkTokenKind; + function FuncUntie(Index: Integer): TtkTokenKind; + function FuncUse(Index: Integer): TtkTokenKind; + function FuncUtime(Index: Integer): TtkTokenKind; + function FuncValues(Index: Integer): TtkTokenKind; + function FuncVars(Index: Integer): TtkTokenKind; + function FuncVec(Index: Integer): TtkTokenKind; + function FuncWait(Index: Integer): TtkTokenKind; + function FuncWaitpid(Index: Integer): TtkTokenKind; + function FuncWantarray(Index: Integer): TtkTokenKind; + function FuncWarn(Index: Integer): TtkTokenKind; + function FuncWhile(Index: Integer): TtkTokenKind; + function FuncWrite(Index: Integer): TtkTokenKind; + function FuncXor(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AndSymbolProc; + procedure CRProc; + procedure ColonProc; + procedure CommentProc; + procedure EqualProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure NotSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure SlashProc; + procedure SpaceProc; + procedure StarProc; + procedure StringInterpProc; + procedure StringLiteralProc; + procedure SymbolProc; + procedure XOrSymbolProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri + write FInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri + write FOperatorAttri; + property PragmaAttri: TSynHighlighterAttributes read FPragmaAttri + write FPragmaAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..281] of UnicodeString = ( + '$ACCUMULATOR', '$ARG', '$ARGV', '$BASETIME', '$CHILD_ERROR', '$DEBUGGING', + '$EFFECTIVE_GROUP_ID', '$EFFECTIVE_USER_ID', '$EGID', '$ENV', '$ERRNO', + '$EUID', '$EVAL_ERROR', '$EXECUTABLE_NAME', '$FORMAT_FORMFEED', + '$FORMAT_LINE_BREAK_CHARACTERS', '$FORMAT_LINES_LEFT', + '$FORMAT_LINES_PER_PAGE', '$FORMAT_NAME', '$FORMAT_PAGE_NUMBER', + '$FORMAT_TOP_NAME', '$GID', '$INPLACE_EDIT', '$INPUT_LINE_NUMBER', + '$INPUT_RECORD_SEPARATOR', '$LAST_PAREN_MATCH', '$LIST_SEPARATOR', '$MATCH', + '$MULTILINE_MATCHING', '$NR', '$OFMT', '$ORS', '$OS_ERROR', + '$OUTPUT_AUTOFLUSH', '$OUTPUT_FIELD_SEPARATOR', '$PERL_VERSION', '$PERLDB', + '$PID', '$POSTMATCH', '$PREMATCH', '$PROCESS_ID', '$PROGRAM_NAME', + '$REAL_GROUP_ID', '$REAL_USER_ID', '$RS', '$SIG', '$SUBSCRIPT_SEPARATOR', + '$SUBSEP', '$SYSTEM_FD_MAX', '$UID', '$WARNING', '%INC', '@ARGV', '@INC', + 'abs', 'accept', 'alarm', 'and', 'atan2', 'bind', 'binmode', 'bless', + 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', + 'close', 'closedir', 'cmp', 'connect', 'constant', 'cos', 'crypt', + 'dbmclose', 'dbmopen', 'defined', 'delete', 'diagnostics', 'die', 'do', + 'dump', 'each', 'else', 'elsif', 'endgrent', 'endhostent', 'endnetent', + 'endprotoent', 'endpwent', 'endservent', 'eof', 'eq', 'eval', 'exec', + 'exists', 'exit', 'exp', 'fcntl', 'fileno', 'flock', 'for', 'foreach', + 'fork', 'format', 'formline', 'ge', 'getc', 'getgrent', 'getgrgid', + 'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin', + 'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp', + 'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber', + 'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname', + 'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', + 'gmtime', 'goto', 'grep', 'gt', 'hex', 'if', 'import', 'index', 'int', + 'integer', 'ioctl', 'join', 'keys', 'kill', 'last', 'lc', 'lcfirst', 'le', + 'length', 'less', 'link', 'listen', 'local', 'locale', 'localtime', 'log', + 'lstat', 'lt', 'm', 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', + 'my', 'ne', 'next', 'no', 'not', 'oct', 'open', 'opendir', 'or', 'ord', + 'pack', 'package', 'pipe', 'pop', 'pos', 'print', 'push', 'q', 'qq', + 'quotemeta', 'qw', 'qx', 'rand', 'read', 'readdir', 'readlink', 'recv', + 'redo', 'ref', 'rename', 'require', 'reset', 'return', 'reverse', + 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir', 'select', + 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent', + 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent', + 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', + 'shutdown', 'sigtrap', 'sin', 'sleep', 'socket', 'socketpair', 'sort', + 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat', 'strict', 'study', + 'sub', 'subs', 'substr', 'symlink', 'syscall', 'sysread', 'system', + 'syswrite', 'tell', 'telldir', 'tie', 'time', 'times', 'tr', 'truncate', + 'uc', 'ucfirst', 'umask', 'undef', 'unless', 'unlink', 'unpack', 'unshift', + 'untie', 'use', 'utime', 'values', 'vars', 'vec', 'wait', 'waitpid', + 'wantarray', 'warn', 'while', 'write', 'xor' + ); + + KeyIndices: array[0..2422] of Integer = ( + -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 62, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, + -1, -1, -1, -1, 212, 189, -1, -1, -1, -1, -1, -1, -1, 111, -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, 55, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, 247, + -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, + 155, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, 254, -1, + -1, -1, -1, -1, -1, -1, -1, 253, -1, 273, -1, -1, -1, 180, -1, -1, -1, -1, + 41, -1, -1, 18, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, 132, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, 45, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 281, -1, 142, -1, -1, -1, -1, 233, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, 7, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 87, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 198, -1, -1, -1, -1, -1, 116, 124, -1, -1, 203, 47, -1, -1, -1, -1, + 150, -1, -1, -1, 205, -1, -1, 152, -1, -1, 271, -1, -1, -1, -1, 76, 92, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, 207, -1, -1, -1, + -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, 153, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, 170, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 258, -1, -1, -1, -1, 99, -1, -1, -1, -1, 22, -1, -1, 33, -1, + -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 259, 228, -1, -1, -1, -1, 115, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, 167, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 158, 40, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 169, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 32, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, + 276, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, 101, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 38, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -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, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 190, -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, + 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 202, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, + -1, -1, -1, 112, -1, -1, 20, -1, -1, -1, -1, -1, 238, -1, -1, 8, -1, 249, + -1, -1, -1, -1, -1, -1, 246, -1, 232, 216, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 146, 54, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, + 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 214, -1, -1, -1, -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, 183, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 79, -1, -1, -1, + -1, -1, 86, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 267, 48, 131, 91, -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, 69, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, 270, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 166, -1, 73, -1, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, -1, -1, -1, 279, -1, 26, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 68, -1, 280, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 278, -1, 184, -1, -1, -1, -1, -1, -1, -1, -1, 206, -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, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 163, -1, -1, -1, -1, 52, -1, -1, -1, -1, -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, -1, -1, -1, + -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, + -1, -1, 129, -1, -1, -1, -1, -1, 95, -1, 234, -1, -1, -1, -1, -1, -1, -1, + -1, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, 138, -1, -1, + -1, -1, -1, 191, -1, 200, -1, -1, -1, 125, -1, -1, 268, 108, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, 66, + -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, 194, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 143, -1, 226, 182, -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, -1, -1, 16, + -1, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, + 113, -1, -1, -1, -1, -1, -1, -1, 37, -1, 71, -1, 15, -1, -1, -1, 154, 257, + -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 160, -1, -1, -1, 126, -1, -1, -1, -1, -1, 58, -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, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 240, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, 275, -1, -1, -1, + -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, + -1, -1, -1, 100, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, 130, -1, -1, 97, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, 196, -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, 114, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, 274, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 137, 35, 159, -1, -1, -1, -1, -1, -1, -1, 260, -1, + -1, -1, -1, -1, 24, -1, 118, 245, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, + -1, 211, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, 188, 147, + -1, 50, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 96, 181, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, + -1, 210, 27, -1, 136, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, 107, -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, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, -1, -1, + -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 164, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, + 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, + -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 213, -1, -1, -1, -1, 5, + -1, 219, -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, + -1, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 12, -1, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 56, -1, -1, -1, -1, 83, -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, 195, 225, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, 171, + -1, -1, -1, 157, 149, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 252, -1, -1, -1, 65, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 229, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, 105, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, 104, -1, -1, + -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, + -1, 220, 110, -1, -1, -1, 128, -1, -1, -1, -1, 235, 263, -1, -1, -1, -1, -1, + -1, -1, 201, -1, -1, -1, -1, -1, 29, -1, 156, -1, -1, -1, 19, -1, 123, -1, + 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 57, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, -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, -1, -1, 90, -1, -1, -1, -1, -1, + 80, -1, -1, -1, -1 + ); + +{$Q-} +function TSynPerlSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) or CharInSet(Str^, ['$', '%', '@']) do + begin + Result := Result * 975 + Ord(Str^) * 515; + Inc(Str); + end; + Result := Result mod 2423; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynPerlSyn.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 TSynPerlSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[368] := Func36accumulator; + FIdentFuncTable[2] := Func36arg; + FIdentFuncTable[804] := Func36argv; + FIdentFuncTable[2272] := Func36basetime; + FIdentFuncTable[626] := Func36child95error; + FIdentFuncTable[2026] := Func36debugging; + FIdentFuncTable[981] := Func36effective95group95id; + FIdentFuncTable[317] := Func36effective95user95id; + FIdentFuncTable[876] := Func36egid; + FIdentFuncTable[141] := Func36env; + FIdentFuncTable[35] := Func36errno; + FIdentFuncTable[495] := Func36euid; + FIdentFuncTable[2067] := Func36eval95error; + FIdentFuncTable[1589] := Func36executable95name; + FIdentFuncTable[1835] := Func36format95formfeed; + FIdentFuncTable[1465] := Func36format95line95break95characters; + FIdentFuncTable[1415] := Func36format95lines95left; + FIdentFuncTable[201] := Func36format95lines95per95page; + FIdentFuncTable[172] := Func36format95name; + FIdentFuncTable[2319] := Func36format95page95number; + FIdentFuncTable[867] := Func36format95top95name; + FIdentFuncTable[1237] := Func36gid; + FIdentFuncTable[519] := Func36inplace95edit; + FIdentFuncTable[315] := Func36input95line95number; + FIdentFuncTable[1733] := Func36input95record95separator; + FIdentFuncTable[1923] := Func36last95paren95match; + FIdentFuncTable[1093] := Func36list95separator; + FIdentFuncTable[1841] := Func36match; + FIdentFuncTable[2201] := Func36multiline95matching; + FIdentFuncTable[2313] := Func36nr; + FIdentFuncTable[2149] := Func36ofmt; + FIdentFuncTable[955] := Func36ors; + FIdentFuncTable[648] := Func36os95error; + FIdentFuncTable[522] := Func36output95autoflush; + FIdentFuncTable[97] := Func36output95field95separator; + FIdentFuncTable[1718] := Func36perl95version; + FIdentFuncTable[1568] := Func36perldb; + FIdentFuncTable[1461] := Func36pid; + FIdentFuncTable[723] := Func36postmatch; + FIdentFuncTable[908] := Func36prematch; + FIdentFuncTable[594] := Func36process95id; + FIdentFuncTable[169] := Func36program95name; + FIdentFuncTable[2182] := Func36real95group95id; + FIdentFuncTable[1084] := Func36real95user95id; + FIdentFuncTable[238] := Func36rs; + FIdentFuncTable[220] := Func36sig; + FIdentFuncTable[261] := Func36subscript95separator; + FIdentFuncTable[427] := Func36subsep; + FIdentFuncTable[1016] := Func36system95fd95max; + FIdentFuncTable[856] := Func36uid; + FIdentFuncTable[1803] := Func36warning; + FIdentFuncTable[1992] := Func37inc; + FIdentFuncTable[1181] := Func64argv; + FIdentFuncTable[1004] := Func64inc; + FIdentFuncTable[899] := FuncAbs; + FIdentFuncTable[79] := FuncAccept; + FIdentFuncTable[2102] := FuncAlarm; + FIdentFuncTable[2365] := FuncAnd; + FIdentFuncTable[1501] := FuncAtan2; + FIdentFuncTable[630] := FuncBind; + FIdentFuncTable[125] := FuncBinmode; + FIdentFuncTable[1110] := FuncBless; + FIdentFuncTable[19] := FuncCaller; + FIdentFuncTable[992] := FuncChdir; + FIdentFuncTable[2236] := FuncChmod; + FIdentFuncTable[2200] := FuncChomp; + FIdentFuncTable[1341] := FuncChop; + FIdentFuncTable[1964] := FuncChown; + FIdentFuncTable[1103] := FuncChr; + FIdentFuncTable[1046] := FuncChroot; + FIdentFuncTable[846] := FuncClose; + FIdentFuncTable[1463] := FuncClosedir; + FIdentFuncTable[470] := FuncCmp; + FIdentFuncTable[1076] := FuncConnect; + FIdentFuncTable[2039] := FuncConstant; + FIdentFuncTable[720] := FuncCos; + FIdentFuncTable[447] := FuncCrypt; + FIdentFuncTable[111] := FuncDbmclose; + FIdentFuncTable[1988] := FuncDbmopen; + FIdentFuncTable[985] := FuncDefined; + FIdentFuncTable[2418] := FuncDelete; + FIdentFuncTable[1194] := FuncDiagnostics; + FIdentFuncTable[2120] := FuncDie; + FIdentFuncTable[2107] := FuncDo; + FIdentFuncTable[2381] := FuncDump; + FIdentFuncTable[1909] := FuncEach; + FIdentFuncTable[991] := FuncElse; + FIdentFuncTable[341] := FuncElsif; + FIdentFuncTable[1739] := FuncEndgrent; + FIdentFuncTable[967] := FuncEndhostent; + FIdentFuncTable[2412] := FuncEndnetent; + FIdentFuncTable[1018] := FuncEndprotoent; + FIdentFuncTable[448] := FuncEndpwent; + FIdentFuncTable[1681] := FuncEndservent; + FIdentFuncTable[1052] := FuncEof; + FIdentFuncTable[1278] := FuncEq; + FIdentFuncTable[1816] := FuncEval; + FIdentFuncTable[1618] := FuncExec; + FIdentFuncTable[2020] := FuncExists; + FIdentFuncTable[514] := FuncExit; + FIdentFuncTable[1586] := FuncExp; + FIdentFuncTable[686] := FuncFcntl; + FIdentFuncTable[115] := FuncFileno; + FIdentFuncTable[1810] := FuncFlock; + FIdentFuncTable[2265] := FuncFor; + FIdentFuncTable[2225] := FuncForeach; + FIdentFuncTable[1846] := FuncFork; + FIdentFuncTable[1854] := FuncFormat; + FIdentFuncTable[1319] := FuncFormline; + FIdentFuncTable[1072] := FuncGe; + FIdentFuncTable[2289] := FuncGetc; + FIdentFuncTable[51] := FuncGetgrent; + FIdentFuncTable[864] := FuncGetgrgid; + FIdentFuncTable[1453] := FuncGetgrnam; + FIdentFuncTable[1663] := FuncGethostbyaddr; + FIdentFuncTable[567] := FuncGethostbyname; + FIdentFuncTable[422] := FuncGethostent; + FIdentFuncTable[1243] := FuncGetlogin; + FIdentFuncTable[1735] := FuncGetnetbyaddr; + FIdentFuncTable[1749] := FuncGetnetbyname; + FIdentFuncTable[1647] := FuncGetnetent; + FIdentFuncTable[1970] := FuncGetpeername; + FIdentFuncTable[2348] := FuncGetpgrp; + FIdentFuncTable[2321] := FuncGetppid; + FIdentFuncTable[423] := FuncGetpriority; + FIdentFuncTable[1315] := FuncGetprotobyname; + FIdentFuncTable[1495] := FuncGetprotobynumber; + FIdentFuncTable[2168] := FuncGetprotoent; + FIdentFuncTable[2293] := FuncGetpwent; + FIdentFuncTable[1272] := FuncGetpwnam; + FIdentFuncTable[1615] := FuncGetpwuid; + FIdentFuncTable[1017] := FuncGetservbyname; + FIdentFuncTable[186] := FuncGetservbyport; + FIdentFuncTable[26] := FuncGetservent; + FIdentFuncTable[737] := FuncGetsockname; + FIdentFuncTable[531] := FuncGetsockopt; + FIdentFuncTable[1843] := FuncGlob; + FIdentFuncTable[1717] := FuncGmtime; + FIdentFuncTable[1303] := FuncGoto; + FIdentFuncTable[1577] := FuncGrep; + FIdentFuncTable[1528] := FuncGt; + FIdentFuncTable[1896] := FuncHex; + FIdentFuncTable[292] := FuncIf; + FIdentFuncTable[1381] := FuncImport; + FIdentFuncTable[708] := FuncIndex; + FIdentFuncTable[2368] := FuncInt; + FIdentFuncTable[898] := FuncInteger; + FIdentFuncTable[1801] := FuncIoctl; + FIdentFuncTable[1665] := FuncJoin; + FIdentFuncTable[2161] := FuncKeys; + FIdentFuncTable[432] := FuncKill; + FIdentFuncTable[2001] := FuncLast; + FIdentFuncTable[439] := FuncLc; + FIdentFuncTable[485] := FuncLcfirst; + FIdentFuncTable[1469] := FuncLe; + FIdentFuncTable[132] := FuncLength; + FIdentFuncTable[2315] := FuncLess; + FIdentFuncTable[2160] := FuncLink; + FIdentFuncTable[593] := FuncListen; + FIdentFuncTable[1719] := FuncLocal; + FIdentFuncTable[1491] := FuncLocale; + FIdentFuncTable[357] := FuncLocaltime; + FIdentFuncTable[2033] := FuncLog; + FIdentFuncTable[1176] := FuncLstat; + FIdentFuncTable[1925] := FuncLt; + FIdentFuncTable[406] := FuncM; + FIdentFuncTable[1074] := FuncMap; + FIdentFuncTable[578] := FuncMkdir; + FIdentFuncTable[1701] := FuncMsgctl; + FIdentFuncTable[613] := FuncMsgget; + FIdentFuncTable[497] := FuncMsgrcv; + FIdentFuncTable[2156] := FuncMsgsnd; + FIdentFuncTable[218] := FuncMy; + FIdentFuncTable[174] := FuncNe; + FIdentFuncTable[611] := FuncNext; + FIdentFuncTable[478] := FuncNo; + FIdentFuncTable[1217] := FuncNot; + FIdentFuncTable[1597] := FuncOct; + FIdentFuncTable[1330] := FuncOpen; + FIdentFuncTable[342] := FuncOpendir; + FIdentFuncTable[164] := FuncOr; + FIdentFuncTable[1817] := FuncOrd; + FIdentFuncTable[1384] := FuncPack; + FIdentFuncTable[968] := FuncPackage; + FIdentFuncTable[1125] := FuncPipe; + FIdentFuncTable[1338] := FuncPop; + FIdentFuncTable[460] := FuncPos; + FIdentFuncTable[1768] := FuncPrint; + FIdentFuncTable[1800] := FuncPush; + FIdentFuncTable[43] := FuncQ; + FIdentFuncTable[777] := FuncQq; + FIdentFuncTable[1309] := FuncQuotemeta; + FIdentFuncTable[1444] := FuncQw; + FIdentFuncTable[1959] := FuncQx; + FIdentFuncTable[1367] := FuncRand; + FIdentFuncTable[2133] := FuncRead; + FIdentFuncTable[1635] := FuncReaddir; + FIdentFuncTable[645] := FuncReadlink; + FIdentFuncTable[416] := FuncRecv; + FIdentFuncTable[2221] := FuncRedo; + FIdentFuncTable[1311] := FuncRef; + FIdentFuncTable[2307] := FuncRename; + FIdentFuncTable[843] := FuncRequire; + FIdentFuncTable[426] := FuncReset; + FIdentFuncTable[2323] := FuncReturn; + FIdentFuncTable[436] := FuncReverse; + FIdentFuncTable[1134] := FuncRewinddir; + FIdentFuncTable[464] := FuncRindex; + FIdentFuncTable[272] := FuncRmdir; + FIdentFuncTable[1475] := FuncScalar; + FIdentFuncTable[1840] := FuncSeek; + FIdentFuncTable[1748] := FuncSeekdir; + FIdentFuncTable[42] := FuncSelect; + FIdentFuncTable[2021] := FuncSemctl; + FIdentFuncTable[933] := FuncSemget; + FIdentFuncTable[570] := FuncSemop; + FIdentFuncTable[888] := FuncSend; + FIdentFuncTable[1789] := FuncSetgrent; + FIdentFuncTable[915] := FuncSethostent; + FIdentFuncTable[2028] := FuncSetnetent; + FIdentFuncTable[2288] := FuncSetpgrp; + FIdentFuncTable[2047] := FuncSetpriority; + FIdentFuncTable[1369] := FuncSetprotoent; + FIdentFuncTable[1608] := FuncSetpwent; + FIdentFuncTable[1629] := FuncSetservent; + FIdentFuncTable[2134] := FuncSetsockopt; + FIdentFuncTable[1383] := FuncShift; + FIdentFuncTable[540] := FuncShmctl; + FIdentFuncTable[562] := FuncShmget; + FIdentFuncTable[2213] := FuncShmread; + FIdentFuncTable[1301] := FuncShmwrite; + FIdentFuncTable[1289] := FuncShutdown; + FIdentFuncTable[887] := FuncSigtrap; + FIdentFuncTable[297] := FuncSin; + FIdentFuncTable[1280] := FuncSleep; + FIdentFuncTable[2298] := FuncSocket; + FIdentFuncTable[1891] := FuncSocketpair; + FIdentFuncTable[1795] := FuncSort; + FIdentFuncTable[873] := FuncSplice; + FIdentFuncTable[830] := FuncSplit; + FIdentFuncTable[1546] := FuncSprintf; + FIdentFuncTable[1553] := FuncSqrt; + FIdentFuncTable[81] := FuncSrand; + FIdentFuncTable[184] := FuncStat; + FIdentFuncTable[1266] := FuncStrict; + FIdentFuncTable[1736] := FuncStudy; + FIdentFuncTable[885] := FuncSub; + FIdentFuncTable[112] := FuncSubs; + FIdentFuncTable[2260] := FuncSubstr; + FIdentFuncTable[878] := FuncSymlink; + FIdentFuncTable[1258] := FuncSyscall; + FIdentFuncTable[1422] := FuncSysread; + FIdentFuncTable[2196] := FuncSystem; + FIdentFuncTable[158] := FuncSyswrite; + FIdentFuncTable[149] := FuncTell; + FIdentFuncTable[2069] := FuncTelldir; + FIdentFuncTable[387] := FuncTie; + FIdentFuncTable[1470] := FuncTime; + FIdentFuncTable[509] := FuncTimes; + FIdentFuncTable[561] := FuncTr; + FIdentFuncTable[1727] := FuncTruncate; + FIdentFuncTable[669] := FuncUc; + FIdentFuncTable[819] := FuncUcfirst; + FIdentFuncTable[2299] := FuncUmask; + FIdentFuncTable[1162] := FuncUndef; + FIdentFuncTable[1946] := FuncUnless; + FIdentFuncTable[681] := FuncUnlink; + FIdentFuncTable[1015] := FuncUnpack; + FIdentFuncTable[1318] := FuncUnshift; + FIdentFuncTable[2280] := FuncUntie; + FIdentFuncTable[1060] := FuncUse; + FIdentFuncTable[442] := FuncUtime; + FIdentFuncTable[2080] := FuncValues; + FIdentFuncTable[160] := FuncVars; + FIdentFuncTable[1705] := FuncVec; + FIdentFuncTable[1560] := FuncWait; + FIdentFuncTable[672] := FuncWaitpid; + FIdentFuncTable[938] := FuncWantarray; + FIdentFuncTable[1123] := FuncWarn; + FIdentFuncTable[1091] := FuncWhile; + FIdentFuncTable[1105] := FuncWrite; + FIdentFuncTable[290] := FuncXor; +end; + +function TSynPerlSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36accumulator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36arg(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36argv(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36basetime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36child95error(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36debugging(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36effective95group95id(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36effective95user95id(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36egid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36env(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36errno(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36euid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36eval95error(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36executable95name(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95formfeed(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95line95break95characters(Index: Integer): + TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95lines95left(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95lines95per95page(Index: Integer): + TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95name(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95page95number(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36format95top95name(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36gid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36inplace95edit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36input95line95number(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36input95record95separator(Index: Integer): + TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36last95paren95match(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36list95separator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36match(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36multiline95matching(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36nr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36ofmt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36ors(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36os95error(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36output95autoflush(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36output95field95separator(Index: Integer): + TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36perl95version(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36perldb(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36pid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36postmatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36prematch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36process95id(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36program95name(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36real95group95id(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36real95user95id(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36rs(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36sig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36subscript95separator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36subsep(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36system95fd95max(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36uid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func36warning(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func37inc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func64argv(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.Func64inc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncAbs(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncAccept(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncAlarm(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncAnd(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncAtan2(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncBind(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncBinmode(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncBless(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncCaller(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChdir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChmod(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChomp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChown(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncChroot(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncClose(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncClosedir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncCmp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncConnect(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncConstant(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncCos(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncCrypt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDbmclose(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDbmopen(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDefined(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDelete(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDiagnostics(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDie(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncDump(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEach(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncElse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncElsif(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndgrent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndhostent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndnetent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndprotoent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndpwent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEndservent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEof(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEq(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncEval(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncExec(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncExists(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncExit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncExp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFcntl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFileno(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFlock(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncForeach(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFork(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFormat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncFormline(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGe(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetgrent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetgrgid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetgrnam(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGethostbyaddr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGethostbyname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGethostent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetlogin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetnetbyaddr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetnetbyname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetnetent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpeername(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpgrp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetppid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpriority(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetprotobyname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetprotobynumber(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetprotoent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpwent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpwnam(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetpwuid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetservbyname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetservbyport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetservent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetsockname(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGetsockopt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGlob(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGmtime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGoto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGrep(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncGt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncHex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncIf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncImport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncIndex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncInt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncInteger(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncIoctl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncJoin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncKeys(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncKill(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLast(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLcfirst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLe(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLength(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLess(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncListen(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLocal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLocale(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLocaltime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLog(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLstat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncLt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncM(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMap(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMkdir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMsgctl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMsgget(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMsgrcv(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMsgsnd(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncMy(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncNe(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncNext(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncNo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncNot(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOct(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOpen(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOpendir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOrd(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPack(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPackage(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPipe(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPos(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPrint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPush(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncQ(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncQq(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncQuotemeta(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncQw(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncQx(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRand(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRead(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncReaddir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncReadlink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRecv(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRedo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRef(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRename(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRequire(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncReset(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncReturn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncReverse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRewinddir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRindex(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncRmdir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncScalar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSeek(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSeekdir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSelect(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSemctl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSemget(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSemop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSend(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetgrent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSethostent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetnetent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetpgrp(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetpriority(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetprotoent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetpwent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetservent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSetsockopt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShift(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShmctl(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShmget(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShmread(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShmwrite(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncShutdown(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSigtrap(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSleep(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSocket(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSocketpair(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSort(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSplice(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSplit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSprintf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSqrt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSrand(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncStat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncStrict(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncStudy(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSub(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSubs(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSubstr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSymlink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSyscall(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSysread(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSystem(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncSyswrite(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTell(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTelldir(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTie(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTimes(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTr(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncTruncate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUcfirst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUmask(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUndef(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUnless(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUnlink(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUnpack(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUnshift(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUntie(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncUtime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncValues(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncVars(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncVec(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWait(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWaitpid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWantarray(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWarn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWhile(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncWrite(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncXor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +constructor TSynPerlSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(FInvalidAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); + AddAttribute(FOperatorAttri); + FPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPragma, SYNS_FriendlyAttrPragma); + FPragmaAttri.Style := [fsBold]; + AddAttribute(FPragmaAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + FVariableAttri.Style := [fsBold]; + AddAttribute(FVariableAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterPerl; +end; { Create } + +procedure TSynPerlSyn.AndSymbolProc; +begin + case FLine[Run + 1] of + '=': {bit and assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '&': + begin + if FLine[Run + 2] = '=' then {logical and assign} + Inc(Run, 3) + else {logical and} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {bit and} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else Inc(Run); + end; +end; + +procedure TSynPerlSyn.ColonProc; +begin + case FLine[Run + 1] of + ':': {double colon} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {colon} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.CommentProc; +begin + FTokenID := tkComment; + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = #0; +end; + +procedure TSynPerlSyn.EqualProc; +begin + case FLine[Run + 1] of + '=': {logical equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': {digraph} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '~': {bind scalar to pattern} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {assign} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.GreaterProc; +begin + case FLine[Run + 1] of + '=': {greater than or equal to} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': + begin + if FLine[Run + 2] = '=' then {shift right assign} + Inc(Run, 3) + else {shift right} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {greater than} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.IdentProc; +begin + case FLine[Run] of + '$': + begin + case FLine[Run + 1] of + '!'..'+', '-'..'@', '['..']', '_', '`', '|', '~': + begin {predefined variables} + Inc(Run, 2); + FTokenID := tkVariable; + Exit; + end; + '^': + begin + case FLine[Run + 2] of + 'A', 'D', 'F', 'I', 'L', 'P', 'T', 'W', 'X': + begin {predefined variables} + Inc(Run, 3); + FTokenID := tkVariable; + Exit; + end; + #0, #10, #13: {predefined variables} + begin + Inc(Run, 2); + FTokenID := tkVariable; + Exit; + end; + end; + end; + end; + end; + '%': + begin + case FLine[Run + 1] of + '=': {mod assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + Exit; + end; + #0, #10, #13: {mod} + begin + Inc(Run); + FTokenID := tkSymbol; + Exit; + end; + end; + end; + 'x': + begin + case FLine[Run + 1] of + '=': {repetition assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + Exit; + end; + #0, #10, #13: {repetition} + begin + Inc(Run); + FTokenID := tkSymbol; + Exit; + end; + end; + end; + end; + {regular identifier} + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynPerlSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynPerlSyn.LowerProc; +begin + case FLine[Run + 1] of + '=': + begin + if FLine[Run + 2] = '>' then {compare - less than, equal, greater} + Inc(Run, 3) + else {less than or equal to} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '<': + begin + if FLine[Run + 2] = '=' then {shift left assign} + Inc(Run, 3) + else {shift left} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {less than} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.MinusProc; +begin + case FLine[Run + 1] of + '=': {subtract assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '-': {decrement} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': {arrow} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {subtract} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.NotSymbolProc; +begin + case FLine[Run + 1] of + '~': {logical negated bind like =~} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '=': {not equal} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {not} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynPerlSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '-', '_', '.', 'A'..'F', 'a'..'f', 'x', 'X': + Result := True; + else + Result := False; + end; + end; + +begin + if FLine[Run] = '.' then + begin + case FLine[Run + 1] of + '.': + begin + Inc(Run, 2); + if FLine[Run] = '.' then {sed range} + Inc(Run); + + FTokenID := tkSymbol; {range} + Exit; + end; + '=': + begin + Inc(Run, 2); + FTokenID := tkSymbol; {concatenation assign} + Exit; + end; + 'a'..'z', 'A'..'Z', '_': + begin + FTokenID := tkSymbol; {concatenation} + Inc(Run); + Exit; + end; + end; + end; + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + '-': {check for e notation} + if not ((FLine[Run + 1] = 'e') or (FLine[Run + 1] = 'E')) then Break; + end; + Inc(Run); + end; +end; + +procedure TSynPerlSyn.OrSymbolProc; +begin + case FLine[Run + 1] of + '=': {bit or assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '|': + begin + if FLine[Run + 2] = '=' then {logical or assign} + Inc(Run, 3) + else {logical or} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {bit or} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.PlusProc; +begin + case FLine[Run + 1] of + '=': {add assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '+': {increment} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {add} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.SlashProc; +begin + case FLine[Run + 1] of + '=': {division assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {division} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynPerlSyn.StarProc; +begin + case FLine[Run + 1] of + '=': {multiply assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '*': + begin + if FLine[Run + 2] = '=' then {exponentiation assign} + Inc(Run, 3) + else {exponentiation} + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {multiply} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.StringInterpProc; +var + BackslashCount : Integer; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + case FLine[Run] of + #0, #10, #13: + Break; + #92: + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. } + if (FLine[Run + 1] = #34) then + begin + BackslashCount := 1; + + while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = #92)) do + BackslashCount := BackslashCount + 1; + + if (BackslashCount mod 2 = 1) then Inc(Run) + end; + end; + Inc(Run); + until FLine[Run] = #34; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynPerlSyn.StringLiteralProc; +begin + FTokenID := tkString; + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = #39; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynPerlSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPerlSyn.XOrSymbolProc; +begin + case FLine[Run + 1] of + '=': {xor assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else {xor} + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynPerlSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + '&': AndSymbolProc; + #13: CRProc; + ':': ColonProc; + '#': CommentProc; + '=': EqualProc; + '>': GreaterProc; + '%', '@', '$', 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + '-': MinusProc; + '!': NotSymbolProc; + #0: NullProc; + '0'..'9', '.': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '*': StarProc; + #34: StringInterpProc; + #39: StringLiteralProc; + '^': XOrSymbolProc; + '(', ')', '[', ']', '\', '{', '}', ',', ';', '?', '~': SymbolProc; + else UnknownProc; + end; + inherited; +end; + +function TSynPerlSyn.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 TSynPerlSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynPerlSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynPerlSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkOperator: Result := FOperatorAttri; + tkPragma: Result := FPragmaAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FInvalidAttri; + tkVariable: Result := FVariableAttri; + else Result := nil; + end; +end; + +function TSynPerlSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynPerlSyn.GetSampleSource: UnicodeString; +begin + Result := + '#!/bin/perl'#13#10 + + 'require "cgi-lib.pl";'#13#10 + + 'use sigtrap;'#13#10 + + 'do ''envars.pl'';'#13#10 + + '$_ = $password1;'#13#10 + + 'sub WriteBack {'#13#10 + + ' while ($_ ne "fred") {'#13#10 + + ' sleep 5;'#13#10 + + ' }'#13#10 + + '}'; +end; + +function TSynPerlSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterPerl; +end; + +function TSynPerlSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '%', '@', '$', '_', '0'..'9', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +class function TSynPerlSyn.GetLanguageName: string; +begin + Result := SYNS_LangPerl; +end; + +class function TSynPerlSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangPerl; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynPerlSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterProgress.pas b/Source/VCL/SynEdit/Source/SynHighlighterProgress.pas index ea0f60b6..907c26f0 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterProgress.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterProgress.pas @@ -1,1074 +1,1076 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterProgress.pas, released 2000-04-20. -The Initial Author of the Original Code is Bruno Mikkelsen. -Portions written by Bruno Mikkelsen are copyright 2000 Bruno Mikkelsen. -Unicode translation by Maël Hörz. -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: SynHighlighterProgress.pas,v 1.16.2.8 2009/09/28 19:16:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Progress Syntax highlighter for SynEdit) -@author(Bruno Mikkelsen ) -@created(2000-04-16) -@lastmod(2000-06-20) -The SynHighlighterProgress provides SynEdit with a syntax highlighter for the -Progress programming language. -Thanks to Michael Hieke for providing a sample highlighter on which this -highlighter is based. -} - -unit SynHighlighterProgress; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; - -type - {Enumerates the different tokens in Progress.} - TtkTokenKind = (tkComment, tkEvent, tkIdentifier, tkInclude, tkKey, - tkNonReserved, tkNull, tkNumber, tkPreprocessor, tkSpace, tkDataType, - tkString, tkSymbol, tkUnknown); - - {Enumerates the ranges in Progress syntax.} - TRangeState = (rsNone, rsInclude, rsPreprocessorDef, rsPreprocessor, - rsComment); - - {Used to hold extra rangeinfo in the Lines.Objects pointer.} - TRangeInfo = packed record - case boolean of - False: (Ptr: Pointer); - True: (Range: Word; Level: Word); - end; - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynProgressSyn = class(TSynCustomHighLighter) - private - fRange: TRangeState; - fCommentLevel: Integer; - fIncludeLevel: Integer; - fPreProcessorLevel: Integer; - FTokenID: TtkTokenKind; - fCommentAttri: TSynHighlighterAttributes; - fEventAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fIncludeAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNonReservedKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fPreprocessorAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fDataTypeAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fHashList: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: string; AKind: Integer); - function HashKey(Str: PWideChar): Integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure AsciiCharProc; - procedure CommentRangeProc; - procedure IncludeRangeProc; - procedure PreprocessorRangeProc; - procedure PreprocessorDefinitionProc; - procedure PreprocessorDefinitionRangeProc; - procedure BraceOpenProc; - procedure IdentProc; - procedure NullProc; - procedure NumberProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure UnknownProc; - procedure SymbolProc; - protected - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; -{$IFDEF DEBUG} - public - property Keywords: TSynHashEntryList read fHashList; -{$ENDIF} - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property EventAttri: TSynHighlighterAttributes read fEventAttri - write fEventAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property IncludeAttri: TSynHighlighterAttributes read fIncludeAttri - write fIncludeAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NonReservedKeyAttri: TSynHighlighterAttributes - read fNonReservedKeyAttri write fNonReservedKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property PreprocessorAttri: TSynHighlighterAttributes - read fPreprocessorAttri write fPreprocessorAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property DataTypeAttri: TSynHighlighterAttributes read fDataTypeAttri - write fDataTypeAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - end; - -const - DefaultKeywords: string = - 'accum accumulate active-window add alias ' + - 'all alter ambig ambiguous analyze ' + - 'analyze-resume analyze-suspend and any apply ' + - 'as asc ascending assign at ' + - 'attr-space authorization auto-return avail available ' + - 'background before-hide begins bell between ' + - 'bin blank break btos by ' + - 'byte call can-do can-find case ' + - 'case-sensitive center centered check chr ' + - 'clear clipboard col colon color ' + - 'column column-label columns compiler control ' + - 'count-of cpstream create ctos current ' + - 'current-changed current-lang current-language current-window cursor ' + - 'database dataservers dbcodepage dbcollation dbname ' + - 'dbparam dbrestrictions dbtaskid dbtype dbversion ' + - 'dde deblank debug-list debugger decimals ' + - 'declare def default default-noxlate default-window ' + - 'define delete delimiter desc descending ' + - 'dict dictionary disable disconnect disp ' + - 'display distinct do dos down ' + - 'drop each editing else ' + - 'elseif enable encode end endif ' + - 'entry error-status escape etime except ' + - 'exclusive exclusive-lock exists export false ' + - 'fetch field fields file-info file-information ' + - 'fill find find-case-sensitive find-global find-next-occurrence ' + - 'find-prev-occurrence find-select find-wrap-around first first-of ' + - 'focus font font-based-grid for form ' + - 'format frame frame-col frame-db frame-down ' + - 'frame-field frame-file frame-index frame-line frame-name ' + - 'frame-row frame-val frame-value from from-chars ' + - 'from-pixels gateways get-byte get-codepages get-collations ' + - 'get-key-value getbyte glob global ' + - 'global-define go-on go-pending grant graphic-edge ' + - 'group having header help hide ' + - 'if import in index ' + - 'indicator input input-output insert into ' + - 'is is-attr-space join kblabel key-code ' + - 'key-function key-label keycode keyfunction keylabel ' + - 'keys keyword label last last-event ' + - 'last-key last-of lastkey ldbname leave ' + - 'library like line-count line-counter line-number ' + - 'listing locked long lookup machine-class ' + - 'map max-button member memptr message ' + - 'message-lines mouse mpe new next ' + - 'next-prompt no no-attr-space no-error no-fill ' + - 'no-help no-hide no-label no-labels no-lobs no-lock ' + - 'no-map no-message no-pause no-prefetch no-undo ' + - 'no-validate no-wait not null num-aliases ' + - 'num-dbs num-entries of off old ' + - 'on open opsys option ' + - 'or os-append os-command os-copy os-create-dir ' + - 'os-delete os-dir os-rename os2 os400 ' + - 'otherwise output overlay page page-bottom ' + - 'page-num page-number page-top param parameter ' + - 'pause pdbname persistent pixels preprocess ' + - 'privileges proc-handle proc-status process program-name ' + - 'progress prompt prompt-for promsgs propath ' + - 'proversion put put-byte put-key-value putbyte ' + - 'query query-tuning quit r-index rcode-information ' + - 'readkey recid record-length rectangle ' + - 'release repeat reposition retain retry ' + - 'return revert revoke run save ' + - 'schema scop scoped scoped-define screen ' + - 'screen-io screen-lines scroll sdbname search ' + - 'seek select self sequence session ' + - 'set setuserid share share-lock shared ' + - 'short show-stats skip some space ' + - 'status stream stream-io string-xref system-dialog ' + - 'table tab-stop term terminal text text-cursor ' + - 'text-height text-seg-growth then this-procedure ' + - 'time title to top-only trans ' + - 'transaction trigger triggers trim true ' + - 'undefine underline undo unformatted union ' + - 'unique unix unless-hidden unsigned-short up ' + - 'update use-index use-revvideo use-underline user ' + - 'userid using v6frame value values ' + - 'view view-as vms wait-for web-context ' + - 'when where while widget-id window window-maximized ' + - 'window-minimized window-normal with work-table workfile ' + - 'write xcode xref yes _actailog ' + - '_actbilog _actbuffer _actindex _actiofile _actiotype ' + - '_actlock _actother _actpws _actrecord _actserver ' + - '_actspace _actsummary _block _buffstatus _cbit ' + - '_checkpoint _connect _control _db _dbstatus ' + - '_dcm _field _field-trig _file _file-trig ' + - '_filelist _index _index-field _license _list ' + - '_lock _lockreq _logging _memory _msg ' + - '_mstrblk _pcontrol _segments _sequence _serial-num ' + - '_servers _startup _trace _trans _user ' + - '_userio _userlock _view _view-col _view-ref'; - - DefaultNonReservedKeywords: string = - 'abs absolute accelerator across add-events-procedure ' + - 'add-first add-interval add-last advise alert-box allow-replication ' + - 'ansi-only anywhere append appl-alert appl-alert-boxes ' + - 'application as-cursor ask-overwrite attachment auto-endkey ' + - 'auto-end-key auto-go auto-indent auto-resize auto-zap ' + - 'available-formats average avg backwards base-key ' + - 'batch batch-mode bgc bgcolor ' + - 'binary bind-where block-iteration-display border-bottom border-bottom-chars ' + - 'border-bottom-pixels border-left border-left-chars border-left-pixels border-right ' + - 'border-right-chars border-right-pixels border-top border-top-chars border-top-pixels ' + - 'both bottom box box-select box-selectable ' + - 'browse browse-header btn-down-arrow btn-left-arrow btn-right-arrow ' + - 'btn-up-arrow buffer buffer-chars buffer-compare buffer-copy ' + - 'buffer-lines button buttons cache cache-size ' + - 'cancel-break cancel-button can-query can-set caps ' + - 'cdecl character_length charset checked clear-select ' + - 'clear-selection code codepage codepage-convert col-of ' + - 'colon-align colon-aligned color-table column-bgcolor column-dcolor ' + - 'column-fgcolor column-font column-label-bgcolor column-label-dcolor column-label-fgcolor ' + - 'column-label-font column-of column-scrolling com1 com2 ' + - 'com3 com4 com5 com6 com7 ' + - 'com8 com9 combo-box command complete ' + - 'com-self con connect connected ' + - 'constrained contains contents context context-popup ' + - 'control-container convert convert-3d-colors convert-to-offset count copy-lob ' + - 'cpcase cpcoll cpinternal cplog cpprint ' + - 'cprcodein cprcodeout cpterm crc-value create-control ' + - 'create-result-list-entry create-test-file current_date current-column ' + - 'current-iteration current-result-row current-row-modified current-value cursor-char ' + - 'cursor-line cursor-offset data-entry-return data-type date-format ' + - 'day db-references dcolor dde-error dde-id ' + - 'dde-item dde-name dde-topic debug default-button ' + - 'default-extension defined delete-current-row delete-selected-row delete-selected-rows ' + - 'deselect-focused-row deselect-rows deselect-selected-row design-mode dialog-box ' + - 'dialog-help dir disabled display-message display-type ' + - 'drag-enabled drop-down drop-down-list dump dynamic dynamic-function ' + - 'echo edge edge-chars edge-pixels edit-can-undo ' + - 'editor edit-undo empty end-key entered ' + - 'eq error error-col error-column error-row ' + - 'events event-type exp expand extended ' + - 'extent external extract fetch-selected-row fgc ' + - 'fgcolor file filename file-create-date file-create-time file-mod-date file-mod-time file-name ' + - 'file-offset file-size file-type filled fill-in filters ' + - 'first-child first-column first-proc first-procedure first-server ' + - 'first-tab-item fixed-only focused-row font-table force-file ' + - 'foreground forwards frame-spacing frame-x frame-y ' + - 'frequency from-current full-height full-height-chars full-height-pixels ' + - 'full-pathname full-width full-width-chars full-width-pixels function ' + - 'ge get-blue get-blue-value get-char-property get-double ' + - 'get-dynamic get-file get-float get-green get-green-value ' + - 'get-iteration get-license get-long get-message get-number ' + - 'get-pointer-value get-red get-red-value get-repositioned-row get-selected ' + - 'get-selected-widget get-short get-signature get-size get-string ' + - 'get-tab-item get-text-height get-text-height-chars get-text-height-pixels get-text-width ' + - 'get-text-width-chars get-text-width-pixels get-unsigned-short grayed grid-factor-h ' + - 'grid-factor-horizontal grid-factor-v grid-factor-vertical grid-set grid-snap ' + - 'grid-unit-height grid-unit-height-chars grid-unit-height-pixels grid-unit-width grid-unit-width-chars ' + - 'grid-unit-width-pixels grid-visible gt height height-chars ' + - 'height-pixels help-context hidden horizontal hwnd ' + - 'image image-down image-insensitive image-size image-size-chars ' + - 'image-size-pixels image-up immediate-display indexed-reposition index-hint ' + - 'info information init initial initial-dir ' + - 'initial-filter initiate inner inner-chars inner-lines input-value ' + - 'insert-backtab insert-file insert-row insert-string insert-tab instantiating-procedure ' + - 'internal-entries is-lead-byte is-row-selected is-selected item ' + - 'items-per-row join-by-sqldb keep-frame-z-order keep-messages keep-tab-order ' + - 'key keyword-all label-bgc label-bgcolor label-dc ' + - 'label-dcolor label-fgc label-fgcolor label-font label-pfc ' + - 'label-pfcolor labels languages large large-to-small ' + - 'last-child last-proc last-procedure last-server last-tab-item ' + - 'lc le leading left-aligned left-trim ' + - 'length line list-events list-items list-item-pairs list-query-attrs ' + - 'list-set-attrs list-widgets load load-control loadcontrols ' + - 'load-icon load-image load-image-down load-image-insensitive load-image-up ' + - 'load-mouse-pointer load-small-icon log-id lookahead lower ' + - 'lpt0 lpt1 lpt2 lpt3 lpt4 ' + - 'lpt5 lpt6 lpt7 lpt8 lpt9 ' + - 'lt manual-highlight margin-extra margin-height margin-height-chars ' + - 'margin-height-pixels margin-width margin-width-chars margin-width-pixels matches ' + - 'max max-chars max-data-guess max-height ' + - 'max-height-chars max-height-pixels maximize maximum max-rows ' + - 'max-size max-value max-width max-width-chars max-width-pixels ' + - 'memory menu menubar menu-bar menu-item ' + - 'menu-key menu-mouse message-area message-area-font message-line ' + - 'min min-height min-height-chars min-height-pixels minimum ' + - 'min-size min-value min-width min-width-chars min-width-pixels ' + - 'mod modified modulo month mouse-pointer ' + - 'movable move-after move-after-tab-item move-before move-before-tab-item ' + - 'move-column move-to-bottom move-to-eof move-to-top multiple ' + - 'multiple-key multitasking-interval must-exist name native ' + - 'ne new-row next-column next-sibling next-tab-item ' + - 'next-value no-apply no-assign no-bind-where no-box ' + - 'no-column-scrolling no-convert no-current-value no-debug no-drag ' + - 'no-echo no-focus no-index-hint no-join-by-sqldb no-lookahead ' + - 'no-return-value no-row-markers no-scrolling no-separate-connection no-separators ' + - 'no-underline no-word-wrap num-buttons num-columns num-copies ' + - 'numeric numeric-format num-formats num-items num-iterations ' + - 'num-lines num-locked-columns num-messages num-results num-selected ' + - 'num-selected-rows num-selected-widgets num-tabs num-to-retain octet_length ' + - 'ok ok-cancel on-frame on-frame-border ordinal ' + - 'orientation os-drives os-error ' + - 'os-getenv outer outer-join override owner ' + - 'paged page-size page-width parent partial-key ' + - 'pascal password-field pathname pfc pfcolor pinnable ' + - 'pixels-per-col pixels-per-column pixels-per-row popup-menu popup-only ' + - 'position precision preselect prev prev-column ' + - 'prev-sibling prev-tab-item primary printer-control-handle printer-name ' + - 'printer-port printer-setup private private-data prn procedure ' + - 'progress-source proxy put-double put-float put-long ' + - 'put-short put-string put-unsigned-short query-off-end question ' + - 'radio-buttons radio-set random raw-transfer read-file ' + - 'read-only real recursive refresh refreshable ' + - 'remote remove-events-list replace replace-selection-text replication-create ' + - 'replication-delete replication-write request resizable resize ' + - 'retry-cancel return-inserted returns return-to-start-dir return-value ' + - 'right-aligned right-trim round row ' + - 'row-markers row-of rule rule-row rule-y ' + - 'save-file screen-value scrollable scrollbar-h scrollbar-horizontal ' + - 'scroll-bars scrollbar-v scrollbar-vertical scroll-delta scrolled-row-pos ' + - 'scrolled-row-position scroll-horiz-value scrolling scroll-offset scroll-to-current-row ' + - 'scroll-to-item scroll-to-selected-row scroll-vert-value se-check-pools section ' + - 'se-enable-off se-enable-on selectable selected selected-items ' + - 'select-focused-row selection-end selection-list selection-start selection-text ' + - 'select-next-row select-prev-row select-repositioned-row select-row send ' + - 'sensitive se-num-pools separate-connection separators server ' + - 'set-blue set-blue-value set-break set-cell-focus set-contents ' + - 'set-dynamic set-green set-green-value set-leakpoint set-pointer-value ' + - 'set-property set-red set-red-value set-repositioned-row set-selection ' + - 'set-size set-wait-state se-use-message side-label-handle side-labels ' + - 'silent simple single size size-chars ' + - 'size-pixels slider smallint sort source ' + - 'sql sqrt start status-area status-area-font ' + - 'status-bar stdcall stenciled stopped stored-procedure ' + - 'string sub-average sub-count sub-max sub-maximum ' + - 'sub-menu sub-menu-help sub-min sub-minimum substitute ' + - 'substr substring sub-total subtype sum ' + - 'suppress-warnings system-alert-boxes system-help tab-position target ' + - 'temp-dir temp-directory temp-table terminate text-selected ' + - 'three-d through thru tic-marks time-source ' + - 'title-bgc title-bgcolor title-dc title-dcolor title-fgc ' + - 'title-fgcolor title-font today toggle-box ' + - 'tool-bar tooltip tooltips top topic ' + - 'to-rowid total trailing trunc truncate ' + - 'type unbuffered unique-id unload upper ' + - 'use use-dict-exps use-filename use-text v6display ' + - 'validate validate-condition validate-message valid-event valid-handle ' + - 'var variable vertical virtual-height virtual-height-chars ' + - 'virtual-height-pixels virtual-width virtual-width-chars virtual-width-pixels visible ' + - 'wait warning weekday widget-enter widget-leave ' + - 'widget-pool width width-chars width-pixels window-name ' + - 'window-state window-system word-wrap x ' + - 'x-of y year year-offset yes-no ' + - 'yes-no-cancel y-of'; - - DefaultEvents: string = - 'abort any-key any-printable append-line backspace ' + - 'back-tab block blue bottom-column break-line ' + - 'bs cancel cancel-move cancel-pick cancel-resize ' + - 'choices choose close compile container-event ' + - 'copy cr ctrl-alt-del ctrl-break ctrl-g ' + - 'ctrl-j ctrl-l cursor-down cursor-left cursor-right ' + - 'cursor-up cut data-refresh-line data-refresh-page dde-notify ' + - 'default-action default-pop-up del del-char delete-char ' + - 'delete-character delete-column delete-end-line delete-field delete-line ' + - 'delete-word del-line deselect deselect-extend deselection ' + - 'deselection-extend dismiss-menu dos-end down-arrow editor-backtab ' + - 'editor-tab empty-selection end-box-selection end-error endkey ' + - 'end-move end-resize end-search enter enter-menubar ' + - 'erase esc execute exit ' + - 'ff find-next find-previous focus-in formfeed ' + - 'forward get go goto help-key ' + - 'home horiz-end horiz-home horiz-scroll-drag ins ' + - 'ins-char insert-column insert-field insert-field-data insert-field-label ' + - 'insert-here insert-mode ins-line iteration-changed left ' + - 'left-arrow left-end left-mouse-click left-mouse-dblclick left-mouse-down ' + - 'left-mouse-up lf line-del line-down line-erase ' + - 'linefeed line-ins line-left line-right line-up ' + - 'main-menu menu-drop middle-mouse-click middle-mouse-dblclick middle-mouse-down ' + - 'middle-mouse-up mouse-extend-click mouse-extend-dblclick mouse-extend-down mouse-extend-drag ' + - 'mouse-extend-up mouse-menu-click mouse-menu-dblclick mouse-menu-down mouse-menu-drag ' + - 'mouse-menu-up mouse-move mouse-move-click mouse-move-dblclick mouse-move-down ' + - 'mouse-move-drag mouse-move-up mouse-select-click mouse-select-dblclick mouse-select-down ' + - 'mouse-select-drag mouse-select-up move new-line next-error ' + - 'next-frame next-page next-scrn next-word object ' + - 'off-end off-home open-line-above options out-of-data ' + - 'page-down page-erase page-left page-right page-right-text ' + - 'page-up parent-window-close paste pgdn pgup ' + - 'pick pick-area pick-both popup-menu-key prev-frame ' + - 'prev-page prev-scrn prev-word recall red ' + - 'remove reports reset resume-display ' + - 'right right-arrow right-end right-mouse-click ' + - 'right-mouse-dblclick right-mouse-down right-mouse-up row-display row-entry ' + - 'row-leave save-as scrollbar-drag scroll-left ' + - 'scroll-mode scroll-notify scroll-right select-extend selection ' + - 'selection-extend settings shift-tab start-box-selection start-extend-box-selection ' + - 'start-move start-resize start-search stop stop-display ' + - 'tab top-column u1 u10 u2 ' + - 'u3 u4 u5 u6 u7 ' + - 'u8 u9 unix-end up-arrow value-changed ' + - 'white window-close window-resized window-restored'; - - DefaultDataTypes: string = - 'char character com-handle component-handle date datetime datetime-tz dec ' + - 'decimal double float handle int ' + - 'integer int64 log logical longchar raw rowid ' + - 'widget widget-handle'; - -implementation - -uses - SynEditStrConst; - -function TSynProgressSyn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 27 + Ord(Str^) - Ord('0'); - '_': Result := 37; - '-': Result := 38; - else Result := 0; - end; - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 3 * Result + GetOrd; -{$ELSE} - Result := (3 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - inc(Str); - end; - Result := Result and $3FF; - fStringLen := Str - fToIdent; -end; - -function TSynProgressSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - fToIdent := MayBe; - Entry := fHashList[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > fStringLen then - break - else if Entry.KeywordLen = fStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; -end; - -procedure TSynProgressSyn.DoAddKeyword(AKeyword: string; AKind: Integer); -var - HashValue: Integer; -begin - HashValue := HashKey(PWideChar(AKeyword)); - fHashList[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -constructor TSynProgressSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fHashList := TSynHashEntryList.Create; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clRed; - AddAttribute(fCommentAttri); - - fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - fEventAttri.Foreground := clOlive; - AddAttribute(fEventAttri); - - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - fIdentifierAttri.Foreground := clNavy; - AddAttribute(fIdentifierAttri); - - fIncludeAttri := TSynHighlighterAttributes.Create(SYNS_AttrInclude, SYNS_FriendlyAttrInclude); - fIncludeAttri.Foreground := clPurple; - AddAttribute(fIncludeAttri); - - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Foreground := clMaroon; - AddAttribute(fKeyAttri); - - fNonreservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - fNonReservedKeyAttri.Foreground := clTeal; - AddAttribute(fNonReservedKeyAttri); - - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clMaroon; - AddAttribute(fNumberAttri); - - fPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - fPreprocessorAttri.Foreground := clPurple; - AddAttribute(fPreProcessorAttri); - - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - fDataTypeAttri.Foreground := clSilver; - AddAttribute(fDataTypeAttri); - - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; - AddAttribute(fStringAttri); - - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - - fDefaultFilter := SYNS_FilterProgress; - - EnumerateKeywords(Ord(tkKey), DefaultKeywords, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkNonReserved), DefaultNonReservedKeywords, - IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkEvent), DefaultEvents, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkDataType), DefaultDataTypes, IsIdentChar, - DoAddKeyword); - SetAttributesOnChange(DefHighlightChange); -end; - -destructor TSynProgressSyn.Destroy; -begin - fHashList.Free; - inherited Destroy; -end; - -procedure TSynProgressSyn.IdentProc; -begin - fTokenID := IdentKind(fLine + Run); - inc(Run, fStringLen); -end; - -procedure TSynProgressSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynProgressSyn.NumberProc; -var - p: PWideChar; -begin - fTokenID := tkNumber; - p := PWideChar(@fLine[Run]); - repeat - Inc(p); - until not CharInSet(p^, ['0'..'9']); - Run := p - fLine; -end; - -procedure TSynProgressSyn.PreprocessorDefinitionProc; -var - p: PWideChar; -begin - fTokenID := tkPreprocessor; - p := PWideChar(@fLine[Run]); - while p^ <> #0 do - begin - case p^ of - '~': if (p + 1)^ = #0 then - fRange := rsPreprocessorDef; - end; - inc(p); - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynProgressSyn.StringProc; -var - p: PWideChar; -begin - fTokenID := tkString; - p := PWideChar(@fLine[Run]); - repeat - Inc(p); - until (p^ = #0) or (p^ = '"'); - if (p^ = '"') then Inc(p); - Run := p - fLine; -end; - -procedure TSynProgressSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynProgressSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynProgressSyn.AsciiCharProc; -var - p: PWideChar; -begin - fTokenID := tkString; - p := PWideChar(@fLine[Run]); - repeat - inc(p); - until (p^ = #0) or (p^ = ''''); - if (p^ = '''') then Inc(p); - Run := p - fLine; -end; - -procedure TSynProgressSyn.SlashProc; -var - p: PWideChar; -begin - p := PWideChar(@fLine[Run]); - inc(p); - case p^ of - '*': begin {c style comments} - fTokenID := tkComment; - fRange := rsComment; - fCommentLevel := 1; - inc(p); - while (p^ <> #0) and (fRange = rsComment) do - begin - case p^ of - '*': begin - inc(p); - if p^ = '/' then - begin - inc(p); - dec(fCommentLevel); - if FCommentLevel = 0 then - fRange := rsNone; - end; - end; - '/': begin - inc(p); - if p^ = '*' then - begin - inc(p); - inc(fCommentLevel); // Max 65535 commentlevels. - end; - end; - else - inc(p); - end; - end; - end; - else {division} - fTokenID := tkSymbol; - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.CommentRangeProc; -var - p: PWideChar; -begin - fTokenID := tkComment; - p := PWideChar(@fLine[Run]); - - if p^ = #0 then - begin - NullProc; - exit; - end; - - while (p^ <> #0) and (fRange = rsComment) do - begin - case p^ of - '*': begin - inc(p); - if p^ = '/' then - begin - inc(p); - dec(fCommentLevel); - if fCommentLevel = 0 then - fRange := rsNone; - end; - end; - '/': begin - inc(p); - if p^ = '*' then - begin - inc(p); - inc(fCommentLevel); - end; - end; - else - inc(p); - end; - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.IncludeRangeProc; -var - p: PWideChar; -begin - fTokenID := tkInclude; - p := PWideChar(@fLine[Run]); - - if p^ = #0 then - begin - NullProc; - exit; - end; - - while p^ <> #0 do - begin - case p^ of - '}': begin - dec(fIncludeLevel); - if fIncludeLevel = 0 then - begin - fRange := rsNone; - break; - end - else - inc(p); - end; - else - inc(p); - end; - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.PreprocessorRangeProc; -var - p: PWideChar; -begin - fTokenID := tkPreprocessor; - p := PWideChar(@fLine[Run]); - - if p^ = #0 then - begin - NullProc; - exit; - end; - - while (p^ <> #0) and (fRange = rsPreprocessor) do - begin - case p^ of - '{': inc(fPreprocessorLevel); - '}': begin - dec(fPreprocessorLevel); - if fPreprocessorLevel = 0 then - fRange := rsNone; - end; - end; - inc(p); - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.PreprocessorDefinitionRangeProc; -var - p: PWideChar; -begin - fTokenID := tkPreprocessor; - p := PWideChar(@fLine[Run]); - - if Run = 0 then - fRange := rsNone; - - if p^ = #0 then - begin - NullProc; - exit; - end; - - while p^ <> #0 do - begin - case p^ of - '~': if (p+1)^ = #0 then - fRange := rsPreprocessorDef; - end; - inc(p); - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.BraceOpenProc; -var - p: PWideChar; - - function LevelCount: Integer; - begin - if fTokenID = tkInclude then - Result := fIncludeLevel - else - Result := fPreprocessorLevel; - end; - -begin - p := PWideChar(@fLine[Run]); - - inc(p); - case p^ of - 'A'..'Z', 'a'..'z', '_': fTokenID := tkInclude; - '&' : fTokenID := tkPreprocessor; - else - fTokenID := tkUnknown; - end; - - case fTokenID of - tkInclude : fIncludeLevel := 1; - tkPreprocessor: fPreprocessorLevel := 1; - end; - - while LevelCount > 0 do - begin - case p^ of - #0 : begin - if fTokenID = tkInclude then - fRange := rsInclude - else - fRange := rsPreprocessor; - break; - end; - '}': case fTokenID of - tkInclude : dec(fIncludeLevel); - tkPreprocessor: dec(fPreprocessorLevel); - end; - '{': case fTokenID of - tkInclude : inc(fIncludeLevel); - tkPreprocessor: inc(fPreprocessorLevel); - end; - end; - inc(p); - end; - Run := p - fLine; -end; - -procedure TSynProgressSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsInclude: IncludeRangeProc; - rsPreprocessor: PreprocessorRangeProc; - rsPreprocessorDef: PreprocessorDefinitionRangeProc; - rsComment: CommentRangeProc; - else - case fLine[Run] of - #0: NullProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - 'A'..'Z','a'..'z','_': IdentProc; - '0'..'9': NumberProc; - '''': AsciiCharProc; - '"': StringProc; - '{': BraceOpenProc; - '+','-','*','@',':','=','<','>','.','^','(',')','[',']': SymbolProc; - '&': PreprocessorDefinitionProc; - '/': SlashProc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynProgressSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; -begin - Result := nil; -end; - -function TSynProgressSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynProgressSyn.GetRange: Pointer; -var - rng: TRangeInfo; -begin - rng.Range := Ord(fRange); - rng.Level := 0; - case fRange of - rsComment: rng.Level := fCommentLevel; - rsInclude: rng.Level := fIncludeLevel; - rsPreProcessor: rng.Level := fPreProcessorLevel; - end; - Result := rng.Ptr; -end; - -function TSynProgressSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynProgressSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkEvent: Result := fEventAttri; - tkIdentifier: Result := fIdentifierAttri; - tkInclude: Result := fIncludeAttri; - tkKey: Result := fKeyAttri; - tkNonReserved: Result := fNonReservedKeyAttri; - tkNumber: Result := fNumberAttri; - tkPreprocessor: Result := fPreprocessorAttri; - tkSpace: Result := fSpaceAttri; - tkDataType: Result := fDataTypeAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fSymbolAttri; - else Result := nil; - end; -end; - -function TSynProgressSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynProgressSyn.ResetRange; -begin - fRange := rsNone; - fCommentLevel := 0; - fIncludeLevel := 0; - fPreprocessorLevel := 0; -end; - -procedure TSynProgressSyn.SetRange(Value: Pointer); -var - rng: TRangeInfo; -begin - rng := TRangeInfo(Value); - fRange := TRangeState(rng.Range); - fCommentLevel := 0; - fIncludeLevel := 0; - fPreprocessorLevel := 0; - case fRange of - rsComment: fCommentLevel := rng.Level; - rsInclude: fIncludeLevel := rng.Level; - rsPreProcessor: fPreprocessorLevel := rng.Level; - end; -end; - -function TSynProgressSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterProgress; -end; - -function TSynProgressSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - '-', '_', '0'..'9', 'A'..'Z', 'a'..'z': - Result := True; - else - Result := False; - end; -end; - -class function TSynProgressSyn.GetLanguageName: string; -begin - Result := SYNS_LangProgress; -end; - -function TSynProgressSyn.GetSampleSource: string; -begin - Result := '&scoped-define FirstChar 65'#13#10+ - '&scoped-define LastChar 90'#13#10+ - #13#10+ - 'def var i as int no-undo.'#13#10+ - 'def var s as char no-undo.'#13#10+ - #13#10+ - 'function GetRandomChar returns char (input SomeValue as int):'#13#10+ - ' return chr(random({&FirstChar}, {&LastChar})).'#13#10+ - 'end.'#13#10+ - #13#10+ - 'procedure ClearString:'#13#10+ - ' def input-output param str as char no-undo.'#13#10+ - ' str = "".'#13#10+ - 'end.'#13#10+ - #13#10+ - 'run ClearString(input-output s).'#13#10+ - 'do i = 1 to 100:'#13#10+ - ' s = s + GetRandomChar(17).'#13#10+ - 'end.'#13#10+ - 'display s.'; -end; - -class function TSynProgressSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangProgress; -end; - -initialization - RegisterPlaceableHighlighter(TSynProgressSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterProgress.pas, released 2000-04-20. +The Initial Author of the Original Code is Bruno Mikkelsen. +Portions written by Bruno Mikkelsen are copyright 2000 Bruno Mikkelsen. +Unicode translation by Maël Hörz. +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: SynHighlighterProgress.pas,v 1.16.2.8 2009/09/28 19:16:08 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Progress Syntax highlighter for SynEdit) +@author(Bruno Mikkelsen ) +@created(2000-04-16) +@lastmod(2000-06-20) +The SynHighlighterProgress provides SynEdit with a syntax highlighter for the +Progress programming language. +Thanks to Michael Hieke for providing a sample highlighter on which this +highlighter is based. +} + +unit SynHighlighterProgress; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynHighlighterHashEntries, + SynUnicode, + SysUtils, + Classes; + +type + {Enumerates the different tokens in Progress.} + TtkTokenKind = (tkComment, tkEvent, tkIdentifier, tkInclude, tkKey, + tkNonReserved, tkNull, tkNumber, tkPreprocessor, tkSpace, tkDataType, + tkString, tkSymbol, tkUnknown); + + {Enumerates the ranges in Progress syntax.} + TRangeState = (rsNone, rsInclude, rsPreprocessorDef, rsPreprocessor, + rsComment); + + {Used to hold extra rangeinfo in the Lines.Objects pointer.} + TRangeInfo = packed record + case Boolean of + False: (Ptr: Pointer); + True: (Range: Word; Level: Word); + end; + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynProgressSyn = class(TSynCustomHighLighter) + private + FRange: TRangeState; + FCommentLevel: Integer; + FIncludeLevel: Integer; + FPreProcessorLevel: Integer; + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FEventAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FIncludeAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNonReservedKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FPreprocessorAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FDataTypeAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FHashList: TSynHashEntryList; + procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + function HashKey(Str: PWideChar): Integer; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure AsciiCharProc; + procedure CommentRangeProc; + procedure IncludeRangeProc; + procedure PreprocessorRangeProc; + procedure PreprocessorDefinitionProc; + procedure PreprocessorDefinitionRangeProc; + procedure BraceOpenProc; + procedure IdentProc; + procedure NullProc; + procedure NumberProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; + procedure SymbolProc; + protected + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; +{$IFDEF DEBUG} + public + property Keywords: TSynHashEntryList read FHashList; +{$ENDIF} + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property EventAttri: TSynHighlighterAttributes read FEventAttri + write FEventAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property IncludeAttri: TSynHighlighterAttributes read FIncludeAttri + write FIncludeAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NonReservedKeyAttri: TSynHighlighterAttributes + read FNonReservedKeyAttri write FNonReservedKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property PreprocessorAttri: TSynHighlighterAttributes + read FPreprocessorAttri write FPreprocessorAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property DataTypeAttri: TSynHighlighterAttributes read FDataTypeAttri + write FDataTypeAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + end; + +const + DefaultKeywords: UnicodeString = + 'accum accumulate active-window add alias ' + + 'all alter ambig ambiguous analyze ' + + 'analyze-resume analyze-suspend and any apply ' + + 'as asc ascending assign at ' + + 'attr-space authorization auto-return avail available ' + + 'background before-hide begins bell between ' + + 'bin blank break btos by ' + + 'byte call can-do can-find case ' + + 'case-sensitive center centered check chr ' + + 'clear clipboard col colon color ' + + 'column column-label columns compiler control ' + + 'count-of cpstream create ctos current ' + + 'current-changed current-lang current-language current-window cursor ' + + 'database dataservers dbcodepage dbcollation dbname ' + + 'dbparam dbrestrictions dbtaskid dbtype dbversion ' + + 'dde deblank debug-list debugger decimals ' + + 'declare def default default-noxlate default-window ' + + 'define delete delimiter desc descending ' + + 'dict dictionary disable disconnect disp ' + + 'display distinct do dos down ' + + 'drop each editing else ' + + 'elseif enable encode end endif ' + + 'entry error-status escape etime except ' + + 'exclusive exclusive-lock exists export false ' + + 'fetch field fields file-info file-information ' + + 'fill find find-case-sensitive find-global find-next-occurrence ' + + 'find-prev-occurrence find-select find-wrap-around first first-of ' + + 'focus font font-based-grid for form ' + + 'format frame frame-col frame-db frame-down ' + + 'frame-field frame-file frame-index frame-line frame-name ' + + 'frame-row frame-val frame-value from from-chars ' + + 'from-pixels gateways get-byte get-codepages get-collations ' + + 'get-key-value getbyte glob global ' + + 'global-define go-on go-pending grant graphic-edge ' + + 'group having header help hide ' + + 'if import in index ' + + 'indicator input input-output insert into ' + + 'is is-attr-space join kblabel key-code ' + + 'key-function key-label keycode keyfunction keylabel ' + + 'keys keyword label last last-event ' + + 'last-key last-of lastkey ldbname leave ' + + 'library like line-count line-counter line-number ' + + 'listing locked long lookup machine-class ' + + 'map max-button member memptr message ' + + 'message-lines mouse mpe new next ' + + 'next-prompt no no-attr-space no-error no-fill ' + + 'no-help no-hide no-label no-labels no-lobs no-lock ' + + 'no-map no-message no-pause no-prefetch no-undo ' + + 'no-validate no-wait not null num-aliases ' + + 'num-dbs num-entries of off old ' + + 'on open opsys option ' + + 'or os-append os-command os-copy os-create-dir ' + + 'os-delete os-dir os-rename os2 os400 ' + + 'otherwise output overlay page page-bottom ' + + 'page-num page-number page-top param parameter ' + + 'pause pdbname persistent pixels preprocess ' + + 'privileges proc-handle proc-status process program-name ' + + 'progress prompt prompt-for promsgs propath ' + + 'proversion put put-byte put-key-value putbyte ' + + 'query query-tuning quit r-index rcode-information ' + + 'readkey recid record-length rectangle ' + + 'release repeat reposition retain retry ' + + 'return revert revoke run save ' + + 'schema scop scoped scoped-define screen ' + + 'screen-io screen-lines scroll sdbname search ' + + 'seek select self sequence session ' + + 'set setuserid share share-lock shared ' + + 'short show-stats skip some space ' + + 'status stream stream-io string-xref system-dialog ' + + 'table tab-stop term terminal text text-cursor ' + + 'text-height text-seg-growth then this-procedure ' + + 'time title to top-only trans ' + + 'transaction trigger triggers trim true ' + + 'undefine underline undo unformatted union ' + + 'unique unix unless-hidden unsigned-short up ' + + 'update use-index use-revvideo use-underline user ' + + 'userid using v6frame value values ' + + 'view view-as vms wait-for web-context ' + + 'when where while widget-id window window-maximized ' + + 'window-minimized window-normal with work-table workfile ' + + 'write xcode xref yes _actailog ' + + '_actbilog _actbuffer _actindex _actiofile _actiotype ' + + '_actlock _actother _actpws _actrecord _actserver ' + + '_actspace _actsummary _block _buffstatus _cbit ' + + '_checkpoint _connect _control _db _dbstatus ' + + '_dcm _field _field-trig _file _file-trig ' + + '_filelist _index _index-field _license _list ' + + '_lock _lockreq _logging _memory _msg ' + + '_mstrblk _pcontrol _segments _sequence _serial-num ' + + '_servers _startup _trace _trans _user ' + + '_userio _userlock _view _view-col _view-ref'; + + DefaultNonReservedKeywords: UnicodeString = + 'abs absolute accelerator across add-events-procedure ' + + 'add-first add-interval add-last advise alert-box allow-replication ' + + 'ansi-only anywhere append appl-alert appl-alert-boxes ' + + 'application as-cursor ask-overwrite attachment auto-endkey ' + + 'auto-end-key auto-go auto-indent auto-resize auto-zap ' + + 'available-formats average avg backwards base-key ' + + 'batch batch-mode bgc bgcolor ' + + 'binary bind-where block-iteration-display border-bottom border-bottom-chars ' + + 'border-bottom-pixels border-left border-left-chars border-left-pixels border-right ' + + 'border-right-chars border-right-pixels border-top border-top-chars border-top-pixels ' + + 'both bottom box box-select box-selectable ' + + 'browse browse-header btn-down-arrow btn-left-arrow btn-right-arrow ' + + 'btn-up-arrow buffer buffer-chars buffer-compare buffer-copy ' + + 'buffer-lines button buttons cache cache-size ' + + 'cancel-break cancel-button can-query can-set caps ' + + 'cdecl character_length charset checked clear-select ' + + 'clear-selection code codepage codepage-convert col-of ' + + 'colon-align colon-aligned color-table column-bgcolor column-dcolor ' + + 'column-fgcolor column-font column-label-bgcolor column-label-dcolor column-label-fgcolor ' + + 'column-label-font column-of column-scrolling com1 com2 ' + + 'com3 com4 com5 com6 com7 ' + + 'com8 com9 combo-box command complete ' + + 'com-self con connect connected ' + + 'constrained contains contents context context-popup ' + + 'control-container convert convert-3d-colors convert-to-offset count copy-lob ' + + 'cpcase cpcoll cpinternal cplog cpprint ' + + 'cprcodein cprcodeout cpterm crc-value create-control ' + + 'create-result-list-entry create-test-file current_date current-column ' + + 'current-iteration current-result-row current-row-modified current-value cursor-char ' + + 'cursor-line cursor-offset data-entry-return data-type date-format ' + + 'day db-references dcolor dde-error dde-id ' + + 'dde-item dde-name dde-topic debug default-button ' + + 'default-extension defined delete-current-row delete-selected-row delete-selected-rows ' + + 'deselect-focused-row deselect-rows deselect-selected-row design-mode dialog-box ' + + 'dialog-help dir disabled display-message display-type ' + + 'drag-enabled drop-down drop-down-list dump dynamic dynamic-function ' + + 'echo edge edge-chars edge-pixels edit-can-undo ' + + 'editor edit-undo empty end-key entered ' + + 'eq error error-col error-column error-row ' + + 'events event-type exp expand extended ' + + 'extent external extract fetch-selected-row fgc ' + + 'fgcolor file filename file-create-date file-create-time file-mod-date file-mod-time file-name ' + + 'file-offset file-size file-type filled fill-in filters ' + + 'first-child first-column first-proc first-procedure first-server ' + + 'first-tab-item fixed-only focused-row font-table force-file ' + + 'foreground forwards frame-spacing frame-x frame-y ' + + 'frequency from-current full-height full-height-chars full-height-pixels ' + + 'full-pathname full-width full-width-chars full-width-pixels function ' + + 'ge get-blue get-blue-value get-char-property get-double ' + + 'get-dynamic get-file get-float get-green get-green-value ' + + 'get-iteration get-license get-long get-message get-number ' + + 'get-pointer-value get-red get-red-value get-repositioned-row get-selected ' + + 'get-selected-widget get-short get-signature get-size get-string ' + + 'get-tab-item get-text-height get-text-height-chars get-text-height-pixels get-text-width ' + + 'get-text-width-chars get-text-width-pixels get-unsigned-short grayed grid-factor-h ' + + 'grid-factor-horizontal grid-factor-v grid-factor-vertical grid-set grid-snap ' + + 'grid-unit-height grid-unit-height-chars grid-unit-height-pixels grid-unit-width grid-unit-width-chars ' + + 'grid-unit-width-pixels grid-visible gt height height-chars ' + + 'height-pixels help-context hidden horizontal hwnd ' + + 'image image-down image-insensitive image-size image-size-chars ' + + 'image-size-pixels image-up immediate-display indexed-reposition index-hint ' + + 'info information init initial initial-dir ' + + 'initial-filter initiate inner inner-chars inner-lines input-value ' + + 'insert-backtab insert-file insert-row insert-string insert-tab instantiating-procedure ' + + 'internal-entries is-lead-byte is-row-selected is-selected item ' + + 'items-per-row join-by-sqldb keep-frame-z-order keep-messages keep-tab-order ' + + 'key keyword-all label-bgc label-bgcolor label-dc ' + + 'label-dcolor label-fgc label-fgcolor label-font label-pfc ' + + 'label-pfcolor labels languages large large-to-small ' + + 'last-child last-proc last-procedure last-server last-tab-item ' + + 'lc le leading left-aligned left-trim ' + + 'length line list-events list-items list-item-pairs list-query-attrs ' + + 'list-set-attrs list-widgets load load-control loadcontrols ' + + 'load-icon load-image load-image-down load-image-insensitive load-image-up ' + + 'load-mouse-pointer load-small-icon log-id lookahead lower ' + + 'lpt0 lpt1 lpt2 lpt3 lpt4 ' + + 'lpt5 lpt6 lpt7 lpt8 lpt9 ' + + 'lt manual-highlight margin-extra margin-height margin-height-chars ' + + 'margin-height-pixels margin-width margin-width-chars margin-width-pixels matches ' + + 'max max-chars max-data-guess max-height ' + + 'max-height-chars max-height-pixels maximize maximum max-rows ' + + 'max-size max-value max-width max-width-chars max-width-pixels ' + + 'memory menu menubar menu-bar menu-item ' + + 'menu-key menu-mouse message-area message-area-font message-line ' + + 'min min-height min-height-chars min-height-pixels minimum ' + + 'min-size min-value min-width min-width-chars min-width-pixels ' + + 'mod modified modulo month mouse-pointer ' + + 'movable move-after move-after-tab-item move-before move-before-tab-item ' + + 'move-column move-to-bottom move-to-eof move-to-top multiple ' + + 'multiple-key multitasking-interval must-exist name native ' + + 'ne new-row next-column next-sibling next-tab-item ' + + 'next-value no-apply no-assign no-bind-where no-box ' + + 'no-column-scrolling no-convert no-current-value no-debug no-drag ' + + 'no-echo no-focus no-index-hint no-join-by-sqldb no-lookahead ' + + 'no-return-value no-row-markers no-scrolling no-separate-connection no-separators ' + + 'no-underline no-word-wrap num-buttons num-columns num-copies ' + + 'numeric numeric-format num-formats num-items num-iterations ' + + 'num-lines num-locked-columns num-messages num-results num-selected ' + + 'num-selected-rows num-selected-widgets num-tabs num-to-retain octet_length ' + + 'ok ok-cancel on-frame on-frame-border ordinal ' + + 'orientation os-drives os-error ' + + 'os-getenv outer outer-join override owner ' + + 'paged page-size page-width parent partial-key ' + + 'pascal password-field pathname pfc pfcolor pinnable ' + + 'pixels-per-col pixels-per-column pixels-per-row popup-menu popup-only ' + + 'position precision preselect prev prev-column ' + + 'prev-sibling prev-tab-item primary printer-control-handle printer-name ' + + 'printer-port printer-setup private private-data prn procedure ' + + 'progress-source proxy put-double put-float put-long ' + + 'put-short put-string put-unsigned-short query-off-end question ' + + 'radio-buttons radio-set random raw-transfer read-file ' + + 'read-only real recursive refresh refreshable ' + + 'remote remove-events-list replace replace-selection-text replication-create ' + + 'replication-delete replication-write request resizable resize ' + + 'retry-cancel return-inserted returns return-to-start-dir return-value ' + + 'right-aligned right-trim round row ' + + 'row-markers row-of rule rule-row rule-y ' + + 'save-file screen-value scrollable scrollbar-h scrollbar-horizontal ' + + 'scroll-bars scrollbar-v scrollbar-vertical scroll-delta scrolled-row-pos ' + + 'scrolled-row-position scroll-horiz-value scrolling scroll-offset scroll-to-current-row ' + + 'scroll-to-item scroll-to-selected-row scroll-vert-value se-check-pools section ' + + 'se-enable-off se-enable-on selectable selected selected-items ' + + 'select-focused-row selection-end selection-list selection-start selection-text ' + + 'select-next-row select-prev-row select-repositioned-row select-row send ' + + 'sensitive se-num-pools separate-connection separators server ' + + 'set-blue set-blue-value set-break set-cell-focus set-contents ' + + 'set-dynamic set-green set-green-value set-leakpoint set-pointer-value ' + + 'set-property set-red set-red-value set-repositioned-row set-selection ' + + 'set-size set-wait-state se-use-message side-label-handle side-labels ' + + 'silent simple single size size-chars ' + + 'size-pixels slider smallint sort source ' + + 'sql sqrt start status-area status-area-font ' + + 'status-bar stdcall stenciled stopped stored-procedure ' + + 'string sub-average sub-count sub-max sub-maximum ' + + 'sub-menu sub-menu-help sub-min sub-minimum substitute ' + + 'substr substring sub-total subtype sum ' + + 'suppress-warnings system-alert-boxes system-help tab-position target ' + + 'temp-dir temp-directory temp-table terminate text-selected ' + + 'three-d through thru tic-marks time-source ' + + 'title-bgc title-bgcolor title-dc title-dcolor title-fgc ' + + 'title-fgcolor title-font today toggle-box ' + + 'tool-bar tooltip tooltips top topic ' + + 'to-rowid total trailing trunc truncate ' + + 'type unbuffered unique-id unload upper ' + + 'use use-dict-exps use-filename use-text v6display ' + + 'validate validate-condition validate-message valid-event valid-handle ' + + 'var variable vertical virtual-height virtual-height-chars ' + + 'virtual-height-pixels virtual-width virtual-width-chars virtual-width-pixels visible ' + + 'wait warning weekday widget-enter widget-leave ' + + 'widget-pool width width-chars width-pixels window-name ' + + 'window-state window-system word-wrap x ' + + 'x-of y year year-offset yes-no ' + + 'yes-no-cancel y-of'; + + DefaultEvents: UnicodeString = + 'abort any-key any-printable append-line backspace ' + + 'back-tab block blue bottom-column break-line ' + + 'bs cancel cancel-move cancel-pick cancel-resize ' + + 'choices choose close compile container-event ' + + 'copy cr ctrl-alt-del ctrl-break ctrl-g ' + + 'ctrl-j ctrl-l cursor-down cursor-left cursor-right ' + + 'cursor-up cut data-refresh-line data-refresh-page dde-notify ' + + 'default-action default-pop-up del del-char delete-char ' + + 'delete-character delete-column delete-end-line delete-field delete-line ' + + 'delete-word del-line deselect deselect-extend deselection ' + + 'deselection-extend dismiss-menu dos-end down-arrow editor-backtab ' + + 'editor-tab empty-selection end-box-selection end-error endkey ' + + 'end-move end-resize end-search enter enter-menubar ' + + 'erase esc execute exit ' + + 'ff find-next find-previous focus-in formfeed ' + + 'forward get go goto help-key ' + + 'home horiz-end horiz-home horiz-scroll-drag ins ' + + 'ins-char insert-column insert-field insert-field-data insert-field-label ' + + 'insert-here insert-mode ins-line iteration-changed left ' + + 'left-arrow left-end left-mouse-click left-mouse-dblclick left-mouse-down ' + + 'left-mouse-up lf line-del line-down line-erase ' + + 'linefeed line-ins line-left line-right line-up ' + + 'main-menu menu-drop middle-mouse-click middle-mouse-dblclick middle-mouse-down ' + + 'middle-mouse-up mouse-extend-click mouse-extend-dblclick mouse-extend-down mouse-extend-drag ' + + 'mouse-extend-up mouse-menu-click mouse-menu-dblclick mouse-menu-down mouse-menu-drag ' + + 'mouse-menu-up mouse-move mouse-move-click mouse-move-dblclick mouse-move-down ' + + 'mouse-move-drag mouse-move-up mouse-select-click mouse-select-dblclick mouse-select-down ' + + 'mouse-select-drag mouse-select-up move new-line next-error ' + + 'next-frame next-page next-scrn next-word object ' + + 'off-end off-home open-line-above options out-of-data ' + + 'page-down page-erase page-left page-right page-right-text ' + + 'page-up parent-window-close paste pgdn pgup ' + + 'pick pick-area pick-both popup-menu-key prev-frame ' + + 'prev-page prev-scrn prev-word recall red ' + + 'remove reports reset resume-display ' + + 'right right-arrow right-end right-mouse-click ' + + 'right-mouse-dblclick right-mouse-down right-mouse-up row-display row-entry ' + + 'row-leave save-as scrollbar-drag scroll-left ' + + 'scroll-mode scroll-notify scroll-right select-extend selection ' + + 'selection-extend settings shift-tab start-box-selection start-extend-box-selection ' + + 'start-move start-resize start-search stop stop-display ' + + 'tab top-column u1 u10 u2 ' + + 'u3 u4 u5 u6 u7 ' + + 'u8 u9 unix-end up-arrow value-changed ' + + 'white window-close window-resized window-restored'; + + DefaultDataTypes: UnicodeString = + 'char character com-handle component-handle date datetime datetime-tz dec ' + + 'decimal double float handle int ' + + 'integer int64 log logical longchar raw rowid ' + + 'widget widget-handle'; + +implementation + +uses + SynEditStrConst; + +function TSynProgressSyn.HashKey(Str: PWideChar): Integer; + + function GetOrd: Integer; + begin + case Str^ of + 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); + 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); + '0'..'9': Result := 27 + Ord(Str^) - Ord('0'); + '_': Result := 37; + '-': Result := 38; + else Result := 0; + end; + end; + +begin + Result := 0; + while IsIdentChar(Str^) do + begin +{$IFOPT Q-} + Result := 3 * Result + GetOrd; +{$ELSE} + Result := (3 * Result + GetOrd) and $FFFFFF; +{$ENDIF} + Inc(Str); + end; + Result := Result and $3FF; + FStringLen := Str - FToIdent; +end; + +function TSynProgressSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Entry: TSynHashEntry; +begin + FToIdent := MayBe; + Entry := FHashList[HashKey(MayBe)]; + while Assigned(Entry) do + begin + if Entry.KeywordLen > FStringLen then + Break + else if Entry.KeywordLen = FStringLen then + if IsCurrentToken(Entry.Keyword) then + begin + Result := TtkTokenKind(Entry.Kind); + Exit; + end; + Entry := Entry.Next; + end; + Result := tkIdentifier; +end; + +procedure TSynProgressSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +var + HashValue: Integer; +begin + HashValue := HashKey(PWideChar(AKeyword)); + FHashList[HashValue] := TSynHashEntry.Create(AKeyword, AKind); +end; + +constructor TSynProgressSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FHashList := TSynHashEntryList.Create; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clRed; + AddAttribute(FCommentAttri); + + FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + FEventAttri.Foreground := clOlive; + AddAttribute(FEventAttri); + + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + FIdentifierAttri.Foreground := clNavy; + AddAttribute(FIdentifierAttri); + + FIncludeAttri := TSynHighlighterAttributes.Create(SYNS_AttrInclude, SYNS_FriendlyAttrInclude); + FIncludeAttri.Foreground := clPurple; + AddAttribute(FIncludeAttri); + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Foreground := clMaroon; + AddAttribute(FKeyAttri); + + FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + FNonReservedKeyAttri.Foreground := clTeal; + AddAttribute(FNonReservedKeyAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clMaroon; + AddAttribute(FNumberAttri); + + FPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + FPreprocessorAttri.Foreground := clPurple; + AddAttribute(FPreprocessorAttri); + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + FDataTypeAttri.Foreground := clSilver; + AddAttribute(FDataTypeAttri); + + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Foreground := clBlue; + AddAttribute(FStringAttri); + + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + + FDefaultFilter := SYNS_FilterProgress; + + EnumerateKeywords(Ord(tkKey), DefaultKeywords, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkNonReserved), DefaultNonReservedKeywords, + IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkEvent), DefaultEvents, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkDataType), DefaultDataTypes, IsIdentChar, + DoAddKeyword); + SetAttributesOnChange(DefHighlightChange); +end; + +destructor TSynProgressSyn.Destroy; +begin + FHashList.Free; + inherited Destroy; +end; + +procedure TSynProgressSyn.IdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); +end; + +procedure TSynProgressSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynProgressSyn.NumberProc; +var + p: PWideChar; +begin + FTokenID := tkNumber; + p := PWideChar(@FLine[Run]); + repeat + Inc(p); + until not CharInSet(p^, ['0'..'9']); + Run := p - FLine; +end; + +procedure TSynProgressSyn.PreprocessorDefinitionProc; +var + p: PWideChar; +begin + FTokenID := tkPreprocessor; + p := PWideChar(@FLine[Run]); + while p^ <> #0 do + begin + case p^ of + '~': if (p + 1)^ = #0 then + FRange := rsPreprocessorDef; + end; + Inc(p); + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynProgressSyn.StringProc; +var + p: PWideChar; +begin + FTokenID := tkString; + p := PWideChar(@FLine[Run]); + repeat + Inc(p); + until (p^ = #0) or (p^ = '"'); + if (p^ = '"') then Inc(p); + Run := p - FLine; +end; + +procedure TSynProgressSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynProgressSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynProgressSyn.AsciiCharProc; +var + p: PWideChar; +begin + FTokenID := tkString; + p := PWideChar(@FLine[Run]); + repeat + Inc(p); + until (p^ = #0) or (p^ = ''''); + if (p^ = '''') then Inc(p); + Run := p - FLine; +end; + +procedure TSynProgressSyn.SlashProc; +var + p: PWideChar; +begin + p := PWideChar(@FLine[Run]); + Inc(p); + case p^ of + '*': begin {c style comments} + FTokenID := tkComment; + FRange := rsComment; + FCommentLevel := 1; + Inc(p); + while (p^ <> #0) and (FRange = rsComment) do + begin + case p^ of + '*': begin + Inc(p); + if p^ = '/' then + begin + Inc(p); + Dec(FCommentLevel); + if FCommentLevel = 0 then + FRange := rsNone; + end; + end; + '/': begin + Inc(p); + if p^ = '*' then + begin + Inc(p); + Inc(FCommentLevel); // Max 65535 commentlevels. + end; + end; + else + Inc(p); + end; + end; + end; + else {division} + FTokenID := tkSymbol; + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.CommentRangeProc; +var + p: PWideChar; +begin + FTokenID := tkComment; + p := PWideChar(@FLine[Run]); + + if p^ = #0 then + begin + NullProc; + Exit; + end; + + while (p^ <> #0) and (FRange = rsComment) do + begin + case p^ of + '*': begin + Inc(p); + if p^ = '/' then + begin + Inc(p); + Dec(FCommentLevel); + if FCommentLevel = 0 then + FRange := rsNone; + end; + end; + '/': begin + Inc(p); + if p^ = '*' then + begin + Inc(p); + Inc(FCommentLevel); + end; + end; + else + Inc(p); + end; + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.IncludeRangeProc; +var + p: PWideChar; +begin + FTokenID := tkInclude; + p := PWideChar(@FLine[Run]); + + if p^ = #0 then + begin + NullProc; + Exit; + end; + + while p^ <> #0 do + begin + case p^ of + '}': begin + Dec(FIncludeLevel); + if FIncludeLevel = 0 then + begin + FRange := rsNone; + Break; + end + else + Inc(p); + end; + else + Inc(p); + end; + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.PreprocessorRangeProc; +var + p: PWideChar; +begin + FTokenID := tkPreprocessor; + p := PWideChar(@FLine[Run]); + + if p^ = #0 then + begin + NullProc; + Exit; + end; + + while (p^ <> #0) and (FRange = rsPreprocessor) do + begin + case p^ of + '{': Inc(FPreProcessorLevel); + '}': begin + Dec(FPreProcessorLevel); + if FPreProcessorLevel = 0 then + FRange := rsNone; + end; + end; + Inc(p); + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.PreprocessorDefinitionRangeProc; +var + p: PWideChar; +begin + FTokenID := tkPreprocessor; + p := PWideChar(@FLine[Run]); + + if Run = 0 then + FRange := rsNone; + + if p^ = #0 then + begin + NullProc; + Exit; + end; + + while p^ <> #0 do + begin + case p^ of + '~': if (p+1)^ = #0 then + FRange := rsPreprocessorDef; + end; + Inc(p); + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.BraceOpenProc; +var + p: PWideChar; + + function LevelCount: Integer; + begin + if FTokenID = tkInclude then + Result := FIncludeLevel + else + Result := FPreProcessorLevel; + end; + +begin + p := PWideChar(@FLine[Run]); + + Inc(p); + case p^ of + 'A'..'Z', 'a'..'z', '_': FTokenID := tkInclude; + '&' : FTokenID := tkPreprocessor; + else + FTokenID := tkUnknown; + end; + + case FTokenID of + tkInclude : FIncludeLevel := 1; + tkPreprocessor: FPreProcessorLevel := 1; + end; + + while LevelCount > 0 do + begin + case p^ of + #0 : begin + if FTokenID = tkInclude then + FRange := rsInclude + else + FRange := rsPreprocessor; + Break; + end; + '}': case FTokenID of + tkInclude : Dec(FIncludeLevel); + tkPreprocessor: Dec(FPreProcessorLevel); + end; + '{': case FTokenID of + tkInclude : Inc(FIncludeLevel); + tkPreprocessor: Inc(FPreProcessorLevel); + end; + end; + Inc(p); + end; + Run := p - FLine; +end; + +procedure TSynProgressSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsInclude: IncludeRangeProc; + rsPreprocessor: PreprocessorRangeProc; + rsPreprocessorDef: PreprocessorDefinitionRangeProc; + rsComment: CommentRangeProc; + else + case FLine[Run] of + #0: NullProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'A'..'Z','a'..'z','_': IdentProc; + '0'..'9': NumberProc; + '''': AsciiCharProc; + '"': StringProc; + '{': BraceOpenProc; + '+','-','*','@',':','=','<','>','.','^','(',')','[',']': SymbolProc; + '&': PreprocessorDefinitionProc; + '/': SlashProc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynProgressSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + Result := nil; +end; + +function TSynProgressSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynProgressSyn.GetRange: Pointer; +var + rng: TRangeInfo; +begin + rng.Range := Ord(FRange); + rng.Level := 0; + case FRange of + rsComment: rng.Level := FCommentLevel; + rsInclude: rng.Level := FIncludeLevel; + rsPreProcessor: rng.Level := FPreProcessorLevel; + end; + Result := rng.Ptr; +end; + +function TSynProgressSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynProgressSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkEvent: Result := FEventAttri; + tkIdentifier: Result := FIdentifierAttri; + tkInclude: Result := FIncludeAttri; + tkKey: Result := FKeyAttri; + tkNonReserved: Result := FNonReservedKeyAttri; + tkNumber: Result := FNumberAttri; + tkPreprocessor: Result := FPreprocessorAttri; + tkSpace: Result := FSpaceAttri; + tkDataType: Result := FDataTypeAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FSymbolAttri; + else Result := nil; + end; +end; + +function TSynProgressSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynProgressSyn.ResetRange; +begin + FRange := rsNone; + FCommentLevel := 0; + FIncludeLevel := 0; + FPreProcessorLevel := 0; +end; + +procedure TSynProgressSyn.SetRange(Value: Pointer); +var + rng: TRangeInfo; +begin + rng := TRangeInfo(Value); + FRange := TRangeState(rng.Range); + FCommentLevel := 0; + FIncludeLevel := 0; + FPreProcessorLevel := 0; + case FRange of + rsComment: FCommentLevel := rng.Level; + rsInclude: FIncludeLevel := rng.Level; + rsPreProcessor: FPreProcessorLevel := rng.Level; + end; +end; + +function TSynProgressSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterProgress; +end; + +function TSynProgressSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + '-', '_', '0'..'9', 'A'..'Z', 'a'..'z': + Result := True; + else + Result := False; + end; +end; + +class function TSynProgressSyn.GetLanguageName: string; +begin + Result := SYNS_LangProgress; +end; + +function TSynProgressSyn.GetSampleSource: UnicodeString; +begin + Result := '&scoped-define FirstChar 65'#13#10+ + '&scoped-define LastChar 90'#13#10+ + #13#10+ + 'def var i as int no-undo.'#13#10+ + 'def var s as char no-undo.'#13#10+ + #13#10+ + 'function GetRandomChar returns char (input SomeValue as int):'#13#10+ + ' return chr(random({&FirstChar}, {&LastChar})).'#13#10+ + 'end.'#13#10+ + #13#10+ + 'procedure ClearString:'#13#10+ + ' def input-output param str as char no-undo.'#13#10+ + ' str = "".'#13#10+ + 'end.'#13#10+ + #13#10+ + 'run ClearString(input-output s).'#13#10+ + 'do i = 1 to 100:'#13#10+ + ' s = s + GetRandomChar(17).'#13#10+ + 'end.'#13#10+ + 'display s.'; +end; + +class function TSynProgressSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangProgress; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynProgressSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterPython.pas b/Source/VCL/SynEdit/Source/SynHighlighterPython.pas index 8486707e..e008075f 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterPython.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterPython.pas @@ -1,1316 +1,1334 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterPython.pas, released 2000-06-23. -The Original Code is based on the odPySyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Olivier Deckmyn. -Portions created by M.Utku Karatas and Dennis Chuah. -Unicode translation by Maël Hörz. -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: SynHighlighterPython.pas,v 1.18.2.7 2008/09/14 16:25:02 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(A Python language highlighter for SynEdit) -@author(Olivier Deckmyn, converted to SynEdit by David Muir ) -@created(unknown, converted to SynEdit on 2000-06-23) -@lastmod(2003-02-13) -The SynHighlighterPython implements a highlighter for Python for the SynEdit projects. -} - -unit SynHighlighterPython; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditHighlighter, - SynEditTypes, - SynUnicode, - SysUtils, -//++ CodeFolding - Classes, - SynEditCodeFolding, - RegularExpressions; -//-- CodeFolding - -const - ALPHA_CHARS = ['_', 'a'..'z', 'A'..'Z']; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkNonKeyword, tkTrippleQuotedString, - tkSystemDefined, tkHex, tkOct, tkFloat, tkUnknown); - - TRangeState = (rsANil, rsComment, rsUnKnown, rsMultilineString, rsMultilineString2, - rsMultilineString3 //this is to indicate if a string is made multiline by backslash char at line end (as in C++ highlighter) - ); - -type -//++ CodeFolding - TSynPythonSyn = class(TSynCustomCodeFoldingHighlighter) -//-- CodeFolding - private - fStringStarter: WideChar; // used only for rsMultilineString3 stuff - fRange: TRangeState; - FTokenID: TtkTokenKind; - FKeywords: TStringList; - fStringAttri: TSynHighlighterAttributes; - fDocStringAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fHexAttri: TSynHighlighterAttributes; - fOctalAttri: TSynHighlighterAttributes; - fFloatAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNonKeyAttri: TSynHighlighterAttributes; - fSystemAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fErrorAttri: TSynHighlighterAttributes; -//++ CodeFolding - BlockOpenerRE : TRegEx; -//-- CodeFolding - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure SymbolProc; - procedure CRProc; - procedure CommentProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure SpaceProc; - procedure PreStringProc; - procedure UnicodeStringProc; - procedure StringProc; - procedure String2Proc; - procedure StringEndProc(EndChar: WideChar); - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - function GetKeywordIdentifiers: TStringList; - property Keywords: TStringList read FKeywords; - property TokenID: TtkTokenKind read FTokenID; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; -//++ CodeFolding - procedure InitFoldRanges(FoldRanges : TSynFoldRanges); override; - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -//-- CodeFolding - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NonKeyAttri: TSynHighlighterAttributes read fNonKeyAttri - write fNonKeyAttri; - property SystemAttri: TSynHighlighterAttributes read fSystemAttri - write fSystemAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property HexAttri: TSynHighlighterAttributes read fHexAttri - write fHexAttri; - property OctalAttri: TSynHighlighterAttributes read fOctalAttri - write fOctalAttri; - property FloatAttri: TSynHighlighterAttributes read fFloatAttri - write fFloatAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property DocStringAttri: TSynHighlighterAttributes read fDocStringAttri - write fDocStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property ErrorAttri: TSynHighlighterAttributes read fErrorAttri - write fErrorAttri; - end; - -implementation - -uses - SynEditStrConst; - -var - GlobalKeywords: TStringList; - -function TSynPythonSyn.GetKeywordIdentifiers: TStringList; -const - // No need to localise keywords! - - // List of keywords - KEYWORDCOUNT = 29; - KEYWORDS: array [1..KEYWORDCOUNT] of string = - ( - 'and', - 'assert', - 'break', - 'class', - 'continue', - 'def', - 'del', - 'elif', - 'else', - 'except', - 'exec', - 'finally', - 'for', - 'from', - 'global', - 'if', - 'import', - 'in', - 'is', - 'lambda', - 'not', - 'or', - 'pass', - 'print', - 'raise', - 'return', - 'try', - 'while', - 'yield' - ); - - // List of non-keyword identifiers - NONKEYWORDCOUNT = 66; - NONKEYWORDS: array [1..NONKEYWORDCOUNT] of string = - ( - '__future__', - '__import__', - 'abs', - 'apply', - 'as', - 'buffer', - 'callable', - 'chr', - 'cmp', - 'coerce', - 'compile', - 'complex', - 'delattr', - 'dict', - 'dir', - 'divmod', - 'eval', - 'execfile', - 'False', - 'file', - 'filter', - 'float', - 'getattr', - 'globals', - 'hasattr', - 'hash', - 'help', - 'hex', - 'id', - 'input', - 'int', - 'intern', - 'isinstance', - 'issubclass', - 'iter', - 'len', - 'list', - 'locals', - 'long', - 'None', - 'NotImplemented', - 'map', - 'max', - 'min', - 'oct', - 'open', - 'ord', - 'pow', - 'range', - 'raw_input', - 'reduce', - 'reload', - 'repr', - 'round', - 'self', - 'setattr', - 'slice', - 'str', - 'True', - 'tuple', - 'type', - 'unichr', - 'unicode', - 'vars', - 'xrange', - 'zip' - ); -var - f: Integer; -begin - if not Assigned (GlobalKeywords) then - begin - // Create the string list of keywords - only once - GlobalKeywords := TStringList.Create; - - for f := 1 to KEYWORDCOUNT do - GlobalKeywords.AddObject(KEYWORDS[f], Pointer(Ord(tkKey))); - for f := 1 to NONKEYWORDCOUNT do - GlobalKeywords.AddObject(NONKEYWORDS[f], Pointer(Ord(tkNonKeyword))); - end; // if - Result := GlobalKeywords; -end; - -function TSynPythonSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - i: Integer; - temp: PWideChar; - s: string; -begin - // Extract the identifier out - it is assumed to terminate in a - // non-alphanumeric character - fToIdent := MayBe; - temp := MayBe; - while IsIdentChar(temp^) do - Inc(temp); - fStringLen := temp - fToIdent; - - // Check to see if it is a keyword - SetString(s, fToIdent, fStringLen); - if FKeywords.Find(s, i) then - begin - // TStringList is not case sensitive! - if s <> FKeywords[i] then - i := -1; - end - else - i := -1; - - if i <> -1 then - Result := TtkTokenKind(FKeywords.Objects[i]) - - // Check if it is a system identifier (__*__) - else if (fStringLen >= 5) and - (MayBe[0] = '_') and (MayBe[1] = '_') and (MayBe[2] <> '_') and - (MayBe[fStringLen - 1] = '_') and (MayBe[fStringLen - 2] = '_') and - (MayBe[fStringLen - 3] <> '_') then - Result := tkSystemDefined - - // Else, hey, it is an ordinary run-of-the-mill identifier! - else - Result := tkIdentifier; -end; - -constructor TSynPythonSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - FKeywords := TStringList.Create; - FKeywords.Sorted := True; - FKeywords.Duplicates := dupError; - FKeywords.Assign (GetKeywordIdentifiers); - -//++ CodeFolding - BlockOpenerRE.Create( - '^(def|class|while|for|if|else|elif|try|except|with'+ - '|(async[ \t]+def)|(async[ \t]+with)|(async[ \t]+for))\b'); -//-- CodeFolding - - fRange := rsUnknown; - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clGray; - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNonKeyAttri := TSynHighlighterAttributes.Create (SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - fNonKeyAttri.Foreground := clNavy; - fNonKeyAttri.Style := [fsBold]; - AddAttribute (fNonKeyAttri); - fSystemAttri := TSynHighlighterAttributes.Create (SYNS_AttrSystem, SYNS_FriendlyAttrSystem); - fSystemAttri.Style := [fsBold]; - AddAttribute (fSystemAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clBlue; - AddAttribute(fNumberAttri); - fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); - fHexAttri.Foreground := clBlue; - AddAttribute(fHexAttri); - fOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal); - fOctalAttri.Foreground := clBlue; - AddAttribute(fOctalAttri); - fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); - fFloatAttri.Foreground := clBlue; - AddAttribute(fFloatAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; - AddAttribute(fStringAttri); - fDocStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); - fDocStringAttri.Foreground := clTeal; - AddAttribute(fDocStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - fErrorAttri.Foreground := clRed; - AddAttribute(fErrorAttri); - SetAttributesOnChange(DefHighlightChange); - fDefaultFilter := SYNS_FilterPython; -end; { Create } - -destructor TSynPythonSyn.Destroy; -begin - FKeywords.Free; - inherited; -end; - -procedure TSynPythonSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynPythonSyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else - inc(Run); - end; -end; - -procedure TSynPythonSyn.CommentProc; -begin - fTokenID := tkComment; - inc(Run); - while not IsLineEnd(Run) do - inc(Run); -end; - -procedure TSynPythonSyn.GreaterProc; -begin - case FLine[Run + 1] of - '=': begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - else begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPythonSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); -end; - -procedure TSynPythonSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynPythonSyn.LowerProc; -begin - case FLine[Run + 1] of - '=': begin - inc(Run, 2); - fTokenID := tkSymbol; - end; - '>': begin - inc(Run, 2); - fTokenID := tkSymbol; - end - else begin - inc(Run); - fTokenID := tkSymbol; - end; - end; -end; - -procedure TSynPythonSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynPythonSyn.NumberProc; -type - TNumberState = - ( - nsStart, - nsDotFound, - nsFloatNeeded, - nsHex, - nsOct, - nsExpFound - ); - -var - temp: WideChar; - State: TNumberState; - - function CheckSpecialCases: Boolean; - begin - case temp of - // Look for dot (.) - '.': begin - // .45 - if CharInSet(FLine[Run], ['0'..'9']) then - begin - Inc (Run); - fTokenID := tkFloat; - State := nsDotFound; - - // Non-number dot - end else begin - // Ellipsis - if (FLine[Run] = '.') and (FLine[Run+1] = '.') then - Inc (Run, 2); - fTokenID := tkSymbol; - Result := False; - Exit; - end; // if - end; // DOT - - // Look for zero (0) - '0': begin - temp := FLine[Run]; - // 0x123ABC - if CharInSet(temp, ['x', 'X']) then begin - Inc (Run); - fTokenID := tkHex; - State := nsHex; - // 0.45 - end else if temp = '.' then begin - Inc (Run); - State := nsDotFound; - fTokenID := tkFloat; - end else if CharInSet(temp, ['0'..'9']) then begin - Inc (Run); - // 0123 or 0123.45 - if CharInSet(temp, ['0'..'7']) then begin - fTokenID := tkOct; - State := nsOct; - // 0899.45 - end else begin - fTokenID := tkFloat; - State := nsFloatNeeded; - end; // if - end; // if - end; // ZERO - end; // case - - Result := True; - end; // CheckSpecialCases - - function HandleBadNumber: Boolean; - begin - Result := False; - fTokenID := tkUnknown; - // Ignore all tokens till end of "number" - while IsIdentChar(FLine[Run]) or (FLine[Run] = '.') do - Inc (Run); - end; // HandleBadNumber - - function HandleExponent: Boolean; - begin - State := nsExpFound; - fTokenID := tkFloat; - // Skip e[+/-] - if CharInSet(FLine[Run+1], ['+', '-']) then - Inc (Run); - // Invalid token : 1.0e - if not CharInSet(FLine[Run+1], ['0'..'9']) then begin - Inc (Run); - Result := HandleBadNumber; - Exit; - end; // if - - Result := True; - end; // HandleExponent - - function HandleDot: Boolean; - begin - // Check for ellipsis - Result := (FLine[Run+1] <> '.') or (FLine[Run+2] <> '.'); - if Result then begin - State := nsDotFound; - fTokenID := tkFloat; - end; // if - end; // HandleDot - - function CheckStart: Boolean; - begin - // 1234 - if CharInSet(temp, ['0'..'9']) then begin - Result := True; - //123e4 - end else if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 123.45j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - fTokenID := tkFloat; - Result := False; - // 123.45 - end else if temp = '.' then begin - Result := HandleDot; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckStart - - function CheckDotFound: Boolean; - begin - // 1.0e4 - if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 123.45 - end else if CharInSet(temp, ['0'..'9']) then begin - Result := True; - // 123.45j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - Result := False; - // 123.45.45: Error! - end else if temp = '.' then begin - Result := False; - if HandleDot then - HandleBadNumber; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckDotFound - - function CheckFloatNeeded: Boolean; - begin - // 091.0e4 - if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 0912345 - end else if CharInSet(temp, ['0'..'9']) then begin - Result := True; - // 09123.45 - end else if temp = '.' then begin - Result := HandleDot or HandleBadNumber; // Bad octal - // 09123.45j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - Result := False; - // End of number (error: Bad oct number) 0912345 - end else begin - Result := HandleBadNumber; - end; - end; // CheckFloatNeeded - - function CheckHex: Boolean; - begin - // 0x123ABC - if CharInSet(temp, ['a'..'f', 'A'..'F', '0'..'9']) then - begin - Result := True; - // 0x123ABCL - end else if CharInSet(temp, ['l', 'L']) then begin - Inc (Run); - Result := False; - // 0x123.45: Error! - end else if temp = '.' then begin - Result := False; - if HandleDot then - HandleBadNumber; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckHex - - function CheckOct: Boolean; - begin - // 012345 - if CharInSet(temp, ['0'..'9']) then begin - if not CharInSet(temp, ['0'..'7']) then begin - State := nsFloatNeeded; - fTokenID := tkFloat; - end; // if - Result := True; - // 012345L - end else if CharInSet(temp, ['l', 'L']) then begin - Inc (Run); - Result := False; - // 0123e4 - end else if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 0123j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - fTokenID := tkFloat; - Result := False; - // 0123.45 - end else if temp = '.' then begin - Result := HandleDot; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckOct - - function CheckExpFound: Boolean; - begin - // 1e+123 - if CharInSet(temp, ['0'..'9']) then begin - Result := True; - // 1e+123j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - Result := False; - // 1e4.5: Error! - end else if temp = '.' then begin - Result := False; - if HandleDot then - HandleBadNumber; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckExpFound - -begin - State := nsStart; - fTokenID := tkNumber; - - temp := FLine[Run]; - Inc (Run); - - // Special cases - if not CheckSpecialCases then - Exit; - - // Use a state machine to parse numbers - while True do begin - temp := FLine[Run]; - - case State of - nsStart: - if not CheckStart then Exit; - nsDotFound: - if not CheckDotFound then Exit; - nsFloatNeeded: - if not CheckFloatNeeded then Exit; - nsHex: - if not CheckHex then Exit; - nsOct: - if not CheckOct then Exit; - nsExpFound: - if not CheckExpFound then Exit; - end; // case - - Inc (Run); - end; // while -end; - -procedure TSynPythonSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynPythonSyn.String2Proc; -var - fBackslashCount: Integer; -begin - fTokenID := tkString; - if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then - begin - fTokenID := tkTrippleQuotedString; - inc(Run, 3); - - fRange := rsMultilineString2; - while fLine[Run] <> #0 do - begin - case fLine[Run] of - - '\':begin - { If we're looking at a backslash, and the following character is an - end quote, and it's preceeded by an odd number of backslashes, then - it shouldn't mark the end of the string. If it's preceeded by an - even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} - if FLine[Run + 1] = '"' then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run) - end; - inc(Run); - end;// '\': - - '"': - if (fLine[Run + 1] = '"') and (fLine[Run + 2] = '"') then begin - fRange := rsUnKnown; - inc(Run, 3); - exit; - end else - inc(Run); - #10: exit; - #13: exit; - else - inc(Run); - end; - end; - end - else //if short string - repeat - case FLine[Run] of - #0, #10, #13: - begin - if FLine[Run-1] = '\' then - begin - fStringStarter := '"'; - fRange := rsMultilineString3; - end; - Break; - end; - {The same backslash stuff above...} - '\':begin - if FLine[Run + 1] = '"' then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run) - end; - inc(Run); - end;// '\': - - else inc(Run); - end; //case - until (FLine[Run] = '"'); - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynPythonSyn.PreStringProc; -var - temp: WideChar; -begin - // Handle python raw strings - // r"" - temp := FLine[Run + 1]; - if temp = '''' then - begin - Inc (Run); - StringProc; - end - else if temp = '"' then - begin - Inc (Run); - String2Proc; - end - else - begin - // If not followed by quote char, must be ident - IdentProc; - end; // if -end; - -procedure TSynPythonSyn.UnicodeStringProc; -begin - // Handle python raw and unicode strings - // Valid syntax: u"", or ur"" - if CharInSet(FLine[Run + 1], ['r', 'R']) and - CharInSet(FLine[Run + 2], ['''', '"']) then - begin - // for ur, Remove the "u" and... - Inc (Run); - end; - // delegate to raw strings - PreStringProc; -end; - -procedure TSynPythonSyn.StringProc; -var - fBackslashCount: Integer; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin - fTokenID := tkTrippleQuotedString; - inc(Run, 3); - - fRange:=rsMultilineString; - while fLine[Run] <> #0 do begin - case fLine[Run] of - - '\': begin - { If we're looking at a backslash, and the following character is an - end quote, and it's preceeded by an odd number of backslashes, then - it shouldn't mark the end of the string. If it's preceeded by an - even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} - if FLine[Run + 1] = #39 then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run) - end; - inc(Run); - end;// '\': - - #39: - if (fLine[Run + 1] = #39) and (fLine[Run + 2] = #39) then begin - fRange := rsUnKnown; - inc(Run, 3); - EXIT; - end else - inc(Run); - #10: EXIT; - #13: EXIT; - else - inc(Run); - end; - end; - end - else //if short string - repeat - case FLine[Run] of - #0, #10, #13 : begin - if FLine[Run-1] = '\' then begin - fStringStarter := #39; - fRange := rsMultilineString3; - end; - BREAK; - end; - - {The same backslash stuff above...} - '\':begin - if FLine[Run + 1] = #39 then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run) - end; - inc(Run); - end;// '\': - - else inc(Run); - end; //case - until (FLine[Run] = #39); - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynPythonSyn.StringEndProc(EndChar: WideChar); -var - fBackslashCount: Integer; -begin - if fRange = rsMultilineString3 then - fTokenID := tkString - else - fTokenID := tkTrippleQuotedString; - - case FLine[Run] of - #0: - begin - NullProc; - EXIT; - end; - #10: - begin - LFProc; - EXIT; - end; - #13: - begin - CRProc; - EXIT; - end; - end; - - if fRange = rsMultilineString3 then begin - repeat - if FLine[Run]=fStringStarter then begin - inc(Run); - fRange:=rsUnknown; - EXIT; - end else if FLine[Run]='\' then ; {The same backslash stuff above...} - begin - if FLine[Run + 1] = fStringStarter then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run); - end; - end;// if FLine[Run]... - - inc(Run); - until IsLineEnd(Run); - if FLine[Run-1]<>'\' then begin - fRange:=rsUnknown; - EXIT; - end; - end else - repeat - if FLine[Run] = '\' then - begin - if FLine[Run + 1] = EndChar then - begin - fBackslashCount := 1; - - while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do - fBackslashCount := fBackslashCount + 1; - - if (fBackslashCount mod 2 = 1) then inc(Run, 2); - end; - end;// if FLine[Run]... - if (FLine[Run]=EndChar) and (FLine[Run+1]=EndChar) and (FLine[Run+2]=EndChar) then begin - inc(Run,3); - fRange:=rsUnknown; - EXIT; - end; - inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynPythonSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynPythonSyn.Next; -begin - fTokenPos := Run; - - case fRange of - rsMultilineString: - StringEndProc(#39); - rsMultilineString2: - StringEndProc('"'); - rsMultilineString3: - StringEndProc(fStringStarter); - else - case fLine[Run] of - '&', '}', '{', ':', ',', ']', '[', '*', '`', - '^', ')', '(', ';', '/', '=', '-', '+', '!', '\', - '%', '|', '~' : - SymbolProc; - #13: CRProc; - '#': CommentProc; - '>': GreaterProc; - 'A'..'Q', 'S', 'T', 'V'..'Z', 'a'..'q', 's', 't', 'v'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - #0: NullProc; - '.', '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - 'r', 'R': PreStringProc; - 'u', 'U': UnicodeStringProc; - '''': StringProc; - '"': String2Proc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynPythonSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - SYN_ATTR_KEYWORD: Result := fKeyAttri; - SYN_ATTR_WHITESPACE: Result := fSpaceAttri; - SYN_ATTR_SYMBOL: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynPythonSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynPythonSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynPythonSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynPythonSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNonKeyword: Result := fNonKeyAttri; - tkSystemDefined: Result := fSystemAttri; - tkNumber: Result := fNumberAttri; - tkHex: Result := fHexAttri; - tkOct: Result := fOctalAttri; - tkFloat: Result := fFloatAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkTrippleQuotedString: Result := fDocStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fErrorAttri; - else - Result := nil; - end; -end; - -function TSynPythonSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynPythonSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -//++ CodeFolding -procedure TSynPythonSyn.InitFoldRanges(FoldRanges: TSynFoldRanges); -begin - inherited; - FoldRanges.CodeFoldingMode := cfmIndentation; -end; - -procedure TSynPythonSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - CurLine: string; - LeftTrimmedLine : string; - Line: Integer; - Indent : Integer; - TabW : integer; - FoldType : integer; -const - MultiLineStringFoldType = 2; - ClassDefType = 3; - FunctionDefType = 4; - - - function IsMultiLineString(Line : integer; Range : TRangeState; Fold : Boolean): Boolean; - begin - Result := True; - if TRangeState(GetLineRange(LinesToScan, Line)) = Range then - begin - if (TRangeState(GetLineRange(LinesToScan, Line - 1)) <> Range) and Fold then - FoldRanges.StartFoldRange(Line + 1, MultiLineStringFoldType) - else - FoldRanges.NoFoldInfo(Line + 1); - end - else if (TRangeState(GetLineRange(LinesToScan, Line - 1)) = Range) and Fold then - begin - FoldRanges.StopFoldRange(Line + 1, MultiLineStringFoldType); - end else - Result := False; - end; - - function FoldRegion(Line: Integer): Boolean; - begin - Result := False; - if Uppercase(Copy(LeftTrimmedLine, 1, 7)) = '#REGION' then - begin - FoldRanges.StartFoldRange(Line + 1, FoldRegionType); - Result := True; - end - else if Uppercase(Copy(LeftTrimmedLine, 1, 10)) = '#ENDREGION' then - begin - FoldRanges.StopFoldRange(Line + 1, FoldRegionType); - Result := True; - end; - end; - - function LeftSpaces: Integer; - var - p: PWideChar; - begin - p := PWideChar(CurLine); - if Assigned(p) then - begin - Result := 0; - while (p^ >= #1) and (p^ <= #32) do - begin - if (p^ = #9) then - Inc(Result, TabW) - else - Inc(Result); - Inc(p); - end; - end - else - Result := 0; - end; - -begin - // Deal with multiline strings - for Line := FromLine to ToLine do begin - if IsMultiLineString(Line, rsMultilineString, True) or - IsMultiLineString(Line, rsMultilineString2, True) or - IsMultiLineString(Line, rsMultilineString3, False) - then - Continue; - - // Find Fold regions - CurLine := LinesToScan[Line]; - LeftTrimmedLine := TrimLeft(CurLine); - - // Skip empty lines - if LeftTrimmedLine = '' then begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // Find Fold regions - if FoldRegion(Line) then - Continue; - - TabW := TabWidth(LinesToScan); - Indent := LeftSpaces; - - // find fold openers - with BlockOpenerRE.Match(LeftTrimmedLine) do - if Success then - begin - if Groups[1].Value = 'class' then - FoldType := ClassDefType - else if Pos('def', Groups[1].Value) >= 1 then - FoldType := FunctionDefType - else - FoldType := 1; - - FoldRanges.StartFoldRange(Line + 1, FoldType, Indent); - Continue; - end; - - FoldRanges.StopFoldRange(Line + 1, 1, Indent) - end; -end; -//-- CodeFolding - -procedure TSynPythonSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynPythonSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterPython; -end; - -class function TSynPythonSyn.GetLanguageName: string; -begin - Result := SYNS_LangPython; -end; - -function TSynPythonSyn.GetSampleSource: string; -begin - Result := - '#!/usr/local/bin/python'#13#10 + - 'import string, sys'#13#10 + - '""" If no arguments were given, print a helpful message """'#13#10 + - 'if len(sys.argv)==1:'#13#10 + - ' print ''Usage: celsius temp1 temp2 ...'''#13#10 + - ' sys.exit(0)'; -end; - -class function TSynPythonSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangPython; -end; - -initialization - RegisterPlaceableHighlighter(TSynPythonSyn); -finalization - GlobalKeywords.Free; -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterPython.pas, released 2000-06-23. +The Original Code is based on the odPySyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Olivier Deckmyn. +Portions created by M.Utku Karatas and Dennis Chuah. +Unicode translation by Maël Hörz. +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: SynHighlighterPython.pas,v 1.18.2.7 2008/09/14 16:25:02 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(A Python language highlighter for SynEdit) +@author(Olivier Deckmyn, converted to SynEdit by David Muir ) +@created(unknown, converted to SynEdit on 2000-06-23) +@lastmod(2003-02-13) +The SynHighlighterPython implements a highlighter for Python for the SynEdit projects. +} + +unit SynHighlighterPython; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditHighlighter, + SynEditTypes, + SynUnicode, +{$IFDEF SYN_CodeFolding} + SynEditCodeFolding, + SynRegExpr, +{$ENDIF} + SysUtils, + Classes; + +const + ALPHA_CHARS = ['_', 'a'..'z', 'A'..'Z']; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, + tkString, tkSymbol, tkNonKeyword, tkTrippleQuotedString, + tkSystemDefined, tkHex, tkOct, tkFloat, tkUnknown); + + TRangeState = (rsANil, rsComment, rsUnknown, rsMultilineString, rsMultilineString2, + rsMultilineString3 //this is to indicate if a string is made multiline by backslash char at line end (as in C++ highlighter) + ); + +type +{$IFDEF SYN_CodeFolding} + TSynPythonSyn = class(TSynCustomCodeFoldingHighlighter) +{$ELSE} + TSynPythonSyn = class(TSynCustomHighLighter) +{$ENDIF} + private + FStringStarter: WideChar; // used only for rsMultilineString3 stuff + FRange: TRangeState; + FTokenID: TtkTokenKind; + FKeywords: TUnicodeStringList; + FStringAttri: TSynHighlighterAttributes; + FDocStringAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FHexAttri: TSynHighlighterAttributes; + FOctalAttri: TSynHighlighterAttributes; + FFloatAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNonKeyAttri: TSynHighlighterAttributes; + FSystemAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FErrorAttri: TSynHighlighterAttributes; +{$IFDEF SYN_CodeFolding} + BlockOpenerRE : TRegExpr; +{$ENDIF} + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure SymbolProc; + procedure CRProc; + procedure CommentProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure SpaceProc; + procedure PreStringProc; + procedure UnicodeStringProc; + procedure StringProc; + procedure String2Proc; + procedure StringEndProc(EndChar: WideChar); + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + function GetKeywordIdentifiers: TUnicodeStringList; + property Keywords: TUnicodeStringList read FKeywords; + property TokenID: TtkTokenKind read FTokenID; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; +{$IFDEF SYN_CodeFolding} + procedure InitFoldRanges(FoldRanges : TSynFoldRanges); override; + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +{$ENDIF} + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NonKeyAttri: TSynHighlighterAttributes read FNonKeyAttri + write FNonKeyAttri; + property SystemAttri: TSynHighlighterAttributes read FSystemAttri + write FSystemAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property HexAttri: TSynHighlighterAttributes read FHexAttri + write FHexAttri; + property OctalAttri: TSynHighlighterAttributes read FOctalAttri + write FOctalAttri; + property FloatAttri: TSynHighlighterAttributes read FFloatAttri + write FFloatAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property DocStringAttri: TSynHighlighterAttributes read FDocStringAttri + write FDocStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property ErrorAttri: TSynHighlighterAttributes read FErrorAttri + write FErrorAttri; + end; + +implementation + +uses + SynEditStrConst; + +var + GlobalKeywords: TUnicodeStringList; + +function TSynPythonSyn.GetKeywordIdentifiers: TUnicodeStringList; +const + // No need to localise keywords! + + // List of keywords + KEYWORDCOUNT = 32; + KEYWORDS: array [1..KEYWORDCOUNT] of UnicodeString = + ( + 'and', + 'as', + 'assert', + 'break', + 'class', + 'continue', + 'def', + 'del', + 'elif', + 'else', + 'except', + 'exec', + 'finally', + 'for', + 'from', + 'global', + 'if', + 'import', + 'in', + 'is', + 'lambda', + 'nonlocal', + 'not', + 'or', + 'pass', + 'print', + 'raise', + 'return', + 'try', + 'while', + 'with', + 'yield' + ); + + // List of non-keyword identifiers + NONKEYWORDCOUNT = 65; + NONKEYWORDS: array [1..NONKEYWORDCOUNT] of UnicodeString = + ( + '__future__', + '__import__', + 'abs', + 'apply', + 'buffer', + 'callable', + 'chr', + 'cmp', + 'coerce', + 'compile', + 'complex', + 'delattr', + 'dict', + 'dir', + 'divmod', + 'eval', + 'execfile', + 'False', + 'file', + 'filter', + 'float', + 'getattr', + 'globals', + 'hasattr', + 'hash', + 'help', + 'hex', + 'id', + 'input', + 'int', + 'intern', + 'isinstance', + 'issubclass', + 'iter', + 'len', + 'list', + 'locals', + 'long', + 'None', + 'NotImplemented', + 'map', + 'max', + 'min', + 'oct', + 'open', + 'ord', + 'pow', + 'range', + 'raw_input', + 'reduce', + 'reload', + 'repr', + 'round', + 'self', + 'setattr', + 'slice', + 'str', + 'True', + 'tuple', + 'type', + 'unichr', + 'unicode', + 'vars', + 'xrange', + 'zip' + ); +var + f: Integer; +begin + if not Assigned (GlobalKeywords) then + begin + // Create the string list of keywords - only once + GlobalKeywords := TUnicodeStringList.Create; + + for f := 1 to KEYWORDCOUNT do + GlobalKeywords.AddObject(KEYWORDS[f], Pointer(Ord(tkKey))); + for f := 1 to NONKEYWORDCOUNT do + GlobalKeywords.AddObject(NONKEYWORDS[f], Pointer(Ord(tkNonKeyword))); + end; // if + Result := GlobalKeywords; +end; + +function TSynPythonSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + i: Integer; + temp: PWideChar; + s: UnicodeString; +begin + // Extract the identifier out - it is assumed to terminate in a + // non-alphanumeric character + FToIdent := MayBe; + temp := MayBe; + while IsIdentChar(temp^) do + Inc(temp); + FStringLen := temp - FToIdent; + + // Check to see if it is a keyword + SetString(s, FToIdent, FStringLen); + if FKeywords.Find(s, i) then + begin + // TUnicodeStringList is not case sensitive! + if s <> FKeywords[i] then + i := -1; + end + else + i := -1; + + if i <> -1 then + Result := TtkTokenKind(FKeywords.Objects[i]) + + // Check if it is a system identifier (__*__) + else if (FStringLen >= 5) and + (MayBe[0] = '_') and (MayBe[1] = '_') and (MayBe[2] <> '_') and + (MayBe[FStringLen - 1] = '_') and (MayBe[FStringLen - 2] = '_') and + (MayBe[FStringLen - 3] <> '_') then + Result := tkSystemDefined + + // Check for names of class and functions - not optimal + else if ( (WideCompareStr(Trim(Copy(FLine, 0, Length(FLine) - Length(FToIdent))), 'def')=0) or (WideCompareStr(Trim(Copy(FLine, 0, Length(FLine) - Length(FToIdent))), 'class')=0) ) then + Result := tkSystemDefined + + // Else, hey, it is an ordinary run-of-the-mill identifier! + else + Result := tkIdentifier; +end; + +constructor TSynPythonSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FKeywords := TUnicodeStringList.Create; + FKeywords.Sorted := True; + FKeywords.Duplicates := dupError; + FKeywords.Assign (GetKeywordIdentifiers); + if not FKeywords.Sorted then + FKeywords.Sort; + +{$IFDEF SYN_CodeFolding} + BlockOpenerRE := TRegExpr.Create; + BlockOpenerRE.Expression := // ':\s*(#.*)?$'; + '^(def|class|while|for|if|else|elif|try|except|with'+ + '|(async[ \t]+def)|(async[ \t]+with)|(async[ \t]+for))\b'; +{$ENDIF} + + FRange := rsUnknown; + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clGray; + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNonKeyAttri := TSynHighlighterAttributes.Create (SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + FNonKeyAttri.Foreground := clNavy; + FNonKeyAttri.Style := [fsBold]; + AddAttribute (FNonKeyAttri); + FSystemAttri := TSynHighlighterAttributes.Create (SYNS_AttrSystem, SYNS_FriendlyAttrSystem); + FSystemAttri.Style := [fsBold]; + AddAttribute (FSystemAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clBlue; + AddAttribute(FNumberAttri); + FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); + FHexAttri.Foreground := clBlue; + AddAttribute(FHexAttri); + FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal); + FOctalAttri.Foreground := clBlue; + AddAttribute(FOctalAttri); + FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); + FFloatAttri.Foreground := clBlue; + AddAttribute(FFloatAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Foreground := clBlue; + AddAttribute(FStringAttri); + FDocStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); + FDocStringAttri.Foreground := clTeal; + AddAttribute(FDocStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + FErrorAttri.Foreground := clRed; + AddAttribute(FErrorAttri); + SetAttributesOnChange(DefHighlightChange); + FDefaultFilter := SYNS_FilterPython; +end; { Create } + +destructor TSynPythonSyn.Destroy; +begin +{$IFDEF SYN_CodeFolding} + BlockOpenerRE.Free; +{$ENDIF} + FKeywords.Free; + inherited; +end; + +procedure TSynPythonSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynPythonSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else + Inc(Run); + end; +end; + +procedure TSynPythonSyn.CommentProc; +begin + FTokenID := tkComment; + Inc(Run); + while not IsLineEnd(Run) do + Inc(Run); +end; + +procedure TSynPythonSyn.GreaterProc; +begin + case FLine[Run + 1] of + '=': begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + else begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPythonSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); +end; + +procedure TSynPythonSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynPythonSyn.LowerProc; +begin + case FLine[Run + 1] of + '=': begin + Inc(Run, 2); + FTokenID := tkSymbol; + end; + '>': begin + Inc(Run, 2); + FTokenID := tkSymbol; + end + else begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPythonSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynPythonSyn.NumberProc; +type + TNumberState = + ( + nsStart, + nsDotFound, + nsFloatNeeded, + nsHex, + nsOct, + nsExpFound + ); + +var + temp: WideChar; + State: TNumberState; + + function CheckSpecialCases: Boolean; + begin + case temp of + // Look for dot (.) + '.': begin + // .45 + if CharInSet(FLine[Run], ['0'..'9']) then + begin + Inc (Run); + FTokenID := tkFloat; + State := nsDotFound; + + // Non-number dot + end else begin + // Ellipsis + if (FLine[Run] = '.') and (FLine[Run+1] = '.') then + Inc (Run, 2); + FTokenID := tkSymbol; + Result := False; + Exit; + end; // if + end; // DOT + + // Look for zero (0) + '0': begin + temp := FLine[Run]; + // 0x123ABC + if CharInSet(temp, ['x', 'X']) then begin + Inc (Run); + FTokenID := tkHex; + State := nsHex; + // 0.45 + end else if temp = '.' then begin + Inc (Run); + State := nsDotFound; + FTokenID := tkFloat; + end else if CharInSet(temp, ['0'..'9']) then begin + Inc (Run); + // 0123 or 0123.45 + if CharInSet(temp, ['0'..'7']) then begin + FTokenID := tkOct; + State := nsOct; + // 0899.45 + end else begin + FTokenID := tkFloat; + State := nsFloatNeeded; + end; // if + end; // if + end; // ZERO + end; // case + + Result := True; + end; // CheckSpecialCases + + function HandleBadNumber: Boolean; + begin + Result := False; + FTokenID := tkUnknown; + // Ignore all tokens till end of "number" + while IsIdentChar(FLine[Run]) or (FLine[Run] = '.') do + Inc (Run); + end; // HandleBadNumber + + function HandleExponent: Boolean; + begin + State := nsExpFound; + FTokenID := tkFloat; + // Skip e[+/-] + if CharInSet(FLine[Run+1], ['+', '-']) then + Inc (Run); + // Invalid token : 1.0e + if not CharInSet(FLine[Run+1], ['0'..'9']) then begin + Inc (Run); + Result := HandleBadNumber; + Exit; + end; // if + + Result := True; + end; // HandleExponent + + function HandleDot: Boolean; + begin + // Check for ellipsis + Result := (FLine[Run+1] <> '.') or (FLine[Run+2] <> '.'); + if Result then begin + State := nsDotFound; + FTokenID := tkFloat; + end; // if + end; // HandleDot + + function CheckStart: Boolean; + begin + // 1234 + if CharInSet(temp, ['0'..'9']) then begin + Result := True; + //123e4 + end else if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 123.45j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + FTokenID := tkFloat; + Result := False; + // 123.45 + end else if temp = '.' then begin + Result := HandleDot; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckStart + + function CheckDotFound: Boolean; + begin + // 1.0e4 + if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 123.45 + end else if CharInSet(temp, ['0'..'9']) then begin + Result := True; + // 123.45j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + Result := False; + // 123.45.45: Error! + end else if temp = '.' then begin + Result := False; + if HandleDot then + HandleBadNumber; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckDotFound + + function CheckFloatNeeded: Boolean; + begin + // 091.0e4 + if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 0912345 + end else if CharInSet(temp, ['0'..'9']) then begin + Result := True; + // 09123.45 + end else if temp = '.' then begin + Result := HandleDot or HandleBadNumber; // Bad octal + // 09123.45j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + Result := False; + // End of number (error: Bad oct number) 0912345 + end else begin + Result := HandleBadNumber; + end; + end; // CheckFloatNeeded + + function CheckHex: Boolean; + begin + // 0x123ABC + if CharInSet(temp, ['a'..'f', 'A'..'F', '0'..'9']) then + begin + Result := True; + // 0x123ABCL + end else if CharInSet(temp, ['l', 'L']) then begin + Inc (Run); + Result := False; + // 0x123.45: Error! + end else if temp = '.' then begin + Result := False; + if HandleDot then + HandleBadNumber; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckHex + + function CheckOct: Boolean; + begin + // 012345 + if CharInSet(temp, ['0'..'9']) then begin + if not CharInSet(temp, ['0'..'7']) then begin + State := nsFloatNeeded; + FTokenID := tkFloat; + end; // if + Result := True; + // 012345L + end else if CharInSet(temp, ['l', 'L']) then begin + Inc (Run); + Result := False; + // 0123e4 + end else if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 0123j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + FTokenID := tkFloat; + Result := False; + // 0123.45 + end else if temp = '.' then begin + Result := HandleDot; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckOct + + function CheckExpFound: Boolean; + begin + // 1e+123 + if CharInSet(temp, ['0'..'9']) then begin + Result := True; + // 1e+123j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + Result := False; + // 1e4.5: Error! + end else if temp = '.' then begin + Result := False; + if HandleDot then + HandleBadNumber; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckExpFound + +begin + State := nsStart; + FTokenID := tkNumber; + + temp := FLine[Run]; + Inc (Run); + + // Special cases + if not CheckSpecialCases then + Exit; + + // Use a state machine to parse numbers + while True do begin + temp := FLine[Run]; + + case State of + nsStart: + if not CheckStart then Exit; + nsDotFound: + if not CheckDotFound then Exit; + nsFloatNeeded: + if not CheckFloatNeeded then Exit; + nsHex: + if not CheckHex then Exit; + nsOct: + if not CheckOct then Exit; + nsExpFound: + if not CheckExpFound then Exit; + end; // case + + Inc (Run); + end; // while +end; + +procedure TSynPythonSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynPythonSyn.String2Proc; +var + BackslashCount: Integer; +begin + FTokenID := tkString; + if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then + begin + FTokenID := tkTrippleQuotedString; + Inc(Run, 3); + + FRange := rsMultilineString2; + while FLine[Run] <> #0 do + begin + case FLine[Run] of + + '\': + begin + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} + if FLine[Run + 1] = '"' then + begin + BackslashCount := 1; + + while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do + BackslashCount := BackslashCount + 1; + + if (BackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + '"': + if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then begin + FRange := rsUnknown; + Inc(Run, 3); + Exit; + end else + Inc(Run); + #10: Exit; + #13: Exit; + else + Inc(Run); + end; + end; + end + else //if short string + repeat + case FLine[Run] of + #0, #10, #13: + begin + if FLine[Run-1] = '\' then + begin + FStringStarter := '"'; + FRange := rsMultilineString3; + end; + Break; + end; + {The same backslash stuff above...} + '\': + begin + if FLine[Run + 1] = '"' then + begin + BackslashCount := 1; + + while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do + BackslashCount := BackslashCount + 1; + + if (BackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + else Inc(Run); + end; //case + until (FLine[Run] = '"'); + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynPythonSyn.PreStringProc; +var + temp: WideChar; +begin + // Handle python raw strings + // r"" + temp := FLine[Run + 1]; + if temp = '''' then + begin + Inc (Run); + StringProc; + end + else if temp = '"' then + begin + Inc (Run); + String2Proc; + end + else + begin + // If not followed by quote char, must be ident + IdentProc; + end; // if +end; + +procedure TSynPythonSyn.UnicodeStringProc; +begin + // Handle python raw and unicode strings + // Valid syntax: u"", or ur"" + if CharInSet(FLine[Run + 1], ['r', 'R']) and + CharInSet(FLine[Run + 2], ['''', '"']) then + begin + // for ur, Remove the "u" and... + Inc (Run); + end; + // delegate to raw strings + PreStringProc; +end; + +procedure TSynPythonSyn.StringProc; +var + FBackslashCount: Integer; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin + FTokenID := tkTrippleQuotedString; + Inc(Run, 3); + + FRange:=rsMultilineString; + while FLine[Run] <> #0 do begin + case FLine[Run] of + + '\': begin + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} + if FLine[Run + 1] = #39 then + begin + FBackslashCount := 1; + + while ((Run > FBackslashCount) and (FLine[Run - FBackslashCount] = '\')) do + FBackslashCount := FBackslashCount + 1; + + if (FBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + #39: + if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin + FRange := rsUnknown; + Inc(Run, 3); + Exit; + end else + Inc(Run); + #10: Exit; + #13: Exit; + else + Inc(Run); + end; + end; + end + else //if short string + repeat + case FLine[Run] of + #0, #10, #13 : begin + if FLine[Run-1] = '\' then begin + FStringStarter := #39; + FRange := rsMultilineString3; + end; + Break; + end; + + {The same backslash stuff above...} + '\': + begin + if FLine[Run + 1] = #39 then + begin + FBackslashCount := 1; + + while ((Run > FBackslashCount) and (FLine[Run - FBackslashCount] = '\')) do + FBackslashCount := FBackslashCount + 1; + + if (FBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + else Inc(Run); + end; //case + until (FLine[Run] = #39); + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynPythonSyn.StringEndProc(EndChar: WideChar); +var + BackslashCount: Integer; +begin + if FRange = rsMultilineString3 then + FTokenID := tkString + else + FTokenID := tkTrippleQuotedString; + + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + #13: + begin + CRProc; + Exit; + end; + end; + + if FRange = rsMultilineString3 then begin + repeat + if FLine[Run]=FStringStarter then begin + Inc(Run); + FRange:=rsUnknown; + Exit; + end else if FLine[Run]='\' then ; {The same backslash stuff above...} + begin + if FLine[Run + 1] = FStringStarter then + begin + BackslashCount := 1; + + while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do + BackslashCount := BackslashCount + 1; + + if (BackslashCount mod 2 = 1) then Inc(Run); + end; + end;// if FLine[Run]... + + Inc(Run); + until IsLineEnd(Run); + if FLine[Run-1]<>'\' then begin + FRange:=rsUnknown; + Exit; + end; + end else + repeat + if FLine[Run] = '\' then + begin + if FLine[Run + 1] = EndChar then + begin + BackslashCount := 1; + + while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do + BackslashCount := BackslashCount + 1; + + if (BackslashCount mod 2 = 1) then Inc(Run, 2); + end; + end;// if FLine[Run]... + if (FLine[Run]=EndChar) and (FLine[Run+1]=EndChar) and (FLine[Run+2]=EndChar) then begin + Inc(Run,3); + FRange:=rsUnknown; + Exit; + end; + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynPythonSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynPythonSyn.Next; +begin + FTokenPos := Run; + + case FRange of + rsMultilineString: + StringEndProc(#39); + rsMultilineString2: + StringEndProc('"'); + rsMultilineString3: + StringEndProc(FStringStarter); + else + case FLine[Run] of + '&', '}', '{', ':', ',', ']', '[', '*', '`', + '^', ')', '(', ';', '/', '=', '-', '+', '!', '\', + '%', '|', '~' : + SymbolProc; + #13: CRProc; + '#': CommentProc; + '>': GreaterProc; + 'A'..'Q', 'S', 'T', 'V'..'Z', 'a'..'q', 's', 't', 'v'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + #0: NullProc; + '.', '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'r', 'R': PreStringProc; + 'u', 'U': UnicodeStringProc; + '''': StringProc; + '"': String2Proc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynPythonSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_KEYWORD: Result := FKeyAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynPythonSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynPythonSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynPythonSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynPythonSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNonKeyword: Result := FNonKeyAttri; + tkSystemDefined: Result := FSystemAttri; + tkNumber: Result := FNumberAttri; + tkHex: Result := FHexAttri; + tkOct: Result := FOctalAttri; + tkFloat: Result := FFloatAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkTrippleQuotedString: Result := FDocStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FErrorAttri; + else + Result := nil; + end; +end; + +function TSynPythonSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynPythonSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +{$IFDEF SYN_CodeFolding} +procedure TSynPythonSyn.InitFoldRanges(FoldRanges: TSynFoldRanges); +begin + inherited; + FoldRanges.CodeFoldingMode := cfmIndentation; +end; + +procedure TSynPythonSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + LeftTrimmedLine : string; + Line: Integer; + Indent : Integer; + TabW : integer; + FoldType : integer; +const + MultiLineStringFoldType = 2; + ClassDefType = 3; + FunctionDefType = 4; + + + function IsMultiLineString(Line : integer; Range : TRangeState; Fold : Boolean): Boolean; + begin + Result := True; + if TRangeState(GetLineRange(LinesToScan, Line)) = Range then + begin + if (TRangeState(GetLineRange(LinesToScan, Line - 1)) <> Range) and Fold then + FoldRanges.StartFoldRange(Line + 1, MultiLineStringFoldType) + else + FoldRanges.NoFoldInfo(Line + 1); + end + else if (TRangeState(GetLineRange(LinesToScan, Line - 1)) = Range) and Fold then + begin + FoldRanges.StopFoldRange(Line + 1, MultiLineStringFoldType); + end else + Result := False; + end; + + function FoldRegion(Line: Integer): Boolean; + begin + Result := False; + if Uppercase(Copy(LeftTrimmedLine, 1, 7)) = '#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(LeftTrimmedLine, 1, 10)) = '#ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + + function LeftSpaces: Integer; + var + p: PWideChar; + begin + p := PWideChar(CurLine); + if Assigned(p) then + begin + Result := 0; + while (p^ >= #1) and (p^ <= #32) do + begin + if (p^ = #9) then + Inc(Result, TabW) + else + Inc(Result); + Inc(p); + end; + end + else + Result := 0; + end; + +begin + // Deal with multiline strings + for Line := FromLine to ToLine do begin + if IsMultiLineString(Line, rsMultilineString, True) or + IsMultiLineString(Line, rsMultilineString2, True) or + IsMultiLineString(Line, rsMultilineString3, False) + then + Continue; + + // Find Fold regions + CurLine := LinesToScan[Line]; + LeftTrimmedLine := TrimLeft(CurLine); + + // Skip empty lines + if LeftTrimmedLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + TabW := TabWidth(LinesToScan); + Indent := LeftSpaces; + + // find fold openers + if BlockOpenerRE.Exec(LeftTrimmedLine) then + begin + if BlockOpenerRE.Match[1] = 'class' then + FoldType := ClassDefType + else if Pos('def', BlockOpenerRE.Match[1]) >= 1 then + FoldType := FunctionDefType + else + FoldType := 1; + + FoldRanges.StartFoldRange(Line + 1, FoldType, Indent); + Continue; + end; + + FoldRanges.StopFoldRange(Line + 1, 1, Indent) + end; +end; +{$ENDIF} + +procedure TSynPythonSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynPythonSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterPython; +end; + +class function TSynPythonSyn.GetLanguageName: string; +begin + Result := SYNS_LangPython; +end; + +function TSynPythonSyn.GetSampleSource: UnicodeString; +begin + Result := + '#!/usr/local/bin/python'#13#10 + + 'import string, sys'#13#10 + + '""" If no arguments were given, print a helpful message """'#13#10 + + 'if len(sys.argv)==1:'#13#10 + + ' print ''Usage: celsius temp1 temp2 ...'''#13#10 + + ' sys.exit(0)'; +end; + +class function TSynPythonSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangPython; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynPythonSyn); +{$ENDIF} +finalization + GlobalKeywords.Free; +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterRC.pas b/Source/VCL/SynEdit/Source/SynHighlighterRC.pas index e5310984..41400a66 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterRC.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterRC.pas @@ -1,537 +1,542 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterRC.pas, released 2004-06-12. -The initial author of this file is Yiannis Mandravellos. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynHighlighterRC.pas,v 1.6.2.8 2008/09/14 16:25:02 maelh Exp $ - -You may retrieve the latest version of SynEdit from the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -unit SynHighlighterRC; - -{$I SynEdit.inc} - -interface - -uses - Windows, Controls, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, - tkNumber, tkSpace, tkString, tkSymbol, tkUnknown); - - TRangeState = (rsUnknown, rsDirective, rsComment); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynRCSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..240] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fDirecAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure CommentProc; - procedure CRProc; - procedure DirectiveProc; - procedure IdentProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure QuoteProc; - procedure SlashProc; - procedure SpaceProc; - procedure SymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetCapabilities: TSynHighlighterCapabilities; override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(aOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(index: integer): TSynHighlighterAttributes; override; - function GetEol: boolean; override; - function GetRange: pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(value: pointer); override; - procedure ResetRange; override; - function UseUserSettings(SettingIndex: integer): boolean; override; - procedure EnumUserSettings(Settings: TStrings); override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property DirecAttri: TSynHighlighterAttributes read fDirecAttri write fDirecAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..77] of string = ( - 'ACCELERATORS', 'ALT', 'ASCII', 'AUTO3STATE', 'AUTOCHECKBOX', - 'AUTORADIOBUTTON', 'BITMAP', 'BLOCK', 'CAPTION', 'CHARACTERISTICS', - 'CHECKBOX', 'CHECKED', 'CLASS', 'COMBOBOX', 'COMMENTS', 'COMPANYNAME', - 'CONTROL', 'CTEXT', 'CURSOR', 'DEFPUSHBUTTON', 'DIALOG', 'DIALOGEX', - 'DISCARDABLE', 'EDITTEXT', 'EXSTYLE', 'FILEDESCRIPTION', 'FILEFLAGS', - 'FILEFLAGSMASK', 'FILEOS', 'FILESUBTYPE', 'FILETYPE', 'FILEVERSION', - 'FIXED', 'FONT', 'GRAYED', 'GROUPBOX', 'HELP', 'ICON', 'IMPURE', 'INACTIVE', - 'INTERNALNAME', 'LANGUAGE', 'LEGALCOPYRIGHT', 'LEGALTRADEMARKS', 'LISTBOX', - 'LOADONCALL', 'LTEXT', 'MENU', 'MENUBARBREAK', 'MENUBREAK', 'MENUEX', - 'MENUITEM', 'MESSAGETABLE', 'MOVEABLE', 'NOINVERT', 'ORIGINALFILENAME', - 'POPUP', 'PRELOAD', 'PRIVATEBUILD', 'PRODUCTNAME', 'PRODUCTVERSION', 'PURE', - 'PUSHBOX', 'PUSHBUTTON', 'RADIOBUTTON', 'RCDATA', 'RTEXT', 'SCROLLBAR', - 'SEPARATOR', 'SHIFT', 'SPECIALBUILD', 'STATE3', 'STRINGTABLE', 'STYLE', - 'VALUE', 'VERSION', 'VERSIONINFO', 'VIRTKEY' - ); - - KeyIndices: array[0..240] of Integer = ( - -1, -1, -1, 35, -1, 57, 54, -1, -1, -1, 74, -1, -1, -1, 64, -1, -1, -1, -1, - 9, 68, -1, 41, -1, -1, 10, -1, -1, 13, 24, -1, -1, -1, 42, -1, -1, -1, -1, - -1, 61, -1, -1, 20, 67, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, 23, -1, - -1, -1, -1, -1, 48, -1, 12, -1, -1, -1, -1, -1, -1, -1, 75, 73, 14, -1, 77, - -1, 4, 63, -1, -1, -1, -1, 65, 19, 27, -1, 31, 38, -1, -1, -1, -1, -1, 50, - -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, 8, 6, 18, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 49, 76, -1, 59, -1, -1, 52, 47, 29, -1, -1, -1, - -1, -1, -1, -1, 56, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1, -1, -1, 71, 17, 32, 34, -1, 45, -1, -1, -1, 70, -1, 3, - -1, 62, 43, 5, -1, -1, 33, 0, 51, 16, 69, -1, -1, -1, 39, -1, -1, 7, -1, 11, - -1, -1, -1, 21, -1, 40, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, - -1, 26, -1, 66, 25, -1, -1, 72, -1, -1, 60, 15, -1, -1, -1, -1, 55, -1, -1, - -1, 30, -1, -1, -1, 46, -1, 58, -1, 37, 22, -1 - ); - -{ TSynRCSyn } - -{$Q-} -function TSynRCSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 25 + Ord(Str^) * 298; - inc(Str); - end; - Result := Result mod 241; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynRCSyn.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 TSynRCSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynRCSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynRCSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -constructor TSynRCSyn.Create(aOwner: TComponent); -begin - inherited; - - fCaseSensitive := True; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - AddAttribute(fCommentAttri); - - fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - AddAttribute(fDirecAttri); - - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fRange := rsUnknown; - fDefaultFilter := SYNS_FilterRC; -end; - -destructor TSynRCSyn.Destroy; -begin - inherited; -end; - -procedure TSynRCSyn.QuoteProc; -begin - fTokenId:= tkString; - repeat - inc(Run); - until IsLineEnd(Run) or (fLine[Run] = #34); - if fLine[Run] = #34 then - inc(Run); -end; - -procedure TSynRCSyn.SlashProc; -begin - case fLine[Run + 1] of - #13: CRPRoc; - #10: LFProc; - '/': - begin - fTokenId := tkComment; - inc(Run, 2); - while not IsLineEnd(Run) do inc(Run); - end; - '*': - begin - fTokenID := tkComment; - fRange := rsComment; - inc(Run, 2); - while fLine[Run] <> #0 do - case fLine[Run] of - '*': - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - fRange := rsUnknown; - break; - end - else inc(Run); - #10, #13: break; - else - inc(Run); - end; - end; - else - fTokenId := tkSymbol; - inc(Run); - end -end; - -procedure TSynRCSyn.CommentProc; -begin - fTokenId := tkComment; - case fLine[Run] of - #0: NullProc; - #13: CRProc; - #10: LFProc; - else - fTokenId := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run +1] = '/') then - begin - inc(Run, 2); - fRange := rsUnknown; - break; - end - else - inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynRCSyn.DirectiveProc; -begin - fTokenId := tkDirective; - repeat - if (fLine[Run] = '/') then - begin - if fLine[Run +1] = '/' then - begin - fRange := rsUnknown; - exit; - end - else - if fLine[Run +1] = '*' then - begin - fRange := rsComment; - exit; - end - end; - inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynRCSyn.IdentProc; -begin - fTokenId := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynRCSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then - inc(Run); -end; - -procedure TSynRCSyn.LFProc; -begin - inc(Run); - fTokenID := tkSpace; -end; - -procedure TSynRCSyn.SpaceProc; -begin - inc(Run); - fTokenId := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynRCSyn.NullProc; -begin - fTokenId := tkNull; - inc(Run); -end; - -procedure TSynRCSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'u', 'U', 'x', 'X', - 'A'..'F', 'a'..'f', 'L', 'l', '-', '+': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case fLine[Run] of - '.': if fLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynRCSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynRCSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynRCSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsDirective: DirectiveProc; - rsComment: CommentProc; - else - case fLine[Run] of - #0: NullProc; - #13: CRProc; - #10: LFProc; - '/': SlashProc; - '"': QuoteProc; - '#': DirectiveProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '|', ',', '{', '}': SymbolProc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynRCSyn.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 TSynRCSyn.GetEol: boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynRCSyn.GetRange: pointer; -begin - Result := pointer(fRange); -end; - -function TSynRCSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenID; -end; - -function TSynRCSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkDirective: Result := fDirecAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fSymbolAttri; - else Result := nil; - end; -end; - -function TSynRCSyn.GetTokenKind: Integer; -begin - Result := ord(GetTokenID); -end; - -procedure TSynRCSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynRCSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynRCSyn.EnumUserSettings(Settings: TStrings); -begin - // ** ?? -end; - -function TSynRCSyn.UseUserSettings(SettingIndex: integer): boolean; -begin - Result := False; -end; - -class function TSynRCSyn.GetCapabilities: TSynHighlighterCapabilities; -begin - Result := inherited GetCapabilities; -end; - -function TSynRCSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterRC; -end; - -class function TSynRCSyn.GetLanguageName: string; -begin - Result := SYNS_LangRC; -end; - -function TSynRCSyn.GetSampleSource: string; -begin - Result := ''; -end; - -class function TSynRCSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangRC; -end; - -initialization - RegisterPlaceableHighlighter(TSynRCSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterRC.pas, released 2004-06-12. +The initial author of this file is Yiannis Mandravellos. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynHighlighterRC.pas,v 1.6.2.8 2008/09/14 16:25:02 maelh Exp $ + +You may retrieve the latest version of SynEdit from the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +unit SynHighlighterRC; + +{$I SynEdit.inc} + +interface + +uses + Windows, Controls, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, + tkNumber, tkSpace, tkString, tkSymbol, tkUnknown); + + TRangeState = (rsUnknown, rsDirective, rsComment); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynRCSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..240] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FDirecAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure CommentProc; + procedure CRProc; + procedure DirectiveProc; + procedure IdentProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure QuoteProc; + procedure SlashProc; + procedure SpaceProc; + procedure SymbolProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetCapabilities: TSynHighlighterCapabilities; override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(aOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(index: Integer): TSynHighlighterAttributes; override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(value: Pointer); override; + procedure ResetRange; override; + function UseUserSettings(SettingIndex: Integer): Boolean; override; + procedure EnumUserSettings(Settings: TStrings); override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property DirecAttri: TSynHighlighterAttributes read FDirecAttri write FDirecAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..77] of UnicodeString = ( + 'ACCELERATORS', 'ALT', 'ASCII', 'AUTO3STATE', 'AUTOCHECKBOX', + 'AUTORADIOBUTTON', 'BITMAP', 'BLOCK', 'CAPTION', 'CHARACTERISTICS', + 'CHECKBOX', 'CHECKED', 'CLASS', 'COMBOBOX', 'COMMENTS', 'COMPANYNAME', + 'CONTROL', 'CTEXT', 'CURSOR', 'DEFPUSHBUTTON', 'DIALOG', 'DIALOGEX', + 'DISCARDABLE', 'EDITTEXT', 'EXSTYLE', 'FILEDESCRIPTION', 'FILEFLAGS', + 'FILEFLAGSMASK', 'FILEOS', 'FILESUBTYPE', 'FILETYPE', 'FILEVERSION', + 'FIXED', 'FONT', 'GRAYED', 'GROUPBOX', 'HELP', 'ICON', 'IMPURE', 'INACTIVE', + 'INTERNALNAME', 'LANGUAGE', 'LEGALCOPYRIGHT', 'LEGALTRADEMARKS', 'LISTBOX', + 'LOADONCALL', 'LTEXT', 'MENU', 'MENUBARBREAK', 'MENUBREAK', 'MENUEX', + 'MENUITEM', 'MESSAGETABLE', 'MOVEABLE', 'NOINVERT', 'ORIGINALFILENAME', + 'POPUP', 'PRELOAD', 'PRIVATEBUILD', 'PRODUCTNAME', 'PRODUCTVERSION', 'PURE', + 'PUSHBOX', 'PUSHBUTTON', 'RADIOBUTTON', 'RCDATA', 'RTEXT', 'SCROLLBAR', + 'SEPARATOR', 'SHIFT', 'SPECIALBUILD', 'STATE3', 'STRINGTABLE', 'STYLE', + 'VALUE', 'VERSION', 'VERSIONINFO', 'VIRTKEY' + ); + + KeyIndices: array[0..240] of Integer = ( + -1, -1, -1, 35, -1, 57, 54, -1, -1, -1, 74, -1, -1, -1, 64, -1, -1, -1, -1, + 9, 68, -1, 41, -1, -1, 10, -1, -1, 13, 24, -1, -1, -1, 42, -1, -1, -1, -1, + -1, 61, -1, -1, 20, 67, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, 23, -1, + -1, -1, -1, -1, 48, -1, 12, -1, -1, -1, -1, -1, -1, -1, 75, 73, 14, -1, 77, + -1, 4, 63, -1, -1, -1, -1, 65, 19, 27, -1, 31, 38, -1, -1, -1, -1, -1, 50, + -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, 8, 6, 18, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 49, 76, -1, 59, -1, -1, 52, 47, 29, -1, -1, -1, + -1, -1, -1, -1, 56, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 1, -1, -1, 71, 17, 32, 34, -1, 45, -1, -1, -1, 70, -1, 3, + -1, 62, 43, 5, -1, -1, 33, 0, 51, 16, 69, -1, -1, -1, 39, -1, -1, 7, -1, 11, + -1, -1, -1, 21, -1, 40, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, + -1, 26, -1, 66, 25, -1, -1, 72, -1, -1, 60, 15, -1, -1, -1, -1, 55, -1, -1, + -1, 30, -1, -1, -1, 46, -1, 58, -1, 37, 22, -1 + ); + +{ TSynRCSyn } + +{$Q-} +function TSynRCSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 25 + Ord(Str^) * 298; + Inc(Str); + end; + Result := Result mod 241; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynRCSyn.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 TSynRCSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynRCSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynRCSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +constructor TSynRCSyn.Create(aOwner: TComponent); +begin + inherited; + + FCaseSensitive := True; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + AddAttribute(FCommentAttri); + + FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + AddAttribute(FDirecAttri); + + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FRange := rsUnknown; + FDefaultFilter := SYNS_FilterRC; +end; + +destructor TSynRCSyn.Destroy; +begin + inherited; +end; + +procedure TSynRCSyn.QuoteProc; +begin + FTokenID:= tkString; + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = #34); + if FLine[Run] = #34 then + Inc(Run); +end; + +procedure TSynRCSyn.SlashProc; +begin + case FLine[Run + 1] of + #13: CRPRoc; + #10: LFProc; + '/': + begin + FTokenID := tkComment; + Inc(Run, 2); + while not IsLineEnd(Run) do Inc(Run); + end; + '*': + begin + FTokenID := tkComment; + FRange := rsComment; + Inc(Run, 2); + while FLine[Run] <> #0 do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end + else Inc(Run); + #10, #13: + Break; + else + Inc(Run); + end; + end; + else + FTokenID := tkSymbol; + Inc(Run); + end +end; + +procedure TSynRCSyn.CommentProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: NullProc; + #13: CRProc; + #10: LFProc; + else + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run +1] = '/') then + begin + Inc(Run, 2); + FRange := rsUnknown; + Break; + end + else + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynRCSyn.DirectiveProc; +begin + FTokenID := tkDirective; + repeat + if (FLine[Run] = '/') then + begin + if FLine[Run +1] = '/' then + begin + FRange := rsUnknown; + Exit; + end + else + if FLine[Run +1] = '*' then + begin + FRange := rsComment; + Exit; + end + end; + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynRCSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynRCSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynRCSyn.LFProc; +begin + Inc(Run); + FTokenID := tkSpace; +end; + +procedure TSynRCSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynRCSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynRCSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'u', 'U', 'x', 'X', + 'A'..'F', 'a'..'f', 'L', 'l', '-', '+': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynRCSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynRCSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynRCSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsDirective: DirectiveProc; + rsComment: CommentProc; + else + case FLine[Run] of + #0: NullProc; + #13: CRProc; + #10: LFProc; + '/': SlashProc; + '"': QuoteProc; + '#': DirectiveProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '|', ',', '{', '}': SymbolProc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynRCSyn.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 TSynRCSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynRCSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynRCSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynRCSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkDirective: Result := FDirecAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FSymbolAttri; + else Result := nil; + end; +end; + +function TSynRCSyn.GetTokenKind: Integer; +begin + Result := Ord(GetTokenID); +end; + +procedure TSynRCSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynRCSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynRCSyn.EnumUserSettings(Settings: TStrings); +begin + // ** ?? +end; + +function TSynRCSyn.UseUserSettings(SettingIndex: Integer): Boolean; +begin + Result := False; +end; + +class function TSynRCSyn.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := inherited GetCapabilities; +end; + +function TSynRCSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterRC; +end; + +class function TSynRCSyn.GetLanguageName: string; +begin + Result := SYNS_LangRC; +end; + +function TSynRCSyn.GetSampleSource: UnicodeString; +begin + Result := ''; +end; + +class function TSynRCSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangRC; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynRCSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterRexx.pas b/Source/VCL/SynEdit/Source/SynHighlighterRexx.pas index d0461137..bb18455a 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterRexx.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterRexx.pas @@ -229,7 +229,7 @@ implementation SynEditStrConst; resourcestring - SYNS_FilterREXX = 'Rexx sources|*.REX|All files (*.*)|*.*'; + SYNS_FilterREXX = 'Rexx sources|*.REX'; SYNS_LangREXX = 'REXX'; SYNS_FriendlyLangREXX = 'REXX'; SYNS_AttrSpecial = 'Special'; diff --git a/Source/VCL/SynEdit/Source/SynHighlighterRuby.pas b/Source/VCL/SynEdit/Source/SynHighlighterRuby.pas index c3c460fe..cf5a1915 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterRuby.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterRuby.pas @@ -1,729 +1,736 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterRuby.pas, released 2001-11-13. -The Initial Author of this file is Stefan Ascher. -Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm) -"Heredoc" syntax highlighting implementation by Marko Njezic. -Unicode translation by Maël Hörz. -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: SynHighlighterRuby.pas,v 1.10.2.9 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Ruby highlighter for SynEdit) -@author(Stefan Ascher ) -@created(21 May 2001) -@lastmod(2001-11-13) -The SynHighlighterVisualLisp unit provides SynEdit with a Ruby highlighter. -} - -unit SynHighlighterRuby; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey, - tkSpace, tkString, tkSymbol, tkUnknown); - -{$IFDEF SYN_HEREDOC} - TRangeState = (rsUnknown, rsHeredoc, rsIndentedHeredoc); - - TRangePointer = packed record - case Boolean of - True: (Ptr: Pointer); - False: (Range: Byte; Length: Byte; Checksum: Word); - end; -{$ELSE} - TRangeState = (rsUnknown); -{$ENDIF} - -type - TSynRubySyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; -{$IFDEF SYN_HEREDOC} - fHeredocLength: Byte; - fHeredocChecksum: Word; -{$ENDIF} - FTokenID: TtkTokenKind; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSecondKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyWords: TStrings; - fSecondKeys: TStrings; - procedure BraceOpenProc; - procedure PointCommaProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure RoundOpenProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure UnknownProc; -{$IFDEF SYN_HEREDOC} - procedure HeredocProc; -{$ENDIF} - procedure SetSecondKeys(const Value: TStrings); - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - procedure NextProcedure; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: string): boolean; override; - function IsSecondKeyWord(aToken: string): Boolean; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri - write fSecondKeyAttri; - property SecondKeyWords: TStrings read fSecondKeys write SetSecondKeys; - 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; - end; - -implementation - -uses - SynEditMiscProcs, - SynEditStrConst; - -const - RubyKeysCount = 43; - RubyKeys: array[1..RubyKeysCount] of string = ( - 'alias', 'attr', 'begin', 'break', 'case', 'class', 'def', 'do', 'else', - 'elsif', 'end', 'ensure', 'exit', 'extend', 'false', 'for', 'gets', 'if', - 'in', 'include', 'load', 'loop', 'module', 'next', 'nil', 'not', 'print', - 'private', 'public', 'puts', 'raise', 'redo', 'require', 'rescue', 'retry', - 'return', 'self', 'then', 'true', 'unless', 'when', 'while', 'yield'); - -function TSynRubySyn.IsKeyword(const AKeyword: string): Boolean; -var - First, Last, I, Compare: Integer; - Token: string; -begin - First := 0; - Last := fKeywords.Count - 1; - Result := False; - Token := SysUtils.AnsiUpperCase(AKeyword); - - while First <= Last do - begin - I := (First + Last) shr 1; - Compare := WideCompareStr(fKeywords[I], Token); - if Compare = 0 then - begin - Result := True; - break; - end - else if Compare < 0 then - First := I + 1 - else - Last := I - 1; - end; -end; { IsKeyWord } - -function TSynRubySyn.IsSecondKeyWord(aToken: string): Boolean; -var - First, Last, I, Compare: Integer; - Token: string; -begin - First := 0; - Last := fSecondKeys.Count - 1; - Result := False; - Token := SysUtils.AnsiUpperCase(aToken); - while First <= Last do - begin - I := (First + Last) shr 1; - Compare := WideCompareStr(fSecondKeys[i], Token); - if Compare = 0 then - begin - Result := True; - break; - end - else if Compare < 0 then - First := I + 1 - else - Last := I - 1; - end; -end; { IsSecondKeyWord } - -constructor TSynRubySyn.Create(AOwner: TComponent); -var - i: integer; -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fKeyWords := TStringList.Create; - TStringList(fKeyWords).Sorted := True; - TStringList(fKeyWords).Duplicates := dupIgnore; - fSecondKeys := TStringList.Create; - TStringList(fSecondKeys).Sorted := True; - TStringList(fSecondKeys).Duplicates := dupIgnore; - if not (csDesigning in ComponentState) then - for i := 1 to RubyKeysCount do - fKeyWords.Add(RubyKeys[i]); - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clMaroon; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Foreground := clBlue; - AddAttribute(fKeyAttri); - fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - AddAttribute(fSecondKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clGreen; - 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.Foreground := clBlue; - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - - fRange := rsUnknown; - fDefaultFilter := SYNS_FilterRuby; -end; { Create } - -destructor TSynRubySyn.Destroy; -begin - fKeyWords.Free; - fSecondKeys.Free; - inherited Destroy; -end; { Destroy } - -procedure TSynRubySyn.BraceOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynRubySyn.PointCommaProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynRubySyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynRubySyn.IdentProc; -begin - while IsIdentChar(fLine[Run]) do inc(Run); - if IsKeyWord(GetToken) then - begin - fTokenId := tkKey; - Exit; - end - else fTokenId := tkIdentifier; - if IsSecondKeyWord(GetToken) then - fTokenId := tkSecondKey - else - fTokenId := tkIdentifier; -end; - -procedure TSynRubySyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynRubySyn.LowerProc; -{$IFDEF SYN_HEREDOC} -var - i, Len, SkipRun: Integer; - IndentedHeredoc: Boolean; - QuoteChar: WideChar; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - if FLine[Run + 1] = '<' then - begin - fTokenID := tkSymbol; - - SkipRun := 0; - QuoteChar := #0; - if (FLine[Run + 2] = '-') and (FLine[Run + 3] in - [WideChar('"'), WideChar(''''), WideChar('`')]) then - begin - SkipRun := 2; - QuoteChar := FLine[Run + 3]; - end - else - if (FLine[Run + 2] in [WideChar('-'), WideChar('"'), WideChar(''''), WideChar('`')]) then - begin - SkipRun := 1; - if FLine[Run + 2] <> '-' then - QuoteChar := FLine[Run + 2]; - end; - IndentedHeredoc := (SkipRun > 0) and (FLine[Run + 2] = '-'); - - if IsIdentChar(FLine[Run + SkipRun + 2]) then - begin - inc(Run, 2); - - i := Run; - while IsIdentChar(FLine[SkipRun + i]) do Inc(i); - Len := i - Run; - - if Len > 255 then - begin - fTokenID := tkUnknown; - Exit; - end; - - if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then - begin - fTokenID := tkUnknown; - Exit; - end; - - if IndentedHeredoc then - fRange := rsIndentedHeredoc - else - fRange := rsHeredoc; - fHeredocLength := Len; - fHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); - - Inc(Run, SkipRun + Len); - fTokenID := tkString; - end - else - inc(Run, 2); - end - else -{$ENDIF} - begin - inc(Run); - fTokenID := tkSymbol; - end; -end; - -procedure TSynRubySyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynRubySyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynRubySyn.RoundOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynRubySyn.SlashProc; -begin - case FLine[Run] of - '/': - begin - inc(Run); - fTokenId := tkSymbol; - end; - '*': - begin - inc(Run); - fTokenId := tkSymbol; - end; - else - begin - fTokenID := tkComment; - while FLine[Run] <> #0 do - begin - case FLine[Run] of - #10, #13: break; - end; - inc(Run); - end; - end; - end; -end; - -procedure TSynRubySyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynRubySyn.StringProc; -var - QuoteChar: WideChar; -begin -// Ha, ha, Strings in Ruby (could be anything)!!!! - -//There are three more ways to construct string literals: %q, %Q, and ``here -//documents.'' -// -//%q and %Q start delimited single- and double-quoted strings. -// -//%q/general single-quoted string/ » general single-quoted string -//%Q!general double-quoted string! » general double-quoted string -//%Q{Seconds/day: #{24*60*60}} » Seconds/day: 86400 -// -//The character following the ``q'' or ``Q'' is the delimiter. If it is an -//opening bracket, brace, parenthesis, or less-than sign, the string is read -//until the matching close symbol is found. Otherwise the string is read until -//the next occurrence of the same delimiter. - - fTokenID := tkString; - QuoteChar := FLine[Run]; // either " or ' - if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) - then inc(Run, 2); - repeat - case FLine[Run] of - #0, #10, #13: break; - end; - inc(Run); - until FLine[Run] = QuoteChar; - if FLine[Run] <> #0 then inc(Run); -end; - -procedure TSynRubySyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -{$IFDEF SYN_HEREDOC} -procedure TSynRubySyn.HeredocProc; - - procedure SkipToEOL; - begin - case FLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - repeat - inc(Run); - until IsLineEnd(Run); - end; - end; - -var - i : Integer; -begin - if IsLineEnd(Run) and (fTokenPos = Run) then - begin - NextProcedure; - Exit; - end; - fTokenID := tkString; - - if fRange = rsIndentedHeredoc then - while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); - - if ((Run = 0) and (fRange = rsHeredoc)) or (fRange = rsIndentedHeredoc) then - begin - i := 0; - - while not IsLineEnd(FLine[Run + i]) do - begin - if i > fHeredocLength then - begin - SkipToEOL; - Exit; - end; - Inc(i); - end; - - if i <> fHeredocLength then - begin - SkipToEOL; - Exit; - end; - - if (CalcFCS(FLine[Run], i) = fHeredocChecksum) then - begin - fRange := rsUnknown; - Run := Run + i; - Exit; - end; - end; - - SkipToEOL; -end; -{$ENDIF} - -procedure TSynRubySyn.Next; -begin - fTokenPos := Run; -{$IFDEF SYN_HEREDOC} - if fRange in [rsHeredoc, rsIndentedHeredoc] then - HeredocProc - else -{$ENDIF} - NextProcedure; - inherited; -end; - -procedure TSynRubySyn.NextProcedure; -begin - case fLine[Run] of - '<': LowerProc; - '#': SlashProc; - '{': BraceOpenProc; - ';': PointCommaProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - '(': RoundOpenProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #34, #39: StringProc; - else UnknownProc; - end; -end; - -function TSynRubySyn.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 TSynRubySyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynRubySyn.GetRange: Pointer; -{$IFDEF SYN_HEREDOC} -var - RangePointer: TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(fRange); - RangePointer.Length := 0; - RangePointer.Checksum := 0; - if fRange in [rsHeredoc, rsIndentedHeredoc] then - begin - RangePointer.Length := fHeredocLength; - RangePointer.Checksum := fHeredocChecksum; - end; - Result := RangePointer.Ptr; -{$ELSE} - Result := Pointer(fRange); -{$ENDIF} -end; - -function TSynRubySyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynRubySyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkSecondKey: Result := fSecondKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynRubySyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynRubySyn.ResetRange; -begin - fRange := rsUnknown; -{$IFDEF SYN_HEREDOC} - fHeredocLength := 0; - fHeredocChecksum := 0; -{$ENDIF} -end; - -procedure TSynRubySyn.SetRange(Value: Pointer); -{$IFDEF SYN_HEREDOC} -var - RangePointer: TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer := TRangePointer(Value); - fRange := TRangeState(RangePointer.Range); - fHeredocLength := 0; - fHeredocChecksum := 0; - if fRange in [rsHeredoc, rsIndentedHeredoc] then - begin - fHeredocLength := RangePointer.Length; - fHeredocChecksum := RangePointer.Checksum; - end; -{$ELSE} - fRange := TRangeState(Value); -{$ENDIF} -end; - -procedure TSynRubySyn.SetSecondKeys(const Value: TStrings); -var - i: Integer; -begin - if Value <> nil then - begin - Value.BeginUpdate; - for i := 0 to Value.Count - 1 do - Value[i] := SysUtils.AnsiUpperCase(Value[i]); - Value.EndUpdate; - end; - fSecondKeys.Assign(Value); - DefHighLightChange(nil); -end; - -function TSynRubySyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterRuby; -end; - -class function TSynRubySyn.GetLanguageName: string; -begin - Result := SYNS_LangRuby; -end; - -function TSynRubySyn.GetSampleSource: string; -begin - Result := - '# Factorial'+#13#10+ - 'def fact(n)'+#13#10+ - ' if n == 0'+#13#10+ - ' 1'+#13#10+ - ' else'+#13#10+ - ' n * fact(n-1)'+#13#10+ - ' end'+#13#10+ - 'end'+#13#10+ - 'print fact(ARGV[0].to_i), "\n"'; -end; - -class function TSynRubySyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangRuby; -end; - -initialization - RegisterPlaceableHighlighter(TSynRubySyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterRuby.pas, released 2001-11-13. +The Initial Author of this file is Stefan Ascher. +Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm) +"Heredoc" syntax highlighting implementation by Marko Njezic. +Unicode translation by Maël Hörz. +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: SynHighlighterRuby.pas,v 1.10.2.9 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Ruby highlighter for SynEdit) +@author(Stefan Ascher ) +@created(21 May 2001) +@lastmod(2001-11-13) +The SynHighlighterVisualLisp unit provides SynEdit with a Ruby highlighter. +} + +unit SynHighlighterRuby; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey, + tkSpace, tkString, tkSymbol, tkUnknown); + +{$IFDEF SYN_HEREDOC} + TRangeState = (rsUnknown, rsHeredoc, rsIndentedHeredoc); + + TRangePointer = packed record + case Boolean of + True: (Ptr: Pointer); + False: (Range: Byte; Length: Byte; Checksum: Word); + end; +{$ELSE} + TRangeState = (rsUnknown); +{$ENDIF} + +type + TSynRubySyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; +{$IFDEF SYN_HEREDOC} + FHeredocLength: Byte; + FHeredocChecksum: Word; +{$ENDIF} + FTokenID: TtkTokenKind; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSecondKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyWords: TUnicodeStrings; + FSecondKeys: TUnicodeStrings; + procedure BraceOpenProc; + procedure PointCommaProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure RoundOpenProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; +{$IFDEF SYN_HEREDOC} + procedure HeredocProc; +{$ENDIF} + procedure SetSecondKeys(const Value: TUnicodeStrings); + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + procedure NextProcedure; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function IsKeyword(const AKeyword: UnicodeString): boolean; override; + function IsSecondKeyWord(aToken: UnicodeString): Boolean; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri + write FSecondKeyAttri; + property SecondKeyWords: TUnicodeStrings read FSecondKeys write SetSecondKeys; + 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; + end; + +implementation + +uses + SynEditMiscProcs, + SynEditStrConst; + +const + RubyKeysCount = 43; + RubyKeys: array[1..RubyKeysCount] of UnicodeString = ( + 'alias', 'attr', 'begin', 'break', 'case', 'class', 'def', 'do', 'else', + 'elsif', 'end', 'ensure', 'exit', 'extend', 'false', 'for', 'gets', 'if', + 'in', 'include', 'load', 'loop', 'module', 'next', 'nil', 'not', 'print', + 'private', 'public', 'puts', 'raise', 'redo', 'require', 'rescue', 'retry', + 'return', 'self', 'then', 'true', 'unless', 'when', 'while', 'yield'); + +function TSynRubySyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +var + First, Last, I, Compare: Integer; + Token: UnicodeString; +begin + First := 0; + Last := FKeyWords.Count - 1; + Result := False; + Token := SynWideUpperCase(AKeyword); + + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := WideCompareStr(FKeyWords[I], Token); + if Compare = 0 then + begin + Result := True; + Break; + end + else if Compare < 0 then + First := I + 1 + else + Last := I - 1; + end; +end; { IsKeyWord } + +function TSynRubySyn.IsSecondKeyWord(aToken: UnicodeString): Boolean; +var + First, Last, I, Compare: Integer; + Token: UnicodeString; +begin + First := 0; + Last := FSecondKeys.Count - 1; + Result := False; + Token := SynWideUpperCase(aToken); + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := WideCompareStr(FSecondKeys[i], Token); + if Compare = 0 then + begin + Result := True; + Break; + end + else if Compare < 0 then + First := I + 1 + else + Last := I - 1; + end; +end; { IsSecondKeyWord } + +constructor TSynRubySyn.Create(AOwner: TComponent); +var + i: Integer; +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FKeyWords := TUnicodeStringList.Create; + TUnicodeStringList(FKeyWords).Sorted := True; + TUnicodeStringList(FKeyWords).Duplicates := dupIgnore; + FSecondKeys := TUnicodeStringList.Create; + TUnicodeStringList(FSecondKeys).Sorted := True; + TUnicodeStringList(FSecondKeys).Duplicates := dupIgnore; + if not (csDesigning in ComponentState) then + for i := 1 to RubyKeysCount do + FKeyWords.Add(RubyKeys[i]); + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clMaroon; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Foreground := clBlue; + AddAttribute(FKeyAttri); + FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + AddAttribute(FSecondKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clGreen; + 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.Foreground := clBlue; + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + + FRange := rsUnknown; + FDefaultFilter := SYNS_FilterRuby; +end; { Create } + +destructor TSynRubySyn.Destroy; +begin + FKeyWords.Free; + FSecondKeys.Free; + inherited Destroy; +end; { Destroy } + +procedure TSynRubySyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynRubySyn.PointCommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynRubySyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: + Inc(Run, 2); + else + Inc(Run); + end; +end; + +procedure TSynRubySyn.IdentProc; +begin + while IsIdentChar(FLine[Run]) do Inc(Run); + if IsKeyWord(GetToken) then + begin + FTokenID := tkKey; + Exit; + end + else FTokenID := tkIdentifier; + if IsSecondKeyWord(GetToken) then + FTokenID := tkSecondKey + else + FTokenID := tkIdentifier; +end; + +procedure TSynRubySyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynRubySyn.LowerProc; +{$IFDEF SYN_HEREDOC} +var + i, Len, SkipRun: Integer; + IndentedHeredoc: Boolean; + QuoteChar: WideChar; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + if FLine[Run + 1] = '<' then + begin + FTokenID := tkSymbol; + + SkipRun := 0; + QuoteChar := #0; + if (FLine[Run + 2] = '-') and (FLine[Run + 3] in + [WideChar('"'), WideChar(''''), WideChar('`')]) then + begin + SkipRun := 2; + QuoteChar := FLine[Run + 3]; + end + else + if (FLine[Run + 2] in [WideChar('-'), WideChar('"'), WideChar(''''), WideChar('`')]) then + begin + SkipRun := 1; + if FLine[Run + 2] <> '-' then + QuoteChar := FLine[Run + 2]; + end; + IndentedHeredoc := (SkipRun > 0) and (FLine[Run + 2] = '-'); + + if IsIdentChar(FLine[Run + SkipRun + 2]) then + begin + Inc(Run, 2); + + i := Run; + while IsIdentChar(FLine[SkipRun + i]) do Inc(i); + Len := i - Run; + + if Len > 255 then + begin + FTokenID := tkUnknown; + Exit; + end; + + if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then + begin + FTokenID := tkUnknown; + Exit; + end; + + if IndentedHeredoc then + FRange := rsIndentedHeredoc + else + FRange := rsHeredoc; + FHeredocLength := Len; + FHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); + + Inc(Run, SkipRun + Len); + FTokenID := tkString; + end + else + Inc(Run, 2); + end + else +{$ENDIF} + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynRubySyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynRubySyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case fLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynRubySyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynRubySyn.SlashProc; +begin + case FLine[Run] of + '/': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + '*': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + begin + FTokenID := tkComment; + while FLine[Run] <> #0 do + begin + case FLine[Run] of + #10, #13: + Break; + end; + Inc(Run); + end; + end; + end; +end; + +procedure TSynRubySyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynRubySyn.StringProc; +var + QuoteChar: WideChar; +begin +// Ha, ha, Strings in Ruby (could be anything)!!!! + +//There are three more ways to construct string literals: %q, %Q, and ``here +//documents.'' +// +//%q and %Q start delimited single- and double-quoted strings. +// +//%q/general single-quoted string/ » general single-quoted string +//%Q!general double-quoted string! » general double-quoted string +//%Q{Seconds/day: #{24*60*60}} » Seconds/day: 86400 +// +//The character following the ``q'' or ``Q'' is the delimiter. If it is an +//opening bracket, brace, parenthesis, or less-than sign, the string is read +//until the matching close symbol is found. Otherwise the string is read until +//the next occurrence of the same delimiter. + + FTokenID := tkString; + QuoteChar := FLine[Run]; // either " or ' + if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) + then Inc(Run, 2); + repeat + case FLine[Run] of + #0, #10, #13: + Break; + end; + Inc(Run); + until FLine[Run] = QuoteChar; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynRubySyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +{$IFDEF SYN_HEREDOC} +procedure TSynRubySyn.HeredocProc; + + procedure SkipToEOL; + begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + repeat + Inc(Run); + until IsLineEnd(Run); + end; + end; + +var + i : Integer; +begin + if IsLineEnd(Run) and (FTokenPos = Run) then + begin + NextProcedure; + Exit; + end; + FTokenID := tkString; + + if FRange = rsIndentedHeredoc then + while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); + + if ((Run = 0) and (FRange = rsHeredoc)) or (FRange = rsIndentedHeredoc) then + begin + i := 0; + + while not IsLineEnd(FLine[Run + i]) do + begin + if i > FHeredocLength then + begin + SkipToEOL; + Exit; + end; + Inc(i); + end; + + if i <> FHeredocLength then + begin + SkipToEOL; + Exit; + end; + + if (CalcFCS(FLine[Run], i) = FHeredocChecksum) then + begin + FRange := rsUnknown; + Run := Run + i; + Exit; + end; + end; + + SkipToEOL; +end; +{$ENDIF} + +procedure TSynRubySyn.Next; +begin + FTokenPos := Run; +{$IFDEF SYN_HEREDOC} + if FRange in [rsHeredoc, rsIndentedHeredoc] then + HeredocProc + else +{$ENDIF} + NextProcedure; + inherited; +end; + +procedure TSynRubySyn.NextProcedure; +begin + case fLine[Run] of + '<': LowerProc; + '#': SlashProc; + '{': BraceOpenProc; + ';': PointCommaProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + '(': RoundOpenProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #34, #39: StringProc; + else UnknownProc; + end; +end; + +function TSynRubySyn.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 TSynRubySyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynRubySyn.GetRange: Pointer; +{$IFDEF SYN_HEREDOC} +var + RangePointer: TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer.Range := Ord(FRange); + RangePointer.Length := 0; + RangePointer.Checksum := 0; + if FRange in [rsHeredoc, rsIndentedHeredoc] then + begin + RangePointer.Length := FHeredocLength; + RangePointer.Checksum := FHeredocChecksum; + end; + Result := RangePointer.Ptr; +{$ELSE} + Result := Pointer(FRange); +{$ENDIF} +end; + +function TSynRubySyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynRubySyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkSecondKey: Result := FSecondKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynRubySyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynRubySyn.ResetRange; +begin + FRange := rsUnknown; +{$IFDEF SYN_HEREDOC} + FHeredocLength := 0; + FHeredocChecksum := 0; +{$ENDIF} +end; + +procedure TSynRubySyn.SetRange(Value: Pointer); +{$IFDEF SYN_HEREDOC} +var + RangePointer: TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer := TRangePointer(Value); + FRange := TRangeState(RangePointer.Range); + FHeredocLength := 0; + FHeredocChecksum := 0; + if FRange in [rsHeredoc, rsIndentedHeredoc] then + begin + FHeredocLength := RangePointer.Length; + FHeredocChecksum := RangePointer.Checksum; + end; +{$ELSE} + FRange := TRangeState(Value); +{$ENDIF} +end; + +procedure TSynRubySyn.SetSecondKeys(const Value: TUnicodeStrings); +var + i: Integer; +begin + if Value <> nil then + begin + Value.BeginUpdate; + for i := 0 to Value.Count - 1 do + Value[i] := SynWideUpperCase(Value[i]); + Value.EndUpdate; + end; + FSecondKeys.Assign(Value); + DefHighLightChange(nil); +end; + +function TSynRubySyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterRuby; +end; + +class function TSynRubySyn.GetLanguageName: string; +begin + Result := SYNS_LangRuby; +end; + +function TSynRubySyn.GetSampleSource: UnicodeString; +begin + Result := + '# Factorial'+#13#10+ + 'def fact(n)'+#13#10+ + ' if n == 0'+#13#10+ + ' 1'+#13#10+ + ' else'+#13#10+ + ' n * fact(n-1)'+#13#10+ + ' end'+#13#10+ + 'end'+#13#10+ + 'print fact(ARGV[0].to_i), "\n"'; +end; + +class function TSynRubySyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangRuby; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynRubySyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterSDD.pas b/Source/VCL/SynEdit/Source/SynHighlighterSDD.pas index 477e9f8a..39894022 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterSDD.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterSDD.pas @@ -1,707 +1,709 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterSDD.pas, released 2001-08-20. -The Initial Author of this file is Pieter Polak. -Unicode translation by Maël Hörz. -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: SynHighlighterSDD.pas,v 1.13.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -unit SynHighlighterSDD; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = ( - tkComment, - tkIdentifier, - tkKey, - tkDatatype, - tkNumber, - tkNull, - tkSpace, - tkSymbol, - tkUnknown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TRangeState = (rsComment, rsUnKnown); - -type - TSynSDDSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..36] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fDatatypeAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncArray(Index: Integer): TtkTokenKind; - function FuncBinarydata(Index: Integer): TtkTokenKind; - function FuncBlock(Index: Integer): TtkTokenKind; - function FuncByte(Index: Integer): TtkTokenKind; - function FuncDatabase(Index: Integer): TtkTokenKind; - function FuncDate(Index: Integer): TtkTokenKind; - function FuncEnd(Index: Integer): TtkTokenKind; - function FuncEndblock(Index: Integer): TtkTokenKind; - function FuncInteger(Index: Integer): TtkTokenKind; - function FuncKeys(Index: Integer): TtkTokenKind; - function FuncLongint(Index: Integer): TtkTokenKind; - function FuncMemotext(Index: Integer): TtkTokenKind; - function FuncObject(Index: Integer): TtkTokenKind; - function FuncObjects(Index: Integer): TtkTokenKind; - function FuncOf(Index: Integer): TtkTokenKind; - function FuncOwner(Index: Integer): TtkTokenKind; - function FuncPartition(Index: Integer): TtkTokenKind; - function FuncPartitions(Index: Integer): TtkTokenKind; - function FuncPrimary(Index: Integer): TtkTokenKind; - function FuncReal(Index: Integer): TtkTokenKind; - function FuncSecondary(Index: Integer): TtkTokenKind; - function FuncSpec(Index: Integer): TtkTokenKind; - function FuncString(Index: Integer): TtkTokenKind; - function FuncSuperblock(Index: Integer): TtkTokenKind; - function FuncSuperspec(Index: Integer): TtkTokenKind; - function FuncTime(Index: Integer): TtkTokenKind; - function FuncVar(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure BraceOpenProc; - procedure BraceCommentProc; - procedure NumberProc; - procedure CRProc; - procedure LFProc; - procedure IdentProc; - procedure NullProc; - procedure SpaceProc; - procedure UnknownProc; - procedure SymbolProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - function GetRange: Pointer; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property DatatypeAttri: TSynHighlighterAttributes read fDatatypeAttri write fDatatypeAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..26] of string = ( - 'array', 'binarydata', 'block', 'byte', 'database', 'date', 'end', - 'endblock', 'integer', 'keys', 'longint', 'memotext', 'object', 'objects', - 'of', 'owner', 'partition', 'partitions', 'primary', 'real', 'secondary', - 'spec', 'string', 'superblock', 'superspec', 'time', 'var' - ); - - KeyIndices: array[0..36] of Integer = ( - 8, 3, 18, 0, 25, 14, 16, 22, 5, 19, 10, 20, -1, -1, 2, 26, -1, 21, -1, 12, - 1, 17, 15, -1, 9, -1, 11, 7, -1, 4, 6, -1, 13, -1, -1, 24, 23 - ); - -{$Q-} -function TSynSDDSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 813 + Ord(Str^) * 168; - inc(Str); - end; - Result := Result mod 37; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynSDDSyn.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 TSynSDDSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[3] := FuncArray; - fIdentFuncTable[20] := FuncBinarydata; - fIdentFuncTable[14] := FuncBlock; - fIdentFuncTable[1] := FuncByte; - fIdentFuncTable[29] := FuncDatabase; - fIdentFuncTable[8] := FuncDate; - fIdentFuncTable[30] := FuncEnd; - fIdentFuncTable[27] := FuncEndblock; - fIdentFuncTable[0] := FuncInteger; - fIdentFuncTable[24] := FuncKeys; - fIdentFuncTable[10] := FuncLongint; - fIdentFuncTable[26] := FuncMemotext; - fIdentFuncTable[19] := FuncObject; - fIdentFuncTable[32] := FuncObjects; - fIdentFuncTable[5] := FuncOf; - fIdentFuncTable[22] := FuncOwner; - fIdentFuncTable[6] := FuncPartition; - fIdentFuncTable[21] := FuncPartitions; - fIdentFuncTable[2] := FuncPrimary; - fIdentFuncTable[9] := FuncReal; - fIdentFuncTable[11] := FuncSecondary; - fIdentFuncTable[17] := FuncSpec; - fIdentFuncTable[7] := FuncString; - fIdentFuncTable[36] := FuncSuperblock; - fIdentFuncTable[35] := FuncSuperspec; - fIdentFuncTable[4] := FuncTime; - fIdentFuncTable[15] := FuncVar; -end; - -function TSynSDDSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncArray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncBinarydata(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncBlock(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncByte(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncDatabase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncDate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncEnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncEndblock(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncInteger(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncKeys(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncLongint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncMemotext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncObject(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncObjects(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncOf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncOwner(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncPartition(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncPartitions(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncPrimary(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncReal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncSecondary(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncSpec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncString(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncSuperblock(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncSuperspec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncTime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkDatatype - else - Result := tkIdentifier; -end; - -function TSynSDDSyn.FuncVar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -constructor TSynSDDSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clNavy; - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - - fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - fKeyAttri.Foreground := clGreen; - AddAttribute(fKeyAttri); - - fDatatypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - fDatatypeAttri.Style := [fsBold]; - fDatatypeAttri.Foreground := clTeal; - AddAttribute(fDatatypeAttri); - - fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - - fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clBlue; - AddAttribute(fNumberAttri); - - fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterSDD; - fRange := rsUnknown; -end; { Create } - -procedure TSynSDDSyn.BraceOpenProc; -begin - fRange := rsComment; - BraceCommentProc; - fTokenID := tkComment; -end; { BraceOpenProc } - -procedure TSynSDDSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - Inc(Run); -end; { IdentProc } - -procedure TSynSDDSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; { NullProc } - -procedure TSynSDDSyn.SpaceProc; -begin - fTokenID := tkSpace; - repeat - inc(Run); - until not CharInSet(fLine[Run], [#1..#32]); -end; { SpaceProc } - -procedure TSynSDDSyn.BraceCommentProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - begin - fTokenID := tkComment; - repeat - if fLine[Run] = '}' then - begin - Inc(Run); - fRange := rsUnKnown; - Break; - end; - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; { BraceCommentProc } - -procedure TSynSDDSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; { UnknownProc } - -procedure TSynSDDSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: BraceCommentProc; - else - case fLine[Run] of - '{': BraceOpenProc; - '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': SymbolProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '0'..'9' : NumberProc; - #0: NullProc; - #1..#32: SpaceProc; - else UnknownProc; - end; - end; - inherited; -end; { Next } - -procedure TSynSDDSyn.CRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then - inc(Run); -end; { CRProc } - -procedure TSynSDDSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; { LFProc } - -function TSynSDDSyn.GetSampleSource: string; -begin - Result := '{ Semanta data dictionary }'#13#10 + - 'database Sample.001;'#13#10 + - 'owner = COAS;'#13#10 + - #13#10 + - 'objects'#13#10 + - ' Test = object'#13#10 + - ' Code : string[4];'#13#10 + - ' Name : string[80];'#13#10 + - ' end;'#13#10 + - 'keys'#13#10 + - ' primary Test.Index = [Code];'#13#10 + - 'end.'; -end; { GetSampleSource } - -function TSynSDDSyn.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_WHITESPACE: Result := fSpaceAttri; - SYN_ATTR_SYMBOL: Result := fSymbolAttri; - else - Result := nil; - end; -end; { GetDefaultAttribute } - -function TSynSDDSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; { GetEol } - -function TSynSDDSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; { GetTokenId } - -function TSynSDDSyn.GetTokenAttribute: TSynHighLighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkDatatype: Result := fDatatypeAttri; - tkSpace: Result := fSpaceAttri; - tkNumber: Result := fNumberAttri; - tkUnknown: Result := fIdentifierAttri; - tkSymbol: Result := fSymbolAttri; - else - Result := nil; - end; -end; { GetTokenAttribute } - -function TSynSDDSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; { GetTokenKind } - -procedure TSynSDDSyn.ResetRange; -begin - inherited; - fRange := rsUnknown; -end; { ResetRange } - -procedure TSynSDDSyn.SetRange(Value: Pointer); -begin - inherited; - fRange := TRangeState(Value); -end; { SetRange } - -function TSynSDDSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; { GetRange } - -class function TSynSDDSyn.GetLanguageName: string; -begin - Result := SYNS_LangSDD; -end; { GetLanguageName } - -procedure TSynSDDSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': if FLine[Run + 1] = '.' then - Break; - end; - inc(Run); - end; -end; { NumberProc } - -function TSynSDDSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterSDD; -end; { IsFilterStored } - -procedure TSynSDDSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -class function TSynSDDSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangSDD; -end; - -initialization - RegisterPlaceableHighlighter(TSynSDDSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterSDD.pas, released 2001-08-20. +The Initial Author of this file is Pieter Polak. +Unicode translation by Maël Hörz. +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: SynHighlighterSDD.pas,v 1.13.2.6 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} + +unit SynHighlighterSDD; + +{$I SynEdit.inc} + +interface + +uses + Windows, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkComment, + tkIdentifier, + tkKey, + tkDatatype, + tkNumber, + tkNull, + tkSpace, + tkSymbol, + tkUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TRangeState = (rsComment, rsUnknown); + +type + TSynSDDSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..36] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FDatatypeAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function FuncArray(Index: Integer): TtkTokenKind; + function FuncBinarydata(Index: Integer): TtkTokenKind; + function FuncBlock(Index: Integer): TtkTokenKind; + function FuncByte(Index: Integer): TtkTokenKind; + function FuncDatabase(Index: Integer): TtkTokenKind; + function FuncDate(Index: Integer): TtkTokenKind; + function FuncEnd(Index: Integer): TtkTokenKind; + function FuncEndblock(Index: Integer): TtkTokenKind; + function FuncInteger(Index: Integer): TtkTokenKind; + function FuncKeys(Index: Integer): TtkTokenKind; + function FuncLongint(Index: Integer): TtkTokenKind; + function FuncMemotext(Index: Integer): TtkTokenKind; + function FuncObject(Index: Integer): TtkTokenKind; + function FuncObjects(Index: Integer): TtkTokenKind; + function FuncOf(Index: Integer): TtkTokenKind; + function FuncOwner(Index: Integer): TtkTokenKind; + function FuncPartition(Index: Integer): TtkTokenKind; + function FuncPartitions(Index: Integer): TtkTokenKind; + function FuncPrimary(Index: Integer): TtkTokenKind; + function FuncReal(Index: Integer): TtkTokenKind; + function FuncSecondary(Index: Integer): TtkTokenKind; + function FuncSpec(Index: Integer): TtkTokenKind; + function FuncString(Index: Integer): TtkTokenKind; + function FuncSuperblock(Index: Integer): TtkTokenKind; + function FuncSuperspec(Index: Integer): TtkTokenKind; + function FuncTime(Index: Integer): TtkTokenKind; + function FuncVar(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure BraceOpenProc; + procedure BraceCommentProc; + procedure NumberProc; + procedure CRProc; + procedure LFProc; + procedure IdentProc; + procedure NullProc; + procedure SpaceProc; + procedure UnknownProc; + procedure SymbolProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property DatatypeAttri: TSynHighlighterAttributes read FDatatypeAttri write FDatatypeAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..26] of UnicodeString = ( + 'array', 'binarydata', 'block', 'byte', 'database', 'date', 'end', + 'endblock', 'integer', 'keys', 'longint', 'memotext', 'object', 'objects', + 'of', 'owner', 'partition', 'partitions', 'primary', 'real', 'secondary', + 'spec', 'string', 'superblock', 'superspec', 'time', 'var' + ); + + KeyIndices: array[0..36] of Integer = ( + 8, 3, 18, 0, 25, 14, 16, 22, 5, 19, 10, 20, -1, -1, 2, 26, -1, 21, -1, 12, + 1, 17, 15, -1, 9, -1, 11, 7, -1, 4, 6, -1, 13, -1, -1, 24, 23 + ); + +{$Q-} +function TSynSDDSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 813 + Ord(Str^) * 168; + Inc(Str); + end; + Result := Result mod 37; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynSDDSyn.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 TSynSDDSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[3] := FuncArray; + FIdentFuncTable[20] := FuncBinarydata; + FIdentFuncTable[14] := FuncBlock; + FIdentFuncTable[1] := FuncByte; + FIdentFuncTable[29] := FuncDatabase; + FIdentFuncTable[8] := FuncDate; + FIdentFuncTable[30] := FuncEnd; + FIdentFuncTable[27] := FuncEndblock; + FIdentFuncTable[0] := FuncInteger; + FIdentFuncTable[24] := FuncKeys; + FIdentFuncTable[10] := FuncLongint; + FIdentFuncTable[26] := FuncMemotext; + FIdentFuncTable[19] := FuncObject; + FIdentFuncTable[32] := FuncObjects; + FIdentFuncTable[5] := FuncOf; + FIdentFuncTable[22] := FuncOwner; + FIdentFuncTable[6] := FuncPartition; + FIdentFuncTable[21] := FuncPartitions; + FIdentFuncTable[2] := FuncPrimary; + FIdentFuncTable[9] := FuncReal; + FIdentFuncTable[11] := FuncSecondary; + FIdentFuncTable[17] := FuncSpec; + FIdentFuncTable[7] := FuncString; + FIdentFuncTable[36] := FuncSuperblock; + FIdentFuncTable[35] := FuncSuperspec; + FIdentFuncTable[4] := FuncTime; + FIdentFuncTable[15] := FuncVar; +end; + +function TSynSDDSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncArray(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncBinarydata(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncBlock(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncByte(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncDatabase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncDate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncEnd(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncEndblock(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncInteger(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncKeys(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncLongint(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncMemotext(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncObject(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncObjects(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncOf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncOwner(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncPartition(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncPartitions(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncPrimary(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncReal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncSecondary(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncSpec(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncString(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncSuperblock(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncSuperspec(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncTime(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkDatatype + else + Result := tkIdentifier; +end; + +function TSynSDDSyn.FuncVar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +constructor TSynSDDSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clNavy; + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + + FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + FKeyAttri.Foreground := clGreen; + AddAttribute(FKeyAttri); + + FDatatypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + FDatatypeAttri.Style := [fsBold]; + FDatatypeAttri.Foreground := clTeal; + AddAttribute(FDatatypeAttri); + + FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + + FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clBlue; + AddAttribute(FNumberAttri); + + FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterSDD; + FRange := rsUnknown; +end; { Create } + +procedure TSynSDDSyn.BraceOpenProc; +begin + FRange := rsComment; + BraceCommentProc; + FTokenID := tkComment; +end; { BraceOpenProc } + +procedure TSynSDDSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; { IdentProc } + +procedure TSynSDDSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; { NullProc } + +procedure TSynSDDSyn.SpaceProc; +begin + FTokenID := tkSpace; + repeat + Inc(Run); + until not CharInSet(FLine[Run], [#1..#32]); +end; { SpaceProc } + +procedure TSynSDDSyn.BraceCommentProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + FTokenID := tkComment; + repeat + if FLine[Run] = '}' then + begin + Inc(Run); + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; { BraceCommentProc } + +procedure TSynSDDSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; { UnknownProc } + +procedure TSynSDDSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: BraceCommentProc; + else + case FLine[Run] of + '{': BraceOpenProc; + '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': SymbolProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '0'..'9' : NumberProc; + #0: NullProc; + #1..#32: SpaceProc; + else UnknownProc; + end; + end; + inherited; +end; { Next } + +procedure TSynSDDSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; { CRProc } + +procedure TSynSDDSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; { LFProc } + +function TSynSDDSyn.GetSampleSource: UnicodeString; +begin + Result := '{ Semanta data dictionary }'#13#10 + + 'database Sample.001;'#13#10 + + 'owner = COAS;'#13#10 + + #13#10 + + 'objects'#13#10 + + ' Test = object'#13#10 + + ' Code : string[4];'#13#10 + + ' Name : string[80];'#13#10 + + ' end;'#13#10 + + 'keys'#13#10 + + ' primary Test.Index = [Code];'#13#10 + + 'end.'; +end; { GetSampleSource } + +function TSynSDDSyn.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_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; { GetDefaultAttribute } + +function TSynSDDSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; { GetEol } + +function TSynSDDSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; { GetTokenId } + +function TSynSDDSyn.GetTokenAttribute: TSynHighLighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkDatatype: Result := FDatatypeAttri; + tkSpace: Result := FSpaceAttri; + tkNumber: Result := FNumberAttri; + tkUnknown: Result := FIdentifierAttri; + tkSymbol: Result := FSymbolAttri; + else + Result := nil; + end; +end; { GetTokenAttribute } + +function TSynSDDSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; { GetTokenKind } + +procedure TSynSDDSyn.ResetRange; +begin + inherited; + FRange := rsUnknown; +end; { ResetRange } + +procedure TSynSDDSyn.SetRange(Value: Pointer); +begin + inherited; + FRange := TRangeState(Value); +end; { SetRange } + +function TSynSDDSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; { GetRange } + +class function TSynSDDSyn.GetLanguageName: string; +begin + Result := SYNS_LangSDD; +end; { GetLanguageName } + +procedure TSynSDDSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; { NumberProc } + +function TSynSDDSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterSDD; +end; { IsFilterStored } + +procedure TSynSDDSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +class function TSynSDDSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangSDD; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynSDDSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterSQL.pas b/Source/VCL/SynEdit/Source/SynHighlighterSQL.pas index fa34bde6..f6edbadb 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterSQL.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterSQL.pas @@ -1,2383 +1,2409 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterSQL.pas, released 2000-04-21. -The Original Code is based on the wmSQLSyn.pas and wmSybaseSyn.pas files from -the mwEdit component suite by Martin Waldenburg and other developers, the -Initial Author of these files is Willo van der Merwe. Initial Author of -SynHighlighterSQL.pas is Michael Hieke. -Portions created by Willo van der Merwe are Copyright 1999 Willo van der Merwe. -Portions created by Michael Hieke are Copyright 2000 Michael Hieke. -Unicode translation by Maël Hörz. -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: SynHighlighterSQL.pas,v 1.39.2.14 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(SQL highlighter for SynEdit with support for different dialects.) -@author(Michael Hieke) -@created(2000-04-21) -@lastmod(2000-11-16) -The SynHighlighterSQL implements a highlighter for SQL for the SynEdit projects. -Different SQL dialects can be selected via the Dialect property. -} - -unit SynHighlighterSQL; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - Generics.Collections, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkDatatype, tkDefaultPackage, tkException, - tkFunction, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, tkPLSQL, - tkSQLPlus, tkString, tkSymbol, tkTableName, tkUnknown, tkVariable, - tkConditionalComment, tkDelimitedIdentifier, tkProcName, tkConsoleOutput); - - TRangeState = (rsUnknown, rsComment, rsString, rsConditionalComment, rsConsoleOutput); - - TSQLDialect = (sqlStandard, sqlInterbase6, sqlMSSQL7, sqlMySQL, sqlOracle, - sqlSybase, sqlIngres, sqlMSSQL2K, sqlPostgres, sqlNexus, sqlInformix); - -type - TSynSQLSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fKeywords: TSynHashEntryList; - FProcNames: TStrings; - fTableNames: TStrings; - FTableDict: TDictionary; - fFunctionNames: TStrings; - fDialect: TSQLDialect; - fCommentAttri: TSynHighlighterAttributes; - fConditionalCommentAttri: TSynHighlighterAttributes; - fConsoleOutputAttri: TSynHighlighterAttributes; - fDataTypeAttri: TSynHighlighterAttributes; - fDefaultPackageAttri: TSynHighlighterAttributes; - fDelimitedIdentifierAttri: TSynHighlighterAttributes; - fExceptionAttri: TSynHighlighterAttributes; - fFunctionAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fPLSQLAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fSQLPlusAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fTableNameAttri: TSynHighlighterAttributes; - fProcNameAttri: TSynHighlighterAttributes; - fVariableAttri: TSynHighlighterAttributes; - function HashKey(Str: PWideChar): Integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure DoAddKeyword(AKeyword: string; AKind: integer); - procedure SetDialect(Value: TSQLDialect); - procedure SetTableNames(const Value: TStrings); - procedure SetFunctionNames(const Value: TStrings); - procedure PutFunctionNamesInKeywordList; - procedure FunctionNamesChanged(Sender: TObject); - procedure ProcNamesChanged(Sender: TObject); - procedure TableNamesChanged(Sender: TObject); - procedure InitializeKeywordLists; - procedure PutProcNamesInKeywordList; - procedure PutTableNamesInKeywordList; - procedure AndSymbolProc; - procedure AsciiCharProc; - procedure CRProc; - procedure EqualProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure HashProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure SlashProc; - procedure SpaceProc; - procedure QuoteProc; - procedure BacktickProc; - procedure BracketProc; - procedure SymbolProc; - procedure SymbolAssignProc; - procedure VariableProc; - procedure UnknownProc; - procedure AnsiCProc; - procedure SetProcNames(const Value: TStrings); - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetKeyWords(TokenKind: Integer): string; override; - function GetRange: Pointer; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenID: TtkTokenKind; - function GetTokenKind: Integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - function IsKeyword(const AKeyword: string): Boolean; override; - procedure Next; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property ConditionalCommentAttri: TSynHighlighterAttributes - read fConditionalCommentAttri write fConditionalCommentAttri; - property ConsoleOutputAttri: TSynHighlighterAttributes - read FConsoleOutputAttri write FConsoleOutputAttri; - property DataTypeAttri: TSynHighlighterAttributes read fDataTypeAttri - write fDataTypeAttri; - property DefaultPackageAttri: TSynHighlighterAttributes - read fDefaultPackageAttri write fDefaultPackageAttri; - property DelimitedIdentifierAttri: TSynHighlighterAttributes - read fDelimitedIdentifierAttri write fDelimitedIdentifierAttri; - property ExceptionAttri: TSynHighlighterAttributes read fExceptionAttri - write fExceptionAttri; - property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri - write fFunctionAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property PLSQLAttri: TSynHighlighterAttributes read fPLSQLAttri - write fPLSQLAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property SQLPlusAttri: TSynHighlighterAttributes read fSQLPlusAttri - write fSQLPlusAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property ProcNameAttri: TSynHighlighterAttributes read FProcNameAttri - write FProcNameAttri; - property TableNameAttri: TSynHighlighterAttributes read fTableNameAttri - write fTableNameAttri; - property ProcNames: TStrings read FProcNames write SetProcNames; - property TableNames: TStrings read fTableNames write SetTableNames; - property FunctionNames: TStrings read fFunctionNames write SetFunctionNames; - property VariableAttri: TSynHighlighterAttributes read fVariableAttri - write fVariableAttri; - property SQLDialect: TSQLDialect read fDialect write SetDialect - default sqlStandard; - end; - -implementation - -uses - SynEditStrConst; - -const -//---"Standard" (ANSI SQL keywords (Version 1, 2 and 3) (www.sql.org)----------- - StandardKW: string = - 'absolute,action,active,actor,add,after,alias,all,allocate,alter,' + - 'and,any,are,as,asc,ascending,assertion,async,at,attributes,auto,' + - 'base_name,before,begin,between,bit,bit_length,boolean,both,breadth,by,' + - 'cache,call,cascade,cascaded,case,cast,catalog,char_length,' + - 'character_length,check,coalesce,collate,collation,column,commit,' + - 'committed,completion,computed,conditional,connect,connection,constraint,' + - 'constraints,containing,convert,corresponding,count,create,cross,current,' + - 'current_date,current_path,current_time,current_timestamp,current_user,' + - 'cursor,cycle,data,database,date,day,deallocate,debug,declare,default,' + - 'deferrable,deferred,delete,depth,desc,descending,describe,descriptor,' + - 'destroy,diagnostics,dictionary,disconnect,distinct,do,domain,' + - 'drop,each,element,else,elseif,end,end-exec,entry_point,equals,escape,' + - 'except,exception,execute,exists,exit,external,extract,factor,false,' + - 'filter,first,for,foreign,from,full,function,general,generator,get,' + - 'global,grant,group,having,hold,hour,identity,if,ignore,immediate,in,' + - 'inactive,index,initially,inner,input,insensitive,insert,instead,' + - 'intersect,interval,into,is,isolation,join,key,last,leading,leave,left,' + - 'less,level,like,limit,list,local,loop,lower,match,merge,minute,modify,' + - 'month,names,national,natural,nchar,new,new_table,next,no,none,not,null,' + - 'nullif,object,octet_length,of,off,old,old_table,on,only,operation,' + - 'operator,operators,or,order,others,outer,output,overlaps,pad,' + - 'parameter,parameters,partial,password,path,pendant,plan,position,' + - 'postfix,prefix,preorder,prepare,preserve,primary,prior,private,' + - 'privileges,procedure,protected,read,recursive,ref,referencing,relative,' + - 'replace,resignal,restrict,retain,return,returns,revoke,right,role,' + - 'rollback,routine,row,rows,savepoint,schema,scroll,search,second,select,' + - 'sensitive,sequence,session,session_user,set,shadow,shared,signal,' + - 'similar,size,snapshot,some,space,sqlexception,sqlstate,sqlwarning,start,' + - 'state,structure,substring,suspend,symbol,system_user,table,temporary,' + - 'term,test,then,there,time,timestamp,timezone_hour,timezone_minute,to,' + - 'trailing,transaction,translate,translation,trigger,trim,true,tuple,type,' + - 'uncommitted,under,union,unique,unknown,update,upper,usage,user,using,' + - 'value,varchar,variable,varying,view,virtual,visible,wait,when,where,' + - 'while,with,without,work,write,year,zone'; - -//---Sybase keywords------------------------------------------------------------ - SybaseKW: string = - 'absolute,action,add,after,alias,all,allocate,alter,and,any,are,' + - 'arith_overflow,as,asc,assertion,async,at,authorization,avg,before,begin,' + - 'between,bit,bit_length,boolean,both,breadth,break,browse,bulk,by,call,' + - 'cascade,cascaded,case,cast,catalog,char,char_convert,char_length,' + - 'character,character_length,check,checkpoint,close,clustered,coalesce,' + - 'collate,collation,column,commit,completion,compute,confirm,' + - 'connect,connection,constraint,constraints,continue,controlrow,convert,' + - 'corresponding,count,create,cross,current,current_date,current_time,' + - 'current_timestamp,current_user,cursor,cycle,data,database,date,day,dbcc,' + - 'deallocate,dec,decimal,declare,default,deferrable,deferred,delete,depth,' + - 'desc,describe,descriptor,diagnostics,dictionary,dis,disconnect,distinct,' + - 'domain,double,drop,dummy,dump,each,else,elseif,en,end,endtran,equals,' + - 'errlvl,errordata,errorexit,escape,except,exception,exclusive,exec,' + - 'execute,exists,exit,exp_row_size,external,extract,false,fetch,' + - 'fillfactor,first,float,for,foreign,found,from,full,general,get,global,' + - 'go,goto,grant,group,having,holdlock,hour,identity,identity_gap,' + - 'identity_insert,identity_start,if,ignore,immediate,in,index,indicator,' + - 'initially,inner,input,insensitive,insert,install,int,integer,intersect,' + - 'interval,into,is,isolation,jar,join,key,kill,language,last,leading,' + - 'leave,left,less,level,like,limit,lineno,load,local,lock,loop,lower,' + - 'match,max,max_rows_per_page,min,minute,mirror,mirrorexit,modify,module,' + - 'month,names,national,natural,nchar,new,next,no,noholdlock,nonclustered,' + - 'none,not,null,nullif,numeric,numeric_truncation,object,' + - 'octet_length,of,off,offsets,oid,old,on,once,online,only,open,operation,' + - 'operators,option,or,order,others,outer,output,over,overlaps,pad,' + - 'parameters,partial,partition,pendant,perm,permanent,plan,position,' + - 'precision,preorder,prepare,preserve,primary,print,prior,private,' + - 'privileges,proc,procedure,processexit,protected,proxy_table,public,' + - 'quiesce,raiserror,read,readpast,readtext,real,reconfigure,recursive,' + - 'ref,reference,referencing,relative,remove,reorg,replace,replication,' + - 'reservepagegap,resignal,restrict,return,returns,revoke,right,role,' + - 'rollback,routine,row,rowcount,rows,rule,save,savepoint,schema,scroll,' + - 'search,second,section,select,sensitive,sequence,session_user,set,' + - 'setuser,shared,shutdown,signal,similar,size,smallint,some,space,sql,' + - 'sqlcode,sqlerror,sqlexception,sqlstate,statistics,stripe,structure,' + - 'substring,sum,syb_identity,syb_restree,system_user,table,temp,temporary,' + - 'test,textsize,then,there,time,timestamp,timezone_hour,timezone_minute,' + - 'to,trailing,tran,transaction,translate,translation,trigger,trim,true,' + - 'truncate,tsequal,type,under,union,unique,unknown,unpartition,update,' + - 'upper,usage,use,user,user_option,using,value,values,varchar,variable,' + - 'varying,view,virtual,visible,wait,waitfor,when,whenever,where,while,' + - 'with,without,work,write,writetext,year,zone'; - -//---Oracle--------------------------------------------------------------------- - // Oracle SQL keywords - OracleKW: string = - 'ACCESS,ACCESSED,ACCOUNT,ACTIVATE,ACTIVE_INSTANCE_COUNT,ADD,ADMIN,ADVISE,' + - 'AGENT,ALL,ALLOCATE,ALTER,ANALYZE,ANCILLARY,AND,ANY,AQ_TM_PROCESSES,' + - 'ARCHIVE_LAG_TARGET,ARCHIVELOG,AS,ASC,ASSOCIATE,ATTRIBUTES,AUDIT,' + - 'AUDIT_FILE_DEST,AUDIT_SYS_OPERATIONS,AUDIT_TRAIL,AUTHENTICATED,AUTHID,' + - 'AUTOALLOCATE,AUTOEXTEND,AUTOMATIC,BACKGROUND_CORE_DUMP,' + - 'BACKGROUND_DUMP_DEST,BACKUP,BACKUP_TAPE_IO_SLAVES,BECOME,BEFORE,' + - 'BEHALF,BETWEEN,BINDING,BITMAP,BITMAP_MERGE_AREA_SIZE,BLANK_TRIMMING,' + - 'BLOCK,BLOCKSIZE,BUFFER_POOL,BUFFER_POOL_KEEP,BUFFER_POOL_RECYCLE,BY,' + - 'CACHE,CANCEL,CASCADE,CAST,CATEGORY,CHAINED,CHANGE,CHARACTER,CHECK,' + - 'CHECKPOINT,CHILD,CHUNK,CIRCUITS,CLASS,CLONE,CLUSTER,CLUSTER_DATABASE,' + - 'CLUSTER_DATABASE_INSTANCES,CLUSTER_INTERCONNECTS,COALESCE,COBOL,' + - 'COLUMN,COLUMNS,COMMENT,COMMIT_POINT_STRENGTH,COMPATIBLE,COMPILE,' + - 'COMPLETE,COMPOSITE_LIMIT,COMPRESS,COMPUTE,CONNECT,' + - 'CONNECT_TIME,CONSIDER,CONSTRAINT,CONSTRAINTS,CONTENTS,CONTEXT,CONTINUE,' + - 'CONTROL,CONTROL_FILE_RECORD_KEEP_TIME,CONTROL_FILES,CONTROLFILE,' + - 'CORE_DUMP_DEST,COST,CPU_COUNT,CPU_PER_CALL,CPU_PER_SESSION,CREATE,' + - 'CREATE_BITMAP_AREA_SIZE,CREATE_STORED_OUTLINES,CURRENT,CURRENT_USER,' + - 'CURSOR_SHARING,CURSOR_SPACE_FOR_TIME,CYCLE,DANGLING,DATAFILE,' + - 'DB_BLOCK_BUFFERS,DB_BLOCK_CHECKING,DB_BLOCK_CHECKSUM,DB_BLOCK_SIZE,' + - 'DB_CACHE_ADVICE,DB_CACHE_SIZE,DB_CREATE_FILE_DEST,DB_DOMAIN,' + - 'DB_FILE_MULTIBLOCK_READ_COUNT,DB_FILE_NAME_CONVERT,DB_FILES,' + - 'DB_KEEP_CACHE_SIZE,DB_NAME,DB_RECYCLE_CACHE_SIZE,DB_WRITER_PROCESSES,' + - 'DBLINK_ENCRYPT_LOGIN,DBWR_IO_SLAVES,DEALLOCATE,DEBUG,DEFAULT,DEFERRED,' + - 'DEFINER,DELETE,DEMAND,DETERMINES,DG_BROKER_START,DICTIONARY,DIMENSION,' + - 'DIRECTORY,DISABLE,DISASSOCIATE,DISK_ASYNCH_IO,DISMOUNT,DISPATCHERS,' + - 'DISTINCT,DISTRIBUTED,DISTRIBUTED_LOCK_TIMEOUT,DML,DML_LOCKS,DOCUMENT,' + - 'DROP,DRS_START,ELSE,ENABLE,ENQUEUE_RESOURCES,ESCAPE,ESTIMATE,EVENT,' + - 'EVENTS,EXCEPT,EXCEPTIONS,EXCHANGE,EXCLUDING,EXCLUSIVE,EXISTS,EXPIRE,' + - 'EXPLAIN,EXTENT,EXTERNALLY,FAILED_LOGIN_ATTEMPTS,FAL_CLIENT,FAL_SERVER,' + - 'FAST,FAST_START_IO_TARGET,FAST_START_MTTR_TARGET,' + - 'FAST_START_PARALLEL_ROLLBACK,FILE,FILE_MAPPING,FILESYSTEMIO_OPTIONS,' + - 'FIXED_DATE,FLUSH,FOR,FORCE,FOREIGN,FORTRAN,FREELIST,FREELISTS,FRESH,' + - 'FROM,FROM_TZ,FUNCTIONS,FULL,GC_FILES_TO_LOCKS,GENERATED,GLOBAL,' + - 'GLOBAL_CONTEXT_POOL_SIZE,GLOBAL_NAME,GLOBAL_NAMES,GLOBALLY,GO,GRANT,' + - 'GROUP,GROUPS,HASH,HASH_AREA_SIZE,HASH_JOIN_ENABLED,HASHKEYS,HAVING,HEAP,' + - 'HI_SHARED_MEMORY_ADDRESS,HIERARCHY,HS_AUTOREGISTER,IDENTIFIED,IDLE_TIME,' + - 'IFILE,IMMEDIATE,IN,INCLUDING,INCREMENT,INDEX,INDEXTYPE,INDEXTYPES,' + - 'INFILE,INITIAL,INITIALIZED,INITIALLY,INITRANS,INSERT,INSTANCE,' + - 'INSTANCE_GROUPS,INSTANCE_NAME,INSTANCE_NUMBER,INT,INTERSECT,INTO,' + - 'INVALIDATE,IS,ISOLATION,JAVA,JAVA_MAX_SESSIONSPACE_SIZE,JAVA_POOL_SIZE,' + - 'JAVA_SOFT_SESSIONSPACE_LIMIT,JOB_QUEUE_PROCESSES,JOIN,KEEP,KEY,KILL,' + - 'LARGE_POOL_SIZE,LAYERLISTS,LEFT,LEVEL,LIBRARY,LICENSE_MAX_SESSIONS,' + - 'LICENSE_MAX_USERS,LICENSE_SESSIONS_WARNING,LIKE,LIMIT,LINK,LIST,LOB,' + - 'LOCAL,LOCAL_LISTENER,LOCATOR,LOCK,LOCK_NAME_SPACE,LOCK_SGA,' + - 'LOG_ARCHIVE_DEST,LOG_ARCHIVE_DUPLEX_DEST,LOG_ARCHIVE_FORMAT,' + - 'LOG_ARCHIVE_MAX_PROCESSES,LOG_ARCHIVE_MIN_SUCCEED_DEST,' + - 'LOG_ARCHIVE_START,LOG_ARCHIVE_TRACE,LOG_BUFFER,LOG_CHECKPOINT_INTERVAL,' + - 'LOG_CHECKPOINT_TIMEOUT,LOG_CHECKPOINTS_TO_ALERT,LOG_FILE_NAME_CONVERT,' + - 'LOG_PARALLELISM,LOGFILE,LOGGING,LOGICAL_READS_PER_CALL,' + - 'LOGICAL_READS_PER_SESSION,LOGMNR_MAX_PERSISTENT_SESSIONS,MANAGE,MANAGED,' + - 'MANAGEMENT,MANUAL,MAP,MASTER,MATCHED,MATERIALIZED,MAX_COMMIT_PROPAGATION_DELAY,' + - 'MAX_DISPATCHERS,MAX_DUMP_FILE_SIZE,MAX_ENABLED_ROLES,' + - 'MAX_ROLLBACK_SEGMENTS,MAX_SHARED_SERVERS,MAXDATAFILES,MAXEXTENTS,' + - 'MAXINSTANCES,MAXLOGFILES,MAXLOGHISTORY,MAXLOGMEMBERS,MAXSIZE,MAXTRANS,' + - 'MAXVALUE,MEMBER,MERGE,MINEXTENTS,MINIMIZE,MINIMUM,MINUS,MINVALUE,MODE,' + - 'MODIFY,MODULE,MONITORING,MOUNT,MOVE,MOVEMENT,MULTISET,NAMED,NATIONAL,' + - 'NESTED,NEVER,NEXT,NLS_CALENDAR,NLS_COMP,NLS_CURRENCY,NLS_DATE_FORMAT,' + - 'NLS_DATE_LANGUAGE,NLS_DUAL_CURRENCY,NLS_ISO_CURRENCY,NLS_LANGUAGE,' + - 'NLS_LENGTH_SEMANTICS,NLS_NCHAR_CONV_EXCP,NLS_NUMERIC_CHARACTERS,' + - 'NLS_TERRITORY,NLS_TIMESTAMP_FORMAT,NLS_TIMESTAMP_TZ_FORMAT,NO,' + - 'NOARCHIVELOG,NOAUDIT,NOCACHE,NOCOMPRESS,NOCOPY,NOCYCLE,NOFORCE,' + - 'NOLOGGING,NOMAXVALUE,NOMINIMIZE,NOMINVALUE,NOMONITORING,NOMOUNT,NONE,' + - 'NOORDER,NORELY,NORESETLOGS,NOREVERSE,NORMAL,NOROWDEPENDENCIES,NOSORT,' + - 'NOT,NOTHING,NOVALIDATE,NOWAIT,NULL,O7_DICTIONARY_ACCESSIBILITY,' + - 'OBJECT_CACHE_MAX_SIZE_PERCENT,OBJECT_CACHE_OPTIMAL_SIZE,OF,OFFLINE,OID,' + - 'OLAP_PAGE_POOL_SIZE,ON,ONLINE,ONLY,OPEN_CURSORS,OPEN_LINKS,' + - 'OPEN_LINKS_PER_INSTANCE,OPERATOR,OPTIMAL,OPTIMIZER_DYNAMIC_SAMPLING,' + - 'OPTIMIZER_FEATURES_ENABLE,OPTIMIZER_INDEX_CACHING,' + - 'OPTIMIZER_INDEX_COST_ADJ,OPTIMIZER_MAX_PERMUTATIONS,OPTIMIZER_MODE,' + - 'OPTION,OR,ORACLE_TRACE_COLLECTION_NAME,ORACLE_TRACE_COLLECTION_PATH,' + - 'ORACLE_TRACE_COLLECTION_SIZE,ORACLE_TRACE_ENABLE,' + - 'ORACLE_TRACE_FACILITY_NAME,ORACLE_TRACE_FACILITY_PATH,ORDER,' + - 'OS_AUTHENT_PREFIX,OS_ROLES,OUTER,OUTLINE,OVERFLOW,OWN,PACKAGES,PARALLEL,' + - 'PARALLEL_ADAPTIVE_MULTI_USER,PARALLEL_AUTOMATIC_TUNING,' + - 'PARALLEL_EXECUTION_MESSAGE_SIZE,PARALLEL_INSTANCE_GROUP,' + - 'PARALLEL_MAX_SERVERS,PARALLEL_MIN_PERCENT,PARALLEL_MIN_SERVERS,' + - 'PARALLEL_THREADS_PER_CPU,PARAMETERS,PARTITION_VIEW_ENABLED,PARTITIONS,' + - 'PASSWORD,PASSWORD_GRACE_TIME,PASSWORD_LIFE_TIME,PASSWORD_LOCK_TIME,' + - 'PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME,PASSWORD_VERIFY_FUNCTION,' + - 'PCTFREE,PCTINCREASE,PCTTHRESHOLD,PCTUSED,PCTVERSION,PERCENT,PERMANENT,' + - 'PGA_AGGREGATE_TARGET,PIPELINED,PLAN,PLI,PLSQL_COMPILER_FLAGS,' + - 'PLSQL_NATIVE_C_COMPILER,PLSQL_NATIVE_LIBRARY_DIR,' + - 'PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT,PLSQL_NATIVE_LINKER,' + - 'PLSQL_NATIVE_MAKE_FILE_NAME,PLSQL_NATIVE_MAKE_UTILITY,' + - 'PLSQL_V2_COMPATIBILITY,POST_TRANSACTION,PRE_PAGE_SGA,PREBUILD,PRECISION,' + - 'PRIMARY,PRIOR,PRIVATE_SGA,PRIVILEGES,PROCESSES,PROFILE,PUBLIC,QUERY,' + - 'QUERY_REWRITE_ENABLED,QUERY_REWRITE_INTEGRITY,QUIESCE,QUOTA,' + - 'RDBMS_SERVER_DN,READ,READ_ONLY_OPEN_DELAYED,REBUILD,RECORDS_PER_BLOCK,' + - 'RECOVER,RECOVERABLE,RECOVERY,RECOVERY_PARALLELISM,RECYCLE,RECYCLEBIN,REDUCED,' + - 'REFERENCES,REFRESH,REGISTER,RELY,REMOTE_ARCHIVE_ENABLE,' + - 'REMOTE_DEPENDENCIES_MODE,REMOTE_LISTENER,REMOTE_LOGIN_PASSWORDFILE,' + - 'REMOTE_OS_AUTHENT,REMOTE_OS_ROLES,RENAME,' + - 'REPLICATION_DEPENDENCY_TRACKING,RESET,RESETLOGS,RESIZE,RESOLVE,RESOLVER,' + - 'RESOURCE,RESOURCE_LIMIT,RESOURCE_MANAGER_PLAN,RESTRICT,RESTRICTED,' + - 'RESUMABLE,RESUME,REUSE,REVOKE,REWRITE,RIGHT,RNDS,RNPS,ROLE,ROLES,' + - 'ROLLBACK_SEGMENTS,ROW,ROW_LOCKING,ROWDEPENDENCIES,ROWLABEL,ROWNUM,' + - 'ROWS,SAMPLE,SCN,SCOPE,SECTION,SEGMENT,SELECT,SELECTIVITY,SEQUENCE,' + - 'SERIAL_REUSE,SERVICE_NAMES,SESSION,SESSION_CACHED_CURSORS,' + - 'SESSION_MAX_OPEN_FILES,SESSIONS,SESSIONS_PER_USER,SGA_MAX_SIZE,' + - 'SHADOW_CORE_DUMP,SHARE,SHARED,SHARED_MEMORY_ADDRESS,SHARED_POOL,' + - 'SHARED_POOL_RESERVED_SIZE,SHARED_POOL_SIZE,SHARED_SERVER_SESSIONS,' + - 'SHARED_SERVERS,SHRINK,SIZE,SNAPSHOT,SOME,SORT,SORT_AREA_RETAINED_SIZE,' + - 'SORT_AREA_SIZE,SOURCE,SPECIFICATION,SPECIFIED,SPFILE,SPLIT,SQL_TRACE,' + - 'SQL92_SECURITY,STANDBY,STANDBY_ARCHIVE_DEST,STANDBY_FILE_MANAGEMENT,' + - 'STAR_TRANSFORMATION_ENABLED,START,START_DATE,STATIC,STATISTICS,' + - 'STATISTICS_LEVEL,STOP,STORAGE,STRUCTURE,SUBPARTITION,SUBPARTITIONS,' + - 'SUCCESSFUL,SUSPEND,SWITCH,SYNONYM,SYSTEM,TABLE,TABLESPACE,' + - 'TAPE_ASYNCH_IO,TEMPFILE,TEMPORARY,THE,THEN,THREAD,THROUGH,TIME,' + - 'TIMED_OS_STATISTICS,TIMED_STATISTICS,TIMEOUT,TO,TRACE_ENABLED,' + - 'TRACEFILE_IDENTIFIER,TRACING,TRANSACTION,TRANSACTION_AUDITING,' + - 'TRANSACTIONS,TRANSACTIONS_PER_ROLLBACK_SEGMENT,TRIGGER,TRUNCATE,TRUST,' + - 'TYPES,UNARCHIVED,UNDER,UNDO,UNDO_MANAGEMENT,UNDO_RETENTION,' + - 'UNDO_SUPPRESS_ERRORS,UNDO_TABLESPACE,UNIFORM,UNION,UNIQUE,UNLIMITED,' + - 'UNLOCK,UNQUIESCE,UNRECOVERABLE,UNTIL,UNUSABLE,UNUSED,UPDATE,USAGE,' + - 'USE_INDIRECT_DATA_BUFFERS,USER_DUMP_DEST,VALIDATE,VALIDATION,VALUES,' + - 'VARGRAPHIC,VARRAY,VIEW,WHERE,WITH,WITHOUT,WNDS,WNPS,' + - 'WORKAREA_SIZE_POLICY'; - -//---Postgresql----------------------------------------------------------------- - //Postgresql Keywords - PostgresKW: string = - 'IF,LOOP,ABORT,ABSOLUTE,ACCESS,ACTION,ADA,ADD,ADMIN,AFTER,AGGREGATE,ALIAS' + - ',ALLOCATE,ALTER,ANALYSE,ANALYZE,AND,ARE,AS,ASC,ASENSITIVE' + - ',ASSERTION,ASSIGNMENT,ASYMMETRIC,AT,ATOMIC,AUTHORIZATION,BACKWARD' + - ',BEFORE,BEGIN,BETWEEN' + - ',BOTH,BREADTH,BY,C,CACHE,CALL,CALLED,CARDINALITY,CASCADE,CASCADED,CASE' + - ',CAST,CATALOG,CATALOG_NAME,CHAIN,CHARACTERISTICS' + - ',CHARACTER_SET_CATALOG,CHARACTER_SET_NAME,CHARACTER_SET_SCHEMA' + - ',CHECK,CHECKED,CHECKPOINT,CLASS,CLASS_ORIGIN,CLOB,CLOSE,CLUSTER,COBOL,COLLATE' + - ',COLLATION,COLLATION_CATALOG,COLLATION_NAME,COLLATION_SCHEMA,COLUMN,COLUMN_NAME' + - ',COMMAND_Function,COMMAND_Function_CODE,COMMENT,COMMIT,COMMITTED,COMPLETION' + - ',CONDITION_NUMBER,CONNECT,CONNECTION,CONNECTION_NAME,CONSTRAINT,CONSTRAINTS' + - ',CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,CONSTRUCTOR,CONTAINS' + - ',CONTINUE,CONVERSION,COPY,CORRESPONDING,CREATE,CREATEDB,CREATEUSER' + - ',CROSS,CUBE,CURRENT,CURRENT_PATH,CURRENT_ROLE' + - ',CURSOR,CURSOR_NAME,CYCLE,DATA,DATABASE,DATETIME_INTERVAL_CODE' + - ',DATETIME_INTERVAL_PRECISION,DAY,DEALLOCATE,DEC,DECLARE,DEFAULT,DEFERRABLE' + - ',DEFERRED,DEFINED,DEFINER,DELETE,DELIMITER,DELIMITERS,DEPTH,DEREF,DESC,DESCRIBE' + - ',DESCRIPTOR,DESTROY,DESTRUCTOR,DETERMINISTIC,DIAGNOSTICS,DICTIONARY,DISCONNECT' + - ',DISPATCH,DISTINCT,DO,DOMAIN,DROP,DYNAMIC,DYNAMIC_Function,DYNAMIC_Function_CODE' + - ',EACH,ELSE,ELSIF,ELSEIF,ENCODING,ENCRYPTED,END,EQUALS,ESCAPE,EXCEPT,EXCEPTION' + - ',EXCLUSIVE,EXEC,EXECUTE,EXISTING,EXPLAIN,EXTERNAL,FALSE,FETCH' + - ',FINAL,FIRST,FOR,FORCE,FOREIGN,FORTRAN,FORWARD,FOUND,FREE,FREEZE,FROM' + - ',FULL,Function,G,GENERAL,GENERATED,GET,GLOBAL,GO,GOTO,GRANT,GRANTED,GROUP' + - ',GROUPING,HANDLER,HAVING,HIERARCHY,HOLD,HOUR,IDENTITY,IGNORE,ILIKE' + - ',IMMEDIATE,IMMUTABLE,IMPLEMENTATION,IMPLICIT,INCREMENT,INDEX,INDICATOR' + - ',INFIX,INHERITS,INITIALIZE,INITIALLY,INNER,INOUT,INPUT,INSENSITIVE,INSERT' + - ',INSTANCE,INSTANTIABLE,INSTEAD,INT,INTERSECT,INTO,INVOKER' + - ',IS,ISNULL,ISOLATION,ITERATE,JOIN,K,KEY,KEY_MEMBER,KEY_TYPE,LANCOMPILER,LANGUAGE' + - ',LARGE,LAST,LATERAL,LEADING,LEFT,LESS,LEVEL,LIKE,LIMIT,LISTEN,LOAD,LOCAL' + - ' LOCATION,LOCATOR,LOCK,M,MAP,MATCH,MAXVALUE,MESSAGE_LENGTH' + - ',MESSAGE_OCTET_LENGTH,MESSAGE_TEXT,METHOD,MINUTE,MINVALUE,MODE,MODIFIES' + - ',MODIFY,MODULE,MONTH,MORE,MOVE,MUMPS,NAME,NAMES,NATIONAL,NATURAL,NCHAR,NCLOB' + - ',NEW,NEXT,NO,NOCREATEDB,NOCREATEUSER,NONE,NOT,NOTHING,NOTIFY,NOTNULL,NULL,NULLABLE' + - ',NUMBER,OBJECT,OF,OFF,OFFSET,OIDS,OLD,ON,ONLY,OPEN' + - ',OPERATION,Operator,OPTION,OPTIONS,OR,ORDER,ORDINALITY,OUT,OUTER,OUTPUT,OVERLAPS' + - ',OVERRIDING,OWNER,PAD,PARAMETER,PARAMETERS,PARAMETER_MODE,PARAMETER_NAME,PARAMETER_ORDINAL_POSITION' + - ',PARAMETER_SPECIFIC_CATALOG,PARAMETER_SPECIFIC_NAME,PARAMETER_SPECIFIC_SCHEMA,PARTIAL,PASCAL,PASSWORD' + - ',PENDANT,PLACING,PLI,POSTFIX,PRECISION,PREFIX,PREORDER,PREPARE,PRESERVE,PRIMARY' + - ',PRIOR,PRIVILEGES,PROCEDURAL,PROCEDURE,PUBLIC,READ,READS,RECHECK,RECURSIVE,REF,REFERENCES' + - ',REFERENCING,REINDEX,RELATIVE,RENAME ,REPEATABLE,RESET,RESTRICT,RESULT,RETURN,RETURNED_LENGTH' + - ',RETURNED_OCTET_LENGTH,RETURNED_SQLSTATE,RETURNS,REVOKE,RIGHT,ROLE,ROLLBACK,ROLLUP,ROUTINE,ROUTINE_CATALOG' + - ',ROUTINE_NAME,ROUTINE_SCHEMA,ROW,ROWS,ROW_COUNT,RULE,SAVEPOINT,SCALE,SCHEMA,SCHEMA_NAME' + - ',SCOPE,SCROLL,SEARCH,SECOND,SECTION,SECURITY,SELECT,SELF,SENSITIVE,SEQUENCE,SERIALIZABLE,SERVER_NAME' + - ',SESSION,SET,SETOF,SETS,SHARE,SHOW,SIMILAR,SIMPLE,SIZE,SOURCE,SPACE' + - ',SPECIFIC,SPECIFICTYPE,SPECIFIC_NAME,SQLCODE,SQLERROR,SQLEXCEPTION,SQLSTATE,SQLWARNING' + - ',STABLE,START,STATE,STATEMENT,STATIC,STATISTICS,STDIN,STDOUT,STORAGE,STRICT,STRUCTURE' + - ',STYLE,SUBCLASS_ORIGIN,SUBLIST,SYMMETRIC,SYSID,SYSTEM,SYSTEM_USER,TABLE' + - ',TABLE_NAME,TEMP,TEMPLATE,TEMPORARY,TERMINATE,THAN,THEN,TIMEZONE_HOUR' + - ',TIMEZONE_MINUTE,TO,TOAST,TRAILING,TRANSACTION,TRANSACTIONS_COMMITTED,TRANSACTIONS_ROLLED_BACK' + - ',TRANSACTION_ACTIVE,TRANSFORM,TRANSFORMS,TRANSLATION,TREAT,TRIGGER_CATALOG' + - ',TRIGGER_NAME,TRIGGER_SCHEMA,TRUE,TRUNCATE,TRUSTED,TYPE,UNCOMMITTED,UNDER,UNENCRYPTED,UNION'+ - ',UNIQUE,UNKNOWN,UNLISTEN,UNNAMED,UNNEST,UNTIL,UPDATE,USAGE,USER_DEFINED_TYPE_CATALOG' + - ',USER_DEFINED_TYPE_NAME,USER_DEFINED_TYPE_SCHEMA,USING,VACUUM,VALID,VALIDATOR,VALUE,VALUES' + - ',VARIABLE,VARYING,VERBOSE,VIEW,VOLATILE,WHEN,WHENEVER,WHERE,WITH,WITHOUT,WORK,WRITE,YEAR,ZONE'; - - //Postgresql Functions - PostgresFunctions: string = - 'abs,cbrt,ceil,ceiling,degrees,exp,floor,ln,log,mod,pi,power,radians,random,'+ - 'round,setseed,sign,sqrt,trunc,width_bucket,acos,asin,atan,atan2,cos,cot,'+ - 'sin,tan,bit_length,char_length,character_length,convert,lower,octet_length,'+ - 'overlay,position,substring,trim,upper,ascii,btrim,chr,decode,'+ - 'encode,initcap,length,lpad,ltrim,md5,pg_client_encoding,quote_ident,quote_literal,'+ - 'replace,rpad,rtrim,split_part,strpos,substr,to_ascii,to_hex,translate,get_byte,'+ - 'set_byte,get_bit,set_bit,to_char,to_date,'+ - 'to_timestamp,to_number,age,date_part,date_trunc,extract,now,'+ - 'timeofday,isfinite,area,box_intersect,center,diameter,height,isclosed,isopen,'+ - 'npoints,pclose,popen,radius,width,'+ - 'broadcast,'+ - 'host,masklen,set_masklen,netmask,hostmask,network,abbrev,family,nextval,'+ - 'currval,setval,coalesce,nullif,array_cat ,array_append ,array_prepend ,array_dims,'+ - 'array_lower ,array_upper ,array_to_string ,string_to_array ,avg,bit_and,bit_or,bool_and,'+ - 'bool_or,count,every,max,min,stddev,sum,variance,exists ,in ,some,'+ - 'all ,generate_series,current_database,current_schema,'+ - 'current_schemas,,inet_client_addr,inet_client_port,inet_server_addr,inet_server_port,'+ - 'version,has_table_privilege,has_database_privilege,'+ - 'has_function_privilege,has_language_privilege,'+ - 'has_schema_privilege,has_tablespace_privilege,'+ - 'pg_table_is_visible,pg_type_is_visible,pg_function_is_visible,pg_operator_is_visible,'+ - 'pg_opclass_is_visible,pg_conversion_is_visible,format_type,pg_get_viewdef,'+ - 'pg_get_ruledef,pg_get_indexdef,'+ - 'pg_get_triggerdef,pg_get_constraintdef,pg_get_expr,'+ - 'pg_get_userbyid,pg_get_serial_sequence,pg_tablespace_databases,obj_description,'+ - 'col_description,current_setting,set_config,pg_cancel_backend,pg_start_backup,pg_stop_backup,'+ - 'current_user,current_date,current_time,current_timestamp,localtime,localtimestamp,session_user,user'; - - //Postgresql Types - PostgresTypes: string = - 'smallint,integer,bigint,decimal,numeric,real,double,serial,bigserial,'+ - 'character,varchar,char,text,bytea,timestamp, interval,date,'+ - 'time,boolean,point,line,lseg,box,path,polygon,circle,cidr,inet,'+ - 'macaddr,BIT,bitvar,ARRAY,oid,regproc,regprocedure,regoper,regoperator,regclass,'+ - 'regtype,any,anyarray,anyelement,cstring,internal,language_handler,record,'+ - 'trigger,void,opaque,refcursor,binary,blob,int4,int2,int8,float,float4,float8'; - - //Postgresql Exceptions - PostgresExceptions: string = - '$BODY$,SUCCESSFUL_COMPLETION,WARNING,DYNAMIC_RESULT_SETS_RETURNED,IMPLICIT_ZERO_BIT_PADDING,NULL_VALUE_ELIMINATED_IN_SET_FUNCTION,'+ - 'PRIVILEGE_NOT_GRANTED,PRIVILEGE_NOT_REVOKED,STRING_DATA_RIGHT_TRUNCATION,DEPRECATED_FEATURE,NO_DATA,NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED,'+ - 'SQL_STATEMENT_NOT_YET_COMPLETE,CONNECTION_EXCEPTION,CONNECTION_DOES_NOT_EXIST,CONNECTION_FAILURE,SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,'+ - 'SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION,TRANSACTION_RESOLUTION_UNKNOWN,PROTOCOL_VIOLATION,TRIGGERED_ACTION_EXCEPTION,'+ - 'FEATURE_NOT_SUPPORTED,INVALID_TRANSACTION_INITIATION,LOCATOR_EXCEPTION,INVALID_LOCATOR_SPECIFICATION,INVALID_GRANTOR,INVALID_GRANT_OPERATION,'+ - 'INVALID_ROLE_SPECIFICATION,CARDINALITY_VIOLATION,DATA_EXCEPTION,ARRAY_SUBSCRIPT_ERROR,CHARACTER_NOT_IN_REPERTOIRE,DATETIME_FIELD_OVERFLOW,'+ - 'DIVISION_BY_ZERO,ERROR_IN_ASSIGNMENT,ESCAPE_CHARACTER_CONFLICT,INDICATOR_OVERFLOW,INTERVAL_FIELD_OVERFLOW,INVALID_ARGUMENT_FOR_LOGARITHM,'+ - 'INVALID_ARGUMENT_FOR_POWER_FUNCTION,INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION,INVALID_CHARACTER_VALUE_FOR_CAST,INVALID_DATETIME_FORMAT,'+ - 'INVALID_ESCAPE_CHARACTER,INVALID_ESCAPE_OCTET,INVALID_ESCAPE_SEQUENCE,INVALID_INDICATOR_PARAMETER_VALUE,INVALID_LIMIT_VALUE,'+ - 'INVALID_PARAMETER_VALUE,INVALID_REGULAR_EXPRESSION,INVALID_TIME_ZONE_DISPLACEMENT_VALUE,INVALID_USE_OF_ESCAPE_CHARACTER,'+ - 'MOST_SPECIFIC_TYPE_MISMATCH,NULL_VALUE_NOT_ALLOWED,NULL_VALUE_NO_INDICATOR_PARAMETER,NUMERIC_VALUE_OUT_OF_RANGE,STRING_DATA_LENGTH_MISMATCH,'+ - 'SUBSTRING_ERROR,TRIM_ERROR,UNTERMINATED_C_STRING,ZERO_LENGTH_CHARACTER_STRING,FLOATING_POINT_EXCEPTION,'+ - 'INVALID_TEXT_REPRESENTATION,INVALID_BINARY_REPRESENTATION,BAD_COPY_FILE_FORMAT,UNTRANSLATABLE_CHARACTER,INTEGRITY_CONSTRAINT_VIOLATION,'+ - 'RESTRICT_VIOLATION,NOT_NULL_VIOLATION,FOREIGN_KEY_VIOLATION,UNIQUE_VIOLATION,CHECK_VIOLATION,INVALID_CURSOR_STATE,INVALID_TRANSACTION_STATE,'+ - 'ACTIVE_SQL_TRANSACTION,BRANCH_TRANSACTION_ALREADY_ACTIVE,HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL,INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION,'+ - 'INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION,NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION,READ_ONLY_SQL_TRANSACTION,'+ - 'SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED,NO_ACTIVE_SQL_TRANSACTION,IN_FAILED_SQL_TRANSACTION,INVALID_SQL_STATEMENT_NAME,TRIGGERED_DATA_CHANGE_VIOLATION,'+ - 'INVALID_AUTHORIZATION_SPECIFICATION,DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST,DEPENDENT_OBJECTS_STILL_EXIST,INVALID_TRANSACTION_TERMINATION,'+ - 'SQL_ROUTINE_EXCEPTION,FUNCTION_EXECUTED_NO_RETURN_STATEMENT,MODIFYING_SQL_DATA_NOT_PERMITTED,PROHIBITED_SQL_STATEMENT_ATTEMPTED,READING_SQL_DATA_NOT_PERMITTED,'+ - 'INVALID_CURSOR_NAME,EXTERNAL_ROUTINE_EXCEPTION,CONTAINING_SQL_NOT_PERMITTED,'+ - 'EXTERNAL_ROUTINE_INVOCATION_EXCEPTION,INVALID_SQLSTATE_RETURNED,TRIGGER_PROTOCOL_VIOLATED,'+ - 'SRF_PROTOCOL_VIOLATED,SAVEPOINT_EXCEPTION,INVALID_SAVEPOINT_SPECIFICATION,INVALID_CATALOG_NAME,INVALID_SCHEMA_NAME,TRANSACTION_ROLLBACK,'+ - 'TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION,SERIALIZATION_FAILURE,STATEMENT_COMPLETION_UNKNOWN,DEADLOCK_DETECTED,SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION,'+ - 'SYNTAX_ERROR,INSUFFICIENT_PRIVILEGE,CANNOT_COERCE,GROUPING_ERROR,INVALID_FOREIGN_KEY,INVALID_NAME,NAME_TOO_LONG,RESERVED_NAME,DATATYPE_MISMATCH,'+ - 'INDETERMINATE_DATATYPE,WRONG_OBJECT_TYPE,UNDEFINED_COLUMN,UNDEFINED_FUNCTION,UNDEFINED_TABLE,UNDEFINED_PARAMETER,UNDEFINED_OBJECT,'+ - 'DUPLICATE_COLUMN,DUPLICATE_CURSOR,DUPLICATE_DATABASE,DUPLICATE_FUNCTION,DUPLICATE_PREPARED_STATEMENT,DUPLICATE_SCHEMA,DUPLICATE_TABLE,'+ - 'DUPLICATE_ALIAS,DUPLICATE_OBJECT,AMBIGUOUS_COLUMN,AMBIGUOUS_FUNCTION,AMBIGUOUS_PARAMETER,AMBIGUOUS_ALIAS,INVALID_COLUMN_REFERENCE,'+ - 'INVALID_COLUMN_DEFINITION,INVALID_CURSOR_DEFINITION,INVALID_DATABASE_DEFINITION,INVALID_FUNCTION_DEFINITION,INVALID_PREPARED_STATEMENT_DEFINITION,'+ - 'INVALID_SCHEMA_DEFINITION,INVALID_TABLE_DEFINITION,INVALID_OBJECT_DEFINITION,WITH_CHECK_OPTION_VIOLATION,INSUFFICIENT_RESOURCES,'+ - 'DISK_FULL,OUT_OF_MEMORY,TOO_MANY_CONNECTIONS,PROGRAM_LIMIT_EXCEEDED,STATEMENT_TOO_COMPLEX,TOO_MANY_COLUMNS,TOO_MANY_ARGUMENTS,'+ - 'OBJECT_NOT_IN_PREREQUISITE_STATE,OBJECT_IN_USE,CANT_CHANGE_RUNTIME_PARAM,LOCK_NOT_AVAILABLE,OPERATOR_INTERVENTION,QUERY_CANCELED,'+ - 'ADMIN_SHUTDOWN,CRASH_SHUTDOWN,CANNOT_CONNECT_NOW,IO_ERROR,UNDEFINED_FILE,DUPLICATE_FILE,CONFIG_FILE_ERROR,LOCK_FILE_EXISTS,'+ - 'PLPGSQL_ERROR,RAISE_EXCEPTION,INTERNAL_ERROR,DATA_CORRUPTED,INDEX_CORRUPTED'; - - // PLSQL keywords - OraclePLSQLKW: string = - 'ABORT,ACCEPT,AFTER,ARRAY,ARRAYLEN,ASSERT,ASSIGN,AT,AUTHORIZATION,' + - 'AUTONOMOUS_TRANSACTION,BASE_TABLE,BEGIN,BODY,BULK,BULK_ROWCOUNT,CALL,' + - 'CALLING,CASE,CHAR_BASE,CHARSETFORM,CHARSETID,CLOSE,CLUSTERS,COLAUTH,' + - 'COLLECT,COMMIT,CONNECTION,CONSTANT,COOKIE,COOKIE_TABLE,CRASH,CURRVAL,' + - 'CURSOR,DATA_BASE,DATABASE,DBA,DEBUGOFF,DEBUGON,DECLARE,DEFINITION,' + - 'DELAY,DELTA,DEQUEUE_OPTIONS_T,DETERMINISTIC,DIGITS,DISPOSE,DO,EACH,' + - 'ELSIF,END,ENQUEUE_OPTIONS_T,ENTRY,EXCEPTION,EXCEPTION_INIT,EXIT,' + - 'EXTERNAL,FALSE,FETCH,FIXED,FORALL,FORM,FOUND,FUNCTION,GENERIC,GOTO,IF,' + - 'INDEXES,INDICATOR,INSTEAD,INTERFACE,ISOPEN,LANGUAGE,LCR$_DDL_RECORD,' + - 'LCR$_ROW_LIST,LCR$_ROW_RECORD,LCR$_ROW_UNIT,LIMITED,LOOP,MAXLEN,' + - 'MESSAGE_PROPERTIES_T,MGW_BASIC_MSG_T,MGW_MQSERIES_PROPERTIES,' + - 'MGW_NAME_TYPE_ARRAY_T,MGW_NAME_VALUE_T,MGW_PROPERTIES,MGW_PROPERTY,' + - 'MGW_RAW_VALUE_T,MGW_TEXT_VALUE_T,NAME,NEW,NEXTVAL,NOTFOUND,' + - 'NUMBER_BASE,OLD,OPEN,OUT,PACKAGE,PARALLEL_ENABLE,PARTITION,PASCAL,' + - 'PRAGMA,PRIVATE,PROCEDURE,RAISE,RAISE_APPLICATION_ERROR,RANGE,RE$ATTRIBUTE_VALUE,' + - 'RE$ATTRIBUTE_VALUE_LIST,RE$COLUMN_VALUE,RE$COLUMN_VALUE_LIST,' + - 'RE$NAME_ARRAY,RE$NV_ARRAY,RE$NV_LIST,RE$NV_NODE,RE$RULE_HIT,' + - 'RE$RULE_HIT_LIST,RE$TABLE_ALIAS,RE$TABLE_ALIAS_LIST,' + - 'RE$TABLE_VALUE,RE$TABLE_VALUE_LIST,RE$VARIABLE_TYPE,' + - 'RE$VARIABLE_TYPE_LIST,RE$VARIABLE_VALUE,RE$VARIABLE_VALUE_LIST,RECORD,' + - 'REF,REFERENCING,RELEASE,REMR,REQ,RESP,RESTRICT_REFERENCES,RETURN,' + - 'REVERSE,ROLLBACK,ROWCOUNT,ROWTYPE,RUNTIME_INFO,SAVEPOINT,SCHEMA,' + - 'SELF,SEPARATE,SERIALLY_REUSABLE,SPACE,SQL,SQLERROR,STATEMENT,STRUCT,' + - 'SUBTYPE,TABAUTH,TABLES,TASK,TDO,TERMINATE,TRUE,TYPE,USE,VARYING,VIEWS,' + - 'WHEN,WHILE,WORK,WRITE,XOR'; - - // Oracle data types - OracleTypes: string = - 'ANYDATA,ANYDATASET,ANYTYPE,BFILE,BINARY_DOUBLE,BINARY_FLOAT,BINARY_INTEGER,' + - 'BLOB,BOOLEAN,CHAR,CLOB,DATE,DAY,DBURITYPE,DEC,DECIMAL,DOUBLE,FLOAT,' + - 'HTTPURITYPE,IDENTITY,INTEGER,INTERVAL,LONG,MLSLABEL,MONTH,NATURAL,NATURALN,NCHAR,' + - 'NCLOB,NUMBER,NUMERIC,NVARCHAR2,PLS_INTEGER,POSITIVE,POSITIVEN,RAW,REAL,' + - 'ROWID,SECOND,SMALLINT,TIMESTAMP,URITYPE,UROWID,VARCHAR,VARCHAR2,XDBURITYPE,' + - 'XMLDATA,XMLTYPE,YEAR,ZONE'; - - // Oracle built in exceptions - OracleExceptions: string = - 'ACCESS_INTO_NULL,CASE_NOT_FOUND,COLLECTION_IS_NULL,CURSOR_ALREADY_OPEN,' + - 'DUP_VAL_ON_INDEX,INVALID_CURSOR,INVALID_NUMBER,LOGIN_DENIED,' + - 'NO_DATA_FOUND,NOT_LOGGED_ON,OTHERS,PROGRAM_ERROR,ROWTYPE_MISMATCH,' + - 'SELF_IS_NULL,STORAGE_ERROR,SUBSCRIPT_BEYOND_COUNT,SUBSCRIPT_OUTSIDE_LIMIT,' + - 'SYS_INVALID_ROWID,TIMEOUT_ON_RESOURCE,TOO_MANY_ROWS,VALUE_ERROR,' + - 'ZERO_DIVIDE'; - - // Oracle built in functions - OracleFunctions: string = - 'ABS,ACOS,ADD_MONTHS,AGGREGATE,ANALYTIC,ASCII,ASCIISTR,ASIN,ATAN,ATAN2,' + - 'AVERAGE,AVG,BASE64_DECODE,BASE64_ENCODE,BEGIN_REQUEST,BFILENAME,' + - 'BIN_TO_NUM,BIT_AND,BIT_COMPLEMENT,BIT_OR,BIT_XOR,BITAND,' + - 'CAST_FROM_BINARY_INTEGER,CAST_FROM_NUMBER,CAST_TO_BINARY_INTEGER,' + - 'CAST_TO_NUMBER,CAST_TO_RAW,CAST_TO_VARCHAR2,CEIL,CHARTOROWID,CHR,' + - 'COLUMN_PRESENT,COMPARE,COMPARE_TEMPLATES,COMPOSE,CONCAT,CONVERSION,' + - 'CONVERT,CONVERT_ANYDATA_TO_LCR_DDL,CONVERT_ANYDATA_TO_LCR_ROW,' + - 'COPIES,COPY_TEMPLATE,CORR,COS,COSH,COUNT,COVAR_POP,COVAR_SAMP,' + - 'CREATE_OBJECT_FROM_EXISTING,CREATE_PIPE,CREATE_REFRESH_TEMPLATE,' + - 'CREATE_TEMPLATE_OBJECT,CREATE_TEMPLATE_PARM,CREATE_USER_AUTHORIZATION,' + - 'CREATE_USER_PARM_VALUE,CRLF,CUBE,CUME_DIST,CURRENT_DATE,' + - 'CURRENT_INSTANCE,CURRENT_TIMESTAMP,DATA_BLOCK_ADDRESS_BLOCK,' + - 'DATA_BLOCK_ADDRESS_FILE,DBTIMEZONE,DECODE,DECOMPOSE,DELETE_BREAKPOINT,' + - 'DELETE_OER_BREAKPOINT,DENSE_RANK,DEPTH,DEREF,DISABLE_BREAKPOINT,' + - 'DISABLED,DISPLAY,DROP_ALL,DROP_ELEMENT,DROP_FILE,DUMP,' + - 'EMPTY_BLOB,EMPTY_CLOB,ENABLE_BREAKPOINT,EQUALS_PATH,ESTIMATE_CPU_UNITS,' + - 'EXCLUDE_PUSH,EXECUTE_AND_FETCH,EXECUTE_NON_QUERY,EXISTSNODE,EXP,EXTEND,' + - 'EXTRACT,EXTRACTVALUE,FCOPY,FETCH_ROW,FETCH_ROWS,FGETPOS,FILEEXISTS,' + - 'FILEISOPEN,FIRST,FIRST_VALUE,FLOOR,FLUSH_DATA,FOPEN,FOPEN_NCHAR,' + - 'FORMAT_CALL_STACK,FORMAT_ERROR_STACK,FREMOVE,FRENAME,FROM_REMOTE,FSEEK,' + - 'GET_ARG_FORM,GET_ARG_TYPE,GET_COOKIE_COUNT,GET_COOKIES,' + - 'GET_DETAILED_SQLCODE,GET_DETAILED_SQLERRM,GET_ERROR_MESSAGE,' + - 'GET_HASH_VALUE,GET_HEADER_COUNT,GET_INDEXES,GET_INFORMATION,' + - 'GET_OBJECT_NULL_VECTOR_ARG,GET_PARAMETER_VALUE,' + - 'GET_PERSISTENT_CONN_COUNT,GET_RAW,GET_RESPONSE,GET_RUNTIME_INFO,' + - 'GET_RUNTIME_PARM_ID,GET_SESSION_TIMEOUT,GET_SYSTEM_CHANGE_NUMBER,' + - 'GET_TAG,GET_TIME,GET_TIMEOUT,GET_TIMEOUT_BEHAVIOR,GET_VALUE,' + - 'GETCHUNKSIZE,GETLENGTH,GLB,GREATEST,GREATEST_LB,GROUP_ID,GROUPING,' + - 'GROUPING_ID,HEXTORAW,I_AM_A_REFRESH,INITCAP,INITIALIZE,' + - 'INSTANTIATE_OFFLINE,INSTANTIATE_ONLINE,INSTR,INSTRB,' + - 'INTERNAL_VERSION_CHECK,IS_CLUSTER_DATABASE,IS_LOCATOR,IS_OPEN,' + - 'IS_ROLE_ENABLED,IS_SESSION_ALIVE,IS_TRIGGER_FIRE_ONCE,ISTEMPORARY,LAG,' + - 'LAST,LAST_DAY,LAST_ERROR_POSITION,LAST_ROW_COUNT,LAST_ROW_ID,' + - 'LAST_SQL__CODE,LAST_VALUE,LEAD,LEAST,LEAST_LB,LENGTH,LENGTHB,LINEAR,LN,' + - 'LOCAL_TRANSACTION_ID,LOCALTIMESTAMP,LOG,LOWER,LPAD,LTRIM,LUB,' + - 'MAKE_DATA_BLOCK_ADDRESS,MAKE_REF,MAP_ALL,MAP_ELEMENT,MAP_FILE,' + - 'MAP_OBJECT,MAX,MIN,MINE_VALUE,MISCELLANEOUS,MOD,MONTHS_BETWEEN,NCHR,' + - 'NEW_TIME,NEXT_DAY,NEXT_ITEM_TYPE,NLS_CHARSET_DECL_LEN,NLS_CHARSET_ID,' + - 'NLS_CHARSET_NAME,NLS_INITCAP,NLS_LOWER,NLS_SORT,NLS_UPPER,NLSSORT,NTILE,' + - 'NULLIF,NUMTODSINTERVAL,NUMTOYMINTERVAL,NVARRAY_FIND_NAME,' + - 'NVARRAY_FIND_NAME_TYPE,NVARRAY_GET,NVARRAY_GET_BOOLEAN,NVARRAY_GET_BYTE,' + - 'NVARRAY_GET_DATE,NVARRAY_GET_DOUBLE,NVARRAY_GET_FLOAT,' + - 'NVARRAY_GET_INTEGER,NVARRAY_GET_LONG,NVARRAY_GET_RAW,NVARRAY_GET_SHORT,' + - 'NVARRAY_GET_TEXT,NVL,NVL2,OBJECT,OPEN_CURSOR,OVER,OVERLAY,PATH,' + - 'PAUSE_PROFILER,PERCENT_RANK,PERCENTILE_CONT,PERCENTILE_DISC,PMARKER,' + - 'PORT_STRING,POWER,PURGE,PUSH,PUT_RAW,QUOTED_PRINTABLE_DECODE,' + - 'QUOTED_PRINTABLE_ENCODE,RANDOM,RANK,RATIO_TO_REPORT,RATION_TO_REPORT,' + - 'RAWTOHEX,RAWTONHEX,RECEIVE_MESSAGE,REFERENCE,REFTOHEX,REGR_AVGX,' + - 'REGR_AVGY,REGR_COUNT,REGR_INTERCEPT,REGR_R2,REGR_SLOPE,REGR_SXX,' + - 'REGR_SXY,REGR_SYY,REGRESSION,REMOVE_PIPE,REPLACE,REPLICATION_IS_ON,' + - 'REQUEST,REQUEST_PIECES,RESTORE,RESUME_PROFILER,RETURNING,ROLLUP,ROUND,' + - 'ROW_NUMBER,ROWID_BLOCK_NUMBER,ROWID_CREATE,ROWID_OBJECT,' + - 'ROWID_RELATIVE_FNO,ROWID_ROW_NUMBER,ROWID_TO_ABSOLUTE_FNO,' + - 'ROWID_TO_EXTENDED,ROWID_TO_RESTRICTED,ROWID_TYPE,ROWID_VERIFY,' + - 'ROWIDTOCHAR,ROWIDTONCHAR,RPAD,RTRIM,SEND_MESSAGE,SESSIONTIMEZONE,' + - 'SET_BREAKPOINT,SET_OER_BREAKPOINT,SET_TIMEOUT,SET_VALUE,SIGN,SIN,SINH,' + - 'SOUNDEX,SPACE_ERROR_INFO,SQLCODE,SQLERRM,SQRT,START_PROFILER,STDDEV,' + - 'STDDEV_POP,STDDEV_SAMP,STDDEVP,STDDEVS,STEP_ID,STOP_PROFILER,SUBSTR,' + - 'SUBSTRB,SUM,SYNCHRONIZE,SYS_CONNECT_BY_PATH,SYS_CONTEXT,SYS_DBURIGEN,' + - 'SYS_EXTRACT_UTC,SYS_GUID,SYS_TYPEID,SYS_XMLAGG,SYS_XMLGEN,SYSDATE,' + - 'SYSTIMESTAMP,TAN,TANH,TO_CHAR,TO_CLOB,TO_DATE,TO_DSINTERVAL,TO_LABEL,' + - 'TO_LOB,TO_MULTI_BYTE,TO_NCHAR,TO_NCLOB,TO_NUMBER,TO_SINGLE_BYTE,' + - 'TO_TIMESTAMP,TO_TIMESTAMP_TZ,TO_YMINTERVAL,TRANSLATE,TRANSLITERATE,' + - 'TREAT,TRIM,TRUNC,TZ_OFFSET,UID,UNDER_PATH,UNESCAPE,UNIQUE_SESSION_ID,' + - 'UNIQUE_SESSION_NAME,UNISTR,UPDATEXML,UPPER,USER,USERENV,USING,UUDECODE,' + - 'UUENCODE,VALUE,VAR_POP,VAR_SAMP,VARIANCE,VARP,VARS,VSIZE,WIDTH_BUCKET,' + - 'XMLAGG,XMLCOLATTVAL,XMLCONCAT,XMLELEMENT,XMLFOREST,XMLSEQUENCE,' + - 'XMLTRANSFORM,XRANGE'; - - OracleDefaultPackages: string = - 'CTX_ADM,CTX_CLS,CTX_DDL,CTX_DOC,CTX_OUTPUT,CTX_QUERY,CTX_REPORT,CTX_THES,CTX_ULEXER,' + - 'DBMS_ADVANCED_REWRITE,DBMS_ADVISOR,DBMS_ALERT,DBMS_APPLICATION_INFO,' + - 'DBMS_APPLY_ADM,DBMS_AQ,DBMS_AQ_EXP_HISTORY_TABLES,DBMS_AQ_EXP_INDEX_TABLES,' + - 'DBMS_AQ_EXP_QUEUE_TABLES,DBMS_AQ_EXP_QUEUES,' + - 'DBMS_AQ_EXP_SUBSCRIBER_TABLES,DBMS_AQ_EXP_TIMEMGR_TABLES,' + - 'DBMS_AQ_EXP_ZECURITY,DBMS_AQ_IMP_INTERNAL,DBMS_AQ_IMP_ZECURITY,' + - 'DBMS_AQ_IMPORT_INTERNAL,DBMS_AQ_SYS_EXP_ACTIONS,' + - 'DBMS_AQ_SYS_EXP_INTERNAL,DBMS_AQ_SYS_IMP_INTERNAL,DBMS_AQADM,' + - 'DBMS_AQADM_SYS,DBMS_AQADM_SYSCALLS,DBMS_AQELM,DBMS_AQIN,' + - 'DBMS_AQJMS,DBMS_ASSERT,DBMS_AUTO_TASK_ADMIN,DBMS_AW_STATS,DBMS_BACKUP_RESTORE,' + - 'DBMS_CAPTURE_ADM,DBMS_CDC_PUBLISH,DBMS_CDC_SUBSCRIBE,DBMS_COMPARISON,' + - 'DBMS_CONNECTION_POOL,DBMS_CQ_NOTIFICATION,DBMS_CRYPTO,DBMS_CSX_ADMIN,' + - 'DBMS_CUBE,DBMS_CUBE_ADVISE,DBMS_DATA_MINING,DBMS_DATA_MINING_TRANSFORM,' + - 'DBMS_DATAPUMP,DBMS_DB_VERSION,DBMS_DDL,' + - 'DBMS_DEBUG,DBMS_DEFER,DBMS_DEFER_IMPORT_INTERNAL,DBMS_DEFER_QUERY,' + - 'DBMS_DEFER_SYS,DBMS_DESCRIBE,DBMS_DG,DBMS_DIMENSION,DBMS_DISTRIBUTED_TRUST_ADMIN,' + - 'DBMS_EPG,DBMS_ERRLOG,DBMS_EXPFIL,DBMS_EXPORT_EXTENSION,DBMS_FGA,DBMS_FILE_GROUP,' + - 'DBMS_FILE_TRANSFER,DBMS_FLASHBACK,DBMS_FREQUENT_ITEMSET,DBMS_HM,DBMS_HPROF,' + - 'DBMS_HS_PARALLEL,DBMS_HS_PASSTHROUGH,DBMS_IJOB,DBMS_INTERNAL_TRIGGER,DBMS_IOT,' + - 'DBMS_IREFRESH,DBMS_ISNAPSHOT,DBMS_JAVA,DBMS_JAVA_TEST,DBMS_JOB,DBMS_LDAP,DBMS_LDAP_UTL,' + - 'DBMS_LIBCACHE,DBMS_LOB,DBMS_LOCK,DBMS_LOGMNR,DBMS_LOGMNR_CDC_PUBLISH,' + - 'DBMS_LOGMNR_CDC_SUBSCRIBE,DBMS_LOGMNR_D,DBMS_LOGSTDBY,DBMS_METADATA,' + - 'DBMS_MGD_ID_UTL,DBMS_MGWADM,DBMS_MGWMSG,DBMS_MONITOR,DBMS_MVIEW,' + - 'DBMS_NETWORK_ACL_ADMIN,DBMS_NETWORK_UTL, DBMS_OBFUSCATION_TOOLKIT,DBMS_ODCI,' + - 'DBMS_OFFLINE_OG,DBMS_OFFLINE_SNAPSHOT,DBMS_OLAP,' + - 'DBMS_ORACLE_TRACE_AGENT,DBMS_ORACLE_TRACE_USER,DBMS_OUTLN,' + - 'DBMS_OUTLN_EDIT,DBMS_OUTPUT,DBMS_PCLXUTIL,DBMS_PICKLER,DBMS_PIPE,' + - 'DBMS_PITR,DBMS_PLUGTS,DBMS_PROFILER,DBMS_PROPAGATION_ADM,' + - 'DBMS_PRVTAQIM,DBMS_PRVTAQIP,DBMS_PRVTAQIS,DBMS_PRVTRMIE,DBMS_PSP,' + - 'DBMS_PSWMG_IMPORT,DBMS_PREDICTIVE_ANALYTICS,DBMS_PREPROCESSOR,' + - 'DBMS_RANDOM,DBMS_RCVMAN,DBMS_RECTIFIER_DIFF,DBMS_REDEFINITION,DBMS_REFRESH,' + - 'DBMS_REFRESH_EXP_LWM,DBMS_REFRESH_EXP_SITES,DBMS_REPAIR,DBMS_REPCAT,DBMS_REPCAT_ADMIN,' + - 'DBMS_REPCAT_AUTH,DBMS_REPCAT_INSTANTIATE,DBMS_REPCAT_RGT,DBMS_REPUTIL,' + - 'DBMS_RESCONFIG,DBMS_RESOURCE_MANAGER,DBMS_RESOURCE_MANAGER_PRIVS,DBMS_RESULT_CACHE,' + - 'DBMS_RESUMABLE,DBMS_RLMGR,DBMS_RLS,DBMS_RMGR_GROUP_EXPORT,DBMS_RMGR_PACT_EXPORT,' + - 'DBMS_RMGR_PLAN_EXPORT,DBMS_RMIN,DBMS_ROWID,DBMS_RULE,DBMS_RULE_ADM,' + - 'DBMS_RULE_EXIMP,DBMS_SCHEDULER,DBMS_SERVER_ALERT,DBMS_SERVICE,DBMS_SESSION,' + - 'DBMS_SHARED_POOL,DBMS_SNAP_INTERNAL,DBMS_SNAP_REPAPI,DBMS_SNAPSHOT,DBMS_SNAPSHOT_UTL,' + - 'DBMS_SPACE,DBMS_SPACE_ADMIN,DBMS_SQL,DBMS_SQLDIAG,DBMS_SQLTUNE,DBMS_STANDARD,' + - 'DBMS_STAT_FUNCS,DBMS_STATS,DBMS_STORAGE_MAP,' + - 'DBMS_STREAMS,DBMS_STREAMS_ADM,DBMS_STREAMS_AUTH,DBMS_STREAMS_ADVISOR_ADM,' + - 'DBMS_STREAMS_MESSAGING,DBMS_STREAMS_TABLESPACE_ADM,DBMS_SUMADV,DBMS_SUMMARY,' + - 'DBMS_SUMREF_CHILD,DBMS_SUMREF_PARENT,DBMS_SUMREF_UTIL,' + - 'DBMS_SUMREF_UTIL2,DBMS_SUMVDM,DBMS_SYS_ERROR,DBMS_SYS_SQL,' + - 'DBMS_SYSTEM,DBMS_TDB,DBMS_TRACE,DBMS_TRANSACTION,DBMS_TRANSFORM,DBMS_TTS,' + - 'DBMS_TYPES,DBMS_UTILITY,DBMS_WORKLOAD_CAPTURE,DBMS_WORKLOAD_REPLAY,' + - 'DBMS_WORKLOAD_REPOSITORY,DBMS_WM,DBMS_XA,DBMS_XDB,DBMS_XDB_ADMIN,' + - 'DBMS_XDB_VERSION,DBMS_XDBRESOURCE,DBMS_XDBT,DBMS_XDBZ,DBMS_XEVENT,' + - 'DBMS_XMLDOM,DBMS_XMLGEN,DBMS_XMLINDEX,DBMS_XMLPARSER,DBMS_XMLQUERY,' + - 'DBMS_XMLSAVE,DBMS_XMLSCHEMA,DBMS_XMLSTORE,DBMS_XMLTRANSLATIONS,DBMS_XPLAN,' + - 'DBMS_XSLPROCESSOR,DBMS_ZHELP,DBMS_ZHELP_IR,DBMSZEXP_SYSPKGGRNT,DEBUG_EXTPROC,' + - 'DIANA,DIUTIL,HTF,HTP,ODCICONST,OUTLN_PKG,PBREAK,PBRPH,PBSDE,PBUTL,PIDL,PLITBLM,' + - 'SDO_CS,SDO_GEOM,SDO_LRS,SDO_MIGRATE,SDO_TUNE,SDO_UTIL,STANDARD,' + - 'SYS_STUB_FOR_PURITY_ANALYSIS,UTL_COLL,UTL_ENCODE,UTL_FILE,UTL_FILE_DIR,UTL_HTTP,' + - 'UTL_I18N,UTL_INADDR,UTL_LMS,UTL_MAIL,UTL_NLA,UTL_PG,UTL_RAW,UTL_REF,UTL_SMTP,' + - 'UTL_SPADV,UTL_TCP,UTL_URL,WPG_DOCLOAD'; - - OracleSQLPlusCommands: string = - 'APP,APPINFO,AQ$_AGENT,AQ$_AGENT_LIST_T,AQ$_DESCRIPTOR,AQ$_POST_INFO,' + - 'AQ$_POST_INFO_LIST,AQ$_RECIPIENT_LIST_T,AQ$_REG_INFO,AQ$_REG_INFO_LIST,' + - 'AQ$_SUBSCRIBER_LIST_T,ARCHIVE,ARRAYSIZE,ATTRIBUTE,AUTOCOMMIT,AUTOP,' + - 'AUTOPRINT,AUTORECOVERY,AUTOT,AUTOTRACE,BLO,BLOCKTERMINATOR,BRE,BREAK,' + - 'BTI,BTITLE,BUFFER,CL,CLEAR,CLOSECURSOR,CMDS,CMDSEP,COL,COLSEP,COM,COMP,' + - 'COMPAT,COMPATIBILITY,CON,CONN,COPY,COPYC,COPYCOMMIT,COPYTYPECHECK,DEF,' + - 'DEFINE,DESC,DESCR,DESCRI,DESCRIB,DESCRIBE,DISC,DISCO,DISCON,DISCONN,' + - 'DISCONNE,DISCONNEC,DISCONNECT,EA,ECHO,EDITF,EDITFILE,EMB,' + - 'EMBEDDED,ESC,EXEC,EXECUTE,FAILURE,FEED,FEEDBACK,FLAGGER,FLU,GET,' + - 'HEA,HEADING,HEADS,HEADSEP,HELP,HO,HOST,INPUT,INTERMED,INTERMEDIATE,INV,' + - 'INVISIBLE,LIN,LINESIZE,LO,LOBOF,LOBOFFSET,LOGON,LOGSOURCE,LONGC,' + - 'LONGCHUNKSIZE,MARKUP,MAXDATA,MIX,MIXED,NATIVE,NEWP,NEWPAGE,NUM,' + - 'NUMF,NUMFORMAT,NUMWIDTH,OFF,OSERROR,PAGES,PAGESIZE,PASSW,PAU,PAUSE,' + - 'PPRINT,PRI,PRINT,RECSEP,RECSEPCHAR,REPF,REPFOOTER,REPH,REPHEADER,' + - 'RUN,SAVE,SCAN,SERVEROUTPUT,SET,SHIFT,SHIFTINOUT,SHO,SHOW,SHUTDOWN,' + - 'SILENT,SPOOL,SQLBL,SQLBLANKLINES,SQLC,SQLCASE,SQLCO,SQLCONTINUE,SQLN,' + - 'SQLNUMBER,SQLP,SQLPRE,SQLPREFIX,SQLPROMPT,SQLT,SQLTERMINATOR,STA,' + - 'STARTUP,STATEMENT_ID,STORE,SUCCESS,SUF,SUFFIX,TAB,TERM,TERMOUT,TI,TIMI,' + - 'TIMING,TRIMOUT,TRIMS,TRIMSPOOL,TTI,TTITLE,UND,UNDEF,UNDEFINE,' + - 'UNDERLINE,UP,VAR,VARIABLE,VER,VERIFY,VERSION,VIS,VISIBLE,WHENEVER,WR,' + - 'WRA,WRAP,WRAPPED'; - - OracleCommentKW: string = - 'REM,REMA,REMAR,REMARK'; - - OracleConsoleOutputKW: string = - 'PRO,PROM,PROMP,PROMPT'; - -//---MS-SQL 7------------------------------------------------------------------- - // keywords - MSSQL7KW: string = - 'ABSOLUTE,ADD,ALL,ALTER,ANY,AS,ASC,AUTHORIZATION,AVG,BACKUP,BEGIN,' + - 'BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CHECK,CHECKPOINT,CLOSE,CLUSTERED,' + - 'COLUMN,COMMIT,COMMITTED,COMPUTE,CONFIRM,CONSTRAINT,CONTAINS,' + - 'CONTAINSTABLE,CONTINUE,CONTROLROW,COUNT,CREATE,CROSS,CURRENT,' + - 'CURRENT_DATE,CURRENT_TIME,CURSOR,DATABASE,DBCC,DEALLOCATE,DECLARE,' + - 'DEFAULT,DELETE,DENY,DESC,DISK,DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,' + - 'DUMP,ELSE,END,ERRLVL,ERROREXIT,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,' + - 'FETCH,FILE,FILLFACTOR,FIRST,FLOPPY,FOR,FOREIGN,FREETEXT,FREETEXTTABLE,' + - 'FROM,FULL,GLOBAL,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,IDENTITYCOL,' + - 'IDENTITY_INSERT,IF,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISOLATION,' + - 'JOIN,KEY,KILL,LAST,LEFT,LEVEL,LIKE,LINENO,LOAD,MAX,MIN,MIRROREXIT,' + - 'NATIONAL,NEXT,NOCHECK,NONCLUSTERED,NOT,NULL,OF,OFF,OFFSETS,ON,ONCE,' + - 'ONLY,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPTION,OR,ORDER,OUTER,' + - 'OVER,PERCENT,PERM,PERMANENT,PIPE,PLAN,PRECISION,PREPARE,PRIMARY,PRINT,' + - 'PRIOR,PRIVILEGES,PROC,PROCEDURE,PROCESSEXIT,PUBLIC,RAISERROR,READ,' + - 'READTEXT,RECONFIGURE,REFERENCES,RELATIVE,REPEATABLE,REPLICATION,RESTORE,' + - 'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,RULE,SAVE,' + - 'SCHEMA,SELECT,SERIALIZABLE,SET,SETUSER,SHUTDOWN,SOME,STATISTICS,SUM,' + - 'TABLE,TAPE,TEMP,TEMPORARY,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,TRIGGER,' + - 'TRUNCATE,TSEQUAL,UNCOMMITTED,UNION,UNIQUE,UPDATE,UPDATETEXT,USE,USER,' + - 'VALUES,VARYING,VIEW,WAITFOR,WHEN,WHERE,WHILE,WITH,WORK,WRITETEXT'; - - // functions - MSSQL7Functions: string = - '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + - '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + - '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + - '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' + - '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' + - '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,ABS,' + - 'ACOS,AND,APP_NAME,ASCII,ASIN,ATAN,ATN2,CASE,CAST,CEILING,CHARINDEX,' + - 'COALESCE,COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,' + - 'CURRENT_TIMESTAMP,CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,' + - 'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,' + - 'DEGREES,DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' + - 'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,FORMATMESSAGE,' + - 'FULLTEXTCATALOGPROPERTY,FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,' + - 'HOST_ID,HOST_NAME,IDENT_INCR,IDENT_SEED,INDEXPROPERTY,INDEX_COL,' + - 'ISDATE,ISNULL,ISNUMERIC,IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,' + - 'LTRIM,MONTH,NEWID,NULLIF,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,' + - 'PATINDEX,PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,' + - 'REVERSE,ROUND,RTRIM,SESSION_USER,SIGN,SIN,SOUNDEX,SPACE,SQRT,SQUARE,' + - 'STATS_DATE,STR,STUFF,SUBSTRING,SUSER_ID,SUSER_NAME,SUSER_SID,' + - 'SUSER_SNAME,SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,' + - 'UPPER,USER_ID,USER_NAME,YEAR'; - - // types - MSSQL7Types: string = - 'BINARY,BIT,CHAR,DATETIME,DECIMAL,FLOAT,IMAGE,INT,MONEY,NCHAR,NTEXT,' + - 'NUMERIC,NVARCHAR,REAL,SMALLDATETIME,SMALLINT,SMALLMONEY,SYSNAME,TEXT,' + - 'TIMESTAMP,TINYINT,UNIQUEIDENTIFIER,VARBINARY,VARCHAR'; - -//---MS-SQL2K------------------------------------------------------------------- - // keywords - MSSQL2000KW: string = - 'ADD,ALL,ALTER,AND,ANY,AS,ASC,AUTHORIZATION,BACKUP,' + - 'BEGIN,BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CASE,' + - 'CHECK,CHECKPOINT,CLOSE,CLUSTERED,COLLATE,' + - 'COLUMN,COMMIT,COMPUTE,CONSTRAINT,CONTAINS,CONTAINSTABLE,' + - 'CONTINUE,CREATE,CROSS,CURRENT,CURSOR,DATABASE,' + - 'DBCC,DEALLOCATE,DECLARE,DEFAULT,DELETE,DENY,DESC,DISK,' + - 'DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,DUMP,ELSE,END,' + - 'ERRLVL,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,FETCH,FILE,' + - 'FILLFACTOR,FOR,FOREIGN,FORMSOF,FREETEXT,FREETEXTTABLE,FROM,FULL,' + - 'FUNCTION,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,' + - 'IDENTITYCOL,IDENTITY_INSERT,IF,IN,INFLECTIONAL,INDEX,INNER,INSERT,' + - 'INTERSECT,INTO,IS,ISABOUT,JOIN,KEY,KILL,LEFT,LIKE,LINENO,LOAD,' + - 'NATIONAL,NOCHECK,NONCLUSTERED,NOT,NULL,NULLIF,OF,OFF,' + - 'OFFSETS,ON,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPENXML,' + - 'OPTION,OR,ORDER,OUTER,OVER,PERCENT,PLAN,PRECISION,' + - 'PRIMARY,PRINT,PROC,PROCEDURE,PUBLIC,RAISERROR,READ,' + - 'READTEXT,RECONFIGURE,REFERENCES,REPLICATION,RESTORE,' + - 'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,' + - 'RULE,SAVE,SCHEMA,SELECT,SESSION_USER,SET,SETUSER,SHUTDOWN,' + - 'SOME,STATISTICS,TABLE,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,' + - 'TRIGGER,TRUNCATE,TSEQUAL,UNION,UNIQUE,UPDATE,UPDATETEXT,' + - 'USE,USER,VALUES,VARYING,VIEW,WAITFOR,WEIGHT,WHEN,WHERE,WHILE,' + - 'WITH,WRITETEXT'; - - // functions - MSSQL2000Functions: string = - '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + - '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + - '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + - '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' + - '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' + - '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,' + - 'ABS,ACOS,APP_NAME,ASCII,ASIN,ATAN,ATN2,AVG,BINARY_CHECKSUM,CAST,' + - 'CEILING,CHARINDEX,CHECKSUM,CHECKSUM_AGG,COALESCE,COLLATIONPROPERTY,' + - 'COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,COUNT,' + - 'COUNT_BIG,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,' + - 'CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,DATABASEPROPERTYEX,' + - 'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,DEGREES,' + - 'DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' + - 'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,fn_helpcollations,' + - 'fn_listextendedproperty,fn_servershareddrives,fn_trace_geteventinfo,' + - 'fn_trace_getfilterinfo,fn_trace_getinfo,fn_trace_gettable,' + - 'fn_virtualfilestats,FORMATMESSAGE,FULLTEXTCATALOGPROPERTY,' + - 'FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,GETUTCDATE,GROUPING,' + - 'HAS_DBACCESS,HOST_ID,HOST_NAME,IDENT_CURRENT,IDENT_INCR,IDENT_SEED,' + - 'INDEXKEY_PROPERTY,INDEXPROPERTY,INDEX_COL,ISDATE,ISNULL,ISNUMERIC,' + - 'IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,LTRIM,MAX,MIN,MONTH,' + - 'NEWID,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,PATINDEX,' + - 'PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,REVERSE,' + - 'ROUND,ROWCOUNT_BIG,RTRIM,SCOPE_IDENTITY,SERVERPROPERTY,SESSIONPROPERTY,' + - 'SIGN,SIN,SOUNDEX,SPACE,SQL_VARIANT_PROPERTY,SQRT,SQUARE,' + - 'STATS_DATE,STDEV,STDEVP,STR,STUFF,SUBSTRING,SUM,SUSER_SID,SUSER_SNAME,' + - 'SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,UPPER,' + - 'USER_ID,USER_NAME,VAR,VARP,YEAR'; - - // types - MSSQL2000Types: string = - 'bigint,binary,bit,char,character,datetime,' + - 'dec,decimal,float,image,int,' + - 'integer,money,nchar,ntext,numeric,nvarchar,real,' + - 'rowversion,smalldatetime,smallint,smallmoney,' + - 'sql_variant,sysname,text,timestamp,tinyint,uniqueidentifier,' + - 'varbinary,varchar'; - -//---Interbase 6---------------------------------------------------------------- - // functions - Interbase6Functions: string = 'AVG,CAST,COUNT,GEN_ID,MAX,MIN,SUM,UPPER'; - - // keywords - Interbase6KW: string = 'ACTIVE,ADD,AFTER,ALL,ALTER,AND,ANY,AS,ASC,' + - 'ASCENDING,AT,AUTO,AUTODDL,BASED,BASENAME,BASE_NAME,BEFORE,BEGIN,BETWEEN,' + - 'BLOBEDIT,BUFFER,BY,CACHE,CHARACTER_LENGTH,CHAR_LENGTH,CHECK,' + - 'CHECK_POINT_LEN,CHECK_POINT_LENGTH,COLLATE,COLLATION,COLUMN,COMMIT,' + - 'COMMITED,COMPILETIME,COMPUTED,CLOSE,CONDITIONAL,CONNECT,CONSTRAINT,' + - 'CONTAINING,CONTINUE,CREATE,CURRENT,CURRENT_DATE,CURRENT_TIME,' + - 'CURRENT_TIMESTAMP,CURSOR,DATABASE,DAY,DB_KEY,DEBUG,DEC,DECLARE,DEFAULT,' + - 'DELETE,DESC,DESCENDING,DESCRIBE,DESCRIPTOR,DISCONNECT,DISTINCT,DO,' + - 'DOMAIN,DROP,ECHO,EDIT,ELSE,END,ENTRY_POINT,ESCAPE,EVENT,EXCEPTION,' + - 'EXECUTE,EXISTS,EXIT,EXTERN,EXTERNAL,EXTRACT,FETCH,FILE,FILTER,FOR,' + - 'FOREIGN,FOUND,FROM,FULL,FUNCTION,GDSCODE,GENERATOR,GLOBAL,GOTO,GRANT,' + - 'GROUP,GROUP_COMMIT_WAIT,GROUP_COMMIT_WAIT_TIME,HAVING,HELP,HOUR,IF,' + - 'IMMEDIATE,IN,INACTIVE,INDEX,INDICATOR,INIT,INNER,INPUT,INPUT_TYPE,' + - 'INSERT,INT,INTO,IS,ISOLATION,ISQL,JOIN,KEY,LC_MESSAGES,LC_TYPE,LEFT,' + - 'LENGTH,LEV,LEVEL,LIKE,LOGFILE,LOG_BUFFER_SIZE,LOG_BUF_SIZE,LONG,MANUAL,' + - 'MAXIMUM,MAXIMUM_SEGMENT,MAX_SEGMENT,MERGE,MESSAGE,MINIMUM,MINUTE,' + - 'MODULE_NAME,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NO,NOAUTO,NOT,NULL,' + - 'NUM_LOG_BUFFS,NUM_LOG_BUFFERS,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,' + - 'ORDER,OUTER,OUTPUT,OUTPUT_TYPE,OVERFLOW,PAGE,PAGELENGTH,PAGES,PAGE_SIZE,' + - 'PARAMETER,PASSWORD,PLAN,POSITION,POST_EVENT,PRECISION,PREPARE,PROCEDURE,' + - 'PROTECTED,PRIMARY,PRIVILEGES,PUBLIC,QUIT,RAW_PARTITIONS,READ,REAL,' + - 'RECORD_VERSION,REFERENCES,RELEASE,RESERV,RESERVING,RETAIN,RETURN,' + - 'RETURNING_VALUES,RETURNS,REVOKE,RIGHT,ROLLBACK,RUNTIME,SCHEMA,SECOND,' + - 'SEGMENT,SELECT,SET,SHADOW,SHARED,SHELL,SHOW,SINGULAR,SIZE,SNAPSHOT,SOME,' + - 'SORT,SQL,SQLCODE,SQLERROR,SQLWARNING,STABILITY,STARTING,STARTS,' + - 'STATEMENT,STATIC,STATISTICS,SUB_TYPE,SUSPEND,TABLE,TERMINATOR,THEN,TO,' + - 'TRANSACTION,TRANSLATE,TRANSLATION,TRIGGER,TRIM,TYPE,UNCOMMITTED,UNION,' + - 'UNIQUE,UPDATE,USER,USING,VALUE,VALUES,VARIABLE,VARYING,VERSION,VIEW,' + - 'WAIT,WEEKDAY,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY'; - - // types - Interbase6Types: string = - 'BLOB,CHAR,CHARACTER,DATE,DECIMAL,DOUBLE,FLOAT,INTEGER,' + - 'NUMERIC,SMALLINT,TIME,TIMESTAMP,VARCHAR'; - -//---MySQL---------------------------------------------------------------------- - // keywords - MySqlKW: string = - 'ACCOUNT,ACTION,ADD,AFTER,AGAINST,ALGORITHM,ALL,ALTER,ANY,ALWAYS,ANALYZE,' + - 'AND,AS,ASC,AT,AUTO_INCREMENT,AVG_ROW_LENGTH,BEFORE,BEGIN,BETWEEN,BINLOG,' + - 'BLOCK,BOTH,BY,CACHE,CALL,CASCADE,CASCADED,CATALOG_NAME,CHANGE,CHANGED,' + - 'CHANNEL,CHAIN,CHARACTER,CHARSET,CHECK,CHECKSUM,CLASS_ORIGIN,CLIENT,CODE,' + - 'COLLATE,COLLATION,COLUMN,COLUMN_FORMAT,COLUMN_NAME,COLUMNS,COMMENT,' + - 'COMMIT,COMMITTED,COMPLETION,CONCURRENT,CONDITION,CONNECTION,CONSISTENT,' + - 'CONSTRAINT,CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,' + - 'CONTAINS,CONTEXT,CONTINUE,CONVERT,COPY,CPU,CREATE,CROSS,CURRENT,CURSOR,' + - 'CURSOR_NAME,CYCLE,DATA,DATABASE,DATABASES,DATAFILE,DAY_HOUR,' + - 'DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DEALLOCATE,DECLARE,DEFAULT,' + - 'DEFINER,DELAY_KEY_WRITE,DELAYED,DELETE,DESC,DESCRIBE,DETERMINISTIC,' + - 'DIAGNOSTICS,DIRECTORY,DISABLE,DISCARD,DISTINCT,DISTINCTROW,DIV,DO,DROP,' + - 'DUAL,DUMPFILE,DUPLICATE,EACH,ELSE,ELSEIF,ENABLE,ENCLOSED,END,ENDS,' + - 'ENGINE,ENGINES,ERROR,ERRORS,ESCAPE,ESCAPED,EVENT,EVENTS,EVERY,EXCHANGE,' + - 'EXCLUSIVE,EXECUTE,EXISTS,EXPANSION,EXPIRE,EXPLAIN,EXTENDED,FALSE,FAST,' + - 'FAULTS,FILE_BLOCK_SIZE,FLUSH,FIELDS,FILE,FIRST,FOLLOWS,FOR,FORCE,' + - 'FOREIGN,FOUND,FROM,FULL,FULLTEXT,FUNCTION,GENERAL,GENERATED,GET,GLOBAL,' + - 'GRANT,GRANTS,GROUP,HAVING,HELP,HIGH_PRIORITY,HOST,HOSTS,' + - 'HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IDENTIFIED,IGNORE,' + - 'IGNORE_SERVER_IDS,IMPORT,IN,INCREMENT,INDEX,INDEXES,INFILE,INITIAL_SIZE,' + - 'INNER,INOUT,INPLACE,INSTANCE,INSERT,INSERT_METHOD,INSTALL,INTO,INVOKER,' + - 'IO,IPC,IS,ISOLATION,JOIN,JSON,KEY,KEY_BLOCK_SIZE,KEYS,KILL,LANGUAGE,' + - 'LAST,LEADING,LESS,LEVEL,LIKE,LIMIT,LINEAR,LINES,LIST,LOAD,LOCAL,LOCK,' + - 'LOGS,LOW_PRIORITY,MASTER,MASTER_AUTO_POSITION,MASTER_BIND,' + - 'MASTER_CONNECT_RETRY,MASTER_DELAY,MASTER_HEARTBEAT_PERIOD,MASTER_HOST,' + - 'MASTER_LOG_FILE,MASTER_LOG_POS,MASTER_PASSWORD,MASTER_PORT,' + - 'MASTER_RETRY_COUNT,MASTER_SSL,MASTER_SSL_CA,MASTER_SSL_CAPATH,' + - 'MASTER_SSL_CERT,MASTER_SSL_CIPHER,MASTER_SSL_CRL,MASTER_SSL_CRLPATH,' + - 'MASTER_SSL_KEY,MASTER_SSL_VERIFY_SERVER_CERT,MASTER_TLS_VERSION,' + - 'MASTER_USER,MATCH,MAX_QUERIES_PER_HOUR,MAX_ROWS,' + - 'MAX_CONNECTIONS_PER_HOUR,MAX_STATEMENT_TIME,MAX_UPDATES_PER_HOUR,' + - 'MAX_USER_CONNECTIONS,MAXVALUE,MEDIUM,MESSAGE_TEXT,MIGRATE,MIN_ROWS,' + - 'MINUTE_MICROSECOND,MINUTE_SECOND,MINVALUE,MOD,MODE,MODIFIES,MODIFY,' + - 'MUTEX,MYSQL_ERRNO,NAME,NAMES,NATURAL,NEVER,NEW,NEXT,NO,NOCACHE,NOCYCLE,' + - 'NOMAXVALUE,NOMINVALUE,NONE,NOT,NULL,NO_WRITE_TO_BINLOG,NUMBER,OFFSET,' + - 'OJ,OLD,ON,ONE,ONLINE,ONLY,OPEN,OPTIMIZE,OPTION,OPTIONALLY,OPTIONS,OR,' + - 'ORDER,OUT,OUTER,OUTFILE,OWNER,PACK_KEYS,PAGE,PAGE_CHECKSUM,PARSER,' + - 'PARTIAL,PARTITION,PARTITIONING,PARTITIONS,PERSIST,PERSISTENT,PHASE,' + - 'PLUGINS,PLUGIN,PORT,PRECEDES,PREPARE,PRESERVE,PRIMARY,PRIVILEGES,' + - 'PROCEDURE,PROCESS,PROCESSLIST,PROFILE,PROFILES,PROXY,PURGE,QUERY,QUICK,' + - 'RANGE,READ,READS,REBUILD,RECOVER,REFERENCES,REGEXP,RELAY,RELAYLOG,' + - 'RELEASE,RELAY_LOG_FILE,RELAY_LOG_POS,RELOAD,REMOVE,RENAME,REORGANIZE,' + - 'REPAIR,REPEATABLE,REPLACE,REPLICATION,REQUIRE,RESET,RESIGNAL,' + - 'RESTRICT,RESUME,RETURN,RETURNED_SQLSTATE,RETURNS,REVOKE,RLIKE,ROLLBACK,' + - 'ROLLUP,ROTATE,ROUTINE,ROW,ROW_FORMAT,ROWS,SAVEPOINT,SCHEDULE,SCHEMA,' + - 'SCHEMA_NAME,SECOND_MICROSECOND,SECURITY,SELECT,SEPARATOR,SEQUENCE,' + - 'SERIALIZABLE,SERVER,SESSION,SET,SHARE,SHARED,SHOW,SHUTDOWN,SIGNAL,' + - 'SIMPLE,SLAVE,SLOW,SNAPSHOT,SOCKET,SOME,SONAME,SOUNDS,SOURCE,SPATIAL,' + - 'SQL,SQL_BIG_RESULT,SQL_BUFFER_RESULT,SQL_CACHE,SQL_CALC_FOUND_ROWS,' + - 'SQL_NO_CACHE,SQL_SMALL_RESULT,SQL_TSI_DAY,SQL_TSI_HOUR,' + - 'SQL_TSI_MICROSECOND,SQL_TSI_MINUTE,SQL_TSI_MONTH,SQL_TSI_QUARTER,' + - 'SQL_TSI_SECOND,SQL_TSI_WEEK,SQL_TSI_YEAR,SQLEXCEPTION,SQLSTATE,' + - 'SQLWARNING,STACKED,STARTING,START,STARTS,STATS_AUTO_RECALC,' + - 'STATS_PERSISTENT,STATS_SAMPLE_PAGES,STATUS,STOP,STORAGE,STORED,' + - 'STRAIGHT_JOIN,SUBCLASS_ORIGIN,SUBPARTITION,SUBPARTITIONS,SUPER,SUSPEND,' + - 'SWAPS,SWITCHES,TABLE,TABLE_CHECKSUM,TABLE_NAME,TABLES,TABLESPACE,' + - 'TEMPORARY,TERMINATED,THAN,TO,TRADITIONAL,TRAILING,TRANSACTION,' + - 'TRANSACTIONAL,TRIGGER,TRIGGERS,TRUE,TYPE,UNCOMMITTED,UNDO,UNINSTALL,' + - 'UNION,UNIQUE,UNKNOWN,UNLOCK,UPDATE,UPGRADE,USAGE,USE,USE_FRM,' + - 'USING,VALIDATION,VALUE,VALUES,VARIABLES,VIEW,VIRTUAL,WAIT,WARNINGS,' + - 'WHERE,WRAPPER,WRITE,WITH,WITHOUT,WORK,XA,XID,XML,XOR,YEAR_MONTH'; - - // PLSQL keywords - MySQLPLSQLKW: string = - 'CASE,CLOSE,EXIT,FETCH,GOTO,HANDLER,ITERATE,IF,LEAVE,LOOP,REPEAT,THEN,' + - 'UNTIL,WHEN,WHILE'; - - MySQLTypes: string = - - // Table Engines - 'ARCHIVE,BDB,BERKELEYDB,BLACKHOLE,CSV,EXAMPLE,FEDERATED,HEAP,INNOBASE,' + - 'InnoDB,ISAM,MEMORY,MERGE,MRG_ISAM,MRG_MYISAM,MyISAM,NDB,NDBCLUSTER,' + - - // Index Types - 'BTREE,HASH,' + - - // Column Types - 'bigint,blob,bool,boolean,byte,char,date,datetime,decimal,double,enum,' + - 'float,geometry,geometrycollection,int,integer,linestring,longblob,' + - 'longtext,mediumblob,mediumint,mediumtext,multilinestring,multipoint,' + - 'multipolygon,national,numeric,point,polygon,precision,real,serial,' + - 'signed,smallint,string,text,time,timestamp,tinyblob,tinyint,tinytext,' + - 'unicode,unsigned,varbinary,varchar,year,zerofill,' + - - // Row Formats - 'COMPACT,COMPRESSED,DISK,DYNAMIC,FIXED,REDUNDANT,' + - - // Raid Types - 'RAID0,STRIPED,' + - - // View Algorythm - 'UNDEFINED,TEMPTABLE,' + - - // Charsets - 'armscii8,big5,cp1250,cp1251,cp1256,cp1257,cp850,cp852,' + - 'cp866,cp932,dec8,eucjpms,euckr,gb18030,gb2312,gbk,geostd8,greek,hebrew,' + - 'hp8,keybcs2,koi8r,koi8u,latin1,latin2,latin5,latin7,macce,macroman,sjis,' + - 'swe7,tis620,ucs2,ujis,utf16,utf16le,utf32,utf8,utf8mb4,' + - - '_armscii8,_big5,_cp1250,_cp1251,_cp1256,_cp1257,_cp850,' + - '_cp852,_cp866,_cp932,_dec8,_eucjpms,_euckr,_gb18030,_gb2312,_gbk,' + - '_geostd8,_greek,_hebrew,_hp8,_keybcs2,_koi8r,_koi8u,_latin1,_latin2,' + - '_latin5,_latin7,_macce,_macroman,_sjis,_swe7,_tis620,_ucs2,_ujis,_utf16,' + - '_utf16le,_utf32,_utf8,_utf8mb4,' + - - // Collations - 'armscii8_bin,armscii8_general_ci,ascii_bin,ascii_general_ci,big5_bin,' + - 'big5_chinese_ci,binary,cp1250_bin,cp1250_croatian_ci,cp1250_czech_cs,' + - 'cp1250_general_ci,cp1250_polish_ci,cp1251_bin,cp1251_bulgarian_ci,' + - 'cp1251_general_ci,cp1251_general_cs,cp1251_ukrainian_ci,cp1256_bin,' + - 'cp1256_general_ci,cp1257_bin,cp1257_general_ci,cp1257_lithuanian_ci,' + - 'cp850_bin,cp850_general_ci,cp852_bin,cp852_general_ci,cp866_bin,' + - 'cp866_general_ci,cp932_bin,cp932_japanese_ci,dec8_bin,dec8_swedish_ci,' + - 'eucjpms_bin,eucjpms_japanese_ci,euckr_bin,euckr_korean_ci,gb18030_bin,' + - 'gb18030_chinese_ci,gb18030_unicode_520_ci,gb2312_bin,gb2312_chinese_ci,' + - 'gbk_bin,gbk_chinese_ci,geostd8_bin,geostd8_general_ci,greek_bin,' + - 'greek_general_ci,hebrew_bin,hebrew_general_ci,hp8_bin,hp8_english_ci,' + - 'keybcs2_bin,keybcs2_general_ci,koi8r_bin,koi8r_general_ci,koi8u_bin,' + - 'koi8u_general_ci,latin1_bin,latin1_danish_ci,latin1_general_ci,' + - 'latin1_general_cs,latin1_german1_ci,latin1_german2_ci,latin1_spanish_ci,' + - 'latin1_swedish_ci,latin2_bin,latin2_croatian_ci,latin2_czech_cs,' + - 'latin2_general_ci,latin2_hungarian_ci,latin5_bin,latin5_turkish_ci,' + - 'latin7_bin,latin7_estonian_cs,latin7_general_ci,latin7_general_cs,' + - 'macce_bin,macce_general_ci,macroman_bin,macroman_general_ci,sjis_bin,' + - 'sjis_japanese_ci,swe7_bin,swe7_swedish_ci,tis620_bin,tis620_thai_ci,' + - 'ucs2_bin,ucs2_croatian_ci,ucs2_czech_ci,ucs2_danish_ci,' + - 'ucs2_esperanto_ci,ucs2_estonian_ci,ucs2_general_ci,' + - 'ucs2_general_mysql500_ci,ucs2_german2_ci,ucs2_hungarian_ci,' + - 'ucs2_icelandic_ci,ucs2_latvian_ci,ucs2_lithuanian_ci,ucs2_persian_ci,' + - 'ucs2_polish_ci,ucs2_romanian_ci,ucs2_roman_ci,ucs2_sinhala_ci,' + - 'ucs2_slovak_ci,ucs2_slovenian_ci,ucs2_spanish2_ci,ucs2_spanish_ci,' + - 'ucs2_swedish_ci,ucs2_turkish_ci,ucs2_unicode_520_ci,ucs2_unicode_ci,' + - 'ucs2_vietnamese_ci,ujis_bin,ujis_japanese_ci,utf16le_bin,' + - 'utf16le_general_ci,utf16_bin,utf16_croatian_ci,utf16_czech_ci,' + - 'utf16_danish_ci,utf16_esperanto_ci,utf16_estonian_ci,utf16_general_ci,' + - 'utf16_german2_ci,utf16_hungarian_ci,utf16_icelandic_ci,utf16_latvian_ci,' + - 'utf16_lithuanian_ci,utf16_persian_ci,utf16_polish_ci,utf16_romanian_ci,' + - 'utf16_roman_ci,utf16_sinhala_ci,utf16_slovak_ci,utf16_slovenian_ci,' + - 'utf16_spanish2_ci,utf16_spanish_ci,utf16_swedish_ci,utf16_turkish_ci,' + - 'utf16_unicode_520_ci,utf16_unicode_ci,utf16_vietnamese_ci,utf32_bin,' + - 'utf32_croatian_ci,utf32_czech_ci,utf32_danish_ci,utf32_esperanto_ci,' + - 'utf32_estonian_ci,utf32_general_ci,utf32_german2_ci,utf32_hungarian_ci,' + - 'utf32_icelandic_ci,utf32_latvian_ci,utf32_lithuanian_ci,' + - 'utf32_persian_ci,utf32_polish_ci,utf32_romanian_ci,utf32_roman_ci,' + - 'utf32_sinhala_ci,utf32_slovak_ci,utf32_slovenian_ci,utf32_spanish2_ci,' + - 'utf32_spanish_ci,utf32_swedish_ci,utf32_turkish_ci,utf32_unicode_520_ci,' + - 'utf32_unicode_ci,utf32_vietnamese_ci,utf8mb4_bin,utf8mb4_croatian_ci,' + - 'utf8mb4_czech_ci,utf8mb4_danish_ci,utf8mb4_esperanto_ci,' + - 'utf8mb4_estonian_ci,utf8mb4_general_ci,utf8mb4_german2_ci,' + - 'utf8mb4_hungarian_ci,utf8mb4_icelandic_ci,utf8mb4_latvian_ci,' + - 'utf8mb4_lithuanian_ci,utf8mb4_persian_ci,utf8mb4_polish_ci,' + - 'utf8mb4_romanian_ci,utf8mb4_roman_ci,utf8mb4_sinhala_ci,' + - 'utf8mb4_slovak_ci,utf8mb4_slovenian_ci,utf8mb4_spanish2_ci,' + - 'utf8mb4_spanish_ci,utf8mb4_swedish_ci,utf8mb4_turkish_ci,' + - 'utf8mb4_unicode_520_ci,utf8mb4_unicode_ci,utf8mb4_vietnamese_ci,' + - 'utf8_bin,utf8_croatian_ci,utf8_czech_ci,utf8_danish_ci,' + - 'utf8_esperanto_ci,utf8_estonian_ci,utf8_general_ci,' + - 'utf8_general_mysql500_ci,utf8_german2_ci,utf8_hungarian_ci,' + - 'utf8_icelandic_ci,utf8_latvian_ci,utf8_lithuanian_ci,utf8_persian_ci,' + - 'utf8_polish_ci,utf8_romanian_ci,utf8_roman_ci,utf8_sinhala_ci,' + - 'utf8_slovak_ci,utf8_slovenian_ci,utf8_spanish2_ci,utf8_spanish_ci,' + - 'utf8_swedish_ci,utf8_turkish_ci,utf8_unicode_520_ci,utf8_unicode_ci,' + - 'utf8_vietnamese_ci'; - - // functions - MySQLFunctions: string = - 'ABS,ACOS,ADDDATE,ADDTIME,AES_DECRYPT,AES_ENCRYPT,ANY_VALUE,AREA,' + - 'ASBINARY,ASCII,ASIN,ASTEXT,ASWKBASWKT,ASYMMETRIC_DECRYPT,' + - 'ASYMMETRIC_DERIVE,ASYMMETRIC_ENCRYPT,ASYMMETRIC_SIGN,ASYMMETRIC_VERIFY,' + - 'ATAN,ATAN2,AVG,BIN,BIT_AND,BIT_COUNT,BIT_LENGTH,BIT_OR,BIT_XOR,BUFFER,' + - 'CAST,CEIL,CEILING,CENTROID,CHAR_LENGTH,CHARACTER_LENGTH,COALESCE,' + - 'COERCIBILITY,COMPRESS,CONCAT,CONCAT_WS,CONNECTION_ID,CONV,CONVERT_TZ,' + - 'CONVEXHULL,COS,COT,COUNT,CRC32,CREATE_ASYMMETRIC_PRIV_KEY,' + - 'CREATE_ASYMMETRIC_PUB_KEY,CREATE_DH_PARAMETERS,CREATE_DIGEST,CROSSES,' + - 'CURDATE,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,' + - 'CURTIME,DATE_ADD,DATE_FORMAT,DATE_SUB,DATEDIFF,DAY,DAYNAME,DAYOFMONTH,' + - 'DAYOFWEEK,DAYOFYEAR,DECODE,DEGREES,DES_DECRYPT,DES_ENCRYPT,DIMENSION,' + - 'DISJOINT,DISTANCE,ELT,ENCODE,ENCRYPT,ENDPOINT,ENVELOPE,EQUALS,EXP,' + - 'EXPORT_SET,EXTERIORRING,EXTRACT,EXTRACTVALUE,FIELD,FIND_IN_SET,FLOOR,' + - 'FORMAT,FOUND_ROWS,FROM_BASE64,FROM_DAYS,FROM_UNIXTIME,GEOMCOLLFROMTEXT,' + - 'GEOMCOLLFROMWKB,GEOMETRYCOLLECTIONFROMTEXT,GEOMETRYCOLLECTIONFROMWKB,' + - 'GEOMETRYFROMTEXT,GEOMETRYFROMWKB,GEOMETRYN,GEOMETRYTYPE,GEOMFROMTEXT,' + - 'GEOMFROMWKB,GET_FORMAT,GET_LOCK,GLENGTH,GREATEST,GROUP_CONCAT,' + - 'GTID_SUBSET,GTID_SUBTRACT,HEX,HOUR,IFNULL,INET_ATON,INET_NTOA,' + - 'INET6_ATON,INET6_NTOA,INSTR,INTERIORRINGN,INTERSECTS,INTERVAL,' + - 'IS_FREE_LOCK,IS_IPV4,IS_IPV4_COMPAT,IS_IPV4_MAPPED,IS_IPV6,IS_USED_LOCK,' + - 'ISCLOSED,ISEMPTY,ISNULL,ISSIMPLE,JSON_APPEND,JSON_ARRAY,' + - 'JSON_ARRAY_APPEND,JSON_ARRAY_INSERT,JSON_CONTAINS,JSON_CONTAINS_PATH,' + - 'JSON_DEPTH,JSON_EXTRACT,JSON_INSERT,JSON_KEYS,JSON_LENGTH,JSON_MERGE,' + - 'JSON_OBJECT,JSON_QUOTE,JSON_REMOVE,JSON_REPLACE,JSON_SEARCH,JSON_SET,' + - 'JSON_TYPE,JSON_UNQUOTE,JSON_VALID,LAST_DAY,LAST_INSERT_ID,LCASE,LEAST,' + - 'LEFT,LENGTH,LINEFROMTEXT,LINEFROMWKB,LINESTRINGFROMTEXT,' + - 'LINESTRINGFROMWKB,LN,LOAD_FILE,LOCALTI,LOCALTIME,LOCALTIMESTAMP,LOCATE,' + - 'LOG,LOG10,LOG2,LOWER,LPAD,LTRIM,MAKE_SET,MAKEDATE,MAKETIME,' + - 'MASTER_POS_WAIT,MAX,MBRCONTAINS,MBRCOVEREDBY,MBRCOVERS,MBRDISJOINT,' + - 'MBREQUAL,MBREQUALS,MBRINTERSECTS,MBROVERLAPS,MBRTOUCHES,MBRWITHIN,MD5,' + - 'MICROSECOND,MID,MIN,MINUTE,MLINEFROMTEXT,MLINEFROMWKB,MONTH,' + - 'MONTHNAME,MPOINTFROMTEXT,MPOINTFROMWKB,MPOLYFROMTEXT,MPOLYFROMWKB,' + - 'MULTILINESTRINGFROMTEXT,MULTILINESTRINGFROMWKB,MULTIPOINTFROMTEXT,' + - 'MULTIPOINTFROMWKB,MULTIPOLYGONFROMTEXT,MULTIPOLYGONFROMWKB,NAME_CONST,' + - 'NOW,NULLIF,NUMGEOMETRIES,NUMINTERIORRINGS,NUMPOINTS,OCT,OCTET_LENGTH,' + - 'OLD_PASSWORD,ORD,OVERLAPS,PASSWORD,PERIOD_ADD,PERIOD_DIFF,PI,' + - 'POINTFROMTEXT,POINTFROMWKB,POINTN,POLYFROMTEXT,POLYFROMWKB,' + - 'POLYGONFROMTEXT,POLYGONFROMWKB,POSITION,POW,POWER,QUARTER,QUOTE,RADIANS,' + - 'RAND,RANDOM_BYTES,RELEASE_ALL_LOCKS,RELEASE_LOCK,REVERSE,RIGHT,ROUND,' + - 'ROW_COUNT,RPAD,RTRIM,SEC_TO_TIME,SECOND,SESSION_USER,SHA,SHA1,SHA2,SIGN,' + - 'SIN,SLEEP,SOUNDEX,SPACE,SQRT,SRID,ST_AREA,ST_ASBINARY,ST_ASGEOJSON,' + - 'ST_ASTEXT,ST_ASWKB,ST_ASWKT,ST_BUFFER,ST_BUFFER_STRATEGY,ST_CENTROID,' + - 'ST_CONTAINS,ST_CONVEXHULL,ST_CROSSES,ST_DIFFERENCE,ST_DIMENSION,' + - 'ST_DISJOINT,ST_DISTANCE,ST_DISTANCE_SPHERE,ST_ENDPOINT,ST_ENVELOPE,' + - 'ST_EQUALS,ST_EXTERIORRING,ST_GEOHASH,ST_GEOMCOLLFROMTEXT,' + - 'ST_GEOMCOLLFROMTXT,ST_GEOMCOLLFROMWKB,ST_GEOMETRYCOLLECTIONFROMTEXT,' + - 'ST_GEOMETRYCOLLECTIONFROMWKB,ST_GEOMETRYFROMTEXT,ST_GEOMETRYFROMWKB,' + - 'ST_GEOMETRYN,ST_GEOMETRYTYPE,ST_GEOMFROMGEOJSON,ST_GEOMFROMTEXT,' + - 'ST_GEOMFROMWKB,ST_INTERIORRINGN,ST_INTERSECTION,ST_INTERSECTS,' + - 'ST_ISCLOSED,ST_ISEMPTY,ST_ISSIMPLE,ST_ISVALID,ST_LATFROMGEOHASH,' + - 'ST_LENGTH,ST_LINEFROMTEXT,ST_LINEFROMWKB,ST_LINESTRINGFROMTEXT,' + - 'ST_LINESTRINGFROMWKB,ST_LONGFROMGEOHASH,ST_MAKEENVELOPE,' + - 'ST_MLINEFROMTEXT,ST_MLINEFROMWKB,ST_MPOINTFROMTEXT,ST_MPOINTFROMWKB,' + - 'ST_MPOLYFROMTEXT,ST_MPOLYFROMWKB,ST_MULTILINESTRINGFROMTEXT,' + - 'ST_MULTILINESTRINGFROMWKB,ST_MULTIPOINTFROMTEXT,ST_MULTIPOINTFROMWKB,' + - 'ST_MULTIPOLYGONFROMTEXT,ST_MULTIPOLYGONFROMWKB,ST_NUMGEOMETRIES,' + - 'ST_NUMINTERIORRING,ST_NUMINTERIORRINGS,ST_NUMPOINTS,ST_OVERLAPS,' + - 'ST_POINTFROMGEOHASH,ST_POINTFROMTEXT,ST_POINTFROMWKB,ST_POINTN,' + - 'ST_POLYFROMTEXT,ST_POLYFROMWKB,ST_POLYGONFROMTEXT,ST_POLYGONFROMWKB,' + - 'ST_SIMPLIFY,ST_SRID,ST_STARTPOINT,ST_SYMDIFFERENCE,ST_TOUCHES,ST_UNION,' + - 'ST_VALIDATE,ST_WITHIN,ST_X,ST_Y,STARTPOINT,STD,STDDEV,STDDEV_POP,' + - 'STDDEV_SAMP,STR_TO_DATE,STRCMP,SUBDATE,SUBSTR,SUBSTRING,SUBSTRING_INDEX,' + - 'SUBTIME,SUM,SYSDATE,SYSTEM_USER,TAN,TIME_FORMAT,TIME_TO_SEC,TIMEDIFF,' + - 'TIMESTAMPADD,TIMESTAMPDIFF,TO_BASE64,TO_DAYS,TO_SECONDS,TOUCHES,TRIM,' + - 'TRUNCATE,UCASE,UNCOMPRESS,UNCOMPRESSED_LENGTH,UNHEX,UNIX_TIMESTAMP,' + - 'UPDATEXML,UPPER,USER,UTC_DATE,UTC_TIME,UTC_TIMESTAMP,UUID,UUID_SHORT,' + - 'VALIDATE_PASSWORD_STRENGTH,VAR_POP,VAR_SAMP,VARIANCE,VERSION,' + - 'WAIT_FOR_EXECUTED_GTID_SET,WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS,WEEK,' + - 'WEEKDAY,WEEKOFYEAR,WEIGHT_STRING,WITHIN,X,Y,YEARWEEK'; - -//---Ingres--------------------------------------------------------------------- - // keywords - IngresKW: string = - 'ABORT,ACTIVATE,ADD,ADDFORM,AFTER,AGGREGATE,ALL,ALTER,AND,APPEND,ARRAY,' + - 'AS,ASC,AT,AUDIT_LOG,AUTHORIZATION,AUTOCOMMIT,AVGU,BEFORE,BEGIN,BETWEEN,' + - 'BREAKDISPLAY,BY,BYREF,CACHE,CALL,CALLFRAME,CALLPROC,CASCADE,CHECK,CLEAR,' + - 'CLEARROW,CLOSE,COLUMN,COMMAND,COMMENT,COMMIT,CONNECT,CONSTRAINT,' + - 'CONTINUE,COPY,COUNTU,CPUFACTOR,CREATE,CURRENT,CURRENT_USER,CURSOR,DATA,' + - 'DATAHANDLER,DATE_FORMAT,DBEVENT,DDL_CONCURRENCY,DEADLOCK,DECLARE,' + - 'DEFAULT,DEFERRED,DEFINE,DELETE,DELETEROW,DESC,DESCRIBE,DESCRIPTOR,' + - 'DESTROY,DIRECT,DISABLE,DISCONNECT,DISPLAY,DISTINCT,DISTRIBUTE,DO,DOWN,' + - 'DROP,ELSE,ELSEIF,ENABLE,END,ENDDATA,ENDDISPLAY,ENDFORMS,ENDIF,ENDLOOP,' + - 'ENDRETRIEVE,ENDSELECT,ENDWHILE,ERROR,ESCAPE,EXCLUDE,EXCLUDING,EXEC,' + - 'EXECUTE,EXISTS,EXIT,FETCH,FIELD,FINALIZE,FOR,FOREIGN,FORMDATA,FORMINIT,' + - 'FORMS,FROM,FULL,GET,GETFORM,GETOPER,GETROW,GLOBAL,GOTO,GRANT,GRANTED,' + - 'HAVING,HELP,HELP_FORMS,HELP_FRS,HELPFILE,IDENTIFIED,IF,IIMESSAGE,' + - 'IIPRINTF,IIPROMPT,IISTATEMENT,IMMEDIATE,IMPORT,IN,INCLUDE,INDEX,' + - 'INDICATOR,INGRES,INITIALIZE,INITTABLE,INNER,INQUIRE_EQUEL,INQUIRE_FORMS,' + - 'INQUIRE_FRS,INQUIRE_INGRES,INSERT,INSERTROW,INSTALLATION,INTEGRITY,INTO,' + - 'IO_TRACE,IS,J_FREESZ1,J_FREESZ2,J_FREESZ3,J_FREESZ4,J_SORTBUFSZ,' + - 'JCPUFACTOR,JOIN,JOINOP,JOURNALING,KEY,LEVEL,LIKE,LINK,LOADTABLE,LOCAL,' + - 'LOCATION,LOCK_TRACE,LOG_TRACE,LOGDBEVENTS,LOGGING,MAXCOST,MAXCPU,' + - 'MAXPAGE,MENUITEM,MESSAGE,MODE,MODIFY,MODULE,MONEY_FORMAT,MONEY_PREC,' + - 'MOVE,NATURAL,NEXT,NODEADLOCK,NOECHO,NOIO_TRACE,NOJIONOP,NOJOURNALING,' + - 'NOLOCK_TRACE,NOLOG_TRACE,NOLOGDBEVENTS,NOLOGGING,NOMAXCOST,NOMAXCPU,' + - 'NOMAXIO,NOMAXPAGE,NOMAXQUERY,NOMAXROW,NOOPTIMIZEONLY,NOPRINTDBEVENTS,' + - 'NOPRINTQRY,NOPRINTRULES,NOQEP,NORULES,NOSQL,NOSTATISTICS,NOT,NOTRACE,' + - 'NULL,OF,ON,ONLY,OPEN,OPTIMIZEONLY,OPTION,OR,ORDER,OUT,PARAM,PERMIT,' + - 'PREPARE,PRESERVE,PRIMARY,PRINT,PRINTDBEVENTS,PRINTQRY,PRINTSCREEN,' + - 'PRIVILEGES,PROCEDURE,PROMPT,PUBLIC,PUT,PUTFORM,PUTOPER,PUTROW,QBUFSIZE,' + - 'QEP,QRY,QUALIFICATION,QUERY_SIZE,RAISE,RANGE,READONLY,REDISPLAY,' + - 'REFERENCES,REFERENCING,REGISTER,RELOCATE,REMOVE,RENAME,REPEAT,REPEATED,' + - 'REPLACE,REPLICATE,RESTRICT,RESULT_STRUCTURE,RESUME,RET_INTO,RETRIEVE,' + - 'RETURN,RETURNING,REVOKE,ROLLBACK,ROWS,RULE,RUN,SAVE,SAVEPOINT,SCHEMA,' + - 'SCREEN,SCROLL,SCROLLDOWN,SCROLLUP,SECTION,SECURITY_ALARM,SECURITY_AUDIT,' + - 'SELECT,SESSION,SET,SET_4GL,SET_EQUAL,SET_FORMS,SET_FRS,SET_INGRES,' + - 'SET_SQL,SHORT_REMARK,SLEEP,SOME,SORT,SORTBUFSIZE,SQL,STATISTICS,STOP,' + - 'SUBMENU,SUMU,SYNONYM,SYSTEM,TABLE,TABLEDATA,TEWMPORARY,THEN,TO,TRACE,' + - 'TRANSACTION,TYPE,UNION,UNIQUE,UNLOADTABLE,UNTIL,UP,UPDATE,USER,USING,' + - 'VALIDATE,VALIDROW,VALUES,VIEW,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK'; - - // types - IngresTypes: string = - 'BYTE,C,CHAR,CHARACTER,DATE,DECIMAL,FLOAT,FLOAT4,FLOAT8,INTEGER,INTEGER1,' + - 'INTEGER2,INTEGER4,LONG,MONEY,OBJECT_KEY,SECURITY_LABEL,SHORT,SMALLINT,' + - 'TABLE_KEY,TEXT,VARCHAR,VARYING'; - - // functions - IngresFunctions: string = - '_BINTIM,_CPU_MS,_DATE,_DIO_CNT,_ET_SEC,_PFAULT_CNT,_TIME,_VERSION,ABS,' + - 'ANY,ATAN,AUTOCOMMIT_STATE,AVG,BIOCNT,CHAREXTRACT,COLLATION,CONCAT,' + - 'CONNECT_TIME_LIMIT,COS,COUNT,CREATE_PROCEDURE,CREATE_TABLE,DATABASE,' + - 'DATE_GMT,DATE_PART,DATE_TRUNC,DB_ADMIN,DB_DELIMITED_CASE,DB_NAME_CASE,' + - 'DBA,DBMS_BIO,DBMS_CPU,DBMS_DIO,DBMSINFO,DOW,EXP,FLATTEN_AGGREGATE,' + - 'FLATTEN_NONE,FLATTEN_OPTIMIZE,FLATTEN_SINGLETON,GROUP,HEX,' + - 'IDLE_TIME_LIMIT,IFNULL,INITIAL_USER,INQUIRE_SQL,INT1,INT2,INT4,INTERVAL,' + - 'LANGUAGE,LEFT,LENGTH,LOCATE,LOCKMODE,LOG,LONG_BYTE,LONG_VARCHAR,' + - 'LOWERCASE,MAX,MAXCONNECT,MAXIDLE,MAXIO,MAXQUERY,MAXROW,MIN,MOD,NOTRIM,' + - 'ON_ERROR_STATE,PAD,QUERY_IO_LIMIT,QUERY_LANGUAGE,QUERY_ROW_LIMIT,RIGHT,' + - 'ROLE,SECURITY_AUDIT_LOG,SECURITY_AUDIT_STATE,SECURITY_PRIV,' + - 'SELECT_SYSCAT,SERVER_CLASS,SESSION_ID,SESSION_PRIORITY,' + - 'SESSION_PRIORITY_LIMIT,SESSION_PRIV,SESSION_SECLABEL,SESSION_USER,SHIFT,' + - 'SIN,SIZE,SQRT,SQUEEZE,SUM,SYSTEM_USER,TABLE_STATISTICS,TERMINAL,' + - 'TRANSACTION_STATE,TRIM,UPDATE_ROWCNT,UPDATE_SYSCAT,UPPERCASE,USERNAME,' + - 'VARBYTE'; - -//---Nexus---------------------------------------------------------------------- - // keywords - NexusKW: string = - 'ABSOLUTE,AFTER,ALTER,ANY,ASC,ASSERT,ATOMIC,' + - 'ADD,ALL,AND,AS,ASSEMBLY,AUTHORIZATION,BEFORE,' + - 'BETWEEN,BINARY,BLOCK,BY,BEGIN,' + - 'BLOCKSIZE,CALL,CASCADE,CAST,,' + - 'CHARACTERS,CLR,CLOSE,CODEPAGE,COLLATION,COMMIT,CONTAINS,' + - 'CROSS,CALLED,CASE,CATCH,' + - 'CHECK,COALESCE,COLLATE,COLUMN,CONSTRAINT,' + - 'CREATE,CURSOR,DATA,DECLARE,' + - 'DELETE,DESC,DETERMINISTIC,DO,DROP,DAY,DEFAULT,DELETING,' + - 'DESCRIPTION,DISTINCT,EACH,ELSEIF,ENCRYPT,END,EQUIVALENT,' + - 'ESCAPE,EXECUTE,EXISTS,ELSE,EMPTY,ENCRYPTION,ENGINE,' + - 'EXCEPT,EXTERNAL,FALSE,FETCH,FETCH_STATUS,FOR,FROM,FUNCTION,FIRST,FOREIGN,' + - 'FULL,HAVING,HOUR,GLOBAL,GROW,GROUP,GROWSIZE,IDENTITY,IGNORE,' + - 'IMMEDIATE,IN,INITIAL,INNER,INPUT,INSERTING,INTERVAL,IS,IF,INDEX,' + - 'INITIALSIZE,INOUT,INSERT,INTERSECT,INTO,ITERATE,JOIN,' + - 'KANA,KEY,LANGUAGE,LEAVE,LIKE,LOCALE,' + - 'LARGE,LAST,LEFT,LOCAL,MATCH,' + - 'MINUTE,MODIFIES,MONTH,NAME,NATURAL,NEXT,NONSPACE,' + - 'NULLIF,NATIONAL,' + - 'NEW,NO,NORESTRICT,NOT,NULL,NULLS,OBJECT,OCTETS,OF,ON,OUT,OCTET_LENGTH,' + - 'ODD,OLD,OPEN,OR,ORDER,OUTER,PARTIAL,PERCENT,PRECISION,' + - 'PRIOR,PROCEDURE,PASSWORDS,PRIMARY,REFERENCES,RELATIVE,REMOVE,RESTRICT,' + - 'RETURNS,ROLLBACK,ROUTINE,READS,' + - 'REFERENCING,REPEAT,RETURN,RIGHT,ROW,SECOND,' + - 'SERIALIZABLE,SET,SIMPLE,SNAPSHOT,SORT,' + - 'STRING,SELECT,SIGNAL,' + - 'SOME,SQL,START,STORAGE,SYMBOLS,TABLE,' + - 'TOP,TRANSACTION,TRY,THEN,' + - 'TO,TRIGGER,TRUE,TYPE,UNION,UNKNOWN,UPDATE,' + - 'UNIQUE,UNTIL,UPDATING,USE,VALUES,VARYING,' + - 'VIEW,WHEN,WHILE,WITH,WORK,WHERE,WIDTH,YEAR'; - - // functions - NexusFunctions: string = - 'ABS,ATAN,ATAN2,ATN2,AVG,BOTH,BROUND,CEIL,CEILING,CHAR_LENGTH,CHARACTER_LENGTH,'+ - 'CHR,COS,COUNT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,ERROR_MESSAGE,EXP,EXTRACT,'+ - 'FLOOR,LASTAUTOINC,LEADING,LIST,LN,LOCALTIME,LOCALTIMESTAMP,LOWER,MAX,MED,MIN,MOD,NEWGUID,OCTECT,'+ - 'OCTECT_LENGTH,ORD,PI,POSITION,POWER,RAND,ROUND,ROWSAFFECTED,ROWSREAD,SESSION_USER,SIN,SQRT,STD,'+ - 'SUBSTRING,SUM,SYSTEM_ROW#,TOSTRING,TOSTRINGLEN,TRAILING,TRIM,UPPER,USER,USING'; - - // types - NexusTypes: string = - 'CHARACTER,CHAR,NULLSTRING,SHORTSTRING,SINGLECHAR,VARCHAR,' + - 'CLOB,TEXT,NSINGLECHAR,NCHAR,' + - 'NVARCHAR,NCLOB,BLOB,IMAGE,NUMERIC,DECIMAL,DEC,BYTE,TINYINT,SHORTINT,SMALLINT,INTEGER,INT,' + - 'AUTOINC,BIGINT,LARGEINT,WORD,DWORD,FLOAT,REAL,DOUBLE,EXTENDED,MONEY,' + - 'BOOLEAN,BOOL,DATE,TIME,TIMESTAMP,DATETIME,GUID,BYTEARRAY,RECREV'; - -//---Informix------------------------------------------------------------------- - // keywords - InformixKW: string = - 'ABSOLUTE,ACCESS,ACCESS_METHOD,ACTIVE,ADD,AFTER,AGGREGATE,ALIGNMENT,ALL,' + - 'ALL_ROWS,ALLOCATE,ALTER,AND,ANSI,ANY,APPEND,AS,ASC,AT,ATTACH,AUDIT,' + - 'AUTHORIZATION,AUTO,AUTOFREE,AVOID_EXECUTE,AVOID_SUBQF,BEFORE,BEGIN,' + - 'BETWEEN,BINARY,BOTH,BUFFERED,BUILTIN,BY,CACHE,CANNOTHASH,CASCADE,CHECK,' + - 'CLASS,CLIENT,CLOSE,CLUSTER,CLUSTERSIZE,COARSE,COBOL,CODESET,COLLATION,' + - 'COLLECTION,COLUMN,COMMIT,COMMITTED,COMMUTATOR,CONCURRENT,CONNECT,' + - 'CONNECTION,CONST,CONSTRAINT,CONSTRAINTS,CONSTRUCTOR,COPY,COSTFUNC,' + - 'CRCOLS,CREATE,CROSS,CURRENT_ROLE,CURSOR,CYCLE,DATABASE,DATAFILES,' + - 'DATASKIP,DBA,DBDATE,DBPASSWORD,DEALLOCATE,DEBUG,DEC_T,DECLARE,DEFAULT,' + - 'DEFERRED,DEFERRED_PREPARE,DELAY,DELETE,DELIMITER,DELUXE,DEREF,DESC,' + - 'DESCRIBE,DESCRIPTOR,DETACH,DIAGNOSTICS,DIRECTIVES,DIRTY,DISABLED,' + - 'DISCONNECT,DISTINCT,DISTRIBUTEBINARY,DISTRIBUTESREFERENCES,' + - 'DISTRIBUTIONS,DOCUMENT,DOMAIN,DONOTDISTRIBUTE,DORMANT,DROP,DTIME_T,EACH,' + - 'ELIF,ELSE,ENABLED,ENCRYPTION,END,ENUM,ENVIRONMENT,ESCAPE,EXCLUSIVE,EXEC,' + - 'EXECUTE,EXECUTEANYWHERE,EXISTS,EXPLAIN,EXPLICIT,EXPRESS,EXPRESSION,' + - 'EXTENT,EXTERNAL,FALSE,FAR,FETCH,FILE,FILLFACTOR,FILTERING,FIRST,' + - 'FIRST_ROWS,FIXCHAR,FIXED,FLUSH,FOREIGN,FORMAT,FORTRAN,FOUND,FRACTION,' + - 'FRAGMENT,FREE,FROM,FULL,FUNCTION,GENERAL,GET,GK,GLOBAL,GO,GOTO,GRANT,' + - 'GROUP,HANDLESNULLS,HASH,HAVING,HIGH,HINT,HOLD,HOUR,HYBRID,IFX_INT8_T,' + - 'IFX_LO_CREATE_SPEC_T,IFX_LO_STAT_T,IMMEDIATE,IMPLICIT,IN,INACTIVE,' + - 'INCREMENT,INDEX,INDEXES,INDICATOR,INFORMIX,INIT,INLINE,INNER,INOUT,' + - 'INSERT,INSTEAD,INTEG,INTERNAL,INTERNALLENGTH,INTO,INTRVL_T,IS,' + - 'ISCANONICAL,ISOLATION,ITEM,ITERATOR,JOIN,KEEP,KEY,LABELEQ,LABELGE,' + - 'LABELGLB,LABELGT,LABELLE,LABELLT,LABELLUB,LABELTOSTRING,LANGUAGE,LAST,' + - 'LEADING,LEFT,LEVEL,LIKE,LIMIT,LISTING,LOAD,LOC_T,LOCAL,LOCATOR,LOCK,' + - 'LOCKS,LOG,LONG,LOW,MATCHES,MAXERRORS,MAXLEN,MAXVALUE,MEDIAN,MEDIUM,' + - 'MEMORY_RESIDENT,MIDDLE,MINUTE,MINVALUE,MODE,MODERATE,MODIFY,MODULE,' + - 'MOUNTING,NAME,NEGATOR,NEW,NEXT,NO,NOCACHE,NOCYCLE,NOMAXVALUE,NOMIGRATE,' + - 'NOMINVALUE,NON_RESIDENT,NONE,NOORDER,NORMAL,NOT,NOTEMPLATEARG,NULL,' + - 'OF,OFF,OLD,ONLINE,ONLY,OPAQUE,OPCLASS,OPEN,OPERATIONAL,OPTCOMPIND,' + - 'OPTICAL,OPTIMIZATION,OPTION,OR,ORDER,OUT,OUTER,OUTPUT,PAGE,' + - 'PARALLELIZABLE,PARAMETER,PARTITION,PASCAL,PASSEDBYVALUE,PASSWORD,' + - 'PDQPRIORITY,PERCALL_COST,PLI,PLOAD,PREPARE,PREVIOUS,PRIMARY,PRIOR,' + - 'PRIVATE,PRIVILEGES,PROCEDURE,PUBLIC,PUT,RAW,READ,RECORDEND,REF,' + - 'REFERENCES,REFERENCING,REGISTER,REJECTFILE,RELATIVE,RELEASE,REMAINDER,' + - 'RENAME,REOPTIMIZATION,REPEATABLE,REPLICATION,RESERVE,RESOLUTION,' + - 'RESOURCE,RESTART,RESTRICT,RESUME,RETAIN,RETURNING,RETURNS,REUSE,REVOKE,' + - 'RIGHT,ROBIN,ROLE,ROLLBACK,ROLLFORWARD,ROUTINE,ROWID,ROWIDS,ROWS,SAMEAS,' + - 'SAMPLES,SAVE,SCHEDULE,SCHEMA,SCRATCH,SCROLL,SECOND,SECONDARY,SECTION,' + - 'SELCONST,SELECT,SELFUNC,SEQUENCE,SERIALIZABLE,SERVERUUID,SESSION,SHARE,' + - 'SHORT,SIGNED,SIZE,SKALL,SKINHIBIT,SKIP,SKSHOW,SOME,SPECIFIC,SQL,SQLCODE,' + - 'SQLCONTEXT,SQLERROR,SQLSTATE,SQLWARNING,STABILITY,STACK,STANDARD,START,' + - 'STATIC,STATISTICS,STEP,STOP,STORAGE,STRATEGIES,STRING,STRINGTOLABEL,' + - 'STRUCT,STYLE,SUPPORT,SYNC,SYNONYM,TABLE,TEMP,TEMPLATE,TEST,TIME,TIMEOUT,' + - 'TO,TRAILING,TRANSACTION,TRIGGER,TRIGGERS,TRUE,TRUNCATE,TYPE,TYPEDEF,' + - 'TYPEID,TYPENAME,TYPEOF,UNCOMMITTED,UNDER,UNION,UNIQUE,UNKNOWN,UNLOAD,' + - 'UNLOCK,UNSIGNED,UPDATE,USAGE,USE_SUBQF,USING,VALUE,VALUES,VAR,VARIABLE,' + - 'VARIANT,VIEW,VIOLATIONS,VOID,VOLATILE,WAIT,WARNING,WHERE,WITH,WITHOUT,' + - 'WORK,WRITE,XADATASOURCE,XID,XLOAD,XUNLOAD'; - - // types - InformixTypes: string = - 'BLOB,BOOLEAN,BYTE,CHAR,CHARACTER,VARYING,CLOB,DATE,DATETIME,DEC,DECIMAL,' + - 'DOUBLE,PRECISION,FLOAT,INT,INT8,INTEGER,INTERVAL,LIST,LVARCHAR,MONEY,' + - 'MULTISET,NCHAR,NUMERIC,NVARCHAR,REAL,ROW,SERIAL,SERIAL8,SET,SMALLFLOAT,' + - 'SMALLINT,TEXT,VARCHAR'; - - // PLSQL keywords - InformixPLSQLKW: string = - 'CALL,CONTINUE,DEFINE,ERROR,EXCEPTION,EXIT,FOR,FOREACH,IF,LET,ON,RAISE,' + - 'RETURN,SYSTEM,TRACE,WHENEVER,WHILE'; - - // functions - InformixFunctions: string = - 'ABS,ACOS,ASIN,ATAN,ATAN2,AVG,CARDINALITY,CASE,CAST,CHARACTER_LENGTH,' + - 'CHAR_LENGTH,COS,COUNT,CURRENT,DAY,DBINFO,DBSERVERNAME,DECODE,' + - 'DECRYPT_CHAR,DECRYPT_BINARY,DEFAULT_ROLE,ENCRYPT_AES,ENCRYPT_TDES,EXP,' + - 'EXTEND,FILETOBLOB,FILETOCLOB,GETHINT,HEX,IFX_ALLOW_NEWLINE,' + - 'IFX_REPLACE_MODULE,INITCAP,LENGTH,LOCOPY,LOGN,LOG10,LOTOFILE,LOWER,LPAD,' + - 'MAX,MDY,MIN,MOD,MONTH,NVL,OCTET_LENGTH,POW,RANGE,REPLACE,ROOT,ROUND,' + - 'RPAD,SIN,SITENAME,SQRT,STDEV,SUBSTR,SUBSTRING,SUM,TAN,THEN,TO_CHAR,TO_DATE,' + - 'TODAY,TRIM,TRUNC,UNITS,UPPER,USER,VARIANCE,WEEKDAY,WHEN,YEAR'; - -function TSynSQLSyn.HashKey(Str: PWideChar): Integer; -var - FoundDoubleMinus: Boolean; - - function GetOrd: Integer; - begin - case Str^ of - '_': Result := 1; - 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); - '@': - if fDialect in [sqlMSSQL7, sqlMSSQL2K] then - Result := 24 - else - Result := 0; - else Result := 0; - end; - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin - FoundDoubleMinus := (Str^ = '-') and ((Str + 1)^ = '-'); - if FoundDoubleMinus then Break; -{$IFOPT Q-} - Result := 2 * Result + GetOrd; -{$ELSE} - Result := (2 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - inc(Str); - end; - Result := Result and $FF; // 255 - if Assigned(fToIdent) then - fStringLen := Str - fToIdent - else - fStringLen := 0; -end; - -function TSynSQLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - fToIdent := MayBe; - Entry := fKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > fStringLen then - break - else if Entry.KeywordLen = fStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - exit; - end; - Entry := Entry.Next; - end; - if fTableDict.ContainsKey(SysUtils.AnsiLowerCase(Copy(StrPas(fToIdent), 1, fStringLen))) then - Result := tkTableName - else - Result := tkIdentifier; -end; - -constructor TSynSQLSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fKeywords := TSynHashEntryList.Create; - - FProcNames := TStringList.Create; - TStringList(FProcNames).OnChange := ProcNamesChanged; - - fTableNames := TStringList.Create; - TStringList(fTableNames).OnChange := TableNamesChanged; - FTableDict := TDictionary.Create; - - fFunctionNames := TStringList.Create; - TStringList(fFunctionNames).OnChange := FunctionNamesChanged; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fConditionalCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrConditionalComment, SYNS_FriendlyAttrConditionalComment); - fConditionalCommentAttri.Style := [fsItalic]; - AddAttribute(fConditionalCommentAttri); - fConsoleOutputAttri := TSynHighlighterAttributes.Create(SYNS_AttrConsoleOutput, SYNS_FriendlyAttrConsoleOutput); - fConsoleOutputAttri.Style := [fsBold, fsUnderline]; - AddAttribute(fConsoleOutputAttri); - fDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - fDataTypeAttri.Style := [fsBold]; - AddAttribute(fDataTypeAttri); - fDefaultPackageAttri := - TSynHighlighterAttributes.Create(SYNS_AttrDefaultPackage, SYNS_FriendlyAttrDefaultPackage); - fDefaultPackageAttri.Style := [fsBold]; - AddAttribute(fDefaultPackageAttri); - fDelimitedIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrDelimitedIdentifier, SYNS_FriendlyAttrDelimitedIdentifier); - AddAttribute(fDelimitedIdentifierAttri); - fExceptionAttri := TSynHighlighterAttributes.Create(SYNS_AttrException, SYNS_FriendlyAttrException); - fExceptionAttri.Style := [fsItalic]; - AddAttribute(fExceptionAttri); - fFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction); - fFunctionAttri.Style := [fsBold]; - AddAttribute(fFunctionAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fPLSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrPLSQL, SYNS_FriendlyAttrPLSQL); - fPLSQLAttri.Style := [fsBold]; - AddAttribute(fPLSQLAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fSQLPlusAttri:=TSynHighlighterAttributes.Create(SYNS_AttrSQLPlus, SYNS_FriendlyAttrSQLPlus); - fSQLPlusAttri.Style := [fsBold]; - AddAttribute(fSQLPlusAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_Attrstring, SYNS_FriendlyAttrstring); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fProcNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrProcName, SYNS_FriendlyAttrProcName); - AddAttribute(fProcNameAttri); - fTableNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrTableName, SYNS_FriendlyAttrTableName); - AddAttribute(fTableNameAttri); - fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(fVariableAttri); - SetAttributesOnChange(DefHighlightChange); - fDefaultFilter := SYNS_FilterSQL; - fRange := rsUnknown; - fDialect := sqlStandard; - InitializeKeywordLists; -end; - -destructor TSynSQLSyn.Destroy; -begin - fKeywords.Free; - fProcNames.Free; - fTableNames.Free; - fTableDict.Free; - fFunctionNames.Free; - inherited Destroy; -end; - -procedure TSynSQLSyn.Assign(Source: TPersistent); -begin - inherited Assign(Source); - if (Source is TSynSQLSyn) then - SQLDialect := TSynSQLSyn(Source).SQLDialect; -end; - -procedure TSynSQLSyn.AndSymbolProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '&']) then Inc(Run); -end; - -procedure TSynSQLSyn.AsciiCharProc; -var - IsEsc: Boolean; -begin - // Oracle SQL allows strings to go over multiple lines - if fLine[Run] = #0 then - NullProc - else begin - fTokenID := tkString; - // else it's end of multiline string - if SQLDialect <> sqlMySql then - begin - if (Run > 0) or (fRange <> rsString) or (fLine[Run] <> #39) then - begin - fRange := rsString; - repeat - Inc(Run); - until IsLineEnd(Run) or (fLine[Run] = #39); - end; - if fLine[Run] = #39 then - begin - Inc(Run); - fRange := rsUnknown; - end; - end - else - begin - IsEsc := False; - if (Run > 0) or (fRange <> rsString) or - ((fLine[Run] <> #39) and (fLine[Run - 1] <> '\')) then - begin - fRange := rsString; - repeat - if FLine[Run] = '\' then - IsEsc := not IsEsc - else - IsEsc := False; - if (not IsEsc) and (FLine[Run + 1] = #39) then - begin - Inc(Run); - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; - if (FLine[Run] = #39) and (not IsEsc) then - begin - Inc(Run); - fRange := rsUnknown; - end; - end; - end; -end; - -procedure TSynSQLSyn.CRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then Inc(Run); -end; - -procedure TSynSQLSyn.EqualProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); -end; - -procedure TSynSQLSyn.GreaterProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); -end; - -procedure TSynSQLSyn.IdentProc; -var - FoundDoubleMinus: Boolean; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - if FTokenID in [tkComment, tkConsoleOutput] then - begin - while not IsLineEnd(Run) do - Inc(Run); - end - else - while IsIdentChar(fLine[Run]) do - begin - FoundDoubleMinus := (fLine[Run] = '-') and (fLine[Run + 1] = '-'); - if FoundDoubleMinus then Break; - inc(Run); - end; -end; - -procedure TSynSQLSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynSQLSyn.LowerProc; -begin - fTokenID := tkSymbol; - Inc(Run); - case fLine[Run] of - '=': Inc(Run); - '<': begin - Inc(Run); - if fLine[Run] = '=' then Inc(Run); - end; - end; -end; - -procedure TSynSQLSyn.MinusProc; -begin - Inc(Run); - if (fLine[Run] = '-') and ((fDialect <> sqlMySQL) or (fLine[Run+1] = ' ')) then - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end - else - fTokenID := tkSymbol; -end; - -procedure TSynSQLSyn.HashProc; -begin - if SQLDialect = sqlMySql then - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end - else - begin - Inc(Run); - fTokenID := tkUnknown; - end; -end; - -procedure TSynSQLSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynSQLSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', '-': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then - Break; - end; - inc(Run); - end; -end; - -procedure TSynSQLSyn.OrSymbolProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '|']) then Inc(Run); -end; - -procedure TSynSQLSyn.PlusProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '+']) then Inc(Run); -end; - -procedure TSynSQLSyn.FunctionNamesChanged(Sender: TObject); -begin - InitializeKeywordLists; -end; - -procedure TSynSQLSyn.ProcNamesChanged(Sender: TObject); -begin - InitializeKeywordLists; -end; - -procedure TSynSQLSyn.SlashProc; -begin - Inc(Run); - case fLine[Run] of - '*': - begin - if (SQLDialect = sqlMySql) and (fLine[Run + 1] = '!') then - begin - fRange := rsConditionalComment; - fTokenID := tkConditionalComment; - end - else - begin - fRange := rsComment; - fTokenID := tkComment; - end; - repeat - Inc(Run); - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - fRange := rsUnknown; - Inc(Run, 2); - break; - end; - until IsLineEnd(Run); - end; - '=': - begin - Inc(Run); - fTokenID := tkSymbol; - end; - '/': - begin - if (SQLDialect = sqlNexus) then - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end; - end - else - fTokenID := tkSymbol; - end; -end; - -procedure TSynSQLSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynSQLSyn.QuoteProc; -begin - fTokenID := tkDelimitedIdentifier; - Inc(Run); - while not IsLineEnd(Run) do - begin - if fLine[Run] = #34 then - begin - Inc(Run); - if fLine[Run] <> #34 then - Break; - end; - Inc(Run); - end; -end; - -procedure TSynSQLSyn.BacktickProc; -begin - if SQLDialect = sqlMySql then - begin - fTokenID := tkDelimitedIdentifier; - Inc(Run); - while not IsLineEnd(Run) do - begin - if fLine[Run] = '`' then - begin - Inc(Run); - if fLine[Run] <> '`' then - Break; - end; - Inc(Run); - end; - end - else - begin - Inc(Run); - fTokenID := tkUnknown; - end; -end; - -procedure TSynSQLSyn.BracketProc; -begin - if SQLDialect in [sqlMSSQL7, sqlMSSQL2K] then - begin - fTokenID := tkDelimitedIdentifier; - Inc(Run); - while not IsLineEnd(Run) do - begin - if fLine[Run] = ']' then - begin - Inc(Run); - if fLine[Run] <> ']' then - Break; - end; - Inc(Run); - end; - end - else - begin - Inc(Run); - fTokenID := tkSymbol; - end; -end; - -procedure TSynSQLSyn.SymbolProc; -begin - Inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynSQLSyn.SymbolAssignProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if fLine[Run] = '=' then Inc(Run); -end; - -procedure TSynSQLSyn.VariableProc; -var - i: integer; - FoundDoubleMinus: Boolean; -begin - // MS SQL Server uses @@ to indicate system functions/variables - if (SQLDialect in [sqlMSSQL7, sqlMSSQL2K]) and (fLine[Run] = '@') and (fLine[Run + 1] = '@') then - IdentProc - else if (SQLDialect in [sqlMySql, sqlOracle]) and (fLine[Run] = '@') then - SymbolProc - // Oracle uses the ':' character to indicate bind variables - // Ingres II also uses the ':' character to indicate variables - else if not (SQLDialect in [sqlOracle, sqlIngres]) and (fLine[Run] = ':') then - SymbolProc - else - begin - fTokenID := tkVariable; - i := Run; - repeat - FoundDoubleMinus := (fLine[i] = '-') and (fLine[i + 1] = '-'); - if FoundDoubleMinus then Break; - Inc(i); - until not IsIdentChar(fLine[i]); - Run := i; - end; -end; - -procedure TSynSQLSyn.UnknownProc; -begin - Inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynSQLSyn.AnsiCProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - begin - if fRange = rsConditionalComment then - fTokenID := tkConditionalComment - else - fTokenID := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then - begin - fRange := rsUnknown; - Inc(Run, 2); - Break; - end; - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; - -function TSynSQLSyn.IsKeyword(const AKeyword: string): Boolean; -var - tk: TtkTokenKind; -begin - tk := IdentKind(PWideChar(AKeyword)); - Result := tk in [tkDatatype, tkException, tkFunction, tkKey, tkPLSQL, - tkDefaultPackage]; -end; - -procedure TSynSQLSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment, rsConditionalComment: - AnsiCProc; - rsConsoleOutput: - begin - while not IsLineEnd(Run) do - Inc(Run); - end; - rsString: - AsciiCharProc; - else - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #39: AsciiCharProc; - '=': EqualProc; - '>': GreaterProc; - '<': LowerProc; - '-': MinusProc; - '#': HashProc; - '|': OrSymbolProc; - '+': PlusProc; - '/': SlashProc; - '&': AndSymbolProc; - #34: QuoteProc; - '`': BacktickProc; - '[': BracketProc; - ':', '@': VariableProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '^', '%', '*', '!': SymbolAssignProc; - '{', '}', '.', ',', ';', '?', '(', ')', ']', '~': SymbolProc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynSQLSyn.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 TSynSQLSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynSQLSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynSQLSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynSQLSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkConditionalComment: Result := fConditionalCommentAttri; - tkConsoleOutput: Result := FConsoleOutputAttri; - tkDatatype: Result := fDataTypeAttri; - tkDefaultPackage: Result := fDefaultPackageAttri; - tkDelimitedIdentifier: Result := fDelimitedIdentifierAttri; - tkException: Result := fExceptionAttri; - tkFunction: Result := fFunctionAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkPLSQL: Result := fPLSQLAttri; - tkSpace: Result := fSpaceAttri; - tkSQLPlus: Result := fSQLPlusAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkProcName: Result := FProcNameAttri; - tkTableName: Result := fTableNameAttri; - tkVariable: Result := fVariableAttri; - tkUnknown: Result := fIdentifierAttri; - else - Result := nil; - end; -end; - -function TSynSQLSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynSQLSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynSQLSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynSQLSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterSQL; -end; - -function TSynSQLSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - 'a'..'z', 'A'..'Z', '0'..'9', '_': - Result := True; - '-': - Result := fDialect = sqlStandard; - '#', '$': // TODO: check this case, ANSI code wasn't clear here if this is exclusively Oracle - Result := fDialect in [sqlOracle, sqlNexus]; - '@': - Result := fDialect in [sqlMSSQL7, sqlMSSQL2K]; - '!', '^', '{', '}','~': - Result := fDialect = sqlNexus - else - Result := False; - end; -end; - -class function TSynSQLSyn.GetLanguageName: string; -begin - Result := SYNS_LangSQL; -end; - -procedure TSynSQLSyn.DoAddKeyword(AKeyword: string; AKind: integer); -var - HashValue: Integer; -begin - AKeyword := SysUtils.AnsiLowerCase(AKeyword); - HashValue := HashKey(PWideChar(AKeyword)); - fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -procedure TSynSQLSyn.SetTableNames(const Value: TStrings); -begin - fTableNames.Assign(Value); -end; - -procedure TSynSQLSyn.TableNamesChanged(Sender: TObject); -begin - InitializeKeywordLists; -end; - -procedure TSynSQLSyn.PutTableNamesInKeywordList; -var - i: Integer; - Entry: TSynHashEntry; -begin - for i := 0 to fTableNames.Count - 1 do - begin - Entry := fKeywords[HashKey(PWideChar(fTableNames[i]))]; - while Assigned(Entry) do - begin - if SysUtils.AnsiLowerCase(Entry.Keyword) = SysUtils.AnsiLowerCase(fTableNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - if not fTableDict.ContainsKey(SysUtils.AnsiLowerCase(fTableNames[i])) then - FTableDict.Add(SysUtils.AnsiLowerCase(FTableNames[i]), True); - end; -end; - -procedure TSynSQLSyn.PutFunctionNamesInKeywordList; -var - i: Integer; - Entry: TSynHashEntry; -begin - for i := 0 to (fFunctionNames.Count - 1) do - begin - Entry := fKeywords[HashKey(PWideChar(fFunctionNames[i]))]; - while Assigned(Entry) do - begin - if SysUtils.AnsiLowerCase(Entry.Keyword) = SysUtils.AnsiLowerCase(fFunctionNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - DoAddKeyword(fFunctionNames[i], Ord(tkFunction)); - end; -end; - -procedure TSynSQLSyn.PutProcNamesInKeywordList; -var - i: Integer; - Entry: TSynHashEntry; -begin - for i := 0 to fProcNames.Count - 1 do - begin - Entry := fKeywords[HashKey(PWideChar(FProcNames[i]))]; - while Assigned(Entry) do - begin - if SysUtils.AnsiLowerCase(Entry.Keyword) = SysUtils.AnsiLowerCase(FProcNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - DoAddKeyword(fProcNames[i], Ord(tkProcName)); - end; -end; - -procedure TSynSQLSyn.InitializeKeywordLists; -var - I: Integer; -begin - fKeywords.Clear; - fTableDict.Clear; - fToIdent := nil; - - for I := 0 to Ord(High(TtkTokenKind)) do - EnumerateKeywords(I, GetKeywords(I), IsIdentChar, DoAddKeyword); - - PutProcNamesInKeywordList; - PutTableNamesInKeywordList; - PutFunctionNamesInKeywordList; - DefHighlightChange(Self); -end; - -procedure TSynSQLSyn.SetDialect(Value: TSQLDialect); -begin - if (Value <> fDialect) then - begin - fDialect := Value; - InitializeKeywordLists; - end; -end; - -procedure TSynSQLSyn.SetFunctionNames(const Value: TStrings); -begin - FFunctionNames.Assign(Value); -end; - -procedure TSynSQLSyn.SetProcNames(const Value: TStrings); -begin - fProcNames.Assign(Value); -end; - -function TSynSQLSyn.GetSampleSource: string; -begin - Result := ''; - case fDialect of - sqlPostgres: - Result := '-- ANSI SQL sample source'#13#10 + - 'SELECT *'#13#10 + - 'FROM planets'#13#10 + - 'WHERE diameter < 13000'#13#10 + - ' AND name <> ''Earth'''; - sqlStandard: - Result := '-- ANSI SQL sample source'#13#10 + - 'SELECT *'#13#10 + - 'FROM planets'#13#10 + - 'WHERE diameter < 13000'#13#10 + - ' AND name <> ''Earth'''; - sqlInterbase6: - Result := '/* Interbase sample source */'#13#10 + - 'SET TERM !! ;'#13#10 + - #13#10 + - 'CREATE PROCEDURE HelloWorld(P_MSG VARCHAR(80)) AS'#13#10 + - 'BEGIN'#13#10 + - ' EXECUTE PROCEDURE WRITELN(:P_MSG);'#13#10 + - 'END !!'#13#10 + - #13#10 + - 'SET TERM ; !!'; - sqlMySQL: - Result := '/* MySQL sample source*/'#13#10 + - 'SET @variable = 1;'#13#10 + - #13#10 + - 'CREATE /*!32302 TEMPORARY */ TABLE t (a INT);'#13#10 + - #13#10 + - 'CREATE TABLE sample ('#13#10 + - ' id INT NOT NULL,'#13#10 + - ' first_name CHAR(30) NOT NULL,'#13#10 + - ' PRIMARY KEY (id),'#13#10 + - ' INDEX name (first_name));'#13#10 + - #13#10 + - 'SELECT DATE_ADD(''1997-12-31 23:59:59'','#13#10 + - ' INTERVAL 1 SECOND);'#13#10 + - #13#10 + - '# End of sample'; - sqlOracle: - Result := 'PROMPT Oracle sample source'#13#10 + - 'declare'#13#10 + - ' x varchar2(2000);'#13#10 + - 'begin -- Show some text here'#13#10 + - ' select to_char(count(*)) into x'#13#10 + - ' from tab;'#13#10 + - #13#10 + - ' dbms_output.put_line(''Hello World: '' || x);'#13#10 + - 'exception'#13#10 + - ' when others then'#13#10 + - ' null;'#13#10 + - 'end;'; - sqlSybase: - Result := '/* SyBase example source */'#13#10 + - 'declare @Integer int'#13#10 + - #13#10 + - '/* Good for positive numbers only. */'#13#10 + - 'select @Integer = 1000'#13#10 + - #13#10 + - 'select "Positives Only" ='#13#10 + - ' right(replicate("0",12) + '#13#10 + - ' convert(varchar, @Integer),12)'#13#10 + - #13#10 + - '/* Good for positive and negative numbers. */'#13#10 + - 'select @Integer = -1000'#13#10 + - #13#10 + - 'select "Both Signs" ='#13#10 + - ' substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 + - ' right(replicate("0",12) + '#13#10 + - ' convert(varchar, abs(@Integer)),12)'#13#10 + - #13#10 + - 'select @Integer = 1000'#13#10 + - #13#10 + - 'select "Both Signs" ='#13#10 + - ' substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 + - ' right(replicate("0",12) + '#13#10 + - ' convert(varchar, abs(@Integer)),12)'#13#10 + - #13#10 + - 'go'; - sqlIngres: - Result := '/* Ingres example source */'#13#10 + - 'DELETE'#13#10 + - 'FROM t1'#13#10 + - 'WHERE EXISTS'#13#10 + - '(SELECT t2.column1, t2.column2'#13#10 + - 'FROM t2'#13#10 + - 'WHERE t1.column1 = t2.column1 and'#13#10 + - 't1.column2 = t2.column2)'; - sqlMSSQL7: - Result := '/* SQL Server 7 example source */'#13#10 + - 'SET QUOTED_IDENTIFIER ON'#13#10 + - 'GO'#13#10 + - 'SET ANSI_NULLS OFF'#13#10 + - 'GO'#13#10 + - #13#10 + - '/* Object: Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 + - 'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 + - ' @Name varchar(25),'#13#10 + - ' @Address varchar(255),'#13#10 + - ' @ZipCode varchar(15)'#13#10 + - 'AS'#13#10 + - ' INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 + - ' VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 + - #13#10 + - ' SELECT SCOPE_IDENTITY()'#13#10 + - 'GO'; - sqlMSSQL2K: - Result := '/* SQL Server2000 example source */'#13#10 + - 'SET QUOTED_IDENTIFIER ON'#13#10 + - 'GO'#13#10 + - 'SET ANSI_NULLS OFF'#13#10 + - 'GO'#13#10 + - #13#10 + - '/* Object: Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 + - 'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 + - ' @Name varchar(25),'#13#10 + - ' @Address varchar(255),'#13#10 + - ' @ZipCode varchar(15)'#13#10 + - 'AS'#13#10 + - ' INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 + - ' VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 + - #13#10 + - ' SELECT SCOPE_IDENTITY()'#13#10 + - 'GO'; - end; -end; - -class function TSynSQLSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangSQL; -end; - -function TSynSQLSyn.GetKeyWords(TokenKind: Integer): string; -begin - Result := ''; - - case fDialect of - sqlPostgres: - begin - case TtkTokenKind(TokenKind) of - tkDatatype: Result := PostgresTypes; - tkKey: Result := PostgresKW; - tkFunction: Result := PostgresFunctions; - tkException: Result := PostgresExceptions; - end; - end; - sqlIngres: - case TtkTokenKind(TokenKind) of - tkDatatype: Result := IngresTypes; - tkKey: Result := IngresKW; - tkFunction: Result := IngresFunctions; - end; - sqlInterbase6: - case TtkTokenKind(TokenKind) of - tkDatatype: Result := Interbase6Types; - tkFunction: Result := Interbase6Functions; - tkKey: Result := Interbase6KW; - end; - sqlMSSQL7: - case TtkTokenKind(TokenKind) of - tkKey: Result := MSSQL7KW; - tkDatatype: Result := MSSQL7Types; - tkFunction: Result := MSSQL7Functions; - end; - sqlMSSQL2K: - case TtkTokenKind(TokenKind) of - tkKey: Result := MSSQL2000KW; - tkDataType: Result := MSSQL2000Types; - tkFunction: Result := MSSQL2000Functions; - end; - sqlMySql: - case TtkTokenKind(TokenKind) of - tkKey: Result := MySqlKW; - tkDatatype: Result := MySqlTypes; - tkFunction: Result := MySqlFunctions; - tkPLSQL: Result := MySQLPLSQLKW; - end; - sqlOracle: - case TtkTokenKind(TokenKind) of - tkKey: Result := OracleKW; - tkDatatype: Result := OracleTypes; - tkException: Result := OracleExceptions; - tkFunction: Result := OracleFunctions; - tkComment: Result := OracleCommentKW; - tkConsoleOutput: Result := OracleConsoleOutputKW; - tkDefaultPackage: Result := OracleDefaultPackages; - tkPLSQL: Result := OraclePLSQLKW; - tkSQLPlus: Result := OracleSQLPlusCommands; - end; - sqlStandard: - if TtkTokenKind(TokenKind) = tkKey then - Result := StandardKW; - sqlSybase: - if TtkTokenKind(TokenKind) = tkKey then - Result := SybaseKW; - sqlNexus: - case TtkTokenKind(TokenKind) of - tkKey: Result := NexusKW; - tkDatatype: Result := NexusTypes; - tkFunction: Result := NexusFunctions; - end; - sqlInformix: - case TtkTokenKind(TokenKind) of - tkKey: Result := InformixKW; - tkDatatype: Result := InformixTypes; - tkFunction: Result := InformixFunctions; - end; - end; -end; - -initialization - RegisterPlaceableHighlighter(TSynSQLSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterSQL.pas, released 2000-04-21. +The Original Code is based on the wmSQLSyn.pas and wmSybaseSyn.pas files from +the mwEdit component suite by Martin Waldenburg and other developers, the +Initial Author of these files is Willo van der Merwe. Initial Author of +SynHighlighterSQL.pas is Michael Hieke. +Portions created by Willo van der Merwe are Copyright 1999 Willo van der Merwe. +Portions created by Michael Hieke are Copyright 2000 Michael Hieke. +Unicode translation by Maël Hörz. +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: SynHighlighterSQL.pas,v 1.39.2.14 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(SQL highlighter for SynEdit with support for different dialects.) +@author(Michael Hieke) +@created(2000-04-21) +@lastmod(2000-11-16) +The SynHighlighterSQL implements a highlighter for SQL for the SynEdit projects. +Different SQL dialects can be selected via the Dialect property. +} + +unit SynHighlighterSQL; + +{$I SynEdit.inc} + +interface + +{$IFDEF SYN_COMPILER_12_UP} + {$DEFINE USE_TABLE_DICTIONARY} +{$ENDIF} + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynHighlighterHashEntries, + SynUnicode, + {$IFDEF USE_TABLE_DICTIONARY} + Generics.Collections, + {$ENDIF} + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkDatatype, tkDefaultPackage, tkException, + tkFunction, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, tkPLSQL, + tkSQLPlus, tkString, tkSymbol, tkTableName, tkUnknown, tkVariable, + tkConditionalComment, tkDelimitedIdentifier, tkProcName, tkConsoleOutput); + + TRangeState = (rsUnknown, rsComment, rsString, rsConditionalComment, rsConsoleOutput); + + TSQLDialect = (sqlStandard, sqlInterbase6, sqlMSSQL7, sqlMySQL, sqlOracle, + sqlSybase, sqlIngres, sqlMSSQL2K, sqlPostgres, sqlNexus, sqlInformix); + +type + TSynSQLSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FKeywords: TSynHashEntryList; + FProcNames: TUnicodeStrings; + FTableNames: TUnicodeStrings; + {$IFDEF USE_TABLE_DICTIONARY} + FTableDict: TDictionary; + {$ENDIF} + FFunctionNames: TUniCodeStrings; + FDialect: TSQLDialect; + FCommentAttri: TSynHighlighterAttributes; + FConditionalCommentAttri: TSynHighlighterAttributes; + FConsoleOutputAttri: TSynHighlighterAttributes; + FDataTypeAttri: TSynHighlighterAttributes; + FDefaultPackageAttri: TSynHighlighterAttributes; + FDelimitedIdentifierAttri: TSynHighlighterAttributes; + FExceptionAttri: TSynHighlighterAttributes; + FFunctionAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FPLSQLAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FSQLPlusAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FTableNameAttri: TSynHighlighterAttributes; + FProcNameAttri: TSynHighlighterAttributes; + FVariableAttri: TSynHighlighterAttributes; + function HashKey(Str: PWideChar): Integer; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + procedure SetDialect(Value: TSQLDialect); + procedure SetTableNames(const Value: TUnicodeStrings); + procedure SetFunctionNames(const Value: TUnicodeStrings); + procedure PutFunctionNamesInKeywordList; + procedure FunctionNamesChanged(Sender: TObject); + procedure ProcNamesChanged(Sender: TObject); + procedure TableNamesChanged(Sender: TObject); + procedure InitializeKeywordLists; + procedure PutProcNamesInKeywordList; + procedure PutTableNamesInKeywordList; + procedure AndSymbolProc; + procedure AsciiCharProc; + procedure CRProc; + procedure EqualProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure HashProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure SlashProc; + procedure SpaceProc; + procedure QuoteProc; + procedure BacktickProc; + procedure BracketProc; + procedure SymbolProc; + procedure SymbolAssignProc; + procedure VariableProc; + procedure UnknownProc; + procedure AnsiCProc; + procedure SetProcNames(const Value: TUnicodeStrings); + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetKeyWords(TokenKind: Integer): UnicodeString; override; + function GetRange: Pointer; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenID: TtkTokenKind; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + function IsKeyword(const AKeyword: UnicodeString): Boolean; override; + procedure Next; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property ConditionalCommentAttri: TSynHighlighterAttributes + read FConditionalCommentAttri write FConditionalCommentAttri; + property ConsoleOutputAttri: TSynHighlighterAttributes + read FConsoleOutputAttri write FConsoleOutputAttri; + property DataTypeAttri: TSynHighlighterAttributes read FDataTypeAttri + write FDataTypeAttri; + property DefaultPackageAttri: TSynHighlighterAttributes + read FDefaultPackageAttri write FDefaultPackageAttri; + property DelimitedIdentifierAttri: TSynHighlighterAttributes + read FDelimitedIdentifierAttri write FDelimitedIdentifierAttri; + property ExceptionAttri: TSynHighlighterAttributes read FExceptionAttri + write FExceptionAttri; + property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri + write FFunctionAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property PLSQLAttri: TSynHighlighterAttributes read FPLSQLAttri + write FPLSQLAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property SQLPlusAttri: TSynHighlighterAttributes read FSQLPlusAttri + write FSQLPlusAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property ProcNameAttri: TSynHighlighterAttributes read FProcNameAttri + write FProcNameAttri; + property TableNameAttri: TSynHighlighterAttributes read FTableNameAttri + write FTableNameAttri; + property ProcNames: TUnicodeStrings read FProcNames write SetProcNames; + property TableNames: TUnicodeStrings read FTableNames write SetTableNames; + property FunctionNames: TUnicodeStrings read FFunctionNames write SetFunctionNames; + property VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + property SQLDialect: TSQLDialect read FDialect write SetDialect + default sqlStandard; + end; + +implementation + +uses + SynEditStrConst; + +const +//---"Standard" (ANSI SQL keywords (Version 1, 2 and 3) (www.sql.org)----------- + StandardKW: UnicodeString = + 'absolute,action,active,actor,add,after,alias,all,allocate,alter,' + + 'and,any,are,as,asc,ascending,assertion,async,at,attributes,auto,' + + 'base_name,before,begin,between,bit,bit_length,boolean,both,breadth,by,' + + 'cache,call,cascade,cascaded,case,cast,catalog,char_length,' + + 'character_length,check,coalesce,collate,collation,column,commit,' + + 'committed,completion,computed,conditional,connect,connection,constraint,' + + 'constraints,containing,convert,corresponding,count,create,cross,current,' + + 'current_date,current_path,current_time,current_timestamp,current_user,' + + 'cursor,cycle,data,database,date,day,deallocate,debug,declare,default,' + + 'deferrable,deferred,delete,depth,desc,descending,describe,descriptor,' + + 'destroy,diagnostics,dictionary,disconnect,distinct,do,domain,' + + 'drop,each,element,else,elseif,end,end-exec,entry_point,equals,escape,' + + 'except,exception,execute,exists,exit,external,extract,factor,false,' + + 'filter,first,for,foreign,from,full,function,general,generator,get,' + + 'global,grant,group,having,hold,hour,identity,if,ignore,immediate,in,' + + 'inactive,index,initially,inner,input,insensitive,insert,instead,' + + 'intersect,interval,into,is,isolation,join,key,last,leading,leave,left,' + + 'less,level,like,limit,list,local,loop,lower,match,merge,minute,modify,' + + 'month,names,national,natural,nchar,new,new_table,next,no,none,not,null,' + + 'nullif,object,octet_length,of,off,old,old_table,on,only,operation,' + + 'operator,operators,or,order,others,outer,output,overlaps,pad,' + + 'parameter,parameters,partial,password,path,pendant,plan,position,' + + 'postfix,prefix,preorder,prepare,preserve,primary,prior,private,' + + 'privileges,procedure,protected,read,recursive,ref,referencing,relative,' + + 'replace,resignal,restrict,retain,return,returns,revoke,right,role,' + + 'rollback,routine,row,rows,savepoint,schema,scroll,search,second,select,' + + 'sensitive,sequence,session,session_user,set,shadow,shared,signal,' + + 'similar,size,snapshot,some,space,sqlexception,sqlstate,sqlwarning,start,' + + 'state,structure,substring,suspend,symbol,system_user,table,temporary,' + + 'term,test,then,there,time,timestamp,timezone_hour,timezone_minute,to,' + + 'trailing,transaction,translate,translation,trigger,trim,true,tuple,type,' + + 'uncommitted,under,union,unique,unknown,update,upper,usage,user,using,' + + 'value,varchar,variable,varying,view,virtual,visible,wait,when,where,' + + 'while,with,without,work,write,year,zone'; + +//---Sybase keywords------------------------------------------------------------ + SybaseKW: UnicodeString = + 'absolute,action,add,after,alias,all,allocate,alter,and,any,are,' + + 'arith_overflow,as,asc,assertion,async,at,authorization,avg,before,begin,' + + 'between,bit,bit_length,boolean,both,breadth,break,browse,bulk,by,call,' + + 'cascade,cascaded,case,cast,catalog,char,char_convert,char_length,' + + 'character,character_length,check,checkpoint,close,clustered,coalesce,' + + 'collate,collation,column,commit,completion,compute,confirm,' + + 'connect,connection,constraint,constraints,continue,controlrow,convert,' + + 'corresponding,count,create,cross,current,current_date,current_time,' + + 'current_timestamp,current_user,cursor,cycle,data,database,date,day,dbcc,' + + 'deallocate,dec,decimal,declare,default,deferrable,deferred,delete,depth,' + + 'desc,describe,descriptor,diagnostics,dictionary,dis,disconnect,distinct,' + + 'domain,double,drop,dummy,dump,each,else,elseif,en,end,endtran,equals,' + + 'errlvl,errordata,errorexit,escape,except,exception,exclusive,exec,' + + 'execute,exists,exit,exp_row_size,external,extract,false,fetch,' + + 'fillfactor,first,float,for,foreign,found,from,full,general,get,global,' + + 'go,goto,grant,group,having,holdlock,hour,identity,identity_gap,' + + 'identity_insert,identity_start,if,ignore,immediate,in,index,indicator,' + + 'initially,inner,input,insensitive,insert,install,int,integer,intersect,' + + 'interval,into,is,isolation,jar,join,key,kill,language,last,leading,' + + 'leave,left,less,level,like,limit,lineno,load,local,lock,loop,lower,' + + 'match,max,max_rows_per_page,min,minute,mirror,mirrorexit,modify,module,' + + 'month,names,national,natural,nchar,new,next,no,noholdlock,nonclustered,' + + 'none,not,null,nullif,numeric,numeric_truncation,object,' + + 'octet_length,of,off,offsets,oid,old,on,once,online,only,open,operation,' + + 'operators,option,or,order,others,outer,output,over,overlaps,pad,' + + 'parameters,partial,partition,pendant,perm,permanent,plan,position,' + + 'precision,preorder,prepare,preserve,primary,print,prior,private,' + + 'privileges,proc,procedure,processexit,protected,proxy_table,public,' + + 'quiesce,raiserror,read,readpast,readtext,real,reconfigure,recursive,' + + 'ref,reference,referencing,relative,remove,reorg,replace,replication,' + + 'reservepagegap,resignal,restrict,return,returns,revoke,right,role,' + + 'rollback,routine,row,rowcount,rows,rule,save,savepoint,schema,scroll,' + + 'search,second,section,select,sensitive,sequence,session_user,set,' + + 'setuser,shared,shutdown,signal,similar,size,smallint,some,space,sql,' + + 'sqlcode,sqlerror,sqlexception,sqlstate,statistics,stripe,structure,' + + 'substring,sum,syb_identity,syb_restree,system_user,table,temp,temporary,' + + 'test,textsize,then,there,time,timestamp,timezone_hour,timezone_minute,' + + 'to,trailing,tran,transaction,translate,translation,trigger,trim,true,' + + 'truncate,tsequal,type,under,union,unique,unknown,unpartition,update,' + + 'upper,usage,use,user,user_option,using,value,values,varchar,variable,' + + 'varying,view,virtual,visible,wait,waitfor,when,whenever,where,while,' + + 'with,without,work,write,writetext,year,zone'; + +//---Oracle--------------------------------------------------------------------- + // Oracle SQL keywords + OracleKW: UnicodeString = + 'ACCESS,ACCESSED,ACCOUNT,ACTIVATE,ACTIVE_INSTANCE_COUNT,ADD,ADMIN,ADVISE,' + + 'AGENT,ALL,ALLOCATE,ALTER,ANALYZE,ANCILLARY,AND,ANY,AQ_TM_PROCESSES,' + + 'ARCHIVE_LAG_TARGET,ARCHIVELOG,AS,ASC,ASSOCIATE,ATTRIBUTES,AUDIT,' + + 'AUDIT_FILE_DEST,AUDIT_SYS_OPERATIONS,AUDIT_TRAIL,AUTHENTICATED,AUTHID,' + + 'AUTOALLOCATE,AUTOEXTEND,AUTOMATIC,BACKGROUND_CORE_DUMP,' + + 'BACKGROUND_DUMP_DEST,BACKUP,BACKUP_TAPE_IO_SLAVES,BECOME,BEFORE,' + + 'BEHALF,BETWEEN,BINDING,BITMAP,BITMAP_MERGE_AREA_SIZE,BLANK_TRIMMING,' + + 'BLOCK,BLOCKSIZE,BUFFER_POOL,BUFFER_POOL_KEEP,BUFFER_POOL_RECYCLE,BY,' + + 'CACHE,CANCEL,CASCADE,CAST,CATEGORY,CHAINED,CHANGE,CHARACTER,CHECK,' + + 'CHECKPOINT,CHILD,CHUNK,CIRCUITS,CLASS,CLONE,CLUSTER,CLUSTER_DATABASE,' + + 'CLUSTER_DATABASE_INSTANCES,CLUSTER_INTERCONNECTS,COALESCE,COBOL,' + + 'COLUMN,COLUMNS,COMMENT,COMMIT_POINT_STRENGTH,COMPATIBLE,COMPILE,' + + 'COMPLETE,COMPOSITE_LIMIT,COMPRESS,COMPUTE,CONNECT,' + + 'CONNECT_TIME,CONSIDER,CONSTRAINT,CONSTRAINTS,CONTENTS,CONTEXT,CONTINUE,' + + 'CONTROL,CONTROL_FILE_RECORD_KEEP_TIME,CONTROL_FILES,CONTROLFILE,' + + 'CORE_DUMP_DEST,COST,CPU_COUNT,CPU_PER_CALL,CPU_PER_SESSION,CREATE,' + + 'CREATE_BITMAP_AREA_SIZE,CREATE_STORED_OUTLINES,CURRENT,CURRENT_USER,' + + 'CURSOR_SHARING,CURSOR_SPACE_FOR_TIME,CYCLE,DANGLING,DATAFILE,' + + 'DB_BLOCK_BUFFERS,DB_BLOCK_CHECKING,DB_BLOCK_CHECKSUM,DB_BLOCK_SIZE,' + + 'DB_CACHE_ADVICE,DB_CACHE_SIZE,DB_CREATE_FILE_DEST,DB_DOMAIN,' + + 'DB_FILE_MULTIBLOCK_READ_COUNT,DB_FILE_NAME_CONVERT,DB_FILES,' + + 'DB_KEEP_CACHE_SIZE,DB_NAME,DB_RECYCLE_CACHE_SIZE,DB_WRITER_PROCESSES,' + + 'DBLINK_ENCRYPT_LOGIN,DBWR_IO_SLAVES,DEALLOCATE,DEBUG,DEFAULT,DEFERRED,' + + 'DEFINER,DELETE,DEMAND,DETERMINES,DG_BROKER_START,DICTIONARY,DIMENSION,' + + 'DIRECTORY,DISABLE,DISASSOCIATE,DISK_ASYNCH_IO,DISMOUNT,DISPATCHERS,' + + 'DISTINCT,DISTRIBUTED,DISTRIBUTED_LOCK_TIMEOUT,DML,DML_LOCKS,DOCUMENT,' + + 'DROP,DRS_START,ELSE,ENABLE,ENQUEUE_RESOURCES,ESCAPE,ESTIMATE,EVENT,' + + 'EVENTS,EXCEPT,EXCEPTIONS,EXCHANGE,EXCLUDING,EXCLUSIVE,EXISTS,EXPIRE,' + + 'EXPLAIN,EXTENT,EXTERNALLY,FAILED_LOGIN_ATTEMPTS,FAL_CLIENT,FAL_SERVER,' + + 'FAST,FAST_START_IO_TARGET,FAST_START_MTTR_TARGET,' + + 'FAST_START_PARALLEL_ROLLBACK,FILE,FILE_MAPPING,FILESYSTEMIO_OPTIONS,' + + 'FIXED_DATE,FLUSH,FOR,FORCE,FOREIGN,FORTRAN,FREELIST,FREELISTS,FRESH,' + + 'FROM,FROM_TZ,FUNCTIONS,FULL,GC_FILES_TO_LOCKS,GENERATED,GLOBAL,' + + 'GLOBAL_CONTEXT_POOL_SIZE,GLOBAL_NAME,GLOBAL_NAMES,GLOBALLY,GO,GRANT,' + + 'GROUP,GROUPS,HASH,HASH_AREA_SIZE,HASH_JOIN_ENABLED,HASHKEYS,HAVING,HEAP,' + + 'HI_SHARED_MEMORY_ADDRESS,HIERARCHY,HS_AUTOREGISTER,IDENTIFIED,IDLE_TIME,' + + 'IFILE,IMMEDIATE,IN,INCLUDING,INCREMENT,INDEX,INDEXTYPE,INDEXTYPES,' + + 'INFILE,INITIAL,INITIALIZED,INITIALLY,INITRANS,INSERT,INSTANCE,' + + 'INSTANCE_GROUPS,INSTANCE_NAME,INSTANCE_NUMBER,INT,INTERSECT,INTO,' + + 'INVALIDATE,IS,ISOLATION,JAVA,JAVA_MAX_SESSIONSPACE_SIZE,JAVA_POOL_SIZE,' + + 'JAVA_SOFT_SESSIONSPACE_LIMIT,JOB_QUEUE_PROCESSES,JOIN,KEEP,KEY,KILL,' + + 'LARGE_POOL_SIZE,LAYERLISTS,LEFT,LEVEL,LIBRARY,LICENSE_MAX_SESSIONS,' + + 'LICENSE_MAX_USERS,LICENSE_SESSIONS_WARNING,LIKE,LIMIT,LINK,LIST,LOB,' + + 'LOCAL,LOCAL_LISTENER,LOCATOR,LOCK,LOCK_NAME_SPACE,LOCK_SGA,' + + 'LOG_ARCHIVE_DEST,LOG_ARCHIVE_DUPLEX_DEST,LOG_ARCHIVE_FORMAT,' + + 'LOG_ARCHIVE_MAX_PROCESSES,LOG_ARCHIVE_MIN_SUCCEED_DEST,' + + 'LOG_ARCHIVE_START,LOG_ARCHIVE_TRACE,LOG_BUFFER,LOG_CHECKPOINT_INTERVAL,' + + 'LOG_CHECKPOINT_TIMEOUT,LOG_CHECKPOINTS_TO_ALERT,LOG_FILE_NAME_CONVERT,' + + 'LOG_PARALLELISM,LOGFILE,LOGGING,LOGICAL_READS_PER_CALL,' + + 'LOGICAL_READS_PER_SESSION,LOGMNR_MAX_PERSISTENT_SESSIONS,MANAGE,MANAGED,' + + 'MANAGEMENT,MANUAL,MAP,MASTER,MATCHED,MATERIALIZED,MAX_COMMIT_PROPAGATION_DELAY,' + + 'MAX_DISPATCHERS,MAX_DUMP_FILE_SIZE,MAX_ENABLED_ROLES,' + + 'MAX_ROLLBACK_SEGMENTS,MAX_SHARED_SERVERS,MAXDATAFILES,MAXEXTENTS,' + + 'MAXINSTANCES,MAXLOGFILES,MAXLOGHISTORY,MAXLOGMEMBERS,MAXSIZE,MAXTRANS,' + + 'MAXVALUE,MEMBER,MERGE,MINEXTENTS,MINIMIZE,MINIMUM,MINUS,MINVALUE,MODE,' + + 'MODIFY,MODULE,MONITORING,MOUNT,MOVE,MOVEMENT,MULTISET,NAMED,NATIONAL,' + + 'NESTED,NEVER,NEXT,NLS_CALENDAR,NLS_COMP,NLS_CURRENCY,NLS_DATE_FORMAT,' + + 'NLS_DATE_LANGUAGE,NLS_DUAL_CURRENCY,NLS_ISO_CURRENCY,NLS_LANGUAGE,' + + 'NLS_LENGTH_SEMANTICS,NLS_NCHAR_CONV_EXCP,NLS_NUMERIC_CHARACTERS,' + + 'NLS_TERRITORY,NLS_TIMESTAMP_FORMAT,NLS_TIMESTAMP_TZ_FORMAT,NO,' + + 'NOARCHIVELOG,NOAUDIT,NOCACHE,NOCOMPRESS,NOCOPY,NOCYCLE,NOFORCE,' + + 'NOLOGGING,NOMAXVALUE,NOMINIMIZE,NOMINVALUE,NOMONITORING,NOMOUNT,NONE,' + + 'NOORDER,NORELY,NORESETLOGS,NOREVERSE,NORMAL,NOROWDEPENDENCIES,NOSORT,' + + 'NOT,NOTHING,NOVALIDATE,NOWAIT,NULL,O7_DICTIONARY_ACCESSIBILITY,' + + 'OBJECT_CACHE_MAX_SIZE_PERCENT,OBJECT_CACHE_OPTIMAL_SIZE,OF,OFFLINE,OID,' + + 'OLAP_PAGE_POOL_SIZE,ON,ONLINE,ONLY,OPEN_CURSORS,OPEN_LINKS,' + + 'OPEN_LINKS_PER_INSTANCE,OPERATOR,OPTIMAL,OPTIMIZER_DYNAMIC_SAMPLING,' + + 'OPTIMIZER_FEATURES_ENABLE,OPTIMIZER_INDEX_CACHING,' + + 'OPTIMIZER_INDEX_COST_ADJ,OPTIMIZER_MAX_PERMUTATIONS,OPTIMIZER_MODE,' + + 'OPTION,OR,ORACLE_TRACE_COLLECTION_NAME,ORACLE_TRACE_COLLECTION_PATH,' + + 'ORACLE_TRACE_COLLECTION_SIZE,ORACLE_TRACE_ENABLE,' + + 'ORACLE_TRACE_FACILITY_NAME,ORACLE_TRACE_FACILITY_PATH,ORDER,' + + 'OS_AUTHENT_PREFIX,OS_ROLES,OUTER,OUTLINE,OVERFLOW,OWN,PACKAGES,PARALLEL,' + + 'PARALLEL_ADAPTIVE_MULTI_USER,PARALLEL_AUTOMATIC_TUNING,' + + 'PARALLEL_EXECUTION_MESSAGE_SIZE,PARALLEL_INSTANCE_GROUP,' + + 'PARALLEL_MAX_SERVERS,PARALLEL_MIN_PERCENT,PARALLEL_MIN_SERVERS,' + + 'PARALLEL_THREADS_PER_CPU,PARAMETERS,PARTITION_VIEW_ENABLED,PARTITIONS,' + + 'PASSWORD,PASSWORD_GRACE_TIME,PASSWORD_LIFE_TIME,PASSWORD_LOCK_TIME,' + + 'PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME,PASSWORD_VERIFY_FUNCTION,' + + 'PCTFREE,PCTINCREASE,PCTTHRESHOLD,PCTUSED,PCTVERSION,PERCENT,PERMANENT,' + + 'PGA_AGGREGATE_TARGET,PIPELINED,PLAN,PLI,PLSQL_COMPILER_FLAGS,' + + 'PLSQL_NATIVE_C_COMPILER,PLSQL_NATIVE_LIBRARY_DIR,' + + 'PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT,PLSQL_NATIVE_LINKER,' + + 'PLSQL_NATIVE_MAKE_FILE_NAME,PLSQL_NATIVE_MAKE_UTILITY,' + + 'PLSQL_V2_COMPATIBILITY,POST_TRANSACTION,PRE_PAGE_SGA,PREBUILD,PRECISION,' + + 'PRIMARY,PRIOR,PRIVATE_SGA,PRIVILEGES,PROCESSES,PROFILE,PUBLIC,QUERY,' + + 'QUERY_REWRITE_ENABLED,QUERY_REWRITE_INTEGRITY,QUIESCE,QUOTA,' + + 'RDBMS_SERVER_DN,READ,READ_ONLY_OPEN_DELAYED,REBUILD,RECORDS_PER_BLOCK,' + + 'RECOVER,RECOVERABLE,RECOVERY,RECOVERY_PARALLELISM,RECYCLE,RECYCLEBIN,REDUCED,' + + 'REFERENCES,REFRESH,REGISTER,RELY,REMOTE_ARCHIVE_ENABLE,' + + 'REMOTE_DEPENDENCIES_MODE,REMOTE_LISTENER,REMOTE_LOGIN_PASSWORDFILE,' + + 'REMOTE_OS_AUTHENT,REMOTE_OS_ROLES,RENAME,' + + 'REPLICATION_DEPENDENCY_TRACKING,RESET,RESETLOGS,RESIZE,RESOLVE,RESOLVER,' + + 'RESOURCE,RESOURCE_LIMIT,RESOURCE_MANAGER_PLAN,RESTRICT,RESTRICTED,' + + 'RESUMABLE,RESUME,REUSE,REVOKE,REWRITE,RIGHT,RNDS,RNPS,ROLE,ROLES,' + + 'ROLLBACK_SEGMENTS,ROW,ROW_LOCKING,ROWDEPENDENCIES,ROWLABEL,ROWNUM,' + + 'ROWS,SAMPLE,SCN,SCOPE,SECTION,SEGMENT,SELECT,SELECTIVITY,SEQUENCE,' + + 'SERIAL_REUSE,SERVICE_NAMES,SESSION,SESSION_CACHED_CURSORS,' + + 'SESSION_MAX_OPEN_FILES,SESSIONS,SESSIONS_PER_USER,SGA_MAX_SIZE,' + + 'SHADOW_CORE_DUMP,SHARE,SHARED,SHARED_MEMORY_ADDRESS,SHARED_POOL,' + + 'SHARED_POOL_RESERVED_SIZE,SHARED_POOL_SIZE,SHARED_SERVER_SESSIONS,' + + 'SHARED_SERVERS,SHRINK,SIZE,SNAPSHOT,SOME,SORT,SORT_AREA_RETAINED_SIZE,' + + 'SORT_AREA_SIZE,SOURCE,SPECIFICATION,SPECIFIED,SPFILE,SPLIT,SQL_TRACE,' + + 'SQL92_SECURITY,STANDBY,STANDBY_ARCHIVE_DEST,STANDBY_FILE_MANAGEMENT,' + + 'STAR_TRANSFORMATION_ENABLED,START,START_DATE,STATIC,STATISTICS,' + + 'STATISTICS_LEVEL,STOP,STORAGE,STRUCTURE,SUBPARTITION,SUBPARTITIONS,' + + 'SUCCESSFUL,SUSPEND,SWITCH,SYNONYM,SYSTEM,TABLE,TABLESPACE,' + + 'TAPE_ASYNCH_IO,TEMPFILE,TEMPORARY,THE,THEN,THREAD,THROUGH,TIME,' + + 'TIMED_OS_STATISTICS,TIMED_STATISTICS,TIMEOUT,TO,TRACE_ENABLED,' + + 'TRACEFILE_IDENTIFIER,TRACING,TRANSACTION,TRANSACTION_AUDITING,' + + 'TRANSACTIONS,TRANSACTIONS_PER_ROLLBACK_SEGMENT,TRIGGER,TRUNCATE,TRUST,' + + 'TYPES,UNARCHIVED,UNDER,UNDO,UNDO_MANAGEMENT,UNDO_RETENTION,' + + 'UNDO_SUPPRESS_ERRORS,UNDO_TABLESPACE,UNIFORM,UNION,UNIQUE,UNLIMITED,' + + 'UNLOCK,UNQUIESCE,UNRECOVERABLE,UNTIL,UNUSABLE,UNUSED,UPDATE,USAGE,' + + 'USE_INDIRECT_DATA_BUFFERS,USER_DUMP_DEST,VALIDATE,VALIDATION,VALUES,' + + 'VARGRAPHIC,VARRAY,VIEW,WHERE,WITH,WITHOUT,WNDS,WNPS,' + + 'WORKAREA_SIZE_POLICY'; + +//---Postgresql----------------------------------------------------------------- + //Postgresql Keywords + PostgresKW: UnicodeString = + 'IF,LOOP,ABORT,ABSOLUTE,ACCESS,ACTION,ADA,ADD,ADMIN,AFTER,AGGREGATE,ALIAS' + + ',ALLOCATE,ALTER,ANALYSE,ANALYZE,AND,ARE,AS,ASC,ASENSITIVE' + + ',ASSERTION,ASSIGNMENT,ASYMMETRIC,AT,ATOMIC,AUTHORIZATION,BACKWARD' + + ',BEFORE,BEGIN,BETWEEN' + + ',BOTH,BREADTH,BY,C,CACHE,CALL,CALLED,CARDINALITY,CASCADE,CASCADED,CASE' + + ',CAST,CATALOG,CATALOG_NAME,CHAIN,CHARACTERISTICS' + + ',CHARACTER_SET_CATALOG,CHARACTER_SET_NAME,CHARACTER_SET_SCHEMA' + + ',CHECK,CHECKED,CHECKPOINT,CLASS,CLASS_ORIGIN,CLOB,CLOSE,CLUSTER,COBOL,COLLATE' + + ',COLLATION,COLLATION_CATALOG,COLLATION_NAME,COLLATION_SCHEMA,COLUMN,COLUMN_NAME' + + ',COMMAND_Function,COMMAND_Function_CODE,COMMENT,COMMIT,COMMITTED,COMPLETION' + + ',CONDITION_NUMBER,CONNECT,CONNECTION,CONNECTION_NAME,CONSTRAINT,CONSTRAINTS' + + ',CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,CONSTRUCTOR,CONTAINS' + + ',CONTINUE,CONVERSION,COPY,CORRESPONDING,CREATE,CREATEDB,CREATEUSER' + + ',CROSS,CUBE,CURRENT,CURRENT_PATH,CURRENT_ROLE' + + ',CURSOR,CURSOR_NAME,CYCLE,DATA,DATABASE,DATETIME_INTERVAL_CODE' + + ',DATETIME_INTERVAL_PRECISION,DAY,DEALLOCATE,DEC,DECLARE,DEFAULT,DEFERRABLE' + + ',DEFERRED,DEFINED,DEFINER,DELETE,DELIMITER,DELIMITERS,DEPTH,DEREF,DESC,DESCRIBE' + + ',DESCRIPTOR,DESTROY,DESTRUCTOR,DETERMINISTIC,DIAGNOSTICS,DICTIONARY,DISCONNECT' + + ',DISPATCH,DISTINCT,DO,DOMAIN,DROP,DYNAMIC,DYNAMIC_Function,DYNAMIC_Function_CODE' + + ',EACH,ELSE,ELSIF,ELSEIF,ENCODING,ENCRYPTED,END,EQUALS,ESCAPE,EXCEPT,EXCEPTION' + + ',EXCLUSIVE,EXEC,EXECUTE,EXISTING,EXPLAIN,EXTERNAL,FALSE,FETCH' + + ',FINAL,FIRST,FOR,FORCE,FOREIGN,FORTRAN,FORWARD,FOUND,FREE,FREEZE,FROM' + + ',FULL,Function,G,GENERAL,GENERATED,GET,GLOBAL,GO,GOTO,GRANT,GRANTED,GROUP' + + ',GROUPING,HANDLER,HAVING,HIERARCHY,HOLD,HOUR,IDENTITY,IGNORE,ILIKE' + + ',IMMEDIATE,IMMUTABLE,IMPLEMENTATION,IMPLICIT,INCREMENT,INDEX,INDICATOR' + + ',INFIX,INHERITS,INITIALIZE,INITIALLY,INNER,INOUT,INPUT,INSENSITIVE,INSERT' + + ',INSTANCE,INSTANTIABLE,INSTEAD,INT,INTERSECT,INTO,INVOKER' + + ',IS,ISNULL,ISOLATION,ITERATE,JOIN,K,KEY,KEY_MEMBER,KEY_TYPE,LANCOMPILER,LANGUAGE' + + ',LARGE,LAST,LATERAL,LEADING,LEFT,LESS,LEVEL,LIKE,LIMIT,LISTEN,LOAD,LOCAL' + + ' LOCATION,LOCATOR,LOCK,M,MAP,MATCH,MAXVALUE,MESSAGE_LENGTH' + + ',MESSAGE_OCTET_LENGTH,MESSAGE_TEXT,METHOD,MINUTE,MINVALUE,MODE,MODIFIES' + + ',MODIFY,MODULE,MONTH,MORE,MOVE,MUMPS,NAME,NAMES,NATIONAL,NATURAL,NCHAR,NCLOB' + + ',NEW,NEXT,NO,NOCREATEDB,NOCREATEUSER,NONE,NOT,NOTHING,NOTIFY,NOTNULL,NULL,NULLABLE' + + ',NUMBER,OBJECT,OF,OFF,OFFSET,OIDS,OLD,ON,ONLY,OPEN' + + ',OPERATION,Operator,OPTION,OPTIONS,OR,ORDER,ORDINALITY,OUT,OUTER,OUTPUT,OVERLAPS' + + ',OVERRIDING,OWNER,PAD,PARAMETER,PARAMETERS,PARAMETER_MODE,PARAMETER_NAME,PARAMETER_ORDINAL_POSITION' + + ',PARAMETER_SPECIFIC_CATALOG,PARAMETER_SPECIFIC_NAME,PARAMETER_SPECIFIC_SCHEMA,PARTIAL,PASCAL,PASSWORD' + + ',PENDANT,PLACING,PLI,POSTFIX,PRECISION,PREFIX,PREORDER,PREPARE,PRESERVE,PRIMARY' + + ',PRIOR,PRIVILEGES,PROCEDURAL,PROCEDURE,PUBLIC,READ,READS,RECHECK,RECURSIVE,REF,REFERENCES' + + ',REFERENCING,REINDEX,RELATIVE,RENAME ,REPEATABLE,RESET,RESTRICT,RESULT,RETURN,RETURNED_LENGTH' + + ',RETURNED_OCTET_LENGTH,RETURNED_SQLSTATE,RETURNS,REVOKE,RIGHT,ROLE,ROLLBACK,ROLLUP,ROUTINE,ROUTINE_CATALOG' + + ',ROUTINE_NAME,ROUTINE_SCHEMA,ROW,ROWS,ROW_COUNT,RULE,SAVEPOINT,SCALE,SCHEMA,SCHEMA_NAME' + + ',SCOPE,SCROLL,SEARCH,SECOND,SECTION,SECURITY,SELECT,SELF,SENSITIVE,SEQUENCE,SERIALIZABLE,SERVER_NAME' + + ',SESSION,SET,SETOF,SETS,SHARE,SHOW,SIMILAR,SIMPLE,SIZE,SOURCE,SPACE' + + ',SPECIFIC,SPECIFICTYPE,SPECIFIC_NAME,SQLCODE,SQLERROR,SQLEXCEPTION,SQLSTATE,SQLWARNING' + + ',STABLE,START,STATE,STATEMENT,STATIC,STATISTICS,STDIN,STDOUT,STORAGE,STRICT,STRUCTURE' + + ',STYLE,SUBCLASS_ORIGIN,SUBLIST,SYMMETRIC,SYSID,SYSTEM,SYSTEM_USER,TABLE' + + ',TABLE_NAME,TEMP,TEMPLATE,TEMPORARY,TERMINATE,THAN,THEN,TIMEZONE_HOUR' + + ',TIMEZONE_MINUTE,TO,TOAST,TRAILING,TRANSACTION,TRANSACTIONS_COMMITTED,TRANSACTIONS_ROLLED_BACK' + + ',TRANSACTION_ACTIVE,TRANSFORM,TRANSFORMS,TRANSLATION,TREAT,TRIGGER_CATALOG' + + ',TRIGGER_NAME,TRIGGER_SCHEMA,TRUE,TRUNCATE,TRUSTED,TYPE,UNCOMMITTED,UNDER,UNENCRYPTED,UNION'+ + ',UNIQUE,UNKNOWN,UNLISTEN,UNNAMED,UNNEST,UNTIL,UPDATE,USAGE,USER_DEFINED_TYPE_CATALOG' + + ',USER_DEFINED_TYPE_NAME,USER_DEFINED_TYPE_SCHEMA,USING,VACUUM,VALID,VALIDATOR,VALUE,VALUES' + + ',VARIABLE,VARYING,VERBOSE,VIEW,VOLATILE,WHEN,WHENEVER,WHERE,WITH,WITHOUT,WORK,WRITE,YEAR,ZONE'; + + //Postgresql Functions + PostgresFunctions: UnicodeString = + 'abs,cbrt,ceil,ceiling,degrees,exp,floor,ln,log,mod,pi,power,radians,random,'+ + 'round,setseed,sign,sqrt,trunc,width_bucket,acos,asin,atan,atan2,cos,cot,'+ + 'sin,tan,bit_length,char_length,character_length,convert,lower,octet_length,'+ + 'overlay,position,substring,trim,upper,ascii,btrim,chr,decode,'+ + 'encode,initcap,length,lpad,ltrim,md5,pg_client_encoding,quote_ident,quote_literal,'+ + 'replace,rpad,rtrim,split_part,strpos,substr,to_ascii,to_hex,translate,get_byte,'+ + 'set_byte,get_bit,set_bit,to_char,to_date,'+ + 'to_timestamp,to_number,age,date_part,date_trunc,extract,now,'+ + 'timeofday,isfinite,area,box_intersect,center,diameter,height,isclosed,isopen,'+ + 'npoints,pclose,popen,radius,width,'+ + 'broadcast,'+ + 'host,masklen,set_masklen,netmask,hostmask,network,abbrev,family,nextval,'+ + 'currval,setval,coalesce,nullif,array_cat ,array_append ,array_prepend ,array_dims,'+ + 'array_lower ,array_upper ,array_to_string ,string_to_array ,avg,bit_and,bit_or,bool_and,'+ + 'bool_or,count,every,max,min,stddev,sum,variance,exists ,in ,some,'+ + 'all ,generate_series,current_database,current_schema,'+ + 'current_schemas,,inet_client_addr,inet_client_port,inet_server_addr,inet_server_port,'+ + 'version,has_table_privilege,has_database_privilege,'+ + 'has_function_privilege,has_language_privilege,'+ + 'has_schema_privilege,has_tablespace_privilege,'+ + 'pg_table_is_visible,pg_type_is_visible,pg_function_is_visible,pg_operator_is_visible,'+ + 'pg_opclass_is_visible,pg_conversion_is_visible,format_type,pg_get_viewdef,'+ + 'pg_get_ruledef,pg_get_indexdef,'+ + 'pg_get_triggerdef,pg_get_constraintdef,pg_get_expr,'+ + 'pg_get_userbyid,pg_get_serial_sequence,pg_tablespace_databases,obj_description,'+ + 'col_description,current_setting,set_config,pg_cancel_backend,pg_start_backup,pg_stop_backup,'+ + 'current_user,current_date,current_time,current_timestamp,localtime,localtimestamp,session_user,user'; + + //Postgresql Types + PostgresTypes: UnicodeString = + 'smallint,integer,bigint,decimal,numeric,real,double,serial,bigserial,'+ + 'character,varchar,char,text,bytea,timestamp, interval,date,'+ + 'time,boolean,point,line,lseg,box,path,polygon,circle,cidr,inet,'+ + 'macaddr,BIT,bitvar,ARRAY,oid,regproc,regprocedure,regoper,regoperator,regclass,'+ + 'regtype,any,anyarray,anyelement,cstring,internal,language_handler,record,'+ + 'trigger,void,opaque,refcursor,binary,blob,int4,int2,int8,float,float4,float8'; + + //Postgresql Exceptions + PostgresExceptions: UnicodeString = + '$BODY$,SUCCESSFUL_COMPLETION,WARNING,DYNAMIC_RESULT_SETS_RETURNED,IMPLICIT_ZERO_BIT_PADDING,NULL_VALUE_ELIMINATED_IN_SET_FUNCTION,'+ + 'PRIVILEGE_NOT_GRANTED,PRIVILEGE_NOT_REVOKED,STRING_DATA_RIGHT_TRUNCATION,DEPRECATED_FEATURE,NO_DATA,NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED,'+ + 'SQL_STATEMENT_NOT_YET_COMPLETE,CONNECTION_EXCEPTION,CONNECTION_DOES_NOT_EXIST,CONNECTION_FAILURE,SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,'+ + 'SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION,TRANSACTION_RESOLUTION_UNKNOWN,PROTOCOL_VIOLATION,TRIGGERED_ACTION_EXCEPTION,'+ + 'FEATURE_NOT_SUPPORTED,INVALID_TRANSACTION_INITIATION,LOCATOR_EXCEPTION,INVALID_LOCATOR_SPECIFICATION,INVALID_GRANTOR,INVALID_GRANT_OPERATION,'+ + 'INVALID_ROLE_SPECIFICATION,CARDINALITY_VIOLATION,DATA_EXCEPTION,ARRAY_SUBSCRIPT_ERROR,CHARACTER_NOT_IN_REPERTOIRE,DATETIME_FIELD_OVERFLOW,'+ + 'DIVISION_BY_ZERO,ERROR_IN_ASSIGNMENT,ESCAPE_CHARACTER_CONFLICT,INDICATOR_OVERFLOW,INTERVAL_FIELD_OVERFLOW,INVALID_ARGUMENT_FOR_LOGARITHM,'+ + 'INVALID_ARGUMENT_FOR_POWER_FUNCTION,INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION,INVALID_CHARACTER_VALUE_FOR_CAST,INVALID_DATETIME_FORMAT,'+ + 'INVALID_ESCAPE_CHARACTER,INVALID_ESCAPE_OCTET,INVALID_ESCAPE_SEQUENCE,INVALID_INDICATOR_PARAMETER_VALUE,INVALID_LIMIT_VALUE,'+ + 'INVALID_PARAMETER_VALUE,INVALID_REGULAR_EXPRESSION,INVALID_TIME_ZONE_DISPLACEMENT_VALUE,INVALID_USE_OF_ESCAPE_CHARACTER,'+ + 'MOST_SPECIFIC_TYPE_MISMATCH,NULL_VALUE_NOT_ALLOWED,NULL_VALUE_NO_INDICATOR_PARAMETER,NUMERIC_VALUE_OUT_OF_RANGE,STRING_DATA_LENGTH_MISMATCH,'+ + 'SUBSTRING_ERROR,TRIM_ERROR,UNTERMINATED_C_STRING,ZERO_LENGTH_CHARACTER_STRING,FLOATING_POINT_EXCEPTION,'+ + 'INVALID_TEXT_REPRESENTATION,INVALID_BINARY_REPRESENTATION,BAD_COPY_FILE_FORMAT,UNTRANSLATABLE_CHARACTER,INTEGRITY_CONSTRAINT_VIOLATION,'+ + 'RESTRICT_VIOLATION,NOT_NULL_VIOLATION,FOREIGN_KEY_VIOLATION,UNIQUE_VIOLATION,CHECK_VIOLATION,INVALID_CURSOR_STATE,INVALID_TRANSACTION_STATE,'+ + 'ACTIVE_SQL_TRANSACTION,BRANCH_TRANSACTION_ALREADY_ACTIVE,HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL,INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION,'+ + 'INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION,NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION,READ_ONLY_SQL_TRANSACTION,'+ + 'SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED,NO_ACTIVE_SQL_TRANSACTION,IN_FAILED_SQL_TRANSACTION,INVALID_SQL_STATEMENT_NAME,TRIGGERED_DATA_CHANGE_VIOLATION,'+ + 'INVALID_AUTHORIZATION_SPECIFICATION,DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST,DEPENDENT_OBJECTS_STILL_EXIST,INVALID_TRANSACTION_TERMINATION,'+ + 'SQL_ROUTINE_EXCEPTION,FUNCTION_EXECUTED_NO_RETURN_STATEMENT,MODIFYING_SQL_DATA_NOT_PERMITTED,PROHIBITED_SQL_STATEMENT_ATTEMPTED,READING_SQL_DATA_NOT_PERMITTED,'+ + 'INVALID_CURSOR_NAME,EXTERNAL_ROUTINE_EXCEPTION,CONTAINING_SQL_NOT_PERMITTED,'+ + 'EXTERNAL_ROUTINE_INVOCATION_EXCEPTION,INVALID_SQLSTATE_RETURNED,TRIGGER_PROTOCOL_VIOLATED,'+ + 'SRF_PROTOCOL_VIOLATED,SAVEPOINT_EXCEPTION,INVALID_SAVEPOINT_SPECIFICATION,INVALID_CATALOG_NAME,INVALID_SCHEMA_NAME,TRANSACTION_ROLLBACK,'+ + 'TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION,SERIALIZATION_FAILURE,STATEMENT_COMPLETION_UNKNOWN,DEADLOCK_DETECTED,SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION,'+ + 'SYNTAX_ERROR,INSUFFICIENT_PRIVILEGE,CANNOT_COERCE,GROUPING_ERROR,INVALID_FOREIGN_KEY,INVALID_NAME,NAME_TOO_LONG,RESERVED_NAME,DATATYPE_MISMATCH,'+ + 'INDETERMINATE_DATATYPE,WRONG_OBJECT_TYPE,UNDEFINED_COLUMN,UNDEFINED_FUNCTION,UNDEFINED_TABLE,UNDEFINED_PARAMETER,UNDEFINED_OBJECT,'+ + 'DUPLICATE_COLUMN,DUPLICATE_CURSOR,DUPLICATE_DATABASE,DUPLICATE_FUNCTION,DUPLICATE_PREPARED_STATEMENT,DUPLICATE_SCHEMA,DUPLICATE_TABLE,'+ + 'DUPLICATE_ALIAS,DUPLICATE_OBJECT,AMBIGUOUS_COLUMN,AMBIGUOUS_FUNCTION,AMBIGUOUS_PARAMETER,AMBIGUOUS_ALIAS,INVALID_COLUMN_REFERENCE,'+ + 'INVALID_COLUMN_DEFINITION,INVALID_CURSOR_DEFINITION,INVALID_DATABASE_DEFINITION,INVALID_FUNCTION_DEFINITION,INVALID_PREPARED_STATEMENT_DEFINITION,'+ + 'INVALID_SCHEMA_DEFINITION,INVALID_TABLE_DEFINITION,INVALID_OBJECT_DEFINITION,WITH_CHECK_OPTION_VIOLATION,INSUFFICIENT_RESOURCES,'+ + 'DISK_FULL,OUT_OF_MEMORY,TOO_MANY_CONNECTIONS,PROGRAM_LIMIT_EXCEEDED,STATEMENT_TOO_COMPLEX,TOO_MANY_COLUMNS,TOO_MANY_ARGUMENTS,'+ + 'OBJECT_NOT_IN_PREREQUISITE_STATE,OBJECT_IN_USE,CANT_CHANGE_RUNTIME_PARAM,LOCK_NOT_AVAILABLE,OPERATOR_INTERVENTION,QUERY_CANCELED,'+ + 'ADMIN_SHUTDOWN,CRASH_SHUTDOWN,CANNOT_CONNECT_NOW,IO_ERROR,UNDEFINED_FILE,DUPLICATE_FILE,CONFIG_FILE_ERROR,LOCK_FILE_EXISTS,'+ + 'PLPGSQL_ERROR,RAISE_EXCEPTION,INTERNAL_ERROR,DATA_CORRUPTED,INDEX_CORRUPTED'; + + // PLSQL keywords + OraclePLSQLKW: UnicodeString = + 'ABORT,ACCEPT,AFTER,ARRAY,ARRAYLEN,ASSERT,ASSIGN,AT,AUTHORIZATION,' + + 'AUTONOMOUS_TRANSACTION,BASE_TABLE,BEGIN,BODY,BULK,BULK_ROWCOUNT,CALL,' + + 'CALLING,CASE,CHAR_BASE,CHARSETFORM,CHARSETID,CLOSE,CLUSTERS,COLAUTH,' + + 'COLLECT,COMMIT,CONNECTION,CONSTANT,COOKIE,COOKIE_TABLE,CRASH,CURRVAL,' + + 'CURSOR,DATA_BASE,DATABASE,DBA,DEBUGOFF,DEBUGON,DECLARE,DEFINITION,' + + 'DELAY,DELTA,DEQUEUE_OPTIONS_T,DETERMINISTIC,DIGITS,DISPOSE,DO,EACH,' + + 'ELSIF,END,ENQUEUE_OPTIONS_T,ENTRY,EXCEPTION,EXCEPTION_INIT,EXIT,' + + 'EXTERNAL,FALSE,FETCH,FIXED,FORALL,FORM,FOUND,FUNCTION,GENERIC,GOTO,IF,' + + 'INDEXES,INDICATOR,INSTEAD,INTERFACE,ISOPEN,LANGUAGE,LCR$_DDL_RECORD,' + + 'LCR$_ROW_LIST,LCR$_ROW_RECORD,LCR$_ROW_UNIT,LIMITED,LOOP,MAXLEN,' + + 'MESSAGE_PROPERTIES_T,MGW_BASIC_MSG_T,MGW_MQSERIES_PROPERTIES,' + + 'MGW_NAME_TYPE_ARRAY_T,MGW_NAME_VALUE_T,MGW_PROPERTIES,MGW_PROPERTY,' + + 'MGW_RAW_VALUE_T,MGW_TEXT_VALUE_T,NAME,NEW,NEXTVAL,NOTFOUND,' + + 'NUMBER_BASE,OLD,OPEN,OUT,PACKAGE,PARALLEL_ENABLE,PARTITION,PASCAL,' + + 'PRAGMA,PRIVATE,PROCEDURE,RAISE,RAISE_APPLICATION_ERROR,RANGE,RE$ATTRIBUTE_VALUE,' + + 'RE$ATTRIBUTE_VALUE_LIST,RE$COLUMN_VALUE,RE$COLUMN_VALUE_LIST,' + + 'RE$NAME_ARRAY,RE$NV_ARRAY,RE$NV_LIST,RE$NV_NODE,RE$RULE_HIT,' + + 'RE$RULE_HIT_LIST,RE$TABLE_ALIAS,RE$TABLE_ALIAS_LIST,' + + 'RE$TABLE_VALUE,RE$TABLE_VALUE_LIST,RE$VARIABLE_TYPE,' + + 'RE$VARIABLE_TYPE_LIST,RE$VARIABLE_VALUE,RE$VARIABLE_VALUE_LIST,RECORD,' + + 'REF,REFERENCING,RELEASE,REMR,REQ,RESP,RESTRICT_REFERENCES,RETURN,' + + 'REVERSE,ROLLBACK,ROWCOUNT,ROWTYPE,RUNTIME_INFO,SAVEPOINT,SCHEMA,' + + 'SELF,SEPARATE,SERIALLY_REUSABLE,SPACE,SQL,SQLERROR,STATEMENT,STRUCT,' + + 'SUBTYPE,TABAUTH,TABLES,TASK,TDO,TERMINATE,TRUE,TYPE,USE,VARYING,VIEWS,' + + 'WHEN,WHILE,WORK,WRITE,XOR'; + + // Oracle data types + OracleTypes: UnicodeString = + 'ANYDATA,ANYDATASET,ANYTYPE,BFILE,BINARY_DOUBLE,BINARY_FLOAT,BINARY_INTEGER,' + + 'BLOB,BOOLEAN,CHAR,CLOB,DATE,DAY,DBURITYPE,DEC,DECIMAL,DOUBLE,FLOAT,' + + 'HTTPURITYPE,IDENTITY,INTEGER,INTERVAL,LONG,MLSLABEL,MONTH,NATURAL,NATURALN,NCHAR,' + + 'NCLOB,NUMBER,NUMERIC,NVARCHAR2,PLS_INTEGER,POSITIVE,POSITIVEN,RAW,REAL,' + + 'ROWID,SECOND,SMALLINT,TIMESTAMP,URITYPE,UROWID,VARCHAR,VARCHAR2,XDBURITYPE,' + + 'XMLDATA,XMLTYPE,YEAR,ZONE'; + + // Oracle built in exceptions + OracleExceptions: UnicodeString = + 'ACCESS_INTO_NULL,CASE_NOT_FOUND,COLLECTION_IS_NULL,CURSOR_ALREADY_OPEN,' + + 'DUP_VAL_ON_INDEX,INVALID_CURSOR,INVALID_NUMBER,LOGIN_DENIED,' + + 'NO_DATA_FOUND,NOT_LOGGED_ON,OTHERS,PROGRAM_ERROR,ROWTYPE_MISMATCH,' + + 'SELF_IS_NULL,STORAGE_ERROR,SUBSCRIPT_BEYOND_COUNT,SUBSCRIPT_OUTSIDE_LIMIT,' + + 'SYS_INVALID_ROWID,TIMEOUT_ON_RESOURCE,TOO_MANY_ROWS,VALUE_ERROR,' + + 'ZERO_DIVIDE'; + + // Oracle built in functions + OracleFunctions: UnicodeString = + 'ABS,ACOS,ADD_MONTHS,AGGREGATE,ANALYTIC,ASCII,ASCIISTR,ASIN,ATAN,ATAN2,' + + 'AVERAGE,AVG,BASE64_DECODE,BASE64_ENCODE,BEGIN_REQUEST,BFILENAME,' + + 'BIN_TO_NUM,BIT_AND,BIT_COMPLEMENT,BIT_OR,BIT_XOR,BITAND,' + + 'CAST_FROM_BINARY_INTEGER,CAST_FROM_NUMBER,CAST_TO_BINARY_INTEGER,' + + 'CAST_TO_NUMBER,CAST_TO_RAW,CAST_TO_VARCHAR2,CEIL,CHARTOROWID,CHR,' + + 'COLUMN_PRESENT,COMPARE,COMPARE_TEMPLATES,COMPOSE,CONCAT,CONVERSION,' + + 'CONVERT,CONVERT_ANYDATA_TO_LCR_DDL,CONVERT_ANYDATA_TO_LCR_ROW,' + + 'COPIES,COPY_TEMPLATE,CORR,COS,COSH,COUNT,COVAR_POP,COVAR_SAMP,' + + 'CREATE_OBJECT_FROM_EXISTING,CREATE_PIPE,CREATE_REFRESH_TEMPLATE,' + + 'CREATE_TEMPLATE_OBJECT,CREATE_TEMPLATE_PARM,CREATE_USER_AUTHORIZATION,' + + 'CREATE_USER_PARM_VALUE,CRLF,CUBE,CUME_DIST,CURRENT_DATE,' + + 'CURRENT_INSTANCE,CURRENT_TIMESTAMP,DATA_BLOCK_ADDRESS_BLOCK,' + + 'DATA_BLOCK_ADDRESS_FILE,DBTIMEZONE,DECODE,DECOMPOSE,DELETE_BREAKPOINT,' + + 'DELETE_OER_BREAKPOINT,DENSE_RANK,DEPTH,DEREF,DISABLE_BREAKPOINT,' + + 'DISABLED,DISPLAY,DROP_ALL,DROP_ELEMENT,DROP_FILE,DUMP,' + + 'EMPTY_BLOB,EMPTY_CLOB,ENABLE_BREAKPOINT,EQUALS_PATH,ESTIMATE_CPU_UNITS,' + + 'EXCLUDE_PUSH,EXECUTE_AND_FETCH,EXECUTE_NON_QUERY,EXISTSNODE,EXP,EXTEND,' + + 'EXTRACT,EXTRACTVALUE,FCOPY,FETCH_ROW,FETCH_ROWS,FGETPOS,FILEEXISTS,' + + 'FILEISOPEN,FIRST,FIRST_VALUE,FLOOR,FLUSH_DATA,FOPEN,FOPEN_NCHAR,' + + 'FORMAT_CALL_STACK,FORMAT_ERROR_STACK,FREMOVE,FRENAME,FROM_REMOTE,FSEEK,' + + 'GET_ARG_FORM,GET_ARG_TYPE,GET_COOKIE_COUNT,GET_COOKIES,' + + 'GET_DETAILED_SQLCODE,GET_DETAILED_SQLERRM,GET_ERROR_MESSAGE,' + + 'GET_HASH_VALUE,GET_HEADER_COUNT,GET_INDEXES,GET_INFORMATION,' + + 'GET_OBJECT_NULL_VECTOR_ARG,GET_PARAMETER_VALUE,' + + 'GET_PERSISTENT_CONN_COUNT,GET_RAW,GET_RESPONSE,GET_RUNTIME_INFO,' + + 'GET_RUNTIME_PARM_ID,GET_SESSION_TIMEOUT,GET_SYSTEM_CHANGE_NUMBER,' + + 'GET_TAG,GET_TIME,GET_TIMEOUT,GET_TIMEOUT_BEHAVIOR,GET_VALUE,' + + 'GETCHUNKSIZE,GETLENGTH,GLB,GREATEST,GREATEST_LB,GROUP_ID,GROUPING,' + + 'GROUPING_ID,HEXTORAW,I_AM_A_REFRESH,INITCAP,INITIALIZE,' + + 'INSTANTIATE_OFFLINE,INSTANTIATE_ONLINE,INSTR,INSTRB,' + + 'INTERNAL_VERSION_CHECK,IS_CLUSTER_DATABASE,IS_LOCATOR,IS_OPEN,' + + 'IS_ROLE_ENABLED,IS_SESSION_ALIVE,IS_TRIGGER_FIRE_ONCE,ISTEMPORARY,LAG,' + + 'LAST,LAST_DAY,LAST_ERROR_POSITION,LAST_ROW_COUNT,LAST_ROW_ID,' + + 'LAST_SQL__CODE,LAST_VALUE,LEAD,LEAST,LEAST_LB,LENGTH,LENGTHB,LINEAR,LN,' + + 'LOCAL_TRANSACTION_ID,LOCALTIMESTAMP,LOG,LOWER,LPAD,LTRIM,LUB,' + + 'MAKE_DATA_BLOCK_ADDRESS,MAKE_REF,MAP_ALL,MAP_ELEMENT,MAP_FILE,' + + 'MAP_OBJECT,MAX,MIN,MINE_VALUE,MISCELLANEOUS,MOD,MONTHS_BETWEEN,NCHR,' + + 'NEW_TIME,NEXT_DAY,NEXT_ITEM_TYPE,NLS_CHARSET_DECL_LEN,NLS_CHARSET_ID,' + + 'NLS_CHARSET_NAME,NLS_INITCAP,NLS_LOWER,NLS_SORT,NLS_UPPER,NLSSORT,NTILE,' + + 'NULLIF,NUMTODSINTERVAL,NUMTOYMINTERVAL,NVARRAY_FIND_NAME,' + + 'NVARRAY_FIND_NAME_TYPE,NVARRAY_GET,NVARRAY_GET_BOOLEAN,NVARRAY_GET_BYTE,' + + 'NVARRAY_GET_DATE,NVARRAY_GET_DOUBLE,NVARRAY_GET_FLOAT,' + + 'NVARRAY_GET_INTEGER,NVARRAY_GET_LONG,NVARRAY_GET_RAW,NVARRAY_GET_SHORT,' + + 'NVARRAY_GET_TEXT,NVL,NVL2,OBJECT,OPEN_CURSOR,OVER,OVERLAY,PATH,' + + 'PAUSE_PROFILER,PERCENT_RANK,PERCENTILE_CONT,PERCENTILE_DISC,PMARKER,' + + 'PORT_STRING,POWER,PURGE,PUSH,PUT_RAW,QUOTED_PRINTABLE_DECODE,' + + 'QUOTED_PRINTABLE_ENCODE,RANDOM,RANK,RATIO_TO_REPORT,RATION_TO_REPORT,' + + 'RAWTOHEX,RAWTONHEX,RECEIVE_MESSAGE,REFERENCE,REFTOHEX,REGR_AVGX,' + + 'REGR_AVGY,REGR_COUNT,REGR_INTERCEPT,REGR_R2,REGR_SLOPE,REGR_SXX,' + + 'REGR_SXY,REGR_SYY,REGRESSION,REMOVE_PIPE,REPLACE,REPLICATION_IS_ON,' + + 'REQUEST,REQUEST_PIECES,RESTORE,RESUME_PROFILER,RETURNING,ROLLUP,ROUND,' + + 'ROW_NUMBER,ROWID_BLOCK_NUMBER,ROWID_CREATE,ROWID_OBJECT,' + + 'ROWID_RELATIVE_FNO,ROWID_ROW_NUMBER,ROWID_TO_ABSOLUTE_FNO,' + + 'ROWID_TO_EXTENDED,ROWID_TO_RESTRICTED,ROWID_TYPE,ROWID_VERIFY,' + + 'ROWIDTOCHAR,ROWIDTONCHAR,RPAD,RTRIM,SEND_MESSAGE,SESSIONTIMEZONE,' + + 'SET_BREAKPOINT,SET_OER_BREAKPOINT,SET_TIMEOUT,SET_VALUE,SIGN,SIN,SINH,' + + 'SOUNDEX,SPACE_ERROR_INFO,SQLCODE,SQLERRM,SQRT,START_PROFILER,STDDEV,' + + 'STDDEV_POP,STDDEV_SAMP,STDDEVP,STDDEVS,STEP_ID,STOP_PROFILER,SUBSTR,' + + 'SUBSTRB,SUM,SYNCHRONIZE,SYS_CONNECT_BY_PATH,SYS_CONTEXT,SYS_DBURIGEN,' + + 'SYS_EXTRACT_UTC,SYS_GUID,SYS_TYPEID,SYS_XMLAGG,SYS_XMLGEN,SYSDATE,' + + 'SYSTIMESTAMP,TAN,TANH,TO_CHAR,TO_CLOB,TO_DATE,TO_DSINTERVAL,TO_LABEL,' + + 'TO_LOB,TO_MULTI_BYTE,TO_NCHAR,TO_NCLOB,TO_NUMBER,TO_SINGLE_BYTE,' + + 'TO_TIMESTAMP,TO_TIMESTAMP_TZ,TO_YMINTERVAL,TRANSLATE,TRANSLITERATE,' + + 'TREAT,TRIM,TRUNC,TZ_OFFSET,UID,UNDER_PATH,UNESCAPE,UNIQUE_SESSION_ID,' + + 'UNIQUE_SESSION_NAME,UNISTR,UPDATEXML,UPPER,USER,USERENV,USING,UUDECODE,' + + 'UUENCODE,VALUE,VAR_POP,VAR_SAMP,VARIANCE,VARP,VARS,VSIZE,WIDTH_BUCKET,' + + 'XMLAGG,XMLCOLATTVAL,XMLCONCAT,XMLELEMENT,XMLFOREST,XMLSEQUENCE,' + + 'XMLTRANSFORM,XRANGE'; + + OracleDefaultPackages: UnicodeString = + 'CTX_ADM,CTX_CLS,CTX_DDL,CTX_DOC,CTX_OUTPUT,CTX_QUERY,CTX_REPORT,CTX_THES,CTX_ULEXER,' + + 'DBMS_ADVANCED_REWRITE,DBMS_ADVISOR,DBMS_ALERT,DBMS_APPLICATION_INFO,' + + 'DBMS_APPLY_ADM,DBMS_AQ,DBMS_AQ_EXP_HISTORY_TABLES,DBMS_AQ_EXP_INDEX_TABLES,' + + 'DBMS_AQ_EXP_QUEUE_TABLES,DBMS_AQ_EXP_QUEUES,' + + 'DBMS_AQ_EXP_SUBSCRIBER_TABLES,DBMS_AQ_EXP_TIMEMGR_TABLES,' + + 'DBMS_AQ_EXP_ZECURITY,DBMS_AQ_IMP_INTERNAL,DBMS_AQ_IMP_ZECURITY,' + + 'DBMS_AQ_IMPORT_INTERNAL,DBMS_AQ_SYS_EXP_ACTIONS,' + + 'DBMS_AQ_SYS_EXP_INTERNAL,DBMS_AQ_SYS_IMP_INTERNAL,DBMS_AQADM,' + + 'DBMS_AQADM_SYS,DBMS_AQADM_SYSCALLS,DBMS_AQELM,DBMS_AQIN,' + + 'DBMS_AQJMS,DBMS_ASSERT,DBMS_AUTO_TASK_ADMIN,DBMS_AW_STATS,DBMS_BACKUP_RESTORE,' + + 'DBMS_CAPTURE_ADM,DBMS_CDC_PUBLISH,DBMS_CDC_SUBSCRIBE,DBMS_COMPARISON,' + + 'DBMS_CONNECTION_POOL,DBMS_CQ_NOTIFICATION,DBMS_CRYPTO,DBMS_CSX_ADMIN,' + + 'DBMS_CUBE,DBMS_CUBE_ADVISE,DBMS_DATA_MINING,DBMS_DATA_MINING_TRANSFORM,' + + 'DBMS_DATAPUMP,DBMS_DB_VERSION,DBMS_DDL,' + + 'DBMS_DEBUG,DBMS_DEFER,DBMS_DEFER_IMPORT_INTERNAL,DBMS_DEFER_QUERY,' + + 'DBMS_DEFER_SYS,DBMS_DESCRIBE,DBMS_DG,DBMS_DIMENSION,DBMS_DISTRIBUTED_TRUST_ADMIN,' + + 'DBMS_EPG,DBMS_ERRLOG,DBMS_EXPFIL,DBMS_EXPORT_EXTENSION,DBMS_FGA,DBMS_FILE_GROUP,' + + 'DBMS_FILE_TRANSFER,DBMS_FLASHBACK,DBMS_FREQUENT_ITEMSET,DBMS_HM,DBMS_HPROF,' + + 'DBMS_HS_PARALLEL,DBMS_HS_PASSTHROUGH,DBMS_IJOB,DBMS_INTERNAL_TRIGGER,DBMS_IOT,' + + 'DBMS_IREFRESH,DBMS_ISNAPSHOT,DBMS_JAVA,DBMS_JAVA_TEST,DBMS_JOB,DBMS_LDAP,DBMS_LDAP_UTL,' + + 'DBMS_LIBCACHE,DBMS_LOB,DBMS_LOCK,DBMS_LOGMNR,DBMS_LOGMNR_CDC_PUBLISH,' + + 'DBMS_LOGMNR_CDC_SUBSCRIBE,DBMS_LOGMNR_D,DBMS_LOGSTDBY,DBMS_METADATA,' + + 'DBMS_MGD_ID_UTL,DBMS_MGWADM,DBMS_MGWMSG,DBMS_MONITOR,DBMS_MVIEW,' + + 'DBMS_NETWORK_ACL_ADMIN,DBMS_NETWORK_UTL, DBMS_OBFUSCATION_TOOLKIT,DBMS_ODCI,' + + 'DBMS_OFFLINE_OG,DBMS_OFFLINE_SNAPSHOT,DBMS_OLAP,' + + 'DBMS_ORACLE_TRACE_AGENT,DBMS_ORACLE_TRACE_USER,DBMS_OUTLN,' + + 'DBMS_OUTLN_EDIT,DBMS_OUTPUT,DBMS_PCLXUTIL,DBMS_PICKLER,DBMS_PIPE,' + + 'DBMS_PITR,DBMS_PLUGTS,DBMS_PROFILER,DBMS_PROPAGATION_ADM,' + + 'DBMS_PRVTAQIM,DBMS_PRVTAQIP,DBMS_PRVTAQIS,DBMS_PRVTRMIE,DBMS_PSP,' + + 'DBMS_PSWMG_IMPORT,DBMS_PREDICTIVE_ANALYTICS,DBMS_PREPROCESSOR,' + + 'DBMS_RANDOM,DBMS_RCVMAN,DBMS_RECTIFIER_DIFF,DBMS_REDEFINITION,DBMS_REFRESH,' + + 'DBMS_REFRESH_EXP_LWM,DBMS_REFRESH_EXP_SITES,DBMS_REPAIR,DBMS_REPCAT,DBMS_REPCAT_ADMIN,' + + 'DBMS_REPCAT_AUTH,DBMS_REPCAT_INSTANTIATE,DBMS_REPCAT_RGT,DBMS_REPUTIL,' + + 'DBMS_RESCONFIG,DBMS_RESOURCE_MANAGER,DBMS_RESOURCE_MANAGER_PRIVS,DBMS_RESULT_CACHE,' + + 'DBMS_RESUMABLE,DBMS_RLMGR,DBMS_RLS,DBMS_RMGR_GROUP_EXPORT,DBMS_RMGR_PACT_EXPORT,' + + 'DBMS_RMGR_PLAN_EXPORT,DBMS_RMIN,DBMS_ROWID,DBMS_RULE,DBMS_RULE_ADM,' + + 'DBMS_RULE_EXIMP,DBMS_SCHEDULER,DBMS_SERVER_ALERT,DBMS_SERVICE,DBMS_SESSION,' + + 'DBMS_SHARED_POOL,DBMS_SNAP_INTERNAL,DBMS_SNAP_REPAPI,DBMS_SNAPSHOT,DBMS_SNAPSHOT_UTL,' + + 'DBMS_SPACE,DBMS_SPACE_ADMIN,DBMS_SQL,DBMS_SQLDIAG,DBMS_SQLTUNE,DBMS_STANDARD,' + + 'DBMS_STAT_FUNCS,DBMS_STATS,DBMS_STORAGE_MAP,' + + 'DBMS_STREAMS,DBMS_STREAMS_ADM,DBMS_STREAMS_AUTH,DBMS_STREAMS_ADVISOR_ADM,' + + 'DBMS_STREAMS_MESSAGING,DBMS_STREAMS_TABLESPACE_ADM,DBMS_SUMADV,DBMS_SUMMARY,' + + 'DBMS_SUMREF_CHILD,DBMS_SUMREF_PARENT,DBMS_SUMREF_UTIL,' + + 'DBMS_SUMREF_UTIL2,DBMS_SUMVDM,DBMS_SYS_ERROR,DBMS_SYS_SQL,' + + 'DBMS_SYSTEM,DBMS_TDB,DBMS_TRACE,DBMS_TRANSACTION,DBMS_TRANSFORM,DBMS_TTS,' + + 'DBMS_TYPES,DBMS_UTILITY,DBMS_WORKLOAD_CAPTURE,DBMS_WORKLOAD_REPLAY,' + + 'DBMS_WORKLOAD_REPOSITORY,DBMS_WM,DBMS_XA,DBMS_XDB,DBMS_XDB_ADMIN,' + + 'DBMS_XDB_VERSION,DBMS_XDBRESOURCE,DBMS_XDBT,DBMS_XDBZ,DBMS_XEVENT,' + + 'DBMS_XMLDOM,DBMS_XMLGEN,DBMS_XMLINDEX,DBMS_XMLPARSER,DBMS_XMLQUERY,' + + 'DBMS_XMLSAVE,DBMS_XMLSCHEMA,DBMS_XMLSTORE,DBMS_XMLTRANSLATIONS,DBMS_XPLAN,' + + 'DBMS_XSLPROCESSOR,DBMS_ZHELP,DBMS_ZHELP_IR,DBMSZEXP_SYSPKGGRNT,DEBUG_EXTPROC,' + + 'DIANA,DIUTIL,HTF,HTP,ODCICONST,OUTLN_PKG,PBREAK,PBRPH,PBSDE,PBUTL,PIDL,PLITBLM,' + + 'SDO_CS,SDO_GEOM,SDO_LRS,SDO_MIGRATE,SDO_TUNE,SDO_UTIL,STANDARD,' + + 'SYS_STUB_FOR_PURITY_ANALYSIS,UTL_COLL,UTL_ENCODE,UTL_FILE,UTL_FILE_DIR,UTL_HTTP,' + + 'UTL_I18N,UTL_INADDR,UTL_LMS,UTL_MAIL,UTL_NLA,UTL_PG,UTL_RAW,UTL_REF,UTL_SMTP,' + + 'UTL_SPADV,UTL_TCP,UTL_URL,WPG_DOCLOAD'; + + OracleSQLPlusCommands: UnicodeString = + 'APP,APPINFO,AQ$_AGENT,AQ$_AGENT_LIST_T,AQ$_DESCRIPTOR,AQ$_POST_INFO,' + + 'AQ$_POST_INFO_LIST,AQ$_RECIPIENT_LIST_T,AQ$_REG_INFO,AQ$_REG_INFO_LIST,' + + 'AQ$_SUBSCRIBER_LIST_T,ARCHIVE,ARRAYSIZE,ATTRIBUTE,AUTOCOMMIT,AUTOP,' + + 'AUTOPRINT,AUTORECOVERY,AUTOT,AUTOTRACE,BLO,BLOCKTERMINATOR,BRE,BREAK,' + + 'BTI,BTITLE,BUFFER,CL,CLEAR,CLOSECURSOR,CMDS,CMDSEP,COL,COLSEP,COM,COMP,' + + 'COMPAT,COMPATIBILITY,CON,CONN,COPY,COPYC,COPYCOMMIT,COPYTYPECHECK,DEF,' + + 'DEFINE,DESC,DESCR,DESCRI,DESCRIB,DESCRIBE,DISC,DISCO,DISCON,DISCONN,' + + 'DISCONNE,DISCONNEC,DISCONNECT,EA,ECHO,EDITF,EDITFILE,EMB,' + + 'EMBEDDED,ESC,EXEC,EXECUTE,FAILURE,FEED,FEEDBACK,FLAGGER,FLU,GET,' + + 'HEA,HEADING,HEADS,HEADSEP,HELP,HO,HOST,INPUT,INTERMED,INTERMEDIATE,INV,' + + 'INVISIBLE,LIN,LINESIZE,LO,LOBOF,LOBOFFSET,LOGON,LOGSOURCE,LONGC,' + + 'LONGCHUNKSIZE,MARKUP,MAXDATA,MIX,MIXED,NATIVE,NEWP,NEWPAGE,NUM,' + + 'NUMF,NUMFORMAT,NUMWIDTH,OFF,OSERROR,PAGES,PAGESIZE,PASSW,PAU,PAUSE,' + + 'PPRINT,PRI,PRINT,RECSEP,RECSEPCHAR,REPF,REPFOOTER,REPH,REPHEADER,' + + 'RUN,SAVE,SCAN,SERVEROUTPUT,SET,SHIFT,SHIFTINOUT,SHO,SHOW,SHUTDOWN,' + + 'SILENT,SPOOL,SQLBL,SQLBLANKLINES,SQLC,SQLCASE,SQLCO,SQLCONTINUE,SQLN,' + + 'SQLNUMBER,SQLP,SQLPRE,SQLPREFIX,SQLPROMPT,SQLT,SQLTERMINATOR,STA,' + + 'STARTUP,STATEMENT_ID,STORE,SUCCESS,SUF,SUFFIX,TAB,TERM,TERMOUT,TI,TIMI,' + + 'TIMING,TRIMOUT,TRIMS,TRIMSPOOL,TTI,TTITLE,UND,UNDEF,UNDEFINE,' + + 'UNDERLINE,UP,VAR,VARIABLE,VER,VERIFY,VERSION,VIS,VISIBLE,WHENEVER,WR,' + + 'WRA,WRAP,WRAPPED'; + + OracleCommentKW: UnicodeString = + 'REM,REMA,REMAR,REMARK'; + + OracleConsoleOutputKW: UnicodeString = + 'PRO,PROM,PROMP,PROMPT'; + +//---MS-SQL 7------------------------------------------------------------------- + // keywords + MSSQL7KW: UnicodeString = + 'ABSOLUTE,ADD,ALL,ALTER,ANY,AS,ASC,AUTHORIZATION,AVG,BACKUP,BEGIN,' + + 'BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CHECK,CHECKPOINT,CLOSE,CLUSTERED,' + + 'COLUMN,COMMIT,COMMITTED,COMPUTE,CONFIRM,CONSTRAINT,CONTAINS,' + + 'CONTAINSTABLE,CONTINUE,CONTROLROW,COUNT,CREATE,CROSS,CURRENT,' + + 'CURRENT_DATE,CURRENT_TIME,CURSOR,DATABASE,DBCC,DEALLOCATE,DECLARE,' + + 'DEFAULT,DELETE,DENY,DESC,DISK,DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,' + + 'DUMP,ELSE,END,ERRLVL,ERROREXIT,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,' + + 'FETCH,FILE,FILLFACTOR,FIRST,FLOPPY,FOR,FOREIGN,FREETEXT,FREETEXTTABLE,' + + 'FROM,FULL,GLOBAL,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,IDENTITYCOL,' + + 'IDENTITY_INSERT,IF,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISOLATION,' + + 'JOIN,KEY,KILL,LAST,LEFT,LEVEL,LIKE,LINENO,LOAD,MAX,MIN,MIRROREXIT,' + + 'NATIONAL,NEXT,NOCHECK,NONCLUSTERED,NOT,NULL,OF,OFF,OFFSETS,ON,ONCE,' + + 'ONLY,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPTION,OR,ORDER,OUTER,' + + 'OVER,PERCENT,PERM,PERMANENT,PIPE,PLAN,PRECISION,PREPARE,PRIMARY,PRINT,' + + 'PRIOR,PRIVILEGES,PROC,PROCEDURE,PROCESSEXIT,PUBLIC,RAISERROR,READ,' + + 'READTEXT,RECONFIGURE,REFERENCES,RELATIVE,REPEATABLE,REPLICATION,RESTORE,' + + 'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,RULE,SAVE,' + + 'SCHEMA,SELECT,SERIALIZABLE,SET,SETUSER,SHUTDOWN,SOME,STATISTICS,SUM,' + + 'TABLE,TAPE,TEMP,TEMPORARY,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,TRIGGER,' + + 'TRUNCATE,TSEQUAL,UNCOMMITTED,UNION,UNIQUE,UPDATE,UPDATETEXT,USE,USER,' + + 'VALUES,VARYING,VIEW,WAITFOR,WHEN,WHERE,WHILE,WITH,WORK,WRITETEXT'; + + // functions + MSSQL7Functions: UnicodeString = + '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + + '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + + '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + + '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' + + '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' + + '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,ABS,' + + 'ACOS,AND,APP_NAME,ASCII,ASIN,ATAN,ATN2,CASE,CAST,CEILING,CHARINDEX,' + + 'COALESCE,COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,' + + 'CURRENT_TIMESTAMP,CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,' + + 'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,' + + 'DEGREES,DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' + + 'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,FORMATMESSAGE,' + + 'FULLTEXTCATALOGPROPERTY,FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,' + + 'HOST_ID,HOST_NAME,IDENT_INCR,IDENT_SEED,INDEXPROPERTY,INDEX_COL,' + + 'ISDATE,ISNULL,ISNUMERIC,IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,' + + 'LTRIM,MONTH,NEWID,NULLIF,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,' + + 'PATINDEX,PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,' + + 'REVERSE,ROUND,RTRIM,SESSION_USER,SIGN,SIN,SOUNDEX,SPACE,SQRT,SQUARE,' + + 'STATS_DATE,STR,STUFF,SUBSTRING,SUSER_ID,SUSER_NAME,SUSER_SID,' + + 'SUSER_SNAME,SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,' + + 'UPPER,USER_ID,USER_NAME,YEAR'; + + // types + MSSQL7Types: UnicodeString = + 'BINARY,BIT,CHAR,DATETIME,DECIMAL,FLOAT,IMAGE,INT,MONEY,NCHAR,NTEXT,' + + 'NUMERIC,NVARCHAR,REAL,SMALLDATETIME,SMALLINT,SMALLMONEY,SYSNAME,TEXT,' + + 'TIMESTAMP,TINYINT,UNIQUEIDENTIFIER,VARBINARY,VARCHAR'; + +//---MS-SQL2K------------------------------------------------------------------- + // keywords + MSSQL2000KW: UnicodeString = + 'ADD,ALL,ALTER,AND,ANY,AS,ASC,AUTHORIZATION,BACKUP,' + + 'BEGIN,BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CASE,' + + 'CHECK,CHECKPOINT,CLOSE,CLUSTERED,COLLATE,' + + 'COLUMN,COMMIT,COMPUTE,CONSTRAINT,CONTAINS,CONTAINSTABLE,' + + 'CONTINUE,CREATE,CROSS,CURRENT,CURSOR,DATABASE,' + + 'DBCC,DEALLOCATE,DECLARE,DEFAULT,DELETE,DENY,DESC,DISK,' + + 'DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,DUMP,ELSE,END,' + + 'ERRLVL,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,FETCH,FILE,' + + 'FILLFACTOR,FOR,FOREIGN,FORMSOF,FREETEXT,FREETEXTTABLE,FROM,FULL,' + + 'FUNCTION,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,' + + 'IDENTITYCOL,IDENTITY_INSERT,IF,IN,INFLECTIONAL,INDEX,INNER,INSERT,' + + 'INTERSECT,INTO,IS,ISABOUT,JOIN,KEY,KILL,LEFT,LIKE,LINENO,LOAD,' + + 'NATIONAL,NOCHECK,NONCLUSTERED,NOT,NULL,NULLIF,OF,OFF,' + + 'OFFSETS,ON,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPENXML,' + + 'OPTION,OR,ORDER,OUTER,OVER,PERCENT,PLAN,PRECISION,' + + 'PRIMARY,PRINT,PROC,PROCEDURE,PUBLIC,RAISERROR,READ,' + + 'READTEXT,RECONFIGURE,REFERENCES,REPLICATION,RESTORE,' + + 'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,' + + 'RULE,SAVE,SCHEMA,SELECT,SESSION_USER,SET,SETUSER,SHUTDOWN,' + + 'SOME,STATISTICS,TABLE,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,' + + 'TRIGGER,TRUNCATE,TSEQUAL,UNION,UNIQUE,UPDATE,UPDATETEXT,' + + 'USE,USER,VALUES,VARYING,VIEW,WAITFOR,WEIGHT,WHEN,WHERE,WHILE,' + + 'WITH,WRITETEXT'; + + // functions + MSSQL2000Functions: UnicodeString = + '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + + '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + + '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + + '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' + + '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' + + '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,' + + 'ABS,ACOS,APP_NAME,ASCII,ASIN,ATAN,ATN2,AVG,BINARY_CHECKSUM,CAST,' + + 'CEILING,CHARINDEX,CHECKSUM,CHECKSUM_AGG,COALESCE,COLLATIONPROPERTY,' + + 'COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,COUNT,' + + 'COUNT_BIG,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,' + + 'CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,DATABASEPROPERTYEX,' + + 'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,DEGREES,' + + 'DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' + + 'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,fn_helpcollations,' + + 'fn_listextendedproperty,fn_servershareddrives,fn_trace_geteventinfo,' + + 'fn_trace_getfilterinfo,fn_trace_getinfo,fn_trace_gettable,' + + 'fn_virtualfilestats,FORMATMESSAGE,FULLTEXTCATALOGPROPERTY,' + + 'FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,GETUTCDATE,GROUPING,' + + 'HAS_DBACCESS,HOST_ID,HOST_NAME,IDENT_CURRENT,IDENT_INCR,IDENT_SEED,' + + 'INDEXKEY_PROPERTY,INDEXPROPERTY,INDEX_COL,ISDATE,ISNULL,ISNUMERIC,' + + 'IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,LTRIM,MAX,MIN,MONTH,' + + 'NEWID,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,PATINDEX,' + + 'PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,REVERSE,' + + 'ROUND,ROWCOUNT_BIG,RTRIM,SCOPE_IDENTITY,SERVERPROPERTY,SESSIONPROPERTY,' + + 'SIGN,SIN,SOUNDEX,SPACE,SQL_VARIANT_PROPERTY,SQRT,SQUARE,' + + 'STATS_DATE,STDEV,STDEVP,STR,STUFF,SUBSTRING,SUM,SUSER_SID,SUSER_SNAME,' + + 'SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,UPPER,' + + 'USER_ID,USER_NAME,VAR,VARP,YEAR'; + + // types + MSSQL2000Types: UnicodeString = + 'bigint,binary,bit,char,character,datetime,' + + 'dec,decimal,float,image,int,' + + 'integer,money,nchar,ntext,numeric,nvarchar,real,' + + 'rowversion,smalldatetime,smallint,smallmoney,' + + 'sql_variant,sysname,text,timestamp,tinyint,uniqueidentifier,' + + 'varbinary,varchar'; + +//---Interbase 6---------------------------------------------------------------- + // functions + Interbase6Functions: UnicodeString = 'AVG,CAST,COUNT,GEN_ID,MAX,MIN,SUM,UPPER'; + + // keywords + Interbase6KW: UnicodeString = 'ACTIVE,ADD,AFTER,ALL,ALTER,AND,ANY,AS,ASC,' + + 'ASCENDING,AT,AUTO,AUTODDL,BASED,BASENAME,BASE_NAME,BEFORE,BEGIN,BETWEEN,' + + 'BLOBEDIT,BUFFER,BY,CACHE,CHARACTER_LENGTH,CHAR_LENGTH,CHECK,' + + 'CHECK_POINT_LEN,CHECK_POINT_LENGTH,COLLATE,COLLATION,COLUMN,COMMIT,' + + 'COMMITED,COMPILETIME,COMPUTED,CLOSE,CONDITIONAL,CONNECT,CONSTRAINT,' + + 'CONTAINING,CONTINUE,CREATE,CURRENT,CURRENT_DATE,CURRENT_TIME,' + + 'CURRENT_TIMESTAMP,CURSOR,DATABASE,DAY,DB_KEY,DEBUG,DEC,DECLARE,DEFAULT,' + + 'DELETE,DESC,DESCENDING,DESCRIBE,DESCRIPTOR,DISCONNECT,DISTINCT,DO,' + + 'DOMAIN,DROP,ECHO,EDIT,ELSE,END,ENTRY_POINT,ESCAPE,EVENT,EXCEPTION,' + + 'EXECUTE,EXISTS,EXIT,EXTERN,EXTERNAL,EXTRACT,FETCH,FILE,FILTER,FOR,' + + 'FOREIGN,FOUND,FROM,FULL,FUNCTION,GDSCODE,GENERATOR,GLOBAL,GOTO,GRANT,' + + 'GROUP,GROUP_COMMIT_WAIT,GROUP_COMMIT_WAIT_TIME,HAVING,HELP,HOUR,IF,' + + 'IMMEDIATE,IN,INACTIVE,INDEX,INDICATOR,INIT,INNER,INPUT,INPUT_TYPE,' + + 'INSERT,INT,INTO,IS,ISOLATION,ISQL,JOIN,KEY,LC_MESSAGES,LC_TYPE,LEFT,' + + 'LENGTH,LEV,LEVEL,LIKE,LOGFILE,LOG_BUFFER_SIZE,LOG_BUF_SIZE,LONG,MANUAL,' + + 'MAXIMUM,MAXIMUM_SEGMENT,MAX_SEGMENT,MERGE,MESSAGE,MINIMUM,MINUTE,' + + 'MODULE_NAME,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NO,NOAUTO,NOT,NULL,' + + 'NUM_LOG_BUFFS,NUM_LOG_BUFFERS,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,' + + 'ORDER,OUTER,OUTPUT,OUTPUT_TYPE,OVERFLOW,PAGE,PAGELENGTH,PAGES,PAGE_SIZE,' + + 'PARAMETER,PASSWORD,PLAN,POSITION,POST_EVENT,PRECISION,PREPARE,PROCEDURE,' + + 'PROTECTED,PRIMARY,PRIVILEGES,PUBLIC,QUIT,RAW_PARTITIONS,READ,REAL,' + + 'RECORD_VERSION,REFERENCES,RELEASE,RESERV,RESERVING,RETAIN,RETURN,' + + 'RETURNING_VALUES,RETURNS,REVOKE,RIGHT,ROLLBACK,RUNTIME,SCHEMA,SECOND,' + + 'SEGMENT,SELECT,SET,SHADOW,SHARED,SHELL,SHOW,SINGULAR,SIZE,SNAPSHOT,SOME,' + + 'SORT,SQL,SQLCODE,SQLERROR,SQLWARNING,STABILITY,STARTING,STARTS,' + + 'STATEMENT,STATIC,STATISTICS,SUB_TYPE,SUSPEND,TABLE,TERMINATOR,THEN,TO,' + + 'TRANSACTION,TRANSLATE,TRANSLATION,TRIGGER,TRIM,TYPE,UNCOMMITTED,UNION,' + + 'UNIQUE,UPDATE,USER,USING,VALUE,VALUES,VARIABLE,VARYING,VERSION,VIEW,' + + 'WAIT,WEEKDAY,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY'; + + // types + Interbase6Types: UnicodeString = + 'BLOB,CHAR,CHARACTER,DATE,DECIMAL,DOUBLE,FLOAT,INTEGER,' + + 'NUMERIC,SMALLINT,TIME,TIMESTAMP,VARCHAR'; + +//---MySQL---------------------------------------------------------------------- + // keywords + MySqlKW: UnicodeString = + 'ACCOUNT,ACTION,ADD,AFTER,AGAINST,ALGORITHM,ALL,ALTER,ANY,ALWAYS,ANALYZE,' + + 'AND,AS,ASC,AT,AUTO_INCREMENT,AVG_ROW_LENGTH,BEFORE,BEGIN,BETWEEN,BINLOG,' + + 'BLOCK,BOTH,BY,CACHE,CALL,CASCADE,CASCADED,CATALOG_NAME,CHANGE,CHANGED,' + + 'CHANNEL,CHAIN,CHARACTER,CHARSET,CHECK,CHECKSUM,CLASS_ORIGIN,CLIENT,CODE,' + + 'COLLATE,COLLATION,COLUMN,COLUMN_FORMAT,COLUMN_NAME,COLUMNS,COMMENT,' + + 'COMMIT,COMMITTED,COMPLETION,CONCURRENT,CONDITION,CONNECTION,CONSISTENT,' + + 'CONSTRAINT,CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,' + + 'CONTAINS,CONTEXT,CONTINUE,CONVERT,COPY,CPU,CREATE,CROSS,CURRENT,CURSOR,' + + 'CURSOR_NAME,CYCLE,DATA,DATABASE,DATABASES,DATAFILE,DAY_HOUR,' + + 'DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DEALLOCATE,DECLARE,DEFAULT,' + + 'DEFINER,DELAY_KEY_WRITE,DELAYED,DELETE,DESC,DESCRIBE,DETERMINISTIC,' + + 'DIAGNOSTICS,DIRECTORY,DISABLE,DISCARD,DISTINCT,DISTINCTROW,DIV,DO,DROP,' + + 'DUAL,DUMPFILE,DUPLICATE,EACH,ELSE,ELSEIF,ENABLE,ENCLOSED,END,ENDS,' + + 'ENGINE,ENGINES,ERROR,ERRORS,ESCAPE,ESCAPED,EVENT,EVENTS,EVERY,EXCHANGE,' + + 'EXCLUSIVE,EXECUTE,EXISTS,EXPANSION,EXPIRE,EXPLAIN,EXTENDED,FALSE,FAST,' + + 'FAULTS,FILE_BLOCK_SIZE,FLUSH,FIELDS,FILE,FIRST,FOLLOWS,FOR,FORCE,' + + 'FOREIGN,FOUND,FROM,FULL,FULLTEXT,FUNCTION,GENERAL,GENERATED,GET,GLOBAL,' + + 'GRANT,GRANTS,GROUP,HAVING,HELP,HIGH_PRIORITY,HOST,HOSTS,' + + 'HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IDENTIFIED,IGNORE,' + + 'IGNORE_SERVER_IDS,IMPORT,IN,INCREMENT,INDEX,INDEXES,INFILE,INITIAL_SIZE,' + + 'INNER,INOUT,INPLACE,INSTANCE,INSERT,INSERT_METHOD,INSTALL,INTO,INVOKER,' + + 'IO,IPC,IS,ISOLATION,JOIN,JSON,KEY,KEY_BLOCK_SIZE,KEYS,KILL,LANGUAGE,' + + 'LAST,LEADING,LESS,LEVEL,LIKE,LIMIT,LINEAR,LINES,LIST,LOAD,LOCAL,LOCK,' + + 'LOGS,LOW_PRIORITY,MASTER,MASTER_AUTO_POSITION,MASTER_BIND,' + + 'MASTER_CONNECT_RETRY,MASTER_DELAY,MASTER_HEARTBEAT_PERIOD,MASTER_HOST,' + + 'MASTER_LOG_FILE,MASTER_LOG_POS,MASTER_PASSWORD,MASTER_PORT,' + + 'MASTER_RETRY_COUNT,MASTER_SSL,MASTER_SSL_CA,MASTER_SSL_CAPATH,' + + 'MASTER_SSL_CERT,MASTER_SSL_CIPHER,MASTER_SSL_CRL,MASTER_SSL_CRLPATH,' + + 'MASTER_SSL_KEY,MASTER_SSL_VERIFY_SERVER_CERT,MASTER_TLS_VERSION,' + + 'MASTER_USER,MATCH,MAX_QUERIES_PER_HOUR,MAX_ROWS,' + + 'MAX_CONNECTIONS_PER_HOUR,MAX_STATEMENT_TIME,MAX_UPDATES_PER_HOUR,' + + 'MAX_USER_CONNECTIONS,MAXVALUE,MEDIUM,MESSAGE_TEXT,MIGRATE,MIN_ROWS,' + + 'MINUTE_MICROSECOND,MINUTE_SECOND,MINVALUE,MOD,MODE,MODIFIES,MODIFY,' + + 'MUTEX,MYSQL_ERRNO,NAME,NAMES,NATURAL,NEVER,NEW,NEXT,NO,NOCACHE,NOCYCLE,' + + 'NOMAXVALUE,NOMINVALUE,NONE,NOT,NULL,NO_WRITE_TO_BINLOG,NUMBER,OFFSET,' + + 'OJ,OLD,ON,ONE,ONLINE,ONLY,OPEN,OPTIMIZE,OPTION,OPTIONALLY,OPTIONS,OR,' + + 'ORDER,OUT,OUTER,OUTFILE,OWNER,PACK_KEYS,PAGE,PAGE_CHECKSUM,PARSER,' + + 'PARTIAL,PARTITION,PARTITIONING,PARTITIONS,PERSIST,PERSISTENT,PHASE,' + + 'PLUGINS,PLUGIN,PORT,PRECEDES,PREPARE,PRESERVE,PRIMARY,PRIVILEGES,' + + 'PROCEDURE,PROCESS,PROCESSLIST,PROFILE,PROFILES,PROXY,PURGE,QUERY,QUICK,' + + 'RANGE,READ,READS,REBUILD,RECOVER,REFERENCES,REGEXP,RELAY,RELAYLOG,' + + 'RELEASE,RELAY_LOG_FILE,RELAY_LOG_POS,RELOAD,REMOVE,RENAME,REORGANIZE,' + + 'REPAIR,REPEATABLE,REPLACE,REPLICATION,REQUIRE,RESET,RESIGNAL,' + + 'RESTRICT,RESUME,RETURN,RETURNED_SQLSTATE,RETURNS,REVOKE,RLIKE,ROLLBACK,' + + 'ROLLUP,ROTATE,ROUTINE,ROW,ROW_FORMAT,ROWS,SAVEPOINT,SCHEDULE,SCHEMA,' + + 'SCHEMA_NAME,SECOND_MICROSECOND,SECURITY,SELECT,SEPARATOR,SEQUENCE,' + + 'SERIALIZABLE,SERVER,SESSION,SET,SHARE,SHARED,SHOW,SHUTDOWN,SIGNAL,' + + 'SIMPLE,SLAVE,SLOW,SNAPSHOT,SOCKET,SOME,SONAME,SOUNDS,SOURCE,SPATIAL,' + + 'SQL,SQL_BIG_RESULT,SQL_BUFFER_RESULT,SQL_CACHE,SQL_CALC_FOUND_ROWS,' + + 'SQL_NO_CACHE,SQL_SMALL_RESULT,SQL_TSI_DAY,SQL_TSI_HOUR,' + + 'SQL_TSI_MICROSECOND,SQL_TSI_MINUTE,SQL_TSI_MONTH,SQL_TSI_QUARTER,' + + 'SQL_TSI_SECOND,SQL_TSI_WEEK,SQL_TSI_YEAR,SQLEXCEPTION,SQLSTATE,' + + 'SQLWARNING,STACKED,STARTING,START,STARTS,STATS_AUTO_RECALC,' + + 'STATS_PERSISTENT,STATS_SAMPLE_PAGES,STATUS,STOP,STORAGE,STORED,' + + 'STRAIGHT_JOIN,SUBCLASS_ORIGIN,SUBPARTITION,SUBPARTITIONS,SUPER,SUSPEND,' + + 'SWAPS,SWITCHES,TABLE,TABLE_CHECKSUM,TABLE_NAME,TABLES,TABLESPACE,' + + 'TEMPORARY,TERMINATED,THAN,TO,TRADITIONAL,TRAILING,TRANSACTION,' + + 'TRANSACTIONAL,TRIGGER,TRIGGERS,TRUE,TYPE,UNCOMMITTED,UNDO,UNINSTALL,' + + 'UNION,UNIQUE,UNKNOWN,UNLOCK,UPDATE,UPGRADE,USAGE,USE,USE_FRM,' + + 'USING,VALIDATION,VALUE,VALUES,VARIABLES,VIEW,VIRTUAL,WAIT,WARNINGS,' + + 'WHERE,WRAPPER,WRITE,WITH,WITHOUT,WORK,XA,XID,XML,XOR,YEAR_MONTH'; + + // PLSQL keywords + MySQLPLSQLKW: UnicodeString = + 'CASE,CLOSE,EXIT,FETCH,GOTO,HANDLER,ITERATE,IF,LEAVE,LOOP,REPEAT,THEN,' + + 'UNTIL,WHEN,WHILE'; + + MySQLTypes: UnicodeString = + + // Table Engines + 'ARCHIVE,BDB,BERKELEYDB,BLACKHOLE,CSV,EXAMPLE,FEDERATED,HEAP,INNOBASE,' + + 'InnoDB,ISAM,MEMORY,MERGE,MRG_ISAM,MRG_MYISAM,MyISAM,NDB,NDBCLUSTER,' + + + // Index Types + 'BTREE,HASH,' + + + // Column Types + 'bigint,blob,bool,boolean,byte,char,date,datetime,decimal,double,enum,' + + 'float,geometry,geometrycollection,int,integer,linestring,longblob,' + + 'longtext,mediumblob,mediumint,mediumtext,multilinestring,multipoint,' + + 'multipolygon,national,numeric,point,polygon,precision,real,serial,' + + 'signed,smallint,string,text,time,timestamp,tinyblob,tinyint,tinytext,' + + 'unicode,unsigned,varbinary,varchar,year,zerofill,' + + + // Row Formats + 'COMPACT,COMPRESSED,DISK,DYNAMIC,FIXED,REDUNDANT,' + + + // Raid Types + 'RAID0,STRIPED,' + + + // View Algorythm + 'UNDEFINED,TEMPTABLE,' + + + // Charsets + 'armscii8,big5,cp1250,cp1251,cp1256,cp1257,cp850,cp852,' + + 'cp866,cp932,dec8,eucjpms,euckr,gb18030,gb2312,gbk,geostd8,greek,hebrew,' + + 'hp8,keybcs2,koi8r,koi8u,latin1,latin2,latin5,latin7,macce,macroman,sjis,' + + 'swe7,tis620,ucs2,ujis,utf16,utf16le,utf32,utf8,utf8mb4,' + + + '_armscii8,_big5,_cp1250,_cp1251,_cp1256,_cp1257,_cp850,' + + '_cp852,_cp866,_cp932,_dec8,_eucjpms,_euckr,_gb18030,_gb2312,_gbk,' + + '_geostd8,_greek,_hebrew,_hp8,_keybcs2,_koi8r,_koi8u,_latin1,_latin2,' + + '_latin5,_latin7,_macce,_macroman,_sjis,_swe7,_tis620,_ucs2,_ujis,_utf16,' + + '_utf16le,_utf32,_utf8,_utf8mb4,' + + + // Collations + 'armscii8_bin,armscii8_general_ci,ascii_bin,ascii_general_ci,big5_bin,' + + 'big5_chinese_ci,binary,cp1250_bin,cp1250_croatian_ci,cp1250_czech_cs,' + + 'cp1250_general_ci,cp1250_polish_ci,cp1251_bin,cp1251_bulgarian_ci,' + + 'cp1251_general_ci,cp1251_general_cs,cp1251_ukrainian_ci,cp1256_bin,' + + 'cp1256_general_ci,cp1257_bin,cp1257_general_ci,cp1257_lithuanian_ci,' + + 'cp850_bin,cp850_general_ci,cp852_bin,cp852_general_ci,cp866_bin,' + + 'cp866_general_ci,cp932_bin,cp932_japanese_ci,dec8_bin,dec8_swedish_ci,' + + 'eucjpms_bin,eucjpms_japanese_ci,euckr_bin,euckr_korean_ci,gb18030_bin,' + + 'gb18030_chinese_ci,gb18030_unicode_520_ci,gb2312_bin,gb2312_chinese_ci,' + + 'gbk_bin,gbk_chinese_ci,geostd8_bin,geostd8_general_ci,greek_bin,' + + 'greek_general_ci,hebrew_bin,hebrew_general_ci,hp8_bin,hp8_english_ci,' + + 'keybcs2_bin,keybcs2_general_ci,koi8r_bin,koi8r_general_ci,koi8u_bin,' + + 'koi8u_general_ci,latin1_bin,latin1_danish_ci,latin1_general_ci,' + + 'latin1_general_cs,latin1_german1_ci,latin1_german2_ci,latin1_spanish_ci,' + + 'latin1_swedish_ci,latin2_bin,latin2_croatian_ci,latin2_czech_cs,' + + 'latin2_general_ci,latin2_hungarian_ci,latin5_bin,latin5_turkish_ci,' + + 'latin7_bin,latin7_estonian_cs,latin7_general_ci,latin7_general_cs,' + + 'macce_bin,macce_general_ci,macroman_bin,macroman_general_ci,sjis_bin,' + + 'sjis_japanese_ci,swe7_bin,swe7_swedish_ci,tis620_bin,tis620_thai_ci,' + + 'ucs2_bin,ucs2_croatian_ci,ucs2_czech_ci,ucs2_danish_ci,' + + 'ucs2_esperanto_ci,ucs2_estonian_ci,ucs2_general_ci,' + + 'ucs2_general_mysql500_ci,ucs2_german2_ci,ucs2_hungarian_ci,' + + 'ucs2_icelandic_ci,ucs2_latvian_ci,ucs2_lithuanian_ci,ucs2_persian_ci,' + + 'ucs2_polish_ci,ucs2_romanian_ci,ucs2_roman_ci,ucs2_sinhala_ci,' + + 'ucs2_slovak_ci,ucs2_slovenian_ci,ucs2_spanish2_ci,ucs2_spanish_ci,' + + 'ucs2_swedish_ci,ucs2_turkish_ci,ucs2_unicode_520_ci,ucs2_unicode_ci,' + + 'ucs2_vietnamese_ci,ujis_bin,ujis_japanese_ci,utf16le_bin,' + + 'utf16le_general_ci,utf16_bin,utf16_croatian_ci,utf16_czech_ci,' + + 'utf16_danish_ci,utf16_esperanto_ci,utf16_estonian_ci,utf16_general_ci,' + + 'utf16_german2_ci,utf16_hungarian_ci,utf16_icelandic_ci,utf16_latvian_ci,' + + 'utf16_lithuanian_ci,utf16_persian_ci,utf16_polish_ci,utf16_romanian_ci,' + + 'utf16_roman_ci,utf16_sinhala_ci,utf16_slovak_ci,utf16_slovenian_ci,' + + 'utf16_spanish2_ci,utf16_spanish_ci,utf16_swedish_ci,utf16_turkish_ci,' + + 'utf16_unicode_520_ci,utf16_unicode_ci,utf16_vietnamese_ci,utf32_bin,' + + 'utf32_croatian_ci,utf32_czech_ci,utf32_danish_ci,utf32_esperanto_ci,' + + 'utf32_estonian_ci,utf32_general_ci,utf32_german2_ci,utf32_hungarian_ci,' + + 'utf32_icelandic_ci,utf32_latvian_ci,utf32_lithuanian_ci,' + + 'utf32_persian_ci,utf32_polish_ci,utf32_romanian_ci,utf32_roman_ci,' + + 'utf32_sinhala_ci,utf32_slovak_ci,utf32_slovenian_ci,utf32_spanish2_ci,' + + 'utf32_spanish_ci,utf32_swedish_ci,utf32_turkish_ci,utf32_unicode_520_ci,' + + 'utf32_unicode_ci,utf32_vietnamese_ci,utf8mb4_bin,utf8mb4_croatian_ci,' + + 'utf8mb4_czech_ci,utf8mb4_danish_ci,utf8mb4_esperanto_ci,' + + 'utf8mb4_estonian_ci,utf8mb4_general_ci,utf8mb4_german2_ci,' + + 'utf8mb4_hungarian_ci,utf8mb4_icelandic_ci,utf8mb4_latvian_ci,' + + 'utf8mb4_lithuanian_ci,utf8mb4_persian_ci,utf8mb4_polish_ci,' + + 'utf8mb4_romanian_ci,utf8mb4_roman_ci,utf8mb4_sinhala_ci,' + + 'utf8mb4_slovak_ci,utf8mb4_slovenian_ci,utf8mb4_spanish2_ci,' + + 'utf8mb4_spanish_ci,utf8mb4_swedish_ci,utf8mb4_turkish_ci,' + + 'utf8mb4_unicode_520_ci,utf8mb4_unicode_ci,utf8mb4_vietnamese_ci,' + + 'utf8_bin,utf8_croatian_ci,utf8_czech_ci,utf8_danish_ci,' + + 'utf8_esperanto_ci,utf8_estonian_ci,utf8_general_ci,' + + 'utf8_general_mysql500_ci,utf8_german2_ci,utf8_hungarian_ci,' + + 'utf8_icelandic_ci,utf8_latvian_ci,utf8_lithuanian_ci,utf8_persian_ci,' + + 'utf8_polish_ci,utf8_romanian_ci,utf8_roman_ci,utf8_sinhala_ci,' + + 'utf8_slovak_ci,utf8_slovenian_ci,utf8_spanish2_ci,utf8_spanish_ci,' + + 'utf8_swedish_ci,utf8_turkish_ci,utf8_unicode_520_ci,utf8_unicode_ci,' + + 'utf8_vietnamese_ci'; + + // functions + MySQLFunctions: UnicodeString = + 'ABS,ACOS,ADDDATE,ADDTIME,AES_DECRYPT,AES_ENCRYPT,ANY_VALUE,AREA,' + + 'ASBINARY,ASCII,ASIN,ASTEXT,ASWKBASWKT,ASYMMETRIC_DECRYPT,' + + 'ASYMMETRIC_DERIVE,ASYMMETRIC_ENCRYPT,ASYMMETRIC_SIGN,ASYMMETRIC_VERIFY,' + + 'ATAN,ATAN2,AVG,BIN,BIT_AND,BIT_COUNT,BIT_LENGTH,BIT_OR,BIT_XOR,BUFFER,' + + 'CAST,CEIL,CEILING,CENTROID,CHAR_LENGTH,CHARACTER_LENGTH,COALESCE,' + + 'COERCIBILITY,COMPRESS,CONCAT,CONCAT_WS,CONNECTION_ID,CONV,CONVERT_TZ,' + + 'CONVEXHULL,COS,COT,COUNT,CRC32,CREATE_ASYMMETRIC_PRIV_KEY,' + + 'CREATE_ASYMMETRIC_PUB_KEY,CREATE_DH_PARAMETERS,CREATE_DIGEST,CROSSES,' + + 'CURDATE,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,' + + 'CURTIME,DATE_ADD,DATE_FORMAT,DATE_SUB,DATEDIFF,DAY,DAYNAME,DAYOFMONTH,' + + 'DAYOFWEEK,DAYOFYEAR,DECODE,DEGREES,DES_DECRYPT,DES_ENCRYPT,DIMENSION,' + + 'DISJOINT,DISTANCE,ELT,ENCODE,ENCRYPT,ENDPOINT,ENVELOPE,EQUALS,EXP,' + + 'EXPORT_SET,EXTERIORRING,EXTRACT,EXTRACTVALUE,FIELD,FIND_IN_SET,FLOOR,' + + 'FORMAT,FOUND_ROWS,FROM_BASE64,FROM_DAYS,FROM_UNIXTIME,GEOMCOLLFROMTEXT,' + + 'GEOMCOLLFROMWKB,GEOMETRYCOLLECTIONFROMTEXT,GEOMETRYCOLLECTIONFROMWKB,' + + 'GEOMETRYFROMTEXT,GEOMETRYFROMWKB,GEOMETRYN,GEOMETRYTYPE,GEOMFROMTEXT,' + + 'GEOMFROMWKB,GET_FORMAT,GET_LOCK,GLENGTH,GREATEST,GROUP_CONCAT,' + + 'GTID_SUBSET,GTID_SUBTRACT,HEX,HOUR,IFNULL,INET_ATON,INET_NTOA,' + + 'INET6_ATON,INET6_NTOA,INSTR,INTERIORRINGN,INTERSECTS,INTERVAL,' + + 'IS_FREE_LOCK,IS_IPV4,IS_IPV4_COMPAT,IS_IPV4_MAPPED,IS_IPV6,IS_USED_LOCK,' + + 'ISCLOSED,ISEMPTY,ISNULL,ISSIMPLE,JSON_APPEND,JSON_ARRAY,' + + 'JSON_ARRAY_APPEND,JSON_ARRAY_INSERT,JSON_CONTAINS,JSON_CONTAINS_PATH,' + + 'JSON_DEPTH,JSON_EXTRACT,JSON_INSERT,JSON_KEYS,JSON_LENGTH,JSON_MERGE,' + + 'JSON_OBJECT,JSON_QUOTE,JSON_REMOVE,JSON_REPLACE,JSON_SEARCH,JSON_SET,' + + 'JSON_TYPE,JSON_UNQUOTE,JSON_VALID,LAST_DAY,LAST_INSERT_ID,LCASE,LEAST,' + + 'LEFT,LENGTH,LINEFROMTEXT,LINEFROMWKB,LINESTRINGFROMTEXT,' + + 'LINESTRINGFROMWKB,LN,LOAD_FILE,LOCALTI,LOCALTIME,LOCALTIMESTAMP,LOCATE,' + + 'LOG,LOG10,LOG2,LOWER,LPAD,LTRIM,MAKE_SET,MAKEDATE,MAKETIME,' + + 'MASTER_POS_WAIT,MAX,MBRCONTAINS,MBRCOVEREDBY,MBRCOVERS,MBRDISJOINT,' + + 'MBREQUAL,MBREQUALS,MBRINTERSECTS,MBROVERLAPS,MBRTOUCHES,MBRWITHIN,MD5,' + + 'MICROSECOND,MID,MIN,MINUTE,MLINEFROMTEXT,MLINEFROMWKB,MONTH,' + + 'MONTHNAME,MPOINTFROMTEXT,MPOINTFROMWKB,MPOLYFROMTEXT,MPOLYFROMWKB,' + + 'MULTILINESTRINGFROMTEXT,MULTILINESTRINGFROMWKB,MULTIPOINTFROMTEXT,' + + 'MULTIPOINTFROMWKB,MULTIPOLYGONFROMTEXT,MULTIPOLYGONFROMWKB,NAME_CONST,' + + 'NOW,NULLIF,NUMGEOMETRIES,NUMINTERIORRINGS,NUMPOINTS,OCT,OCTET_LENGTH,' + + 'OLD_PASSWORD,ORD,OVERLAPS,PASSWORD,PERIOD_ADD,PERIOD_DIFF,PI,' + + 'POINTFROMTEXT,POINTFROMWKB,POINTN,POLYFROMTEXT,POLYFROMWKB,' + + 'POLYGONFROMTEXT,POLYGONFROMWKB,POSITION,POW,POWER,QUARTER,QUOTE,RADIANS,' + + 'RAND,RANDOM_BYTES,RELEASE_ALL_LOCKS,RELEASE_LOCK,REVERSE,RIGHT,ROUND,' + + 'ROW_COUNT,RPAD,RTRIM,SEC_TO_TIME,SECOND,SESSION_USER,SHA,SHA1,SHA2,SIGN,' + + 'SIN,SLEEP,SOUNDEX,SPACE,SQRT,SRID,ST_AREA,ST_ASBINARY,ST_ASGEOJSON,' + + 'ST_ASTEXT,ST_ASWKB,ST_ASWKT,ST_BUFFER,ST_BUFFER_STRATEGY,ST_CENTROID,' + + 'ST_CONTAINS,ST_CONVEXHULL,ST_CROSSES,ST_DIFFERENCE,ST_DIMENSION,' + + 'ST_DISJOINT,ST_DISTANCE,ST_DISTANCE_SPHERE,ST_ENDPOINT,ST_ENVELOPE,' + + 'ST_EQUALS,ST_EXTERIORRING,ST_GEOHASH,ST_GEOMCOLLFROMTEXT,' + + 'ST_GEOMCOLLFROMTXT,ST_GEOMCOLLFROMWKB,ST_GEOMETRYCOLLECTIONFROMTEXT,' + + 'ST_GEOMETRYCOLLECTIONFROMWKB,ST_GEOMETRYFROMTEXT,ST_GEOMETRYFROMWKB,' + + 'ST_GEOMETRYN,ST_GEOMETRYTYPE,ST_GEOMFROMGEOJSON,ST_GEOMFROMTEXT,' + + 'ST_GEOMFROMWKB,ST_INTERIORRINGN,ST_INTERSECTION,ST_INTERSECTS,' + + 'ST_ISCLOSED,ST_ISEMPTY,ST_ISSIMPLE,ST_ISVALID,ST_LATFROMGEOHASH,' + + 'ST_LENGTH,ST_LINEFROMTEXT,ST_LINEFROMWKB,ST_LINESTRINGFROMTEXT,' + + 'ST_LINESTRINGFROMWKB,ST_LONGFROMGEOHASH,ST_MAKEENVELOPE,' + + 'ST_MLINEFROMTEXT,ST_MLINEFROMWKB,ST_MPOINTFROMTEXT,ST_MPOINTFROMWKB,' + + 'ST_MPOLYFROMTEXT,ST_MPOLYFROMWKB,ST_MULTILINESTRINGFROMTEXT,' + + 'ST_MULTILINESTRINGFROMWKB,ST_MULTIPOINTFROMTEXT,ST_MULTIPOINTFROMWKB,' + + 'ST_MULTIPOLYGONFROMTEXT,ST_MULTIPOLYGONFROMWKB,ST_NUMGEOMETRIES,' + + 'ST_NUMINTERIORRING,ST_NUMINTERIORRINGS,ST_NUMPOINTS,ST_OVERLAPS,' + + 'ST_POINTFROMGEOHASH,ST_POINTFROMTEXT,ST_POINTFROMWKB,ST_POINTN,' + + 'ST_POLYFROMTEXT,ST_POLYFROMWKB,ST_POLYGONFROMTEXT,ST_POLYGONFROMWKB,' + + 'ST_SIMPLIFY,ST_SRID,ST_STARTPOINT,ST_SYMDIFFERENCE,ST_TOUCHES,ST_UNION,' + + 'ST_VALIDATE,ST_WITHIN,ST_X,ST_Y,STARTPOINT,STD,STDDEV,STDDEV_POP,' + + 'STDDEV_SAMP,STR_TO_DATE,STRCMP,SUBDATE,SUBSTR,SUBSTRING,SUBSTRING_INDEX,' + + 'SUBTIME,SUM,SYSDATE,SYSTEM_USER,TAN,TIME_FORMAT,TIME_TO_SEC,TIMEDIFF,' + + 'TIMESTAMPADD,TIMESTAMPDIFF,TO_BASE64,TO_DAYS,TO_SECONDS,TOUCHES,TRIM,' + + 'TRUNCATE,UCASE,UNCOMPRESS,UNCOMPRESSED_LENGTH,UNHEX,UNIX_TIMESTAMP,' + + 'UPDATEXML,UPPER,USER,UTC_DATE,UTC_TIME,UTC_TIMESTAMP,UUID,UUID_SHORT,' + + 'VALIDATE_PASSWORD_STRENGTH,VAR_POP,VAR_SAMP,VARIANCE,VERSION,' + + 'WAIT_FOR_EXECUTED_GTID_SET,WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS,WEEK,' + + 'WEEKDAY,WEEKOFYEAR,WEIGHT_STRING,WITHIN,X,Y,YEARWEEK'; + +//---Ingres--------------------------------------------------------------------- + // keywords + IngresKW: UnicodeString = + 'ABORT,ACTIVATE,ADD,ADDFORM,AFTER,AGGREGATE,ALL,ALTER,AND,APPEND,ARRAY,' + + 'AS,ASC,AT,AUDIT_LOG,AUTHORIZATION,AUTOCOMMIT,AVGU,BEFORE,BEGIN,BETWEEN,' + + 'BREAKDISPLAY,BY,BYREF,CACHE,CALL,CALLFRAME,CALLPROC,CASCADE,CHECK,CLEAR,' + + 'CLEARROW,CLOSE,COLUMN,COMMAND,COMMENT,COMMIT,CONNECT,CONSTRAINT,' + + 'CONTINUE,COPY,COUNTU,CPUFACTOR,CREATE,CURRENT,CURRENT_USER,CURSOR,DATA,' + + 'DATAHANDLER,DATE_FORMAT,DBEVENT,DDL_CONCURRENCY,DEADLOCK,DECLARE,' + + 'DEFAULT,DEFERRED,DEFINE,DELETE,DELETEROW,DESC,DESCRIBE,DESCRIPTOR,' + + 'DESTROY,DIRECT,DISABLE,DISCONNECT,DISPLAY,DISTINCT,DISTRIBUTE,DO,DOWN,' + + 'DROP,ELSE,ELSEIF,ENABLE,END,ENDDATA,ENDDISPLAY,ENDFORMS,ENDIF,ENDLOOP,' + + 'ENDRETRIEVE,ENDSELECT,ENDWHILE,ERROR,ESCAPE,EXCLUDE,EXCLUDING,EXEC,' + + 'EXECUTE,EXISTS,EXIT,FETCH,FIELD,FINALIZE,FOR,FOREIGN,FORMDATA,FORMINIT,' + + 'FORMS,FROM,FULL,GET,GETFORM,GETOPER,GETROW,GLOBAL,GOTO,GRANT,GRANTED,' + + 'HAVING,HELP,HELP_FORMS,HELP_FRS,HELPFILE,IDENTIFIED,IF,IIMESSAGE,' + + 'IIPRINTF,IIPROMPT,IISTATEMENT,IMMEDIATE,IMPORT,IN,INCLUDE,INDEX,' + + 'INDICATOR,INGRES,INITIALIZE,INITTABLE,INNER,INQUIRE_EQUEL,INQUIRE_FORMS,' + + 'INQUIRE_FRS,INQUIRE_INGRES,INSERT,INSERTROW,INSTALLATION,INTEGRITY,INTO,' + + 'IO_TRACE,IS,J_FREESZ1,J_FREESZ2,J_FREESZ3,J_FREESZ4,J_SORTBUFSZ,' + + 'JCPUFACTOR,JOIN,JOINOP,JOURNALING,KEY,LEVEL,LIKE,LINK,LOADTABLE,LOCAL,' + + 'LOCATION,LOCK_TRACE,LOG_TRACE,LOGDBEVENTS,LOGGING,MAXCOST,MAXCPU,' + + 'MAXPAGE,MENUITEM,MESSAGE,MODE,MODIFY,MODULE,MONEY_FORMAT,MONEY_PREC,' + + 'MOVE,NATURAL,NEXT,NODEADLOCK,NOECHO,NOIO_TRACE,NOJIONOP,NOJOURNALING,' + + 'NOLOCK_TRACE,NOLOG_TRACE,NOLOGDBEVENTS,NOLOGGING,NOMAXCOST,NOMAXCPU,' + + 'NOMAXIO,NOMAXPAGE,NOMAXQUERY,NOMAXROW,NOOPTIMIZEONLY,NOPRINTDBEVENTS,' + + 'NOPRINTQRY,NOPRINTRULES,NOQEP,NORULES,NOSQL,NOSTATISTICS,NOT,NOTRACE,' + + 'NULL,OF,ON,ONLY,OPEN,OPTIMIZEONLY,OPTION,OR,ORDER,OUT,PARAM,PERMIT,' + + 'PREPARE,PRESERVE,PRIMARY,PRINT,PRINTDBEVENTS,PRINTQRY,PRINTSCREEN,' + + 'PRIVILEGES,PROCEDURE,PROMPT,PUBLIC,PUT,PUTFORM,PUTOPER,PUTROW,QBUFSIZE,' + + 'QEP,QRY,QUALIFICATION,QUERY_SIZE,RAISE,RANGE,READONLY,REDISPLAY,' + + 'REFERENCES,REFERENCING,REGISTER,RELOCATE,REMOVE,RENAME,REPEAT,REPEATED,' + + 'REPLACE,REPLICATE,RESTRICT,RESULT_STRUCTURE,RESUME,RET_INTO,RETRIEVE,' + + 'RETURN,RETURNING,REVOKE,ROLLBACK,ROWS,RULE,RUN,SAVE,SAVEPOINT,SCHEMA,' + + 'SCREEN,SCROLL,SCROLLDOWN,SCROLLUP,SECTION,SECURITY_ALARM,SECURITY_AUDIT,' + + 'SELECT,SESSION,SET,SET_4GL,SET_EQUAL,SET_FORMS,SET_FRS,SET_INGRES,' + + 'SET_SQL,SHORT_REMARK,SLEEP,SOME,SORT,SORTBUFSIZE,SQL,STATISTICS,STOP,' + + 'SUBMENU,SUMU,SYNONYM,SYSTEM,TABLE,TABLEDATA,TEWMPORARY,THEN,TO,TRACE,' + + 'TRANSACTION,TYPE,UNION,UNIQUE,UNLOADTABLE,UNTIL,UP,UPDATE,USER,USING,' + + 'VALIDATE,VALIDROW,VALUES,VIEW,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK'; + + // types + IngresTypes: UnicodeString = + 'BYTE,C,CHAR,CHARACTER,DATE,DECIMAL,FLOAT,FLOAT4,FLOAT8,INTEGER,INTEGER1,' + + 'INTEGER2,INTEGER4,LONG,MONEY,OBJECT_KEY,SECURITY_LABEL,SHORT,SMALLINT,' + + 'TABLE_KEY,TEXT,VARCHAR,VARYING'; + + // functions + IngresFunctions: UnicodeString = + '_BINTIM,_CPU_MS,_DATE,_DIO_CNT,_ET_SEC,_PFAULT_CNT,_TIME,_VERSION,ABS,' + + 'ANY,ATAN,AUTOCOMMIT_STATE,AVG,BIOCNT,CHAREXTRACT,COLLATION,CONCAT,' + + 'CONNECT_TIME_LIMIT,COS,COUNT,CREATE_PROCEDURE,CREATE_TABLE,DATABASE,' + + 'DATE_GMT,DATE_PART,DATE_TRUNC,DB_ADMIN,DB_DELIMITED_CASE,DB_NAME_CASE,' + + 'DBA,DBMS_BIO,DBMS_CPU,DBMS_DIO,DBMSINFO,DOW,EXP,FLATTEN_AGGREGATE,' + + 'FLATTEN_NONE,FLATTEN_OPTIMIZE,FLATTEN_SINGLETON,GROUP,HEX,' + + 'IDLE_TIME_LIMIT,IFNULL,INITIAL_USER,INQUIRE_SQL,INT1,INT2,INT4,INTERVAL,' + + 'LANGUAGE,LEFT,LENGTH,LOCATE,LOCKMODE,LOG,LONG_BYTE,LONG_VARCHAR,' + + 'LOWERCASE,MAX,MAXCONNECT,MAXIDLE,MAXIO,MAXQUERY,MAXROW,MIN,MOD,NOTRIM,' + + 'ON_ERROR_STATE,PAD,QUERY_IO_LIMIT,QUERY_LANGUAGE,QUERY_ROW_LIMIT,RIGHT,' + + 'ROLE,SECURITY_AUDIT_LOG,SECURITY_AUDIT_STATE,SECURITY_PRIV,' + + 'SELECT_SYSCAT,SERVER_CLASS,SESSION_ID,SESSION_PRIORITY,' + + 'SESSION_PRIORITY_LIMIT,SESSION_PRIV,SESSION_SECLABEL,SESSION_USER,SHIFT,' + + 'SIN,SIZE,SQRT,SQUEEZE,SUM,SYSTEM_USER,TABLE_STATISTICS,TERMINAL,' + + 'TRANSACTION_STATE,TRIM,UPDATE_ROWCNT,UPDATE_SYSCAT,UPPERCASE,USERNAME,' + + 'VARBYTE'; + +//---Nexus---------------------------------------------------------------------- + // keywords + NexusKW: UnicodeString = + 'ABSOLUTE,AFTER,ALTER,ANY,ASC,ASSERT,ATOMIC,' + + 'ADD,ALL,AND,AS,ASSEMBLY,AUTHORIZATION,BEFORE,' + + 'BETWEEN,BINARY,BLOCK,BY,BEGIN,' + + 'BLOCKSIZE,CALL,CASCADE,CAST,,' + + 'CHARACTERS,CLR,CLOSE,CODEPAGE,COLLATION,COMMIT,CONTAINS,' + + 'CROSS,CALLED,CASE,CATCH,' + + 'CHECK,COALESCE,COLLATE,COLUMN,CONSTRAINT,' + + 'CREATE,CURSOR,DATA,DECLARE,' + + 'DELETE,DESC,DETERMINISTIC,DO,DROP,DAY,DEFAULT,DELETING,' + + 'DESCRIPTION,DISTINCT,EACH,ELSEIF,ENCRYPT,END,EQUIVALENT,' + + 'ESCAPE,EXECUTE,EXISTS,ELSE,EMPTY,ENCRYPTION,ENGINE,' + + 'EXCEPT,EXTERNAL,FALSE,FETCH,FETCH_STATUS,FOR,FROM,FUNCTION,FIRST,FOREIGN,' + + 'FULL,HAVING,HOUR,GLOBAL,GROW,GROUP,GROWSIZE,IDENTITY,IGNORE,' + + 'IMMEDIATE,IN,INITIAL,INNER,INPUT,INSERTING,INTERVAL,IS,IF,INDEX,' + + 'INITIALSIZE,INOUT,INSERT,INTERSECT,INTO,ITERATE,JOIN,' + + 'KANA,KEY,LANGUAGE,LEAVE,LIKE,LOCALE,' + + 'LARGE,LAST,LEFT,LOCAL,MATCH,' + + 'MINUTE,MODIFIES,MONTH,NAME,NATURAL,NEXT,NONSPACE,' + + 'NULLIF,NATIONAL,' + + 'NEW,NO,NORESTRICT,NOT,NULL,NULLS,OBJECT,OCTETS,OF,ON,OUT,OCTET_LENGTH,' + + 'ODD,OLD,OPEN,OR,ORDER,OUTER,PARTIAL,PERCENT,PRECISION,' + + 'PRIOR,PROCEDURE,PASSWORDS,PRIMARY,REFERENCES,RELATIVE,REMOVE,RESTRICT,' + + 'RETURNS,ROLLBACK,ROUTINE,READS,' + + 'REFERENCING,REPEAT,RETURN,RIGHT,ROW,SECOND,' + + 'SERIALIZABLE,SET,SIMPLE,SNAPSHOT,SORT,' + + 'STRING,SELECT,SIGNAL,' + + 'SOME,SQL,START,STORAGE,SYMBOLS,TABLE,' + + 'TOP,TRANSACTION,TRY,THEN,' + + 'TO,TRIGGER,TRUE,TYPE,UNION,UNKNOWN,UPDATE,' + + 'UNIQUE,UNTIL,UPDATING,USE,VALUES,VARYING,' + + 'VIEW,WHEN,WHILE,WITH,WORK,WHERE,WIDTH,YEAR'; + + // functions + NexusFunctions: UnicodeString = + 'ABS,ATAN,ATAN2,ATN2,AVG,BOTH,BROUND,CEIL,CEILING,CHAR_LENGTH,CHARACTER_LENGTH,'+ + 'CHR,COS,COUNT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,ERROR_MESSAGE,EXP,EXTRACT,'+ + 'FLOOR,LASTAUTOINC,LEADING,LIST,LN,LOCALTIME,LOCALTIMESTAMP,LOWER,MAX,MED,MIN,MOD,NEWGUID,OCTECT,'+ + 'OCTECT_LENGTH,ORD,PI,POSITION,POWER,RAND,ROUND,ROWSAFFECTED,ROWSREAD,SESSION_USER,SIN,SQRT,STD,'+ + 'SUBSTRING,SUM,SYSTEM_ROW#,TOSTRING,TOSTRINGLEN,TRAILING,TRIM,UPPER,USER,USING'; + + // types + NexusTypes: UnicodeString = + 'CHARACTER,CHAR,NULLSTRING,SHORTSTRING,SINGLECHAR,VARCHAR,' + + 'CLOB,TEXT,NSINGLECHAR,NCHAR,' + + 'NVARCHAR,NCLOB,BLOB,IMAGE,NUMERIC,DECIMAL,DEC,BYTE,TINYINT,SHORTINT,SMALLINT,INTEGER,INT,' + + 'AUTOINC,BIGINT,LARGEINT,WORD,DWORD,FLOAT,REAL,DOUBLE,EXTENDED,MONEY,' + + 'BOOLEAN,BOOL,DATE,TIME,TIMESTAMP,DATETIME,GUID,BYTEARRAY,RECREV'; + +//---Informix------------------------------------------------------------------- + // keywords + InformixKW: Unicodestring = + 'ABSOLUTE,ACCESS,ACCESS_METHOD,ACTIVE,ADD,AFTER,AGGREGATE,ALIGNMENT,ALL,' + + 'ALL_ROWS,ALLOCATE,ALTER,AND,ANSI,ANY,APPEND,AS,ASC,AT,ATTACH,AUDIT,' + + 'AUTHORIZATION,AUTO,AUTOFREE,AVOID_EXECUTE,AVOID_SUBQF,BEFORE,BEGIN,' + + 'BETWEEN,BINARY,BOTH,BUFFERED,BUILTIN,BY,CACHE,CANNOTHASH,CASCADE,CHECK,' + + 'CLASS,CLIENT,CLOSE,CLUSTER,CLUSTERSIZE,COARSE,COBOL,CODESET,COLLATION,' + + 'COLLECTION,COLUMN,COMMIT,COMMITTED,COMMUTATOR,CONCURRENT,CONNECT,' + + 'CONNECTION,CONST,CONSTRAINT,CONSTRAINTS,CONSTRUCTOR,COPY,COSTFUNC,' + + 'CRCOLS,CREATE,CROSS,CURRENT_ROLE,CURSOR,CYCLE,DATABASE,DATAFILES,' + + 'DATASKIP,DBA,DBDATE,DBPASSWORD,DEALLOCATE,DEBUG,DEC_T,DECLARE,DEFAULT,' + + 'DEFERRED,DEFERRED_PREPARE,DELAY,DELETE,DELIMITER,DELUXE,DEREF,DESC,' + + 'DESCRIBE,DESCRIPTOR,DETACH,DIAGNOSTICS,DIRECTIVES,DIRTY,DISABLED,' + + 'DISCONNECT,DISTINCT,DISTRIBUTEBINARY,DISTRIBUTESREFERENCES,' + + 'DISTRIBUTIONS,DOCUMENT,DOMAIN,DONOTDISTRIBUTE,DORMANT,DROP,DTIME_T,EACH,' + + 'ELIF,ELSE,ENABLED,ENCRYPTION,END,ENUM,ENVIRONMENT,ESCAPE,EXCLUSIVE,EXEC,' + + 'EXECUTE,EXECUTEANYWHERE,EXISTS,EXPLAIN,EXPLICIT,EXPRESS,EXPRESSION,' + + 'EXTENT,EXTERNAL,FALSE,FAR,FETCH,FILE,FILLFACTOR,FILTERING,FIRST,' + + 'FIRST_ROWS,FIXCHAR,FIXED,FLUSH,FOREIGN,FORMAT,FORTRAN,FOUND,FRACTION,' + + 'FRAGMENT,FREE,FROM,FULL,FUNCTION,GENERAL,GET,GK,GLOBAL,GO,GOTO,GRANT,' + + 'GROUP,HANDLESNULLS,HASH,HAVING,HIGH,HINT,HOLD,HOUR,HYBRID,IFX_INT8_T,' + + 'IFX_LO_CREATE_SPEC_T,IFX_LO_STAT_T,IMMEDIATE,IMPLICIT,IN,INACTIVE,' + + 'INCREMENT,INDEX,INDEXES,INDICATOR,INFORMIX,INIT,INLINE,INNER,INOUT,' + + 'INSERT,INSTEAD,INTEG,INTERNAL,INTERNALLENGTH,INTO,INTRVL_T,IS,' + + 'ISCANONICAL,ISOLATION,ITEM,ITERATOR,JOIN,KEEP,KEY,LABELEQ,LABELGE,' + + 'LABELGLB,LABELGT,LABELLE,LABELLT,LABELLUB,LABELTOSTRING,LANGUAGE,LAST,' + + 'LEADING,LEFT,LEVEL,LIKE,LIMIT,LISTING,LOAD,LOC_T,LOCAL,LOCATOR,LOCK,' + + 'LOCKS,LOG,LONG,LOW,MATCHES,MAXERRORS,MAXLEN,MAXVALUE,MEDIAN,MEDIUM,' + + 'MEMORY_RESIDENT,MIDDLE,MINUTE,MINVALUE,MODE,MODERATE,MODIFY,MODULE,' + + 'MOUNTING,NAME,NEGATOR,NEW,NEXT,NO,NOCACHE,NOCYCLE,NOMAXVALUE,NOMIGRATE,' + + 'NOMINVALUE,NON_RESIDENT,NONE,NOORDER,NORMAL,NOT,NOTEMPLATEARG,NULL,' + + 'OF,OFF,OLD,ONLINE,ONLY,OPAQUE,OPCLASS,OPEN,OPERATIONAL,OPTCOMPIND,' + + 'OPTICAL,OPTIMIZATION,OPTION,OR,ORDER,OUT,OUTER,OUTPUT,PAGE,' + + 'PARALLELIZABLE,PARAMETER,PARTITION,PASCAL,PASSEDBYVALUE,PASSWORD,' + + 'PDQPRIORITY,PERCALL_COST,PLI,PLOAD,PREPARE,PREVIOUS,PRIMARY,PRIOR,' + + 'PRIVATE,PRIVILEGES,PROCEDURE,PUBLIC,PUT,RAW,READ,RECORDEND,REF,' + + 'REFERENCES,REFERENCING,REGISTER,REJECTFILE,RELATIVE,RELEASE,REMAINDER,' + + 'RENAME,REOPTIMIZATION,REPEATABLE,REPLICATION,RESERVE,RESOLUTION,' + + 'RESOURCE,RESTART,RESTRICT,RESUME,RETAIN,RETURNING,RETURNS,REUSE,REVOKE,' + + 'RIGHT,ROBIN,ROLE,ROLLBACK,ROLLFORWARD,ROUTINE,ROWID,ROWIDS,ROWS,SAMEAS,' + + 'SAMPLES,SAVE,SCHEDULE,SCHEMA,SCRATCH,SCROLL,SECOND,SECONDARY,SECTION,' + + 'SELCONST,SELECT,SELFUNC,SEQUENCE,SERIALIZABLE,SERVERUUID,SESSION,SHARE,' + + 'SHORT,SIGNED,SIZE,SKALL,SKINHIBIT,SKIP,SKSHOW,SOME,SPECIFIC,SQL,SQLCODE,' + + 'SQLCONTEXT,SQLERROR,SQLSTATE,SQLWARNING,STABILITY,STACK,STANDARD,START,' + + 'STATIC,STATISTICS,STEP,STOP,STORAGE,STRATEGIES,STRING,STRINGTOLABEL,' + + 'STRUCT,STYLE,SUPPORT,SYNC,SYNONYM,TABLE,TEMP,TEMPLATE,TEST,TIME,TIMEOUT,' + + 'TO,TRAILING,TRANSACTION,TRIGGER,TRIGGERS,TRUE,TRUNCATE,TYPE,TYPEDEF,' + + 'TYPEID,TYPENAME,TYPEOF,UNCOMMITTED,UNDER,UNION,UNIQUE,UNKNOWN,UNLOAD,' + + 'UNLOCK,UNSIGNED,UPDATE,USAGE,USE_SUBQF,USING,VALUE,VALUES,VAR,VARIABLE,' + + 'VARIANT,VIEW,VIOLATIONS,VOID,VOLATILE,WAIT,WARNING,WHERE,WITH,WITHOUT,' + + 'WORK,WRITE,XADATASOURCE,XID,XLOAD,XUNLOAD'; + + // types + InformixTypes: UnicodeString = + 'BLOB,BOOLEAN,BYTE,CHAR,CHARACTER,VARYING,CLOB,DATE,DATETIME,DEC,DECIMAL,' + + 'DOUBLE,PRECISION,FLOAT,INT,INT8,INTEGER,INTERVAL,LIST,LVARCHAR,MONEY,' + + 'MULTISET,NCHAR,NUMERIC,NVARCHAR,REAL,ROW,SERIAL,SERIAL8,SET,SMALLFLOAT,' + + 'SMALLINT,TEXT,VARCHAR'; + + // PLSQL keywords + InformixPLSQLKW: UnicodeString = + 'CALL,CONTINUE,DEFINE,ERROR,EXCEPTION,EXIT,FOR,FOREACH,IF,LET,ON,RAISE,' + + 'RETURN,SYSTEM,TRACE,WHENEVER,WHILE'; + + // functions + InformixFunctions: UnicodeString = + 'ABS,ACOS,ASIN,ATAN,ATAN2,AVG,CARDINALITY,CASE,CAST,CHARACTER_LENGTH,' + + 'CHAR_LENGTH,COS,COUNT,CURRENT,DAY,DBINFO,DBSERVERNAME,DECODE,' + + 'DECRYPT_CHAR,DECRYPT_BINARY,DEFAULT_ROLE,ENCRYPT_AES,ENCRYPT_TDES,EXP,' + + 'EXTEND,FILETOBLOB,FILETOCLOB,GETHINT,HEX,IFX_ALLOW_NEWLINE,' + + 'IFX_REPLACE_MODULE,INITCAP,LENGTH,LOCOPY,LOGN,LOG10,LOTOFILE,LOWER,LPAD,' + + 'MAX,MDY,MIN,MOD,MONTH,NVL,OCTET_LENGTH,POW,RANGE,REPLACE,ROOT,ROUND,' + + 'RPAD,SIN,SITENAME,SQRT,STDEV,SUBSTR,SUBSTRING,SUM,TAN,THEN,TO_CHAR,TO_DATE,' + + 'TODAY,TRIM,TRUNC,UNITS,UPPER,USER,VARIANCE,WEEKDAY,WHEN,YEAR'; + +function TSynSQLSyn.HashKey(Str: PWideChar): Integer; +var + FoundDoubleMinus: Boolean; + + function GetOrd: Integer; + begin + case Str^ of + '_': Result := 1; + 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); + 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); + '@': + if FDialect in [sqlMSSQL7, sqlMSSQL2K] then + Result := 24 + else + Result := 0; + else Result := 0; + end; + end; + +begin + Result := 0; + while IsIdentChar(Str^) do + begin + FoundDoubleMinus := (Str^ = '-') and ((Str + 1)^ = '-'); + if FoundDoubleMinus then Break; +{$IFOPT Q-} + Result := 2 * Result + GetOrd; +{$ELSE} + Result := (2 * Result + GetOrd) and $FFFFFF; +{$ENDIF} + Inc(Str); + end; + Result := Result and $FF; // 255 + if Assigned(FToIdent) then + FStringLen := Str - FToIdent + else + FStringLen := 0; +end; + +function TSynSQLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Entry: TSynHashEntry; +begin + FToIdent := MayBe; + Entry := FKeywords[HashKey(MayBe)]; + while Assigned(Entry) do + begin + if Entry.KeywordLen > FStringLen then + Break + else if Entry.KeywordLen = FStringLen then + if IsCurrentToken(Entry.Keyword) then + begin + Result := TtkTokenKind(Entry.Kind); + Exit; + end; + Entry := Entry.Next; + end; + {$IFDEF USE_TABLE_DICTIONARY} + if FTableDict.ContainsKey(SynWideLowerCase(Copy(StrPas(FToIdent), 1, FStringLen))) then + Result := tkTableName + else + {$ENDIF} + Result := tkIdentifier; +end; + +constructor TSynSQLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FKeywords := TSynHashEntryList.Create; + + FProcNames := TUnicodeStringList.Create; + TUnicodeStringList(FProcNames).OnChange := ProcNamesChanged; + + FTableNames := TUnicodeStringList.Create; + TUnicodeStringList(FTableNames).OnChange := TableNamesChanged; + {$IFDEF USE_TABLE_DICTIONARY} + FTableDict := TDictionary.Create; + {$ENDIF} + + FFunctionNames := TunicodeStringList.Create; + TUnicodeStringList(FFunctionNames).OnChange := FunctionNamesChanged; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FConditionalCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrConditionalComment, SYNS_FriendlyAttrConditionalComment); + FConditionalCommentAttri.Style := [fsItalic]; + AddAttribute(FConditionalCommentAttri); + FConsoleOutputAttri := TSynHighlighterAttributes.Create(SYNS_AttrConsoleOutput, SYNS_FriendlyAttrConsoleOutput); + FConsoleOutputAttri.Style := [fsBold, fsUnderline]; + AddAttribute(FConsoleOutputAttri); + FDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + FDataTypeAttri.Style := [fsBold]; + AddAttribute(FDataTypeAttri); + FDefaultPackageAttri := + TSynHighlighterAttributes.Create(SYNS_AttrDefaultPackage, SYNS_FriendlyAttrDefaultPackage); + FDefaultPackageAttri.Style := [fsBold]; + AddAttribute(FDefaultPackageAttri); + FDelimitedIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrDelimitedIdentifier, SYNS_FriendlyAttrDelimitedIdentifier); + AddAttribute(FDelimitedIdentifierAttri); + FExceptionAttri := TSynHighlighterAttributes.Create(SYNS_AttrException, SYNS_FriendlyAttrException); + FExceptionAttri.Style := [fsItalic]; + AddAttribute(FExceptionAttri); + FFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction); + FFunctionAttri.Style := [fsBold]; + AddAttribute(FFunctionAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FPLSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrPLSQL, SYNS_FriendlyAttrPLSQL); + FPLSQLAttri.Style := [fsBold]; + AddAttribute(FPLSQLAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FSQLPlusAttri:=TSynHighlighterAttributes.Create(SYNS_AttrSQLPlus, SYNS_FriendlyAttrSQLPlus); + FSQLPlusAttri.Style := [fsBold]; + AddAttribute(FSQLPlusAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_Attrstring, SYNS_FriendlyAttrstring); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FProcNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrProcName, SYNS_FriendlyAttrProcName); + AddAttribute(FProcNameAttri); + FTableNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrTableName, SYNS_FriendlyAttrTableName); + AddAttribute(FTableNameAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(FVariableAttri); + SetAttributesOnChange(DefHighlightChange); + FDefaultFilter := SYNS_FilterSQL; + FRange := rsUnknown; + FDialect := sqlStandard; + InitializeKeywordLists; +end; + +destructor TSynSQLSyn.Destroy; +begin + FKeywords.Free; + FProcNames.Free; + FTableNames.Free; + {$IFDEF USE_TABLE_DICTIONARY} + FTableDict.Free; + {$ENDIF} + FFunctionNames.Free; + inherited Destroy; +end; + +procedure TSynSQLSyn.Assign(Source: TPersistent); +begin + inherited Assign(Source); + if (Source is TSynSQLSyn) then + SQLDialect := TSynSQLSyn(Source).SQLDialect; +end; + +procedure TSynSQLSyn.AndSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); +end; + +procedure TSynSQLSyn.AsciiCharProc; +var + IsEsc: Boolean; +begin + // Oracle SQL allows strings to go over multiple lines + if FLine[Run] = #0 then + NullProc + else begin + FTokenID := tkString; + // else it's end of multiline string + if SQLDialect <> sqlMySql then + begin + if (Run > 0) or (FRange <> rsString) or (FLine[Run] <> #39) then + begin + FRange := rsString; + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = #39); + end; + if FLine[Run] = #39 then + begin + Inc(Run); + FRange := rsUnknown; + end; + end + else + begin + IsEsc := False; + if (Run > 0) or (FRange <> rsString) or + ((FLine[Run] <> #39) and (FLine[Run - 1] <> '\')) then + begin + FRange := rsString; + repeat + if FLine[Run] = '\' then + IsEsc := not IsEsc + else + IsEsc := False; + if (not IsEsc) and (FLine[Run + 1] = #39) then + begin + Inc(Run); + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + if (FLine[Run] = #39) and (not IsEsc) then + begin + Inc(Run); + FRange := rsUnknown; + end; + end; + end; +end; + +procedure TSynSQLSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynSQLSyn.EqualProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); +end; + +procedure TSynSQLSyn.GreaterProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); +end; + +procedure TSynSQLSyn.IdentProc; +var + FoundDoubleMinus: Boolean; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + if FTokenID in [tkComment, tkConsoleOutput] then + begin + while not IsLineEnd(Run) do + Inc(Run); + end + else + while IsIdentChar(FLine[Run]) do + begin + FoundDoubleMinus := (FLine[Run] = '-') and (FLine[Run + 1] = '-'); + if FoundDoubleMinus then Break; + Inc(Run); + end; +end; + +procedure TSynSQLSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynSQLSyn.LowerProc; +begin + FTokenID := tkSymbol; + Inc(Run); + case FLine[Run] of + '=': Inc(Run); + '<': begin + Inc(Run); + if FLine[Run] = '=' then Inc(Run); + end; + end; +end; + +procedure TSynSQLSyn.MinusProc; +begin + Inc(Run); + if (FLine[Run] = '-') and ((FDialect <> sqlMySQL) or (FLine[Run+1] = ' ')) then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + FTokenID := tkSymbol; +end; + +procedure TSynSQLSyn.HashProc; +begin + if SQLDialect = sqlMySql then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + begin + Inc(Run); + FTokenID := tkUnknown; + end; +end; + +procedure TSynSQLSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynSQLSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', '-': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynSQLSyn.OrSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); +end; + +procedure TSynSQLSyn.PlusProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); +end; + +procedure TSynSQLSyn.FunctionNamesChanged(Sender: TObject); +begin + InitializeKeywordLists; +end; + +procedure TSynSQLSyn.ProcNamesChanged(Sender: TObject); +begin + InitializeKeywordLists; +end; + +procedure TSynSQLSyn.SlashProc; +begin + Inc(Run); + case FLine[Run] of + '*': + begin + if (SQLDialect = sqlMySql) and (FLine[Run + 1] = '!') then + begin + FRange := rsConditionalComment; + FTokenID := tkConditionalComment; + end + else + begin + FRange := rsComment; + FTokenID := tkComment; + end; + repeat + Inc(Run); + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end; + until IsLineEnd(Run); + end; + '=': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + '/': + begin + if (SQLDialect = sqlNexus) then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; + end + else + FTokenID := tkSymbol; + end; +end; + +procedure TSynSQLSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynSQLSyn.QuoteProc; +begin + FTokenID := tkDelimitedIdentifier; + Inc(Run); + while not IsLineEnd(Run) do + begin + if FLine[Run] = #34 then + begin + Inc(Run); + if FLine[Run] <> #34 then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynSQLSyn.BacktickProc; +begin + if SQLDialect = sqlMySql then + begin + FTokenID := tkDelimitedIdentifier; + Inc(Run); + while not IsLineEnd(Run) do + begin + if FLine[Run] = '`' then + begin + Inc(Run); + if FLine[Run] <> '`' then + Break; + end; + Inc(Run); + end; + end + else + begin + Inc(Run); + FTokenID := tkUnknown; + end; +end; + +procedure TSynSQLSyn.BracketProc; +begin + if SQLDialect in [sqlMSSQL7, sqlMSSQL2K] then + begin + FTokenID := tkDelimitedIdentifier; + Inc(Run); + while not IsLineEnd(Run) do + begin + if FLine[Run] = ']' then + begin + Inc(Run); + if FLine[Run] <> ']' then + Break; + end; + Inc(Run); + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynSQLSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynSQLSyn.SymbolAssignProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynSQLSyn.VariableProc; +var + i: Integer; + FoundDoubleMinus: Boolean; +begin + // MS SQL Server uses @@ to indicate system functions/variables + if (SQLDialect in [sqlMSSQL7, sqlMSSQL2K]) and (FLine[Run] = '@') and (FLine[Run + 1] = '@') then + IdentProc + else if (SQLDialect in [sqlMySql, sqlOracle]) and (FLine[Run] = '@') then + SymbolProc + // Oracle uses the ':' character to indicate bind variables + // Ingres II also uses the ':' character to indicate variables + else if not (SQLDialect in [sqlOracle, sqlIngres]) and (FLine[Run] = ':') then + SymbolProc + else + begin + FTokenID := tkVariable; + i := Run; + repeat + FoundDoubleMinus := (FLine[i] = '-') and (FLine[i + 1] = '-'); + if FoundDoubleMinus then Break; + Inc(i); + until not IsIdentChar(FLine[i]); + Run := i; + end; +end; + +procedure TSynSQLSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynSQLSyn.AnsiCProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + if FRange = rsConditionalComment then + FTokenID := tkConditionalComment + else + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +function TSynSQLSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +var + tk: TtkTokenKind; +begin + tk := IdentKind(PWideChar(AKeyword)); + Result := tk in [tkDatatype, tkException, tkFunction, tkKey, tkPLSQL, + tkDefaultPackage]; +end; + +procedure TSynSQLSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment, rsConditionalComment: + AnsiCProc; + rsConsoleOutput: + begin + while not IsLineEnd(Run) do + Inc(Run); + end; + rsString: + AsciiCharProc; + else + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #39: AsciiCharProc; + '=': EqualProc; + '>': GreaterProc; + '<': LowerProc; + '-': MinusProc; + '#': HashProc; + '|': OrSymbolProc; + '+': PlusProc; + '/': SlashProc; + '&': AndSymbolProc; + #34: QuoteProc; + '`': BacktickProc; + '[': BracketProc; + ':', '@': VariableProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '^', '%', '*', '!': SymbolAssignProc; + '{', '}', '.', ',', ';', '?', '(', ')', ']', '~': SymbolProc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynSQLSyn.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 TSynSQLSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynSQLSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynSQLSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynSQLSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkConditionalComment: Result := FConditionalCommentAttri; + tkConsoleOutput: Result := FConsoleOutputAttri; + tkDatatype: Result := FDataTypeAttri; + tkDefaultPackage: Result := FDefaultPackageAttri; + tkDelimitedIdentifier: Result := FDelimitedIdentifierAttri; + tkException: Result := FExceptionAttri; + tkFunction: Result := FFunctionAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkPLSQL: Result := FPLSQLAttri; + tkSpace: Result := FSpaceAttri; + tkSQLPlus: Result := FSQLPlusAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkProcName: Result := FProcNameAttri; + tkTableName: Result := FTableNameAttri; + tkVariable: Result := FVariableAttri; + tkUnknown: Result := FIdentifierAttri; + else + Result := nil; + end; +end; + +function TSynSQLSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynSQLSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynSQLSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynSQLSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterSQL; +end; + +function TSynSQLSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + 'a'..'z', 'A'..'Z', '0'..'9', '_': + Result := True; + '-': + Result := FDialect = sqlStandard; + '#', '$': // TODO: check this case, ANSI code wasn't clear here if this is exclusively Oracle + Result := FDialect in [sqlOracle, sqlNexus]; + '@': + Result := FDialect in [sqlMSSQL7, sqlMSSQL2K]; + '!', '^', '{', '}','~': + Result := FDialect = sqlNexus + else + Result := False; + end; +end; + +class function TSynSQLSyn.GetLanguageName: string; +begin + Result := SYNS_LangSQL; +end; + +procedure TSynSQLSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +var + HashValue: Integer; +begin + AKeyword := SynWideLowerCase(AKeyword); + HashValue := HashKey(PWideChar(AKeyword)); + FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); +end; + +procedure TSynSQLSyn.SetTableNames(const Value: TUnicodeStrings); +begin + FTableNames.Assign(Value); +end; + +procedure TSynSQLSyn.TableNamesChanged(Sender: TObject); +begin + InitializeKeywordLists; +end; + +procedure TSynSQLSyn.PutTableNamesInKeywordList; +var + i: Integer; + Entry: TSynHashEntry; +begin + for i := 0 to FTableNames.Count - 1 do + begin + Entry := FKeywords[HashKey(PWideChar(FTableNames[i]))]; + while Assigned(Entry) do + begin + if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FTableNames[i]) then + Break; + Entry := Entry.Next; + end; + if not Assigned(Entry) then + {$IFDEF USE_TABLE_DICTIONARY} + if not FTableDict.ContainsKey(SynWideLowerCase(FTableNames[i])) then + FTableDict.Add(SynWideLowerCase(FTableNames[i]), True); + {$ELSE} + DoAddKeyword(FTableNames[i], Ord(tkTableName)); + {$ENDIF} + end; +end; + +procedure TSynSQLSyn.PutFunctionNamesInKeywordList; +var + i: Integer; + Entry: TSynHashEntry; +begin + for i := 0 to (FFunctionNames.Count - 1) do + begin + Entry := FKeywords[HashKey(PWideChar(FFunctionNames[i]))]; + while Assigned(Entry) do + begin + if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FFunctionNames[i]) then + Break; + Entry := Entry.Next; + end; + if not Assigned(Entry) then + DoAddKeyword(FFunctionNames[i], Ord(tkFunction)); + end; +end; + +procedure TSynSQLSyn.PutProcNamesInKeywordList; +var + i: Integer; + Entry: TSynHashEntry; +begin + for i := 0 to FProcNames.Count - 1 do + begin + Entry := FKeywords[HashKey(PWideChar(FProcNames[i]))]; + while Assigned(Entry) do + begin + if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FProcNames[i]) then + Break; + Entry := Entry.Next; + end; + if not Assigned(Entry) then + DoAddKeyword(FProcNames[i], Ord(tkProcName)); + end; +end; + +procedure TSynSQLSyn.InitializeKeywordLists; +var + I: Integer; +begin +{$IFDEF LIST_CLEAR_NOT_VIRTUAL} + FKeywords.DeleteEntries; +{$ELSE} + FKeywords.Clear; +{$ENDIF} + {$IFDEF USE_TABLE_DICTIONARY} + FTableDict.Clear; + {$ENDIF} + FToIdent := nil; + + for I := 0 to Ord(High(TtkTokenKind)) do + EnumerateKeywords(I, GetKeywords(I), IsIdentChar, DoAddKeyword); + + PutProcNamesInKeywordList; + PutTableNamesInKeywordList; + PutFunctionNamesInKeywordList; + DefHighlightChange(Self); +end; + +procedure TSynSQLSyn.SetDialect(Value: TSQLDialect); +begin + if (Value <> FDialect) then + begin + FDialect := Value; + InitializeKeywordLists; + end; +end; + +procedure TSynSQLSyn.SetFunctionNames(const Value: TUnicodeStrings); +begin + FFunctionNames.Assign(Value); +end; + +procedure TSynSQLSyn.SetProcNames(const Value: TUnicodeStrings); +begin + FProcNames.Assign(Value); +end; + +function TSynSQLSyn.GetSampleSource: UnicodeString; +begin + Result := ''; + case FDialect of + sqlPostgres: + Result := '-- ANSI SQL sample source'#13#10 + + 'SELECT *'#13#10 + + 'FROM planets'#13#10 + + 'WHERE diameter < 13000'#13#10 + + ' AND name <> ''Earth'''; + sqlStandard: + Result := '-- ANSI SQL sample source'#13#10 + + 'SELECT *'#13#10 + + 'FROM planets'#13#10 + + 'WHERE diameter < 13000'#13#10 + + ' AND name <> ''Earth'''; + sqlInterbase6: + Result := '/* Interbase sample source */'#13#10 + + 'SET TERM !! ;'#13#10 + + #13#10 + + 'CREATE PROCEDURE HelloWorld(P_MSG VARCHAR(80)) AS'#13#10 + + 'BEGIN'#13#10 + + ' EXECUTE PROCEDURE WRITELN(:P_MSG);'#13#10 + + 'END !!'#13#10 + + #13#10 + + 'SET TERM ; !!'; + sqlMySQL: + Result := '/* MySQL sample source*/'#13#10 + + 'SET @variable = 1;'#13#10 + + #13#10 + + 'CREATE /*!32302 TEMPORARY */ TABLE t (a INT);'#13#10 + + #13#10 + + 'CREATE TABLE sample ('#13#10 + + ' id INT NOT NULL,'#13#10 + + ' first_name CHAR(30) NOT NULL,'#13#10 + + ' PRIMARY KEY (id),'#13#10 + + ' INDEX name (first_name));'#13#10 + + #13#10 + + 'SELECT DATE_ADD(''1997-12-31 23:59:59'','#13#10 + + ' INTERVAL 1 SECOND);'#13#10 + + #13#10 + + '# End of sample'; + sqlOracle: + Result := 'PROMPT Oracle sample source'#13#10 + + 'declare'#13#10 + + ' x varchar2(2000);'#13#10 + + 'begin -- Show some text here'#13#10 + + ' select to_char(count(*)) into x'#13#10 + + ' from tab;'#13#10 + + #13#10 + + ' dbms_output.put_line(''Hello World: '' || x);'#13#10 + + 'exception'#13#10 + + ' when others then'#13#10 + + ' null;'#13#10 + + 'end;'; + sqlSybase: + Result := '/* SyBase example source */'#13#10 + + 'declare @Integer int'#13#10 + + #13#10 + + '/* Good for positive numbers only. */'#13#10 + + 'select @Integer = 1000'#13#10 + + #13#10 + + 'select "Positives Only" ='#13#10 + + ' right(replicate("0",12) + '#13#10 + + ' convert(varchar, @Integer),12)'#13#10 + + #13#10 + + '/* Good for positive and negative numbers. */'#13#10 + + 'select @Integer = -1000'#13#10 + + #13#10 + + 'select "Both Signs" ='#13#10 + + ' substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 + + ' right(replicate("0",12) + '#13#10 + + ' convert(varchar, abs(@Integer)),12)'#13#10 + + #13#10 + + 'select @Integer = 1000'#13#10 + + #13#10 + + 'select "Both Signs" ='#13#10 + + ' substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 + + ' right(replicate("0",12) + '#13#10 + + ' convert(varchar, abs(@Integer)),12)'#13#10 + + #13#10 + + 'go'; + sqlIngres: + Result := '/* Ingres example source */'#13#10 + + 'DELETE'#13#10 + + 'FROM t1'#13#10 + + 'WHERE EXISTS'#13#10 + + '(SELECT t2.column1, t2.column2'#13#10 + + 'FROM t2'#13#10 + + 'WHERE t1.column1 = t2.column1 and'#13#10 + + 't1.column2 = t2.column2)'; + sqlMSSQL7: + Result := '/* SQL Server 7 example source */'#13#10 + + 'SET QUOTED_IDENTIFIER ON'#13#10 + + 'GO'#13#10 + + 'SET ANSI_NULLS OFF'#13#10 + + 'GO'#13#10 + + #13#10 + + '/* Object: Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 + + 'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 + + ' @Name varchar(25),'#13#10 + + ' @Address varchar(255),'#13#10 + + ' @ZipCode varchar(15)'#13#10 + + 'AS'#13#10 + + ' INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 + + ' VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 + + #13#10 + + ' SELECT SCOPE_IDENTITY()'#13#10 + + 'GO'; + sqlMSSQL2K: + Result := '/* SQL Server2000 example source */'#13#10 + + 'SET QUOTED_IDENTIFIER ON'#13#10 + + 'GO'#13#10 + + 'SET ANSI_NULLS OFF'#13#10 + + 'GO'#13#10 + + #13#10 + + '/* Object: Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 + + 'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 + + ' @Name varchar(25),'#13#10 + + ' @Address varchar(255),'#13#10 + + ' @ZipCode varchar(15)'#13#10 + + 'AS'#13#10 + + ' INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 + + ' VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 + + #13#10 + + ' SELECT SCOPE_IDENTITY()'#13#10 + + 'GO'; + end; +end; + +class function TSynSQLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangSQL; +end; + +function TSynSQLSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +begin + Result := ''; + + case FDialect of + sqlPostgres: + begin + case TtkTokenKind(TokenKind) of + tkDatatype: Result := PostgresTypes; + tkKey: Result := PostgresKW; + tkFunction: Result := PostgresFunctions; + tkException: Result := PostgresExceptions; + end; + end; + sqlIngres: + case TtkTokenKind(TokenKind) of + tkDatatype: Result := IngresTypes; + tkKey: Result := IngresKW; + tkFunction: Result := IngresFunctions; + end; + sqlInterbase6: + case TtkTokenKind(TokenKind) of + tkDatatype: Result := Interbase6Types; + tkFunction: Result := Interbase6Functions; + tkKey: Result := Interbase6KW; + end; + sqlMSSQL7: + case TtkTokenKind(TokenKind) of + tkKey: Result := MSSQL7KW; + tkDatatype: Result := MSSQL7Types; + tkFunction: Result := MSSQL7Functions; + end; + sqlMSSQL2K: + case TtkTokenKind(TokenKind) of + tkKey: Result := MSSQL2000KW; + tkDataType: Result := MSSQL2000Types; + tkFunction: Result := MSSQL2000Functions; + end; + sqlMySql: + case TtkTokenKind(TokenKind) of + tkKey: Result := MySqlKW; + tkDatatype: Result := MySqlTypes; + tkFunction: Result := MySqlFunctions; + tkPLSQL: Result := MySQLPLSQLKW; + end; + sqlOracle: + case TtkTokenKind(TokenKind) of + tkKey: Result := OracleKW; + tkDatatype: Result := OracleTypes; + tkException: Result := OracleExceptions; + tkFunction: Result := OracleFunctions; + tkComment: Result := OracleCommentKW; + tkConsoleOutput: Result := OracleConsoleOutputKW; + tkDefaultPackage: Result := OracleDefaultPackages; + tkPLSQL: Result := OraclePLSQLKW; + tkSQLPlus: Result := OracleSQLPlusCommands; + end; + sqlStandard: + if TtkTokenKind(TokenKind) = tkKey then + Result := StandardKW; + sqlSybase: + if TtkTokenKind(TokenKind) = tkKey then + Result := SybaseKW; + sqlNexus: + case TtkTokenKind(TokenKind) of + tkKey: Result := NexusKW; + tkDatatype: Result := NexusTypes; + tkFunction: Result := NexusFunctions; + end; + sqlInformix: + case TtkTokenKind(TokenKind) of + tkKey: Result := InformixKW; + tkDatatype: Result := InformixTypes; + tkFunction: Result := InformixFunctions; + end; + end; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynSQLSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterST.pas b/Source/VCL/SynEdit/Source/SynHighlighterST.pas index 44c86af6..8bda85fe 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterST.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterST.pas @@ -1,620 +1,622 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterST.pas, released 2002-07. -ST stands for Structured Text, and it is part of IEC1131 standard for -programming PLCs. -Author of this file is Ruggero Bandera. -Portions created by Ruggero Bandera are Copyright (C) 2002 Ruggero Bandera. -Unicode translation by Maël Hörz. -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: SynHighlighterST.pas,v 1.9.2.6 2008/09/14 16:25:03 maelh Exp $ by Ruggero Bandera - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynHighlighterST; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Controls, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown); - - TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, - rsUnKnown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynSTSyn = class(TSynCustomHighlighter) - private - fAsmStart: Boolean; - fRange: TRangeState; - fIdentFuncTable: array[0..210] of TIdentFuncTableFunc; - FTokenID: TtkTokenKind; - fStringAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fAsmAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AddressOpProc; - procedure AsciiCharProc; - procedure AnsiProc; - procedure BorProc; - procedure BraceOpenProc; - procedure ColonOrGreaterProc; - procedure CRProc; - procedure IdentProc; - procedure IntegerProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure PointProc; - procedure RoundOpenProc; - procedure SemicolonProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - protected - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenID: TtkTokenKind; - function GetTokenKind: integer; override; - procedure Next; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - published - property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..74] of string = ( - 'action', 'and', 'any', 'any_num', 'array', 'at', 'bool', 'by', 'byte', - 'case', 'configuration', 'constant', 'dint', 'do', 'dword', 'else', 'elsif', - 'end_action', 'end_case', 'end_configuration', 'end_for', 'end_if', - 'end_repeat', 'end_resource', 'end_step', 'end_struct', 'end_transition', - 'end_type', 'end_var', 'end_while', 'exit', 'external', 'finally', 'for', - 'from', 'function', 'goto', 'if', 'index', 'initial_step', 'initialization', - 'int', 'label', 'not', 'of', 'on', 'or', 'program', 'real', 'repeat', - 'resource', 'retain', 'return', 'sint', 'step', 'string', 'struct', 'then', - 'time', 'to', 'transition', 'type', 'udint', 'uint', 'until', 'usint', - 'var', 'var_external', 'var_global', 'var_in_out', 'var_input', - 'var_output', 'while', 'word', 'xor' - ); - - KeyIndices: array[0..210] of Integer = ( - -1, -1, -1, -1, -1, 55, 39, -1, -1, -1, -1, 51, -1, -1, -1, -1, 57, 49, 4, - -1, 17, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, - 47, -1, -1, -1, 58, 70, 38, -1, -1, 35, -1, -1, -1, 28, 12, -1, -1, -1, -1, - -1, -1, 64, -1, -1, 1, -1, -1, 69, 27, 45, -1, 2, -1, -1, -1, 3, 9, -1, 37, - 13, 63, -1, -1, 8, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, - 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 25, 20, -1, 53, 14, -1, -1, -1, - 0, -1, -1, 26, 41, 42, 62, -1, -1, -1, 66, 21, 36, -1, -1, 30, -1, 73, 22, - -1, 16, -1, -1, -1, -1, 74, -1, -1, 23, -1, 29, 50, -1, -1, -1, -1, -1, 68, - -1, -1, 19, -1, 15, 11, -1, 48, -1, 72, -1, 43, -1, -1, -1, -1, 67, 31, -1, - 32, -1, -1, 6, -1, -1, 7, 65, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, 5, -1, - 40, 52, 34, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, 44, 54, -1, 71, 46, 59 - ); - -{$Q-} -function TSynSTSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 381 + Ord(Str^) * 141; - inc(Str); - end; - Result := Result mod 211; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynSTSyn.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 TSynSTSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynSTSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier -end; - -function TSynSTSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -constructor TSynSTSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); - AddAttribute(fAsmAttri); - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - - InitIdent; - fRange := rsUnknown; - fAsmStart := False; - fDefaultFilter := SYNS_FilterST; -end; { Create } - -procedure TSynSTSyn.AddressOpProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '@' then inc(Run); -end; - -procedure TSynSTSyn.AsciiCharProc; -begin - fTokenID := tkString; - inc(Run); - while CharInSet(FLine[Run], ['0'..'9']) do inc(Run); -end; - -procedure TSynSTSyn.BorProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else begin - fTokenID := tkComment; - repeat - if fLine[Run] = '}' then begin - Inc(Run); - if fRange = rsBorAsm then - fRange := rsAsm - else - fRange := rsUnKnown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; - -procedure TSynSTSyn.BraceOpenProc; -begin - if fRange = rsAsm then - fRange := rsBorAsm - else - fRange := rsBor; - BorProc; -end; - -procedure TSynSTSyn.ColonOrGreaterProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynSTSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynSTSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynSTSyn.IntegerProc; - - function IsIntegerChar: Boolean; - begin - case fLine[Run] of - '0'..'9', 'A'..'F', 'a'..'f': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsIntegerChar do inc(Run); -end; - -procedure TSynSTSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynSTSyn.LowerProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '>']) then inc(Run); -end; - -procedure TSynSTSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynSTSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynSTSyn.PointProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['.', ')']) then inc(Run); -end; - -procedure TSynSTSyn.AnsiProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - fTokenID := tkComment; - repeat - if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then begin - Inc(Run, 2); - if fRange = rsAnsiAsm then - fRange := rsAsm - else - fRange := rsUnKnown; - break; - end; - Inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynSTSyn.RoundOpenProc; -begin - Inc(Run); - case fLine[Run] of - '*': - begin - Inc(Run); - if fRange = rsAsm then - fRange := rsAnsiAsm - else - fRange := rsAnsi; - fTokenID := tkComment; - if not IsLineEnd(Run) then - AnsiProc; - end; - '.': - begin - inc(Run); - fTokenID := tkSymbol; - end; - else - fTokenID := tkSymbol; - end; -end; - -procedure TSynSTSyn.SemicolonProc; -begin - Inc(Run); - fTokenID := tkSymbol; - if fRange = rsProperty then - fRange := rsUnknown; -end; - -procedure TSynSTSyn.SlashProc; -begin - Inc(Run); - if fLine[Run] = '/' then begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end else - fTokenID := tkSymbol; -end; - -procedure TSynSTSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynSTSyn.StringProc; -begin - fTokenID := tkString; - Inc(Run); - while not IsLineEnd(Run) do - begin - if fLine[Run] = #39 then - begin - Inc(Run); - if fLine[Run] <> #39 then - break; - end; - Inc(Run); - end; -end; - -procedure TSynSTSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynSTSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynSTSyn.Next; -begin - fAsmStart := False; - fTokenPos := Run; - case fRange of - rsAnsi, rsAnsiAsm: - AnsiProc; - rsBor, rsBorAsm: - BorProc; - else - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '#': AsciiCharProc; - '$': IntegerProc; - #39: StringProc; - '0'..'9': NumberProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - '{': BraceOpenProc; - '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': - begin - case fLine[Run] of - '(': RoundOpenProc; - '.': PointProc; - ';': SemicolonProc; - '/': SlashProc; - ':', '>': ColonOrGreaterProc; - '<': LowerProc; - '@': AddressOpProc; - else - SymbolProc; - end; - end; - else - UnknownProc; - end; - end; - inherited; -end; - -function TSynSTSyn.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 TSynSTSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynSTSyn.GetTokenID: TtkTokenKind; -begin - if not fAsmStart and (fRange = rsAsm) - and not (fTokenId in [tkNull, tkComment, tkSpace]) - then - Result := tkAsm - else - Result := fTokenId; -end; - -function TSynSTSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkAsm: Result := fAsmAttri; - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynSTSyn.GetTokenKind: integer; -begin - Result := Ord(GetTokenID); -end; - -function TSynSTSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -procedure TSynSTSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynSTSyn.ResetRange; -begin - fRange:= rsUnknown; -end; - -class function TSynSTSyn.GetLanguageName: string; -begin - Result := SYNS_LangST; -end; - -function TSynSTSyn.IsFilterStored: boolean; -begin - Result := fDefaultFilter <> SYNS_FilterST; -end; - -class function TSynSTSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangST; -end; - -initialization - RegisterPlaceableHighlighter(TSynSTSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterST.pas, released 2002-07. +ST stands for Structured Text, and it is part of IEC1131 standard for +programming PLCs. +Author of this file is Ruggero Bandera. +Portions created by Ruggero Bandera are Copyright (C) 2002 Ruggero Bandera. +Unicode translation by Maël Hörz. +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: SynHighlighterST.pas,v 1.9.2.6 2008/09/14 16:25:03 maelh Exp $ by Ruggero Bandera + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynHighlighterST; + +{$I SynEdit.inc} + +interface + +uses + Windows, + Controls, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, + tkSpace, tkString, tkSymbol, tkUnknown); + + TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, + rsUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynSTSyn = class(TSynCustomHighlighter) + private + FAsmStart: Boolean; + FRange: TRangeState; + FIdentFuncTable: array[0..210] of TIdentFuncTableFunc; + FTokenID: TtkTokenKind; + FStringAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FAsmAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AddressOpProc; + procedure AsciiCharProc; + procedure AnsiProc; + procedure BorProc; + procedure BraceOpenProc; + procedure ColonOrGreaterProc; + procedure CRProc; + procedure IdentProc; + procedure IntegerProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure PointProc; + procedure RoundOpenProc; + procedure SemicolonProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + protected + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenID: TtkTokenKind; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + published + property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..74] of UnicodeString = ( + 'action', 'and', 'any', 'any_num', 'array', 'at', 'bool', 'by', 'byte', + 'case', 'configuration', 'constant', 'dint', 'do', 'dword', 'else', 'elsif', + 'end_action', 'end_case', 'end_configuration', 'end_for', 'end_if', + 'end_repeat', 'end_resource', 'end_step', 'end_struct', 'end_transition', + 'end_type', 'end_var', 'end_while', 'exit', 'external', 'finally', 'for', + 'from', 'function', 'goto', 'if', 'index', 'initial_step', 'initialization', + 'int', 'label', 'not', 'of', 'on', 'or', 'program', 'real', 'repeat', + 'resource', 'retain', 'return', 'sint', 'step', 'string', 'struct', 'then', + 'time', 'to', 'transition', 'type', 'udint', 'uint', 'until', 'usint', + 'var', 'var_external', 'var_global', 'var_in_out', 'var_input', + 'var_output', 'while', 'word', 'xor' + ); + + KeyIndices: array[0..210] of Integer = ( + -1, -1, -1, -1, -1, 55, 39, -1, -1, -1, -1, 51, -1, -1, -1, -1, 57, 49, 4, + -1, 17, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, + 47, -1, -1, -1, 58, 70, 38, -1, -1, 35, -1, -1, -1, 28, 12, -1, -1, -1, -1, + -1, -1, 64, -1, -1, 1, -1, -1, 69, 27, 45, -1, 2, -1, -1, -1, 3, 9, -1, 37, + 13, 63, -1, -1, 8, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, + 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 25, 20, -1, 53, 14, -1, -1, -1, + 0, -1, -1, 26, 41, 42, 62, -1, -1, -1, 66, 21, 36, -1, -1, 30, -1, 73, 22, + -1, 16, -1, -1, -1, -1, 74, -1, -1, 23, -1, 29, 50, -1, -1, -1, -1, -1, 68, + -1, -1, 19, -1, 15, 11, -1, 48, -1, 72, -1, 43, -1, -1, -1, -1, 67, 31, -1, + 32, -1, -1, 6, -1, -1, 7, 65, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, 5, -1, + 40, 52, 34, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, 44, 54, -1, 71, 46, 59 + ); + +{$Q-} +function TSynSTSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 381 + Ord(Str^) * 141; + Inc(Str); + end; + Result := Result mod 211; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynSTSyn.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 TSynSTSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynSTSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier +end; + +function TSynSTSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +constructor TSynSTSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); + AddAttribute(FAsmAttri); + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + + InitIdent; + FRange := rsUnknown; + FAsmStart := False; + FDefaultFilter := SYNS_FilterST; +end; { Create } + +procedure TSynSTSyn.AddressOpProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '@' then Inc(Run); +end; + +procedure TSynSTSyn.AsciiCharProc; +begin + FTokenID := tkString; + Inc(Run); + while CharInSet(FLine[Run], ['0'..'9']) do Inc(Run); +end; + +procedure TSynSTSyn.BorProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else begin + FTokenID := tkComment; + repeat + if FLine[Run] = '}' then begin + Inc(Run); + if FRange = rsBorAsm then + FRange := rsAsm + else + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynSTSyn.BraceOpenProc; +begin + if FRange = rsAsm then + FRange := rsBorAsm + else + FRange := rsBor; + BorProc; +end; + +procedure TSynSTSyn.ColonOrGreaterProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynSTSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynSTSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynSTSyn.IntegerProc; + + function IsIntegerChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsIntegerChar do Inc(Run); +end; + +procedure TSynSTSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynSTSyn.LowerProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); +end; + +procedure TSynSTSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynSTSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynSTSyn.PointProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['.', ')']) then Inc(Run); +end; + +procedure TSynSTSyn.AnsiProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkComment; + repeat + if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then begin + Inc(Run, 2); + if FRange = rsAnsiAsm then + FRange := rsAsm + else + FRange := rsUnknown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynSTSyn.RoundOpenProc; +begin + Inc(Run); + case FLine[Run] of + '*': + begin + Inc(Run); + if FRange = rsAsm then + FRange := rsAnsiAsm + else + FRange := rsAnsi; + FTokenID := tkComment; + if not IsLineEnd(Run) then + AnsiProc; + end; + '.': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + FTokenID := tkSymbol; + end; +end; + +procedure TSynSTSyn.SemicolonProc; +begin + Inc(Run); + FTokenID := tkSymbol; + if FRange = rsProperty then + FRange := rsUnknown; +end; + +procedure TSynSTSyn.SlashProc; +begin + Inc(Run); + if FLine[Run] = '/' then begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end else + FTokenID := tkSymbol; +end; + +procedure TSynSTSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynSTSyn.StringProc; +begin + FTokenID := tkString; + Inc(Run); + while not IsLineEnd(Run) do + begin + if FLine[Run] = #39 then + begin + Inc(Run); + if FLine[Run] <> #39 then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynSTSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynSTSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynSTSyn.Next; +begin + FAsmStart := False; + FTokenPos := Run; + case FRange of + rsAnsi, rsAnsiAsm: + AnsiProc; + rsBor, rsBorAsm: + BorProc; + else + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '#': AsciiCharProc; + '$': IntegerProc; + #39: StringProc; + '0'..'9': NumberProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + '{': BraceOpenProc; + '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': + begin + case FLine[Run] of + '(': RoundOpenProc; + '.': PointProc; + ';': SemicolonProc; + '/': SlashProc; + ':', '>': ColonOrGreaterProc; + '<': LowerProc; + '@': AddressOpProc; + else + SymbolProc; + end; + end; + else + UnknownProc; + end; + end; + inherited; +end; + +function TSynSTSyn.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 TSynSTSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynSTSyn.GetTokenID: TtkTokenKind; +begin + if not FAsmStart and (FRange = rsAsm) + and not (FTokenID in [tkNull, tkComment, tkSpace]) + then + Result := tkAsm + else + Result := FTokenID; +end; + +function TSynSTSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkAsm: Result := FAsmAttri; + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynSTSyn.GetTokenKind: Integer; +begin + Result := Ord(GetTokenID); +end; + +function TSynSTSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +procedure TSynSTSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynSTSyn.ResetRange; +begin + FRange:= rsUnknown; +end; + +class function TSynSTSyn.GetLanguageName: string; +begin + Result := SYNS_LangST; +end; + +function TSynSTSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterST; +end; + +class function TSynSTSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangST; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynSTSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterSml.pas b/Source/VCL/SynEdit/Source/SynHighlighterSml.pas index 12d55bf3..8bd6082c 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterSml.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterSml.pas @@ -1,672 +1,676 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterSML.pas, released 2000-04-17. -The Original Code is based on the dmMLSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is David H. Muir. -Unicode translation by Maël Hörz. -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: SynHighlighterSml.pas,v 1.14.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides SynEdit with a Standard ML syntax highlighter, with extra options for the standard Basis library.) -@author(David H Muir ) -@created(1999) -@lastmod(2000-06-23) -The SynHighlighterSML.pas unit provides SynEdit text control with a Standard ML highlighter. Many formatting attributes can -be specified, and there is an option to include extra keywords and operators only found in the Basis library, this option can -be disabled for backwards compatibility with older ML compilers that do not have support for the Basis Library. -} - -unit SynHighlighterSml; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -Type - TtkTokenKind = (tkCharacter, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, - tkOperator, tkSpace, tkString, tkSymbol, tkSyntaxError, tkUnknown); - - TRangeState = (rsUnknown, rsComment, rsMultilineString); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynSMLSyn = class(TSynCustomHighlighter) - private - fBasis: Boolean; - fRange: TRangeState; - FTokenID: TtkTokenKind; - fIdentFuncTable: array[0..70] of TIdentFuncTableFunc; - fCharacterAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fOperatorAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fSyntaxErrorAttri: TSynHighlighterAttributes; - function IsValidMLCharacter: Boolean; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure CRProc; - procedure CharacterProc; - procedure ColonProc; - procedure CommentProc; - procedure IdentProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure OperatorProc; - procedure RoundBracketOpenProc; - procedure SpaceProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - procedure BasisOpProc; - procedure StringEndProc; - procedure PoundProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - function GetRange: Pointer; override; - procedure ResetRange; override; - procedure SetRange(Value: Pointer); override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property CharacterAttri: TSynHighlighterAttributes read fCharacterAttri - write fCharacterAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property OperatorAttri: TSynHighlighterAttributes read fOperatorAttri - write fOperatorAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property SyntaxErrorAttri: TSynHighlighterAttributes read fSyntaxErrorAttri - write fSyntaxErrorAttri; - property Basis: Boolean read FBasis write FBasis default True; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..40] of string = ( - 'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else', 'end', - 'eqtype', 'exception', 'fn', 'fun', 'functor', 'handle', 'if', 'in', - 'include', 'infix', 'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', - 'orelse', 'raise', 'rec', 'sharing', 'sig', 'signature', 'struct', - 'structure', 'then', 'type', 'val', 'where', 'while', 'with', 'withtype' - ); - - KeyIndices: array[0..70] of Integer = ( - 28, -1, -1, -1, 23, 4, 19, -1, -1, 32, 8, 6, -1, 33, 0, -1, 14, -1, 2, -1, - -1, 29, 35, -1, -1, -1, -1, 13, -1, -1, 9, -1, 11, 30, 1, -1, 25, 36, -1, - -1, -1, 40, -1, 7, -1, 16, 26, 37, -1, 15, 21, -1, 18, 12, 5, -1, -1, 10, - 22, 27, 34, 17, -1, 20, -1, 39, -1, 3, 38, 31, 24 - ); - -{$Q-} -function TSynSMLSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 157 + Ord(Str^) * 35; - inc(Str); - end; - Result := Result mod 71; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynSMLSyn.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 TSynSMLSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynSMLSyn.IsValidMLCharacter: Boolean; - - function IsABNRTChar(Run: Integer): Boolean; - begin - case fLine[Run] of - 'a', 'b', 'n', 'r', 't': - Result := True; - else - Result := False; - end; - end; - -var - ASCIIStr: string; - ASCIICode, Error: Integer; -begin - Result := False; - if (fLine[Run] = '"') then - if (Run > 2) and (fLine[Run - 1] <> '\') and (fLine[Run - 2] = '"') then - Result := True - else if (Run > 3) and (fLine[Run - 1] = '\') and (fLine[Run - 2] = '\') - and (fLine[Run - 3] = '"') then - Result := True - else if (Run > 3) and IsABNRTChar(Run - 1) and - (fLine[Run - 2] = '\') and (fLine[Run - 3] = '"') then - Result := True - else if (Run > 5) and (fLine[Run - 4] = '\') and (fLine[Run - 5] = '"') then - begin - ASCIIStr := copy(fLine, Run - 2, 3); - Val(ASCIIStr, ASCIICode, Error); - if (Error = 0) and (ASCIICode >= 0) and (ASCIICode <= 255) then - Result := True - end -end; - -function TSynSMLSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynSMLSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -constructor TSynSMLSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fCharacterAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); - fCharacterAttri.Foreground := clBlue; - AddAttribute(fCharacterAttri); - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clNavy; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - fKeyAttri.Foreground := clGreen; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fNumberAttri.Foreground := clRed; - AddAttribute(fNumberAttri); - fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); - fOperatorAttri.Foreground := clMaroon; - AddAttribute(fOperatorAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - fSyntaxErrorAttri.Foreground := clRed; - fSyntaxErrorAttri.Style := [fsBold]; - AddAttribute(fSyntaxErrorAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterSML; - Basis := True; -end; - -procedure TSynSMLSyn.CRProc; -begin - fTokenID := tkSpace; - Case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynSMLSyn.ColonProc; -begin - inc(Run); - if Basis and (fLine[Run] = ':') then - begin - fTokenID := tkOperator; - inc(Run); - end - else fTokenID := tkSymbol; -end; - -procedure TSynSMLSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynSMLSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynSMLSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynSMLSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynSMLSyn.OperatorProc; -begin - inc(Run); - fTokenID := tkOperator; -end; - -procedure TSynSMLSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynSMLSyn.StringProc; -begin - fTokenID := tkString; - repeat - if fLine[Run] = '\' then - begin - case fLine[Run + 1] of - '"', '\': - Inc(Run); - #00: - begin - Inc(Run); - fRange := rsMultilineString; - Exit; - end; - end; - end; - inc(Run); - until IsLineEnd(Run) or (fLine[Run] = '"'); - if FLine[Run] = '"' then - inc(Run); -end; - -procedure TSynSMLSyn.StringEndProc; -begin - fTokenID := tkString; - - case FLine[Run] of - #0: - begin - NullProc; - Exit; - end; - #10: - begin - LFProc; - Exit; - end; - #13: - begin - CRProc; - Exit; - end; - end; - - fRange := rsUnknown; - - repeat - case FLine[Run] of - #0, #10, #13: Break; - '\': - begin - case fLine[Run + 1] of - '"', '\': - Inc(Run); - #00: - begin - Inc(Run); - fRange := rsMultilineString; - Exit; - end; - end; - end; - '"': Break; - end; - inc(Run); - until IsLineEnd(Run) or (fLine[Run] = '"'); - if FLine[Run] = '"' then - inc(Run); -end; - -procedure TSynSMLSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynSMLSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynSMLSyn.BasisOpProc; -begin - inc(Run); - if Basis then fTokenID := tkOperator else fTokenID := tkIdentifier; -end; - -procedure TSynSMLSyn.PoundProc; -begin - Inc(Run); - if (fLine[Run] = '"') then - CharacterProc - else - fTokenID := tkIdentifier; -end; - -procedure TSynSMLSyn.CharacterProc; -begin - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - begin - repeat - Inc(Run); - until IsLineEnd(Run) or (fLine[Run] = '"'); - - if IsValidMLCharacter then - fTokenID := tkCharacter - else - begin - if fLine[Run] = '"' then Inc(Run); - fTokenID := tkSyntaxError; - end; - end - end -end; - -procedure TSynSMLSyn.RoundBracketOpenProc; -begin - Inc(Run); - if (fLine[Run] = '*') then - begin - fRange := rsComment; - CommentProc; - fTokenID := tkComment; - end - else - fTokenID := tkIdentifier; -end; - -procedure TSynSMLSyn.CommentProc; -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 TSynSMLSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsComment: CommentProc; - rsMultilineString: StringEndProc; - else - begin - fRange := rsUnknown; - - case fLine[Run] of - #13: CRProc; - '#': PoundProc; - ':': ColonProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '"': StringProc; - '@', '^': BasisOpProc; - '(': RoundBracketOpenProc; - '+', '-', '~', '*', '/', '=', '<', '>': OperatorProc; - ',', '.', ';': SymbolProc; - else UnknownProc; - end; - end; - end; - inherited; -end; - -function TSynSMLSyn.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 TSynSMLSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynSMLSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynSMLSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkCharacter: Result := fCharacterAttri; - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkOperator: Result := fOperatorAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkSyntaxError: Result := fSyntaxErrorAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynSMLSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynSMLSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterSML; -end; - -function TSynSMLSyn.IsIdentChar(AChar: WideChar): Boolean; -begin - case AChar of - #39, '_', '0'..'9', 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; -end; - -class function TSynSMLSyn.GetLanguageName: string; -begin - Result := SYNS_LangSML; -end; - -function TSynSMLSyn.GetSampleSource: string; -begin - Result := '(* Syntax highlighting *)'#13#10 + - 'load "Real";'#13#10 + - 'fun PrintNumber(x: int) ='#13#10 + - ' let'#13#10 + - ' val Number = real(x) / 10.0;'#13#10 + - ' val Text = "The Number is " ^ Real.toString(~Number) ^ "\n";'#13#10 + - ' in'#13#10 + - ' print Text;'#13#10 + - ' if x = 0 then () else PrintNumber(x-1)'#13#10+ - ' end;' -end; - -procedure TSynSMLSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynSMLSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynSMLSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -class function TSynSMLSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangSML; -end; - -initialization - RegisterPlaceableHighlighter(TSynSMLSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterSML.pas, released 2000-04-17. +The Original Code is based on the dmMLSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is David H. Muir. +Unicode translation by Maël Hörz. +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: SynHighlighterSml.pas,v 1.14.2.6 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides SynEdit with a Standard ML syntax highlighter, with extra options for the standard Basis library.) +@author(David H Muir ) +@created(1999) +@lastmod(2000-06-23) +The SynHighlighterSML.pas unit provides SynEdit text control with a Standard ML highlighter. Many formatting attributes can +be specified, and there is an option to include extra keywords and operators only found in the Basis library, this option can +be disabled for backwards compatibility with older ML compilers that do not have support for the Basis Library. +} + +unit SynHighlighterSml; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +Type + TtkTokenKind = (tkCharacter, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, + tkOperator, tkSpace, tkString, tkSymbol, tkSyntaxError, tkUnknown); + + TRangeState = (rsUnknown, rsComment, rsMultilineString); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynSMLSyn = class(TSynCustomHighlighter) + private + FBasis: Boolean; + FRange: TRangeState; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..70] of TIdentFuncTableFunc; + FCharacterAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FOperatorAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FSyntaxErrorAttri: TSynHighlighterAttributes; + function IsValidMLCharacter: Boolean; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure CRProc; + procedure CharacterProc; + procedure ColonProc; + procedure CommentProc; + procedure IdentProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure OperatorProc; + procedure RoundBracketOpenProc; + procedure SpaceProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + procedure BasisOpProc; + procedure StringEndProc; + procedure PoundProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property CharacterAttri: TSynHighlighterAttributes read FCharacterAttri + write FCharacterAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri + write FOperatorAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property SyntaxErrorAttri: TSynHighlighterAttributes read FSyntaxErrorAttri + write FSyntaxErrorAttri; + property Basis: Boolean read FBasis write FBasis default True; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..40] of UnicodeString = ( + 'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else', 'end', + 'eqtype', 'exception', 'fn', 'fun', 'functor', 'handle', 'if', 'in', + 'include', 'infix', 'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', + 'orelse', 'raise', 'rec', 'sharing', 'sig', 'signature', 'struct', + 'structure', 'then', 'type', 'val', 'where', 'while', 'with', 'withtype' + ); + + KeyIndices: array[0..70] of Integer = ( + 28, -1, -1, -1, 23, 4, 19, -1, -1, 32, 8, 6, -1, 33, 0, -1, 14, -1, 2, -1, + -1, 29, 35, -1, -1, -1, -1, 13, -1, -1, 9, -1, 11, 30, 1, -1, 25, 36, -1, + -1, -1, 40, -1, 7, -1, 16, 26, 37, -1, 15, 21, -1, 18, 12, 5, -1, -1, 10, + 22, 27, 34, 17, -1, 20, -1, 39, -1, 3, 38, 31, 24 + ); + +{$Q-} +function TSynSMLSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 157 + Ord(Str^) * 35; + Inc(Str); + end; + Result := Result mod 71; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynSMLSyn.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 TSynSMLSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynSMLSyn.IsValidMLCharacter: Boolean; + + function IsABNRTChar(Run: Integer): Boolean; + begin + case FLine[Run] of + 'a', 'b', 'n', 'r', 't': + Result := True; + else + Result := False; + end; + end; + +var + ASCIIStr: UnicodeString; + ASCIICode, Error: Integer; +begin + Result := False; + if (FLine[Run] = '"') then + if (Run > 2) and (FLine[Run - 1] <> '\') and (FLine[Run - 2] = '"') then + Result := True + else if (Run > 3) and (FLine[Run - 1] = '\') and (FLine[Run - 2] = '\') + and (FLine[Run - 3] = '"') then + Result := True + else if (Run > 3) and IsABNRTChar(Run - 1) and + (FLine[Run - 2] = '\') and (FLine[Run - 3] = '"') then + Result := True + else if (Run > 5) and (FLine[Run - 4] = '\') and (FLine[Run - 5] = '"') then + begin + ASCIIStr := copy(FLine, Run - 2, 3); + Val(ASCIIStr, ASCIICode, Error); + if (Error = 0) and (ASCIICode >= 0) and (ASCIICode <= 255) then + Result := True + end +end; + +function TSynSMLSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynSMLSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +constructor TSynSMLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FCharacterAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); + FCharacterAttri.Foreground := clBlue; + AddAttribute(FCharacterAttri); + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clNavy; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + FKeyAttri.Foreground := clGreen; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clRed; + AddAttribute(FNumberAttri); + FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); + FOperatorAttri.Foreground := clMaroon; + AddAttribute(FOperatorAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Foreground := clBlue; + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + FSyntaxErrorAttri.Foreground := clRed; + FSyntaxErrorAttri.Style := [fsBold]; + AddAttribute(FSyntaxErrorAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterSML; + Basis := True; +end; + +procedure TSynSMLSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else + Inc(Run); + end; +end; + +procedure TSynSMLSyn.ColonProc; +begin + Inc(Run); + if Basis and (FLine[Run] = ':') then + begin + FTokenID := tkOperator; + Inc(Run); + end + else FTokenID := tkSymbol; +end; + +procedure TSynSMLSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynSMLSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynSMLSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynSMLSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynSMLSyn.OperatorProc; +begin + Inc(Run); + FTokenID := tkOperator; +end; + +procedure TSynSMLSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynSMLSyn.StringProc; +begin + FTokenID := tkString; + repeat + if FLine[Run] = '\' then + begin + case FLine[Run + 1] of + '"', '\': + Inc(Run); + #00: + begin + Inc(Run); + FRange := rsMultilineString; + Exit; + end; + end; + end; + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = '"'); + if FLine[Run] = '"' then + Inc(Run); +end; + +procedure TSynSMLSyn.StringEndProc; +begin + FTokenID := tkString; + + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + #13: + begin + CRProc; + Exit; + end; + end; + + FRange := rsUnknown; + + repeat + case FLine[Run] of + #0, #10, #13: Break; + '\': + begin + case FLine[Run + 1] of + '"', '\': + Inc(Run); + #00: + begin + Inc(Run); + FRange := rsMultilineString; + Exit; + end; + end; + end; + '"': Break; + end; + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = '"'); + if FLine[Run] = '"' then + Inc(Run); +end; + +procedure TSynSMLSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynSMLSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynSMLSyn.BasisOpProc; +begin + Inc(Run); + if Basis then FTokenID := tkOperator else FTokenID := tkIdentifier; +end; + +procedure TSynSMLSyn.PoundProc; +begin + Inc(Run); + if (FLine[Run] = '"') then + CharacterProc + else + FTokenID := tkIdentifier; +end; + +procedure TSynSMLSyn.CharacterProc; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + begin + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = '"'); + + if IsValidMLCharacter then + FTokenID := tkCharacter + else + begin + if FLine[Run] = '"' then Inc(Run); + FTokenID := tkSyntaxError; + end; + end + end +end; + +procedure TSynSMLSyn.RoundBracketOpenProc; +begin + Inc(Run); + if (FLine[Run] = '*') then + begin + FRange := rsComment; + CommentProc; + FTokenID := tkComment; + end + else + FTokenID := tkIdentifier; +end; + +procedure TSynSMLSyn.CommentProc; +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 TSynSMLSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsComment: CommentProc; + rsMultilineString: StringEndProc; + else + begin + FRange := rsUnknown; + + case FLine[Run] of + #13: CRProc; + '#': PoundProc; + ':': ColonProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '"': StringProc; + '@', '^': BasisOpProc; + '(': RoundBracketOpenProc; + '+', '-', '~', '*', '/', '=', '<', '>': OperatorProc; + ',', '.', ';': SymbolProc; + else UnknownProc; + end; + end; + end; + inherited; +end; + +function TSynSMLSyn.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 TSynSMLSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynSMLSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynSMLSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkCharacter: Result := FCharacterAttri; + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkOperator: Result := FOperatorAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkSyntaxError: Result := FSyntaxErrorAttri; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynSMLSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynSMLSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterSML; +end; + +function TSynSMLSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + case AChar of + #39, '_', '0'..'9', 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; +end; + +class function TSynSMLSyn.GetLanguageName: string; +begin + Result := SYNS_LangSML; +end; + +function TSynSMLSyn.GetSampleSource: UnicodeString; +begin + Result := '(* Syntax highlighting *)'#13#10 + + 'load "Real";'#13#10 + + 'fun PrintNumber(x: int) ='#13#10 + + ' let'#13#10 + + ' val Number = real(x) / 10.0;'#13#10 + + ' val Text = "The Number is " ^ Real.toString(~Number) ^ "\n";'#13#10 + + ' in'#13#10 + + ' print Text;'#13#10 + + ' if x = 0 then () else PrintNumber(x-1)'#13#10+ + ' end;' +end; + +procedure TSynSMLSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynSMLSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynSMLSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +class function TSynSMLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangSML; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynSMLSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterTclTk.pas b/Source/VCL/SynEdit/Source/SynHighlighterTclTk.pas index 960b8ff5..c577ca7c 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterTclTk.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterTclTk.pas @@ -1,895 +1,898 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterTclTk.pas, released 2000-05-05. -The Original Code is based on the siTclTkSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Igor Shitikov. -Unicode translation by Maël Hörz. -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: SynHighlighterTclTk.pas,v 1.18.2.12 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a TCL/Tk highlighter for SynEdit) -@author(Igor Shitikov, converted to SynEdit by David Muir ) -@created(5 December 1999, converted to SynEdit April 18, 2000) -@lastmod(2000-06-23) -The SynHighlighterTclTk unit provides SynEdit with a TCL/Tk highlighter. -} - -unit SynHighlighterTclTk; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkSecondKey, - tkTixKey, tkSpace, tkString, tkOptions, tkVariable, tkWidgetKey, tkPath, tkUnknown); - - TRangeState = (rsUnknown, rsAnsi, rsPasStyle, rsCStyle); - -type - TSynTclTkSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - FTokenID: TtkTokenKind; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSecondKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fOptionsAttri: TSynHighlighterAttributes; - fVariableAttri: TSynHighlighterAttributes; - fPathAttri: TSynHighlighterAttributes; - fKeyWords: TStrings; - fSecondKeys: TStrings; - fTixWords: TStrings; - fTixKeyAttri: TSynHighlighterAttributes; - fWidgetWords: TStrings; - fWidgetKeyAttri: TSynHighlighterAttributes; - procedure BraceOpenProc; - procedure PointCommaProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure NullProc; - procedure NumberProc; - procedure RoundOpenProc; - procedure SlashProc; - procedure SpaceProc; - procedure StringProc; - procedure UnknownProc; - procedure AnsiProc; - procedure PasStyleProc; - procedure CStyleProc; - procedure VariableProc; - procedure PathProc; - procedure MinusProc; - procedure SymbolProc; - procedure SetKeyWords(const Value: TStrings); - procedure SetSecondKeys(const Value: TStrings); - function IsKeywordListStored: Boolean; - function IsSecondKeywordListStored: Boolean; - function InternalIsKeyword(const AKeyword: string; - KeyWordList: TStrings; ACaseSensitive: Boolean = False): Boolean; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: string): Boolean; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - function SaveToRegistry(RootKey: HKEY; Key: string): boolean; override; - function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property KeyWords: TStrings read fKeyWords write SetKeyWords - stored IsKeywordListStored; - property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri - write fSecondKeyAttri; - property SecondKeyWords: TStrings read fSecondKeys write SetSecondKeys - stored IsSecondKeywordListStored; - property TixKeyAttri: TSynHighlighterAttributes read fTixKeyAttri - write fTixKeyAttri; - property TixWords: TStrings read fTixWords; - property WidgetKeyAttri: TSynHighlighterAttributes read fWidgetKeyAttri - write fWidgetKeyAttri; - property WidgetWords: TStrings read fWidgetWords; - - 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 OptionsAttri: TSynHighlighterAttributes read fOptionsAttri - write fOptionsAttri; - property PathAttri: TSynHighlighterAttributes read fPathAttri - write fPathAttri; - property VariableAttri: TSynHighlighterAttributes read fVariableAttri - write fVariableAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - TclTkKeys: array[0..128] of string = ( - 'after', 'append', 'array', 'auto_execok', 'auto_import', 'auto_load', - 'auto_mkindex', 'auto_mkindex_old', 'auto_qualify', 'auto_reset', 'base', - 'bgerror', 'binary', 'body', 'break', 'catch', 'cd', 'class', 'clock', - 'close', 'code', 'concat', 'configbody', 'constructor', 'continue', 'dde', - 'delete', 'destructor', 'else', 'elseif', 'encoding', 'ensemble', 'eof', - 'error', 'eval', 'exec', 'exit', 'expr', 'fblocked', 'fconfigure', 'fcopy', - 'file', 'fileevent', 'filename', 'find', 'flush', 'for', 'foreach', - 'format', 'gets', 'glob', 'global', 'history', 'http', 'if', 'incr', 'info', - 'inherit', 'interp', 'is', 'join', 'lappend', 'lindex', 'linsert', 'list', - 'llength', 'load', 'local', 'lrange', 'lreplace', 'lsearch', 'lset', - 'lsort', 'memory', 'method', 'msgcat', 'namespace', 'open', 'package', - 'parray', 'pid', 'pkg_mkindex', 'private', 'proc', 'protected', 'public', - 'puts', 'pwd', 're_syntax', 'read', 'regexp', 'registry', 'regsub', - 'rename', 'resource', 'return', 'safe', 'safebase', 'scan', 'scope', 'seek', - 'set', 'socket', 'source', 'split', 'string', 'subst', 'switch', 'tcl', - 'tcl_endofword', 'tcl_findlibrary', 'tcl_startofnextword', - 'tcl_startofpreviousword', 'tcl_wordbreakafter', 'tcl_wordbreakbefore', - 'tcltest', 'tclvars', 'tell', 'then', 'time', 'trace', 'unknown', 'unset', - 'update', 'uplevel', 'upvar', 'variable', 'vwait', 'while' - ); - - SecondTclTkKeys: array[0..91] of string = ( - 'bell', 'bind', 'bindidproc', 'bindproc', 'bindtags', 'bitmap', 'button', - 'canvas', 'checkbutton', 'clipboard', 'colors', 'combobox', 'console', - 'cursors', 'debug', 'destroy', 'entry', 'event', 'exp_after', 'exp_before', - 'exp_continue', 'exp_internal', 'exp_send', 'expect', 'focus', 'font', - 'frame', 'grab', 'grid', 'image', 'interact', 'interpreter', 'keysyms', - 'label', 'labelframe', 'listbox', 'loadtk', 'log_file', 'log_user', 'lower', - 'menu', 'menubutton', 'message', 'namespupd', 'option', 'options', 'pack', - 'panedwindow', 'photo', 'place', 'radiobutton', 'raise', 'rgb', 'scale', - 'scrollbar', 'selection', 'send', 'send_error', 'send_log', 'send_tty', - 'send_user', 'sendout', 'sleep', 'spawn', 'spinbox', 'stty', 'text', 'tk', - 'tk_bisque', 'tk_choosecolor', 'tk_choosedirectory', 'tk_dialog', - 'tk_focusfollowsmouse', 'tk_focusnext', 'tk_focusprev', 'tk_getopenfile', - 'tk_getsavefile', 'tk_menusetfocus', 'tk_messagebox', 'tk_optionmenu', - 'tk_popup', 'tk_setpalette', 'tk_textcopy', 'tk_textcut', 'tk_textpaste', - 'tkerror', 'tkvars', 'tkwait', 'toplevel', 'wait', 'winfo', 'wm' - ); - - TixKeys: array[0..43] of string = ( - 'compound', 'pixmap', 'tix', 'tixballoon', 'tixbuttonbox', 'tixchecklist', - 'tixcombobox', 'tixcontrol', 'tixdestroy', 'tixdirlist', - 'tixdirselectdialog', 'tixdirtree', 'tixdisplaystyle', 'tixexfileselectbox', - 'tixexfileselectdialog', 'tixfileentry', 'tixfileselectbox', - 'tixfileselectdialog', 'tixform', 'tixgetboolean', 'tixgetint', 'tixgrid', - 'tixhlist', 'tixinputonly', 'tixlabelentry', 'tixlabelframe', - 'tixlistnotebook', 'tixmeter', 'tixmwm', 'tixnbframe', 'tixnotebook', - 'tixoptionmenu', 'tixpanedwindow', 'tixpopupmenu', 'tixscrolledhlist', - 'tixscrolledlistbox', 'tixscrolledtext', 'tixscrolledwindow', 'tixselect', - 'tixstdbuttonbox', 'tixtlist', 'tixtree', 'tixutils', 'tixwish' - ); - - WidgetKeys: array[0..32] of string = ( - 'ArrowButton', 'Button', 'ButtonBox', 'BWidget', 'ComboBox', 'Dialog', - 'DragSite', 'DropSite', 'DynamicHelp', 'Entry', 'Label', 'LabelEntry', - 'LabelFrame', 'ListBox', 'MainFrame', 'MessageDlg', 'NoteBook', - 'PagesManager', 'PanedWindow', 'PasswdDlg', 'ProgressBar', 'ProgressDlg', - 'ScrollableFrame', 'ScrollableWindow', 'ScrolledWindow', 'ScrollView', - 'SelectColor', 'SelectFont', 'Separator', 'SpinBox', 'TitleFrame', 'Tree', - 'Widget' - ); - -function TSynTclTkSyn.InternalIsKeyword(const AKeyword: string; - KeyWordList: TStrings; ACaseSensitive: Boolean = False): Boolean; -var - First, Last, I, Compare: Integer; - Token: string; -begin - First := 0; - Last := KeyWordList.Count - 1; - Result := False; - if ACaseSensitive then - Token := AKeyword - else - Token := SysUtils.AnsiLowerCase(AKeyword); - while First <= Last do - begin - I := (First + Last) shr 1; - Compare := WideCompareStr(KeyWordList[i], Token); - if Compare = 0 then - begin - Result := True; - break; - end - else - if Compare < 0 then First := I + 1 else Last := I - 1; - end; -end; - -function TSynTclTkSyn.IsKeyword(const AKeyword: string): Boolean; -begin - Result := InternalIsKeyword(AKeyword, fWidgetWords, True) or - InternalIsKeyword(AKeyword, fTixWords) or - InternalIsKeyword(AKeyword, fKeyWords) or - InternalIsKeyword(AKeyword, fSecondKeys); -end; - -constructor TSynTclTkSyn.Create(AOwner: TComponent); -var - i: Integer; -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fKeyWords := TStringList.Create; - TStringList(fKeyWords).Sorted := True; - TStringList(fKeyWords).Duplicates := dupIgnore; - fSecondKeys := TStringList.Create; - TStringList(fSecondKeys).Sorted := True; - TStringList(fSecondKeys).Duplicates := dupIgnore; - fTixWords := TStringList.Create; - TStringList(fTixWords).Sorted := True; - TStringList(fTixWords).Duplicates := dupIgnore; - fWidgetWords := TStringList.Create; - TStringList(fWidgetWords).Sorted := True; - TStringList(fWidgetWords).Duplicates := dupIgnore; - fKeyWords.BeginUpdate; - for i := Low(TclTkKeys) to High(TclTkKeys) do - FKeyWords.Add(TclTkKeys[i]); - fKeyWords.EndUpdate; - fSecondKeys.BeginUpdate; - for i := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do - fSecondKeys.Add(SecondTclTkKeys[i]); - fSecondKeys.EndUpdate; - fTixWords.BeginUpdate; - for i := Low(TixKeys) to High(TixKeys) do - FTixWords.Add(TixKeys[i]); - fTixWords.EndUpdate; - fWidgetWords.BeginUpdate; - for i := Low(WidgetKeys) to High(WidgetKeys) do - FWidgetWords.Add(WidgetKeys[i]); - fWidgetWords.EndUpdate; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - fSecondKeyAttri.Style := [fsBold]; - AddAttribute(fSecondKeyAttri); - - fTixKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrTixKeyWords, SYNS_FriendlyAttrTixKeyWords); - fTixKeyAttri.Style := [fsBold, fsItalic]; - AddAttribute(fTixKeyAttri); - - fWidgetKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrWidgetWords, SYNS_FriendlyAttrWidgetWords); - fWidgetKeyAttri.Style := [fsBold, fsItalic]; - AddAttribute(fWidgetKeyAttri); - - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - fOptionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrOptions, SYNS_FriendlyAttrOptions); - AddAttribute(fOptionsAttri); - fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(fVariableAttri); - fPathAttri := TSynHighlighterAttributes.Create(SYNS_AttrPath, SYNS_FriendlyAttrPath); - AddAttribute(fPathAttri); - - fRange := rsUnknown; - fDefaultFilter := SYNS_FilterTclTk; -end; - -destructor TSynTclTkSyn.Destroy; -begin - fWidgetWords.Free; - fTixWords.Free; - fSecondKeys.Free; - fKeyWords.Free; - inherited Destroy; -end; - -procedure TSynTclTkSyn.AnsiProc; -begin - fTokenID := tkComment; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - if fLine[Run] = '*' then - begin - if fLine[Run + 1] = ')' then - begin - fRange := rsUnKnown; - inc(Run, 2); - break; - end - else - inc(Run) - end - else - inc(Run); -end; - -procedure TSynTclTkSyn.PasStyleProc; -begin - fTokenID := tkComment; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - if FLine[Run] = '}' then - begin - fRange := rsUnKnown; - inc(Run); - break; - end - else - inc(Run); -end; - -procedure TSynTclTkSyn.CStyleProc; -begin - fTokenID := tkComment; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - if fLine[Run] = '*' then - begin - if fLine[Run + 1] = '/' then - begin - fRange := rsUnKnown; - inc(Run, 2); - break; - end - else inc(Run) - end - else - inc(Run); -end; - -procedure TSynTclTkSyn.BraceOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynTclTkSyn.PointCommaProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynTclTkSyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynTclTkSyn.IdentProc; -begin - while IsIdentChar(fLine[Run]) do inc(Run); - if InternalIsKeyword(GetToken, fWidgetWords, True) then - fTokenId := tkWidgetKey - else if InternalIsKeyword(GetToken, fTixWords) then - fTokenId := tkTixKey - else if InternalIsKeyword(GetToken, fKeyWords) then - fTokenId := tkKey - else if InternalIsKeyword(GetToken, fSecondKeys) then - fTokenId := tkSecondKey - else - fTokenId := tkIdentifier; -end; - -procedure TSynTclTkSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynTclTkSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynTclTkSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynTclTkSyn.RoundOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynTclTkSyn.SlashProc; -begin - if FLine[Run] = '#' then - begin - fTokenID := tkComment; - while not IsLineEnd(Run) do Inc(Run); - end - else - begin - FTokenID := tkSymbol; - Inc(Run); - end; -end; - -procedure TSynTclTkSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynTclTkSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then - inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until (FLine[Run] = #34) and (FLine[Pred(Run)] <> '\'); - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynTclTkSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnKnown; -end; - -procedure TSynTclTkSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsAnsi: AnsiProc; - rsPasStyle: PasStyleProc; - rsCStyle: CStyleProc; - else - case fLine[Run] of - '-': MinusProc; - '#': SlashProc; - '{': BraceOpenProc; - ';': PointCommaProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - '(': RoundOpenProc; - '/': SlashProc; - '[', ']', ')', '}': SymbolProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #34: StringProc; - '$': VariableProc; - '.': PathProc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynTclTkSyn.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 TSynTclTkSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynTclTkSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynTclTkSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynTclTkSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkSecondKey: Result := fSecondKeyAttri; - tkTixKey: Result := fTixKeyAttri; - tkWidgetKey: Result := fWidgetKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkOptions: Result := fOptionsAttri; - tkVariable: Result := fVariableAttri; - tkPath: Result := fPathAttri; - tkUnknown: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynTclTkSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynTclTkSyn.ResetRange; -begin - fRange := rsUnknown; -end; - -procedure TSynTclTkSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynTclTkSyn.SetKeyWords(const Value: TStrings); -var - i: Integer; -begin - if Value <> nil then - begin - Value.BeginUpdate; - for i := 0 to Value.Count - 1 do - Value[i] := SysUtils.AnsiUpperCase(Value[i]); - Value.EndUpdate; - end; - fKeyWords.Assign(Value); - DefHighLightChange(nil); -end; - -procedure TSynTclTkSyn.SetSecondKeys(const Value: TStrings); -var - i: Integer; -begin - if Value <> nil then - begin - Value.BeginUpdate; - for i := 0 to Value.Count - 1 do - Value[i] := SysUtils.AnsiUpperCase(Value[i]); - Value.EndUpdate; - end; - fSecondKeys.Assign(Value); - DefHighLightChange(nil); -end; - -function TSynTclTkSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterTclTk; -end; - -class function TSynTclTkSyn.GetLanguageName: string; -begin - Result := SYNS_LangTclTk; -end; - -function TSynTclTkSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; -var - r: TBetterRegistry; -begin - r := TBetterRegistry.Create; - try - r.RootKey := RootKey; - if r.OpenKeyReadOnly(Key) then - begin - if r.ValueExists('KeyWords') then KeyWords.Text := r.ReadString('KeyWords'); - Result := inherited LoadFromRegistry(RootKey, Key); - end - else - Result := False; - finally - r.Free; - end; -end; - -function TSynTclTkSyn.SaveToRegistry(RootKey: HKEY; Key: string): boolean; -var - r: TBetterRegistry; -begin - r:= TBetterRegistry.Create; - try - r.RootKey := RootKey; - if r.OpenKey(Key,true) then - begin - r.WriteString('KeyWords', KeyWords.Text); - Result := inherited SaveToRegistry(RootKey, Key); - end - else - Result := false; - finally - r.Free; - end; -end; - -function TSynTclTkSyn.IsKeywordListStored: Boolean; -var - Keys: TStringList; - DefKey: Integer; - Index: Integer; -begin - Keys := TStringList.Create; - try - Keys.Assign(KeyWords); - Index := 0; - for DefKey := Low(TclTkKeys) to High(TclTkKeys) do - begin - if not Keys.Find(TclTkKeys[DefKey], Index) then - begin - Result := True; - Exit; - end; - Keys.Delete(Index); - end; - Result := Keys.Count <> 0; - finally - Keys.Free; - end; -end; - -function TSynTclTkSyn.GetSampleSource: string; -begin - Result := - '#!/usr/local/tclsh8.0'#13#10 + - 'if {$argc < 2} {'#13#10 + - ' puts stderr "Usage: $argv0 parameter"'#13#10 + - ' exit 1'#13#10 + - '}'; -end; - -class function TSynTclTkSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangTclTk; -end; - -procedure TSynTclTkSyn.MinusProc; -const - EmptyChars = [' ', #9, #0, #10, #13]; -var - OK: Boolean; -begin - OK := False; - Inc(Run); - { minus like symbol } - if CharInSet(fLine[Run], ['0'..'9']) then - FTokenID := tkSymbol - else - { special option -- } - if (fLine[Run] = '-') and CharInSet(fLine[Run + 1], EmptyChars) then - begin - OK := True; - Inc(Run); - end - { normal options -options } - else begin - if CharInSet(fLine[Run], ['a'..'z', 'A'..'Z']) then - begin - Inc(Run); - while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z']) do - Inc(Run); - OK := CharInSet(fLine[Run], EmptyChars); - end - { bad option syntax } - else - while not CharInSet(FLine[Run], EmptyChars) do - Inc(Run); - end; - if OK then - FTokenID := tkOptions - else - FTokenID := tkUnknown; -end; - -procedure TSynTclTkSyn.PathProc; -begin - if CharInSet(FLine[Run + 1], ['a'..'z', 'A'..'Z']) then - begin - fTokenID := tkPath; - Inc(Run); - while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z', '0'..'9']) do Inc(Run); - end - else - begin - FTokenID := tkSymbol; - Inc(Run); - end; -end; - -procedure TSynTclTkSyn.VariableProc; -begin - fTokenId := tkVariable; - Inc(Run); - while CharInSet(FLine[Run], ['_', '0'..'9', 'A'..'Z', 'a'..'z']) do Inc(Run); -end; - -function TSynTclTkSyn.IsSecondKeywordListStored: Boolean; -var - Keys: TStringList; - DefKey: Integer; - Index: Integer; -begin - Keys := TStringList.Create; - try - Keys.Assign(SecondKeyWords); - Index := 0; - for DefKey := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do - begin - if not Keys.Find(SecondTclTkKeys[DefKey], Index) then - begin - Result := True; - Exit; - end; - Keys.Delete(Index); - end; - Result := Keys.Count <> 0; - finally - Keys.Free; - end; -end; - -procedure TSynTclTkSyn.SymbolProc; -begin - FTokenID := tkSymbol; - Inc(Run); -end; - -initialization - RegisterPlaceableHighlighter(TSynTclTkSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterTclTk.pas, released 2000-05-05. +The Original Code is based on the siTclTkSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Igor Shitikov. +Unicode translation by Maël Hörz. +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: SynHighlighterTclTk.pas,v 1.18.2.12 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a TCL/Tk highlighter for SynEdit) +@author(Igor Shitikov, converted to SynEdit by David Muir ) +@created(5 December 1999, converted to SynEdit April 18, 2000) +@lastmod(2000-06-23) +The SynHighlighterTclTk unit provides SynEdit with a TCL/Tk highlighter. +} + +unit SynHighlighterTclTk; + +{$I SynEdit.inc} + +interface + +uses + Windows, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkSecondKey, + tkTixKey, tkSpace, tkString, tkOptions, tkVariable, tkWidgetKey, tkPath, tkUnknown); + + TRangeState = (rsUnknown, rsAnsi, rsPasStyle, rsCStyle); + +type + TSynTclTkSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSecondKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FOptionsAttri: TSynHighlighterAttributes; + FVariableAttri: TSynHighlighterAttributes; + FPathAttri: TSynHighlighterAttributes; + FKeyWords: TUnicodeStrings; + FSecondKeys: TUnicodeStrings; + FTixWords: TUnicodeStrings; + FTixKeyAttri: TSynHighlighterAttributes; + FWidgetWords: TUnicodeStrings; + FWidgetKeyAttri: TSynHighlighterAttributes; + procedure BraceOpenProc; + procedure PointCommaProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure RoundOpenProc; + procedure SlashProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; + procedure AnsiProc; + procedure PasStyleProc; + procedure CStyleProc; + procedure VariableProc; + procedure PathProc; + procedure MinusProc; + procedure SymbolProc; + procedure SetKeyWords(const Value: TUnicodeStrings); + procedure SetSecondKeys(const Value: TUnicodeStrings); + function IsKeywordListStored: Boolean; + function IsSecondKeywordListStored: Boolean; + function InternalIsKeyword(const AKeyword: UnicodeString; + KeyWordList: TUnicodeStrings; ACaseSensitive: Boolean = False): Boolean; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function IsKeyword(const AKeyword: UnicodeString): Boolean; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; + function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords + stored IsKeywordListStored; + property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri + write FSecondKeyAttri; + property SecondKeyWords: TUnicodeStrings read FSecondKeys write SetSecondKeys + stored IsSecondKeywordListStored; + property TixKeyAttri: TSynHighlighterAttributes read FTixKeyAttri + write FTixKeyAttri; + property TixWords: TUnicodeStrings read FTixWords; + property WidgetKeyAttri: TSynHighlighterAttributes read FWidgetKeyAttri + write FWidgetKeyAttri; + property WidgetWords: TUnicodeStrings read FWidgetWords; + + 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 OptionsAttri: TSynHighlighterAttributes read FOptionsAttri + write FOptionsAttri; + property PathAttri: TSynHighlighterAttributes read FPathAttri + write FPathAttri; + property VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + TclTkKeys: array[0..128] of UnicodeString = ( + 'after', 'append', 'array', 'auto_execok', 'auto_import', 'auto_load', + 'auto_mkindex', 'auto_mkindex_old', 'auto_qualify', 'auto_reset', 'base', + 'bgerror', 'binary', 'body', 'break', 'catch', 'cd', 'class', 'clock', + 'close', 'code', 'concat', 'configbody', 'constructor', 'continue', 'dde', + 'delete', 'destructor', 'else', 'elseif', 'encoding', 'ensemble', 'eof', + 'error', 'eval', 'exec', 'exit', 'expr', 'fblocked', 'fconfigure', 'fcopy', + 'file', 'fileevent', 'filename', 'find', 'flush', 'for', 'foreach', + 'format', 'gets', 'glob', 'global', 'history', 'http', 'if', 'incr', 'info', + 'inherit', 'interp', 'is', 'join', 'lappend', 'lindex', 'linsert', 'list', + 'llength', 'load', 'local', 'lrange', 'lreplace', 'lsearch', 'lset', + 'lsort', 'memory', 'method', 'msgcat', 'namespace', 'open', 'package', + 'parray', 'pid', 'pkg_mkindex', 'private', 'proc', 'protected', 'public', + 'puts', 'pwd', 're_syntax', 'read', 'regexp', 'registry', 'regsub', + 'rename', 'resource', 'return', 'safe', 'safebase', 'scan', 'scope', 'seek', + 'set', 'socket', 'source', 'split', 'string', 'subst', 'switch', 'tcl', + 'tcl_endofword', 'tcl_findlibrary', 'tcl_startofnextword', + 'tcl_startofpreviousword', 'tcl_wordbreakafter', 'tcl_wordbreakbefore', + 'tcltest', 'tclvars', 'tell', 'then', 'time', 'trace', 'unknown', 'unset', + 'update', 'uplevel', 'upvar', 'variable', 'vwait', 'while' + ); + + SecondTclTkKeys: array[0..91] of UnicodeString = ( + 'bell', 'bind', 'bindidproc', 'bindproc', 'bindtags', 'bitmap', 'button', + 'canvas', 'checkbutton', 'clipboard', 'colors', 'combobox', 'console', + 'cursors', 'debug', 'destroy', 'entry', 'event', 'exp_after', 'exp_before', + 'exp_continue', 'exp_internal', 'exp_send', 'expect', 'focus', 'font', + 'frame', 'grab', 'grid', 'image', 'interact', 'interpreter', 'keysyms', + 'label', 'labelframe', 'listbox', 'loadtk', 'log_file', 'log_user', 'lower', + 'menu', 'menubutton', 'message', 'namespupd', 'option', 'options', 'pack', + 'panedwindow', 'photo', 'place', 'radiobutton', 'raise', 'rgb', 'scale', + 'scrollbar', 'selection', 'send', 'send_error', 'send_log', 'send_tty', + 'send_user', 'sendout', 'sleep', 'spawn', 'spinbox', 'stty', 'text', 'tk', + 'tk_bisque', 'tk_choosecolor', 'tk_choosedirectory', 'tk_dialog', + 'tk_focusfollowsmouse', 'tk_focusnext', 'tk_focusprev', 'tk_getopenfile', + 'tk_getsavefile', 'tk_menusetfocus', 'tk_messagebox', 'tk_optionmenu', + 'tk_popup', 'tk_setpalette', 'tk_textcopy', 'tk_textcut', 'tk_textpaste', + 'tkerror', 'tkvars', 'tkwait', 'toplevel', 'wait', 'winfo', 'wm' + ); + + TixKeys: array[0..43] of UnicodeString = ( + 'compound', 'pixmap', 'tix', 'tixballoon', 'tixbuttonbox', 'tixchecklist', + 'tixcombobox', 'tixcontrol', 'tixdestroy', 'tixdirlist', + 'tixdirselectdialog', 'tixdirtree', 'tixdisplaystyle', 'tixexfileselectbox', + 'tixexfileselectdialog', 'tixfileentry', 'tixfileselectbox', + 'tixfileselectdialog', 'tixform', 'tixgetboolean', 'tixgetint', 'tixgrid', + 'tixhlist', 'tixinputonly', 'tixlabelentry', 'tixlabelframe', + 'tixlistnotebook', 'tixmeter', 'tixmwm', 'tixnbframe', 'tixnotebook', + 'tixoptionmenu', 'tixpanedwindow', 'tixpopupmenu', 'tixscrolledhlist', + 'tixscrolledlistbox', 'tixscrolledtext', 'tixscrolledwindow', 'tixselect', + 'tixstdbuttonbox', 'tixtlist', 'tixtree', 'tixutils', 'tixwish' + ); + + WidgetKeys: array[0..32] of UnicodeString = ( + 'ArrowButton', 'Button', 'ButtonBox', 'BWidget', 'ComboBox', 'Dialog', + 'DragSite', 'DropSite', 'DynamicHelp', 'Entry', 'Label', 'LabelEntry', + 'LabelFrame', 'ListBox', 'MainFrame', 'MessageDlg', 'NoteBook', + 'PagesManager', 'PanedWindow', 'PasswdDlg', 'ProgressBar', 'ProgressDlg', + 'ScrollableFrame', 'ScrollableWindow', 'ScrolledWindow', 'ScrollView', + 'SelectColor', 'SelectFont', 'Separator', 'SpinBox', 'TitleFrame', 'Tree', + 'Widget' + ); + +function TSynTclTkSyn.InternalIsKeyword(const AKeyword: UnicodeString; + KeyWordList: TUnicodeStrings; ACaseSensitive: Boolean = False): Boolean; +var + First, Last, I, Compare: Integer; + Token: UnicodeString; +begin + First := 0; + Last := KeyWordList.Count - 1; + Result := False; + if ACaseSensitive then + Token := AKeyword + else + Token := SynWideLowerCase(AKeyword); + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := WideCompareStr(KeyWordList[i], Token); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; +end; + +function TSynTclTkSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +begin + Result := InternalIsKeyword(AKeyword, FWidgetWords, True) or + InternalIsKeyword(AKeyword, FTixWords) or + InternalIsKeyword(AKeyword, FKeyWords) or + InternalIsKeyword(AKeyword, FSecondKeys); +end; + +constructor TSynTclTkSyn.Create(AOwner: TComponent); +var + i: Integer; +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FKeyWords := TUnicodeStringList.Create; + TUnicodeStringList(FKeyWords).Sorted := True; + TUnicodeStringList(FKeyWords).Duplicates := dupIgnore; + FSecondKeys := TUnicodeStringList.Create; + TUnicodeStringList(FSecondKeys).Sorted := True; + TUnicodeStringList(FSecondKeys).Duplicates := dupIgnore; + FTixWords := TUnicodeStringList.Create; + TUnicodeStringList(FTixWords).Sorted := True; + TUnicodeStringList(FTixWords).Duplicates := dupIgnore; + FWidgetWords := TUnicodeStringList.Create; + TUnicodeStringList(FWidgetWords).Sorted := True; + TUnicodeStringList(FWidgetWords).Duplicates := dupIgnore; + FKeyWords.BeginUpdate; + for i := Low(TclTkKeys) to High(TclTkKeys) do + FKeyWords.Add(TclTkKeys[i]); + FKeyWords.EndUpdate; + FSecondKeys.BeginUpdate; + for i := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do + FSecondKeys.Add(SecondTclTkKeys[i]); + FSecondKeys.EndUpdate; + FTixWords.BeginUpdate; + for i := Low(TixKeys) to High(TixKeys) do + FTixWords.Add(TixKeys[i]); + FTixWords.EndUpdate; + FWidgetWords.BeginUpdate; + for i := Low(WidgetKeys) to High(WidgetKeys) do + FWidgetWords.Add(WidgetKeys[i]); + FWidgetWords.EndUpdate; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + FSecondKeyAttri.Style := [fsBold]; + AddAttribute(FSecondKeyAttri); + + FTixKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrTixKeyWords, SYNS_FriendlyAttrTixKeyWords); + FTixKeyAttri.Style := [fsBold, fsItalic]; + AddAttribute(FTixKeyAttri); + + FWidgetKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrWidgetWords, SYNS_FriendlyAttrWidgetWords); + FWidgetKeyAttri.Style := [fsBold, fsItalic]; + AddAttribute(FWidgetKeyAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + FOptionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrOptions, SYNS_FriendlyAttrOptions); + AddAttribute(FOptionsAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(FVariableAttri); + FPathAttri := TSynHighlighterAttributes.Create(SYNS_AttrPath, SYNS_FriendlyAttrPath); + AddAttribute(FPathAttri); + + FRange := rsUnknown; + FDefaultFilter := SYNS_FilterTclTk; +end; + +destructor TSynTclTkSyn.Destroy; +begin + FWidgetWords.Free; + FTixWords.Free; + FSecondKeys.Free; + FKeyWords.Free; + inherited Destroy; +end; + +procedure TSynTclTkSyn.AnsiProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + if FLine[Run] = '*' then + begin + if FLine[Run + 1] = ')' then + begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end + else + Inc(Run) + end + else + Inc(Run); +end; + +procedure TSynTclTkSyn.PasStyleProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + if FLine[Run] = '}' then + begin + FRange := rsUnknown; + Inc(Run); + Break; + end + else + Inc(Run); +end; + +procedure TSynTclTkSyn.CStyleProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + if FLine[Run] = '*' then + begin + if FLine[Run + 1] = '/' then + begin + FRange := rsUnknown; + Inc(Run, 2); + Break; + end + else Inc(Run) + end + else + Inc(Run); +end; + +procedure TSynTclTkSyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynTclTkSyn.PointCommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynTclTkSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else Inc(Run); + end; +end; + +procedure TSynTclTkSyn.IdentProc; +begin + while IsIdentChar(FLine[Run]) do Inc(Run); + if InternalIsKeyword(GetToken, FWidgetWords, True) then + FTokenID := tkWidgetKey + else if InternalIsKeyword(GetToken, FTixWords) then + FTokenID := tkTixKey + else if InternalIsKeyword(GetToken, FKeyWords) then + FTokenID := tkKey + else if InternalIsKeyword(GetToken, FSecondKeys) then + FTokenID := tkSecondKey + else + FTokenID := tkIdentifier; +end; + +procedure TSynTclTkSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynTclTkSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynTclTkSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynTclTkSyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynTclTkSyn.SlashProc; +begin + if FLine[Run] = '#' then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + begin + FTokenID := tkSymbol; + Inc(Run); + end; +end; + +procedure TSynTclTkSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynTclTkSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then + Inc(Run, 2); + repeat + if IsLineEnd(Run) then Break; + Inc(Run); + until (FLine[Run] = #34) and (FLine[Pred(Run)] <> '\'); + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynTclTkSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnKnown; +end; + +procedure TSynTclTkSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsAnsi: AnsiProc; + rsPasStyle: PasStyleProc; + rsCStyle: CStyleProc; + else + case FLine[Run] of + '-': MinusProc; + '#': SlashProc; + '{': BraceOpenProc; + ';': PointCommaProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + '(': RoundOpenProc; + '/': SlashProc; + '[', ']', ')', '}': SymbolProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #34: StringProc; + '$': VariableProc; + '.': PathProc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynTclTkSyn.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 TSynTclTkSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynTclTkSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynTclTkSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynTclTkSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkSecondKey: Result := FSecondKeyAttri; + tkTixKey: Result := FTixKeyAttri; + tkWidgetKey: Result := FWidgetKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkOptions: Result := FOptionsAttri; + tkVariable: Result := FVariableAttri; + tkPath: Result := FPathAttri; + tkUnknown: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynTclTkSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynTclTkSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynTclTkSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynTclTkSyn.SetKeyWords(const Value: TUnicodeStrings); +var + i: Integer; +begin + if Value <> nil then + begin + Value.BeginUpdate; + for i := 0 to Value.Count - 1 do + Value[i] := SynWideUpperCase(Value[i]); + Value.EndUpdate; + end; + FKeyWords.Assign(Value); + DefHighLightChange(nil); +end; + +procedure TSynTclTkSyn.SetSecondKeys(const Value: TUnicodeStrings); +var + i: Integer; +begin + if Value <> nil then + begin + Value.BeginUpdate; + for i := 0 to Value.Count - 1 do + Value[i] := SynWideUpperCase(Value[i]); + Value.EndUpdate; + end; + FSecondKeys.Assign(Value); + DefHighLightChange(nil); +end; + +function TSynTclTkSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterTclTk; +end; + +class function TSynTclTkSyn.GetLanguageName: string; +begin + Result := SYNS_LangTclTk; +end; + +function TSynTclTkSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; +var + r: TBetterRegistry; +begin + r := TBetterRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKeyReadOnly(Key) then + begin + if r.ValueExists('KeyWords') then KeyWords.Text := r.ReadString('KeyWords'); + Result := inherited LoadFromRegistry(RootKey, Key); + end + else + Result := False; + finally + r.Free; + end; +end; + +function TSynTclTkSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; +var + r: TBetterRegistry; +begin + r:= TBetterRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKey(Key,true) then begin + {$IFNDEF SYN_COMPILER_25_UP} + Result := true; + {$ENDIF} + r.WriteString('KeyWords', KeyWords.Text); + Result := inherited SaveToRegistry(RootKey, Key); + end + else Result := False; + finally + r.Free; + end; +end; + +function TSynTclTkSyn.IsKeywordListStored: Boolean; +var + Keys: TUnicodeStringList; + DefKey: Integer; + Index: Integer; +begin + Keys := TUnicodeStringList.Create; + try + Keys.Assign(KeyWords); + Index := 0; + for DefKey := Low(TclTkKeys) to High(TclTkKeys) do + begin + if not Keys.Find(TclTkKeys[DefKey], Index) then + begin + Result := True; + Exit; + end; + Keys.Delete(Index); + end; + Result := Keys.Count <> 0; + finally + Keys.Free; + end; +end; + +function TSynTclTkSyn.GetSampleSource: UnicodeString; +begin + Result := + '#!/usr/local/tclsh8.0'#13#10 + + 'if {$argc < 2} {'#13#10 + + ' puts stderr "Usage: $argv0 parameter"'#13#10 + + ' exit 1'#13#10 + + '}'; +end; + +class function TSynTclTkSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangTclTk; +end; + +procedure TSynTclTkSyn.MinusProc; +const + EmptyChars = [' ', #9, #0, #10, #13]; +var + OK: Boolean; +begin + OK := False; + Inc(Run); + { minus like symbol } + if CharInSet(FLine[Run], ['0'..'9']) then + FTokenID := tkSymbol + else + { special option -- } + if (FLine[Run] = '-') and CharInSet(FLine[Run + 1], EmptyChars) then + begin + OK := True; + Inc(Run); + end + { normal options -options } + else begin + if CharInSet(FLine[Run], ['a'..'z', 'A'..'Z']) then + begin + Inc(Run); + while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z']) do + Inc(Run); + OK := CharInSet(FLine[Run], EmptyChars); + end + { bad option syntax } + else + while not CharInSet(FLine[Run], EmptyChars) do + Inc(Run); + end; + if OK then + FTokenID := tkOptions + else + FTokenID := tkUnknown; +end; + +procedure TSynTclTkSyn.PathProc; +begin + if CharInSet(FLine[Run + 1], ['a'..'z', 'A'..'Z']) then + begin + FTokenID := tkPath; + Inc(Run); + while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z', '0'..'9']) do Inc(Run); + end + else + begin + FTokenID := tkSymbol; + Inc(Run); + end; +end; + +procedure TSynTclTkSyn.VariableProc; +begin + FTokenID := tkVariable; + Inc(Run); + while CharInSet(FLine[Run], ['_', '0'..'9', 'A'..'Z', 'a'..'z']) do Inc(Run); +end; + +function TSynTclTkSyn.IsSecondKeywordListStored: Boolean; +var + Keys: TUnicodeStringList; + DefKey: Integer; + Index: Integer; +begin + Keys := TUnicodeStringList.Create; + try + Keys.Assign(SecondKeyWords); + Index := 0; + for DefKey := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do + begin + if not Keys.Find(SecondTclTkKeys[DefKey], Index) then + begin + Result := True; + Exit; + end; + Keys.Delete(Index); + end; + Result := Keys.Count <> 0; + finally + Keys.Free; + end; +end; + +procedure TSynTclTkSyn.SymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynTclTkSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterTeX.pas b/Source/VCL/SynEdit/Source/SynHighlighterTeX.pas index 6dae0be6..fddc2309 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterTeX.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterTeX.pas @@ -1,345 +1,347 @@ -{------------------------------------------------------------------------------ -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. - -The Original Code is: SynHighlighterTex.pas, released 2002-09-18. -Author of this file is Soeren Sproessig. -Unicode translation by Maël Hörz. -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: SynHighlighterTeX.pas,v 1.5.2.5 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file from sproessig@bs-webdesign.de - -The unit SynHighlighterTeX provides SynEdit with a TeX highlighter. - -Known Issues: --------------------------------------------------------------------------------} - -unit SynHighlighterTeX; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - Classes; - -type - TtkTokenKind = (tkBrace, tkBracket, tkNull, tkSpace, tkText, tkComment, - tkControlSequence, tkMathMode); - -type - TSynTeXSyn = class(TSynCustomHighlighter) - private - fTokenID: TtkTokenKind; - fTextAttri: TSynHighlighterAttributes; - fControlSequenceAttri: TSynHighlighterAttributes; - fMathmodeAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fBracketAttri: TSynHighlighterAttributes; - fBraceAttri: TSynHighlighterAttributes; - - function CreateHighlighterAttributes(Name: string; FriendlyName: string; - Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; - procedure CRProc; - procedure TextProc; - procedure LFProc; - procedure NullProc; - procedure CommentProc; - procedure SpaceProc; - procedure ControlSequenceProc; - procedure BraceOpenProc; - procedure BraceCloseProc; - procedure BracketOpenProc; - procedure BracketCloseProc; - procedure MathmodeProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri : TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property TextAttri: TSynHighlighterAttributes read fTextAttri - write fTextAttri; - property ControlSequenceAttri: TSynHighlighterAttributes read -fControlSequenceAttri - write fControlSequenceAttri; - property MathmodeAttri: TSynHighlighterAttributes read fMathmodeAttri - write fMathmodeAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property BraceAttri: TSynHighlighterAttributes read fBraceAttri - write fBraceAttri; - property BracketAttri: TSynHighlighterAttributes read fBracketAttri - write fBracketAttri; - end; - -implementation - -uses - SynEditStrConst; - -constructor TSynTeXSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCommentAttri := CreateHighlighterAttributes(SYNS_AttrComment, SYNS_FriendlyAttrComment, clTeal, clNone, []); - AddAttribute(fCommentAttri); - - fTextAttri := CreateHighlighterAttributes(SYNS_AttrText, SYNS_FriendlyAttrText, clBlack, clNone, []); - AddAttribute(fTextAttri); - - fMathmodeAttri := CreateHighlighterAttributes(SYNS_AttrMathmode, SYNS_FriendlyAttrMathmode, clOlive, clNone, - [fsbold]); - AddAttribute(fMathmodeAttri); - - fSpaceAttri := CreateHighlighterAttributes(SYNS_AttrSpace, SYNS_FriendlyAttrSpace, clNone, clWhite, []); - AddAttribute(fSpaceAttri); - - fControlSequenceAttri := CreateHighlighterAttributes(SYNS_AttrTexCommand, SYNS_FriendlyAttrTexCommand, clBlue, - clWhite, [fsBold]); - AddAttribute(fControlSequenceAttri); - - fBracketAttri := CreateHighlighterAttributes(SYNS_AttrSquareBracket, SYNS_FriendlyAttrSquareBracket, clPurple, - clNone, []); - AddAttribute(fBracketAttri); - - fBraceAttri:= CreateHighlighterAttributes(SYNS_AttrRoundBracket, SYNS_FriendlyAttrRoundBracket, clRed, - clNone, [fsBold]); - AddAttribute(fBraceAttri); - - SetAttributesOnChange(DefHighlightChange); - fDefaultFilter := SYNS_FilterTeX; -end; { Create } - -procedure TSynTeXSyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; { CRProc } - - -procedure TSynTeXSyn.SpaceProc; -begin - fTokenID := tkSpace; - inc(Run); - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; { SpaceProc } - -procedure TSynTeXSyn.TextProc; -begin - fTokenID := tkText; - inc(Run); -end; { TextProc } - -procedure TSynTeXSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; { SpaceProc } - -procedure TSynTeXSyn.BraceOpenProc; -begin - fTokenID := tkBrace; - inc(Run); -end; { BraceOpen } - -procedure TSynTeXSyn.BraceCloseProc; -begin - fTokenID := tkBrace; - inc(Run); -end; { BraceClose } - -procedure TSynTeXSyn.BracketOpenProc; -begin - fTokenID := tkBracket; - inc(Run); -end; { BracketOpen } - -procedure TSynTeXSyn.BracketCloseProc; -begin - fTokenID := tkBracket; - inc(Run); -end; { BracketClose } - -procedure TSynTeXSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; { NullProc } - -procedure TSynTeXSyn.CommentProc; -begin - fTokenID := tkComment; - repeat - case fLine[Run] of - #0, #10: Break; - end; - inc(Run); - until fLine[Run] = #13; - Exit; -end; { CommentProc } - -procedure TSynTeXSyn.MathModeProc; -begin - fTokenID := tkMathMode; - Inc(Run); -end; { MathModeProc } - -procedure TSynTeXSyn.ControlSequenceProc; -begin - fTokenID := tkControlSequence; - repeat - case fLine[Run] of - #0..#31: Break; //No Control Chars ! - #48..#57: Break; //No Numbers ! - #33..#47, #58..#64, //Just the Characters that - #91, #93,#94, #123, //only can follow to '\' - #125, #126: - begin - if (fLine[Run-1]='\') then - Inc(Run,1); - Break; - end; - end; - Inc(Run); - until fLine[Run] = #32; - exit; -end; { ControlSequenceProc } - -procedure TSynTeXSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #37: CommentProc; - #92: ControlSequenceProc; - #123: BraceOpenProc; - #125: BraceCloseProc; - #91: BracketOpenProc; - #93: BracketCloseProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #36: MathmodeProc; - else TextProc; - end; - inherited; -end; { Next } - -function TSynTeXSyn.GetDefaultAttribute(Index: integer): - TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - SYN_ATTR_WHITESPACE: Result := fSpaceAttri; - else Result := nil; - end; -end; - -function TSynTeXSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; { GetDefaultAttribute } - -function TSynTeXSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; { GetTokenID } - -function TSynTeXSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkText: Result := fTextAttri; - tkControlSequence: Result := fControlSequenceAttri; - tkMathMode: Result := fMathmodeAttri; - tkSpace: Result := fSpaceAttri; - tkBrace: Result := fBraceAttri; - tkBracket: Result := fBracketAttri; - else - Result := nil; - end; -end; { GetTokenAttribute } - -function TSynTeXSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; { GetTokenKind } - -function TSynTeXSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterTeX; -end; - -class function TSynTeXSyn.GetLanguageName: string; -begin - Result := SYNS_LangTeX; -end; { GetLanguageName } - -function TSynTeXSyn.CreateHighlighterAttributes(Name: string; FriendlyName: string; - Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; -begin - Result := TSynHighlighterAttributes.Create(Name, FriendlyName); - if Foreground <> clNone then Result.Foreground := Foreground; - if Background <> clNone then Result.Background := Background; - Result.Style := FontStyles; -end; - -function TSynTeXSyn.GetSampleSource: string; -begin - Result:='\documentclass[a4paper]{article}'+#13#10+ - '% LaTeX sample source'+#13#10+ - '\begin{document}'+#13#10+ - 'Here is a formula: $ (2x + 3)*5y $'+#13#10+ - '\end{document}'; -end; - -class function TSynTeXSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangTeX; -end; - -initialization - RegisterPlaceableHighlighter(TSynTeXSyn); -end. +{------------------------------------------------------------------------------ +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. + +The Original Code is: SynHighlighterTex.pas, released 2002-09-18. +Author of this file is Soeren Sproessig. +Unicode translation by Maël Hörz. +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: SynHighlighterTeX.pas,v 1.5.2.5 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file from sproessig@bs-webdesign.de + +The unit SynHighlighterTeX provides SynEdit with a TeX highlighter. + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynHighlighterTeX; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + Classes; + +type + TtkTokenKind = (tkBrace, tkBracket, tkNull, tkSpace, tkText, tkComment, + tkControlSequence, tkMathMode); + +type + TSynTeXSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FTextAttri: TSynHighlighterAttributes; + FControlSequenceAttri: TSynHighlighterAttributes; + FMathmodeAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FBracketAttri: TSynHighlighterAttributes; + FBraceAttri: TSynHighlighterAttributes; + + function CreateHighlighterAttributes(Name: string; FriendlyName: UnicodeString; + Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; + procedure CRProc; + procedure TextProc; + procedure LFProc; + procedure NullProc; + procedure CommentProc; + procedure SpaceProc; + procedure ControlSequenceProc; + procedure BraceOpenProc; + procedure BraceCloseProc; + procedure BracketOpenProc; + procedure BracketCloseProc; + procedure MathmodeProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri : TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property TextAttri: TSynHighlighterAttributes read FTextAttri + write FTextAttri; + property ControlSequenceAttri: TSynHighlighterAttributes read FControlSequenceAttri + write FControlSequenceAttri; + property MathmodeAttri: TSynHighlighterAttributes read FMathmodeAttri + write FMathmodeAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property BraceAttri: TSynHighlighterAttributes read FBraceAttri + write FBraceAttri; + property BracketAttri: TSynHighlighterAttributes read FBracketAttri + write FBracketAttri; + end; + +implementation + +uses + SynEditStrConst; + +constructor TSynTeXSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCommentAttri := CreateHighlighterAttributes(SYNS_AttrComment, SYNS_FriendlyAttrComment, clTeal, clNone, []); + AddAttribute(FCommentAttri); + + FTextAttri := CreateHighlighterAttributes(SYNS_AttrText, SYNS_FriendlyAttrText, clBlack, clNone, []); + AddAttribute(FTextAttri); + + FMathmodeAttri := CreateHighlighterAttributes(SYNS_AttrMathmode, SYNS_FriendlyAttrMathmode, clOlive, clNone, + [fsbold]); + AddAttribute(FMathmodeAttri); + + FSpaceAttri := CreateHighlighterAttributes(SYNS_AttrSpace, SYNS_FriendlyAttrSpace, clNone, clWhite, []); + AddAttribute(FSpaceAttri); + + FControlSequenceAttri := CreateHighlighterAttributes(SYNS_AttrTexCommand, SYNS_FriendlyAttrTexCommand, clBlue, + clWhite, [fsBold]); + AddAttribute(FControlSequenceAttri); + + FBracketAttri := CreateHighlighterAttributes(SYNS_AttrSquareBracket, SYNS_FriendlyAttrSquareBracket, clPurple, + clNone, []); + AddAttribute(FBracketAttri); + + FBraceAttri:= CreateHighlighterAttributes(SYNS_AttrRoundBracket, SYNS_FriendlyAttrRoundBracket, clRed, + clNone, [fsBold]); + AddAttribute(FBraceAttri); + + SetAttributesOnChange(DefHighlightChange); + FDefaultFilter := SYNS_FilterTeX; +end; { Create } + +procedure TSynTeXSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else Inc(Run); + end; +end; { CRProc } + + +procedure TSynTeXSyn.SpaceProc; +begin + FTokenID := tkSpace; + Inc(Run); + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; { SpaceProc } + +procedure TSynTeXSyn.TextProc; +begin + FTokenID := tkText; + Inc(Run); +end; { TextProc } + +procedure TSynTeXSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; { SpaceProc } + +procedure TSynTeXSyn.BraceOpenProc; +begin + FTokenID := tkBrace; + Inc(Run); +end; { BraceOpen } + +procedure TSynTeXSyn.BraceCloseProc; +begin + FTokenID := tkBrace; + Inc(Run); +end; { BraceClose } + +procedure TSynTeXSyn.BracketOpenProc; +begin + FTokenID := tkBracket; + Inc(Run); +end; { BracketOpen } + +procedure TSynTeXSyn.BracketCloseProc; +begin + FTokenID := tkBracket; + Inc(Run); +end; { BracketClose } + +procedure TSynTeXSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; { NullProc } + +procedure TSynTeXSyn.CommentProc; +begin + FTokenID := tkComment; + repeat + case fLine[Run] of + #0, #10: Break; + end; + Inc(Run); + until fLine[Run] = #13; + Exit; +end; { CommentProc } + +procedure TSynTeXSyn.MathModeProc; +begin + FTokenID := tkMathMode; + Inc(Run); +end; { MathModeProc } + +procedure TSynTeXSyn.ControlSequenceProc; +begin + FTokenID := tkControlSequence; + repeat + case fLine[Run] of + #0..#31: Break; //No Control Chars ! + #48..#57: Break; //No Numbers ! + #33..#47, #58..#64, //Just the Characters that + #91, #93,#94, #123, //only can follow to '\' + #125, #126: + begin + if (FLine[Run-1] = '\') then + Inc(Run,1); + Break; + end; + end; + Inc(Run); + until fLine[Run] = #32; + Exit; +end; { ControlSequenceProc } + +procedure TSynTeXSyn.Next; +begin + FTokenPos := Run; + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + #37: CommentProc; + #92: ControlSequenceProc; + #123: BraceOpenProc; + #125: BraceCloseProc; + #91: BracketOpenProc; + #93: BracketCloseProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #36: MathmodeProc; + else TextProc; + end; + inherited; +end; { Next } + +function TSynTeXSyn.GetDefaultAttribute(Index: Integer): + TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + else Result := nil; + end; +end; + +function TSynTeXSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; { GetDefaultAttribute } + +function TSynTeXSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; { GetTokenID } + +function TSynTeXSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkText: Result := FTextAttri; + tkControlSequence: Result := FControlSequenceAttri; + tkMathMode: Result := FMathmodeAttri; + tkSpace: Result := FSpaceAttri; + tkBrace: Result := FBraceAttri; + tkBracket: Result := FBracketAttri; + else + Result := nil; + end; +end; { GetTokenAttribute } + +function TSynTeXSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; { GetTokenKind } + +function TSynTeXSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterTeX; +end; + +class function TSynTeXSyn.GetLanguageName: string; +begin + Result := SYNS_LangTeX; +end; { GetLanguageName } + +function TSynTeXSyn.CreateHighlighterAttributes(Name: string; FriendlyName: UnicodeString; + Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; +begin + Result := TSynHighlighterAttributes.Create(Name, FriendlyName); + if Foreground <> clNone then Result.Foreground := Foreground; + if Background <> clNone then Result.Background := Background; + Result.Style := FontStyles; +end; + +function TSynTeXSyn.GetSampleSource: UnicodeString; +begin + Result := + '\documentclass[a4paper]{article}'+#13#10+ + '% LaTeX sample source'+#13#10+ + '\begin{document}'+#13#10+ + 'Here is a formula: $ (2x + 3)*5y $'+#13#10+ + '\end{document}'; +end; + +class function TSynTeXSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangTeX; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynTeXSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterUNIXShellScript.pas b/Source/VCL/SynEdit/Source/SynHighlighterUNIXShellScript.pas index dc290535..557adee1 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterUNIXShellScript.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterUNIXShellScript.pas @@ -1,777 +1,779 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterUNIXShellScript.pas, released 2001-11-13. -The Initial Author of this file is Stefan Ascher. -Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm) -"Heredoc" syntax highlighting implementation by Marko Njezic. -Unicode translation by Maël Hörz. -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: SynHighlighterUNIXShellScript.pas,v 1.7.2.11 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a UNIX Shell Script highlighter for SynEdit) -@author(Stefan Ascher ) -@created(10 November 2001) -@lastmod(2001-11-13) -The SynHighlighterUNIXShellScript unit provides SynEdit with a UNIX Shell Script highlighter. -} - -unit SynHighlighterUNIXShellScript; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey, - tkSpace, tkString, tkSymbol, tkVariable, tkUnknown); - -{$IFDEF SYN_HEREDOC} - TRangeState = (rsUnknown, rsHeredoc, rsIndentedHeredoc); - - TRangePointer = packed record - case Boolean of - True: (Ptr: Pointer); - False: (Range: Byte; Length: Byte; Checksum: Word); - end; -{$ELSE} - TRangeState = (rsUnknown); -{$ENDIF} - -type - TSynUNIXShellScriptSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; -{$IFDEF SYN_HEREDOC} - fHeredocLength: Byte; - fHeredocChecksum: Word; -{$ENDIF} - FTokenID: TtkTokenKind; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fSecondKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fVarAttri: TSynHighlighterAttributes; - procedure BraceOpenProc; - procedure PointCommaProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure RoundOpenProc; - procedure SlashProc; - procedure SpaceProc; - procedure SymbolProc; - procedure StringProc; - procedure UnknownProc; - procedure DollarProc; - procedure DotProc; -{$IFDEF SYN_HEREDOC} - procedure HeredocProc; -{$ENDIF} - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - procedure NextProcedure; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: string): Boolean; override; - function IsSecondKeyWord(AToken: string): Boolean; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: Integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri - write fSecondKeyAttri; - 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 VarAttri: TSynHighlighterAttributes read fVarAttri - write fVarAttri; - end; - -implementation - -uses - SynEditMiscProcs, - SynEditStrConst; - -const - ShellScriptKeys: array[0..109] of string = ( - 'awk', 'banner', 'basename', 'bdiff', 'bg', 'break', 'case', 'cat', 'cc', - 'cd', 'chdir', 'chgrp', 'chmod', 'chown', 'clear', 'compress', 'continue', - 'cp', 'cpio', 'cut', 'date', 'dd', 'df', 'diff', 'do', 'done', 'dtpad', - 'echo', 'elif', 'else', 'esac', 'eval', 'exit', 'export', 'expr', 'fg', - 'fi', 'finger', 'fold', 'for', 'ftp', 'g++', 'gcc', 'getopts', 'grep', - 'gzip', 'hash', 'head', 'if', 'in', 'jobs', 'kill', 'ld', 'ln', 'login', - 'ls', 'make', 'mkdir', 'mt', 'mv', 'newgrp', 'nohup', 'od', 'paste', 'perl', - 'pg', 'ping', 'pr', 'ps', 'pwd', 'rcp', 'read', 'remsh', 'return', 'rm', - 'rsh', 'rwho', 'sed', 'set', 'sh', 'shift', 'stop', 'strings', 'strip', - 'sync', 'tail', 'tar', 'telnet', 'test', 'then', 'times', 'tput', 'trap', - 'true', 'tty', 'type', 'ulimit', 'umask', 'unset', 'until', 'uudecode', - 'uuencode', 'vi', 'wait', 'wc', 'while', 'who', 'xtern', 'zcat', 'zip' - ); - - ShellScriptSecondKeys: array[0..22] of string = ( - 'cdpath', 'editor', 'home', 'ifs', 'lang', 'lc_messages', 'lc_type', - 'ld_library_path', 'logname', 'mail', 'mailcheck', 'mailpath', 'manpath', - 'path', 'ps1', 'ps2', 'pwd', 'shacct', 'shell', 'shlib_path', 'term', - 'termcap', 'tz' - ); - -function TSynUNIXShellScriptSyn.IsKeyword(const AKeyword: string): Boolean; -var - First, Last, I, Compare: Integer; - Token: string; -begin - First := 0; - Last := High(ShellScriptKeys); - Result := False; - Token := SysUtils.AnsiLowerCase(AKeyword); - - while First <= Last do - begin - I := (First + Last) shr 1; - Compare := WideCompareStr(ShellScriptKeys[I], Token); - if Compare = 0 then - begin - Result := True; - break; - end - else - if Compare < 0 then First := I + 1 else Last := I - 1; - end; -end; { IsKeyWord } - -function TSynUNIXShellScriptSyn.IsSecondKeyWord(AToken: string): Boolean; -var - First, Last, I, Compare: Integer; - Token: string; -begin - First := 0; - Last := High(ShellScriptSecondKeys); - Result := False; - Token := SysUtils.AnsiLowerCase(AToken); - while First <= Last do - begin - I := (First + Last) shr 1; - Compare := WideCompareStr(ShellScriptSecondKeys[i], Token); - if Compare = 0 then - begin - Result := True; - break; - end - else - if Compare < 0 then First := I + 1 else Last := I - 1; - end; -end; { IsSecondKeyWord } - -constructor TSynUNIXShellScriptSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fCaseSensitive := False; - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Foreground := clGreen; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Foreground := clNavy; - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - AddAttribute(fSecondKeyAttri); - 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 := clMaroon; - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - fSymbolAttri.Foreground := clRed; - AddAttribute(fSymbolAttri); - fVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - fVarAttri.Foreground := clPurple; - AddAttribute(fVarAttri); - SetAttributesOnChange(DefHighlightChange); - - fRange := rsUnknown; - fDefaultFilter := SYNS_FilterUNIXShellScript; -end; { Create } - -destructor TSynUNIXShellScriptSyn.Destroy; -begin - inherited Destroy; -end; { Destroy } - -procedure TSynUNIXShellScriptSyn.DollarProc; -var - cc: WideChar; -begin - inc(Run); - fTokenID := tkVariable; - if IsLineEnd(Run) then Exit; - cc := FLine[Run]; - inc(Run); - if (cc = '{') then - begin - // ${var} - while IsIdentChar(FLine[Run]) do - begin - if IsLineEnd(Run) then break; - inc(Run); - end; - if FLine[Run] = '}' then Inc(Run); - end - else - // $var - while IsIdentChar(FLine[Run]) do - inc(Run); -end; - -procedure TSynUNIXShellScriptSyn.DotProc; - - function TestDot: Boolean; - var - i: Integer; - begin - result := False; - i := Run; - inc(i); - while CharInSet(FLine[i], ['a'..'z', 'A'..'Z']) do - inc(i); - if i > (Run + 1) then - Result := True; - if Result then - Run := i; - end; - -begin - // Don't highlight filenames like filename.zip - if TestDot then - fTokenID := tkIdentifier - else - begin - inc(Run); - fTokenID := tkSymbol; - end; -end; - -procedure TSynUNIXShellScriptSyn.BraceOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynUNIXShellScriptSyn.PointCommaProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynUNIXShellScriptSyn.CRProc; -begin - fTokenID := tkSpace; - case FLine[Run + 1] of - #10: inc(Run, 2); - else inc(Run); - end; -end; - -procedure TSynUNIXShellScriptSyn.IdentProc; -begin - while IsIdentChar(fLine[Run]) do inc(Run); - if IsKeyWord(GetToken) then - begin - fTokenId := tkKey; - Exit; - end - else - fTokenId := tkIdentifier; - - if IsSecondKeyWord(GetToken) then - fTokenId := tkSecondKey - else if fLine[Run] = '=' then - FTokenID := tkVariable - else - fTokenId := tkIdentifier; -end; - -procedure TSynUNIXShellScriptSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynUNIXShellScriptSyn.LowerProc; -{$IFDEF SYN_HEREDOC} - - // In UNIX Shell, Heredoc delimiter can be pretty much anything and the list - // of alpha-numeric characters is extended with a few common special characters - function IsAlphaNumChar(Run: Integer): Boolean; - begin - case fLine[Run] of - 'A'..'Z', 'a'..'z', '0'..'9', '_', '-', '+', '!', '#', '%': - Result := True; - else - Result := False; - end; - end; - -var - i, Len, SkipRun: Integer; - IndentedHeredoc: Boolean; - QuoteChar: WideChar; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - if FLine[Run + 1] = '<' then - begin - fTokenID := tkSymbol; - - SkipRun := 0; - QuoteChar := #0; - if (FLine[Run + 2] = '-') and (FLine[Run + 3] in - [WideChar('"'), WideChar(''''), WideChar('`'), WideChar('\')]) then - begin - SkipRun := 2; - if FLine[Run + 3] <> '\' then - QuoteChar := FLine[Run + 3]; - end - else if (FLine[Run + 2] in - [WideChar('-'), WideChar('"'), WideChar(''''), WideChar('`'), WideChar('\')]) then - begin - SkipRun := 1; - if not (FLine[Run + 2] in [WideChar('-'), WideChar('\')]) then - QuoteChar := FLine[Run + 2]; - end; - IndentedHeredoc := (SkipRun > 0) and (FLine[Run + 2] = '-'); - - if IsAlphaNumChar(Run + SkipRun + 2) then - begin - inc(Run, 2); - - i := Run; - while IsAlphaNumChar(SkipRun + i) do Inc(i); - Len := i - Run; - - if Len > 255 then - begin - fTokenID := tkUnknown; - Exit; - end; - - if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then - begin - fTokenID := tkUnknown; - Exit; - end; - - if IndentedHeredoc then - fRange := rsIndentedHeredoc - else - fRange := rsHeredoc; - fHeredocLength := Len; - fHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); - - Inc(Run, SkipRun + Len); - fTokenID := tkString; - end - else - inc(Run, 2); - end - else -{$ENDIF} - begin - inc(Run); - fTokenID := tkSymbol; - end; -end; - -procedure TSynUNIXShellScriptSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynUNIXShellScriptSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynUNIXShellScriptSyn.RoundOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynUNIXShellScriptSyn.SlashProc; -begin - if FLine[Run] = '#' then - begin - // Perl Styled Comment - inc(Run); - fTokenID := tkComment; - while not IsLineEnd(Run) do - begin - inc(Run); - end; - end - else - begin - inc(Run); - fTokenID := tkSymbol; - end; -end; - -procedure TSynUNIXShellScriptSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynUNIXShellScriptSyn.StringProc; -var - QuoteChar: WideChar; -begin -// Single and Double Quotes. - - fTokenID := tkString; - QuoteChar := FLine[Run]; // either " or ' - if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) - then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until FLine[Run] = QuoteChar; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynUNIXShellScriptSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -{$IFDEF SYN_HEREDOC} -procedure TSynUNIXShellScriptSyn.HeredocProc; - - procedure SkipToEOL; - begin - case FLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - else - repeat - inc(Run); - until IsLineEnd(Run); - end; - end; - -var - i: Integer; -begin - if IsLineEnd(Run) and (fTokenPos = Run) then - begin - NextProcedure; - Exit; - end; - fTokenID := tkString; - - if fRange = rsIndentedHeredoc then - while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); - - if ((Run = 0) and (fRange = rsHeredoc)) or (fRange = rsIndentedHeredoc) then - begin - i := 0; - - while not IsLineEnd(FLine[Run + i]) do - begin - if i > fHeredocLength then - begin - SkipToEOL; - Exit; - end; - Inc(i); - end; - - if i <> fHeredocLength then - begin - SkipToEOL; - Exit; - end; - - if (CalcFCS(FLine[Run], i) = fHeredocChecksum) then - begin - fRange := rsUnknown; - Run := Run + i; - Exit; - end; - end; - - SkipToEOL; -end; -{$ENDIF} - -procedure TSynUNIXShellScriptSyn.Next; -begin - fTokenPos := Run; -{$IFDEF SYN_HEREDOC} - if fRange in [rsHeredoc, rsIndentedHeredoc] then - HeredocProc - else -{$ENDIF} - NextProcedure; - inherited; -end; - -procedure TSynUNIXShellScriptSyn.NextProcedure; -begin - case fLine[Run] of - '<': LowerProc; - '#': SlashProc; - '{': BraceOpenProc; - ';': PointCommaProc; - '.': DotProc; - #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - #0: NullProc; - '0'..'9': NumberProc; - '(': RoundOpenProc; - '/': SlashProc; - '$': DollarProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #34, #39: StringProc; - '}', ')', '!', '%', '&',':','@','[',']','^','`','~': SymbolProc; - else UnknownProc; - end; -end; - -function TSynUNIXShellScriptSyn.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 TSynUNIXShellScriptSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynUNIXShellScriptSyn.GetRange: Pointer; -{$IFDEF SYN_HEREDOC} -var - RangePointer: TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(fRange); - RangePointer.Length := 0; - RangePointer.Checksum := 0; - if fRange in [rsHeredoc, rsIndentedHeredoc] then - begin - RangePointer.Length := fHeredocLength; - RangePointer.Checksum := fHeredocChecksum; - end; - Result := RangePointer.Ptr; -{$ELSE} - Result := Pointer(fRange); -{$ENDIF} -end; - -function TSynUNIXShellScriptSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynUNIXShellScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkSecondKey: Result := fSecondKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkVariable: Result := fVarAttri; - tkUnknown: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynUNIXShellScriptSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynUNIXShellScriptSyn.ResetRange; -begin - fRange := rsUnknown; -{$IFDEF SYN_HEREDOC} - fHeredocLength := 0; - fHeredocChecksum := 0; -{$ENDIF} -end; - -procedure TSynUNIXShellScriptSyn.SetRange(Value: Pointer); -{$IFDEF SYN_HEREDOC} -var - RangePointer : TRangePointer; -{$ENDIF} -begin -{$IFDEF SYN_HEREDOC} - RangePointer := TRangePointer(Value); - fRange := TRangeState(RangePointer.Range); - fHeredocLength := 0; - fHeredocChecksum := 0; - if fRange in [rsHeredoc, rsIndentedHeredoc] then - begin - fHeredocLength := RangePointer.Length; - fHeredocChecksum := RangePointer.Checksum; - end; -{$ELSE} - fRange := TRangeState(Value); -{$ENDIF} -end; - -function TSynUNIXShellScriptSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterUNIXShellScript; -end; - -class function TSynUNIXShellScriptSyn.GetLanguageName: string; -begin - Result := SYNS_LangNameUNIXShellScript; -end; - -function TSynUNIXShellScriptSyn.GetSampleSource: string; -begin - Result := '######################################'#13#10 + - '# Here is a comment about some stuff #'#13#10 + - '######################################'#13#10 + - ''#13#10 + - 'case $BUILD_MODE in'#13#10 + - ' full )'#13#10 + - ' MyFirstFunction'#13#10 + - ' ;;'#13#10 + - ' rekit)'#13#10 + - ' MySecondFunction'#13#10 + - ' ;;'#13#10 + - ' installer)'#13#10 + - ' MyThirdFunction'#13#10 + - ' ;;'#13#10 + - 'esac'; -end; - -class function TSynUNIXShellScriptSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangNameUNIXShellScript; -end; - -procedure TSynUNIXShellScriptSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -initialization - RegisterPlaceableHighlighter(TSynUNIXShellScriptSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterUNIXShellScript.pas, released 2001-11-13. +The Initial Author of this file is Stefan Ascher. +Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm) +"Heredoc" syntax highlighting implementation by Marko Njezic. +Unicode translation by Maël Hörz. +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: SynHighlighterUNIXShellScript.pas,v 1.7.2.11 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a UNIX Shell Script highlighter for SynEdit) +@author(Stefan Ascher ) +@created(10 November 2001) +@lastmod(2001-11-13) +The SynHighlighterUNIXShellScript unit provides SynEdit with a UNIX Shell Script highlighter. +} + +unit SynHighlighterUNIXShellScript; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSecondKey, + tkSpace, tkString, tkSymbol, tkVariable, tkUnknown); + +{$IFDEF SYN_HEREDOC} + TRangeState = (rsUnknown, rsHeredoc, rsIndentedHeredoc); + + TRangePointer = packed record + case Boolean of + True: (Ptr: Pointer); + False: (Range: Byte; Length: Byte; Checksum: Word); + end; +{$ELSE} + TRangeState = (rsUnknown); +{$ENDIF} + +type + TSynUNIXShellScriptSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; +{$IFDEF SYN_HEREDOC} + FHeredocLength: Byte; + FHeredocChecksum: Word; +{$ENDIF} + FTokenID: TtkTokenKind; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FSecondKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FVarAttri: TSynHighlighterAttributes; + procedure BraceOpenProc; + procedure PointCommaProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure RoundOpenProc; + procedure SlashProc; + procedure SpaceProc; + procedure SymbolProc; + procedure StringProc; + procedure UnknownProc; + procedure DollarProc; + procedure DotProc; +{$IFDEF SYN_HEREDOC} + procedure HeredocProc; +{$ENDIF} + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + procedure NextProcedure; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function IsKeyword(const AKeyword: UnicodeString): Boolean; override; + function IsSecondKeyWord(AToken: UnicodeString): Boolean; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri + write FSecondKeyAttri; + 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 VarAttri: TSynHighlighterAttributes read FVarAttri + write FVarAttri; + end; + +implementation + +uses + SynEditMiscProcs, + SynEditStrConst; + +const + ShellScriptKeys: array[0..109] of UnicodeString = ( + 'awk', 'banner', 'basename', 'bdiff', 'bg', 'break', 'case', 'cat', 'cc', + 'cd', 'chdir', 'chgrp', 'chmod', 'chown', 'clear', 'compress', 'continue', + 'cp', 'cpio', 'cut', 'date', 'dd', 'df', 'diff', 'do', 'done', 'dtpad', + 'echo', 'elif', 'else', 'esac', 'eval', 'exit', 'export', 'expr', 'fg', + 'fi', 'finger', 'fold', 'for', 'ftp', 'g++', 'gcc', 'getopts', 'grep', + 'gzip', 'hash', 'head', 'if', 'in', 'jobs', 'kill', 'ld', 'ln', 'login', + 'ls', 'make', 'mkdir', 'mt', 'mv', 'newgrp', 'nohup', 'od', 'paste', 'perl', + 'pg', 'ping', 'pr', 'ps', 'pwd', 'rcp', 'read', 'remsh', 'return', 'rm', + 'rsh', 'rwho', 'sed', 'set', 'sh', 'shift', 'stop', 'strings', 'strip', + 'sync', 'tail', 'tar', 'telnet', 'test', 'then', 'times', 'tput', 'trap', + 'true', 'tty', 'type', 'ulimit', 'umask', 'unset', 'until', 'uudecode', + 'uuencode', 'vi', 'wait', 'wc', 'while', 'who', 'xtern', 'zcat', 'zip' + ); + + ShellScriptSecondKeys: array[0..22] of UnicodeString = ( + 'cdpath', 'editor', 'home', 'ifs', 'lang', 'lc_messages', 'lc_type', + 'ld_library_path', 'logname', 'mail', 'mailcheck', 'mailpath', 'manpath', + 'path', 'ps1', 'ps2', 'pwd', 'shacct', 'shell', 'shlib_path', 'term', + 'termcap', 'tz' + ); + +function TSynUNIXShellScriptSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +var + First, Last, I, Compare: Integer; + Token: UnicodeString; +begin + First := 0; + Last := High(ShellScriptKeys); + Result := False; + Token := SynWideLowerCase(AKeyword); + + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := WideCompareStr(ShellScriptKeys[I], Token); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; +end; { IsKeyWord } + +function TSynUNIXShellScriptSyn.IsSecondKeyWord(AToken: UnicodeString): Boolean; +var + First, Last, I, Compare: Integer; + Token: UnicodeString; +begin + First := 0; + Last := High(ShellScriptSecondKeys); + Result := False; + Token := SynWideLowerCase(AToken); + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := WideCompareStr(ShellScriptSecondKeys[i], Token); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; +end; { IsSecondKeyWord } + +constructor TSynUNIXShellScriptSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCaseSensitive := False; + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clGreen; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Foreground := clNavy; + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + AddAttribute(FSecondKeyAttri); + 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 := clMaroon; + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + FSymbolAttri.Foreground := clRed; + AddAttribute(FSymbolAttri); + FVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + FVarAttri.Foreground := clPurple; + AddAttribute(FVarAttri); + SetAttributesOnChange(DefHighlightChange); + + FRange := rsUnknown; + FDefaultFilter := SYNS_FilterUNIXShellScript; +end; { Create } + +destructor TSynUNIXShellScriptSyn.Destroy; +begin + inherited Destroy; +end; { Destroy } + +procedure TSynUNIXShellScriptSyn.DollarProc; +var + cc: WideChar; +begin + Inc(Run); + FTokenID := tkVariable; + if IsLineEnd(Run) then Exit; + cc := FLine[Run]; + Inc(Run); + if (cc = '{') then + begin + // ${var} + while IsIdentChar(FLine[Run]) do + begin + if IsLineEnd(Run) then Break; + Inc(Run); + end; + if FLine[Run] = '}' then Inc(Run); + end + else + // $var + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynUNIXShellScriptSyn.DotProc; + + function TestDot: Boolean; + var + i: Integer; + begin + Result := False; + i := Run; + Inc(i); + while CharInSet(FLine[i], ['a'..'z', 'A'..'Z']) do + Inc(i); + if i > (Run + 1) then + Result := True; + if Result then + Run := i; + end; + +begin + // Don't highlight filenames like filename.zip + if TestDot then + FTokenID := tkIdentifier + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynUNIXShellScriptSyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynUNIXShellScriptSyn.PointCommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynUNIXShellScriptSyn.CRProc; +begin + FTokenID := tkSpace; + case FLine[Run + 1] of + #10: Inc(Run, 2); + else Inc(Run); + end; +end; + +procedure TSynUNIXShellScriptSyn.IdentProc; +begin + while IsIdentChar(FLine[Run]) do Inc(Run); + if IsKeyWord(GetToken) then + begin + FTokenID := tkKey; + Exit; + end + else + FTokenID := tkIdentifier; + + if IsSecondKeyWord(GetToken) then + FTokenID := tkSecondKey + else if fLine[Run] = '=' then + FTokenID := tkVariable + else + FTokenID := tkIdentifier; +end; + +procedure TSynUNIXShellScriptSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynUNIXShellScriptSyn.LowerProc; +{$IFDEF SYN_HEREDOC} + + // In UNIX Shell, Heredoc delimiter can be pretty much anything and the list + // of alpha-numeric characters is extended with a few common special characters + function IsAlphaNumChar(Run: Integer): Boolean; + begin + case fLine[Run] of + 'A'..'Z', 'a'..'z', '0'..'9', '_', '-', '+', '!', '#', '%': + Result := True; + else + Result := False; + end; + end; + +var + i, Len, SkipRun: Integer; + IndentedHeredoc: Boolean; + QuoteChar: WideChar; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + if FLine[Run + 1] = '<' then + begin + FTokenID := tkSymbol; + + SkipRun := 0; + QuoteChar := #0; + if (FLine[Run + 2] = '-') and (FLine[Run + 3] in + [WideChar('"'), WideChar(''''), WideChar('`'), WideChar('\')]) then + begin + SkipRun := 2; + if FLine[Run + 3] <> '\' then + QuoteChar := FLine[Run + 3]; + end + else if (FLine[Run + 2] in + [WideChar('-'), WideChar('"'), WideChar(''''), WideChar('`'), WideChar('\')]) then + begin + SkipRun := 1; + if not (FLine[Run + 2] in [WideChar('-'), WideChar('\')]) then + QuoteChar := FLine[Run + 2]; + end; + IndentedHeredoc := (SkipRun > 0) and (FLine[Run + 2] = '-'); + + if IsAlphaNumChar(Run + SkipRun + 2) then + begin + Inc(Run, 2); + + i := Run; + while IsAlphaNumChar(SkipRun + i) do Inc(i); + Len := i - Run; + + if Len > 255 then + begin + FTokenID := tkUnknown; + Exit; + end; + + if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then + begin + FTokenID := tkUnknown; + Exit; + end; + + if IndentedHeredoc then + FRange := rsIndentedHeredoc + else + FRange := rsHeredoc; + FHeredocLength := Len; + FHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); + + Inc(Run, SkipRun + Len); + FTokenID := tkString; + end + else + Inc(Run, 2); + end + else +{$ENDIF} + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynUNIXShellScriptSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynUNIXShellScriptSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case fLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; +end; + +procedure TSynUNIXShellScriptSyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynUNIXShellScriptSyn.SlashProc; +begin + if FLine[Run] = '#' then + begin + // Perl Styled Comment + Inc(Run); + FTokenID := tkComment; + while not IsLineEnd(Run) do + begin + Inc(Run); + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynUNIXShellScriptSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynUNIXShellScriptSyn.StringProc; +var + QuoteChar: WideChar; +begin +// Single and Double Quotes. + + FTokenID := tkString; + QuoteChar := FLine[Run]; // either " or ' + if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) + then Inc(Run, 2); + repeat + if IsLineEnd(Run) then Break; + Inc(Run); + until FLine[Run] = QuoteChar; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynUNIXShellScriptSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +{$IFDEF SYN_HEREDOC} +procedure TSynUNIXShellScriptSyn.HeredocProc; + + procedure SkipToEOL; + begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + repeat + Inc(Run); + until IsLineEnd(Run); + end; + end; + +var + i: Integer; +begin + if IsLineEnd(Run) and (FTokenPos = Run) then + begin + NextProcedure; + Exit; + end; + FTokenID := tkString; + + if FRange = rsIndentedHeredoc then + while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); + + if ((Run = 0) and (FRange = rsHeredoc)) or (FRange = rsIndentedHeredoc) then + begin + i := 0; + + while not IsLineEnd(FLine[Run + i]) do + begin + if i > FHeredocLength then + begin + SkipToEOL; + Exit; + end; + Inc(i); + end; + + if i <> FHeredocLength then + begin + SkipToEOL; + Exit; + end; + + if (CalcFCS(FLine[Run], i) = FHeredocChecksum) then + begin + FRange := rsUnknown; + Run := Run + i; + Exit; + end; + end; + + SkipToEOL; +end; +{$ENDIF} + +procedure TSynUNIXShellScriptSyn.Next; +begin + FTokenPos := Run; +{$IFDEF SYN_HEREDOC} + if FRange in [rsHeredoc, rsIndentedHeredoc] then + HeredocProc + else +{$ENDIF} + NextProcedure; + inherited; +end; + +procedure TSynUNIXShellScriptSyn.NextProcedure; +begin + case fLine[Run] of + '<': LowerProc; + '#': SlashProc; + '{': BraceOpenProc; + ';': PointCommaProc; + '.': DotProc; + #13: CRProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + #0: NullProc; + '0'..'9': NumberProc; + '(': RoundOpenProc; + '/': SlashProc; + '$': DollarProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #34, #39: StringProc; + '}', ')', '!', '%', '&',':','@','[',']','^','`','~': SymbolProc; + else UnknownProc; + end; +end; + +function TSynUNIXShellScriptSyn.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 TSynUNIXShellScriptSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynUNIXShellScriptSyn.GetRange: Pointer; +{$IFDEF SYN_HEREDOC} +var + RangePointer: TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer.Range := Ord(FRange); + RangePointer.Length := 0; + RangePointer.Checksum := 0; + if FRange in [rsHeredoc, rsIndentedHeredoc] then + begin + RangePointer.Length := FHeredocLength; + RangePointer.Checksum := FHeredocChecksum; + end; + Result := RangePointer.Ptr; +{$ELSE} + Result := Pointer(FRange); +{$ENDIF} +end; + +function TSynUNIXShellScriptSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynUNIXShellScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkSecondKey: Result := FSecondKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkVariable: Result := FVarAttri; + tkUnknown: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynUNIXShellScriptSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynUNIXShellScriptSyn.ResetRange; +begin + FRange := rsUnknown; +{$IFDEF SYN_HEREDOC} + FHeredocLength := 0; + FHeredocChecksum := 0; +{$ENDIF} +end; + +procedure TSynUNIXShellScriptSyn.SetRange(Value: Pointer); +{$IFDEF SYN_HEREDOC} +var + RangePointer : TRangePointer; +{$ENDIF} +begin +{$IFDEF SYN_HEREDOC} + RangePointer := TRangePointer(Value); + FRange := TRangeState(RangePointer.Range); + FHeredocLength := 0; + FHeredocChecksum := 0; + if FRange in [rsHeredoc, rsIndentedHeredoc] then + begin + FHeredocLength := RangePointer.Length; + FHeredocChecksum := RangePointer.Checksum; + end; +{$ELSE} + FRange := TRangeState(Value); +{$ENDIF} +end; + +function TSynUNIXShellScriptSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterUNIXShellScript; +end; + +class function TSynUNIXShellScriptSyn.GetLanguageName: string; +begin + Result := SYNS_LangNameUNIXShellScript; +end; + +function TSynUNIXShellScriptSyn.GetSampleSource: UnicodeString; +begin + Result := '######################################'#13#10 + + '# Here is a comment about some stuff #'#13#10 + + '######################################'#13#10 + + ''#13#10 + + 'case $BUILD_MODE in'#13#10 + + ' full )'#13#10 + + ' MyFirstFunction'#13#10 + + ' ;;'#13#10 + + ' rekit)'#13#10 + + ' MySecondFunction'#13#10 + + ' ;;'#13#10 + + ' installer)'#13#10 + + ' MyThirdFunction'#13#10 + + ' ;;'#13#10 + + 'esac'; +end; + +class function TSynUNIXShellScriptSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangNameUNIXShellScript; +end; + +procedure TSynUNIXShellScriptSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynUNIXShellScriptSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterURI.pas b/Source/VCL/SynEdit/Source/SynHighlighterURI.pas index 101f8a65..afd076ad 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterURI.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterURI.pas @@ -1,703 +1,709 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterURI.pas, released 2003-04-10. -The initial author of this file is Maël Hörz. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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. - --------------------------------------------------------------------------------} -{ -@abstract(Provides an URI syntax highlighter for SynEdit) -@author(Maël Hörz) -@created(2003) -@lastmod(2004-03-19) -http://www.mh-net.de.vu - -The SynHighlighterURI unit implements an URI syntax highlighter for SynEdit. - -Recognition of URIs is based on the information provided in the document -"Uniform Resource Identifiers (URI): Generic Syntax" of "The Internet Society", -that can be found at http://www.ietf.org/rfc/rfc2396.txt. - -Also interesting is http://www.freesoft.org/CIE/RFC/1738/33.htm which describes -general URL syntax and major protocols. - -these protocols are recognized: -------------------------------- -http:// -https:// -ftp:// -mailto: -news: or news:// -nntp:// -telnet:// -gopher:// -prospero:// -wais:// - -as well as commonly used shorthands: ------------------------------------- -someone@somewhere.org -www.host.org -} - -unit SynHighlighterURI; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkNull, tkSpace, tkFtpLink, tkGopherLink, - tkHttpLink, tkHttpsLink, tkMailtoLink, tkNewsLink, tkNntpLink, - tkProsperoLink, tkTelnetLink, tkWaisLink, tkWebLink, tkUnknown, tkNullChar); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Key: Integer): TtkTokenKind of object; - - TAlreadyVisitedURIFunc = function (URI: string): Boolean of object; - - TSynURISyn = class(TSynCustomHighlighter) - private - fMayBeProtocol: PWideChar; - fTokenID: TtkTokenKind; - fIdentFuncTable: array[0..15] of TIdentFuncTableFunc; - fIdentifierAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fURIAttri: TSynHighlighterAttributes; - fVisitedURIAttri: TSynHighlighterAttributes; - fAlreadyVisitedURI: TAlreadyVisitedURIFunc; - - function HashKey(Str: PWideChar): Integer; - procedure InitIdent; - - procedure CRProc; - procedure LFProc; - procedure NullProc; - procedure ProtocolProc; - procedure SpaceProc; - procedure UnknownProc; - - function AltFunc(Key: Integer): TtkTokenKind; - function FuncFtp(Key: Integer): TtkTokenKind; - function FuncGopher(Key: Integer): TtkTokenKind; - function FuncHttp(Key: Integer): TtkTokenKind; - function FuncHttps(Key: Integer): TtkTokenKind; - function FuncMailto(Key: Integer): TtkTokenKind; - function FuncNews(Key: Integer): TtkTokenKind; - function FuncNntp(Key: Integer): TtkTokenKind; - function FuncProspero(Key: Integer): TtkTokenKind; - function FuncTelnet(Key: Integer): TtkTokenKind; - function FuncWais(Key: Integer): TtkTokenKind; - function FuncWeb(Key: Integer): TtkTokenKind; - - function IsAlphaNum(AChar: WideChar): Boolean; - function IsMark(AChar: WideChar): Boolean; - function IsReserved(AChar: WideChar): Boolean; - function IsUnreserved(AChar: WideChar): Boolean; - function IsURIChar(AChar: WideChar): Boolean; - function IsNeverAtEnd(AChar: WideChar): Boolean; - function IsEMailAddressChar(AChar: WideChar): Boolean; - function IsNeverAtEMailAddressEnd(AChar: WideChar): Boolean; - - function IsValidEmailAddress: Boolean; - function IsValidURI: Boolean; - function IsValidWebLink: Boolean; - - procedure SetURIAttri(const Value: TSynHighlighterAttributes); - procedure SetVisitedURIAttri(const Value: TSynHighlighterAttributes); - protected - function GetSampleSource: string; override; - function IsCurrentToken(const Token: string): Boolean; override; - function IsFilterStored: Boolean; override; - procedure SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: Integer; override; - function IsIdentChar(AChar: WideChar): Boolean; override; - procedure Next; override; - published - property URIAttri: TSynHighlighterAttributes read fURIAttri write SetURIAttri; - property VisitedURIAttri: TSynHighlighterAttributes read fVisitedURIAttri - write SetVisitedURIAttri; - end; - -const - SYN_ATTR_URI = 6; - SYN_ATTR_VISITEDURI = 7; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..15] of string = ( - '', 'http://', '', 'https://', 'news:', 'gopher://', '', 'prospero://', - 'news://', 'www', 'nntp://', 'ftp://', 'wais://', '', 'telnet://', 'mailto:' - ); - -function TSynURISyn.HashKey(Str: PWideChar): Integer; -begin - Result := 0; - while CharInSet(Str^, ['A'..'Z', 'a'..'z']) do - begin - Result := (Result * 3 + Ord(Str^) div 9) mod 16; - inc(Str); - end; - - if Str^ = ':' then - begin - Result := (Result * 3 + Ord(Str^) div 9) mod 16; - inc(Str); - end; - - if Str^ = '/' then - begin - Result := (Result * 3 + Ord(Str^) div 9) mod 16; - inc(Str); - end; - - if Str^ = '/' then - begin - Result := (Result * 3 + Ord(Str^) div 9) mod 16; - inc(Str); - end; - - fStringLen := Str - fMayBeProtocol; -end; - -procedure TSynURISyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[11] := FuncFtp; - fIdentFuncTable[5] := FuncGopher; - fIdentFuncTable[1] := FuncHttp; - fIdentFuncTable[3] := FuncHttps; - fIdentFuncTable[15] := FuncMailto; - fIdentFuncTable[4] := FuncNews; - fIdentFuncTable[8] := FuncNews; - fIdentFuncTable[10] := FuncNntp; - fIdentFuncTable[7] := FuncProspero; - fIdentFuncTable[14] := FuncTelnet; - fIdentFuncTable[12] := FuncWais; - fIdentFuncTable[9] := FuncWeb; -end; - -function TSynURISyn.IsCurrentToken(const Token: string): Boolean; -var - I: Integer; - Temp: PWideChar; -begin - Temp := fMayBeProtocol; - if Length(Token) = fStringLen then - begin - Result := True; - for i := 1 to fStringLen do - begin - if Temp^ <> Token[i] then - begin - Result := False; - break; - end; - inc(Temp); - end; - end - else - Result := False; -end; - -function TSynURISyn.AltFunc(Key: Integer): TtkTokenKind; -begin - Result := tkUnknown; -end; - -constructor TSynURISyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - fCaseSensitive := False; - - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - - fURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrURI, SYNS_FriendlyAttrURI); - fURIAttri.Foreground := clBlue; - fURIAttri.Style := [fsUnderline]; - AddAttribute(fURIAttri); - - fVisitedURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrVisitedURI, SYNS_FriendlyAttrVisitedURI); - fVisitedURIAttri.Foreground := clPurple; - fVisitedURIAttri.Style := [fsUnderline]; - AddAttribute(fVisitedURIAttri); - - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterURI; -end; - -destructor TSynURISyn.Destroy; -begin - inherited; - //the other attributes are automatically freed because of AddAttribute() - fSpaceAttri.Free; - fIdentifierAttri.Free; -end; - -procedure TSynURISyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then - Inc(Run); -end; - -procedure TSynURISyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynURISyn.NullProc; -begin - if Run < fLineLen + 1 then - begin - inc(Run); - fTokenID := tkNullChar; - end - else - fTokenID := tkNull -end; - -procedure TSynURISyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynURISyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynURISyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #13: CRProc; - #10: LFProc; - #0: NullProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - 'A'..'Z', 'a'..'z': ProtocolProc; - else - UnknownProc; - end; - inherited; -end; - -function TSynURISyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; - SYN_ATTR_WHITESPACE: Result := fSpaceAttri; - SYN_ATTR_URI: Result := fURIAttri; - SYN_ATTR_VISITEDURI: Result := fVisitedURIAttri; - else - Result := nil; - end; -end; - -function TSynURISyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynURISyn.GetTokenAttribute: TSynHighlighterAttributes; -var - Visited: Boolean; -begin - case GetTokenID of - tkSpace: Result := fSpaceAttri; - tkFtpLink, tkGopherLink, tkHttpLink, tkHttpsLink, tkMailtoLink, tkNewsLink, - tkNntpLink, tkProsperoLink, tkTelnetLink, tkWaisLink, tkWebLink: - begin - Visited := False; - if Assigned(FAlreadyVisitedURI) then - Visited := FAlreadyVisitedURI(GetToken); - if Visited then - Result := fVisitedURIAttri - else - Result := fURIAttri; - end; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynURISyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynURISyn.GetTokenKind: Integer; -begin - Result := Ord(fTokenId); -end; - -class function TSynURISyn.GetLanguageName: string; -begin - Result := SYNS_LangURI; -end; - -function TSynURISyn.GetSampleSource: string; -begin - Result := 'Universal Resource Identifier highlighting'#13#10#13#10 + - 'http://www.somewhere.org'#13#10 + - 'ftp://superhost.org/downloads/gems.zip'#13#10 + - 'www.w3c.org'#13#10 + - 'mailto:big@lebowski.edu'#13#10 + - 'douglas@adams.lod'#13#10 + - 'news:comp.lang.pascal.borland'; -end; - -function TSynURISyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterURI; -end; - -function TSynURISyn.IsIdentChar(AChar: WideChar): Boolean; -begin - Result := IsCharAlphaNumeric(AChar); -end; - -procedure TSynURISyn.SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); -begin - FAlreadyVisitedURI := Value; -end; - -procedure TSynURISyn.SetURIAttri(const Value: TSynHighlighterAttributes); -begin - fURIAttri.Assign(Value); -end; - -procedure TSynURISyn.SetVisitedURIAttri(const Value: TSynHighlighterAttributes); -begin - fVisitedURIAttri.Assign(Value); -end; - -procedure TSynURISyn.ProtocolProc; -var - Key: Integer; -begin - if IsValidEmailAddress then - fTokenID := tkMailtoLink - else - begin - fMayBeProtocol := fLine + Run; - Key := HashKey(fMayBeProtocol); - inc(Run, fStringLen); - - if Key <= 15 then - fTokenID := fIdentFuncTable[Key](Key) - else - fTokenID := tkUnknown; - end; -end; - -function TSynURISyn.FuncFtp(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkFtpLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncGopher(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkGopherLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncHttp(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkHttpLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncHttps(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkHttpsLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncMailto(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkMailtoLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncNews(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkNewsLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncNntp(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkNntpLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncProspero(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkProsperoLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncTelnet(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkTelnetLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncWais(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidURI then - Result := tkWaisLink - else - Result := tkUnknown; -end; - -function TSynURISyn.FuncWeb(Key: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Key]) and IsValidWebLink then - Result := tkWebLink - else - Result := tkUnknown; -end; - - -function TSynURISyn.IsAlphaNum(AChar: WideChar): Boolean; -begin - Result := IsCharAlphaNumeric(AChar); -end; - -function TSynURISyn.IsMark(AChar: WideChar): Boolean; -begin - case AChar of - '-', '_', '.', '!', '~', '*', '''', '(' , ')': - Result := True; - else - Result := False; - end; -end; - -function TSynURISyn.IsReserved(AChar: WideChar): Boolean; -begin - case AChar of - ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '%', '#': - Result := True; - else - Result := False; - end; -end; - -function TSynURISyn.IsUnreserved(AChar: WideChar): Boolean; -begin - Result := IsAlphaNum(AChar) or IsMark(AChar); -end; - -function TSynURISyn.IsURIChar(AChar: WideChar): Boolean; -begin - Result := IsReserved(AChar) or IsUnreserved(AChar); -end; - -function TSynURISyn.IsNeverAtEnd(AChar: WideChar): Boolean; -begin - Result := (IsMark(AChar) and (AChar <> '''')) or - (IsReserved(AChar) and (AChar <> '/') and (AChar <> '$')); -end; - -function TSynURISyn.IsEMailAddressChar(AChar: WideChar): Boolean; -begin - case AChar of - '.', '_', '-', '@': - Result := True; - else - Result := IsAlphaNum(AChar); - end; -end; - -function TSynURISyn.IsNeverAtEMailAddressEnd(AChar: WideChar): Boolean; -begin - Result := (AChar = '.') or (AChar = '@'); -end; - -function TSynURISyn.IsValidEmailAddress: Boolean; -var - StartPos, AtPos, DotPos: Integer; -begin - StartPos := Run; - - AtPos := -1; - DotPos := -1; - while IsEMailAddressChar(fLine[Run]) do - begin - if fLine[Run] = '@' then - AtPos := Run - else if fLine[Run] = '.' then - // reject array of dots: "neighbour" dots are not allowed - if (Run = StartPos) or (DotPos >= 0) and (DotPos = Run - 1) then - break - else - DotPos := Run; - Inc(Run); - end; - - while (Run > StartPos) and (IsNeverAtEMailAddressEnd(fLine[Run - 1])) do - dec(Run); - - while (DotPos >= Run) or (DotPos > -1) and (fLine[DotPos] <> '.') do - Dec(DotPos); - - Result := (StartPos < AtPos) and (AtPos < Run - 1) and (DotPos > AtPos + 1); - if not Result then Run := StartPos; -end; - -function TSynURISyn.IsValidURI: Boolean; -var - ProtocolEndPos, DotPos: Integer; - - function IsRelativePath: Boolean; - begin - Result := (DotPos - 1 >= 0) and - ((fLine[DotPos - 1] = '/') and (fLine[DotPos + 2] = '/')) or - ((fLine[DotPos - 1] = '\') and (fLine[DotPos + 2] = '\')); - end; - -begin - ProtocolEndPos := Run; - - DotPos := -1; - while IsURIChar(fLine[Run]) do - begin - if fLine[Run] = '.' then - // reject array of dots: "neighbour" dots are not allowed - if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then - break - else - DotPos := Run; - inc(Run); - end; - - while (Run > ProtocolEndPos) and IsNeverAtEnd(fLine[Run - 1]) do - dec(Run); - - Result := Run > ProtocolEndPos; -end; - -function TSynURISyn.IsValidWebLink: Boolean; -var - WWWEndPos, DotPos, SecondDotPos: Integer; - - function IsRelativePath: Boolean; - begin - Result := (DotPos - 1 >= 0) and - ((fLine[DotPos - 1] = '/') and (fLine[DotPos + 2] = '/')) or - ((fLine[DotPos - 1] = '\') and (fLine[DotPos + 2] = '\')); - end; - -begin - WWWEndPos := Run; - - DotPos := -1; - SecondDotPos := -1; - while IsURIChar(fLine[Run]) do - begin - if fLine[Run] = '.' then - // reject array of dots: "neighbour" dots are not allowed - if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then - break - else - begin - DotPos := Run; - if SecondDotPos = -2 then SecondDotPos := DotPos; - if SecondDotPos = -1 then SecondDotPos := -2; - end; - inc(Run); - end; - - while (Run > WWWEndPos) and IsNeverAtEnd(fLine[Run - 1]) do - dec(Run); - - Result := (Run > WWWEndPos) and (fLine[WWWEndPos] = '.') and - (SecondDotPos > WWWEndPos + 1) and (SecondDotPos < Run); -end; - -class function TSynURISyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangURI; -end; - -initialization - RegisterPlaceableHighlighter(TSynURISyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterURI.pas, released 2003-04-10. +The initial author of this file is Maël Hörz. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynHighlighterURI.pas,v 1.16.2.9 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of SynEdit from the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} +{ +@abstract(Provides an URI syntax highlighter for SynEdit) +@author(Maël Hörz) +@created(2003) +@lastmod(2004-03-19) +http://www.mh-net.de.vu + +The SynHighlighterURI unit implements an URI syntax highlighter for SynEdit. + +Recognition of URIs is based on the information provided in the document +"Uniform Resource Identifiers (URI): Generic Syntax" of "The Internet Society", +that can be found at http://www.ietf.org/rfc/rfc2396.txt. + +Also interesting is http://www.freesoft.org/CIE/RFC/1738/33.htm which describes +general URL syntax and major protocols. + +these protocols are recognized: +------------------------------- +http:// +https:// +ftp:// +mailto: +news: or news:// +nntp:// +telnet:// +gopher:// +prospero:// +wais:// + +as well as commonly used shorthands: +------------------------------------ +someone@somewhere.org +www.host.org +} + +unit SynHighlighterURI; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkNull, tkSpace, tkFtpLink, tkGopherLink, + tkHttpLink, tkHttpsLink, tkMailtoLink, tkNewsLink, tkNntpLink, + tkProsperoLink, tkTelnetLink, tkWaisLink, tkWebLink, tkUnknown, tkNullChar); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Key: Integer): TtkTokenKind of object; + + TAlreadyVisitedURIFunc = function (URI: UnicodeString): Boolean of object; + + TSynURISyn = class(TSynCustomHighlighter) + private + FMayBeProtocol: PWideChar; + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..15] of TIdentFuncTableFunc; + FIdentifierAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FURIAttri: TSynHighlighterAttributes; + FVisitedURIAttri: TSynHighlighterAttributes; + FAlreadyVisitedURI: TAlreadyVisitedURIFunc; + + function HashKey(Str: PWideChar): Integer; + procedure InitIdent; + + procedure CRProc; + procedure LFProc; + procedure NullProc; + procedure ProtocolProc; + procedure SpaceProc; + procedure UnknownProc; + + function AltFunc(Key: Integer): TtkTokenKind; + function FuncFtp(Key: Integer): TtkTokenKind; + function FuncGopher(Key: Integer): TtkTokenKind; + function FuncHttp(Key: Integer): TtkTokenKind; + function FuncHttps(Key: Integer): TtkTokenKind; + function FuncMailto(Key: Integer): TtkTokenKind; + function FuncNews(Key: Integer): TtkTokenKind; + function FuncNntp(Key: Integer): TtkTokenKind; + function FuncProspero(Key: Integer): TtkTokenKind; + function FuncTelnet(Key: Integer): TtkTokenKind; + function FuncWais(Key: Integer): TtkTokenKind; + function FuncWeb(Key: Integer): TtkTokenKind; + + function IsAlphaNum(AChar: WideChar): Boolean; + function IsMark(AChar: WideChar): Boolean; + function IsReserved(AChar: WideChar): Boolean; + function IsUnreserved(AChar: WideChar): Boolean; + function IsURIChar(AChar: WideChar): Boolean; + function IsNeverAtEnd(AChar: WideChar): Boolean; + function IsEMailAddressChar(AChar: WideChar): Boolean; + function IsNeverAtEMailAddressEnd(AChar: WideChar): Boolean; + + function IsValidEmailAddress: Boolean; + function IsValidURI: Boolean; + function IsValidWebLink: Boolean; + + procedure SetURIAttri(const Value: TSynHighlighterAttributes); + procedure SetVisitedURIAttri(const Value: TSynHighlighterAttributes); + protected + function GetSampleSource: UnicodeString; override; + function IsCurrentToken(const Token: UnicodeString): Boolean; override; + function IsFilterStored: Boolean; override; + procedure SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + procedure Next; override; + published + property URIAttri: TSynHighlighterAttributes read FURIAttri write SetURIAttri; + property VisitedURIAttri: TSynHighlighterAttributes read FVisitedURIAttri + write SetVisitedURIAttri; + end; + +const + SYN_ATTR_URI = 6; + SYN_ATTR_VISITEDURI = 7; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..15] of UnicodeString = ( + '', 'http://', '', 'https://', 'news:', 'gopher://', '', 'prospero://', + 'news://', 'www', 'nntp://', 'ftp://', 'wais://', '', 'telnet://', 'mailto:' + ); + +function TSynURISyn.HashKey(Str: PWideChar): Integer; +begin + Result := 0; + while CharInSet(Str^, ['A'..'Z', 'a'..'z']) do + begin + Result := (Result * 3 + Ord(Str^) div 9) mod 16; + Inc(Str); + end; + + if Str^ = ':' then + begin + Result := (Result * 3 + Ord(Str^) div 9) mod 16; + Inc(Str); + end; + + if Str^ = '/' then + begin + Result := (Result * 3 + Ord(Str^) div 9) mod 16; + Inc(Str); + end; + + if Str^ = '/' then + begin + Result := (Result * 3 + Ord(Str^) div 9) mod 16; + Inc(Str); + end; + + FStringLen := Str - FMayBeProtocol; +end; + +procedure TSynURISyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[11] := FuncFtp; + FIdentFuncTable[5] := FuncGopher; + FIdentFuncTable[1] := FuncHttp; + FIdentFuncTable[3] := FuncHttps; + FIdentFuncTable[15] := FuncMailto; + FIdentFuncTable[4] := FuncNews; + FIdentFuncTable[8] := FuncNews; + FIdentFuncTable[10] := FuncNntp; + FIdentFuncTable[7] := FuncProspero; + FIdentFuncTable[14] := FuncTelnet; + FIdentFuncTable[12] := FuncWais; + FIdentFuncTable[9] := FuncWeb; +end; + +function TSynURISyn.IsCurrentToken(const Token: UnicodeString): Boolean; +var + I: Integer; + Temp: PWideChar; +begin + Temp := FMayBeProtocol; + if Length(Token) = FStringLen then + begin + Result := True; + for i := 1 to FStringLen do + begin + if Temp^ <> Token[i] then + begin + Result := False; + Break; + end; + Inc(Temp); + end; + end + else + Result := False; +end; + +function TSynURISyn.AltFunc(Key: Integer): TtkTokenKind; +begin + Result := tkUnknown; +end; + +constructor TSynURISyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCaseSensitive := False; + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + + FURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrURI, SYNS_FriendlyAttrURI); + FURIAttri.Foreground := clBlue; + FURIAttri.Style := [fsUnderline]; + AddAttribute(FURIAttri); + + FVisitedURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrVisitedURI, SYNS_FriendlyAttrVisitedURI); + FVisitedURIAttri.Foreground := clPurple; + FVisitedURIAttri.Style := [fsUnderline]; + AddAttribute(FVisitedURIAttri); + + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterURI; +end; + +destructor TSynURISyn.Destroy; +begin + inherited; + //the other attributes are automatically freed because of AddAttribute() + FSpaceAttri.Free; + FIdentifierAttri.Free; +end; + +procedure TSynURISyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then + Inc(Run); +end; + +procedure TSynURISyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynURISyn.NullProc; +begin + if Run < FLineLen + 1 then + begin + Inc(Run); + FTokenID := tkNullChar; + end + else + FTokenID := tkNull +end; + +procedure TSynURISyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynURISyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynURISyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + #13: CRProc; + #10: LFProc; + #0: NullProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + 'A'..'Z', 'a'..'z': ProtocolProc; + else + UnknownProc; + end; + inherited; +end; + +function TSynURISyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_URI: Result := FURIAttri; + SYN_ATTR_VISITEDURI: Result := FVisitedURIAttri; + else + Result := nil; + end; +end; + +function TSynURISyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynURISyn.GetTokenAttribute: TSynHighlighterAttributes; +var + Visited: Boolean; +begin + case GetTokenID of + tkSpace: Result := FSpaceAttri; + tkFtpLink, tkGopherLink, tkHttpLink, tkHttpsLink, tkMailtoLink, tkNewsLink, + tkNntpLink, tkProsperoLink, tkTelnetLink, tkWaisLink, tkWebLink: + begin + Visited := False; + if Assigned(FAlreadyVisitedURI) then + Visited := FAlreadyVisitedURI(GetToken); + if Visited then + Result := FVisitedURIAttri + else + Result := FURIAttri; + end; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynURISyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynURISyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +class function TSynURISyn.GetLanguageName: string; +begin + Result := SYNS_LangURI; +end; + +function TSynURISyn.GetSampleSource: UnicodeString; +begin + Result := 'Universal Resource Identifier highlighting'#13#10#13#10 + + 'http://www.somewhere.org'#13#10 + + 'ftp://superhost.org/downloads/gems.zip'#13#10 + + 'www.w3c.org'#13#10 + + 'mailto:big@lebowski.edu'#13#10 + + 'douglas@adams.lod'#13#10 + + 'news:comp.lang.pascal.borland'; +end; + +function TSynURISyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterURI; +end; + +function TSynURISyn.IsIdentChar(AChar: WideChar): Boolean; +begin + Result := SynIsCharAlphaNumeric(AChar); +end; + +procedure TSynURISyn.SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); +begin + FAlreadyVisitedURI := Value; +end; + +procedure TSynURISyn.SetURIAttri(const Value: TSynHighlighterAttributes); +begin + FURIAttri.Assign(Value); +end; + +procedure TSynURISyn.SetVisitedURIAttri(const Value: TSynHighlighterAttributes); +begin + FVisitedURIAttri.Assign(Value); +end; + +procedure TSynURISyn.ProtocolProc; +var + Key: Integer; +begin + if IsValidEmailAddress then + FTokenID := tkMailtoLink + else + begin + FMayBeProtocol := FLine + Run; + Key := HashKey(FMayBeProtocol); + Inc(Run, FStringLen); + + if Key <= 15 then + FTokenID := FIdentFuncTable[Key](Key) + else + FTokenID := tkUnknown; + end; +end; + +function TSynURISyn.FuncFtp(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkFtpLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncGopher(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkGopherLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncHttp(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkHttpLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncHttps(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkHttpsLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncMailto(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkMailtoLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncNews(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkNewsLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncNntp(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkNntpLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncProspero(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkProsperoLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncTelnet(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkTelnetLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncWais(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidURI then + Result := tkWaisLink + else + Result := tkUnknown; +end; + +function TSynURISyn.FuncWeb(Key: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Key]) and IsValidWebLink then + Result := tkWebLink + else + Result := tkUnknown; +end; + + +function TSynURISyn.IsAlphaNum(AChar: WideChar): Boolean; +begin + Result := SynIsCharAlphaNumeric(AChar); +end; + +function TSynURISyn.IsMark(AChar: WideChar): Boolean; +begin + case AChar of + '-', '_', '.', '!', '~', '*', '''', '(' , ')': + Result := True; + else + Result := False; + end; +end; + +function TSynURISyn.IsReserved(AChar: WideChar): Boolean; +begin + case AChar of + ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '%', '#': + Result := True; + else + Result := False; + end; +end; + +function TSynURISyn.IsUnreserved(AChar: WideChar): Boolean; +begin + Result := IsAlphaNum(AChar) or IsMark(AChar); +end; + +function TSynURISyn.IsURIChar(AChar: WideChar): Boolean; +begin + Result := IsReserved(AChar) or IsUnreserved(AChar); +end; + +function TSynURISyn.IsNeverAtEnd(AChar: WideChar): Boolean; +begin + Result := (IsMark(AChar) and (AChar <> '''')) or + (IsReserved(AChar) and (AChar <> '/') and (AChar <> '$')); +end; + +function TSynURISyn.IsEMailAddressChar(AChar: WideChar): Boolean; +begin + case AChar of + '.', '_', '-', '@': + Result := True; + else + Result := IsAlphaNum(AChar); + end; +end; + +function TSynURISyn.IsNeverAtEMailAddressEnd(AChar: WideChar): Boolean; +begin + Result := (AChar = '.') or (AChar = '@'); +end; + +function TSynURISyn.IsValidEmailAddress: Boolean; +var + StartPos, AtPos, DotPos: Integer; +begin + StartPos := Run; + + AtPos := -1; + DotPos := -1; + while IsEMailAddressChar(FLine[Run]) do + begin + if FLine[Run] = '@' then + AtPos := Run + else if FLine[Run] = '.' then + // reject array of dots: "neighbour" dots are not allowed + if (Run = StartPos) or (DotPos >= 0) and (DotPos = Run - 1) then + Break + else + DotPos := Run; + Inc(Run); + end; + + while (Run > StartPos) and (IsNeverAtEMailAddressEnd(FLine[Run - 1])) do + Dec(Run); + + while (DotPos >= Run) or (DotPos > -1) and (FLine[DotPos] <> '.') do + Dec(DotPos); + + Result := (StartPos < AtPos) and (AtPos < Run - 1) and (DotPos > AtPos + 1); + if not Result then Run := StartPos; +end; + +function TSynURISyn.IsValidURI: Boolean; +var + ProtocolEndPos, DotPos: Integer; + + function IsRelativePath: Boolean; + begin + Result := (DotPos - 1 >= 0) and + ((FLine[DotPos - 1] = '/') and (FLine[DotPos + 2] = '/')) or + ((FLine[DotPos - 1] = '\') and (FLine[DotPos + 2] = '\')); + end; + +begin + ProtocolEndPos := Run; + + DotPos := -1; + while IsURIChar(FLine[Run]) do + begin + if FLine[Run] = '.' then + // reject array of dots: "neighbour" dots are not allowed + if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then + Break + else + DotPos := Run; + Inc(Run); + end; + + while (Run > ProtocolEndPos) and IsNeverAtEnd(FLine[Run - 1]) do + Dec(Run); + + Result := Run > ProtocolEndPos; +end; + +function TSynURISyn.IsValidWebLink: Boolean; +var + WWWEndPos, DotPos, SecondDotPos: Integer; + + function IsRelativePath: Boolean; + begin + Result := (DotPos - 1 >= 0) and + ((FLine[DotPos - 1] = '/') and (FLine[DotPos + 2] = '/')) or + ((FLine[DotPos - 1] = '\') and (FLine[DotPos + 2] = '\')); + end; + +begin + WWWEndPos := Run; + + DotPos := -1; + SecondDotPos := -1; + while IsURIChar(FLine[Run]) do + begin + if FLine[Run] = '.' then + // reject array of dots: "neighbour" dots are not allowed + if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then + Break + else + begin + DotPos := Run; + if SecondDotPos = -2 then SecondDotPos := DotPos; + if SecondDotPos = -1 then SecondDotPos := -2; + end; + Inc(Run); + end; + + while (Run > WWWEndPos) and IsNeverAtEnd(FLine[Run - 1]) do + Dec(Run); + + Result := (Run > WWWEndPos) and (FLine[WWWEndPos] = '.') and + (SecondDotPos > WWWEndPos + 1) and (SecondDotPos < Run); +end; + +class function TSynURISyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangURI; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynURISyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterUnreal.pas b/Source/VCL/SynEdit/Source/SynHighlighterUnreal.pas index 7cd6a529..2d222795 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterUnreal.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterUnreal.pas @@ -1,2658 +1,2663 @@ -{------------------------------------------------------------------------------- -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. - PP - 2001/10/24: -The Original Code is based on the UnrealSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Dean Harmon. -Unicode translation by Maël Hörz. -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: SynHighlighterUnreal.pas,v 1.17.2.8 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Unreal syntax highlighter for SynEdit) -@author(Dean Harmon) -@created(2000) -@lastmod(2001-06-29) -} - -unit SynHighlighterUnreal; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - Windows, // registry constants - SynEditHighlighter, - SynEditTypes, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = ( - tkComment, - tkDirective, - tkIdentifier, - tkKey, - tkKey2, - tkNull, - tkNumber, - tkSpace, - tkString, - tkString2, - tkSymbol, - tkUnknown); - - TxtkTokenKind = ( - xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign, - xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma, - xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan, - xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan, - xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr, - xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion, - xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft, - xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose, - xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor, - xtkXorAssign); - - TRangeState = (rsANil, rsAnsiC, rsDirective, rsDirectiveComment, rsUnKnown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - - TSynUnrealSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - FRoundCount: Integer; - FSquareCount: Integer; - FTokenID: TtkTokenKind; - FExtTokenID: TxtkTokenKind; - fIdentFuncTable: array[0..732] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fDirecAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fInvalidAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fKey2Attri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fString2Attri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncAbstract(Index: Integer): TtkTokenKind; - function FuncAlways(Index: Integer): TtkTokenKind; - function FuncArray(Index: Integer): TtkTokenKind; - function FuncArraycount(Index: Integer): TtkTokenKind; - function FuncAssert(Index: Integer): TtkTokenKind; - function FuncAuto(Index: Integer): TtkTokenKind; - function FuncAutomated(Index: Integer): TtkTokenKind; - function FuncBool(Index: Integer): TtkTokenKind; - function FuncBoundingbox(Index: Integer): TtkTokenKind; - function FuncBoundingvolume(Index: Integer): TtkTokenKind; - function FuncBreak(Index: Integer): TtkTokenKind; - function FuncButton(Index: Integer): TtkTokenKind; - function FuncByte(Index: Integer): TtkTokenKind; - function FuncCache(Index: Integer): TtkTokenKind; - function FuncCacheexempt(Index: Integer): TtkTokenKind; - function FuncCase(Index: Integer): TtkTokenKind; - function FuncCatch(Index: Integer): TtkTokenKind; - function FuncClass(Index: Integer): TtkTokenKind; - function FuncCoerce(Index: Integer): TtkTokenKind; - function FuncCollapsecategories(Index: Integer): TtkTokenKind; - function FuncColor(Index: Integer): TtkTokenKind; - function FuncConfig(Index: Integer): TtkTokenKind; - function FuncConst(Index: Integer): TtkTokenKind; - function FuncContinue(Index: Integer): TtkTokenKind; - function FuncCoords(Index: Integer): TtkTokenKind; - function FuncCpptext(Index: Integer): TtkTokenKind; - function FuncCross(Index: Integer): TtkTokenKind; - function FuncDefault(Index: Integer): TtkTokenKind; - function FuncDefaultproperties(Index: Integer): TtkTokenKind; - function FuncDelegate(Index: Integer): TtkTokenKind; - function FuncDelete(Index: Integer): TtkTokenKind; - function FuncDependson(Index: Integer): TtkTokenKind; - function FuncDeprecated(Index: Integer): TtkTokenKind; - function FuncDo(Index: Integer): TtkTokenKind; - function FuncDontcollapsecategories(Index: Integer): TtkTokenKind; - function FuncDot(Index: Integer): TtkTokenKind; - function FuncEach(Index: Integer): TtkTokenKind; - function FuncEdfindable(Index: Integer): TtkTokenKind; - function FuncEditconst(Index: Integer): TtkTokenKind; - function FuncEditconstarray(Index: Integer): TtkTokenKind; - function FuncEditinline(Index: Integer): TtkTokenKind; - function FuncEditinlinenew(Index: Integer): TtkTokenKind; - function FuncEditinlinenotify(Index: Integer): TtkTokenKind; - function FuncEditinlineuse(Index: Integer): TtkTokenKind; - function FuncElse(Index: Integer): TtkTokenKind; - function FuncEnum(Index: Integer): TtkTokenKind; - function FuncEnumcount(Index: Integer): TtkTokenKind; - function FuncEvent(Index: Integer): TtkTokenKind; - function FuncExec(Index: Integer): TtkTokenKind; - function FuncExpands(Index: Integer): TtkTokenKind; - function FuncExplicit(Index: Integer): TtkTokenKind; - function FuncExport(Index: Integer): TtkTokenKind; - function FuncExportstructs(Index: Integer): TtkTokenKind; - function FuncExtends(Index: Integer): TtkTokenKind; - function FuncFalse(Index: Integer): TtkTokenKind; - function FuncFinal(Index: Integer): TtkTokenKind; - function FuncFloat(Index: Integer): TtkTokenKind; - function FuncFor(Index: Integer): TtkTokenKind; - function FuncForeach(Index: Integer): TtkTokenKind; - function FuncFunction(Index: Integer): TtkTokenKind; - function FuncGlobal(Index: Integer): TtkTokenKind; - function FuncGlobalconfig(Index: Integer): TtkTokenKind; - function FuncGoto(Index: Integer): TtkTokenKind; - function FuncGuid(Index: Integer): TtkTokenKind; - function FuncHidecategories(Index: Integer): TtkTokenKind; - function FuncHidedropdown(Index: Integer): TtkTokenKind; - function FuncHideparent(Index: Integer): TtkTokenKind; - function FuncIf(Index: Integer): TtkTokenKind; - function FuncIgnores(Index: Integer): TtkTokenKind; - function FuncImport(Index: Integer): TtkTokenKind; - function FuncInit(Index: Integer): TtkTokenKind; - function FuncInput(Index: Integer): TtkTokenKind; - function FuncInsert(Index: Integer): TtkTokenKind; - function FuncInstanced(Index: Integer): TtkTokenKind; - function FuncInt(Index: Integer): TtkTokenKind; - function FuncIntrinsic(Index: Integer): TtkTokenKind; - function FuncInvariant(Index: Integer): TtkTokenKind; - function FuncIterator(Index: Integer): TtkTokenKind; - function FuncLatent(Index: Integer): TtkTokenKind; - function FuncLength(Index: Integer): TtkTokenKind; - function FuncLocal(Index: Integer): TtkTokenKind; - function FuncLocalized(Index: Integer): TtkTokenKind; - function FuncLong(Index: Integer): TtkTokenKind; - function FuncMesh(Index: Integer): TtkTokenKind; - function FuncModel(Index: Integer): TtkTokenKind; - function FuncMutable(Index: Integer): TtkTokenKind; - function FuncName(Index: Integer): TtkTokenKind; - function FuncNative(Index: Integer): TtkTokenKind; - function FuncNativereplication(Index: Integer): TtkTokenKind; - function FuncNew(Index: Integer): TtkTokenKind; - function FuncNoexport(Index: Integer): TtkTokenKind; - function FuncNone(Index: Integer): TtkTokenKind; - function FuncNoteditinlinenew(Index: Integer): TtkTokenKind; - function FuncNotplaceable(Index: Integer): TtkTokenKind; - function FuncNousercreate(Index: Integer): TtkTokenKind; - function FuncOperator(Index: Integer): TtkTokenKind; - function FuncOptional(Index: Integer): TtkTokenKind; - function FuncOut(Index: Integer): TtkTokenKind; - function FuncParseconfig(Index: Integer): TtkTokenKind; - function FuncPerobjectconfig(Index: Integer): TtkTokenKind; - function FuncPlaceable(Index: Integer): TtkTokenKind; - function FuncPlane(Index: Integer): TtkTokenKind; - function FuncPointer(Index: Integer): TtkTokenKind; - function FuncPostoperator(Index: Integer): TtkTokenKind; - function FuncPreoperator(Index: Integer): TtkTokenKind; - function FuncPrivate(Index: Integer): TtkTokenKind; - function FuncProtected(Index: Integer): TtkTokenKind; - function FuncRegister(Index: Integer): TtkTokenKind; - function FuncReliable(Index: Integer): TtkTokenKind; - function FuncRemove(Index: Integer): TtkTokenKind; - function FuncReplication(Index: Integer): TtkTokenKind; - function FuncReturn(Index: Integer): TtkTokenKind; - function FuncRng(Index: Integer): TtkTokenKind; - function FuncRot(Index: Integer): TtkTokenKind; - function FuncRotator(Index: Integer): TtkTokenKind; - function FuncSafereplace(Index: Integer): TtkTokenKind; - function FuncScale(Index: Integer): TtkTokenKind; - function FuncScriptconst(Index: Integer): TtkTokenKind; - function FuncSelf(Index: Integer): TtkTokenKind; - function FuncShowcategories(Index: Integer): TtkTokenKind; - function FuncSimulated(Index: Integer): TtkTokenKind; - function FuncSingular(Index: Integer): TtkTokenKind; - function FuncSkip(Index: Integer): TtkTokenKind; - function FuncSound(Index: Integer): TtkTokenKind; - function FuncState(Index: Integer): TtkTokenKind; - function FuncStatic(Index: Integer): TtkTokenKind; - function FuncStop(Index: Integer): TtkTokenKind; - function FuncString(Index: Integer): TtkTokenKind; - function FuncStruct(Index: Integer): TtkTokenKind; - function FuncSuper(Index: Integer): TtkTokenKind; - function FuncSwitch(Index: Integer): TtkTokenKind; - function FuncTexture(Index: Integer): TtkTokenKind; - function FuncTransient(Index: Integer): TtkTokenKind; - function FuncTravel(Index: Integer): TtkTokenKind; - function FuncTrue(Index: Integer): TtkTokenKind; - function FuncUnreliable(Index: Integer): TtkTokenKind; - function FuncUntil(Index: Integer): TtkTokenKind; - function FuncVar(Index: Integer): TtkTokenKind; - function FuncVect(Index: Integer): TtkTokenKind; - function FuncVector(Index: Integer): TtkTokenKind; - function FuncVoid(Index: Integer): TtkTokenKind; - function FuncWhile(Index: Integer): TtkTokenKind; - function FuncWithin(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AnsiCProc; - procedure AndSymbolProc; - procedure AsciiCharProc; - procedure BraceCloseProc; - procedure BraceOpenProc; - procedure CRProc; - procedure ColonProc; - procedure CommaProc; - procedure DirectiveProc; - procedure EqualProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure MinusProc; - procedure ModSymbolProc; - procedure NotSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure QuestionProc; - procedure RoundCloseProc; - procedure RoundOpenProc; - procedure SemiColonProc; - procedure SlashProc; - procedure SpaceProc; - procedure SquareCloseProc; - procedure SquareOpenProc; - procedure StarProc; - procedure StringProc; - procedure DollarSignProc; - procedure TildeProc; - procedure XOrSymbolProc; - procedure UnknownProc; - protected - function GetExtTokenID: TxtkTokenKind; - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - procedure NextProcedure; - public - class function GetCapabilities: TSynHighlighterCapabilities; override; - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - function UseUserSettings(settingIndex: integer): boolean; override; - procedure EnumUserSettings(settings: TStrings); override; - property ExtTokenID: TxtkTokenKind read GetExtTokenID; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property DirecAttri: TSynHighlighterAttributes read fDirecAttri - write fDirecAttri; - property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri - write fIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri - write fInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property Key2Attri: TSynHighlighterAttributes read fKey2Attri write fKey2Attri; - property NumberAttri: TSynHighlighterAttributes read fNumberAttri - write fNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property StringAttri: TSynHighlighterAttributes read fStringAttri - write fStringAttri; - property SingleStringAttri: TSynHighlighterAttributes read fString2Attri - write fString2Attri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..142] of string = ( - 'abstract', 'always', 'array', 'arraycount', 'assert', 'auto', 'automated', - 'bool', 'boundingbox', 'boundingvolume', 'break', 'button', 'byte', 'cache', - 'cacheexempt', 'case', 'catch', 'class', 'coerce', 'collapsecategories', - 'color', 'config', 'const', 'continue', 'coords', 'cpptext', 'cross', - 'default', 'defaultproperties', 'delegate', 'delete', 'dependson', - 'deprecated', 'do', 'dontcollapsecategories', 'dot', 'each', 'edfindable', - 'editconst', 'editconstarray', 'editinline', 'editinlinenew', - 'editinlinenotify', 'editinlineuse', 'else', 'enum', 'enumcount', 'event', - 'exec', 'expands', 'explicit', 'export', 'exportstructs', 'extends', - 'false', 'final', 'float', 'for', 'foreach', 'function', 'global', - 'globalconfig', 'goto', 'guid', 'hidecategories', 'hidedropdown', - 'hideparent', 'if', 'ignores', 'import', 'init', 'input', 'insert', - 'instanced', 'int', 'intrinsic', 'invariant', 'iterator', 'latent', - 'length', 'local', 'localized', 'long', 'mesh', 'model', 'mutable', 'name', - 'native', 'nativereplication', 'new', 'noexport', 'none', - 'noteditinlinenew', 'notplaceable', 'nousercreate', 'operator', 'optional', - 'out', 'parseconfig', 'perobjectconfig', 'placeable', 'plane', 'pointer', - 'postoperator', 'preoperator', 'private', 'protected', 'register', - 'reliable', 'remove', 'replication', 'return', 'rng', 'rot', 'rotator', - 'safereplace', 'scale', 'scriptconst', 'self', 'showcategories', - 'simulated', 'singular', 'skip', 'sound', 'state', 'static', 'stop', - 'string', 'struct', 'super', 'switch', 'texture', 'transient', 'travel', - 'true', 'unreliable', 'until', 'var', 'vect', 'vector', 'void', 'while', - 'within' - ); - - KeyIndices: array[0..732] of Integer = ( - -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 34, -1, -1, -1, 18, -1, -1, -1, -1, -1, 30, 1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, 114, - -1, -1, 121, -1, -1, -1, -1, -1, 105, -1, -1, 108, -1, 135, 9, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 117, 33, 109, -1, -1, -1, -1, -1, -1, 90, -1, -1, - -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 19, -1, - -1, -1, -1, 81, -1, 82, -1, -1, -1, -1, 40, 15, -1, -1, -1, 52, -1, 80, -1, - -1, -1, -1, -1, -1, 136, -1, -1, 61, -1, 113, -1, -1, -1, 83, -1, -1, -1, - -1, -1, -1, 27, -1, -1, 133, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, - 76, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, - 51, -1, -1, -1, -1, 44, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 20, -1, -1, -1, 8, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, - -1, -1, -1, -1, -1, 39, 24, -1, -1, -1, -1, 54, -1, 4, 123, -1, -1, -1, -1, - -1, -1, 50, 141, -1, -1, -1, -1, -1, -1, -1, 87, -1, -1, 21, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, 85, -1, - -1, -1, -1, -1, 70, -1, 68, 131, -1, -1, 69, -1, -1, -1, -1, -1, 128, 26, - -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, 142, -1, -1, 122, -1, 74, -1, -1, - -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, 101, 119, -1, -1, 94, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, 89, -1, -1, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, 92, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, 67, -1, -1, 45, -1, - 116, -1, -1, 132, 28, -1, -1, -1, 31, -1, -1, -1, 77, -1, -1, -1, -1, -1, - 91, -1, 37, -1, -1, -1, -1, 35, -1, 6, -1, -1, -1, -1, -1, -1, -1, 97, -1, - -1, -1, -1, -1, 53, -1, 84, -1, -1, -1, -1, 56, 14, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 23, -1, 107, -1, -1, -1, -1, 98, -1, -1, 75, -1, -1, -1, -1, - -1, 88, -1, -1, 103, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, - 139, 11, 42, -1, -1, 95, -1, -1, -1, -1, -1, 3, -1, -1, -1, 38, -1, -1, -1, - -1, -1, -1, -1, -1, 16, -1, 46, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, 41, -1, -1, -1, - -1, -1, -1, -1, -1, 48, 64, -1, -1, -1, -1, 86, -1, 58, 43, 72, -1, -1, 66, - 137, 71, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, 17, 130, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, 73, -1, -1, 118, -1, -1, -1, - -1, -1, -1, 138, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, - -1, -1, -1, 32, 47, 49, -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, - -1, 125, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, 12, -1, 127, - 140, -1, -1 - ); - -{$Q-} -function TSynUnrealSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 41 + Ord(Str^) * 701; - inc(Str); - end; - Result := Result mod 733; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynUnrealSyn.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 TSynUnrealSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[410] := FuncAbstract; - fIdentFuncTable[71] := FuncAlways; - fIdentFuncTable[219] := FuncArray; - fIdentFuncTable[554] := FuncArraycount; - fIdentFuncTable[294] := FuncAssert; - fIdentFuncTable[681] := FuncAuto; - fIdentFuncTable[477] := FuncAutomated; - fIdentFuncTable[364] := FuncBool; - fIdentFuncTable[249] := FuncBoundingbox; - fIdentFuncTable[109] := FuncBoundingvolume; - fIdentFuncTable[675] := FuncBreak; - fIdentFuncTable[544] := FuncButton; - fIdentFuncTable[727] := FuncByte; - fIdentFuncTable[380] := FuncCache; - fIdentFuncTable[499] := FuncCacheexempt; - fIdentFuncTable[160] := FuncCase; - fIdentFuncTable[567] := FuncCatch; - fIdentFuncTable[635] := FuncClass; - fIdentFuncTable[64] := FuncCoerce; - fIdentFuncTable[147] := FuncCollapsecategories; - fIdentFuncTable[245] := FuncColor; - fIdentFuncTable[314] := FuncConfig; - fIdentFuncTable[231] := FuncConst; - fIdentFuncTable[510] := FuncContinue; - fIdentFuncTable[287] := FuncCoords; - fIdentFuncTable[11] := FuncCpptext; - fIdentFuncTable[355] := FuncCross; - fIdentFuncTable[189] := FuncDefault; - fIdentFuncTable[454] := FuncDefaultproperties; - fIdentFuncTable[425] := FuncDelegate; - fIdentFuncTable[70] := FuncDelete; - fIdentFuncTable[458] := FuncDependson; - fIdentFuncTable[696] := FuncDeprecated; - fIdentFuncTable[120] := FuncDo; - fIdentFuncTable[60] := FuncDontcollapsecategories; - fIdentFuncTable[475] := FuncDot; - fIdentFuncTable[49] := FuncEach; - fIdentFuncTable[470] := FuncEdfindable; - fIdentFuncTable[558] := FuncEditconst; - fIdentFuncTable[286] := FuncEditconstarray; - fIdentFuncTable[159] := FuncEditinline; - fIdentFuncTable[596] := FuncEditinlinenew; - fIdentFuncTable[545] := FuncEditinlinenotify; - fIdentFuncTable[614] := FuncEditinlineuse; - fIdentFuncTable[229] := FuncElse; - fIdentFuncTable[448] := FuncEnum; - fIdentFuncTable[569] := FuncEnumcount; - fIdentFuncTable[697] := FuncEvent; - fIdentFuncTable[605] := FuncExec; - fIdentFuncTable[698] := FuncExpands; - fIdentFuncTable[302] := FuncExplicit; - fIdentFuncTable[224] := FuncExport; - fIdentFuncTable[164] := FuncExportstructs; - fIdentFuncTable[491] := FuncExtends; - fIdentFuncTable[292] := FuncFalse; - fIdentFuncTable[662] := FuncFinal; - fIdentFuncTable[498] := FuncFloat; - fIdentFuncTable[706] := FuncFor; - fIdentFuncTable[613] := FuncForeach; - fIdentFuncTable[542] := FuncFunction; - fIdentFuncTable[330] := FuncGlobal; - fIdentFuncTable[176] := FuncGlobalconfig; - fIdentFuncTable[197] := FuncGoto; - fIdentFuncTable[89] := FuncGuid; - fIdentFuncTable[606] := FuncHidecategories; - fIdentFuncTable[278] := FuncHidedropdown; - fIdentFuncTable[618] := FuncHideparent; - fIdentFuncTable[445] := FuncIf; - fIdentFuncTable[344] := FuncIgnores; - fIdentFuncTable[348] := FuncImport; - fIdentFuncTable[342] := FuncInit; - fIdentFuncTable[620] := FuncInput; - fIdentFuncTable[615] := FuncInsert; - fIdentFuncTable[648] := FuncInstanced; - fIdentFuncTable[372] := FuncInt; - fIdentFuncTable[520] := FuncIntrinsic; - fIdentFuncTable[205] := FuncInvariant; - fIdentFuncTable[462] := FuncIterator; - fIdentFuncTable[6] := FuncLatent; - fIdentFuncTable[24] := FuncLength; - fIdentFuncTable[166] := FuncLocal; - fIdentFuncTable[152] := FuncLocalized; - fIdentFuncTable[154] := FuncLong; - fIdentFuncTable[182] := FuncMesh; - fIdentFuncTable[493] := FuncModel; - fIdentFuncTable[336] := FuncMutable; - fIdentFuncTable[611] := FuncName; - fIdentFuncTable[311] := FuncNative; - fIdentFuncTable[526] := FuncNativereplication; - fIdentFuncTable[407] := FuncNew; - fIdentFuncTable[128] := FuncNoexport; - fIdentFuncTable[468] := FuncNone; - fIdentFuncTable[428] := FuncNoteditinlinenew; - fIdentFuncTable[532] := FuncNotplaceable; - fIdentFuncTable[389] := FuncNousercreate; - fIdentFuncTable[548] := FuncOperator; - fIdentFuncTable[265] := FuncOptional; - fIdentFuncTable[485] := FuncOut; - fIdentFuncTable[517] := FuncParseconfig; - fIdentFuncTable[726] := FuncPerobjectconfig; - fIdentFuncTable[401] := FuncPlaceable; - fIdentFuncTable[385] := FuncPlane; - fIdentFuncTable[575] := FuncPointer; - fIdentFuncTable[529] := FuncPostoperator; - fIdentFuncTable[33] := FuncPreoperator; - fIdentFuncTable[103] := FuncPrivate; - fIdentFuncTable[134] := FuncProtected; - fIdentFuncTable[512] := FuncRegister; - fIdentFuncTable[106] := FuncReliable; - fIdentFuncTable[121] := FuncRemove; - fIdentFuncTable[253] := FuncReplication; - fIdentFuncTable[593] := FuncReturn; - fIdentFuncTable[440] := FuncRng; - fIdentFuncTable[178] := FuncRot; - fIdentFuncTable[94] := FuncRotator; - fIdentFuncTable[691] := FuncSafereplace; - fIdentFuncTable[450] := FuncScale; - fIdentFuncTable[119] := FuncScriptconst; - fIdentFuncTable[651] := FuncSelf; - fIdentFuncTable[386] := FuncShowcategories; - fIdentFuncTable[646] := FuncSimulated; - fIdentFuncTable[97] := FuncSingular; - fIdentFuncTable[370] := FuncSkip; - fIdentFuncTable[295] := FuncSound; - fIdentFuncTable[142] := FuncState; - fIdentFuncTable[713] := FuncStatic; - fIdentFuncTable[213] := FuncStop; - fIdentFuncTable[729] := FuncString; - fIdentFuncTable[354] := FuncStruct; - fIdentFuncTable[626] := FuncSuper; - fIdentFuncTable[636] := FuncSwitch; - fIdentFuncTable[345] := FuncTexture; - fIdentFuncTable[453] := FuncTransient; - fIdentFuncTable[192] := FuncTravel; - fIdentFuncTable[714] := FuncTrue; - fIdentFuncTable[108] := FuncUnreliable; - fIdentFuncTable[173] := FuncUntil; - fIdentFuncTable[619] := FuncVar; - fIdentFuncTable[658] := FuncVect; - fIdentFuncTable[543] := FuncVector; - fIdentFuncTable[730] := FuncVoid; - fIdentFuncTable[303] := FuncWhile; - fIdentFuncTable[367] := FuncWithin; -end; - -function TSynUnrealSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncAbstract(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncAlways(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncArray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncArraycount(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncAssert(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncAuto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncAutomated(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncBool(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncBoundingbox(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncBoundingvolume(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncBreak(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncButton(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncByte(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCache(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCacheexempt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncClass(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCoerce(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCollapsecategories(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncColor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncConfig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncConst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncContinue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCoords(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncCpptext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; - -end; - -function TSynUnrealSyn.FuncCross(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkSymbol - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDefault(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDefaultproperties(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDelegate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDelete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDependson(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDeprecated(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDontcollapsecategories(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncDot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkSymbol - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEdfindable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditconst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditconstarray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditinline(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditinlinenew(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditinlinenotify(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEditinlineuse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncElse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEnum(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEnumcount(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncEvent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExpands(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExplicit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExportstructs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncExtends(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncFalse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncFinal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncFloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncFor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncForeach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncFunction(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncGlobal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncGlobalconfig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncGoto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncGuid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncHidecategories(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncHidedropdown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncHideparent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncIf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncIgnores(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncImport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInput(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInsert(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInstanced(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncIntrinsic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncInvariant(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncIterator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncLatent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncLength(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncLocal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncLocalized(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncLong(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncMesh(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncModel(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncMutable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncName(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNative(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNativereplication(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNew(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNoexport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNone(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNoteditinlinenew(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNotplaceable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncNousercreate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncOperator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncOptional(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncOut(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncParseconfig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPerobjectconfig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPlaceable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPlane(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPointer(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPostoperator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPreoperator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncPrivate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncProtected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncRegister(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncReliable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncRemove(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncReplication(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncReturn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncRng(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncRot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncRotator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSafereplace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncScale(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncScriptconst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSelf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncShowcategories(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSimulated(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; - -end; - -function TSynUnrealSyn.FuncSingular(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSkip(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSound(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncState(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncStatic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncStop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncString(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncStruct(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSuper(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncSwitch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncTexture(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncTransient(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncTravel(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncTrue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncUnreliable(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey2 - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncUntil(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncVar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncVect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncVector(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncVoid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncWhile(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynUnrealSyn.FuncWithin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -constructor TSynUnrealSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(fInvalidAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fKey2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - fKey2Attri.Style:= [fsBold]; - AddAttribute(fKey2Attri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fString2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSingleString, SYNS_FriendlyAttrSingleString); - AddAttribute(fString2Attri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - AddAttribute(fDirecAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fRange := rsUnknown; - fDefaultFilter := SYNS_FilterCPP; -end; { Create } - -procedure TSynUnrealSyn.AnsiCProc; -begin - fTokenID := tkComment; - case FLine[Run] of - #0: - begin - NullProc; - exit; - end; - #10: - begin - LFProc; - exit; - end; - #13: - begin - CRProc; - exit; - end; - end; - - while not IsLineEnd(Run) do - case FLine[Run] of - '*': - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - if fRange = rsDirectiveComment then - fRange := rsDirective - else - fRange := rsUnKnown; - break; - end else - inc(Run); - #10: break; - #13: break; - else inc(Run); - end; -end; - -procedure TSynUnrealSyn.AndSymbolProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {and assign} - begin - inc(Run, 2); - FExtTokenID := xtkAndAssign; - end; - '&': {logical and} - begin - inc(Run, 2); - FExtTokenID := xtkLogAnd; - end; - else {and} - begin - inc(Run); - FExtTokenID := xtkAnd; - end; - end; -end; - -procedure TSynUnrealSyn.AsciiCharProc; -begin - fTokenID := tkString2; - repeat - if IsLineEnd(Run) then break; - if FLine[Run] = #92 then {backslash} - {if we have an escaped single quote it doesn't count} - if FLine[Run + 1] = #39 then inc(Run); - inc(Run); - until FLine[Run] = #39; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynUnrealSyn.BraceCloseProc; -begin - inc(Run); - fTokenId := tkSymbol; - FExtTokenID := xtkBraceClose; -end; - -procedure TSynUnrealSyn.BraceOpenProc; -begin - inc(Run); - fTokenId := tkSymbol; - FExtTokenID := xtkBraceOpen; -end; - -procedure TSynUnrealSyn.CRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run + 1] = #10 then Inc(Run); -end; - -procedure TSynUnrealSyn.ColonProc; -begin - fTokenID := tkSymbol; - Case FLine[Run + 1] of - ':': {scope resolution operator} - begin - inc(Run, 2); - FExtTokenID := xtkScopeResolution; - end; - else {colon} - begin - inc(Run); - FExtTokenID := xtkColon; - end; - end; -end; - -procedure TSynUnrealSyn.CommaProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkComma; -end; - -procedure TSynUnrealSyn.DirectiveProc; -begin - if IsLineEnd(Run) then - begin - if (Run <= 0) then - fRange := rsUnknown; - NextProcedure; - end - else - begin - fTokenID := tkDirective; - while TRUE do - case fLine[Run] of - '/': // comment? - begin - if fLine[Run + 1] = '/' then // is end of directive as well - break - else if fLine[Run + 1] = '*' then - begin // might be embedded only - fRange := rsDirectiveComment; - break; - end else - Inc(Run); - end; - #0, #10, #13: - begin - fRange := rsUnknown; - break; - end; - else Inc(Run); - end; - end; -end; - -procedure TSynUnrealSyn.EqualProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {logical equal} - begin - inc(Run, 2); - FExtTokenID := xtkLogEqual; - end; - else {assign} - begin - inc(Run); - FExtTokenID := xtkAssign; - end; - end; -end; - -procedure TSynUnrealSyn.GreaterProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {greater than or equal to} - begin - inc(Run, 2); - FExtTokenID := xtkGreaterThanEqual; - end; - '>': - begin - if FLine[Run + 2] = '=' then {shift right assign} - begin - inc(Run, 3); - FExtTokenID := xtkShiftRightAssign; - end - else {shift right} - begin - inc(Run, 2); - FExtTokenID := xtkShiftRight; - end; - end; - else {greater than} - begin - inc(Run); - FExtTokenID := xtkGreaterThan; - end; - end; -end; - -procedure TSynUnrealSyn.QuestionProc; -begin - fTokenID := tkSymbol; {conditional} - FExtTokenID := xtkQuestion; - inc(Run); -end; - -procedure TSynUnrealSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynUnrealSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynUnrealSyn.LowerProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {less than or equal to} - begin - inc(Run, 2); - FExtTokenID := xtkLessThanEqual; - end; - '<': - begin - if FLine[Run + 2] = '=' then {shift left assign} - begin - inc(Run, 3); - FExtTokenID := xtkShiftLeftAssign; - end - else {shift left} - begin - inc(Run, 2); - FExtTokenID := xtkShiftLeft; - end; - end; - else {less than} - begin - inc(Run); - FExtTokenID := xtkLessThan; - end; - end; -end; - -procedure TSynUnrealSyn.MinusProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {subtract assign} - begin - inc(Run, 2); - FExtTokenID := xtkSubtractAssign; - end; - '-': {decrement} - begin - inc(Run, 2); - FExtTokenID := xtkDecrement; - end; - '>': {arrow} - begin - inc(Run, 2); - FExtTokenID := xtkArrow; - end; - else {subtract} - begin - inc(Run); - FExtTokenID := xtkSubtract; - end; - end; -end; - -procedure TSynUnrealSyn.ModSymbolProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {mod assign} - begin - inc(Run, 2); - FExtTokenID := xtkModAssign; - end; - else {mod} - begin - inc(Run); - FExtTokenID := xtkMod; - end; - end; -end; - -procedure TSynUnrealSyn.NotSymbolProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {not equal} - begin - inc(Run, 2); - FExtTokenID := xtkNotEqual; - end; - else {not} - begin - inc(Run); - FExtTokenID := xtkLogComplement; - end; - end; -end; - -procedure TSynUnrealSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynUnrealSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do - begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then break; - end; - inc(Run); - end; -end; - -procedure TSynUnrealSyn.OrSymbolProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {or assign} - begin - inc(Run, 2); - FExtTokenID := xtkIncOrAssign; - end; - '|': {logical or} - begin - inc(Run, 2); - FExtTokenID := xtkLogOr; - end; - else {or} - begin - inc(Run); - FExtTokenID := xtkIncOr; - end; - end; -end; - -procedure TSynUnrealSyn.PlusProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {add assign} - begin - inc(Run, 2); - FExtTokenID := xtkAddAssign; - end; - '+': {increment} - begin - inc(Run, 2); - FExtTokenID := xtkIncrement; - end; - else {add} - begin - inc(Run); - FExtTokenID := xtkAdd; - end; - end; -end; - -procedure TSynUnrealSyn.PointProc; -begin - fTokenID := tkSymbol; - if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then - begin {ellipse} - inc(Run, 3); - FExtTokenID := xtkEllipse; - end - else {point} - begin - inc(Run); - FExtTokenID := xtkPoint; - end; -end; - -procedure TSynUnrealSyn.RoundCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkRoundClose; - dec(FRoundCount); -end; - -procedure TSynUnrealSyn.RoundOpenProc; -begin - inc(Run); - FTokenID := tkSymbol; - FExtTokenID := xtkRoundOpen; - inc(FRoundCount); -end; - -procedure TSynUnrealSyn.SemiColonProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSemiColon; -end; - -procedure TSynUnrealSyn.SlashProc; -begin - case FLine[Run + 1] of - '/': {c++ style comments} - begin - fTokenID := tkComment; - inc(Run, 2); - while not IsLineEnd(Run) do Inc(Run); - end; - '*': {c style comments} - begin - fTokenID := tkComment; - if fRange <> rsDirectiveComment then - fRange := rsAnsiC; - inc(Run, 2); - while not IsLineEnd(Run) do - case fLine[Run] of - '*': - if fLine[Run + 1] = '/' then - begin - inc(Run, 2); - if fRange = rsDirectiveComment then - fRange := rsDirective - else - fRange := rsUnKnown; - break; - end else inc(Run); - #10, #13: - begin - if fRange = rsDirectiveComment then - fRange := rsAnsiC; - break; - end; - else inc(Run); - end; - end; - '=': {divide assign} - begin - inc(Run, 2); - fTokenID := tkSymbol; - FExtTokenID := xtkDivideAssign; - end; - else {divide} - begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkDivide; - end; - end; -end; - -procedure TSynUnrealSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynUnrealSyn.SquareCloseProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSquareClose; - dec(FSquareCount); -end; - -procedure TSynUnrealSyn.SquareOpenProc; -begin - inc(Run); - fTokenID := tkSymbol; - FExtTokenID := xtkSquareOpen; - inc(FSquareCount); -end; - -procedure TSynUnrealSyn.StarProc; -begin - fTokenID := tkSymbol; - case FLine[Run + 1] of - '=': {multiply assign} - begin - inc(Run, 2); - FExtTokenID := xtkMultiplyAssign; - end; - else {star} - begin - inc(Run); - FExtTokenID := xtkStar; - end; - end; -end; - -procedure TSynUnrealSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - if FLine[Run] = #92 then {backslash} - case FLine[Run + 1] of - #10: inc(Run); {line continuation character} - #34: inc(Run); {escaped quote doesn't count} - #92: inc(Run); - end; - inc(Run); - until FLine[Run] = #34; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynUnrealSyn.DollarSignProc; -begin - fTokenID := tkSymbol; - inc(run); -end; - - -procedure TSynUnrealSyn.TildeProc; -begin - inc(Run); {bitwise complement} - fTokenId := tkSymbol; - FExtTokenID := xtkBitComplement; -end; - -procedure TSynUnrealSyn.XOrSymbolProc; -begin - fTokenID := tkSymbol; - Case FLine[Run + 1] of - '=': {xor assign} - begin - inc(Run, 2); - FExtTokenID := xtkXorAssign; - end; - else {xor} - begin - inc(Run); - FExtTokenID := xtkXor; - end; - end; -end; - -procedure TSynUnrealSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynUnrealSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsAnsiC, rsDirectiveComment: AnsiCProc; - rsDirective: DirectiveProc; - else - begin - fRange := rsUnknown; - NextProcedure - end; - end; - inherited; -end; - -procedure TSynUnrealSyn.NextProcedure; -begin - case fLine[Run] of - '&': AndSymbolProc; - #39: AsciiCharProc; - '}': BraceCloseProc; - '{': BraceOpenProc; - #13: CRProc; - ':': ColonProc; - ',': CommaProc; - '#': DirectiveProc; - '=': EqualProc; - '>': GreaterProc; - '?': QuestionProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': MinusProc; - '%': ModSymbolProc; - '!': NotSymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - ')': RoundCloseProc; - '(': RoundOpenProc; - ';': SemiColonProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - ']': SquareCloseProc; - '[': SquareOpenProc; - '*': StarProc; - #34: StringProc; - '$', '@': DollarSignProc; - '~': TildeProc; - '^': XOrSymbolProc; - else UnknownProc; - end; -end; - -function TSynUnrealSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - SYN_ATTR_KEYWORD: Result := fKeyAttri; - SYN_ATTR_WHITESPACE: Result := fSpaceAttri; - SYN_ATTR_STRING: Result := fStringAttri; - SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; - SYN_ATTR_SYMBOL: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynUnrealSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynUnrealSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynUnrealSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynUnrealSyn.GetExtTokenID: TxtkTokenKind; -begin - Result := FExtTokenID; -end; - - -function TSynUnrealSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterCPP; -end; { IsFilterStored } - - -function TSynUnrealSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkDirective: Result := fDirecAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkKey2: Result := fKey2Attri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkString2: Result := fString2Attri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fInvalidAttri; - else Result := nil; - end; -end; - -function TSynUnrealSyn.GetTokenKind: integer; -begin - Result := Ord(GetTokenID); -end; - -procedure TSynUnrealSyn.ResetRange; -begin - fRange:= rsUnknown; -end; - -procedure TSynUnrealSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynUnrealSyn.EnumUserSettings(settings: TStrings); -begin - { returns the user settings that exist in the registry } - with TBetterRegistry.Create do - begin - try - RootKey := HKEY_LOCAL_MACHINE; - if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then - begin - try - GetKeyNames(settings); - finally - CloseKey; - end; - end; - finally - Free; - end; - end; -end; - -function TSynUnrealSyn.UseUserSettings(settingIndex: integer): boolean; -// Possible parameter values: -// index into TStrings returned by EnumUserSettings -// Possible return values: -// true : settings were read and used -// false: problem reading settings or invalid version specified - old settings -// were preserved - - function ReadCPPBSettings(settingIndex: integer): boolean; - - function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean; - - function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): boolean; - var - i: integer; - begin - for i := 1 to Length(name) do - if name[i] = ' ' then name[i] := '_'; - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name,true); - end; { ReadCPPB1 } - - function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight', - key,false); - end; { ReadCPPB3OrMore } - - begin { ReadCPPBSetting } - try - if (settingTag[1] = '1') - then Result := ReadCPPB1(settingTag,attri,key) - else Result := ReadCPPB3OrMore(settingTag,attri,key); - except Result := false; end; - end; { ReadCPPBSetting } - - var - tmpStringAttri : TSynHighlighterAttributes; - tmpNumberAttri : TSynHighlighterAttributes; - tmpKeyAttri : TSynHighlighterAttributes; - tmpSymbolAttri : TSynHighlighterAttributes; - tmpCommentAttri : TSynHighlighterAttributes; - tmpIdentifierAttri: TSynHighlighterAttributes; - tmpInvalidAttri : TSynHighlighterAttributes; - tmpSpaceAttri : TSynHighlighterAttributes; - tmpDirecAttri : TSynHighlighterAttributes; - sl : TStringList; - - begin { ReadCPPBSettings } - sl := TStringList.Create; - try - EnumUserSettings(sl); - if settingIndex >= sl.Count then Result := false - else begin - tmpStringAttri := TSynHighlighterAttributes.Create('', ''); - tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); - tmpKeyAttri := TSynHighlighterAttributes.Create('', ''); - tmpSymbolAttri := TSynHighlighterAttributes.Create('', ''); - tmpCommentAttri := TSynHighlighterAttributes.Create('', ''); - tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', ''); - tmpInvalidAttri := TSynHighlighterAttributes.Create('', ''); - tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); - tmpDirecAttri := TSynHighlighterAttributes.Create('', ''); - tmpStringAttri .Assign(fStringAttri); - tmpNumberAttri .Assign(fNumberAttri); - tmpKeyAttri .Assign(fKeyAttri); - tmpSymbolAttri .Assign(fSymbolAttri); - tmpCommentAttri .Assign(fCommentAttri); - tmpIdentifierAttri.Assign(fIdentifierAttri); - tmpInvalidAttri .Assign(fInvalidAttri); - tmpSpaceAttri .Assign(fSpaceAttri); - tmpDirecAttri .Assign(fDirecAttri); - Result := ReadCPPBSetting(sl[settingIndex],fCommentAttri,'Comment') and - ReadCPPBSetting(sl[settingIndex],fIdentifierAttri,'Identifier') and - ReadCPPBSetting(sl[settingIndex],fInvalidAttri,'Illegal Char') and - ReadCPPBSetting(sl[settingIndex],fKeyAttri,'Reserved word') and - ReadCPPBSetting(sl[settingIndex],fNumberAttri,'Integer') and - ReadCPPBSetting(sl[settingIndex],fSpaceAttri,'Whitespace') and - ReadCPPBSetting(sl[settingIndex],fStringAttri,'String') and - ReadCPPBSetting(sl[settingIndex],fSymbolAttri,'Symbol') and - ReadCPPBSetting(sl[settingIndex],fDirecAttri,'Preprocessor'); - if not Result then begin - fStringAttri .Assign(tmpStringAttri); - fString2Attri .Assign(tmpStringAttri); - fNumberAttri .Assign(tmpNumberAttri); - fKeyAttri .Assign(tmpKeyAttri); - fKey2Attri .Assign(tmpKeyAttri); - fSymbolAttri .Assign(tmpSymbolAttri); - fCommentAttri .Assign(tmpCommentAttri); - fIdentifierAttri.Assign(tmpIdentifierAttri); - fInvalidAttri.Assign(tmpInvalidAttri); - fSpaceAttri .Assign(tmpSpaceAttri); - fDirecAttri .Assign(tmpDirecAttri); - end; - tmpStringAttri .Free; - tmpNumberAttri .Free; - tmpKeyAttri .Free; - tmpSymbolAttri .Free; - tmpCommentAttri .Free; - tmpIdentifierAttri.Free; - tmpInvalidAttri .Free; - tmpSpaceAttri .Free; - tmpDirecAttri .Free; - end; - finally - sl.Free; - end; - end; { ReadCPPBSettings } - -begin - Result := ReadCPPBSettings(settingIndex); -end; { TSynUnrealSyn.UseUserSettings } - -class function TSynUnrealSyn.GetLanguageName: string; -begin - Result := SYNS_LangUnreal; -end; - -class function TSynUnrealSyn.GetCapabilities: TSynHighlighterCapabilities; -begin - Result := inherited GetCapabilities + [hcUserSettings]; -end; - -function TSynUnrealSyn.GetSampleSource: string; -begin - Result := '//----Comment-----------------------------------------------------------'#13#10+ - 'class TestObject expands Object native;'#13#10+ - #13#10+ - '#exec MESH IMPORT MESH=Something ANIVFILE=MODELS\Something.3D DATAFILE=MODELS\Something.3D X=0 Y=0 Z=0 MLOD=0'#13#10+ - #13#10+ - 'var() Sound HitSound;'#13#10+ - 'function Cast()'#13#10+ - '{'#13#10+ - ' Super.Cast();'#13#10+ - ' CastTime = 50;'#13#10+ - ' GatherEffect = Spawn( class''SomethingCorona'',,, GetStartLoc(), Pawn(Owner).ViewRotation );'#13#10+ - ' GatherEffect.SetFollowPawn( Pawn(Owner) );'#13#10+ - '}'#13#10+ - #13#10+ - 'defaultproperties'#13#10+ - '{'#13#10+ - ' PickupMessage="You have picked up a thing."'#13#10+ - '}'; -end; - -class function TSynUnrealSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangUnreal; -end; - -initialization - RegisterPlaceableHighlighter(TSynUnrealSyn); -end. +{------------------------------------------------------------------------------- +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. + PP - 2001/10/24: +The Original Code is based on the UnrealSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Dean Harmon. +Unicode translation by Maël Hörz. +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: SynHighlighterUnreal.pas,v 1.17.2.8 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Unreal syntax highlighter for SynEdit) +@author(Dean Harmon) +@created(2000) +@lastmod(2001-06-29) +} + +unit SynHighlighterUnreal; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + Windows, // registry constants + SynEditHighlighter, + SynEditTypes, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkComment, + tkDirective, + tkIdentifier, + tkKey, + tkKey2, + tkNull, + tkNumber, + tkSpace, + tkString, + tkString2, + tkSymbol, + tkUnknown); + + TxtkTokenKind = ( + xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign, + xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma, + xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan, + xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan, + xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr, + xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion, + xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft, + xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose, + xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor, + xtkXorAssign); + + TRangeState = (rsANil, rsAnsiC, rsDirective, rsDirectiveComment, rsUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + + TSynUnrealSyn = class(TSynCustomHighlighter) + private + FRange: TRangeState; + FRoundCount: Integer; + FSquareCount: Integer; + FTokenID: TtkTokenKind; + FExtTokenID: TxtkTokenKind; + FIdentFuncTable: array[0..732] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FDirecAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FInvalidAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FKey2Attri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FString2Attri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function FuncAbstract(Index: Integer): TtkTokenKind; + function FuncAlways(Index: Integer): TtkTokenKind; + function FuncArray(Index: Integer): TtkTokenKind; + function FuncArraycount(Index: Integer): TtkTokenKind; + function FuncAssert(Index: Integer): TtkTokenKind; + function FuncAuto(Index: Integer): TtkTokenKind; + function FuncAutomated(Index: Integer): TtkTokenKind; + function FuncBool(Index: Integer): TtkTokenKind; + function FuncBoundingbox(Index: Integer): TtkTokenKind; + function FuncBoundingvolume(Index: Integer): TtkTokenKind; + function FuncBreak(Index: Integer): TtkTokenKind; + function FuncButton(Index: Integer): TtkTokenKind; + function FuncByte(Index: Integer): TtkTokenKind; + function FuncCache(Index: Integer): TtkTokenKind; + function FuncCacheexempt(Index: Integer): TtkTokenKind; + function FuncCase(Index: Integer): TtkTokenKind; + function FuncCatch(Index: Integer): TtkTokenKind; + function FuncClass(Index: Integer): TtkTokenKind; + function FuncCoerce(Index: Integer): TtkTokenKind; + function FuncCollapsecategories(Index: Integer): TtkTokenKind; + function FuncColor(Index: Integer): TtkTokenKind; + function FuncConfig(Index: Integer): TtkTokenKind; + function FuncConst(Index: Integer): TtkTokenKind; + function FuncContinue(Index: Integer): TtkTokenKind; + function FuncCoords(Index: Integer): TtkTokenKind; + function FuncCpptext(Index: Integer): TtkTokenKind; + function FuncCross(Index: Integer): TtkTokenKind; + function FuncDefault(Index: Integer): TtkTokenKind; + function FuncDefaultproperties(Index: Integer): TtkTokenKind; + function FuncDelegate(Index: Integer): TtkTokenKind; + function FuncDelete(Index: Integer): TtkTokenKind; + function FuncDependson(Index: Integer): TtkTokenKind; + function FuncDeprecated(Index: Integer): TtkTokenKind; + function FuncDo(Index: Integer): TtkTokenKind; + function FuncDontcollapsecategories(Index: Integer): TtkTokenKind; + function FuncDot(Index: Integer): TtkTokenKind; + function FuncEach(Index: Integer): TtkTokenKind; + function FuncEdfindable(Index: Integer): TtkTokenKind; + function FuncEditconst(Index: Integer): TtkTokenKind; + function FuncEditconstarray(Index: Integer): TtkTokenKind; + function FuncEditinline(Index: Integer): TtkTokenKind; + function FuncEditinlinenew(Index: Integer): TtkTokenKind; + function FuncEditinlinenotify(Index: Integer): TtkTokenKind; + function FuncEditinlineuse(Index: Integer): TtkTokenKind; + function FuncElse(Index: Integer): TtkTokenKind; + function FuncEnum(Index: Integer): TtkTokenKind; + function FuncEnumcount(Index: Integer): TtkTokenKind; + function FuncEvent(Index: Integer): TtkTokenKind; + function FuncExec(Index: Integer): TtkTokenKind; + function FuncExpands(Index: Integer): TtkTokenKind; + function FuncExplicit(Index: Integer): TtkTokenKind; + function FuncExport(Index: Integer): TtkTokenKind; + function FuncExportstructs(Index: Integer): TtkTokenKind; + function FuncExtends(Index: Integer): TtkTokenKind; + function FuncFalse(Index: Integer): TtkTokenKind; + function FuncFinal(Index: Integer): TtkTokenKind; + function FuncFloat(Index: Integer): TtkTokenKind; + function FuncFor(Index: Integer): TtkTokenKind; + function FuncForeach(Index: Integer): TtkTokenKind; + function FuncFunction(Index: Integer): TtkTokenKind; + function FuncGlobal(Index: Integer): TtkTokenKind; + function FuncGlobalconfig(Index: Integer): TtkTokenKind; + function FuncGoto(Index: Integer): TtkTokenKind; + function FuncGuid(Index: Integer): TtkTokenKind; + function FuncHidecategories(Index: Integer): TtkTokenKind; + function FuncHidedropdown(Index: Integer): TtkTokenKind; + function FuncHideparent(Index: Integer): TtkTokenKind; + function FuncIf(Index: Integer): TtkTokenKind; + function FuncIgnores(Index: Integer): TtkTokenKind; + function FuncImport(Index: Integer): TtkTokenKind; + function FuncInit(Index: Integer): TtkTokenKind; + function FuncInput(Index: Integer): TtkTokenKind; + function FuncInsert(Index: Integer): TtkTokenKind; + function FuncInstanced(Index: Integer): TtkTokenKind; + function FuncInt(Index: Integer): TtkTokenKind; + function FuncIntrinsic(Index: Integer): TtkTokenKind; + function FuncInvariant(Index: Integer): TtkTokenKind; + function FuncIterator(Index: Integer): TtkTokenKind; + function FuncLatent(Index: Integer): TtkTokenKind; + function FuncLength(Index: Integer): TtkTokenKind; + function FuncLocal(Index: Integer): TtkTokenKind; + function FuncLocalized(Index: Integer): TtkTokenKind; + function FuncLong(Index: Integer): TtkTokenKind; + function FuncMesh(Index: Integer): TtkTokenKind; + function FuncModel(Index: Integer): TtkTokenKind; + function FuncMutable(Index: Integer): TtkTokenKind; + function FuncName(Index: Integer): TtkTokenKind; + function FuncNative(Index: Integer): TtkTokenKind; + function FuncNativereplication(Index: Integer): TtkTokenKind; + function FuncNew(Index: Integer): TtkTokenKind; + function FuncNoexport(Index: Integer): TtkTokenKind; + function FuncNone(Index: Integer): TtkTokenKind; + function FuncNoteditinlinenew(Index: Integer): TtkTokenKind; + function FuncNotplaceable(Index: Integer): TtkTokenKind; + function FuncNousercreate(Index: Integer): TtkTokenKind; + function FuncOperator(Index: Integer): TtkTokenKind; + function FuncOptional(Index: Integer): TtkTokenKind; + function FuncOut(Index: Integer): TtkTokenKind; + function FuncParseconfig(Index: Integer): TtkTokenKind; + function FuncPerobjectconfig(Index: Integer): TtkTokenKind; + function FuncPlaceable(Index: Integer): TtkTokenKind; + function FuncPlane(Index: Integer): TtkTokenKind; + function FuncPointer(Index: Integer): TtkTokenKind; + function FuncPostoperator(Index: Integer): TtkTokenKind; + function FuncPreoperator(Index: Integer): TtkTokenKind; + function FuncPrivate(Index: Integer): TtkTokenKind; + function FuncProtected(Index: Integer): TtkTokenKind; + function FuncRegister(Index: Integer): TtkTokenKind; + function FuncReliable(Index: Integer): TtkTokenKind; + function FuncRemove(Index: Integer): TtkTokenKind; + function FuncReplication(Index: Integer): TtkTokenKind; + function FuncReturn(Index: Integer): TtkTokenKind; + function FuncRng(Index: Integer): TtkTokenKind; + function FuncRot(Index: Integer): TtkTokenKind; + function FuncRotator(Index: Integer): TtkTokenKind; + function FuncSafereplace(Index: Integer): TtkTokenKind; + function FuncScale(Index: Integer): TtkTokenKind; + function FuncScriptconst(Index: Integer): TtkTokenKind; + function FuncSelf(Index: Integer): TtkTokenKind; + function FuncShowcategories(Index: Integer): TtkTokenKind; + function FuncSimulated(Index: Integer): TtkTokenKind; + function FuncSingular(Index: Integer): TtkTokenKind; + function FuncSkip(Index: Integer): TtkTokenKind; + function FuncSound(Index: Integer): TtkTokenKind; + function FuncState(Index: Integer): TtkTokenKind; + function FuncStatic(Index: Integer): TtkTokenKind; + function FuncStop(Index: Integer): TtkTokenKind; + function FuncString(Index: Integer): TtkTokenKind; + function FuncStruct(Index: Integer): TtkTokenKind; + function FuncSuper(Index: Integer): TtkTokenKind; + function FuncSwitch(Index: Integer): TtkTokenKind; + function FuncTexture(Index: Integer): TtkTokenKind; + function FuncTransient(Index: Integer): TtkTokenKind; + function FuncTravel(Index: Integer): TtkTokenKind; + function FuncTrue(Index: Integer): TtkTokenKind; + function FuncUnreliable(Index: Integer): TtkTokenKind; + function FuncUntil(Index: Integer): TtkTokenKind; + function FuncVar(Index: Integer): TtkTokenKind; + function FuncVect(Index: Integer): TtkTokenKind; + function FuncVector(Index: Integer): TtkTokenKind; + function FuncVoid(Index: Integer): TtkTokenKind; + function FuncWhile(Index: Integer): TtkTokenKind; + function FuncWithin(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure AnsiCProc; + procedure AndSymbolProc; + procedure AsciiCharProc; + procedure BraceCloseProc; + procedure BraceOpenProc; + procedure CRProc; + procedure ColonProc; + procedure CommaProc; + procedure DirectiveProc; + procedure EqualProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure MinusProc; + procedure ModSymbolProc; + procedure NotSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure QuestionProc; + procedure RoundCloseProc; + procedure RoundOpenProc; + procedure SemiColonProc; + procedure SlashProc; + procedure SpaceProc; + procedure SquareCloseProc; + procedure SquareOpenProc; + procedure StarProc; + procedure StringProc; + procedure DollarSignProc; + procedure TildeProc; + procedure XOrSymbolProc; + procedure UnknownProc; + protected + function GetExtTokenID: TxtkTokenKind; + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + procedure NextProcedure; + public + class function GetCapabilities: TSynHighlighterCapabilities; override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + function UseUserSettings(settingIndex: Integer): Boolean; override; + procedure EnumUserSettings(settings: TStrings); override; + property ExtTokenID: TxtkTokenKind read GetExtTokenID; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property DirecAttri: TSynHighlighterAttributes read FDirecAttri + write FDirecAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri + write FInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property Key2Attri: TSynHighlighterAttributes read FKey2Attri write FKey2Attri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SingleStringAttri: TSynHighlighterAttributes read FString2Attri + write FString2Attri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..142] of UnicodeString = ( + 'abstract', 'always', 'array', 'arraycount', 'assert', 'auto', 'automated', + 'bool', 'boundingbox', 'boundingvolume', 'break', 'button', 'byte', 'cache', + 'cacheexempt', 'case', 'catch', 'class', 'coerce', 'collapsecategories', + 'color', 'config', 'const', 'continue', 'coords', 'cpptext', 'cross', + 'default', 'defaultproperties', 'delegate', 'delete', 'dependson', + 'deprecated', 'do', 'dontcollapsecategories', 'dot', 'each', 'edfindable', + 'editconst', 'editconstarray', 'editinline', 'editinlinenew', + 'editinlinenotify', 'editinlineuse', 'else', 'enum', 'enumcount', 'event', + 'exec', 'expands', 'explicit', 'export', 'exportstructs', 'extends', + 'false', 'final', 'float', 'for', 'foreach', 'function', 'global', + 'globalconfig', 'goto', 'guid', 'hidecategories', 'hidedropdown', + 'hideparent', 'if', 'ignores', 'import', 'init', 'input', 'insert', + 'instanced', 'int', 'intrinsic', 'invariant', 'iterator', 'latent', + 'length', 'local', 'localized', 'long', 'mesh', 'model', 'mutable', 'name', + 'native', 'nativereplication', 'new', 'noexport', 'none', + 'noteditinlinenew', 'notplaceable', 'nousercreate', 'operator', 'optional', + 'out', 'parseconfig', 'perobjectconfig', 'placeable', 'plane', 'pointer', + 'postoperator', 'preoperator', 'private', 'protected', 'register', + 'reliable', 'remove', 'replication', 'return', 'rng', 'rot', 'rotator', + 'safereplace', 'scale', 'scriptconst', 'self', 'showcategories', + 'simulated', 'singular', 'skip', 'sound', 'state', 'static', 'stop', + 'string', 'struct', 'super', 'switch', 'texture', 'transient', 'travel', + 'true', 'unreliable', 'until', 'var', 'vect', 'vector', 'void', 'while', + 'within' + ); + + KeyIndices: array[0..732] of Integer = ( + -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 34, -1, -1, -1, 18, -1, -1, -1, -1, -1, 30, 1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, 114, + -1, -1, 121, -1, -1, -1, -1, -1, 105, -1, -1, 108, -1, 135, 9, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 117, 33, 109, -1, -1, -1, -1, -1, -1, 90, -1, -1, + -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 19, -1, + -1, -1, -1, 81, -1, 82, -1, -1, -1, -1, 40, 15, -1, -1, -1, 52, -1, 80, -1, + -1, -1, -1, -1, -1, 136, -1, -1, 61, -1, 113, -1, -1, -1, 83, -1, -1, -1, + -1, -1, -1, 27, -1, -1, 133, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, + 76, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, + 51, -1, -1, -1, -1, 44, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 20, -1, -1, -1, 8, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, + -1, -1, -1, -1, -1, 39, 24, -1, -1, -1, -1, 54, -1, 4, 123, -1, -1, -1, -1, + -1, -1, 50, 141, -1, -1, -1, -1, -1, -1, -1, 87, -1, -1, 21, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, 85, -1, + -1, -1, -1, -1, 70, -1, 68, 131, -1, -1, 69, -1, -1, -1, -1, -1, 128, 26, + -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, 142, -1, -1, 122, -1, 74, -1, -1, + -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, 101, 119, -1, -1, 94, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, 89, -1, -1, 0, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, 92, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, 67, -1, -1, 45, -1, + 116, -1, -1, 132, 28, -1, -1, -1, 31, -1, -1, -1, 77, -1, -1, -1, -1, -1, + 91, -1, 37, -1, -1, -1, -1, 35, -1, 6, -1, -1, -1, -1, -1, -1, -1, 97, -1, + -1, -1, -1, -1, 53, -1, 84, -1, -1, -1, -1, 56, 14, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 23, -1, 107, -1, -1, -1, -1, 98, -1, -1, 75, -1, -1, -1, -1, + -1, 88, -1, -1, 103, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + 139, 11, 42, -1, -1, 95, -1, -1, -1, -1, -1, 3, -1, -1, -1, 38, -1, -1, -1, + -1, -1, -1, -1, -1, 16, -1, 46, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, 41, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 64, -1, -1, -1, -1, 86, -1, 58, 43, 72, -1, -1, 66, + 137, 71, -1, -1, -1, -1, -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, 17, 130, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, 73, -1, -1, 118, -1, -1, -1, + -1, -1, -1, 138, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, + -1, -1, -1, 32, 47, 49, -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, + -1, 125, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, 12, -1, 127, + 140, -1, -1 + ); + +{$Q-} +function TSynUnrealSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 41 + Ord(Str^) * 701; + Inc(Str); + end; + Result := Result mod 733; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynUnrealSyn.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 TSynUnrealSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[410] := FuncAbstract; + FIdentFuncTable[71] := FuncAlways; + FIdentFuncTable[219] := FuncArray; + FIdentFuncTable[554] := FuncArraycount; + FIdentFuncTable[294] := FuncAssert; + FIdentFuncTable[681] := FuncAuto; + FIdentFuncTable[477] := FuncAutomated; + FIdentFuncTable[364] := FuncBool; + FIdentFuncTable[249] := FuncBoundingbox; + FIdentFuncTable[109] := FuncBoundingvolume; + FIdentFuncTable[675] := FuncBreak; + FIdentFuncTable[544] := FuncButton; + FIdentFuncTable[727] := FuncByte; + FIdentFuncTable[380] := FuncCache; + FIdentFuncTable[499] := FuncCacheexempt; + FIdentFuncTable[160] := FuncCase; + FIdentFuncTable[567] := FuncCatch; + FIdentFuncTable[635] := FuncClass; + FIdentFuncTable[64] := FuncCoerce; + FIdentFuncTable[147] := FuncCollapsecategories; + FIdentFuncTable[245] := FuncColor; + FIdentFuncTable[314] := FuncConfig; + FIdentFuncTable[231] := FuncConst; + FIdentFuncTable[510] := FuncContinue; + FIdentFuncTable[287] := FuncCoords; + FIdentFuncTable[11] := FuncCpptext; + FIdentFuncTable[355] := FuncCross; + FIdentFuncTable[189] := FuncDefault; + FIdentFuncTable[454] := FuncDefaultproperties; + FIdentFuncTable[425] := FuncDelegate; + FIdentFuncTable[70] := FuncDelete; + FIdentFuncTable[458] := FuncDependson; + FIdentFuncTable[696] := FuncDeprecated; + FIdentFuncTable[120] := FuncDo; + FIdentFuncTable[60] := FuncDontcollapsecategories; + FIdentFuncTable[475] := FuncDot; + FIdentFuncTable[49] := FuncEach; + FIdentFuncTable[470] := FuncEdfindable; + FIdentFuncTable[558] := FuncEditconst; + FIdentFuncTable[286] := FuncEditconstarray; + FIdentFuncTable[159] := FuncEditinline; + FIdentFuncTable[596] := FuncEditinlinenew; + FIdentFuncTable[545] := FuncEditinlinenotify; + FIdentFuncTable[614] := FuncEditinlineuse; + FIdentFuncTable[229] := FuncElse; + FIdentFuncTable[448] := FuncEnum; + FIdentFuncTable[569] := FuncEnumcount; + FIdentFuncTable[697] := FuncEvent; + FIdentFuncTable[605] := FuncExec; + FIdentFuncTable[698] := FuncExpands; + FIdentFuncTable[302] := FuncExplicit; + FIdentFuncTable[224] := FuncExport; + FIdentFuncTable[164] := FuncExportstructs; + FIdentFuncTable[491] := FuncExtends; + FIdentFuncTable[292] := FuncFalse; + FIdentFuncTable[662] := FuncFinal; + FIdentFuncTable[498] := FuncFloat; + FIdentFuncTable[706] := FuncFor; + FIdentFuncTable[613] := FuncForeach; + FIdentFuncTable[542] := FuncFunction; + FIdentFuncTable[330] := FuncGlobal; + FIdentFuncTable[176] := FuncGlobalconfig; + FIdentFuncTable[197] := FuncGoto; + FIdentFuncTable[89] := FuncGuid; + FIdentFuncTable[606] := FuncHidecategories; + FIdentFuncTable[278] := FuncHidedropdown; + FIdentFuncTable[618] := FuncHideparent; + FIdentFuncTable[445] := FuncIf; + FIdentFuncTable[344] := FuncIgnores; + FIdentFuncTable[348] := FuncImport; + FIdentFuncTable[342] := FuncInit; + FIdentFuncTable[620] := FuncInput; + FIdentFuncTable[615] := FuncInsert; + FIdentFuncTable[648] := FuncInstanced; + FIdentFuncTable[372] := FuncInt; + FIdentFuncTable[520] := FuncIntrinsic; + FIdentFuncTable[205] := FuncInvariant; + FIdentFuncTable[462] := FuncIterator; + FIdentFuncTable[6] := FuncLatent; + FIdentFuncTable[24] := FuncLength; + FIdentFuncTable[166] := FuncLocal; + FIdentFuncTable[152] := FuncLocalized; + FIdentFuncTable[154] := FuncLong; + FIdentFuncTable[182] := FuncMesh; + FIdentFuncTable[493] := FuncModel; + FIdentFuncTable[336] := FuncMutable; + FIdentFuncTable[611] := FuncName; + FIdentFuncTable[311] := FuncNative; + FIdentFuncTable[526] := FuncNativereplication; + FIdentFuncTable[407] := FuncNew; + FIdentFuncTable[128] := FuncNoexport; + FIdentFuncTable[468] := FuncNone; + FIdentFuncTable[428] := FuncNoteditinlinenew; + FIdentFuncTable[532] := FuncNotplaceable; + FIdentFuncTable[389] := FuncNousercreate; + FIdentFuncTable[548] := FuncOperator; + FIdentFuncTable[265] := FuncOptional; + FIdentFuncTable[485] := FuncOut; + FIdentFuncTable[517] := FuncParseconfig; + FIdentFuncTable[726] := FuncPerobjectconfig; + FIdentFuncTable[401] := FuncPlaceable; + FIdentFuncTable[385] := FuncPlane; + FIdentFuncTable[575] := FuncPointer; + FIdentFuncTable[529] := FuncPostoperator; + FIdentFuncTable[33] := FuncPreoperator; + FIdentFuncTable[103] := FuncPrivate; + FIdentFuncTable[134] := FuncProtected; + FIdentFuncTable[512] := FuncRegister; + FIdentFuncTable[106] := FuncReliable; + FIdentFuncTable[121] := FuncRemove; + FIdentFuncTable[253] := FuncReplication; + FIdentFuncTable[593] := FuncReturn; + FIdentFuncTable[440] := FuncRng; + FIdentFuncTable[178] := FuncRot; + FIdentFuncTable[94] := FuncRotator; + FIdentFuncTable[691] := FuncSafereplace; + FIdentFuncTable[450] := FuncScale; + FIdentFuncTable[119] := FuncScriptconst; + FIdentFuncTable[651] := FuncSelf; + FIdentFuncTable[386] := FuncShowcategories; + FIdentFuncTable[646] := FuncSimulated; + FIdentFuncTable[97] := FuncSingular; + FIdentFuncTable[370] := FuncSkip; + FIdentFuncTable[295] := FuncSound; + FIdentFuncTable[142] := FuncState; + FIdentFuncTable[713] := FuncStatic; + FIdentFuncTable[213] := FuncStop; + FIdentFuncTable[729] := FuncString; + FIdentFuncTable[354] := FuncStruct; + FIdentFuncTable[626] := FuncSuper; + FIdentFuncTable[636] := FuncSwitch; + FIdentFuncTable[345] := FuncTexture; + FIdentFuncTable[453] := FuncTransient; + FIdentFuncTable[192] := FuncTravel; + FIdentFuncTable[714] := FuncTrue; + FIdentFuncTable[108] := FuncUnreliable; + FIdentFuncTable[173] := FuncUntil; + FIdentFuncTable[619] := FuncVar; + FIdentFuncTable[658] := FuncVect; + FIdentFuncTable[543] := FuncVector; + FIdentFuncTable[730] := FuncVoid; + FIdentFuncTable[303] := FuncWhile; + FIdentFuncTable[367] := FuncWithin; +end; + +function TSynUnrealSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncAbstract(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncAlways(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncArray(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncArraycount(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncAssert(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncAuto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncAutomated(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncBool(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncBoundingbox(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncBoundingvolume(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncBreak(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncButton(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncByte(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCache(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCacheexempt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCase(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCatch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncClass(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCoerce(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCollapsecategories(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncColor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncConfig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncConst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncContinue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCoords(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncCpptext(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; + +end; + +function TSynUnrealSyn.FuncCross(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkSymbol + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDefault(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDefaultproperties(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDelegate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDelete(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDependson(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDeprecated(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDo(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDontcollapsecategories(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncDot(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkSymbol + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEach(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEdfindable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditconst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditconstarray(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditinline(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditinlinenew(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditinlinenotify(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEditinlineuse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncElse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEnum(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEnumcount(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncEvent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExec(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExpands(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExplicit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExportstructs(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncExtends(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncFalse(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncFinal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncFloat(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncFor(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncForeach(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncFunction(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncGlobal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncGlobalconfig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncGoto(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncGuid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncHidecategories(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncHidedropdown(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncHideparent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncIf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncIgnores(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncImport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInit(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInput(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInsert(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInstanced(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInt(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncIntrinsic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncInvariant(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncIterator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncLatent(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncLength(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncLocal(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncLocalized(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncLong(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncMesh(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncModel(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncMutable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncName(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNative(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNativereplication(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNew(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNoexport(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNone(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNoteditinlinenew(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNotplaceable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncNousercreate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncOperator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncOptional(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncOut(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncParseconfig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPerobjectconfig(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPlaceable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPlane(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPointer(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPostoperator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPreoperator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncPrivate(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncProtected(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncRegister(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncReliable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncRemove(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncReplication(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncReturn(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncRng(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncRot(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncRotator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSafereplace(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncScale(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncScriptconst(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSelf(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncShowcategories(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSimulated(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; + +end; + +function TSynUnrealSyn.FuncSingular(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSkip(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSound(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncState(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncStatic(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncStop(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncString(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncStruct(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSuper(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncSwitch(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncTexture(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncTransient(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncTravel(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncTrue(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncUnreliable(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey2 + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncUntil(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncVar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncVect(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncVector(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncVoid(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncWhile(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynUnrealSyn.FuncWithin(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +constructor TSynUnrealSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(FInvalidAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FKey2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + FKey2Attri.Style:= [fsBold]; + AddAttribute(FKey2Attri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FString2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSingleString, SYNS_FriendlyAttrSingleString); + AddAttribute(FString2Attri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + AddAttribute(FDirecAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FRange := rsUnknown; + FDefaultFilter := SYNS_FilterCPP; +end; { Create } + +procedure TSynUnrealSyn.AnsiCProc; +begin + FTokenID := tkComment; + case FLine[Run] of + #0: + begin + NullProc; + Exit; + end; + #10: + begin + LFProc; + Exit; + end; + #13: + begin + CRProc; + Exit; + end; + end; + + while not IsLineEnd(Run) do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + if FRange = rsDirectiveComment then + FRange := rsDirective + else + FRange := rsUnknown; + Break; + end else + Inc(Run); + #10, #13: + Break; + else + Inc(Run); + end; +end; + +procedure TSynUnrealSyn.AndSymbolProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {and assign} + begin + Inc(Run, 2); + FExtTokenID := xtkAndAssign; + end; + '&': {logical and} + begin + Inc(Run, 2); + FExtTokenID := xtkLogAnd; + end; + else {and} + begin + Inc(Run); + FExtTokenID := xtkAnd; + end; + end; +end; + +procedure TSynUnrealSyn.AsciiCharProc; +begin + FTokenID := tkString2; + repeat + if IsLineEnd(Run) then Break; + if FLine[Run] = #92 then {backslash} + {if we have an escaped single quote it doesn't count} + if FLine[Run + 1] = #39 then Inc(Run); + Inc(Run); + until FLine[Run] = #39; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynUnrealSyn.BraceCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkBraceClose; +end; + +procedure TSynUnrealSyn.BraceOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkBraceOpen; +end; + +procedure TSynUnrealSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run + 1] = #10 then Inc(Run); +end; + +procedure TSynUnrealSyn.ColonProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + ':': {scope resolution operator} + begin + Inc(Run, 2); + FExtTokenID := xtkScopeResolution; + end; + else {colon} + begin + Inc(Run); + FExtTokenID := xtkColon; + end; + end; +end; + +procedure TSynUnrealSyn.CommaProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkComma; +end; + +procedure TSynUnrealSyn.DirectiveProc; +begin + if IsLineEnd(Run) then + begin + if (Run <= 0) then + FRange := rsUnknown; + NextProcedure; + end + else + begin + FTokenID := tkDirective; + while TRUE do + case FLine[Run] of + '/': // comment? + begin + if FLine[Run + 1] = '/' then // is end of directive as well + Break + else if FLine[Run + 1] = '*' then + begin // might be embedded only + FRange := rsDirectiveComment; + Break; + end else + Inc(Run); + end; + #0, #10, #13: + begin + FRange := rsUnknown; + Break; + end; + else Inc(Run); + end; + end; +end; + +procedure TSynUnrealSyn.EqualProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {logical equal} + begin + Inc(Run, 2); + FExtTokenID := xtkLogEqual; + end; + else {assign} + begin + Inc(Run); + FExtTokenID := xtkAssign; + end; + end; +end; + +procedure TSynUnrealSyn.GreaterProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {greater than or equal to} + begin + Inc(Run, 2); + FExtTokenID := xtkGreaterThanEqual; + end; + '>': + begin + if FLine[Run + 2] = '=' then {shift right assign} + begin + Inc(Run, 3); + FExtTokenID := xtkShiftRightAssign; + end + else {shift right} + begin + Inc(Run, 2); + FExtTokenID := xtkShiftRight; + end; + end; + else {greater than} + begin + Inc(Run); + FExtTokenID := xtkGreaterThan; + end; + end; +end; + +procedure TSynUnrealSyn.QuestionProc; +begin + FTokenID := tkSymbol; {conditional} + FExtTokenID := xtkQuestion; + Inc(Run); +end; + +procedure TSynUnrealSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynUnrealSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynUnrealSyn.LowerProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {less than or equal to} + begin + Inc(Run, 2); + FExtTokenID := xtkLessThanEqual; + end; + '<': + begin + if FLine[Run + 2] = '=' then {shift left assign} + begin + Inc(Run, 3); + FExtTokenID := xtkShiftLeftAssign; + end + else {shift left} + begin + Inc(Run, 2); + FExtTokenID := xtkShiftLeft; + end; + end; + else {less than} + begin + Inc(Run); + FExtTokenID := xtkLessThan; + end; + end; +end; + +procedure TSynUnrealSyn.MinusProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {subtract assign} + begin + Inc(Run, 2); + FExtTokenID := xtkSubtractAssign; + end; + '-': {decrement} + begin + Inc(Run, 2); + FExtTokenID := xtkDecrement; + end; + '>': {arrow} + begin + Inc(Run, 2); + FExtTokenID := xtkArrow; + end; + else {subtract} + begin + Inc(Run); + FExtTokenID := xtkSubtract; + end; + end; +end; + +procedure TSynUnrealSyn.ModSymbolProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {mod assign} + begin + Inc(Run, 2); + FExtTokenID := xtkModAssign; + end; + else {mod} + begin + Inc(Run); + FExtTokenID := xtkMod; + end; + end; +end; + +procedure TSynUnrealSyn.NotSymbolProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {not equal} + begin + Inc(Run, 2); + FExtTokenID := xtkNotEqual; + end; + else {not} + begin + Inc(Run); + FExtTokenID := xtkLogComplement; + end; + end; +end; + +procedure TSynUnrealSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynUnrealSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + '.': + if FLine[Run + 1] = '.' then + Break; + end; + Inc(Run); + end; +end; + +procedure TSynUnrealSyn.OrSymbolProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {or assign} + begin + Inc(Run, 2); + FExtTokenID := xtkIncOrAssign; + end; + '|': {logical or} + begin + Inc(Run, 2); + FExtTokenID := xtkLogOr; + end; + else {or} + begin + Inc(Run); + FExtTokenID := xtkIncOr; + end; + end; +end; + +procedure TSynUnrealSyn.PlusProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {add assign} + begin + Inc(Run, 2); + FExtTokenID := xtkAddAssign; + end; + '+': {increment} + begin + Inc(Run, 2); + FExtTokenID := xtkIncrement; + end; + else {add} + begin + Inc(Run); + FExtTokenID := xtkAdd; + end; + end; +end; + +procedure TSynUnrealSyn.PointProc; +begin + FTokenID := tkSymbol; + if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then + begin {ellipse} + Inc(Run, 3); + FExtTokenID := xtkEllipse; + end + else {point} + begin + Inc(Run); + FExtTokenID := xtkPoint; + end; +end; + +procedure TSynUnrealSyn.RoundCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkRoundClose; + Dec(FRoundCount); +end; + +procedure TSynUnrealSyn.RoundOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkRoundOpen; + Inc(FRoundCount); +end; + +procedure TSynUnrealSyn.SemiColonProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSemiColon; +end; + +procedure TSynUnrealSyn.SlashProc; +begin + case FLine[Run + 1] of + '/': {c++ style comments} + begin + FTokenID := tkComment; + Inc(Run, 2); + while not IsLineEnd(Run) do Inc(Run); + end; + '*': {c style comments} + begin + FTokenID := tkComment; + if FRange <> rsDirectiveComment then + FRange := rsAnsiC; + Inc(Run, 2); + while not IsLineEnd(Run) do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + Inc(Run, 2); + if FRange = rsDirectiveComment then + FRange := rsDirective + else + FRange := rsUnknown; + Break; + end else Inc(Run); + #10, #13: + begin + if FRange = rsDirectiveComment then + FRange := rsAnsiC; + Break; + end; + else Inc(Run); + end; + end; + '=': {divide assign} + begin + Inc(Run, 2); + FTokenID := tkSymbol; + FExtTokenID := xtkDivideAssign; + end; + else {divide} + begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkDivide; + end; + end; +end; + +procedure TSynUnrealSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynUnrealSyn.SquareCloseProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSquareClose; + Dec(FSquareCount); +end; + +procedure TSynUnrealSyn.SquareOpenProc; +begin + Inc(Run); + FTokenID := tkSymbol; + FExtTokenID := xtkSquareOpen; + Inc(FSquareCount); +end; + +procedure TSynUnrealSyn.StarProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {multiply assign} + begin + Inc(Run, 2); + FExtTokenID := xtkMultiplyAssign; + end; + else {star} + begin + Inc(Run); + FExtTokenID := xtkStar; + end; + end; +end; + +procedure TSynUnrealSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then + Break; + if FLine[Run] = #92 then {backslash} + case FLine[Run + 1] of + #10: Inc(Run); {line continuation character} + #34: Inc(Run); {escaped quote doesn't count} + #92: Inc(Run); + end; + Inc(Run); + until FLine[Run] = #34; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynUnrealSyn.DollarSignProc; +begin + FTokenID := tkSymbol; + Inc(run); +end; + + +procedure TSynUnrealSyn.TildeProc; +begin + Inc(Run); {bitwise complement} + FTokenID := tkSymbol; + FExtTokenID := xtkBitComplement; +end; + +procedure TSynUnrealSyn.XOrSymbolProc; +begin + FTokenID := tkSymbol; + case FLine[Run + 1] of + '=': {xor assign} + begin + Inc(Run, 2); + FExtTokenID := xtkXorAssign; + end; + else {xor} + begin + Inc(Run); + FExtTokenID := xtkXor; + end; + end; +end; + +procedure TSynUnrealSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynUnrealSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsAnsiC, rsDirectiveComment: AnsiCProc; + rsDirective: DirectiveProc; + else + begin + FRange := rsUnknown; + NextProcedure + end; + end; + inherited; +end; + +procedure TSynUnrealSyn.NextProcedure; +begin + case FLine[Run] of + '&': AndSymbolProc; + #39: AsciiCharProc; + '}': BraceCloseProc; + '{': BraceOpenProc; + #13: CRProc; + ':': ColonProc; + ',': CommaProc; + '#': DirectiveProc; + '=': EqualProc; + '>': GreaterProc; + '?': QuestionProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + '-': MinusProc; + '%': ModSymbolProc; + '!': NotSymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + ')': RoundCloseProc; + '(': RoundOpenProc; + ';': SemiColonProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + ']': SquareCloseProc; + '[': SquareOpenProc; + '*': StarProc; + #34: StringProc; + '$', '@': DollarSignProc; + '~': TildeProc; + '^': XOrSymbolProc; + else UnknownProc; + end; +end; + +function TSynUnrealSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_KEYWORD: Result := FKeyAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_STRING: Result := FStringAttri; + SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynUnrealSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynUnrealSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynUnrealSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynUnrealSyn.GetExtTokenID: TxtkTokenKind; +begin + Result := FExtTokenID; +end; + + +function TSynUnrealSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterCPP; +end; { IsFilterStored } + + +function TSynUnrealSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkDirective: Result := FDirecAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkKey2: Result := FKey2Attri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkString2: Result := FString2Attri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FInvalidAttri; + else Result := nil; + end; +end; + +function TSynUnrealSyn.GetTokenKind: Integer; +begin + Result := Ord(GetTokenID); +end; + +procedure TSynUnrealSyn.ResetRange; +begin + FRange:= rsUnknown; +end; + +procedure TSynUnrealSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynUnrealSyn.EnumUserSettings(settings: TStrings); +begin + { returns the user settings that exist in the registry } + with TBetterRegistry.Create do + begin + try + RootKey := HKEY_LOCAL_MACHINE; + if OpenKeyReadOnly('\SOFTWARE\Borland\C++Builder') then + begin + try + GetKeyNames(settings); + finally + CloseKey; + end; + end; + finally + Free; + end; + end; +end; + +function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; +// Possible parameter values: +// index into TStrings returned by EnumUserSettings +// Possible return values: +// true : settings were read and used +// False: problem reading settings or invalid version specified - old settings +// were preserved + + function ReadCPPBSettings(settingIndex: Integer): Boolean; + + function ReadCPPBSetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + + function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean; + var + i: Integer; + begin + for i := 1 to Length(name) do + if name[i] = ' ' then name[i] := '_'; + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name,true); + end; { ReadCPPB1 } + + function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; + begin + Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, + '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight', + key, False); + end; { ReadCPPB3OrMore } + + begin { ReadCPPBSetting } + try + if (settingTag[1] = '1') + then Result := ReadCPPB1(settingTag,attri,key) + else Result := ReadCPPB3OrMore(settingTag,attri,key); + except Result := False; end; + end; { ReadCPPBSetting } + + var + tmpStringAttri : TSynHighlighterAttributes; + tmpNumberAttri : TSynHighlighterAttributes; + tmpKeyAttri : TSynHighlighterAttributes; + tmpSymbolAttri : TSynHighlighterAttributes; + tmpCommentAttri : TSynHighlighterAttributes; + tmpIdentifierAttri: TSynHighlighterAttributes; + tmpInvalidAttri : TSynHighlighterAttributes; + tmpSpaceAttri : TSynHighlighterAttributes; + tmpDirecAttri : TSynHighlighterAttributes; + sl : TStringList; + + begin { ReadCPPBSettings } + sl := TStringList.Create; + try + EnumUserSettings(sl); + if settingIndex >= sl.Count then Result := False + else begin + tmpStringAttri := TSynHighlighterAttributes.Create('', ''); + tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); + tmpKeyAttri := TSynHighlighterAttributes.Create('', ''); + tmpSymbolAttri := TSynHighlighterAttributes.Create('', ''); + tmpCommentAttri := TSynHighlighterAttributes.Create('', ''); + tmpIdentifierAttri:= TSynHighlighterAttributes.Create('', ''); + tmpInvalidAttri := TSynHighlighterAttributes.Create('', ''); + tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); + tmpDirecAttri := TSynHighlighterAttributes.Create('', ''); + tmpStringAttri .Assign(FStringAttri); + tmpNumberAttri .Assign(FNumberAttri); + tmpKeyAttri .Assign(FKeyAttri); + tmpSymbolAttri .Assign(FSymbolAttri); + tmpCommentAttri .Assign(FCommentAttri); + tmpIdentifierAttri.Assign(FIdentifierAttri); + tmpInvalidAttri .Assign(FInvalidAttri); + tmpSpaceAttri .Assign(FSpaceAttri); + tmpDirecAttri .Assign(FDirecAttri); + Result := ReadCPPBSetting(sl[settingIndex],FCommentAttri,'Comment') and + ReadCPPBSetting(sl[settingIndex],FIdentifierAttri,'Identifier') and + ReadCPPBSetting(sl[settingIndex],FInvalidAttri,'Illegal Char') and + ReadCPPBSetting(sl[settingIndex],FKeyAttri,'Reserved word') and + ReadCPPBSetting(sl[settingIndex],FNumberAttri,'Integer') and + ReadCPPBSetting(sl[settingIndex],FSpaceAttri,'Whitespace') and + ReadCPPBSetting(sl[settingIndex],FStringAttri,'String') and + ReadCPPBSetting(sl[settingIndex],FSymbolAttri,'Symbol') and + ReadCPPBSetting(sl[settingIndex],FDirecAttri,'Preprocessor'); + if not Result then begin + FStringAttri .Assign(tmpStringAttri); + FString2Attri .Assign(tmpStringAttri); + FNumberAttri .Assign(tmpNumberAttri); + FKeyAttri .Assign(tmpKeyAttri); + FKey2Attri .Assign(tmpKeyAttri); + FSymbolAttri .Assign(tmpSymbolAttri); + FCommentAttri .Assign(tmpCommentAttri); + FIdentifierAttri.Assign(tmpIdentifierAttri); + FInvalidAttri.Assign(tmpInvalidAttri); + FSpaceAttri .Assign(tmpSpaceAttri); + FDirecAttri .Assign(tmpDirecAttri); + end; + tmpStringAttri .Free; + tmpNumberAttri .Free; + tmpKeyAttri .Free; + tmpSymbolAttri .Free; + tmpCommentAttri .Free; + tmpIdentifierAttri.Free; + tmpInvalidAttri .Free; + tmpSpaceAttri .Free; + tmpDirecAttri .Free; + end; + finally + sl.Free; + end; + end; { ReadCPPBSettings } + +begin + Result := ReadCPPBSettings(settingIndex); +end; { TSynUnrealSyn.UseUserSettings } + +class function TSynUnrealSyn.GetLanguageName: string; +begin + Result := SYNS_LangUnreal; +end; + +class function TSynUnrealSyn.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := inherited GetCapabilities + [hcUserSettings]; +end; + +function TSynUnrealSyn.GetSampleSource: UnicodeString; +begin + Result := '//----Comment-----------------------------------------------------------'#13#10+ + 'class TestObject expands Object native;'#13#10+ + #13#10+ + '#exec MESH IMPORT MESH=Something ANIVFILE=MODELS\Something.3D DATAFILE=MODELS\Something.3D X=0 Y=0 Z=0 MLOD=0'#13#10+ + #13#10+ + 'var() Sound HitSound;'#13#10+ + 'function Cast()'#13#10+ + '{'#13#10+ + ' Super.Cast();'#13#10+ + ' CastTime = 50;'#13#10+ + ' GatherEffect = Spawn( class''SomethingCorona'',,, GetStartLoc(), Pawn(Owner).ViewRotation );'#13#10+ + ' GatherEffect.SetFollowPawn( Pawn(Owner) );'#13#10+ + '}'#13#10+ + #13#10+ + 'defaultproperties'#13#10+ + '{'#13#10+ + ' PickupMessage="You have picked up a thing."'#13#10+ + '}'; +end; + +class function TSynUnrealSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangUnreal; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynUnrealSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterVB.pas b/Source/VCL/SynEdit/Source/SynHighlighterVB.pas index adaa7aa2..45e26314 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterVB.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterVB.pas @@ -1,561 +1,565 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterVB.pas, released 2000-04-20. -The Original Code is based on the wbADSP21xxSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Max Horvßth. -Unicode translation by Maël Hörz. -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: SynHighlighterVB.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Visual Basic highlighter for SynEdit) -@author(Max Horvßth , converted to SynEdit by David Muir ) -@created(5 December 1999, converted to SynEdit April 21, 2000) -@lastmod(2000-06-23) -The SynHighlighterVB unit provides SynEdit with a Visual Basic (.bas) highlighter. -} - -unit SynHighlighterVB; - -{$I SynEdit.inc} - -interface - -uses - Windows, Messages, Controls, Graphics, Registry, - SynEditHighlighter, - SynEditTypes, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynVBSyn = class(TSynCustomHighlighter) - private - FTokenID: TtkTokenKind; - fIdentFuncTable: array[0..1422] of TIdentFuncTableFunc; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function FuncRem(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure SymbolProc; - procedure ApostropheProc; - procedure CRProc; - procedure DateProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure SpaceProc; - procedure StringProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..213] of string = ( - 'abs', 'and', 'appactivate', 'array', 'as', 'asc', 'atn', 'attribute', - 'base', 'beep', 'begin', 'boolean', 'byte', 'call', 'case', 'cbool', - 'cbyte', 'ccur', 'cdate', 'cdbl', 'chdir', 'chdrive', 'chr', 'cint', - 'circle', 'class', 'clear', 'clng', 'close', 'command', 'compare', 'const', - 'cos', 'createobject', 'csng', 'cstr', 'curdir', 'currency', 'cvar', - 'cverr', 'date', 'dateadd', 'datediff', 'datepart', 'dateserial', - 'datevalue', 'ddb', 'deftype', 'dim', 'dir', 'do', 'doevents', 'double', - 'each', 'else', 'elseif', 'empty', 'end', 'environ', 'eof', 'eqv', 'erase', - 'err', 'error', 'exit', 'exp', 'explicit', 'fileattr', 'filecopy', - 'filedatetime', 'filelen', 'fix', 'for', 'form', 'format', 'freefile', - 'function', 'fv', 'get', 'getattr', 'getobject', 'gosub', 'goto', 'hex', - 'hour', 'if', 'iif', 'imp', 'input', 'instr', 'int', 'integer', 'ipmt', - 'irr', 'is', 'isarray', 'isdate', 'isempty', 'iserror', 'ismissing', - 'isnull', 'isnumeric', 'isobject', 'kill', 'lbound', 'lcase', 'left', 'len', - 'let', 'line', 'loc', 'lock', 'lof', 'log', 'long', 'loop', 'lset', 'ltrim', - 'me', 'mid', 'minute', 'mirr', 'mkdir', 'mod', 'module', 'month', 'msgbox', - 'name', 'new', 'next', 'not', 'nothing', 'now', 'nper', 'npv', 'object', - 'oct', 'on', 'open', 'option', 'or', 'pmt', 'ppmt', 'print', 'private', - 'property', 'pset', 'public', 'put', 'pv', 'qbcolor', 'raise', 'randomize', - 'rate', 'redim', 'rem', 'reset', 'resume', 'return', 'rgb', 'right', - 'rmdir', 'rnd', 'rset', 'rtrim', 'second', 'seek', 'select', 'sendkeys', - 'set', 'setattr', 'sgn', 'shell', 'sin', 'single', 'sln', 'space', 'spc', - 'sqr', 'static', 'stop', 'str', 'strcomp', 'strconv', 'string', 'sub', - 'switch', 'syd', 'system', 'tab', 'tan', 'then', 'time', 'timer', - 'timeserial', 'timevalue', 'to', 'trim', 'typename', 'ubound', 'ucase', - 'unlock', 'until', 'val', 'variant', 'vartype', 'version', 'weekday', - 'wend', 'while', 'width', 'with', 'write', 'xor' - ); - - KeyIndices: array[0..1422] of Integer = ( - -1, 117, 59, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, - -1, 22, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, 115, 19, -1, - -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, 34, -1, 54, -1, -1, - 31, 161, -1, 87, -1, 173, -1, -1, -1, -1, 76, -1, -1, -1, 138, -1, -1, -1, - -1, -1, 176, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -1, - 178, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, 131, -1, -1, -1, - -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, 194, 209, -1, -1, -1, 88, -1, - 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, 185, -1, - -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 73, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 67, -1, -1, -1, 130, -1, 82, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, - 206, 40, -1, -1, 143, 202, -1, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 146, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 97, 69, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, 184, -1, -1, - -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 199, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 112, 90, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, 119, - -1, -1, -1, 25, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, 65, -1, -1, - -1, 134, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, 86, -1, 147, 148, -1, -1, -1, - -1, -1, 107, 164, 203, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, - -1, -1, -1, 68, -1, -1, 101, 32, 201, -1, -1, -1, -1, -1, -1, 95, -1, -1, - 124, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 172, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, 175, -1, 129, -1, - -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 58, -1, -1, 141, -1, -1, -1, 181, -1, -1, -1, 166, 80, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 133, 28, -1, -1, -1, 21, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, - -1, -1, -1, -1, 104, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 92, -1, -1, 180, -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, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 108, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, - 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, -1, -1, -1, -1, - -1, -1, -1, 136, 55, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, 51, 70, -1, -1, -1, -1, - 204, -1, -1, -1, -1, -1, -1, 24, -1, -1, 71, -1, -1, -1, -1, -1, 45, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, 94, 84, - -1, -1, 189, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, - -1, -1, -1, -1, -1, -1, 38, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, 47, 18, - 187, -1, -1, 137, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 182, -1, 4, 75, -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, - -1, 20, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, - -1, -1, -1, 93, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, - -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, - -1, 26, -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, 132, -1, -1, 196, -1, -1, -1, 85, - -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 11, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, - 169, -1, -1, -1, -1, 159, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 44, -1, -1, -1, -1, 61, 15, -1, 27, -1, -1, -1, -1, 6, -1, - -1, -1, -1, -1, -1, -1, -1, 113, 39, -1, -1, -1, -1, -1, 91, -1, -1, 77, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 145, -1, 195, 52, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, - 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 7, -1, -1, 33, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 96, -1, - 106, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 212, 5, -1, 190, -1, -1, 49, 50, -1, -1, -1, -1, -1, -1, 46, 3, -1, - 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, - -1, 16, -1, -1, -1, -1, -1, 144, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 183, -1, -1, -1, 13, 135, -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, - 41, 149, -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, 123, -1, -1, -1, 208, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, - 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, - 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1 - ); - -{$Q-} -function TSynVBSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 251 + Ord(Str^) * 749; - inc(Str); - end; - Result := Result mod 1423; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynVBSyn.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 TSynVBSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[436] := FuncRem; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynVBSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynVBSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -function TSynVBSyn.FuncRem(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - ApostropheProc; - fStringLen := 0; - Result := tkComment; - end - else - Result := tkIdentifier; -end; - -constructor TSynVBSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style:= [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style:= [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - InitIdent; - fDefaultFilter := SYNS_FilterVisualBASIC; -end; - -procedure TSynVBSyn.SymbolProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynVBSyn.ApostropheProc; -begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynVBSyn.CRProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then Inc(Run); -end; - -procedure TSynVBSyn.DateProc; -begin - fTokenID := tkString; - repeat - if IsLineEnd(Run) then break; - inc(Run); - until FLine[Run] = '#'; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynVBSyn.GreaterProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if fLine[Run] = '=' then Inc(Run); -end; - -procedure TSynVBSyn.IdentProc; -begin - fTokenID := IdentKind(fLine + Run); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynVBSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynVBSyn.LowerProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); -end; - -procedure TSynVBSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynVBSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do inc(Run); -end; - -procedure TSynVBSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynVBSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until FLine[Run] = #34; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynVBSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynVBSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - '&': SymbolProc; - #39: ApostropheProc; - '}': SymbolProc; - '{': SymbolProc; - #13: CRProc; - ':': SymbolProc; - ',': SymbolProc; - '#': DateProc; - '=': SymbolProc; - '^': SymbolProc; - '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - '-': SymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '+': SymbolProc; - '.': SymbolProc; - ')': SymbolProc; - '(': SymbolProc; - ';': SymbolProc; - '/': SymbolProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '*': SymbolProc; - #34: StringProc; - else UnknownProc; - end; - inherited; -end; - -function TSynVBSyn.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 TSynVBSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynVBSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynVBSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynVBSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynVBSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterVisualBASIC; -end; - -class function TSynVBSyn.GetLanguageName: string; -begin - Result := SYNS_LangVisualBASIC; -end; - -function TSynVBSyn.GetSampleSource: string; -begin - Result := ''' Syntax highlighting'#13#10+ - 'Function PrintNumber'#13#10+ - ' Dim Number'#13#10+ - ' Dim X'#13#10+ - ''#13#10+ - ' Number = 123456'#13#10+ - ' Response.Write "The number is " & number'#13#10+ - ''#13#10+ - ' For I = 0 To Number'#13#10+ - ' X = X + &h4c'#13#10+ - ' X = X - &o8'#13#10+ - ' X = X + 1.0'#13#10+ - ' Next'#13#10+ - ''#13#10+ - ' I = I + @; '' illegal character'#13#10+ - 'End Function'; -end; - -class function TSynVBSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangVisualBASIC; -end; - -initialization - RegisterPlaceableHighlighter(TSynVBSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterVB.pas, released 2000-04-20. +The Original Code is based on the wbADSP21xxSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Max Horvßth. +Unicode translation by Maël Hörz. +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: SynHighlighterVB.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Visual Basic highlighter for SynEdit) +@author(Max Horvßth , converted to SynEdit by David Muir ) +@created(5 December 1999, converted to SynEdit April 21, 2000) +@lastmod(2000-06-23) +The SynHighlighterVB unit provides SynEdit with a Visual Basic (.bas) highlighter. +} + +unit SynHighlighterVB; + +{$I SynEdit.inc} + +interface + +uses + Windows, Messages, Controls, Graphics, Registry, + SynEditHighlighter, + SynEditTypes, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, + tkString, tkSymbol, tkUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynVBSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FIdentFuncTable: array[0..1422] of TIdentFuncTableFunc; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function FuncRem(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure SymbolProc; + procedure ApostropheProc; + procedure CRProc; + procedure DateProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..213] of UnicodeString = ( + 'abs', 'and', 'appactivate', 'array', 'as', 'asc', 'atn', 'attribute', + 'base', 'beep', 'begin', 'boolean', 'byte', 'call', 'case', 'cbool', + 'cbyte', 'ccur', 'cdate', 'cdbl', 'chdir', 'chdrive', 'chr', 'cint', + 'circle', 'class', 'clear', 'clng', 'close', 'command', 'compare', 'const', + 'cos', 'createobject', 'csng', 'cstr', 'curdir', 'currency', 'cvar', + 'cverr', 'date', 'dateadd', 'datediff', 'datepart', 'dateserial', + 'datevalue', 'ddb', 'deftype', 'dim', 'dir', 'do', 'doevents', 'double', + 'each', 'else', 'elseif', 'empty', 'end', 'environ', 'eof', 'eqv', 'erase', + 'err', 'error', 'exit', 'exp', 'explicit', 'fileattr', 'filecopy', + 'filedatetime', 'filelen', 'fix', 'for', 'form', 'format', 'freefile', + 'function', 'fv', 'get', 'getattr', 'getobject', 'gosub', 'goto', 'hex', + 'hour', 'if', 'iif', 'imp', 'input', 'instr', 'int', 'integer', 'ipmt', + 'irr', 'is', 'isarray', 'isdate', 'isempty', 'iserror', 'ismissing', + 'isnull', 'isnumeric', 'isobject', 'kill', 'lbound', 'lcase', 'left', 'len', + 'let', 'line', 'loc', 'lock', 'lof', 'log', 'long', 'loop', 'lset', 'ltrim', + 'me', 'mid', 'minute', 'mirr', 'mkdir', 'mod', 'module', 'month', 'msgbox', + 'name', 'new', 'next', 'not', 'nothing', 'now', 'nper', 'npv', 'object', + 'oct', 'on', 'open', 'option', 'or', 'pmt', 'ppmt', 'print', 'private', + 'property', 'pset', 'public', 'put', 'pv', 'qbcolor', 'raise', 'randomize', + 'rate', 'redim', 'rem', 'reset', 'resume', 'return', 'rgb', 'right', + 'rmdir', 'rnd', 'rset', 'rtrim', 'second', 'seek', 'select', 'sendkeys', + 'set', 'setattr', 'sgn', 'shell', 'sin', 'single', 'sln', 'space', 'spc', + 'sqr', 'static', 'stop', 'str', 'strcomp', 'strconv', 'string', 'sub', + 'switch', 'syd', 'system', 'tab', 'tan', 'then', 'time', 'timer', + 'timeserial', 'timevalue', 'to', 'trim', 'typename', 'ubound', 'ucase', + 'unlock', 'until', 'val', 'variant', 'vartype', 'version', 'weekday', + 'wend', 'while', 'width', 'with', 'write', 'xor' + ); + + KeyIndices: array[0..1422] of Integer = ( + -1, 117, 59, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, + -1, 22, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, 115, 19, -1, + -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, 34, -1, 54, -1, -1, + 31, 161, -1, 87, -1, 173, -1, -1, -1, -1, 76, -1, -1, -1, 138, -1, -1, -1, + -1, -1, 176, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -1, + 178, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, 131, -1, -1, -1, + -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, 194, 209, -1, -1, -1, 88, -1, + 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, 185, -1, + -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 73, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 67, -1, -1, -1, 130, -1, 82, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, + 206, 40, -1, -1, 143, 202, -1, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 146, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 97, 69, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, 184, -1, -1, + -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 199, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 112, 90, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, 119, + -1, -1, -1, 25, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, 65, -1, -1, + -1, 134, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, 86, -1, 147, 148, -1, -1, -1, + -1, -1, 107, 164, 203, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, + -1, -1, -1, 68, -1, -1, 101, 32, 201, -1, -1, -1, -1, -1, -1, 95, -1, -1, + 124, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 172, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, 175, -1, 129, -1, + -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 58, -1, -1, 141, -1, -1, -1, 181, -1, -1, -1, 166, 80, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 133, 28, -1, -1, -1, 21, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, + -1, -1, -1, -1, 104, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 92, -1, -1, 180, -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, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 108, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, + 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, -1, -1, -1, -1, + -1, -1, -1, 136, 55, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, 51, 70, -1, -1, -1, -1, + 204, -1, -1, -1, -1, -1, -1, 24, -1, -1, 71, -1, -1, -1, -1, -1, 45, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, 94, 84, + -1, -1, 189, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, + -1, -1, -1, -1, -1, -1, 38, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, 47, 18, + 187, -1, -1, 137, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 182, -1, 4, 75, -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, + -1, 20, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, + -1, -1, -1, 93, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, + -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, + -1, 26, -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, 132, -1, -1, 196, -1, -1, -1, 85, + -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 11, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, + 169, -1, -1, -1, -1, 159, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 44, -1, -1, -1, -1, 61, 15, -1, 27, -1, -1, -1, -1, 6, -1, + -1, -1, -1, -1, -1, -1, -1, 113, 39, -1, -1, -1, -1, -1, 91, -1, -1, 77, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 145, -1, 195, 52, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, + 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 7, -1, -1, 33, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 96, -1, + 106, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 212, 5, -1, 190, -1, -1, 49, 50, -1, -1, -1, -1, -1, -1, 46, 3, -1, + 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, + -1, 16, -1, -1, -1, -1, -1, 144, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 183, -1, -1, -1, 13, 135, -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, + 41, 149, -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, 123, -1, -1, -1, 208, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, + 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, + 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1 + ); + +{$Q-} +function TSynVBSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 251 + Ord(Str^) * 749; + Inc(Str); + end; + Result := Result mod 1423; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynVBSyn.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 TSynVBSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[436] := FuncRem; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynVBSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynVBSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +function TSynVBSyn.FuncRem(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + ApostropheProc; + FStringLen := 0; + Result := tkComment; + end + else + Result := tkIdentifier; +end; + +constructor TSynVBSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style:= [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style:= [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + InitIdent; + FDefaultFilter := SYNS_FilterVisualBASIC; +end; + +procedure TSynVBSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynVBSyn.ApostropheProc; +begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynVBSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynVBSyn.DateProc; +begin + FTokenID := tkString; + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until FLine[Run] = '#'; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynVBSyn.GreaterProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynVBSyn.IdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynVBSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynVBSyn.LowerProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); +end; + +procedure TSynVBSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynVBSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do Inc(Run); +end; + +procedure TSynVBSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynVBSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until FLine[Run] = #34; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynVBSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynVBSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + '&': SymbolProc; + #39: ApostropheProc; + '}': SymbolProc; + '{': SymbolProc; + #13: CRProc; + ':': SymbolProc; + ',': SymbolProc; + '#': DateProc; + '=': SymbolProc; + '^': SymbolProc; + '>': GreaterProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + '-': SymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '+': SymbolProc; + '.': SymbolProc; + ')': SymbolProc; + '(': SymbolProc; + ';': SymbolProc; + '/': SymbolProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '*': SymbolProc; + #34: StringProc; + else UnknownProc; + end; + inherited; +end; + +function TSynVBSyn.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 TSynVBSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynVBSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynVBSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynVBSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynVBSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterVisualBASIC; +end; + +class function TSynVBSyn.GetLanguageName: string; +begin + Result := SYNS_LangVisualBASIC; +end; + +function TSynVBSyn.GetSampleSource: UnicodeString; +begin + Result := ''' Syntax highlighting'#13#10+ + 'Function PrintNumber'#13#10+ + ' Dim Number'#13#10+ + ' Dim X'#13#10+ + ''#13#10+ + ' Number = 123456'#13#10+ + ' Response.Write "The number is " & number'#13#10+ + ''#13#10+ + ' For I = 0 To Number'#13#10+ + ' X = X + &h4c'#13#10+ + ' X = X - &o8'#13#10+ + ' X = X + 1.0'#13#10+ + ' Next'#13#10+ + ''#13#10+ + ' I = I + @; '' illegal character'#13#10+ + 'End Function'; +end; + +class function TSynVBSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangVisualBASIC; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynVBSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterVBScript.pas b/Source/VCL/SynEdit/Source/SynHighlighterVBScript.pas index 69d81f98..f1c79677 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterVBScript.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterVBScript.pas @@ -1,463 +1,467 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterVBScript.pas, released 2000-04-18. -The Original Code is based on the lbVBSSyn.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Luiz C. Vaz de Brito. -Unicode translation by Maël Hörz. -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: SynHighlighterVBScript.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a VBScript highlighter for SynEdit) -@author(Luiz C. Vaz de Brito, converted to SynEdit by David Muir ) -@created(20 January 1999, converted to SynEdit April 18, 2000) -@lastmod(2000-06-23) -The SynHighlighterVBScript unit provides SynEdit with a VisualBasic Script (.vbs) highlighter. -Thanks to Primoz Gabrijelcic and Martin Waldenburg. -} - -unit SynHighlighterVBScript; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - Registry, - SynEditHighlighter, - SynEditTypes, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type - TSynVBScriptSyn = class(TSynCustomHighLighter) - private - FTokenID: TtkTokenKind; - fCommentAttri: TSynHighlighterAttributes; - fIdentifierAttri: TSynHighlighterAttributes; - fKeyAttri: TSynHighlighterAttributes; - fNumberAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fStringAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - fIdentFuncTable: array[0..268] of TIdentFuncTableFunc; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function FuncRem(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure ApostropheProc; - procedure CRProc; - procedure DateProc; - procedure GreaterProc; - procedure IdentProc; - procedure LFProc; - procedure LowerProc; - procedure NullProc; - procedure NumberProc; - procedure SpaceProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - 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; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..83] of string = ( - 'and', 'as', 'boolean', 'byref', 'byte', 'byval', 'call', 'case', 'class', - 'const', 'currency', 'debug', 'dim', 'do', 'double', 'each', 'else', - 'elseif', 'empty', 'end', 'endif', 'enum', 'eqv', 'erase', 'error', 'event', - 'exit', 'explicit', 'false', 'for', 'function', 'get', 'goto', 'if', 'imp', - 'implements', 'in', 'integer', 'is', 'let', 'like', 'long', 'loop', 'lset', - 'me', 'mod', 'new', 'next', 'not', 'nothing', 'null', 'on', 'option', - 'optional', 'or', 'paramarray', 'preserve', 'private', 'property', 'public', - 'raiseevent', 'randomize', 'redim', 'rem', 'resume', 'rset', 'select', - 'set', 'shared', 'single', 'static', 'stop', 'sub', 'then', 'to', 'true', - 'type', 'typeof', 'until', 'variant', 'wend', 'while', 'with', 'xor' - ); - - KeyIndices: array[0..268] of Integer = ( - -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, 77, -1, 78, -1, 37, 19, 75, -1, -1, - -1, -1, -1, -1, -1, 12, -1, 66, -1, -1, -1, -1, -1, 35, -1, -1, -1, 46, 41, - 36, -1, -1, 83, 33, 40, 34, -1, -1, -1, -1, 54, 24, 51, -1, -1, -1, -1, -1, - -1, -1, 76, -1, 68, -1, 1, -1, 7, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 57, -1, 79, -1, -1, -1, 5, -1, -1, -1, -1, 4, -1, -1, -1, 43, 72, -1, - 44, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 69, -1, -1, 16, 70, 80, -1, 53, - 47, 58, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, 59, -1, 65, 39, -1, -1, - -1, -1, 6, -1, 55, -1, 67, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, 74, 50, - -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 31, 20, 23, -1, -1, 61, 27, 38, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, - -1, -1, 3, -1, -1, 71, -1, -1, -1, -1, 11, 0, -1, -1, 82, 13, 15, 2, 30, 29, - 14, -1, -1, 42, 49, 81, -1, 9, -1, -1, 62, 25, 60, -1, -1, 45, -1, -1, -1, - -1, -1, -1, -1, -1, 26, 28, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, - 17, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, 52, 73, -1, -1, - 18 - ); - -{$Q-} -function TSynVBScriptSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 713 + Ord(Str^) * 134; - inc(Str); - end; - Result := Result mod 269; - fStringLen := Str - fToIdent; -end; -{$Q+} - -function TSynVBScriptSyn.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 TSynVBScriptSyn.InitIdent; -var - i: Integer; -begin - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if KeyIndices[i] = -1 then - fIdentFuncTable[i] := AltFunc; - - fIdentFuncTable[123] := FuncRem; - - for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do - if @fIdentFuncTable[i] = nil then - fIdentFuncTable[i] := KeyWordFunc; -end; - -function TSynVBScriptSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynVBScriptSyn.KeyWordFunc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier -end; - -function TSynVBScriptSyn.FuncRem(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - begin - ApostropheProc; - fStringLen := 0; - Result := tkComment; - end - else - Result := tkIdentifier; -end; - -constructor TSynVBScriptSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := False; - - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - AddAttribute(fCommentAttri); - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(fIdentifierAttri); - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - AddAttribute(fKeyAttri); - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(fNumberAttri); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(fSpaceAttri); - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(fStringAttri); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(fSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - fDefaultFilter := SYNS_FilterVBScript; - InitIdent; -end; - -procedure TSynVBScriptSyn.ApostropheProc; -begin - fTokenID := tkComment; - repeat - inc(Run); - until IsLineEnd(Run); -end; - -procedure TSynVBScriptSyn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynVBScriptSyn.DateProc; -begin - fTokenID := tkString; - repeat - if IsLineEnd(Run) then break; - inc(Run); - until FLine[Run] = '#'; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynVBScriptSyn.GreaterProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if fLine[Run] = '=' then Inc(Run); -end; - -procedure TSynVBScriptSyn.IdentProc; -begin - fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do inc(Run); -end; - -procedure TSynVBScriptSyn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynVBScriptSyn.LowerProc; -begin - fTokenID := tkSymbol; - Inc(Run); - if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); -end; - -procedure TSynVBScriptSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynVBScriptSyn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; - -begin - inc(Run); - fTokenID := tkNumber; - while IsNumberChar do inc(Run); -end; - -procedure TSynVBScriptSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynVBScriptSyn.StringProc; -begin - fTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until FLine[Run] = #34; - if not IsLineEnd(Run) then inc(Run); -end; - -procedure TSynVBScriptSyn.SymbolProc; -begin - inc(Run); - fTokenID := tkSymbol; -end; - -procedure TSynVBScriptSyn.UnknownProc; -begin - inc(Run); - fTokenID := tkIdentifier; -end; - -procedure TSynVBScriptSyn.Next; -begin - fTokenPos := Run; - case fLine[Run] of - #39: ApostropheProc; - #13: CRProc; - '#': DateProc; - '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '<': LowerProc; - #0: NullProc; - '0'..'9': NumberProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - #34: StringProc; - '&', '{', '}', ':', ',', '=', '^', '-', - '+', '.', '(', ')', ';', '/', '*': SymbolProc; - else UnknownProc; - end; - inherited; -end; - -function TSynVBScriptSyn.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 TSynVBScriptSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynVBScriptSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynVBScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - else Result := nil; - end; -end; - -function TSynVBScriptSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynVBScriptSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterVBScript; -end; - -class function TSynVBScriptSyn.GetLanguageName: string; -begin - Result := SYNS_LangVBSScript; -end; - -function TSynVBScriptSyn.GetSampleSource: string; -begin - Result := ''' Syntax highlighting'#13#10 + - 'function printNumber()'#13#10 + - ' number = 12345'#13#10 + - ' document.write("The number is " + number)'#13#10 + - ' for i = 0 to 10'#13#10 + - ' x = x + 1.0'#13#10 + - ' next'#13#10 + - 'end function'; -end; - -class function TSynVBScriptSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangVBSScript; -end; - -initialization - RegisterPlaceableHighlighter(TSynVBScriptSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterVBScript.pas, released 2000-04-18. +The Original Code is based on the lbVBSSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Luiz C. Vaz de Brito. +Unicode translation by Maël Hörz. +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: SynHighlighterVBScript.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a VBScript highlighter for SynEdit) +@author(Luiz C. Vaz de Brito, converted to SynEdit by David Muir ) +@created(20 January 1999, converted to SynEdit April 18, 2000) +@lastmod(2000-06-23) +The SynHighlighterVBScript unit provides SynEdit with a VisualBasic Script (.vbs) highlighter. +Thanks to Primoz Gabrijelcic and Martin Waldenburg. +} + +unit SynHighlighterVBScript; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + Registry, + SynEditHighlighter, + SynEditTypes, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, + tkString, tkSymbol, tkUnknown); + + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; + +type + TSynVBScriptSyn = class(TSynCustomHighLighter) + private + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FIdentFuncTable: array[0..268] of TIdentFuncTableFunc; + function AltFunc(Index: Integer): TtkTokenKind; + function KeyWordFunc(Index: Integer): TtkTokenKind; + function FuncRem(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure InitIdent; + procedure ApostropheProc; + procedure CRProc; + procedure DateProc; + procedure GreaterProc; + procedure IdentProc; + procedure LFProc; + procedure LowerProc; + procedure NullProc; + procedure NumberProc; + procedure SpaceProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + 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; + end; + +implementation + +uses + SynEditStrConst; + +const + KeyWords: array[0..83] of UnicodeString = ( + 'and', 'as', 'boolean', 'byref', 'byte', 'byval', 'call', 'case', 'class', + 'const', 'currency', 'debug', 'dim', 'do', 'double', 'each', 'else', + 'elseif', 'empty', 'end', 'endif', 'enum', 'eqv', 'erase', 'error', 'event', + 'exit', 'explicit', 'false', 'for', 'function', 'get', 'goto', 'if', 'imp', + 'implements', 'in', 'integer', 'is', 'let', 'like', 'long', 'loop', 'lset', + 'me', 'mod', 'new', 'next', 'not', 'nothing', 'null', 'on', 'option', + 'optional', 'or', 'paramarray', 'preserve', 'private', 'property', 'public', + 'raiseevent', 'randomize', 'redim', 'rem', 'resume', 'rset', 'select', + 'set', 'shared', 'single', 'static', 'stop', 'sub', 'then', 'to', 'true', + 'type', 'typeof', 'until', 'variant', 'wend', 'while', 'with', 'xor' + ); + + KeyIndices: array[0..268] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, 77, -1, 78, -1, 37, 19, 75, -1, -1, + -1, -1, -1, -1, -1, 12, -1, 66, -1, -1, -1, -1, -1, 35, -1, -1, -1, 46, 41, + 36, -1, -1, 83, 33, 40, 34, -1, -1, -1, -1, 54, 24, 51, -1, -1, -1, -1, -1, + -1, -1, 76, -1, 68, -1, 1, -1, 7, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 57, -1, 79, -1, -1, -1, 5, -1, -1, -1, -1, 4, -1, -1, -1, 43, 72, -1, + 44, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 69, -1, -1, 16, 70, 80, -1, 53, + 47, 58, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, 59, -1, 65, 39, -1, -1, + -1, -1, 6, -1, 55, -1, 67, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, 74, 50, + -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 31, 20, 23, -1, -1, 61, 27, 38, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, + -1, -1, 3, -1, -1, 71, -1, -1, -1, -1, 11, 0, -1, -1, 82, 13, 15, 2, 30, 29, + 14, -1, -1, 42, 49, 81, -1, 9, -1, -1, 62, 25, 60, -1, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, 26, 28, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, + 17, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, 52, 73, -1, -1, + 18 + ); + +{$Q-} +function TSynVBScriptSyn.HashKey(Str: PWideChar): Cardinal; +begin + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 713 + Ord(Str^) * 134; + Inc(Str); + end; + Result := Result mod 269; + FStringLen := Str - FToIdent; +end; +{$Q+} + +function TSynVBScriptSyn.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 TSynVBScriptSyn.InitIdent; +var + i: Integer; +begin + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if KeyIndices[i] = -1 then + FIdentFuncTable[i] := AltFunc; + + FIdentFuncTable[123] := FuncRem; + + for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + if @FIdentFuncTable[i] = nil then + FIdentFuncTable[i] := KeyWordFunc; +end; + +function TSynVBScriptSyn.AltFunc(Index: Integer): TtkTokenKind; +begin + Result := tkIdentifier; +end; + +function TSynVBScriptSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier +end; + +function TSynVBScriptSyn.FuncRem(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + begin + ApostropheProc; + FStringLen := 0; + Result := tkComment; + end + else + Result := tkIdentifier; +end; + +constructor TSynVBScriptSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := False; + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + FDefaultFilter := SYNS_FilterVBScript; + InitIdent; +end; + +procedure TSynVBScriptSyn.ApostropheProc; +begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +procedure TSynVBScriptSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynVBScriptSyn.DateProc; +begin + FTokenID := tkString; + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until FLine[Run] = '#'; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynVBScriptSyn.GreaterProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynVBScriptSyn.IdentProc; +begin + FTokenID := IdentKind((FLine + Run)); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do Inc(Run); +end; + +procedure TSynVBScriptSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynVBScriptSyn.LowerProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); +end; + +procedure TSynVBScriptSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynVBScriptSyn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do Inc(Run); +end; + +procedure TSynVBScriptSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynVBScriptSyn.StringProc; +begin + FTokenID := tkString; + if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until FLine[Run] = #34; + if not IsLineEnd(Run) then Inc(Run); +end; + +procedure TSynVBScriptSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynVBScriptSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkIdentifier; +end; + +procedure TSynVBScriptSyn.Next; +begin + FTokenPos := Run; + case FLine[Run] of + #39: ApostropheProc; + #13: CRProc; + '#': DateProc; + '>': GreaterProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '<': LowerProc; + #0: NullProc; + '0'..'9': NumberProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + #34: StringProc; + '&', '{', '}', ':', ',', '=', '^', '-', + '+', '.', '(', ')', ';', '/', '*': SymbolProc; + else UnknownProc; + end; + inherited; +end; + +function TSynVBScriptSyn.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 TSynVBScriptSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynVBScriptSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynVBScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + else Result := nil; + end; +end; + +function TSynVBScriptSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynVBScriptSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterVBScript; +end; + +class function TSynVBScriptSyn.GetLanguageName: string; +begin + Result := SYNS_LangVBSScript; +end; + +function TSynVBScriptSyn.GetSampleSource: UnicodeString; +begin + Result := ''' Syntax highlighting'#13#10 + + 'function printNumber()'#13#10 + + ' number = 12345'#13#10 + + ' document.write("The number is " + number)'#13#10 + + ' for i = 0 to 10'#13#10 + + ' x = x + 1.0'#13#10 + + ' next'#13#10 + + 'end function'; +end; + +class function TSynVBScriptSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangVBSScript; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynVBScriptSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterVrml97.pas b/Source/VCL/SynEdit/Source/SynHighlighterVrml97.pas index 5129c605..ad815a11 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterVrml97.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterVrml97.pas @@ -1,1203 +1,1206 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterVrml.pas, released 2002-10-21. -The Original Code is based on: SynHighlighterJScript.pas, released 2000-04-14. -The Original Code is based on the mwJScript.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Tony de Buys. -Unicode translation by Maël Hörz. -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: SynHighlighterVrml97.pas,v 1.6.2.8 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -{ -@abstract(Provides a Vrml97/X3D/JavaScript highlighter for SynEdit) -@author(Massimo Maria Ghisalberti (nissl@mammuth.it) -@created(november 2002 [December 1999, converted to SynEdit April 14, 2000]) -@lastmod(2002-11-03) -The SynHighlighterVrml97 unit provides SynEdit with a Vrml97/X3D/JavaScript (.wrl;*.x3d) highlighter. -The highlighter formats Vrml97/X3D source code highlighting keywords, strings, numbers and characters. -} - -{ TODO: The Ansi version kept unclear to the status of following tokens: - - Token Ambiguity - ===== ========= - bottom tkVrmlAttribute or tkNonReservedKey - description tkVrmlAttribute or tkNonReservedKey - height tkVrmlAttribute or tkNonReservedKey - location tkVrmlAttribute or tkNonReservedKey - style tkVrmlAttribute or tkNonReservedKey - type tkVrmlAttribute or tkNonReservedKey - - NULL tkVrmlParameter or tkVrmlProto - FALSE tkVrmlParameter or tkVrmlProto - - Text tkVrmlShape or tkNonReservedKey - - I took always the first one as this produces the same results as in the - Ansi-version, because the other cases were never reached (due to the way - the if construct was used). -} - -unit SynHighlighterVrml97; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Messages, - Registry, - Controls, - Graphics, - SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = ( - tkComment, - tkIdentifier, - tkKey, - tkNull, - tkNumber, - tkSpace, - tkString, - tkSymbol, - tkUnknown, - tkNonReservedKey, - tkEvent, - tkVrmlAppearance, - tkVrmlAttribute, - tkVrmlDefinition, - tkVrmlEvent, - tkVrmlGrouping, - tkVrmlInterpolator, - tkVrmlLight, - tkVrmlNode, - tkVrmlParameter, - tkVrmlproto, - tkVrmlSensor, - tkVrmlShape, - tkVrmlShape_Hint, - tkVrmlTime_dependent, - tkVrmlViewpoint, - tkVrmlWorldInfo, - tkX3DDocType, - tkX3DHeader); - - TRangeState = (rsNormalText, rsComment, rsX3DHeader, rsX3DDocType); - -type - TSynVrml97Syn = class(TSynCustomHighLighter) - private - fRange :TRangeState; - isDoctype :boolean; - FTokenID :TtkTokenKind; - fCommentAttri :TSynHighlighterAttributes; - fIdentifierAttri :TSynHighlighterAttributes; - fKeyAttri :TSynHighlighterAttributes; - fNonReservedKeyAttri :TSynHighlighterAttributes; - fEventAttri :TSynHighlighterAttributes; - fNumberAttri :TSynHighlighterAttributes; - fSpaceAttri :TSynHighlighterAttributes; - fStringAttri :TSynHighlighterAttributes; - fSymbolAttri :TSynHighlighterAttributes; - - fVrmlAppearanceAttri :TSynHighlighterAttributes; - fVrmlAttributeAttri :TSynHighlighterAttributes; - fVrmlDefinitionAttri :TSynHighlighterAttributes; - fVrmlEventAttri :TSynHighlighterAttributes; - fVrmlGroupingAttri :TSynHighlighterAttributes; - fVrmlInterpolatorAttri :TSynHighlighterAttributes; - fVrmlLightAttri :TSynHighlighterAttributes; - fVrmlNodeAttri :TSynHighlighterAttributes; - fVrmlParameterAttri :TSynHighlighterAttributes; - fVrmlprotoAttri :TSynHighlighterAttributes; - fVrmlSensorAttri :TSynHighlighterAttributes; - fVrmlShapeAttri :TSynHighlighterAttributes; - fVrmlShape_HintAttri :TSynHighlighterAttributes; - fVrmlTime_dependentAttri :TSynHighlighterAttributes; - fVrmlViewpointAttri :TSynHighlighterAttributes; - fVrmlWorldInfoAttri :TSynHighlighterAttributes; - fX3DDocTypeAttri :TSynHighlighterAttributes; - fX3DHeaderAttri :TSynHighlighterAttributes; - - fKeywords: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: string; AKind: integer); - function HashKey(Str: PWideChar): Integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure AndSymbolProc; - procedure CommentProc; - procedure DiesisCommentProc; - procedure X3DDocTypeOpenProc; - procedure X3DDocTypeProc; - procedure X3DHeaderOpenProc; - procedure X3DHeaderProc; - procedure InCommentProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure MinusProc; - procedure ModSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure SlashProc; - procedure SpaceProc; - procedure StarProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - function NextTokenIs(T: string) :Boolean; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function GetDefaultAttribute(Index :integer) :TSynHighlighterAttributes; - override; - function GetEol :Boolean; override; - function GetRange :Pointer; override; - function GetTokenID :TtkTokenKind; - function GetTokenAttribute :TSynHighlighterAttributes; override; - function GetTokenKind :integer; override; - procedure Next; override; - procedure SetRange(Value :Pointer); override; - procedure ResetRange; override; - published - property NonReservedKeyAttri :TSynHighlighterAttributes read fNonReservedKeyAttri write fNonReservedKeyAttri; - 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 CommentAttri :TSynHighlighterAttributes read fCommentAttri write fCommentAttri; - property IdentifierAttri :TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; - property EcmaScriptKeyAttri :TSynHighlighterAttributes read fKeyAttri write fKeyAttri; - property EcmaScriptEventAttri :TSynHighlighterAttributes read fEventAttri write fEventAttri; - - property VrmlAppearanceAttri :TSynHighlighterAttributes read fVrmlAppearanceAttri write fVrmlAppearanceAttri; - property VrmlAttributeAttri :TSynHighlighterAttributes read fVrmlAttributeAttri write fVrmlAttributeAttri; - property VrmlDefinitionAttri :TSynHighlighterAttributes read fVrmlDefinitionAttri write fVrmlDefinitionAttri; - property VrmlEventAttri :TSynHighlighterAttributes read fVrmlEventAttri write fVrmlEventAttri; - property VrmlGroupingAttri :TSynHighlighterAttributes read fVrmlGroupingAttri write fVrmlGroupingAttri; - property VrmlInterpolatorAttri :TSynHighlighterAttributes read fVrmlInterpolatorAttri write fVrmlInterpolatorAttri; - property VrmlLightAttri :TSynHighlighterAttributes read fVrmlLightAttri write fVrmlLightAttri; - property VrmlNodeAttri :TSynHighlighterAttributes read fVrmlNodeAttri write fVrmlNodeAttri; - property VrmlParameterAttri :TSynHighlighterAttributes read fVrmlParameterAttri write fVrmlParameterAttri; - property VrmlprotoAttri :TSynHighlighterAttributes read fVrmlprotoAttri write fVrmlprotoAttri; - property VrmlSensorAttri :TSynHighlighterAttributes read fVrmlSensorAttri write fVrmlSensorAttri; - property VrmlShapeAttri :TSynHighlighterAttributes read fVrmlShapeAttri write fVrmlShapeAttri; - property VrmlShape_HintAttri :TSynHighlighterAttributes read fVrmlShape_HintAttri write fVrmlShape_HintAttri; - property VrmlTime_dependentAttri :TSynHighlighterAttributes read fVrmlTime_dependentAttri write fVrmlTime_dependentAttri; - property VrmlViewpointAttri :TSynHighlighterAttributes read fVrmlViewpointAttri write fVrmlViewpointAttri; - property VrmlWorldInfoAttri :TSynHighlighterAttributes read fVrmlWorldInfoAttri write fVrmlWorldInfoAttri; - property X3DDocTypeAttri :TSynHighlighterAttributes read fX3DDocTypeAttri write fX3DDocTypeAttri; - property X3DHeaderAttri :TSynHighlighterAttributes read fX3DHeaderAttri write fX3DHeaderAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - Events: string = - 'onAbort, onBlur, onChange, onClick, onDblClick, onError, onFocus, ' + - 'onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseMove, ' + - 'onMouseOut, onMouseOver, onMouseUp, onReset, onSelect, onSubmit, ' + - 'onUnload'; - - KeyWords: string = - 'abstract, boolean, break, byte, callee, case, catch, char, class, ' + - 'const, constructor, continue, debugger, default, delete, do, DOCTYPE, ' + - 'double, else, enum, export, extends, false, final, finally, float, for, ' + - 'function, goto, head, if, implements, import, in, instanceof, int, ' + - 'interface, long, meta, NaN, native, new, null, package, private, ' + - 'protected, prototype, public, PUBLIC, return, short, start, static, ' + - 'super, switch, synchronized, this, throw, throws, transient, true, try, ' + - 'typeof, var, void, while, with, xml'; - - NonReservedKeys: string = - 'abs, acos, action, alert, align, alinkColor, all, All, anchor, anchors, ' + - 'appCodeName, Applet, applets, appName, appVersion, Area, arguments, ' + - 'Arguments, Array, asin, atan, atan2, back, background, bgColor, big, ' + - 'blink, blur, body, bold, Boolean, border, Button, call, caller, ' + - 'captureEvents, ceil, charAt, charCodeAt, Checkbox, checked, clear, ' + - 'clearInterval, clearTimeout, click, close, closed, complete, concat, ' + - 'confirm, content, cookie, cos, current, Date, defaultChecked, ' + - 'defaultSelected, defaultStatus, defaultValue, display, document, ' + - 'domain, E, elements, Embed, embeds, enabledPlugin, encoding, escape, ' + - 'eval, event, exp, fgColor, filename, FileUpload, find, fixed, Float, ' + - 'floor, focus, fontcolor, fontsize, form, Form, forms, forward, Frame, ' + - 'frames, fromCharCode, Function, getDate, getDay, getElementById, ' + - 'getFullYear, getHours, getMilliseconds, getMinutes, getMonth, ' + - 'getSeconds, getTime, getTimezoneOffset, getUTCDate, getUTCDay, ' + - 'getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, ' + - 'getUTCMonth, getUTCSeconds, getYear, Global, go, handleEvent, hash, ' + - 'Hidden, history, History, home, host, hostname, href, hspace, Image, ' + - 'images, index, indexOf, Infinity, innerHeight, innerWidth, input, ' + - 'isFinite, isNaN, italics, java, javaEnabled, join, lastIndexOf, ' + - 'lastModified, Layer, layers, left, link, Link, linkColor, links, LN10, ' + - 'LN2, Location, locationbar, log, LOG10E, LOG2E, logon, lowsrc, match, ' + - 'Math, max, MAX_VALUE, menubar, method, MimeType, mimeTypes, min, ' + - 'MIN_VALUE, moveBy, moveTo, name, navigator, Navigator, ' + - 'NEGATIVE_INFINITY, netscape, next, Null, Number, Object, open, opener, ' + - 'Option, options, outerHeight, outerWidth, Packages, pageX, pageXOffset, ' + - 'pageY, pageYOffset, parent, parse, parseFloat, parseInt, Password, ' + - 'pathname, personalbar, PI, platform, Plugin, plugins, port, ' + - 'POSITIVE_INFINITY, pow, previous, print, prompt, protocol, Radio, ' + - 'random, referrer, refresh, RegExp, releaseEvents, reload, replace, ' + - 'reset, Reset, resizeBy, resizeTo, reverse, right, round, routeEvent, ' + - 'screen, scroll, scrollbars, scrollBy, scrollTo, search, select, Select, ' + - 'selected, selectedIndex, self, setDate, setFullYear, setHours, ' + - 'setInterval, setMilliseconds, setMinutes, setMonth, setSeconds, ' + - 'setTime, setTimeout, setUTCDate, setUTCFullYear, setUTCHours, ' + - 'setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, setYear, ' + - 'sin, slice, small, sort, split, sqrt, SQRT1_2, SQRT2, src, status, ' + - 'statusbar, stop, strike, String, sub, submit, Submit, substr, ' + - 'substring, suffixes, sup, tags, taint, taintEnabled, tan, target, text, ' + - 'Textarea, title, toGMTString, toLocaleString, toLowerCase, toolbar, ' + - 'toSource, toString, toUpperCase, toUTCString, undefined, Undefined, ' + - 'unescape, untaint, unwatch, URL, userAgent, UTC, value, valueOf, ' + - 'version, visibility, vlinkColor, vspace, watch, width, window, Window, ' + - 'write, writeln, zIndex'; - - VrmlAppearances: string = - 'Appearance, ImageTexture, Material, NurbsTextureSurface, PixelTexture, ' + - 'TextureBackground, TextureCoordinate, TextureCoordinateGenerator, ' + - 'TextureTransform'; - - VrmlAttributes: string = - 'addChildren, ambientIntensity, appearance, attenuation, autoOffset, ' + - 'avatarSize, axisOfRotation, backUrl, bboxCenter, bboxSize, beamWidth, ' + - 'beginCap, bindTime, bottom, bottomRadius, bottomUrl, ccw, center, children, ' + - 'choice, collide, collideTime, color, colorIndex, colorPerVertex, ' + - 'ColorRGBA, convex, coord, coordIndex, creaseAngle, crossSection, ' + - 'cutOffAngle, cycleInterval, cycleTime, description, diffuseColor, direction, ' + - 'directOutput, diskAngle, duration_changed, emissiveColor, enabled, ' + - 'endCap, enterTime, eventName, eventType, exitTime, family, fieldName, ' + - 'fieldOfView, fieldType, FillProperties, fogType, fontStyle, ' + - 'fraction_changed, frontUrl, GeoCoordinate, GeoElevationGrid, ' + - 'GeoLocation, GeoLOD, GeoMetadata, geometry, GeoOrigin, groundAngle, ' + - 'groundColor, headlight, height, hitNormal_changed, hitPoint_changed, ' + - 'hitTexCoord_changed, horizontal, image, info, intensity, isActive, ' + - 'isBound, isOver, jump, justify, key, keyValue, language, leftToRight, ' + - 'leftUrl, length, level, LineProperties, location, loop, material, maxAngle, ' + - 'maxBack, maxExtent, maxFront, maxPosition, minAngle, minBack, minFront, ' + - 'minPosition, MultiTexture, MultiTextureCoordinate, mustEvaluate, ' + - 'normal, normalIndex, normalPerVertex, offset, on, orientation, ' + - 'orientation_changed, parameter, pitch, point, position, ' + - 'position_changed, priority, proxy, radius, range, removeChildren, ' + - 'repeatS, repeatT, rightUrl, rotation, rotation_changed, scale, ' + - 'scaleOrientation, set_bind, set_colorIndex, set_coordIndex, ' + - 'set_crossSection, set_fraction, set_height, set_normalIndex, ' + - 'set_orientation, set_scale, set_spine, set_texCoordIndex, shininess, ' + - 'side, size, skyAngle, skyColor, solid, source, spacing, spatialize, ' + - 'specularColor, speed, spine, startTime, stopTime, string, style, texCoord, ' + - 'texCoordIndex, texture, textureTransform, time, top, topToBottom, ' + - 'topUrl, touchTime, trackPoint_changed, translation, ' + - 'translation_changed, transparency, type, url, value_changed, vector, ' + - 'visibilityLimit, visibilityRange, whichChoice, xDimension, xSpacing, ' + - 'zDimension, zSpacing'; - - VrmlDefinitions: string = - 'MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, ' + - 'MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, ' + - 'SFRotation, SFString, SFTime, SFVec2f, SFVec3f'; - - VrmlEvents: string = - 'eventIn, eventOut, exposedField, field'; - - VrmlGroupings: string = - 'Anchor, Billboard, Collision, ESPDUTransform, Group, Inline, LOD, ' + - 'NurbsGroup, ReceiverPdu, SignalPdu, StaticGroup, Switch, Transform, ' + - 'Transform2D, TransmitterPdu'; - - VrmlInterpolators: string = - 'ColorInterpolator, CoordinateInterpolator, CoordinateInterpolator2D, ' + - 'GeoPositionInterpolator, NormalInterpolator, NurbsPositionInterpolator, ' + - 'OrientationInterpolator, PositionInterpolator, PositionInterpolator2D, ' + - 'ScalarInterpolator'; - - VrmlLights: string = - 'DirectionalLight, PointLight, SpotLight'; - - VrmlNodes: string = - 'Background, Color, Coordinate, CoordinateDeformer, Fog, FontStyle, ' + - 'Joint, NavigationInfo, Normal, Script, Site, Sound'; - - VrmlParameters: string = - 'ALL, AUTO, BINDINGS, BOLD, BOTTOM, CENTER, CLAMP, CLOCKWISE, CONVEX, ' + - 'COUNTERCLOCKWISE, CULLING, DEFAULT, DEFAULTS, Displacer, ENUMS, FACE, FALSE, ' + - 'FAMILY, FILE, FORMAT, ITALIC, JUSTIFICATION, LEFT, NONE, NULL, OFF, ON, ' + - 'OVERALL, PARTS, PER_FACE, PER_FACE_INDEXED, PER_PART, PER_PART_INDEXED, ' + - 'PER_VERTEX, PER_VERTEX_INDEXED, REPEAT, RIGHT, SHAPE, SIDES, SOLID, ' + - 'STYLE, TRUE, TYPE, UNKNOWN_FACE_TYPE, UNKNOWN_ORDERING, ' + - 'UNKNOWN_SHAPE_TYPE, WRAP'; - - VrmlProtos: string = - 'DEF, EXTERNPROTO, IS, PROTO, ROUTE, Scene, TO, USE, VRML, X3D, ' + - 'X3DAppearanceNode, X3DAppearanceChildNode, X3DBackgroundNode, X3DBindableNode, ' + - 'X3DBoundedObject, X3DChildNode, X3DColorNode, X3DComposedGeometryNode, ' + - 'X3DCoordinateNode, X3DDragSensorNode, X3DEnvironmentalSensorNode, ' + - 'X3DFontStyleNode, X3DGeometry2DNode, X3DGeometry3DNode, ' + - 'X3DGeometryNode, X3DGeometryPropertyNode, X3DGroupingNode, ' + - 'X3DInterpolatorNode, X3DKeyDeviceSensorNode, X3DLightNode, ' + - 'X3DMaterialNode, X3DNetworkSensorNode, X3DNode, X3DNormalNode, ' + - 'X3DParametricGeometryNode, X3DPointingDeviceSensorNode, ' + - 'X3DPrototypeInstance, X3DScriptNode, X3DSensorNode, X3DSequencerNode, ' + - 'X3DShapeNode, X3DSoundNode, X3DSoundSourceNode, X3DTexture2DNode, ' + - 'X3DTextureCoordinateNode, X3DTextureNode, X3DTextureTransform2DNode, ' + - 'X3DTextureTransformNode, X3DTimeDependentNode, X3DTouchSensorNode, ' + - 'X3DTriggerNode, X3DUrlObject'; - - VrmlSensors: string = - 'BooleanFilter, BooleanSequencer, BooleanToggle, BooleanTrigger, ' + - 'CylinderSensor, GeoTouchSensor, IntegerTrigger, KeySensor, LoadSensor, ' + - 'PlaneSensor, ProximitySensor, SphereSensor, StringSensor, TimeSensor, ' + - 'TouchSensor, VisibilitySensor'; - - VrmlShapes: string = - 'Arc2D, ArcClose2D, Box, Circle2D, Cone, Contour2D, ContourPolyline2D, ' + - 'Cylinder, Disk2D, ElevationGrid, Humanoid, NurbsCurve, NurbsCurve2D, ' + - 'NurbsSurface, PointSet, Polyline2D, Polypoint2D, Rectangle2D, Segment, ' + - 'Shape, Shape2D, Sphere, Text, TriangleFanSet, TriangleSet, TriangleSet2D, ' + - 'TriangleStripSet, TrimmedSurface'; - - VrmlShape_Hints: string = - 'Extrusion, IndexedFaceSet, IndexedLineSet'; - - VrmlTime_dependents: string = - 'AudioClip, IntegerSequencer, MovieTexture, TimeTrigger'; - - VrmlViewpoints: string = - 'GeoViewpoint, Viewpoint'; - - VrmlWorldInfos: string = - 'WorldInfo'; - - -procedure TSynVrml97Syn.DoAddKeyword(AKeyword: string; AKind: integer); -var - HashValue: integer; -begin - HashValue := HashKey(PWideChar(AKeyword)); - fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -function TSynVrml97Syn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 27 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 54 + Ord(Str^) - Ord('0'); - '_': Result := 53; - else Result := 0; - end - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $FF; // 255 - fStringLen := Str - fToIdent; -end; - -function TSynVrml97Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - fToIdent := MayBe; - Entry := fKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > fStringLen then - break - else if Entry.KeywordLen = fStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; -end; - -constructor TSynVrml97Syn.Create(AOwner :TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fKeywords := TSynHashEntryList.Create; - isDoctype := False; - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fCommentAttri.Style := [fsItalic]; - fCommentAttri.Foreground := clNavy; - fCommentAttri.Background := clGray; - AddAttribute(fCommentAttri); - - fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - fIdentifierAttri.Style := []; - fIdentifierAttri.Foreground := clNavy; - fIdentifierAttri.Background := clWhite; - AddAttribute(fIdentifierAttri); - - fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - fKeyAttri.Style := [fsBold]; - fKeyAttri.Foreground := clRed; - fKeyAttri.Background := clWhite; - AddAttribute(fKeyAttri); - - fNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - fNonReservedKeyAttri.Style := [fsItalic]; - fNonReservedKeyAttri.Foreground := clBlack; - fNonReservedKeyAttri.Background := clWhite; - AddAttribute(fNonReservedKeyAttri); - - fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - fEventAttri.Style := [fsItalic]; - fEventAttri.Foreground := clNavy; - fEventAttri.Background := clWhite; - AddAttribute(fEventAttri); - - fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - fEventAttri.Style := [fsItalic]; - fEventAttri.Foreground := clNavy; - fEventAttri.Background := clWhite; - AddAttribute(fNumberAttri); - - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - fSpaceAttri.Style := [fsItalic]; - fSpaceAttri.Foreground := clNavy; - AddAttribute(fSpaceAttri); - - fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Style := [fsItalic]; - fStringAttri.Foreground := clNavy; - fStringAttri.Background := clWhite; - AddAttribute(fStringAttri); - - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - fSymbolAttri.Style := [fsItalic]; - fSymbolAttri.Foreground := clNavy; - fSymbolAttri.Background := clWhite; - AddAttribute(fSymbolAttri); - //-- vrml - fVrmlAppearanceAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAppearance, SYNS_FriendlyAttrVrmlAppearance); - fVrmlAppearanceAttri.Style := [fsItalic]; - fVrmlAppearanceAttri.Foreground := clNavy; - fVrmlAppearanceAttri.Background := clWhite; - AddAttribute(fVrmlAppearanceAttri); - - fVrmlAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAttribute, SYNS_FriendlyAttrVrmlAttribute); - fVrmlAttributeAttri.Style := [fsItalic]; - fVrmlAttributeAttri.Foreground := clNavy; - fVrmlAttributeAttri.Background := clGray; - AddAttribute(fVrmlAttributeAttri); - - fVrmlDefinitionAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlDefinition, SYNS_FriendlyAttrVrmlDefinition); - fVrmlDefinitionAttri.Style := [fsItalic]; - fVrmlDefinitionAttri.Foreground := clNavy; - fVrmlDefinitionAttri.Background := clRed; - AddAttribute(fVrmlDefinitionAttri); - - fVrmlEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlEvent, SYNS_FriendlyAttrVrmlEvent); - fVrmlEventAttri.Style := [fsBold]; - fVrmlEventAttri.Foreground := clRed; - fVrmlEventAttri.Background := clWhite; - AddAttribute(fVrmlEventAttri); - - fVrmlGroupingAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlGrouping, SYNS_FriendlyAttrVrmlGrouping); - fVrmlGroupingAttri.Style := [fsBold]; - fVrmlGroupingAttri.Foreground := clNavy; - fVrmlGroupingAttri.Background := clWhite; - AddAttribute(fVrmlGroupingAttri); - - fVrmlInterpolatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlInterpolator, SYNS_FriendlyAttrVrmlInterpolator); - fVrmlInterpolatorAttri.Style := [fsItalic]; - fVrmlInterpolatorAttri.Foreground := clLime; - fVrmlInterpolatorAttri.Background := clWhite; - AddAttribute(fVrmlInterpolatorAttri); - - fVrmlLightAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlLight, SYNS_FriendlyAttrVrmlLight); - fVrmlLightAttri.Style := [fsItalic]; - fVrmlLightAttri.Foreground := clTeal; - fVrmlLightAttri.Background := clWhite; - AddAttribute(fVrmlLightAttri); - - fVrmlNodeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlNode, SYNS_FriendlyAttrVrmlNode); - fVrmlNodeAttri.Style := [fsItalic, fsBold]; - fVrmlNodeAttri.Foreground := clGreen; - fVrmlNodeAttri.Background := clWhite; - AddAttribute(fVrmlNodeAttri); - - fVrmlParameterAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlParameter, SYNS_FriendlyAttrVrmlParameter); - fVrmlParameterAttri.Style := [fsBold]; - fVrmlParameterAttri.Foreground := $F0CAA6; //clSkyBlue - fVrmlParameterAttri.Background := clWhite; - AddAttribute(fVrmlParameterAttri); - - fVrmlprotoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlProto, SYNS_FriendlyAttrVrmlProto); - fVrmlprotoAttri.Style := [fsBold]; - fVrmlprotoAttri.Foreground := clRed; - fVrmlprotoAttri.Background := clWhite; - AddAttribute(fVrmlprotoAttri); - - fVrmlSensorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlSensor, SYNS_FriendlyAttrVrmlSensor); - fVrmlSensorAttri.Style := [fsBold]; - fVrmlSensorAttri.Foreground := clOlive; - fVrmlSensorAttri.Background := clWhite; - AddAttribute(fVrmlSensorAttri); - - fVrmlShapeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape, SYNS_FriendlyAttrVrmlShape); - fVrmlShapeAttri.Style := [fsBold]; - fVrmlShapeAttri.Foreground := clPurple; - fVrmlShapeAttri.Background := clWhite; - AddAttribute(fVrmlShapeAttri); - - fVrmlShape_HintAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape_Hint, SYNS_FriendlyAttrVrmlShape_Hint); - fVrmlShape_HintAttri.Style := [fsItalic]; - fVrmlShape_HintAttri.Foreground := clPurple; - fVrmlShape_HintAttri.Background := clWhite; - AddAttribute(fVrmlShape_HintAttri); - - fVrmlTime_dependentAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlTime_dependent, SYNS_FriendlyAttrVrmlTime_dependent); - fVrmlTime_dependentAttri.Style := [fsItalic]; - fVrmlTime_dependentAttri.Foreground := clOlive; - fVrmlTime_dependentAttri.Background := clWhite; - AddAttribute(fVrmlTime_dependentAttri); - - fVrmlViewpointAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlViewpoint, SYNS_FriendlyAttrVrmlViewpoint); - fVrmlViewpointAttri.Style := [fsItalic]; - fVrmlViewpointAttri.Foreground := clGreen; - fVrmlViewpointAttri.Background := clWhite; - AddAttribute(fVrmlViewpointAttri); - - fVrmlWorldInfoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlWorldInfo, SYNS_FriendlyAttrVrmlWorldInfo); - fVrmlWorldInfoAttri.Style := [fsItalic]; - fVrmlWorldInfoAttri.Foreground := clMaroon; - fVrmlWorldInfoAttri.Background := clWhite; - AddAttribute(fVrmlWorldInfoAttri); - - fX3DDocTypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DDocType, SYNS_FriendlyAttrX3DDocType); - fX3DDocTypeAttri.Style := [fsItalic]; - fX3DDocTypeAttri.Foreground := clMaroon; - fX3DDocTypeAttri.Background := clWhite; - AddAttribute(fX3DDocTypeAttri); - - fX3DHeaderAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DHeader, SYNS_FriendlyAttrX3DHeader); - fX3DHeaderAttri.Style := [fsItalic]; - fX3DHeaderAttri.Foreground := clMaroon; - fX3DHeaderAttri.Background := clWhite; - AddAttribute(fX3DHeaderAttri); - SetAttributesOnChange(DefHighlightChange); - - EnumerateKeywords(Ord(tkEvent), Events, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkNonReservedKey), NonReservedKeys, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlAppearance), VrmlAppearances, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlAttribute), VrmlAttributes, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlDefinition), VrmlDefinitions, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlEvent), VrmlEvents, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlGrouping), VrmlGroupings, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlInterpolator), VrmlInterpolators, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlLight), VrmlLights, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlNode), VrmlNodes, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlParameter), VrmlParameters, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlproto), VrmlProtos, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlSensor), VrmlSensors, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlShape), VrmlShapes, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlShape_Hint), VrmlShape_Hints, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlTime_dependent), VrmlTime_dependents, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlViewpoint), VrmlViewpoints, IsIdentChar, DoAddKeyword); - EnumerateKeywords(Ord(tkVrmlWorldInfo), VrmlWorldInfos, IsIdentChar, DoAddKeyword); - - fDefaultFilter := SYNS_FilterVrml97; - fRange := rsNormalText; -end; - -destructor TSynVrml97Syn.Destroy; -begin - fKeywords.Free; - inherited Destroy; -end; - -procedure TSynVrml97Syn.AndSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '&']) then inc(Run); -end; - -function TSynVrml97Syn.NextTokenIs(T: string): Boolean; -var - I, Len: Integer; -begin - Result := True; - Len := Length(T); - for I := 1 to Len do - if (fLine[Run + I] <> T[I]) then - begin - Result := False; - Break; - end; -end; - -procedure TSynVrml97Syn.InCommentProc; -begin - if (fLine[Run + 1] = '-') and (fLine[Run + 2] = '-') then - begin - Inc(Run); - fTokenID := tkComment; - fRange := rsComment; - Inc(Run, 2); - repeat - Inc(Run); - if (fLine[Run] = '-') and (fLine[Run + 1] = '-') then - begin - fRange := rsNormalText; - Inc(Run, 2); - break; - end; - until IsLineEnd(Run); - Exit; - end; -end; - -procedure TSynVrml97Syn.DiesisCommentProc; -begin - if fLine[Run] = #0 then - NullProc - else - begin - fTokenID := tkComment; - repeat - inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynVrml97Syn.X3DHeaderOpenProc; -begin - Inc(Run); - fRange := rsX3DHeader; - X3DHeaderProc; - fTokenID := tkX3DHeader; -end; - -procedure TSynVrml97Syn.X3DHeaderProc; -begin - case fLine[Run] of - #0 :NullProc; - #10 :LFProc; - #13 :CRProc; - else - begin - fTokenID := tkX3DHeader; - repeat - if (fLine[Run] = '?') then - begin - Inc(Run, 1); - fRange := rsNormalText; - Break; - end; - if not IsLineEnd(Run) then - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; - -procedure TSynVrml97Syn.X3DDocTypeOpenProc; -begin - if NextTokenIs('DOCTYPE') then - begin - fRange := rsX3DDocType; - X3DDocTypeProc; - fTokenID := tkX3DDocType; - end - else - if NextTokenIs('--') then - begin - fRange := rsComment; - InCommentProc; - fTokenID := tkComment; - end - else - begin - fTokenID := tkSymbol; - inc(Run); - end; -end; - -procedure TSynVrml97Syn.X3DDocTypeProc; -begin - case fLine[Run] of - #0 :NullProc; - #10 :LFProc; - #13 :CRProc; - else - begin - fTokenID := tkX3DDocType; - repeat - if (fLine[Run + 1] = '>') then - begin - Inc(Run, 1); - fRange := rsNormalText; - Break; - end; - if not IsLineEnd(Run) then - Inc(Run); - until IsLineEnd(Run); - end; - end; -end; - -procedure TSynVrml97Syn.CommentProc; -begin - if fLine[Run] = #0 then - NullProc - else - begin - fTokenID := tkComment; - repeat - if ((fLine[Run] = '*') and (fLine[Run + 1] = '/')) - or - ((fLine[Run] = '-') and (fLine[Run + 1] = '-')) then - begin - fRange := rsNormalText; - inc(Run, 2); - break; - end; - inc(Run); - until IsLineEnd(Run); - end; -end; - -procedure TSynVrml97Syn.CRProc; -begin - fTokenID := tkSpace; - inc(Run); - if fLine[Run] = #10 then inc(Run); -end; - -procedure TSynVrml97Syn.IdentProc; -begin - fTokenID := IdentKind(fLine + Run); - inc(Run, fStringLen); - while IsIdentChar(fLine[Run]) do - inc(Run); -end; - -procedure TSynVrml97Syn.LFProc; -begin - fTokenID := tkSpace; - inc(Run); -end; - -procedure TSynVrml97Syn.MinusProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '-', '>']) then inc(Run); -end; - -procedure TSynVrml97Syn.ModSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynVrml97Syn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynVrml97Syn.NumberProc; - - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X': - 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 CharInSet(FLine[Succ(Run)], ['0'..'9', 'a'..'f', 'A'..'F']) then - begin - Break; - end; - isHex := True; - end; - end; - Inc(Run); - end; -end; - -procedure TSynVrml97Syn.OrSymbolProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '|']) then inc(Run); -end; - -procedure TSynVrml97Syn.PlusProc; -begin - fTokenID := tkSymbol; - inc(Run); - if CharInSet(fLine[Run], ['=', '+']) then inc(Run); -end; - -procedure TSynVrml97Syn.PointProc; -begin - fTokenID := tkSymbol; - inc(Run); - if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then inc(Run, 2); -end; - -procedure TSynVrml97Syn.SlashProc; -begin - Inc(Run); - case fLine[Run] of - '/' : - begin - fTokenID := tkComment; - repeat - Inc(Run); - until IsLineEnd(Run); - end; - '*' : - begin - fTokenID := tkComment; - fRange := rsComment; - repeat - Inc(Run); - if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then - begin - fRange := rsNormalText; - Inc(Run, 2); - break; - end; - until IsLineEnd(Run); - end; - '=' : - begin - Inc(Run); - fTokenID := tkSymbol; - end; - else - fTokenID := tkSymbol; - end; -end; - -procedure TSynVrml97Syn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); -end; - -procedure TSynVrml97Syn.StarProc; -begin - fTokenID := tkSymbol; - inc(Run); - if fLine[Run] = '=' then inc(Run); -end; - -procedure TSynVrml97Syn.StringProc; -var - l_strChar: string; -begin - fTokenID := tkString; - l_strChar := FLine[Run]; // We could have '"' or #39 - if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then inc(Run, 2); - repeat - if IsLineEnd(Run) then break; - inc(Run); - until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); - if not IsLineEnd(Run) then - Inc(Run); -end; - -procedure TSynVrml97Syn.SymbolProc; -begin - inc(Run); - fTokenId := tkSymbol; -end; - -procedure TSynVrml97Syn.UnknownProc; -begin - inc(Run); - fTokenID := tkUnknown; -end; - -procedure TSynVrml97Syn.Next; -begin - fTokenPos := Run; - case fRange of - rsX3DHeader: X3DHeaderProc; - rsX3DDocType: X3DDocTypeProc; - rsComment: CommentProc; - else - case fLine[Run] of - '&': AndSymbolProc; - #13: CRProc; - '#': DiesisCommentProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; - '-': MinusProc; - '%': ModSymbolProc; - #0: NullProc; - '0'..'9': NumberProc; - '|': OrSymbolProc; - '+': PlusProc; - '.': PointProc; - '/': SlashProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '*': StarProc; - '"', #39: StringProc; - '?': X3DHeaderOpenProc; - '!': X3DDocTypeOpenProc; - '~', '{', '}', ',', '(', ')', '[', ']', ':', ';', '=', '<', '>': SymbolProc; - else UnknownProc; - end; - end; - inherited; -end; - -function TSynVrml97Syn.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 TSynVrml97Syn.GetEol :Boolean; -begin - Result := fTokenID = tkNull; -end; - -function TSynVrml97Syn.GetRange :Pointer; -begin - Result := Pointer(fRange); -end; - -function TSynVrml97Syn.GetTokenID :TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynVrml97Syn.GetTokenAttribute :TSynHighlighterAttributes; -begin - case GetTokenID of - tkComment: Result := fCommentAttri; - tkIdentifier: Result := fIdentifierAttri; - tkKey: Result := fKeyAttri; - tkNonReservedKey: Result := fNonReservedKeyAttri; - tkEvent: Result := fEventAttri; - tkNumber: Result := fNumberAttri; - tkSpace: Result := fSpaceAttri; - tkString: Result := fStringAttri; - tkSymbol: Result := fSymbolAttri; - tkUnknown: Result := fIdentifierAttri; - // vrml - tkVrmlAppearance: Result := fVrmlAppearanceAttri; - tkVrmlAttribute: Result := fVrmlAttributeAttri; - tkVrmlDefinition: Result := fVrmlDefinitionAttri; - tkVrmlEvent: Result := fVrmlEventAttri; - tkVrmlGrouping: Result := fVrmlGroupingAttri; - tkVrmlInterpolator: Result := fVrmlInterpolatorAttri; - tkVrmlLight: Result := fVrmlLightAttri; - tkVrmlNode: Result := fVrmlNodeAttri; - tkVrmlParameter: Result := fVrmlParameterAttri; - tkVrmlproto: Result := fVrmlprotoAttri; - tkVrmlSensor: Result := fVrmlSensorAttri; - tkVrmlShape: Result := fVrmlShapeAttri; - tkVrmlShape_Hint: Result := fVrmlShape_HintAttri; - tkVrmlTime_dependent: Result := fVrmlTime_dependentAttri; - tkVrmlViewpoint: Result := fVrmlViewpointAttri; - tkVrmlWorldInfo: Result := fVrmlWorldInfoAttri; - tkX3DDocType: Result := fX3DDocTypeAttri; - tkX3DHeader: Result := fX3DHeaderAttri; - //-- - else - Result := nil; - end; -end; - -function TSynVrml97Syn.GetTokenKind :integer; -begin - Result := Ord(fTokenId); -end; - -procedure TSynVrml97Syn.ResetRange; -begin - fRange := rsNormalText; -end; - -procedure TSynVrml97Syn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -function TSynVrml97Syn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterVrml97; -end; - -class function TSynVrml97Syn.GetLanguageName: string; -begin - Result := SYNS_LangVrml97; -end; - -function TSynVrml97Syn.GetSampleSource: string; -begin - Result := - '#VRML V2.0 utf8'#13#10 + - 'Transform {'#13#10 + - ' children ['#13#10 + - ' NavigationInfo { headlight FALSE } # We''ll add our own light'#13#10 + - ''#13#10 + - ' DirectionalLight { # First child'#13#10 + - ' direction 0 0 -1 # Light illuminating the scene'#13#10 + - ' }'#13#10 + - ''#13#10 + - ' Transform { # Second child - a red sphere'#13#10 + - ' translation 3 0 1'#13#10 + - ' children ['#13#10 + - ' Shape {'#13#10 + - ' geometry Sphere { radius 2.3 }'#13#10 + - ' appearance Appearance {'#13#10 + - ' material Material { diffuseColor 1 0 0 } # Red'#13#10 + - ' }'#13#10 + - ' }'#13#10 + - ' ]'#13#10 + - ' }'#13#10 + - ''#13#10 + - ' Transform { # Third child - a blue box '#13#10 + - ' translation -2.4 .2 1'#13#10 + - ' rotation 0 1 1 .9'#13#10 + - ' children ['#13#10 + - ' Shape {'#13#10 + - ' geometry Box {}'#13#10 + - ' appearance Appearance {'#13#10 + - ' material Material { diffuseColor 0 0 1 } # Blue'#13#10 + - ' }'#13#10 + - ' }'#13#10 + - ' ]'#13#10 + - ' }'#13#10 + - ''#13#10 + - ' ] # end of children for world'#13#10 + - '}'#13#10 + - 'DEF Example_2 Script {'#13#10 + - ' field SFNode myself USE Example_2'#13#10 + - ' field SFNode root USE ROOT_TRANSFORM'#13#10 + - ' field MFString url "foo.wrl"'#13#10 + - ' eventIn MFNode nodesLoaded'#13#10 + - ' eventIn SFBool trigger_event'#13#10 + - ''#13#10 + - ' url "javascript:'#13#10 + - ' function trigger_event(value, ts){'#13#10 + - ' // do something and then fetch values'#13#10 + - ' Browser.createVRMLFromURL(url, myself, ''nodesLoaded'');'#13#10 + - ' }'#13#10 + - ''#13#10 + - ' function nodesLoaded(value, timestamp){'#13#10 + - ' if (value.length > 5) {'#13#10 + - ' // do something more than 5 nodes in this MFNode...'#13#10 + - ' }'#13#10 + - ' root.addChildren = value;'#13#10 + - ' }"'#13#10 + - '}'; -end; - -class function TSynVrml97Syn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangVrml97; -end; - -initialization - RegisterPlaceableHighlighter(TSynVrml97Syn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterVrml.pas, released 2002-10-21. +The Original Code is based on: SynHighlighterJScript.pas, released 2000-04-14. +The Original Code is based on the mwJScript.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Tony de Buys. +Unicode translation by Maël Hörz. +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: SynHighlighterVrml97.pas,v 1.6.2.8 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} +{ +@abstract(Provides a Vrml97/X3D/JavaScript highlighter for SynEdit) +@author(Massimo Maria Ghisalberti (nissl@mammuth.it) +@created(november 2002 [December 1999, converted to SynEdit April 14, 2000]) +@lastmod(2002-11-03) +The SynHighlighterVrml97 unit provides SynEdit with a Vrml97/X3D/JavaScript (.wrl;*.x3d) highlighter. +The highlighter formats Vrml97/X3D source code highlighting keywords, strings, numbers and characters. +} + +{ TODO: The Ansi version kept unclear to the status of following tokens: + + Token Ambiguity + ===== ========= + bottom tkVrmlAttribute or tkNonReservedKey + description tkVrmlAttribute or tkNonReservedKey + height tkVrmlAttribute or tkNonReservedKey + location tkVrmlAttribute or tkNonReservedKey + style tkVrmlAttribute or tkNonReservedKey + type tkVrmlAttribute or tkNonReservedKey + + NULL tkVrmlParameter or tkVrmlProto + FALSE tkVrmlParameter or tkVrmlProto + + Text tkVrmlShape or tkNonReservedKey + + I took always the first one as this produces the same results as in the + Ansi-version, because the other cases were never reached (due to the way + the if construct was used). +} + +unit SynHighlighterVrml97; + +{$I SynEdit.inc} + +interface + +uses + Windows, + Messages, + Registry, + Controls, + Graphics, + SynEditTypes, + SynEditHighlighter, + SynHighlighterHashEntries, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = ( + tkComment, + tkIdentifier, + tkKey, + tkNull, + tkNumber, + tkSpace, + tkString, + tkSymbol, + tkUnknown, + tkNonReservedKey, + tkEvent, + tkVrmlAppearance, + tkVrmlAttribute, + tkVrmlDefinition, + tkVrmlEvent, + tkVrmlGrouping, + tkVrmlInterpolator, + tkVrmlLight, + tkVrmlNode, + tkVrmlParameter, + tkVrmlproto, + tkVrmlSensor, + tkVrmlShape, + tkVrmlShape_Hint, + tkVrmlTime_dependent, + tkVrmlViewpoint, + tkVrmlWorldInfo, + tkX3DDocType, + tkX3DHeader); + + TRangeState = (rsNormalText, rsComment, rsX3DHeader, rsX3DDocType); + +type + TSynVrml97Syn = class(TSynCustomHighLighter) + private + FRange: TRangeState; + FIsDoctype: Boolean; + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNonReservedKeyAttri: TSynHighlighterAttributes; + FEventAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + + FVrmlAppearanceAttri: TSynHighlighterAttributes; + FVrmlAttributeAttri: TSynHighlighterAttributes; + FVrmlDefinitionAttri: TSynHighlighterAttributes; + FVrmlEventAttri: TSynHighlighterAttributes; + FVrmlGroupingAttri: TSynHighlighterAttributes; + FVrmlInterpolatorAttri: TSynHighlighterAttributes; + FVrmlLightAttri: TSynHighlighterAttributes; + FVrmlNodeAttri: TSynHighlighterAttributes; + FVrmlParameterAttri: TSynHighlighterAttributes; + FVrmlprotoAttri: TSynHighlighterAttributes; + FVrmlSensorAttri: TSynHighlighterAttributes; + FVrmlShapeAttri: TSynHighlighterAttributes; + FVrmlShape_HintAttri: TSynHighlighterAttributes; + FVrmlTime_dependentAttri: TSynHighlighterAttributes; + FVrmlViewpointAttri: TSynHighlighterAttributes; + FVrmlWorldInfoAttri: TSynHighlighterAttributes; + FX3DDocTypeAttri: TSynHighlighterAttributes; + FX3DHeaderAttri: TSynHighlighterAttributes; + + FKeywords: TSynHashEntryList; + procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + function HashKey(Str: PWideChar): Integer; + function IdentKind(MayBe: PWideChar): TtkTokenKind; + procedure AndSymbolProc; + procedure CommentProc; + procedure DiesisCommentProc; + procedure X3DDocTypeOpenProc; + procedure X3DDocTypeProc; + procedure X3DHeaderOpenProc; + procedure X3DHeaderProc; + procedure InCommentProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure MinusProc; + procedure ModSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure SlashProc; + procedure SpaceProc; + procedure StarProc; + procedure StringProc; + procedure SymbolProc; + procedure UnknownProc; + function NextTokenIs(T: UnicodeString): Boolean; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; + published + property NonReservedKeyAttri: TSynHighlighterAttributes read FNonReservedKeyAttri write FNonReservedKeyAttri; + 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 CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; + property EcmaScriptKeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property EcmaScriptEventAttri: TSynHighlighterAttributes read FEventAttri write FEventAttri; + + property VrmlAppearanceAttri: TSynHighlighterAttributes read FVrmlAppearanceAttri write FVrmlAppearanceAttri; + property VrmlAttributeAttri: TSynHighlighterAttributes read FVrmlAttributeAttri write FVrmlAttributeAttri; + property VrmlDefinitionAttri: TSynHighlighterAttributes read FVrmlDefinitionAttri write FVrmlDefinitionAttri; + property VrmlEventAttri: TSynHighlighterAttributes read FVrmlEventAttri write FVrmlEventAttri; + property VrmlGroupingAttri: TSynHighlighterAttributes read FVrmlGroupingAttri write FVrmlGroupingAttri; + property VrmlInterpolatorAttri: TSynHighlighterAttributes read FVrmlInterpolatorAttri write FVrmlInterpolatorAttri; + property VrmlLightAttri: TSynHighlighterAttributes read FVrmlLightAttri write FVrmlLightAttri; + property VrmlNodeAttri: TSynHighlighterAttributes read FVrmlNodeAttri write FVrmlNodeAttri; + property VrmlParameterAttri: TSynHighlighterAttributes read FVrmlParameterAttri write FVrmlParameterAttri; + property VrmlprotoAttri: TSynHighlighterAttributes read FVrmlprotoAttri write FVrmlprotoAttri; + property VrmlSensorAttri: TSynHighlighterAttributes read FVrmlSensorAttri write FVrmlSensorAttri; + property VrmlShapeAttri: TSynHighlighterAttributes read FVrmlShapeAttri write FVrmlShapeAttri; + property VrmlShape_HintAttri: TSynHighlighterAttributes read FVrmlShape_HintAttri write FVrmlShape_HintAttri; + property VrmlTime_dependentAttri: TSynHighlighterAttributes read FVrmlTime_dependentAttri write FVrmlTime_dependentAttri; + property VrmlViewpointAttri: TSynHighlighterAttributes read FVrmlViewpointAttri write FVrmlViewpointAttri; + property VrmlWorldInfoAttri: TSynHighlighterAttributes read FVrmlWorldInfoAttri write FVrmlWorldInfoAttri; + property X3DDocTypeAttri: TSynHighlighterAttributes read FX3DDocTypeAttri write FX3DDocTypeAttri; + property X3DHeaderAttri: TSynHighlighterAttributes read FX3DHeaderAttri write FX3DHeaderAttri; + end; + +implementation + +uses + SynEditStrConst; + +const + Events: UnicodeString = + 'onAbort, onBlur, onChange, onClick, onDblClick, onError, onFocus, ' + + 'onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseMove, ' + + 'onMouseOut, onMouseOver, onMouseUp, onReset, onSelect, onSubmit, ' + + 'onUnload'; + + KeyWords: UnicodeString = + 'abstract, boolean, break, byte, callee, case, catch, char, class, ' + + 'const, constructor, continue, debugger, default, delete, do, DOCTYPE, ' + + 'double, else, enum, export, extends, false, final, finally, float, for, ' + + 'function, goto, head, if, implements, import, in, instanceof, int, ' + + 'interface, long, meta, NaN, native, new, null, package, private, ' + + 'protected, prototype, public, PUBLIC, return, short, start, static, ' + + 'super, switch, synchronized, this, throw, throws, transient, true, try, ' + + 'typeof, var, void, while, with, xml'; + + NonReservedKeys: UnicodeString = + 'abs, acos, action, alert, align, alinkColor, all, All, anchor, anchors, ' + + 'appCodeName, Applet, applets, appName, appVersion, Area, arguments, ' + + 'Arguments, Array, asin, atan, atan2, back, background, bgColor, big, ' + + 'blink, blur, body, bold, Boolean, border, Button, call, caller, ' + + 'captureEvents, ceil, charAt, charCodeAt, Checkbox, checked, clear, ' + + 'clearInterval, clearTimeout, click, close, closed, complete, concat, ' + + 'confirm, content, cookie, cos, current, Date, defaultChecked, ' + + 'defaultSelected, defaultStatus, defaultValue, display, document, ' + + 'domain, E, elements, Embed, embeds, enabledPlugin, encoding, escape, ' + + 'eval, event, exp, fgColor, filename, FileUpload, find, fixed, Float, ' + + 'floor, focus, fontcolor, fontsize, form, Form, forms, forward, Frame, ' + + 'frames, fromCharCode, Function, getDate, getDay, getElementById, ' + + 'getFullYear, getHours, getMilliseconds, getMinutes, getMonth, ' + + 'getSeconds, getTime, getTimezoneOffset, getUTCDate, getUTCDay, ' + + 'getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, ' + + 'getUTCMonth, getUTCSeconds, getYear, Global, go, handleEvent, hash, ' + + 'Hidden, history, History, home, host, hostname, href, hspace, Image, ' + + 'images, index, indexOf, Infinity, innerHeight, innerWidth, input, ' + + 'isFinite, isNaN, italics, java, javaEnabled, join, lastIndexOf, ' + + 'lastModified, Layer, layers, left, link, Link, linkColor, links, LN10, ' + + 'LN2, Location, locationbar, log, LOG10E, LOG2E, logon, lowsrc, match, ' + + 'Math, max, MAX_VALUE, menubar, method, MimeType, mimeTypes, min, ' + + 'MIN_VALUE, moveBy, moveTo, name, navigator, Navigator, ' + + 'NEGATIVE_INFINITY, netscape, next, Null, Number, Object, open, opener, ' + + 'Option, options, outerHeight, outerWidth, Packages, pageX, pageXOffset, ' + + 'pageY, pageYOffset, parent, parse, parseFloat, parseInt, Password, ' + + 'pathname, personalbar, PI, platform, Plugin, plugins, port, ' + + 'POSITIVE_INFINITY, pow, previous, print, prompt, protocol, Radio, ' + + 'random, referrer, refresh, RegExp, releaseEvents, reload, replace, ' + + 'reset, Reset, resizeBy, resizeTo, reverse, right, round, routeEvent, ' + + 'screen, scroll, scrollbars, scrollBy, scrollTo, search, select, Select, ' + + 'selected, selectedIndex, self, setDate, setFullYear, setHours, ' + + 'setInterval, setMilliseconds, setMinutes, setMonth, setSeconds, ' + + 'setTime, setTimeout, setUTCDate, setUTCFullYear, setUTCHours, ' + + 'setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, setYear, ' + + 'sin, slice, small, sort, split, sqrt, SQRT1_2, SQRT2, src, status, ' + + 'statusbar, stop, strike, String, sub, submit, Submit, substr, ' + + 'substring, suffixes, sup, tags, taint, taintEnabled, tan, target, text, ' + + 'Textarea, title, toGMTString, toLocaleString, toLowerCase, toolbar, ' + + 'toSource, toString, toUpperCase, toUTCString, undefined, Undefined, ' + + 'unescape, untaint, unwatch, URL, userAgent, UTC, value, valueOf, ' + + 'version, visibility, vlinkColor, vspace, watch, width, window, Window, ' + + 'write, writeln, zIndex'; + + VrmlAppearances: UnicodeString = + 'Appearance, ImageTexture, Material, NurbsTextureSurface, PixelTexture, ' + + 'TextureBackground, TextureCoordinate, TextureCoordinateGenerator, ' + + 'TextureTransform'; + + VrmlAttributes: UnicodeString = + 'addChildren, ambientIntensity, appearance, attenuation, autoOffset, ' + + 'avatarSize, axisOfRotation, backUrl, bboxCenter, bboxSize, beamWidth, ' + + 'beginCap, bindTime, bottom, bottomRadius, bottomUrl, ccw, center, children, ' + + 'choice, collide, collideTime, color, colorIndex, colorPerVertex, ' + + 'ColorRGBA, convex, coord, coordIndex, creaseAngle, crossSection, ' + + 'cutOffAngle, cycleInterval, cycleTime, description, diffuseColor, direction, ' + + 'directOutput, diskAngle, duration_changed, emissiveColor, enabled, ' + + 'endCap, enterTime, eventName, eventType, exitTime, family, fieldName, ' + + 'fieldOfView, fieldType, FillProperties, fogType, fontStyle, ' + + 'fraction_changed, frontUrl, GeoCoordinate, GeoElevationGrid, ' + + 'GeoLocation, GeoLOD, GeoMetadata, geometry, GeoOrigin, groundAngle, ' + + 'groundColor, headlight, height, hitNormal_changed, hitPoint_changed, ' + + 'hitTexCoord_changed, horizontal, image, info, intensity, isActive, ' + + 'isBound, isOver, jump, justify, key, keyValue, language, leftToRight, ' + + 'leftUrl, length, level, LineProperties, location, loop, material, maxAngle, ' + + 'maxBack, maxExtent, maxFront, maxPosition, minAngle, minBack, minFront, ' + + 'minPosition, MultiTexture, MultiTextureCoordinate, mustEvaluate, ' + + 'normal, normalIndex, normalPerVertex, offset, on, orientation, ' + + 'orientation_changed, parameter, pitch, point, position, ' + + 'position_changed, priority, proxy, radius, range, removeChildren, ' + + 'repeatS, repeatT, rightUrl, rotation, rotation_changed, scale, ' + + 'scaleOrientation, set_bind, set_colorIndex, set_coordIndex, ' + + 'set_crossSection, set_fraction, set_height, set_normalIndex, ' + + 'set_orientation, set_scale, set_spine, set_texCoordIndex, shininess, ' + + 'side, size, skyAngle, skyColor, solid, source, spacing, spatialize, ' + + 'specularColor, speed, spine, startTime, stopTime, string, style, texCoord, ' + + 'texCoordIndex, texture, textureTransform, time, top, topToBottom, ' + + 'topUrl, touchTime, trackPoint_changed, translation, ' + + 'translation_changed, transparency, type, url, value_changed, vector, ' + + 'visibilityLimit, visibilityRange, whichChoice, xDimension, xSpacing, ' + + 'zDimension, zSpacing'; + + VrmlDefinitions: UnicodeString = + 'MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, ' + + 'MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, ' + + 'SFRotation, SFString, SFTime, SFVec2f, SFVec3f'; + + VrmlEvents: UnicodeString = + 'eventIn, eventOut, exposedField, field'; + + VrmlGroupings: UnicodeString = + 'Anchor, Billboard, Collision, ESPDUTransform, Group, Inline, LOD, ' + + 'NurbsGroup, ReceiverPdu, SignalPdu, StaticGroup, Switch, Transform, ' + + 'Transform2D, TransmitterPdu'; + + VrmlInterpolators: UnicodeString = + 'ColorInterpolator, CoordinateInterpolator, CoordinateInterpolator2D, ' + + 'GeoPositionInterpolator, NormalInterpolator, NurbsPositionInterpolator, ' + + 'OrientationInterpolator, PositionInterpolator, PositionInterpolator2D, ' + + 'ScalarInterpolator'; + + VrmlLights: UnicodeString = + 'DirectionalLight, PointLight, SpotLight'; + + VrmlNodes: UnicodeString = + 'Background, Color, Coordinate, CoordinateDeformer, Fog, FontStyle, ' + + 'Joint, NavigationInfo, Normal, Script, Site, Sound'; + + VrmlParameters: UnicodeString = + 'ALL, AUTO, BINDINGS, BOLD, BOTTOM, CENTER, CLAMP, CLOCKWISE, CONVEX, ' + + 'COUNTERCLOCKWISE, CULLING, DEFAULT, DEFAULTS, Displacer, ENUMS, FACE, FALSE, ' + + 'FAMILY, FILE, FORMAT, ITALIC, JUSTIFICATION, LEFT, NONE, NULL, OFF, ON, ' + + 'OVERALL, PARTS, PER_FACE, PER_FACE_INDEXED, PER_PART, PER_PART_INDEXED, ' + + 'PER_VERTEX, PER_VERTEX_INDEXED, REPEAT, RIGHT, SHAPE, SIDES, SOLID, ' + + 'STYLE, TRUE, TYPE, UNKNOWN_FACE_TYPE, UNKNOWN_ORDERING, ' + + 'UNKNOWN_SHAPE_TYPE, WRAP'; + + VrmlProtos: UnicodeString = + 'DEF, EXTERNPROTO, IS, PROTO, ROUTE, Scene, TO, USE, VRML, X3D, ' + + 'X3DAppearanceNode, X3DAppearanceChildNode, X3DBackgroundNode, X3DBindableNode, ' + + 'X3DBoundedObject, X3DChildNode, X3DColorNode, X3DComposedGeometryNode, ' + + 'X3DCoordinateNode, X3DDragSensorNode, X3DEnvironmentalSensorNode, ' + + 'X3DFontStyleNode, X3DGeometry2DNode, X3DGeometry3DNode, ' + + 'X3DGeometryNode, X3DGeometryPropertyNode, X3DGroupingNode, ' + + 'X3DInterpolatorNode, X3DKeyDeviceSensorNode, X3DLightNode, ' + + 'X3DMaterialNode, X3DNetworkSensorNode, X3DNode, X3DNormalNode, ' + + 'X3DParametricGeometryNode, X3DPointingDeviceSensorNode, ' + + 'X3DPrototypeInstance, X3DScriptNode, X3DSensorNode, X3DSequencerNode, ' + + 'X3DShapeNode, X3DSoundNode, X3DSoundSourceNode, X3DTexture2DNode, ' + + 'X3DTextureCoordinateNode, X3DTextureNode, X3DTextureTransform2DNode, ' + + 'X3DTextureTransformNode, X3DTimeDependentNode, X3DTouchSensorNode, ' + + 'X3DTriggerNode, X3DUrlObject'; + + VrmlSensors: UnicodeString = + 'BooleanFilter, BooleanSequencer, BooleanToggle, BooleanTrigger, ' + + 'CylinderSensor, GeoTouchSensor, IntegerTrigger, KeySensor, LoadSensor, ' + + 'PlaneSensor, ProximitySensor, SphereSensor, StringSensor, TimeSensor, ' + + 'TouchSensor, VisibilitySensor'; + + VrmlShapes: UnicodeString = + 'Arc2D, ArcClose2D, Box, Circle2D, Cone, Contour2D, ContourPolyline2D, ' + + 'Cylinder, Disk2D, ElevationGrid, Humanoid, NurbsCurve, NurbsCurve2D, ' + + 'NurbsSurface, PointSet, Polyline2D, Polypoint2D, Rectangle2D, Segment, ' + + 'Shape, Shape2D, Sphere, Text, TriangleFanSet, TriangleSet, TriangleSet2D, ' + + 'TriangleStripSet, TrimmedSurface'; + + VrmlShape_Hints: UnicodeString = + 'Extrusion, IndexedFaceSet, IndexedLineSet'; + + VrmlTime_dependents: UnicodeString = + 'AudioClip, IntegerSequencer, MovieTexture, TimeTrigger'; + + VrmlViewpoints: UnicodeString = + 'GeoViewpoint, Viewpoint'; + + VrmlWorldInfos: UnicodeString = + 'WorldInfo'; + + +procedure TSynVrml97Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +var + HashValue: Integer; +begin + HashValue := HashKey(PWideChar(AKeyword)); + FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); +end; + +function TSynVrml97Syn.HashKey(Str: PWideChar): Integer; + + function GetOrd: Integer; + begin + case Str^ of + 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); + 'A'..'Z': Result := 27 + Ord(Str^) - Ord('A'); + '0'..'9': Result := 54 + Ord(Str^) - Ord('0'); + '_': Result := 53; + else Result := 0; + end + end; + +begin + Result := 0; + while IsIdentChar(Str^) do + begin +{$IFOPT Q-} + Result := 7 * Result + GetOrd; +{$ELSE} + Result := (7 * Result + GetOrd) and $FFFFFF; +{$ENDIF} + Inc(Str); + end; + Result := Result and $FF; // 255 + FStringLen := Str - FToIdent; +end; + +function TSynVrml97Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Entry: TSynHashEntry; +begin + FToIdent := MayBe; + Entry := FKeywords[HashKey(MayBe)]; + while Assigned(Entry) do + begin + if Entry.KeywordLen > FStringLen then + Break + else if Entry.KeywordLen = FStringLen then + if IsCurrentToken(Entry.Keyword) then + begin + Result := TtkTokenKind(Entry.Kind); + Exit; + end; + Entry := Entry.Next; + end; + Result := tkIdentifier; +end; + +constructor TSynVrml97Syn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FKeywords := TSynHashEntryList.Create; + FIsDoctype := False; + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + FCommentAttri.Foreground := clNavy; + FCommentAttri.Background := clGray; + AddAttribute(FCommentAttri); + + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + FIdentifierAttri.Style := []; + FIdentifierAttri.Foreground := clNavy; + FIdentifierAttri.Background := clWhite; + AddAttribute(FIdentifierAttri); + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + FKeyAttri.Style := [fsBold]; + FKeyAttri.Foreground := clRed; + FKeyAttri.Background := clWhite; + AddAttribute(FKeyAttri); + + FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + FNonReservedKeyAttri.Style := [fsItalic]; + FNonReservedKeyAttri.Foreground := clBlack; + FNonReservedKeyAttri.Background := clWhite; + AddAttribute(FNonReservedKeyAttri); + + FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + FEventAttri.Style := [fsItalic]; + FEventAttri.Foreground := clNavy; + FEventAttri.Background := clWhite; + AddAttribute(FEventAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FEventAttri.Style := [fsItalic]; + FEventAttri.Foreground := clNavy; + FEventAttri.Background := clWhite; + AddAttribute(FNumberAttri); + + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + FSpaceAttri.Style := [fsItalic]; + FSpaceAttri.Foreground := clNavy; + AddAttribute(FSpaceAttri); + + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + FStringAttri.Style := [fsItalic]; + FStringAttri.Foreground := clNavy; + FStringAttri.Background := clWhite; + AddAttribute(FStringAttri); + + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + FSymbolAttri.Style := [fsItalic]; + FSymbolAttri.Foreground := clNavy; + FSymbolAttri.Background := clWhite; + AddAttribute(FSymbolAttri); + //-- vrml + FVrmlAppearanceAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAppearance, SYNS_FriendlyAttrVrmlAppearance); + FVrmlAppearanceAttri.Style := [fsItalic]; + FVrmlAppearanceAttri.Foreground := clNavy; + FVrmlAppearanceAttri.Background := clWhite; + AddAttribute(FVrmlAppearanceAttri); + + FVrmlAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAttribute, SYNS_FriendlyAttrVrmlAttribute); + FVrmlAttributeAttri.Style := [fsItalic]; + FVrmlAttributeAttri.Foreground := clNavy; + FVrmlAttributeAttri.Background := clGray; + AddAttribute(FVrmlAttributeAttri); + + FVrmlDefinitionAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlDefinition, SYNS_FriendlyAttrVrmlDefinition); + FVrmlDefinitionAttri.Style := [fsItalic]; + FVrmlDefinitionAttri.Foreground := clNavy; + FVrmlDefinitionAttri.Background := clRed; + AddAttribute(FVrmlDefinitionAttri); + + FVrmlEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlEvent, SYNS_FriendlyAttrVrmlEvent); + FVrmlEventAttri.Style := [fsBold]; + FVrmlEventAttri.Foreground := clRed; + FVrmlEventAttri.Background := clWhite; + AddAttribute(FVrmlEventAttri); + + FVrmlGroupingAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlGrouping, SYNS_FriendlyAttrVrmlGrouping); + FVrmlGroupingAttri.Style := [fsBold]; + FVrmlGroupingAttri.Foreground := clNavy; + FVrmlGroupingAttri.Background := clWhite; + AddAttribute(FVrmlGroupingAttri); + + FVrmlInterpolatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlInterpolator, SYNS_FriendlyAttrVrmlInterpolator); + FVrmlInterpolatorAttri.Style := [fsItalic]; + FVrmlInterpolatorAttri.Foreground := clLime; + FVrmlInterpolatorAttri.Background := clWhite; + AddAttribute(FVrmlInterpolatorAttri); + + FVrmlLightAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlLight, SYNS_FriendlyAttrVrmlLight); + FVrmlLightAttri.Style := [fsItalic]; + FVrmlLightAttri.Foreground := clTeal; + FVrmlLightAttri.Background := clWhite; + AddAttribute(FVrmlLightAttri); + + FVrmlNodeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlNode, SYNS_FriendlyAttrVrmlNode); + FVrmlNodeAttri.Style := [fsItalic, fsBold]; + FVrmlNodeAttri.Foreground := clGreen; + FVrmlNodeAttri.Background := clWhite; + AddAttribute(FVrmlNodeAttri); + + FVrmlParameterAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlParameter, SYNS_FriendlyAttrVrmlParameter); + FVrmlParameterAttri.Style := [fsBold]; + FVrmlParameterAttri.Foreground := $F0CAA6; //clSkyBlue + FVrmlParameterAttri.Background := clWhite; + AddAttribute(FVrmlParameterAttri); + + FVrmlprotoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlProto, SYNS_FriendlyAttrVrmlProto); + FVrmlprotoAttri.Style := [fsBold]; + FVrmlprotoAttri.Foreground := clRed; + FVrmlprotoAttri.Background := clWhite; + AddAttribute(FVrmlprotoAttri); + + FVrmlSensorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlSensor, SYNS_FriendlyAttrVrmlSensor); + FVrmlSensorAttri.Style := [fsBold]; + FVrmlSensorAttri.Foreground := clOlive; + FVrmlSensorAttri.Background := clWhite; + AddAttribute(FVrmlSensorAttri); + + FVrmlShapeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape, SYNS_FriendlyAttrVrmlShape); + FVrmlShapeAttri.Style := [fsBold]; + FVrmlShapeAttri.Foreground := clPurple; + FVrmlShapeAttri.Background := clWhite; + AddAttribute(FVrmlShapeAttri); + + FVrmlShape_HintAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape_Hint, SYNS_FriendlyAttrVrmlShape_Hint); + FVrmlShape_HintAttri.Style := [fsItalic]; + FVrmlShape_HintAttri.Foreground := clPurple; + FVrmlShape_HintAttri.Background := clWhite; + AddAttribute(FVrmlShape_HintAttri); + + FVrmlTime_dependentAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlTime_dependent, SYNS_FriendlyAttrVrmlTime_dependent); + FVrmlTime_dependentAttri.Style := [fsItalic]; + FVrmlTime_dependentAttri.Foreground := clOlive; + FVrmlTime_dependentAttri.Background := clWhite; + AddAttribute(FVrmlTime_dependentAttri); + + FVrmlViewpointAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlViewpoint, SYNS_FriendlyAttrVrmlViewpoint); + FVrmlViewpointAttri.Style := [fsItalic]; + FVrmlViewpointAttri.Foreground := clGreen; + FVrmlViewpointAttri.Background := clWhite; + AddAttribute(FVrmlViewpointAttri); + + FVrmlWorldInfoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlWorldInfo, SYNS_FriendlyAttrVrmlWorldInfo); + FVrmlWorldInfoAttri.Style := [fsItalic]; + FVrmlWorldInfoAttri.Foreground := clMaroon; + FVrmlWorldInfoAttri.Background := clWhite; + AddAttribute(FVrmlWorldInfoAttri); + + FX3DDocTypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DDocType, SYNS_FriendlyAttrX3DDocType); + FX3DDocTypeAttri.Style := [fsItalic]; + FX3DDocTypeAttri.Foreground := clMaroon; + FX3DDocTypeAttri.Background := clWhite; + AddAttribute(FX3DDocTypeAttri); + + FX3DHeaderAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DHeader, SYNS_FriendlyAttrX3DHeader); + FX3DHeaderAttri.Style := [fsItalic]; + FX3DHeaderAttri.Foreground := clMaroon; + FX3DHeaderAttri.Background := clWhite; + AddAttribute(FX3DHeaderAttri); + SetAttributesOnChange(DefHighlightChange); + + EnumerateKeywords(Ord(tkEvent), Events, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkNonReservedKey), NonReservedKeys, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlAppearance), VrmlAppearances, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlAttribute), VrmlAttributes, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlDefinition), VrmlDefinitions, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlEvent), VrmlEvents, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlGrouping), VrmlGroupings, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlInterpolator), VrmlInterpolators, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlLight), VrmlLights, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlNode), VrmlNodes, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlParameter), VrmlParameters, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlproto), VrmlProtos, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlSensor), VrmlSensors, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlShape), VrmlShapes, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlShape_Hint), VrmlShape_Hints, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlTime_dependent), VrmlTime_dependents, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlViewpoint), VrmlViewpoints, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkVrmlWorldInfo), VrmlWorldInfos, IsIdentChar, DoAddKeyword); + + FDefaultFilter := SYNS_FilterVrml97; + FRange := rsNormalText; +end; + +destructor TSynVrml97Syn.Destroy; +begin + FKeywords.Free; + inherited Destroy; +end; + +procedure TSynVrml97Syn.AndSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); +end; + +function TSynVrml97Syn.NextTokenIs(T: UnicodeString): Boolean; +var + I, Len: Integer; +begin + Result := True; + Len := Length(T); + for I := 1 to Len do + if (FLine[Run + I] <> T[I]) then + begin + Result := False; + Break; + end; +end; + +procedure TSynVrml97Syn.InCommentProc; +begin + if (FLine[Run + 1] = '-') and (FLine[Run + 2] = '-') then + begin + Inc(Run); + FTokenID := tkComment; + FRange := rsComment; + Inc(Run, 2); + repeat + Inc(Run); + if (FLine[Run] = '-') and (FLine[Run + 1] = '-') then + begin + FRange := rsNormalText; + Inc(Run, 2); + Break; + end; + until IsLineEnd(Run); + Exit; + end; +end; + +procedure TSynVrml97Syn.DiesisCommentProc; +begin + if FLine[Run] = #0 then + NullProc + else + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynVrml97Syn.X3DHeaderOpenProc; +begin + Inc(Run); + FRange := rsX3DHeader; + X3DHeaderProc; + FTokenID := tkX3DHeader; +end; + +procedure TSynVrml97Syn.X3DHeaderProc; +begin + case FLine[Run] of + #0 :NullProc; + #10 :LFProc; + #13 :CRProc; + else + begin + FTokenID := tkX3DHeader; + repeat + if (FLine[Run] = '?') then + begin + Inc(Run, 1); + FRange := rsNormalText; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynVrml97Syn.X3DDocTypeOpenProc; +begin + if NextTokenIs('DOCTYPE') then + begin + FRange := rsX3DDocType; + X3DDocTypeProc; + FTokenID := tkX3DDocType; + end + else + if NextTokenIs('--') then + begin + FRange := rsComment; + InCommentProc; + FTokenID := tkComment; + end + else + begin + FTokenID := tkSymbol; + Inc(Run); + end; +end; + +procedure TSynVrml97Syn.X3DDocTypeProc; +begin + case FLine[Run] of + #0 :NullProc; + #10 :LFProc; + #13 :CRProc; + else + begin + FTokenID := tkX3DDocType; + repeat + if (FLine[Run + 1] = '>') then + begin + Inc(Run, 1); + FRange := rsNormalText; + Break; + end; + if not IsLineEnd(Run) then + Inc(Run); + until IsLineEnd(Run); + end; + end; +end; + +procedure TSynVrml97Syn.CommentProc; +begin + if FLine[Run] = #0 then + NullProc + else + begin + FTokenID := tkComment; + repeat + if ((FLine[Run] = '*') and (FLine[Run + 1] = '/')) + or + ((FLine[Run] = '-') and (FLine[Run + 1] = '-')) then + begin + FRange := rsNormalText; + Inc(Run, 2); + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynVrml97Syn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynVrml97Syn.IdentProc; +begin + FTokenID := IdentKind(FLine + Run); + Inc(Run, FStringLen); + while IsIdentChar(FLine[Run]) do + Inc(Run); +end; + +procedure TSynVrml97Syn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynVrml97Syn.MinusProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run); +end; + +procedure TSynVrml97Syn.ModSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynVrml97Syn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynVrml97Syn.NumberProc; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X': + 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 CharInSet(FLine[Succ(Run)], ['0'..'9', 'a'..'f', 'A'..'F']) then + begin + Break; + end; + isHex := True; + end; + end; + Inc(Run); + end; +end; + +procedure TSynVrml97Syn.OrSymbolProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); +end; + +procedure TSynVrml97Syn.PlusProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); +end; + +procedure TSynVrml97Syn.PointProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2); +end; + +procedure TSynVrml97Syn.SlashProc; +begin + Inc(Run); + case FLine[Run] of + '/' : + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; + '*' : + begin + FTokenID := tkComment; + FRange := rsComment; + repeat + Inc(Run); + if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + begin + FRange := rsNormalText; + Inc(Run, 2); + Break; + end; + until IsLineEnd(Run); + end; + '=' : + begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + FTokenID := tkSymbol; + end; +end; + +procedure TSynVrml97Syn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynVrml97Syn.StarProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if FLine[Run] = '=' then Inc(Run); +end; + +procedure TSynVrml97Syn.StringProc; +var + l_strChar: UnicodeString; +begin + FTokenID := tkString; + l_strChar := FLine[Run]; // We could have '"' or #39 + if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then Inc(Run, 2); + repeat + if IsLineEnd(Run) then + Break; + Inc(Run); + until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); + if not IsLineEnd(Run) then + Inc(Run); +end; + +procedure TSynVrml97Syn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynVrml97Syn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynVrml97Syn.Next; +begin + FTokenPos := Run; + case FRange of + rsX3DHeader: X3DHeaderProc; + rsX3DDocType: X3DDocTypeProc; + rsComment: CommentProc; + else + case FLine[Run] of + '&': AndSymbolProc; + #13: CRProc; + '#': DiesisCommentProc; + 'A'..'Z', 'a'..'z', '_': IdentProc; + #10: LFProc; + '-': MinusProc; + '%': ModSymbolProc; + #0: NullProc; + '0'..'9': NumberProc; + '|': OrSymbolProc; + '+': PlusProc; + '.': PointProc; + '/': SlashProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '*': StarProc; + '"', #39: StringProc; + '?': X3DHeaderOpenProc; + '!': X3DDocTypeOpenProc; + '~', '{', '}', ',', '(', ')', '[', ']', ':', ';', '=', '<', '>': SymbolProc; + else UnknownProc; + end; + end; + inherited; +end; + +function TSynVrml97Syn.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 TSynVrml97Syn.GetEol: Boolean; +begin + Result := FTokenID = tkNull; +end; + +function TSynVrml97Syn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynVrml97Syn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynVrml97Syn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case GetTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNonReservedKey: Result := FNonReservedKeyAttri; + tkEvent: Result := FEventAttri; + tkNumber: Result := FNumberAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + // vrml + tkVrmlAppearance: Result := FVrmlAppearanceAttri; + tkVrmlAttribute: Result := FVrmlAttributeAttri; + tkVrmlDefinition: Result := FVrmlDefinitionAttri; + tkVrmlEvent: Result := FVrmlEventAttri; + tkVrmlGrouping: Result := FVrmlGroupingAttri; + tkVrmlInterpolator: Result := FVrmlInterpolatorAttri; + tkVrmlLight: Result := FVrmlLightAttri; + tkVrmlNode: Result := FVrmlNodeAttri; + tkVrmlParameter: Result := FVrmlParameterAttri; + tkVrmlproto: Result := FVrmlprotoAttri; + tkVrmlSensor: Result := FVrmlSensorAttri; + tkVrmlShape: Result := FVrmlShapeAttri; + tkVrmlShape_Hint: Result := FVrmlShape_HintAttri; + tkVrmlTime_dependent: Result := FVrmlTime_dependentAttri; + tkVrmlViewpoint: Result := FVrmlViewpointAttri; + tkVrmlWorldInfo: Result := FVrmlWorldInfoAttri; + tkX3DDocType: Result := FX3DDocTypeAttri; + tkX3DHeader: Result := FX3DHeaderAttri; + //-- + else + Result := nil; + end; +end; + +function TSynVrml97Syn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynVrml97Syn.ResetRange; +begin + FRange := rsNormalText; +end; + +procedure TSynVrml97Syn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +function TSynVrml97Syn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterVrml97; +end; + +class function TSynVrml97Syn.GetLanguageName: string; +begin + Result := SYNS_LangVrml97; +end; + +function TSynVrml97Syn.GetSampleSource: UnicodeString; +begin + Result := + '#VRML V2.0 utf8'#13#10 + + 'Transform {'#13#10 + + ' children ['#13#10 + + ' NavigationInfo { headlight FALSE } # We''ll add our own light'#13#10 + + ''#13#10 + + ' DirectionalLight { # First child'#13#10 + + ' direction 0 0 -1 # Light illuminating the scene'#13#10 + + ' }'#13#10 + + ''#13#10 + + ' Transform { # Second child - a red sphere'#13#10 + + ' translation 3 0 1'#13#10 + + ' children ['#13#10 + + ' Shape {'#13#10 + + ' geometry Sphere { radius 2.3 }'#13#10 + + ' appearance Appearance {'#13#10 + + ' material Material { diffuseColor 1 0 0 } # Red'#13#10 + + ' }'#13#10 + + ' }'#13#10 + + ' ]'#13#10 + + ' }'#13#10 + + ''#13#10 + + ' Transform { # Third child - a blue box '#13#10 + + ' translation -2.4 .2 1'#13#10 + + ' rotation 0 1 1 .9'#13#10 + + ' children ['#13#10 + + ' Shape {'#13#10 + + ' geometry Box {}'#13#10 + + ' appearance Appearance {'#13#10 + + ' material Material { diffuseColor 0 0 1 } # Blue'#13#10 + + ' }'#13#10 + + ' }'#13#10 + + ' ]'#13#10 + + ' }'#13#10 + + ''#13#10 + + ' ] # end of children for world'#13#10 + + '}'#13#10 + + 'DEF Example_2 Script {'#13#10 + + ' field SFNode myself USE Example_2'#13#10 + + ' field SFNode root USE ROOT_TRANSFORM'#13#10 + + ' field MFString url "foo.wrl"'#13#10 + + ' eventIn MFNode nodesLoaded'#13#10 + + ' eventIn SFBool trigger_event'#13#10 + + ''#13#10 + + ' url "javascript:'#13#10 + + ' function trigger_event(value, ts){'#13#10 + + ' // do something and then fetch values'#13#10 + + ' Browser.createVRMLFromURL(url, myself, ''nodesLoaded'');'#13#10 + + ' }'#13#10 + + ''#13#10 + + ' function nodesLoaded(value, timestamp){'#13#10 + + ' if (value.length > 5) {'#13#10 + + ' // do something more than 5 nodes in this MFNode...'#13#10 + + ' }'#13#10 + + ' root.addChildren = value;'#13#10 + + ' }"'#13#10 + + '}'; +end; + +class function TSynVrml97Syn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangVrml97; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynVrml97Syn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterXML.pas b/Source/VCL/SynEdit/Source/SynHighlighterXML.pas index 29f8cfdd..818cff49 100644 --- a/Source/VCL/SynEdit/Source/SynHighlighterXML.pas +++ b/Source/VCL/SynEdit/Source/SynHighlighterXML.pas @@ -1,859 +1,988 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynHighlighterXML.pas, released 2000-11-20. -The Initial Author of this file is Jeff Rafter. -Unicode translation by Maël Hörz. -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: SynHighlighterXML.pas,v 1.11.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -History: -------------------------------------------------------------------------------- -2000-11-30 Removed mHashTable and MakeIdentTable per Michael Hieke - -Known Issues: -- Nothing is really constrained (properly) to valid name chars -- Entity Refs are not constrained to valid name chars -- Support for "Combining Chars and Extender Chars" in names are lacking -- The internal DTD is not parsed (and not handled correctly) --------------------------------------------------------------------------------} -{ -@abstract(Provides an XML highlighter for SynEdit) -@author(Jeff Rafter-- Phil 4:13, based on SynHighlighterHTML by Hideo Koiso) -@created(2000-11-17) -@lastmod(2001-03-12) -The SynHighlighterXML unit provides SynEdit with an XML highlighter. -} - -unit SynHighlighterXML; - -interface - -{$I SynEdit.inc} - -uses - Windows, Messages, Controls, Graphics, Registry, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkAposAttrValue, tkAposEntityRef, tkAttribute, tkCDATA, - tkComment, tkElement, tkEntityRef, tkEqual, tkNull, tkProcessingInstruction, - tkQuoteAttrValue, tkQuoteEntityRef, tkSpace, tkSymbol, tkText, - // - tknsAposAttrValue, tknsAposEntityRef, tknsAttribute, tknsEqual, - tknsQuoteAttrValue, tknsQuoteEntityRef, - //These are unused at the moment - tkDocType - {tkDocTypeAposAttrValue, tkDocTypeAposEntityRef, tkDocTypeAttribute, - tkDocTypeElement, tkDocTypeEqual tkDocTypeQuoteAttrValue, - tkDocTypeQuoteEntityRef} - ); - - TRangeState = (rsAposAttrValue, rsAPosEntityRef, rsAttribute, rsCDATA, - rsComment, rsElement, rsEntityRef, rsEqual, rsProcessingInstruction, - rsQuoteAttrValue, rsQuoteEntityRef, rsText, - // - rsnsAposAttrValue, rsnsAPosEntityRef, rsnsEqual, rsnsQuoteAttrValue, - rsnsQuoteEntityRef, - //These are unused at the moment - rsDocType, rsDocTypeSquareBraces - {rsDocTypeAposAttrValue, rsDocTypeAposEntityRef, rsDocTypeAttribute, - rsDocTypeElement, rsDocTypeEqual, rsDocTypeQuoteAttrValue, - rsDocTypeQuoteEntityRef} - ); - - TSynXMLSyn = class(TSynCustomHighlighter) - private - fRange: TRangeState; - fTokenID: TtkTokenKind; - fElementAttri: TSynHighlighterAttributes; - fSpaceAttri: TSynHighlighterAttributes; - fTextAttri: TSynHighlighterAttributes; - fEntityRefAttri: TSynHighlighterAttributes; - fProcessingInstructionAttri: TSynHighlighterAttributes; - fCDATAAttri: TSynHighlighterAttributes; - fCommentAttri: TSynHighlighterAttributes; - fDocTypeAttri: TSynHighlighterAttributes; - fAttributeAttri: TSynHighlighterAttributes; - fnsAttributeAttri: TSynHighlighterAttributes; - fAttributeValueAttri: TSynHighlighterAttributes; - fnsAttributeValueAttri: TSynHighlighterAttributes; - fSymbolAttri: TSynHighlighterAttributes; - FWantBracesParsed: Boolean; - procedure NullProc; - procedure CarriageReturnProc; - procedure LineFeedProc; - procedure SpaceProc; - procedure LessThanProc; - procedure GreaterThanProc; - procedure CommentProc; - procedure ProcessingInstructionProc; - procedure DocTypeProc; - procedure CDATAProc; - procedure TextProc; - procedure ElementProc; - procedure AttributeProc; - procedure QAttributeValueProc; - procedure AAttributeValueProc; - procedure EqualProc; - procedure IdentProc; - procedure NextProcedure; - function NextTokenIs(Token: string): Boolean; - procedure EntityRefProc; - procedure QEntityRefProc; - procedure AEntityRefProc; - protected - function GetSampleSource: string; override; - function IsFilterStored: Boolean; override; - function IsNameChar: Boolean; virtual; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: string; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; - published - property ElementAttri: TSynHighlighterAttributes read fElementAttri - write fElementAttri; - property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri - write fAttributeAttri; - property NamespaceAttributeAttri: TSynHighlighterAttributes - read fnsAttributeAttri write fnsAttributeAttri; - property AttributeValueAttri: TSynHighlighterAttributes - read fAttributeValueAttri write fAttributeValueAttri; - property NamespaceAttributeValueAttri: TSynHighlighterAttributes - read fnsAttributeValueAttri write fnsAttributeValueAttri; - property TextAttri: TSynHighlighterAttributes read fTextAttri - write fTextAttri; - property CDATAAttri: TSynHighlighterAttributes read fCDATAAttri - write fCDATAAttri; - property EntityRefAttri: TSynHighlighterAttributes read fEntityRefAttri - write fEntityRefAttri; - property ProcessingInstructionAttri: TSynHighlighterAttributes - read fProcessingInstructionAttri write fProcessingInstructionAttri; - property CommentAttri: TSynHighlighterAttributes read fCommentAttri - write fCommentAttri; - property DocTypeAttri: TSynHighlighterAttributes read fDocTypeAttri - write fDocTypeAttri; - property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri - write fSpaceAttri; - property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri - write fSymbolAttri; - property WantBracesParsed : Boolean read FWantBracesParsed - write FWantBracesParsed default True; - end; - -implementation - -uses - SynEditStrConst; - -constructor TSynXMLSyn.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - fCaseSensitive := True; - - fElementAttri := TSynHighlighterAttributes.Create(SYNS_AttrElementName, SYNS_FriendlyAttrElementName); - fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); - fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrWhitespace, SYNS_FriendlyAttrWhitespace); - fEntityRefAttri := TSynHighlighterAttributes.Create(SYNS_AttrEntityReference, SYNS_FriendlyAttrEntityReference); - fProcessingInstructionAttri := TSynHighlighterAttributes.Create( - SYNS_AttrProcessingInstr, SYNS_FriendlyAttrProcessingInstr); - fCDATAAttri := TSynHighlighterAttributes.Create(SYNS_AttrCDATASection, SYNS_FriendlyAttrCDATASection); - fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - fDocTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDOCTYPESection, SYNS_FriendlyAttrDOCTYPESection); - fAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttributeName, SYNS_FriendlyAttrAttributeName); - fnsAttributeAttri := TSynHighlighterAttributes.Create( - SYNS_AttrNamespaceAttrName, SYNS_FriendlyAttrNamespaceAttrName); - fAttributeValueAttri := TSynHighlighterAttributes.Create( - SYNS_AttrAttributeValue, SYNS_FriendlyAttrAttributeValue); - fnsAttributeValueAttri := TSynHighlighterAttributes.Create( - SYNS_AttrNamespaceAttrValue, SYNS_FriendlyAttrNamespaceAttrValue); - fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - - fElementAttri.Foreground := clMaroon; - fElementAttri.Style := [fsBold]; - - fDocTypeAttri.Foreground := clblue; - fDocTypeAttri.Style := [fsItalic]; - - fCDATAAttri.Foreground := clOlive; - fCDATAAttri.Style := [fsItalic]; - - fEntityRefAttri.Foreground := clblue; - fEntityRefAttri.Style := [fsbold]; - - fProcessingInstructionAttri.Foreground:= clblue; - fProcessingInstructionAttri.Style:= []; - - fTextAttri.Foreground := clBlack; - fTextAttri.Style := [fsBold]; - - fAttributeAttri.Foreground := clMaroon; - fAttributeAttri.Style := []; - - fnsAttributeAttri.Foreground := clRed; - fnsAttributeAttri.Style := []; - - fAttributeValueAttri.Foreground := clNavy; - fAttributeValueAttri.Style := [fsBold]; - - fnsAttributeValueAttri.Foreground := clRed; - fnsAttributeValueAttri.Style := [fsBold]; - - fCommentAttri.Background := clSilver; - fCommentAttri.Foreground := clGray; - fCommentAttri.Style := [fsbold, fsItalic]; - - fSymbolAttri.Foreground := clblue; - fSymbolAttri.Style := []; - - AddAttribute(fSymbolAttri); - AddAttribute(fProcessingInstructionAttri); - AddAttribute(fDocTypeAttri); - AddAttribute(fCommentAttri); - AddAttribute(fElementAttri); - AddAttribute(fAttributeAttri); - AddAttribute(fnsAttributeAttri); - AddAttribute(fAttributeValueAttri); - AddAttribute(fnsAttributeValueAttri); - AddAttribute(fEntityRefAttri); - AddAttribute(fCDATAAttri); - AddAttribute(fSpaceAttri); - AddAttribute(fTextAttri); - - SetAttributesOnChange(DefHighlightChange); - - fRange := rsText; - fDefaultFilter := SYNS_FilterXML; -end; - -procedure TSynXMLSyn.NullProc; -begin - fTokenID := tkNull; - inc(Run); -end; - -procedure TSynXMLSyn.CarriageReturnProc; -begin - fTokenID := tkSpace; - Inc(Run); - if fLine[Run] = #10 then Inc(Run); -end; - -procedure TSynXMLSyn.LineFeedProc; -begin - fTokenID := tkSpace; - Inc(Run); -end; - -procedure TSynXMLSyn.SpaceProc; -begin - inc(Run); - fTokenID := tkSpace; - while fLine[Run] <= #32 do - begin - if CharInSet(fLine[Run], [#0, #9, #10, #13]) then break; - Inc(Run); - end; -end; - -procedure TSynXMLSyn.LessThanProc; -begin - Inc(Run); - if (fLine[Run] = '/') then - Inc(Run); - - if (fLine[Run] = '!') then - begin - if NextTokenIs('--') then - begin - fTokenID := tkSymbol; - fRange := rsComment; - Inc(Run, 3); - end - else if NextTokenIs('DOCTYPE') then - begin - fTokenID := tkDocType; - fRange := rsDocType; - Inc(Run, 7); - end - else if NextTokenIs('[CDATA[') then - begin - fTokenID := tkCDATA; - fRange := rsCDATA; - Inc(Run, 7); - end - else - begin - fTokenID := tkSymbol; - fRange := rsElement; - Inc(Run); - end; - end - else if fLine[Run]= '?' then - begin - fTokenID := tkProcessingInstruction; - fRange := rsProcessingInstruction; - Inc(Run); - end - else - begin - fTokenID := tkSymbol; - fRange := rsElement; - end; -end; - -procedure TSynXMLSyn.GreaterThanProc; -begin - fTokenId := tkSymbol; - fRange:= rsText; - Inc(Run); -end; - -procedure TSynXMLSyn.CommentProc; -begin - if (fLine[Run] = '-') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '>') then - begin - fTokenID := tkSymbol; - fRange := rsText; - Inc(Run, 3); - Exit; - end; - - fTokenID := tkComment; - - if IsLineEnd(Run) then - begin - NextProcedure; - Exit; - end; - - while not IsLineEnd(Run) do - begin - if (fLine[Run] = '-') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '>') then - begin - fRange := rsComment; - break; - end; - Inc(Run); - end; -end; - -procedure TSynXMLSyn.ProcessingInstructionProc; -begin - fTokenID := tkProcessingInstruction; - if IsLineEnd(Run) then - begin - NextProcedure; - Exit; - end; - - while not IsLineEnd(Run) do - begin - if (fLine[Run] = '>') and (fLine[Run - 1] = '?') - then - begin - fRange := rsText; - Inc(Run); - break; - end; - Inc(Run); - end; -end; - -procedure TSynXMLSyn.DocTypeProc; -begin - fTokenID := tkDocType; - - if IsLineEnd(Run) then - begin - NextProcedure; - Exit; - end; - - case fRange of - rsDocType: - begin - while not IsLineEnd(Run) do - begin - case fLine[Run] of - '[': begin - while True do - begin - inc(Run); - case fLine[Run] of - ']': - begin - Inc(Run); - Exit; - end; - #0, #10, #13: - begin - fRange := rsDocTypeSquareBraces; - Exit; - end; - end; - end; - end; - '>': begin - fRange := rsAttribute; - Inc(Run); - Break; - end; - end; - inc(Run); - end; - end; - rsDocTypeSquareBraces: - begin - while not IsLineEnd(Run) do - begin - if (fLine[Run] = ']') then - begin - fRange := rsDocType; - Inc(Run); - Exit; - end; - inc(Run); - end; - end; - end; -end; - -procedure TSynXMLSyn.CDATAProc; -begin - fTokenID := tkCDATA; - if IsLineEnd(Run) then - begin - NextProcedure; - Exit; - end; - - while not IsLineEnd(Run) do - begin - if (fLine[Run] = '>') and (fLine[Run - 1] = ']') - then - begin - fRange := rsText; - Inc(Run); - break; - end; - Inc(Run); - end; -end; - -procedure TSynXMLSyn.ElementProc; -begin - if fLine[Run] = '/' then Inc(Run); - while IsNameChar do Inc(Run); - fRange := rsAttribute; - fTokenID := tkElement; -end; - -procedure TSynXMLSyn.AttributeProc; -begin - //Check if we are starting on a closing quote - if CharInSet(fLine[Run], [#34, #39]) then - begin - fTokenID := tkSymbol; - fRange := rsAttribute; - Inc(Run); - Exit; - end; - //Read the name - while IsNameChar do Inc(Run); - //Check if this is an xmlns: attribute - if (Pos('xmlns', GetToken) > 0) then - begin - fTokenID := tknsAttribute; - fRange := rsnsEqual; - end - else - begin - fTokenID := tkAttribute; - fRange := rsEqual; - end; -end; - -procedure TSynXMLSyn.EqualProc; -begin - if fRange = rsnsEqual then - fTokenID := tknsEqual - else - fTokenID := tkEqual; - - while not IsLineEnd(Run) do - begin - if (fLine[Run] = '/') then - begin - fTokenID := tkSymbol; - fRange := rsElement; - Inc(Run); - Exit; - end - else if (fLine[Run] = #34) then - begin - if fRange = rsnsEqual then - fRange := rsnsQuoteAttrValue - else - fRange := rsQuoteAttrValue; - Inc(Run); - Exit; - end - else if (fLine[Run] = #39) then - begin - if fRange = rsnsEqual then - fRange := rsnsAPosAttrValue - else - fRange := rsAPosAttrValue; - Inc(Run); - Exit; - end; - Inc(Run); - end; -end; - -procedure TSynXMLSyn.QAttributeValueProc; -begin - if fRange = rsnsQuoteAttrValue then - fTokenID := tknsQuoteAttrValue - else - fTokenID := tkQuoteAttrValue; - - while not (IsLineEnd(Run) or (fLine[Run] = '&') or (fLine[Run] = #34)) do - Inc(Run); - - if fLine[Run] = '&' then - begin - if fRange = rsnsQuoteAttrValue then - fRange := rsnsQuoteEntityRef - else - fRange := rsQuoteEntityRef; - Exit; - end - else if fLine[Run] <> #34 then - Exit; - - fRange := rsAttribute; -end; - -procedure TSynXMLSyn.AAttributeValueProc; -begin - if fRange = rsnsAPosAttrValue then - fTokenID := tknsAPosAttrValue - else - fTokenID := tkAPosAttrValue; - - while not (IsLineEnd(Run) or (fLine[Run] = '&') or (fLine[Run] = #39)) do - Inc(Run); - - if fLine[Run] = '&' then - begin - if fRange = rsnsAPosAttrValue then - fRange := rsnsAPosEntityRef - else - fRange := rsAPosEntityRef; - Exit; - end - else if fLine[Run] <> #39 then - Exit; - - fRange := rsAttribute; -end; - -procedure TSynXMLSyn.TextProc; -begin - if (fLine[Run] <= #31) or (fLine[Run] = '<') then - begin - NextProcedure; - exit; - end; - - fTokenID := tkText; - while not ((fLine[Run] <= #31) or (fLine[Run] = '<') or (fLine[Run] = '&')) do - Inc(Run); - - if (fLine[Run] = '&') then - begin - fRange := rsEntityRef; - Exit; - end; -end; - -procedure TSynXMLSyn.EntityRefProc; -begin - fTokenID := tkEntityRef; - fRange := rsEntityRef; - while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); - if (fLine[Run] = ';') then Inc(Run); - fRange := rsText; -end; - -procedure TSynXMLSyn.QEntityRefProc; -begin - if fRange = rsnsQuoteEntityRef then - fTokenID := tknsQuoteEntityRef - else - fTokenID := tkQuoteEntityRef; - - while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); - if (fLine[Run] = ';') then Inc(Run); - - if fRange = rsnsQuoteEntityRef then - fRange := rsnsQuoteAttrValue - else - fRange := rsQuoteAttrValue; -end; - -procedure TSynXMLSyn.AEntityRefProc; -begin - if fRange = rsnsAPosEntityRef then - fTokenID := tknsAPosEntityRef - else - fTokenID := tkAPosEntityRef; - - while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); - if (fLine[Run] = ';') then Inc(Run); - - if fRange = rsnsAPosEntityRef then - fRange := rsnsAPosAttrValue - else - fRange := rsAPosAttrValue; -end; - -procedure TSynXMLSyn.IdentProc; -begin - case fRange of - rsElement: - begin - ElementProc; - end; - rsAttribute: - begin - AttributeProc; - end; - rsEqual, rsnsEqual: - begin - EqualProc; - end; - rsQuoteAttrValue, rsnsQuoteAttrValue: - begin - QAttributeValueProc; - end; - rsAposAttrValue, rsnsAPosAttrValue: - begin - AAttributeValueProc; - end; - rsQuoteEntityRef, rsnsQuoteEntityRef: - begin - QEntityRefProc; - end; - rsAposEntityRef, rsnsAPosEntityRef: - begin - AEntityRefProc; - end; - rsEntityRef: - begin - EntityRefProc; - end; - else ; - end; -end; - -procedure TSynXMLSyn.Next; -begin - fTokenPos := Run; - case fRange of - rsText: TextProc; - rsComment: CommentProc; - rsProcessingInstruction: ProcessingInstructionProc; - rsDocType, rsDocTypeSquareBraces: DocTypeProc; - rsCDATA: CDATAProc; - else NextProcedure; - end; - // ensure that one call of Next is enough to reach next token - if (fOldRun = Run) and not GetEol then Next; - inherited; -end; - -procedure TSynXMLSyn.NextProcedure; -begin - case fLine[Run] of - #0: NullProc; - #10: LineFeedProc; - #13: CarriageReturnProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - '<': LessThanProc; - '>': GreaterThanProc; - else IdentProc; - end; -end; - -function TSynXMLSyn.NextTokenIs(Token: string): Boolean; -var - I, Len: Integer; -begin - Result := True; - Len := Length(Token); - for I := 1 to Len do - if (fLine[Run + I] <> Token[I]) then - begin - Result:= False; - Break; - end; -end; - -function TSynXMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_COMMENT: Result := fCommentAttri; - SYN_ATTR_IDENTIFIER: Result := fAttributeAttri; - SYN_ATTR_KEYWORD: Result := fElementAttri; - SYN_ATTR_WHITESPACE: Result := fSpaceAttri; - SYN_ATTR_SYMBOL: Result := fSymbolAttri; - else - Result := nil; - end; -end; - -function TSynXMLSyn.GetEol: Boolean; -begin - Result := Run = fLineLen + 1; -end; - -function TSynXMLSyn.GetTokenID: TtkTokenKind; -begin - Result := fTokenId; -end; - -function TSynXMLSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case fTokenID of - tkElement: Result:= fElementAttri; - tkAttribute: Result:= fAttributeAttri; - tknsAttribute: Result:= fnsAttributeAttri; - tkEqual: Result:= fSymbolAttri; - tknsEqual: Result:= fSymbolAttri; - tkQuoteAttrValue: Result:= fAttributeValueAttri; - tkAPosAttrValue: Result:= fAttributeValueAttri; - tknsQuoteAttrValue: Result:= fnsAttributeValueAttri; - tknsAPosAttrValue: Result:= fnsAttributeValueAttri; - tkText: Result:= fTextAttri; - tkCDATA: Result:= fCDATAAttri; - tkEntityRef: Result:= fEntityRefAttri; - tkQuoteEntityRef: Result:= fEntityRefAttri; - tkAposEntityRef: Result:= fEntityRefAttri; - tknsQuoteEntityRef: Result:= fEntityRefAttri; - tknsAposEntityRef: Result:= fEntityRefAttri; - tkProcessingInstruction: Result:= fProcessingInstructionAttri; - tkComment: Result:= fCommentAttri; - tkDocType: Result:= fDocTypeAttri; - tkSymbol: Result:= fSymbolAttri; - tkSpace: Result:= fSpaceAttri; - else - Result := nil; - end; -end; - -function TSynXMLSyn.GetTokenKind: integer; -begin - Result := Ord(fTokenId); -end; - -function TSynXMLSyn.GetRange: Pointer; -begin - Result := Pointer(fRange); -end; - -procedure TSynXMLSyn.SetRange(Value: Pointer); -begin - fRange := TRangeState(Value); -end; - -procedure TSynXMLSyn.ResetRange; -begin - fRange := rsText; -end; - -function TSynXMLSyn.IsFilterStored: Boolean; -begin - Result := fDefaultFilter <> SYNS_FilterXML; -end; - -{ TODO: In fact every Number also non-arabics and every letter also German umlauts - can be used. Something like IsAlphaNumericCharW should be used instead. } -function TSynXMLSyn.IsNameChar: Boolean; -begin - case fLine[Run] of - '0'..'9', 'a'..'z', 'A'..'Z', '_', '.', ':', '-': - Result := True; - else if fLine[Run] > 'À' then // TODO: this here is very vague, see above - Result := True - else - Result := False; - end; -end; - -class function TSynXMLSyn.GetLanguageName: string; -begin - Result := SYNS_LangXML; -end; - -function TSynXMLSyn.GetSampleSource: string; -begin - Result:= ''#13#10+ - ''#13#10+ - ''#13#10+ - ''#13#10+ - ' '#13#10+ - ''; -end; - -class function TSynXMLSyn.GetFriendlyLanguageName: string; -begin - Result := SYNS_FriendlyLangXML; -end; - -initialization - RegisterPlaceableHighlighter(TSynXMLSyn); -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynHighlighterXML.pas, released 2000-11-20. +The Initial Author of this file is Jeff Rafter. +Unicode translation by Maël Hörz. +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: SynHighlighterXML.pas,v 1.11.2.6 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +History: +------------------------------------------------------------------------------- +2000-11-30 Removed mHashTable and MakeIdentTable per Michael Hieke + +Known Issues: +- Nothing is really constrained (properly) to valid name chars +- Entity Refs are not constrained to valid name chars +- Support for "Combining Chars and Extender Chars" in names are lacking +- The internal DTD is not parsed (and not handled correctly) +-------------------------------------------------------------------------------} +{ +@abstract(Provides an XML highlighter for SynEdit) +@author(Jeff Rafter-- Phil 4:13, based on SynHighlighterHTML by Hideo Koiso) +@created(2000-11-17) +@lastmod(2001-03-12) +The SynHighlighterXML unit provides SynEdit with an XML highlighter. +} + +unit SynHighlighterXML; + +interface + +{$I SynEdit.inc} + +uses + Windows, Messages, Controls, Graphics, Registry, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, +{$IFDEF SYN_CodeFolding} + SynEditCodeFolding, +{$ENDIF} + Classes; + +type + TtkTokenKind = (tkAposAttrValue, tkAposEntityRef, tkAttribute, tkCDATA, + tkComment, tkElement, tkEntityRef, tkEqual, tkNull, tkProcessingInstruction, + tkQuoteAttrValue, tkQuoteEntityRef, tkSpace, tkSymbol, tkText, + // + tknsAposAttrValue, tknsAposEntityRef, tknsAttribute, tknsEqual, + tknsQuoteAttrValue, tknsQuoteEntityRef, + //These are unused at the moment + tkDocType + {tkDocTypeAposAttrValue, tkDocTypeAposEntityRef, tkDocTypeAttribute, + tkDocTypeElement, tkDocTypeEqual tkDocTypeQuoteAttrValue, + tkDocTypeQuoteEntityRef} + ); + + TRangeState = (rsAposAttrValue, rsAPosEntityRef, rsAttribute, rsCDATA, + rsComment, rsElement, rsEntityRef, rsEqual, rsProcessingInstruction, + rsQuoteAttrValue, rsQuoteEntityRef, rsText, + // + rsnsAposAttrValue, rsnsAPosEntityRef, rsnsEqual, rsnsQuoteAttrValue, + rsnsQuoteEntityRef, + //These are unused at the moment + rsDocType, rsDocTypeSquareBraces + {rsDocTypeAposAttrValue, rsDocTypeAposEntityRef, rsDocTypeAttribute, + rsDocTypeElement, rsDocTypeEqual, rsDocTypeQuoteAttrValue, + rsDocTypeQuoteEntityRef} + ); + +{$IFDEF SYN_CodeFolding} + TSynXMLSyn = class(TSynCustomCodeFoldingHighlighter) +{$ELSE} + TSynXMLSyn = class(TSynCustomHighlighter) +{$ENDIF} + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FElementAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FTextAttri: TSynHighlighterAttributes; + FEntityRefAttri: TSynHighlighterAttributes; + FProcessingInstructionAttri: TSynHighlighterAttributes; + FCDATAAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FDocTypeAttri: TSynHighlighterAttributes; + FAttributeAttri: TSynHighlighterAttributes; + FnsAttributeAttri: TSynHighlighterAttributes; + FAttributeValueAttri: TSynHighlighterAttributes; + FnsAttributeValueAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FWantBracesParsed: Boolean; + procedure NullProc; + procedure CarriageReturnProc; + procedure LineFeedProc; + procedure SpaceProc; + procedure LessThanProc; + procedure GreaterThanProc; + procedure CommentProc; + procedure ProcessingInstructionProc; + procedure DocTypeProc; + procedure CDATAProc; + procedure TextProc; + procedure ElementProc; + procedure AttributeProc; + procedure QAttributeValueProc; + procedure AAttributeValueProc; + procedure EqualProc; + procedure IdentProc; + procedure NextProcedure; + function NextTokenIs(Token: UnicodeString): Boolean; + procedure EntityRefProc; + procedure QEntityRefProc; + procedure AEntityRefProc; + protected + function GetSampleSource: UnicodeString; override; + function IsFilterStored: Boolean; override; + function IsNameChar: Boolean; virtual; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; +{$IFDEF SYN_CodeFolding} + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +{$ENDIF} + published + property ElementAttri: TSynHighlighterAttributes read FElementAttri + write FElementAttri; + property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri + write FAttributeAttri; + property NamespaceAttributeAttri: TSynHighlighterAttributes + read FnsAttributeAttri write FnsAttributeAttri; + property AttributeValueAttri: TSynHighlighterAttributes + read FAttributeValueAttri write FAttributeValueAttri; + property NamespaceAttributeValueAttri: TSynHighlighterAttributes + read FnsAttributeValueAttri write FnsAttributeValueAttri; + property TextAttri: TSynHighlighterAttributes read FTextAttri + write FTextAttri; + property CDATAAttri: TSynHighlighterAttributes read FCDATAAttri + write FCDATAAttri; + property EntityRefAttri: TSynHighlighterAttributes read FEntityRefAttri + write FEntityRefAttri; + property ProcessingInstructionAttri: TSynHighlighterAttributes + read FProcessingInstructionAttri write FProcessingInstructionAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property DocTypeAttri: TSynHighlighterAttributes read FDocTypeAttri + write FDocTypeAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property WantBracesParsed : Boolean read FWantBracesParsed + write FWantBracesParsed default True; + end; + +implementation + +uses + SynEditStrConst; + +constructor TSynXMLSyn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCaseSensitive := True; + + FElementAttri := TSynHighlighterAttributes.Create(SYNS_AttrElementName, SYNS_FriendlyAttrElementName); + FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrWhitespace, SYNS_FriendlyAttrWhitespace); + FEntityRefAttri := TSynHighlighterAttributes.Create(SYNS_AttrEntityReference, SYNS_FriendlyAttrEntityReference); + FProcessingInstructionAttri := TSynHighlighterAttributes.Create( + SYNS_AttrProcessingInstr, SYNS_FriendlyAttrProcessingInstr); + FCDATAAttri := TSynHighlighterAttributes.Create(SYNS_AttrCDATASection, SYNS_FriendlyAttrCDATASection); + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FDocTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDOCTYPESection, SYNS_FriendlyAttrDOCTYPESection); + FAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttributeName, SYNS_FriendlyAttrAttributeName); + FnsAttributeAttri := TSynHighlighterAttributes.Create( + SYNS_AttrNamespaceAttrName, SYNS_FriendlyAttrNamespaceAttrName); + FAttributeValueAttri := TSynHighlighterAttributes.Create( + SYNS_AttrAttributeValue, SYNS_FriendlyAttrAttributeValue); + FnsAttributeValueAttri := TSynHighlighterAttributes.Create( + SYNS_AttrNamespaceAttrValue, SYNS_FriendlyAttrNamespaceAttrValue); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + + FElementAttri.Foreground := clMaroon; + FElementAttri.Style := [fsBold]; + + FDocTypeAttri.Foreground := clblue; + FDocTypeAttri.Style := [fsItalic]; + + FCDATAAttri.Foreground := clOlive; + FCDATAAttri.Style := [fsItalic]; + + FEntityRefAttri.Foreground := clblue; + FEntityRefAttri.Style := [fsbold]; + + FProcessingInstructionAttri.Foreground:= clblue; + FProcessingInstructionAttri.Style:= []; + + FTextAttri.Foreground := clBlack; + FTextAttri.Style := [fsBold]; + + FAttributeAttri.Foreground := clMaroon; + FAttributeAttri.Style := []; + + FnsAttributeAttri.Foreground := clRed; + FnsAttributeAttri.Style := []; + + FAttributeValueAttri.Foreground := clNavy; + FAttributeValueAttri.Style := [fsBold]; + + FnsAttributeValueAttri.Foreground := clRed; + FnsAttributeValueAttri.Style := [fsBold]; + + FCommentAttri.Background := clSilver; + FCommentAttri.Foreground := clGray; + FCommentAttri.Style := [fsbold, fsItalic]; + + FSymbolAttri.Foreground := clblue; + FSymbolAttri.Style := []; + + AddAttribute(FSymbolAttri); + AddAttribute(FProcessingInstructionAttri); + AddAttribute(FDocTypeAttri); + AddAttribute(FCommentAttri); + AddAttribute(FElementAttri); + AddAttribute(FAttributeAttri); + AddAttribute(FnsAttributeAttri); + AddAttribute(FAttributeValueAttri); + AddAttribute(FnsAttributeValueAttri); + AddAttribute(FEntityRefAttri); + AddAttribute(FCDATAAttri); + AddAttribute(FSpaceAttri); + AddAttribute(FTextAttri); + + SetAttributesOnChange(DefHighlightChange); + + FRange := rsText; + FDefaultFilter := SYNS_FilterXML; +end; + +procedure TSynXMLSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynXMLSyn.CarriageReturnProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynXMLSyn.LineFeedProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynXMLSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while FLine[Run] <= #32 do + begin + if CharInSet(FLine[Run], [#0, #9, #10, #13]) then Break; + Inc(Run); + end; +end; + +procedure TSynXMLSyn.LessThanProc; +begin + Inc(Run); + if (FLine[Run] = '/') then + Inc(Run); + + if (FLine[Run] = '!') then + begin + if NextTokenIs('--') then + begin + FTokenID := tkSymbol; + FRange := rsComment; + Inc(Run, 3); + end + else if NextTokenIs('DOCTYPE') then + begin + FTokenID := tkDocType; + FRange := rsDocType; + Inc(Run, 7); + end + else if NextTokenIs('[CDATA[') then + begin + FTokenID := tkCDATA; + FRange := rsCDATA; + Inc(Run, 7); + end + else + begin + FTokenID := tkSymbol; + FRange := rsElement; + Inc(Run); + end; + end + else if FLine[Run]= '?' then + begin + FTokenID := tkProcessingInstruction; + FRange := rsProcessingInstruction; + Inc(Run); + end + else + begin + FTokenID := tkSymbol; + FRange := rsElement; + end; +end; + +procedure TSynXMLSyn.GreaterThanProc; +begin + FTokenID := tkSymbol; + FRange:= rsText; + Inc(Run); +end; + +procedure TSynXMLSyn.CommentProc; +begin + if (FLine[Run] = '-') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '>') then + begin + FTokenID := tkSymbol; + FRange := rsText; + Inc(Run, 3); + Exit; + end; + + FTokenID := tkComment; + + if IsLineEnd(Run) then + begin + NextProcedure; + Exit; + end; + + while not IsLineEnd(Run) do + begin + if (FLine[Run] = '-') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '>') then + begin + FRange := rsComment; + Break; + end; + Inc(Run); + end; +end; + +procedure TSynXMLSyn.ProcessingInstructionProc; +begin + FTokenID := tkProcessingInstruction; + if IsLineEnd(Run) then + begin + NextProcedure; + Exit; + end; + + while not IsLineEnd(Run) do + begin + if (FLine[Run] = '>') and (FLine[Run - 1] = '?') + then + begin + FRange := rsText; + Inc(Run); + Break; + end; + Inc(Run); + end; +end; + +procedure TSynXMLSyn.DocTypeProc; +begin + FTokenID := tkDocType; + + if IsLineEnd(Run) then + begin + NextProcedure; + Exit; + end; + + case FRange of + rsDocType: + begin + while not IsLineEnd(Run) do + begin + case FLine[Run] of + '[': begin + while True do + begin + Inc(Run); + case FLine[Run] of + ']': + begin + Inc(Run); + Exit; + end; + #0, #10, #13: + begin + FRange := rsDocTypeSquareBraces; + Exit; + end; + end; + end; + end; + '>': begin + FRange := rsAttribute; + Inc(Run); + Break; + end; + end; + Inc(Run); + end; + end; + rsDocTypeSquareBraces: + begin + while not IsLineEnd(Run) do + begin + if (FLine[Run] = ']') then + begin + FRange := rsDocType; + Inc(Run); + Exit; + end; + Inc(Run); + end; + end; + end; +end; + +procedure TSynXMLSyn.CDATAProc; +begin + FTokenID := tkCDATA; + if IsLineEnd(Run) then + begin + NextProcedure; + Exit; + end; + + while not IsLineEnd(Run) do + begin + if (FLine[Run] = '>') and (FLine[Run - 1] = ']') + then + begin + FRange := rsText; + Inc(Run); + Break; + end; + Inc(Run); + end; +end; + +procedure TSynXMLSyn.ElementProc; +begin + if FLine[Run] = '/' then Inc(Run); + while IsNameChar do Inc(Run); + FRange := rsAttribute; + FTokenID := tkElement; +end; + +procedure TSynXMLSyn.AttributeProc; +begin + //Check if we are starting on a closing quote + if CharInSet(FLine[Run], [#34, #39]) then + begin + FTokenID := tkSymbol; + FRange := rsAttribute; + Inc(Run); + Exit; + end; + //Read the name + while IsNameChar do Inc(Run); + //Check if this is an xmlns: attribute + if (Pos('xmlns', GetToken) > 0) then + begin + FTokenID := tknsAttribute; + FRange := rsnsEqual; + end + else + begin + FTokenID := tkAttribute; + FRange := rsEqual; + end; +end; + +procedure TSynXMLSyn.EqualProc; +begin + if FRange = rsnsEqual then + FTokenID := tknsEqual + else + FTokenID := tkEqual; + + while not IsLineEnd(Run) do + begin + if (FLine[Run] = '/') then + begin + FTokenID := tkSymbol; + FRange := rsElement; + Inc(Run); + Exit; + end + else if (FLine[Run] = #34) then + begin + if FRange = rsnsEqual then + FRange := rsnsQuoteAttrValue + else + FRange := rsQuoteAttrValue; + Inc(Run); + Exit; + end + else if (FLine[Run] = #39) then + begin + if FRange = rsnsEqual then + FRange := rsnsAPosAttrValue + else + FRange := rsAPosAttrValue; + Inc(Run); + Exit; + end; + Inc(Run); + end; +end; + +procedure TSynXMLSyn.QAttributeValueProc; +begin + if FRange = rsnsQuoteAttrValue then + FTokenID := tknsQuoteAttrValue + else + FTokenID := tkQuoteAttrValue; + + while not (IsLineEnd(Run) or (FLine[Run] = '&') or (FLine[Run] = #34)) do + Inc(Run); + + if FLine[Run] = '&' then + begin + if FRange = rsnsQuoteAttrValue then + FRange := rsnsQuoteEntityRef + else + FRange := rsQuoteEntityRef; + Exit; + end + else if FLine[Run] <> #34 then + Exit; + + FRange := rsAttribute; +end; + +procedure TSynXMLSyn.AAttributeValueProc; +begin + if FRange = rsnsAPosAttrValue then + FTokenID := tknsAPosAttrValue + else + FTokenID := tkAPosAttrValue; + + while not (IsLineEnd(Run) or (FLine[Run] = '&') or (FLine[Run] = #39)) do + Inc(Run); + + if FLine[Run] = '&' then + begin + if FRange = rsnsAPosAttrValue then + FRange := rsnsAPosEntityRef + else + FRange := rsAPosEntityRef; + Exit; + end + else if FLine[Run] <> #39 then + Exit; + + FRange := rsAttribute; +end; + +procedure TSynXMLSyn.TextProc; +begin + if (FLine[Run] <= #31) or (FLine[Run] = '<') then + begin + NextProcedure; + Exit; + end; + + FTokenID := tkText; + while not ((FLine[Run] <= #31) or (FLine[Run] = '<') or (FLine[Run] = '&')) do + Inc(Run); + + if (FLine[Run] = '&') then + begin + FRange := rsEntityRef; + Exit; + end; +end; + +procedure TSynXMLSyn.EntityRefProc; +begin + FTokenID := tkEntityRef; + FRange := rsEntityRef; + while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); + if (FLine[Run] = ';') then Inc(Run); + FRange := rsText; +end; + +procedure TSynXMLSyn.QEntityRefProc; +begin + if FRange = rsnsQuoteEntityRef then + FTokenID := tknsQuoteEntityRef + else + FTokenID := tkQuoteEntityRef; + + while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); + if (FLine[Run] = ';') then Inc(Run); + + if FRange = rsnsQuoteEntityRef then + FRange := rsnsQuoteAttrValue + else + FRange := rsQuoteAttrValue; +end; + +procedure TSynXMLSyn.AEntityRefProc; +begin + if FRange = rsnsAPosEntityRef then + FTokenID := tknsAPosEntityRef + else + FTokenID := tkAPosEntityRef; + + while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); + if (FLine[Run] = ';') then Inc(Run); + + if FRange = rsnsAPosEntityRef then + FRange := rsnsAPosAttrValue + else + FRange := rsAPosAttrValue; +end; + +procedure TSynXMLSyn.IdentProc; +begin + case FRange of + rsElement: + begin + ElementProc; + end; + rsAttribute: + begin + AttributeProc; + end; + rsEqual, rsnsEqual: + begin + EqualProc; + end; + rsQuoteAttrValue, rsnsQuoteAttrValue: + begin + QAttributeValueProc; + end; + rsAposAttrValue, rsnsAPosAttrValue: + begin + AAttributeValueProc; + end; + rsQuoteEntityRef, rsnsQuoteEntityRef: + begin + QEntityRefProc; + end; + rsAposEntityRef, rsnsAPosEntityRef: + begin + AEntityRefProc; + end; + rsEntityRef: + begin + EntityRefProc; + end; + else ; + end; +end; + +procedure TSynXMLSyn.Next; +begin + FTokenPos := Run; + case FRange of + rsText: TextProc; + rsComment: CommentProc; + rsProcessingInstruction: ProcessingInstructionProc; + rsDocType, rsDocTypeSquareBraces: DocTypeProc; + rsCDATA: CDATAProc; + else NextProcedure; + end; + // ensure that one call of Next is enough to reach next token + if (fOldRun = Run) and not GetEol then Next; + inherited; +end; + +procedure TSynXMLSyn.NextProcedure; +begin + case FLine[Run] of + #0: NullProc; + #10: LineFeedProc; + #13: CarriageReturnProc; + #1..#9, #11, #12, #14..#32: SpaceProc; + '<': LessThanProc; + '>': GreaterThanProc; + else IdentProc; + end; +end; + +function TSynXMLSyn.NextTokenIs(Token: UnicodeString): Boolean; +var + I, Len: Integer; +begin + Result := True; + Len := Length(Token); + for I := 1 to Len do + if (FLine[Run + I] <> Token[I]) then + begin + Result:= False; + Break; + end; +end; + +function TSynXMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_IDENTIFIER: Result := FAttributeAttri; + SYN_ATTR_KEYWORD: Result := FElementAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynXMLSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +function TSynXMLSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynXMLSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkElement: Result:= FElementAttri; + tkAttribute: Result:= FAttributeAttri; + tknsAttribute: Result:= FnsAttributeAttri; + tkEqual: Result:= FSymbolAttri; + tknsEqual: Result:= FSymbolAttri; + tkQuoteAttrValue: Result:= FAttributeValueAttri; + tkAPosAttrValue: Result:= FAttributeValueAttri; + tknsQuoteAttrValue: Result:= FnsAttributeValueAttri; + tknsAPosAttrValue: Result:= FnsAttributeValueAttri; + tkText: Result:= FTextAttri; + tkCDATA: Result:= FCDATAAttri; + tkEntityRef: Result:= FEntityRefAttri; + tkQuoteEntityRef: Result:= FEntityRefAttri; + tkAposEntityRef: Result:= FEntityRefAttri; + tknsQuoteEntityRef: Result:= FEntityRefAttri; + tknsAposEntityRef: Result:= FEntityRefAttri; + tkProcessingInstruction: Result:= FProcessingInstructionAttri; + tkComment: Result:= FCommentAttri; + tkDocType: Result:= FDocTypeAttri; + tkSymbol: Result:= FSymbolAttri; + tkSpace: Result:= FSpaceAttri; + else + Result := nil; + end; +end; + +function TSynXMLSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +function TSynXMLSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +procedure TSynXMLSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynXMLSyn.ResetRange; +begin + FRange := rsText; +end; + +{$IFDEF SYN_CodeFolding} +procedure TSynXMLSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + Line: Integer; + CurLine: string; + RunPos: Integer; + IsClosing: Boolean; + IndentLevel, CurLevel: Integer; +begin + IndentLevel := 0; + for Line := FromLine to ToLine do + begin + CurLine := LinesToScan[Line]; + RunPos := 1; + + // skip empty lines + if CurLine = '' then + begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + CurLevel := 0; + while RunPos <= Length(CurLine) do + begin + // scan for open tag + if CurLine[RunPos] = '<' then + begin + Inc(RunPos); + if RunPos = Length(CurLine) then + break; + + // get tag type (prolog, closing or malformed + case CurLine[RunPos] of + '?' : + begin + // skip to end and continue + Inc(RunPos); + while RunPos <= Length(CurLine) do + begin + if CurLine[RunPos] = '?' then + begin + break; + end; + Inc(RunPos); + end; + Continue; + end; + + '/' : + begin + Inc(RunPos); + if RunPos = Length(CurLine) then + break; + IsClosing := True; + end; + '>' : + begin + // malformed tag (without any tag name) -> skip + Inc(RunPos); + continue; + end; + else + IsClosing := False; + end; + + // scan for tag end-marker + while RunPos <= Length(CurLine) do + begin + + if CurLine[RunPos] = '>' then + begin + // decrease the current level if it's a closing tag + if IsClosing then + Dec(CurLevel) + else + // eventually increase the current level if it's not an empty tag + if not (CurLine[RunPos - 1] = '/') then + Inc(CurLevel); + + Inc(RunPos); + break; + end; + + Inc(RunPos); + end; + end; + Inc(RunPos); + end; + + // check whether the current level has changed, otherwise continue + if (CurLevel = 0) then + begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // the level has changed, but in what direction? + if CurLevel > 0 then + begin + // start a new fold range for the next indent level + IndentLevel := IndentLevel + CurLevel; + FoldRanges.StartFoldRange(Line + 1, 1, IndentLevel); + end + else + begin + // stop the fold range for the current indent level and decrease + FoldRanges.StopFoldRange(Line + 1, 1, IndentLevel); + IndentLevel := IndentLevel + CurLevel; + end; + end; //for Line +end; +{$ENDIF} + +function TSynXMLSyn.IsFilterStored: Boolean; +begin + Result := FDefaultFilter <> SYNS_FilterXML; +end; + +{ TODO: In fact every Number also non-arabics and every letter also German umlauts + can be used. Something like IsAlphaNumericCharW should be used instead. } +function TSynXMLSyn.IsNameChar: Boolean; +begin + case FLine[Run] of + '0'..'9', 'a'..'z', 'A'..'Z', '_', '.', ':', '-': + Result := True; + else if FLine[Run] > 'À' then // TODO: this here is very vague, see above + Result := True + else + Result := False; + end; +end; + +class function TSynXMLSyn.GetLanguageName: string; +begin + Result := SYNS_LangXML; +end; + +function TSynXMLSyn.GetSampleSource: UnicodeString; +begin + Result := + ''#13#10+ + ''#13#10+ + ''#13#10+ + ''#13#10+ + ' '#13#10+ + ''; +end; + +class function TSynXMLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangXML; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynXMLSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynHighlighterZPL.pas b/Source/VCL/SynEdit/Source/SynHighlighterZPL.pas new file mode 100644 index 00000000..80cc0aee --- /dev/null +++ b/Source/VCL/SynEdit/Source/SynHighlighterZPL.pas @@ -0,0 +1,322 @@ +{------------------------------------------------------------------------------- +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. + +The original code is: C:\radw3\dpr\bin\SynHighlighterZPL.pas, released 2020-05-03. +Description: Syntax Parser/Highlighter +The initial author of this file is chtilux. +Copyright (c) 2020, 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 + +-------------------------------------------------------------------------------} + +unit SynHighlighterZPL; + +{$I SynEdit.inc} + +interface + +uses + Graphics, + SynEditTypes, + SynEditHighlighter, + SynUnicode, + SysUtils, + Classes; + +type + TtkTokenKind = (tkNull, tkKey, tkText, tkComment, tkNumber); + + TSynZPLSyn = class(TSynCustomHighlighter) + private + FTokenID: TtkTokenKind; + FKeyAttri: TSynHighlighterAttributes; + FTextAttri: TSynHighlighterAttributes; + FCommentAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FFieldDataAttri: TSynHighlighterAttributes; + pvFieldData: Boolean; + pvGraphic: Boolean; + FCommentScript: boolean; + + procedure NullProc; + procedure KeyProc; + procedure TextProc; + procedure SlashProc; + procedure NumberProc; + procedure SetCommentScript(const Value: boolean); + protected + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; + function GetSampleSource: UnicodeString; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: UnicodeString; override; + public + constructor Create(AOwner: TComponent); override; + function GetEol: Boolean; override; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + procedure Next; override; + published + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property TextAttri: TSynHighlighterAttributes read FTextAttri write FTextAttri; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; + property FieldDataAttri: TSynHighlighterAttributes read FFieldDataAttri write FFieldDataAttri; + (* // is not a ZPL comment, but in my needs yes (for scripting), so set + commentScript to False to disable // comments *) + property CommentScript: boolean read FCommentScript write SetCommentScript default True; + end; + +implementation + +uses + SynEditStrConst; + +resourcestring + SYNS_FilterZPL = '*.zpl;*.zplx'; + SYNS_LangZPL = 'ZPL'; + SYNS_FriendlyLangZPL = 'ZPL'; + +{ TMyHighlighter } + +constructor TSynZPLSyn.Create(AOwner: TComponent); +begin + inherited; + pvFieldData := False; + pvGraphic := False; + FCommentScript := True; + + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + FKeyAttri.Foreground := clMaroon; + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + + FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + AddAttribute(FTextAttri); + + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Foreground := clGreen; + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + FNumberAttri.Foreground := clNavy; + AddAttribute(FNumberAttri); + + FFieldDataAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + FFieldDataAttri.Foreground := clNavy; + FFieldDataAttri.Style := [fsBold]; + AddAttribute(FFieldDataAttri); + + SetAttributesOnChange(DefHighlightChange); + + FDefaultFilter := SYNS_FilterZPL; +end; + +function TSynZPLSyn.GetDefaultAttribute( + Index: Integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_KEYWORD: Result := FKeyAttri; + SYN_ATTR_COMMENT: Result := FCommentAttri; + else + Result := nil; + end; +end; + +function TSynZPLSyn.GetEol: Boolean; +begin + Result := Run = FLineLen + 1; +end; + +class function TSynZPLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangZPL; +end; + +class function TSynZPLSyn.GetLanguageName: string; +begin + Result := SYNS_LangZPL; +end; + +function TSynZPLSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkKey: Result := FKeyAttri; + tkText: begin + if not pvFieldData then + Result := FTextAttri + else + Result := FFieldDataAttri; + end; + tkComment: Result := FCommentAttri; + tkNumber: begin + if not pvGraphic then + Result := FNumberAttri + else + Result := FTextAttri; + end; + else + Result := nil; + end; +end; + +function TSynZPLSyn.GetTokenKind: Integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynZPLSyn.KeyProc; +var + lcComment: boolean; +begin + pvFieldData := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '^') and (UpCase(FLine[Run+1]) = 'F') and (UpCase(FLine[Run+2]) = 'D'); + pvGraphic := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '~') and (UpCase(FLine[Run+1]) = 'D') and (UpCase(FLine[Run+2]) = 'G'); + lcComment := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '^') and (UpCase(FLine[Run+1]) = 'F') and (UpCase(FLine[Run+2]) = 'X'); + if not lcComment then + begin + FTokenID := tkKey; + if Run < Length(FLineStr)-2 then + Inc(Run,3) + else + Inc(Run); + end + else + begin + FTokenID := tkComment; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + #10, #13: + Break; + else + Inc(Run); + end; + end; +end; + +procedure TSynZPLSyn.Next; +begin + case FLine[Run] of + #0: NullProc; + '^': KeyProc; + '~': KeyProc; + '/': SlashProc; + '0'..'9': NumberProc; + else + TextProc; + end; + inherited; +end; + +procedure TSynZPLSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynZPLSyn.NumberProc; + function IsNumberChar: Boolean; + begin + case fLine[Run] of + '0'..'9', '.', 'e', 'E': + Result := True; + else + Result := False; + end; + end; +begin + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do Inc(Run); +end; + +procedure TSynZPLSyn.SetCommentScript(const Value: boolean); +begin + FCommentScript := Value; +end; + +procedure TSynZPLSyn.SlashProc; +begin + // if it is not column 0 mark as tkText and get out of here + if (Run > 0) or not(FCommentScript) then + begin + FTokenID := tkText; + Inc(Run); + Exit; + end; + + // this is column 0 ok it is a comment + FTokenID := tkComment; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + #10, #13: + Break; + else + Inc(Run); + end; +end; + +procedure TSynZPLSyn.TextProc; + + function IsTextChar: Boolean; + begin + case fLine[Run] of + 'a'..'z', 'A'..'Z': + Result := True; + else + Result := False; + end; + end; + +begin + FTokenID := tkText; + Inc(Run); + while FLine[Run] <> #0 do + if IsTextChar then + Inc(Run) + else + Break; +end; + +function TSynZPLSyn.GetSampleSource: UnicodeString; +begin + Result := + '^XA'#13#10+ + '^LH30,6161'#13#10+ + '^FO20,10'#13#10+ + '^ADN,90,50'#13#10+ + '^FDHello^FS'#13#10+ + '^XZ'; +end; + +initialization +{$IFNDEF SYN_CPPB_1} + RegisterPlaceableHighlighter(TSynZPLSyn); +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynMacroRecorder.pas b/Source/VCL/SynEdit/Source/SynMacroRecorder.pas index ac1315d9..705d72da 100644 --- a/Source/VCL/SynEdit/Source/SynMacroRecorder.pas +++ b/Source/VCL/SynEdit/Source/SynMacroRecorder.pas @@ -1,993 +1,980 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynMacroRecorder.pas, released 2001-10-17. - -Author of this file is Flávio Etrusco. -Portions created by Flávio Etrusco are Copyright 2001 Flávio Etrusco. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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: SynMacroRecorder.pas,v 1.31.2.3 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -unit SynMacroRecorder; - -{$I SynEdit.inc} - -interface - -uses - StdCtrls, - Controls, - Windows, - Messages, - Graphics, - Menus, - SynEdit, - SynEditKeyCmds, - SynEditPlugins, - SynEditTypes, - SynUnicode, - Classes; - -resourcestring - sCannotRecord = 'Cannot record macro; already recording or playing'; - sCannotPlay = 'Cannot playback macro; already playing or recording'; - sCannotPause = 'Can only pause when recording'; - sCannotResume = 'Can only resume when paused'; - -type - TSynMacroState = (msStopped, msRecording, msPlaying, msPaused); - TSynMacroCommand = (mcRecord, mcPlayback); - - TSynMacroEvent = class(TObject) - protected - fRepeatCount: Byte; - function GetAsString: string; virtual; abstract; - procedure InitEventParameters(aStr: string); virtual; abstract; - public - constructor Create; virtual; - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - virtual; abstract; - { the CommandID must not be read inside LoadFromStream/SaveToStream. It's read by the - MacroRecorder component to decide which MacroEvent class to instanciate } - procedure LoadFromStream(aStream: TStream); virtual; abstract; - procedure SaveToStream(aStream: TStream); virtual; abstract; - procedure Playback(aEditor: TCustomSynEdit); virtual; abstract; - property AsString: string read GetAsString; - property RepeatCount: Byte read fRepeatCount write fRepeatCount; - end; - - TSynBasicEvent = class(TSynMacroEvent) - protected - fCommand: TSynEditorCommand; - function GetAsString: string; override; - procedure InitEventParameters(aStr: string); override; - public - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - override; - procedure LoadFromStream(aStream: TStream); override; - procedure SaveToStream(aStream: TStream); override; - procedure Playback(aEditor: TCustomSynEdit); override; - public - property Command: TSynEditorCommand read fCommand write fCommand; - end; - - TSynCharEvent = class(TSynMacroEvent) - protected - fKey: WideChar; - function GetAsString: string; override; - procedure InitEventParameters(aStr: string); override; - public - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - override; - procedure LoadFromStream(aStream: TStream); override; - procedure SaveToStream(aStream: TStream); override; - procedure Playback(aEditor: TCustomSynEdit); override; - public - property Key: WideChar read fKey write fKey; - end; - - TSynStringEvent = class(TSynMacroEvent) - protected - fString: string; - function GetAsString: string; override; - procedure InitEventParameters(aStr: string); override; - public - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - override; - procedure LoadFromStream(aStream: TStream); override; - procedure SaveToStream(aStream: TStream); override; - procedure Playback(aEditor: TCustomSynEdit); override; - public - property Value: string read fString write fString; - end; - - TSynPositionEvent = class(TSynBasicEvent) - protected - fPosition: TBufferCoord; - function GetAsString: string; override; - procedure InitEventParameters(aStr: string); override; - public - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - override; - procedure LoadFromStream(aStream: TStream); override; - procedure SaveToStream(aStream: TStream); override; - procedure Playback(aEditor: TCustomSynEdit); override; - public - property Position: TBufferCoord read fPosition write fPosition; - end; - - TSynDataEvent = class(TSynBasicEvent) - protected - fData: Pointer; - public - procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); - override; - procedure LoadFromStream(aStream: TStream); override; - procedure SaveToStream(aStream: TStream); override; - procedure Playback(aEditor: TCustomSynEdit); override; - end; - - TCustomSynMacroRecorder = class; - - TSynUserCommandEvent = procedure (aSender: TCustomSynMacroRecorder; - aCmd: TSynEditorCommand; var aEvent: TSynMacroEvent) of object; - - { TCustomSynMacroRecorder - OnStateChange: - occurs right after start playing, recording, pausing or stopping - SaveMarkerPos: - if true, Bookmark position is recorded in the macro. Otherwise, the Bookmark - is created in the position the Caret is at the time of playback. - } - - TCustomSynMacroRecorder = class(TAbstractSynHookerPlugin) - private - fShortCuts: array [TSynMacroCommand] of TShortCut; - fOnStateChange: TNotifyEvent; - fOnUserCommand: TSynUserCommandEvent; - fMacroName: string; - fSaveMarkerPos: boolean; - function GetEvent(aIndex: integer): TSynMacroEvent; - function GetEventCount: integer; - function GetAsString: string; - function GetPlaybackCommandID: TSynEditorCommand; - function GetPlaybackShortCut(const Index: Integer): TShortCut; - function GetRecordCommandID: TSynEditorCommand; - function GetRecordShortCut(const Index: Integer): TShortCut; - procedure SetAsString(const Value: string); - protected - fCurrentEditor: TCustomSynEdit; - fState: TSynMacroState; - fEvents: TList; - fCommandIDs: array [TSynMacroCommand] of TSynEditorCommand; - procedure SetShortCut(const Index: Integer; const Value: TShortCut); - function GetIsEmpty: boolean; - procedure StateChanged; - procedure DoAddEditor(aEditor: TCustomSynEdit); override; - procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; - procedure OnCommand(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; var aChar: WideChar; - Data: pointer; HandlerData: pointer); override; - function CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; - protected - property RecordCommandID: TSynEditorCommand read GetRecordCommandID; - property PlaybackCommandID: TSynEditorCommand read GetPlaybackCommandID; - public - constructor Create(aOwner: TComponent); override; - destructor Destroy; override; - procedure Error(const aMsg: String); - procedure AddEditor(aEditor: TCustomSynEdit); - procedure RemoveEditor(aEditor: TCustomSynEdit); - procedure RecordMacro(aEditor: TCustomSynEdit); - procedure PlaybackMacro(aEditor: TCustomSynEdit); - procedure Stop; - procedure Pause; - procedure Resume; - property IsEmpty: boolean read GetIsEmpty; - property State: TSynMacroState read fState; - procedure Clear; - procedure AddEvent(aCmd: TSynEditorCommand; aChar: WideChar; aData: pointer); - procedure InsertEvent(aIndex: integer; aCmd: TSynEditorCommand; aChar: WideChar; - aData: pointer); - procedure AddCustomEvent(aEvent: TSynMacroEvent); - procedure InsertCustomEvent(aIndex: integer; aEvent: TSynMacroEvent); - procedure DeleteEvent(aIndex: integer); - procedure LoadFromStream(aSrc: TStream); - procedure LoadFromStreamEx(aSrc: TStream; aClear: boolean); - procedure SaveToStream(aDest: TStream); - procedure LoadFromFile(aFilename : string); - procedure SaveToFile(aFilename : string); - property EventCount: integer read GetEventCount; - property Events[aIndex: integer]: TSynMacroEvent read GetEvent; - property RecordShortCut: TShortCut index Ord(mcRecord) read GetRecordShortCut write SetShortCut; - property PlaybackShortCut: TShortCut index Ord(mcPlayback) read GetPlaybackShortCut write SetShortCut; - property SaveMarkerPos: boolean read fSaveMarkerPos - write fSaveMarkerPos default False; - property AsString: string read GetAsString write SetAsString; - property MacroName: string read fMacroName write fMacroName; - property OnStateChange: TNotifyEvent read fOnStateChange write fOnStateChange; - property OnUserCommand: TSynUserCommandEvent read fOnUserCommand - write fOnUserCommand; - end; - - TSynMacroRecorder = class(TCustomSynMacroRecorder) - published - property SaveMarkerPos; - property RecordShortCut; - property PlaybackShortCut; - property OnStateChange; - property OnUserCommand; - end; - -implementation - -uses - Forms, - SynEditMiscProcs, - RTLConsts, - SysUtils; - -{ TSynDataEvent } - -procedure TSynDataEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; - aData: Pointer); -begin - fCommand := aCmd; - Assert(aChar = #0); - fData := aData; -end; - -procedure TSynDataEvent.LoadFromStream(aStream: TStream); -begin - aStream.Read(fData, SizeOf(fData)); -end; - -procedure TSynDataEvent.Playback(aEditor: TCustomSynEdit); -begin - aEditor.CommandProcessor(Command, #0, fData); -end; - -procedure TSynDataEvent.SaveToStream(aStream: TStream); -begin - inherited; - aStream.Write(fData, SizeOf(fData)); -end; - -{ TCustomSynMacroRecorder } - -procedure TCustomSynMacroRecorder.AddCustomEvent(aEvent: TSynMacroEvent); -begin - InsertCustomEvent(EventCount, aEvent); -end; - -procedure TCustomSynMacroRecorder.AddEditor(aEditor: TCustomSynEdit); -begin - inherited AddEditor(aEditor); -end; - -procedure TCustomSynMacroRecorder.AddEvent(aCmd: TSynEditorCommand; - aChar: WideChar; aData: pointer); -begin - InsertEvent(EventCount, aCmd, aChar, aData); -end; - -procedure TCustomSynMacroRecorder.Clear; -var - I: Integer; - Obj: TObject; -begin - if Assigned(fEvents) then - begin - for I := fEvents.Count-1 downto 0 do - begin - Obj := fEvents[I]; - fEvents.Delete(I); - Obj.Free; - end; - FreeAndNil(fEvents); - end; -end; - -constructor TCustomSynMacroRecorder.Create(aOwner: TComponent); -begin - inherited; - fMacroName := 'unnamed'; - fCommandIDs[mcRecord] := NewPluginCommand; - fCommandIDs[mcPlayback] := NewPluginCommand; - fShortCuts[mcRecord] := Menus.ShortCut(Ord('R'), [ssCtrl, ssShift]); - fShortCuts[mcPlayback] := Menus.ShortCut(Ord('P'), [ssCtrl, ssShift]); -end; - -function TCustomSynMacroRecorder.CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; - - function WantDefaultEvent(var aEvent: TSynMacroEvent): boolean; - begin - if Assigned(OnUserCommand) then - OnUserCommand(Self, aCmd, aEvent); - Result := aEvent = nil; - end; - -begin - case aCmd of - ecGotoXY, ecSelGotoXY, ecSetMarker0..ecSetMarker9: - begin - Result := TSynPositionEvent.Create; - TSynPositionEvent(Result).Command := aCmd; - end; - ecChar: - Result := TSynCharEvent.Create; - ecString: - Result := TSynStringEvent.Create; - else begin - Result := nil; - if (aCmd < ecUserFirst) or WantDefaultEvent(Result) then - begin - Result := TSynBasicEvent.Create; - TSynBasicEvent(Result).Command := aCmd; - end; - end; - end; -end; - -procedure TCustomSynMacroRecorder.DeleteEvent(aIndex: integer); -var - iObj: Pointer; -begin - iObj := fEvents[aIndex]; - fEvents.Delete(aIndex); - TObject(iObj).Free; -end; - -destructor TCustomSynMacroRecorder.Destroy; -begin - Clear; - inherited; - ReleasePluginCommand(PlaybackCommandID); - ReleasePluginCommand(RecordCommandID); -end; - -procedure TCustomSynMacroRecorder.DoAddEditor(aEditor: TCustomSynEdit); -begin - HookEditor(aEditor, RecordCommandID, 0, RecordShortCut); - HookEditor(aEditor, PlaybackCommandID, 0, PlaybackShortCut); -end; - -procedure TCustomSynMacroRecorder.DoRemoveEditor(aEditor: TCustomSynEdit); -begin - UnHookEditor(aEditor, RecordCommandID, RecordShortCut); - UnHookEditor(aEditor, PlaybackCommandID, PlaybackShortCut); -end; - -procedure TCustomSynMacroRecorder.Error(const aMsg: String); -begin - raise Exception.Create(aMsg); -end; - -function TCustomSynMacroRecorder.GetEvent(aIndex: integer): TSynMacroEvent; -begin - Result := TSynMacroEvent(fEvents[aIndex]); -end; - -function TCustomSynMacroRecorder.GetEventCount: integer; -begin - if fEvents = nil then - Result := 0 - else - Result := fEvents.Count; -end; - -function TCustomSynMacroRecorder.GetIsEmpty: boolean; -begin - Result := (fEvents = nil) or (fEvents.Count = 0); -end; - -procedure TCustomSynMacroRecorder.InsertCustomEvent(aIndex: integer; - aEvent: TSynMacroEvent); -begin - if fEvents = nil then - fEvents := TList.Create; - fEvents.Insert(aIndex, aEvent); -end; - -procedure TCustomSynMacroRecorder.InsertEvent(aIndex: integer; - aCmd: TSynEditorCommand; aChar: WideChar; aData: pointer); -var - iEvent: TSynMacroEvent; -begin - iEvent := CreateMacroEvent(aCmd); - try - iEvent.Initialize(aCmd, aChar, aData); - InsertCustomEvent(aIndex, iEvent); - except - iEvent.Free; - raise; - end; -end; - -procedure TCustomSynMacroRecorder.LoadFromStream(aSrc: TStream); -begin - LoadFromStreamEx(aSrc, True); -end; - -procedure TCustomSynMacroRecorder.LoadFromStreamEx(aSrc: TStream; - aClear: boolean); -var - iCommand: TSynEditorCommand; - iEvent: TSynMacroEvent; - cnt, i: Integer; -begin - Stop; - if aClear then - Clear; - fEvents := TList.Create; - aSrc.Read(cnt, sizeof(cnt)); - i := 0; - fEvents.Capacity := aSrc.Size div SizeOf(TSynEditorCommand); - while (aSrc.Position < aSrc.Size) and (i < cnt) do - begin - aSrc.Read(iCommand, SizeOf(TSynEditorCommand)); - iEvent := CreateMacroEvent(iCommand); - iEvent.Initialize(iCommand, #0, nil); - iEvent.LoadFromStream(aSrc); - fEvents.Add(iEvent); - Inc(i); - end; -end; - -// TODO: Sender could be also something else then a TCustomSynedit(namely a TObject) but the code below assumes it is a TCustomSynedit even if Sender is of type TObject. -procedure TCustomSynMacroRecorder.OnCommand(Sender: TObject; - AfterProcessing: boolean; var Handled: boolean; - var Command: TSynEditorCommand; var aChar: WideChar; Data, - HandlerData: pointer); -var - iEvent: TSynMacroEvent; -begin - if AfterProcessing then - begin - if (Sender = fCurrentEditor) and (State = msRecording) and (not Handled) then - begin - iEvent := CreateMacroEvent(Command); - iEvent.Initialize(Command, aChar, Data); - fEvents.Add(iEvent); - if SaveMarkerPos and (Command >= ecSetMarker0) and - (Command <= ecSetMarker9) and (Data = nil) then - begin - TSynPositionEvent(iEvent).Position := fCurrentEditor.CaretXY; - end; - end; - end - else - begin - {not AfterProcessing} - case State of - msStopped: - if Command = RecordCommandID then - begin - RecordMacro(TCustomSynEdit(Sender)); - Handled := True; - end - else if Command = PlaybackCommandID then - begin - PlaybackMacro(TCustomSynEdit(Sender)); - Handled := True; - end; - msPlaying: - ; - msPaused: - if Command = PlaybackCommandID then - begin - Resume; - Handled := True; - end; - msRecording: - if Command = PlaybackCommandID then - begin - Pause; - Handled := True; - end - else if Command = RecordCommandID then - begin - Stop; - Handled := True; - end; - end; - end; -end; - -procedure TCustomSynMacroRecorder.Pause; -begin - if State <> msRecording then - Error(sCannotPause); - fState := msPaused; - StateChanged; -end; - -procedure TCustomSynMacroRecorder.PlaybackMacro(aEditor: TCustomSynEdit); -var - cEvent: integer; -begin - if State <> msStopped then - Error(sCannotPlay); - fState := msPlaying; - try - StateChanged; - for cEvent := 0 to EventCount -1 do - begin - Events[cEvent].Playback(aEditor); - if State <> msPlaying then - break; - end; - finally - if State = msPlaying then - begin - fState := msStopped; - StateChanged; - end; - end; -end; - -procedure TCustomSynMacroRecorder.RecordMacro(aEditor: TCustomSynEdit); -begin - if fState <> msStopped then - Error(sCannotRecord); - Clear; - fEvents := TList.Create; - fEvents.Capacity := 512; - fState := msRecording; - fCurrentEditor := aEditor; - StateChanged; -end; - -procedure TCustomSynMacroRecorder.RemoveEditor(aEditor: TCustomSynEdit); -begin - inherited RemoveEditor(aEditor); -end; - -procedure TCustomSynMacroRecorder.Resume; -begin - if fState <> msPaused then - Error(sCannotResume); - fState := msRecording; - StateChanged; -end; - -procedure TCustomSynMacroRecorder.SaveToStream(aDest: TStream); -var - cEvent, eCnt: integer; -begin - eCnt := EventCount; - aDest.Write(eCnt, sizeof(eCnt)); - for cEvent := 0 to eCnt -1 do - Events[cEvent].SaveToStream(aDest); -end; - -procedure TCustomSynMacroRecorder.SetShortCut(const Index: Integer; - const Value: TShortCut); -var - cEditor: integer; -begin - if fShortCuts[TSynMacroCommand(Index)] <> Value then - begin - if Assigned(fEditors) then - if Value <> 0 then - begin - for cEditor := 0 to fEditors.Count -1 do - HookEditor(Editors[cEditor], fCommandIDs[TSynMacroCommand(Index)], - fShortCuts[TSynMacroCommand(Index)], Value); - end else - begin - for cEditor := 0 to fEditors.Count -1 do - UnHookEditor(Editors[cEditor], fCommandIDs[TSynMacroCommand(Index)], - fShortCuts[TSynMacroCommand(Index)]); - end; - fShortCuts[TSynMacroCommand(Index)] := Value; - end; -end; - -procedure TCustomSynMacroRecorder.StateChanged; -begin - if Assigned(OnStateChange) then - OnStateChange(Self); -end; - -procedure TCustomSynMacroRecorder.Stop; -begin - if fState = msStopped then - Exit; - fState := msStopped; - fCurrentEditor := nil; - if fEvents.Count = 0 then - FreeAndNil(fEvents); - StateChanged; -end; - -function TCustomSynMacroRecorder.GetAsString: string; -var - i: integer; - eStr: string; -begin - Result := 'macro ' + MacroName + #13#10 + 'begin' + #13#10; - if Assigned(fEvents) then - begin - for i := 0 to fEvents.Count -1 do - begin - eStr := Events[i].AsString; - if eStr <> '' then - Result := Result + ' ' + eStr + #13#10; - end; - end; - Result := Result + 'end'; -end; - -function TCustomSynMacroRecorder.GetPlaybackCommandID: TSynEditorCommand; -begin - Result := fCommandIDs[mcPlayback]; -end; - -function TCustomSynMacroRecorder.GetPlaybackShortCut(const Index: Integer): TShortCut; -begin - Result := fShortCuts[mcPlayback]; -end; - -function TCustomSynMacroRecorder.GetRecordCommandID: TSynEditorCommand; -begin - Result := fCommandIDs[mcRecord]; -end; - -function TCustomSynMacroRecorder.GetRecordShortCut(const Index: Integer): TShortCut; -begin - Result := fShortCuts[mcRecord]; -end; - -procedure TCustomSynMacroRecorder.SetAsString(const Value: string); -var - i, p, Cmd: Integer; - S: TStrings; - cmdStr: string; - iEvent: TSynMacroEvent; -begin - Stop; - Clear; - fEvents := TList.Create; - // process file line by line and create events - S := TStringList.Create; - try - S.Text := Value; - for i := 0 to S.Count - 1 do - begin - cmdStr := Trim(S[i]); - p := Pos(' ', cmdStr); - if p = 0 then p := Length(cmdStr) + 1; - Cmd := ecNone; - if IdentToEditorCommand(Copy(cmdStr, 1, p - 1), Cmd) then // D2 needs type-cast - begin - Delete(cmdStr, 1, p); - iEvent := CreateMacroEvent(Cmd); - try - fEvents.Add(iEvent); - iEvent.InitEventParameters(cmdStr); - except - iEvent.Free; - end; - end; - end; - finally - S.Free; - end; -end; - -procedure TCustomSynMacroRecorder.LoadFromFile(aFilename: string); -var - F : TFileStream; -begin - F := TFileStream.Create(aFilename, fmOpenRead); - try - LoadFromStream(F); - MacroName := ChangeFileExt(ExtractFileName(aFilename), ''); - finally - F.Free; - end; -end; - -procedure TCustomSynMacroRecorder.SaveToFile(aFilename: string); -var - F : TFileStream; -begin - F := TFileStream.Create(aFilename, fmCreate); - try - SaveToStream(F); - finally - F.Free; - end; -end; - -{ TSynBasicEvent } - -function TSynBasicEvent.GetAsString: string; -var - Ident: string; -begin - EditorCommandToIdent(Command, Ident); - Result := Ident; - if RepeatCount > 1 then - Result := Result + ' ' + IntToStr(RepeatCount); -end; - -procedure TSynBasicEvent.InitEventParameters(aStr: string); -begin - // basic events have no parameters but can contain an optional repeat count - RepeatCount := StrToIntDef(Trim(aStr), 1); -end; - -procedure TSynBasicEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; - aData: Pointer); -begin - Command := aCmd; -{$IFDEF SYN_DEVELOPMENT_CHECKS} - if (aChar <> #0) or (aData <> nil) then - raise Exception.Create('TSynBasicEvent cannot handle Char <> #0 or Data <> nil'); -{$ENDIF} -end; - -procedure TSynBasicEvent.LoadFromStream(aStream: TStream); -begin - aStream.Read(fRepeatCount, SizeOf(fRepeatCount)); -end; - -procedure TSynBasicEvent.Playback(aEditor: TCustomSynEdit); -var - i : Integer; -begin - for i := 1 to RepeatCount do - aEditor.CommandProcessor(Command, #0, nil); -end; - -procedure TSynBasicEvent.SaveToStream(aStream: TStream); -begin - aStream.Write(Command, SizeOf(TSynEditorCommand)); - aStream.Write(RepeatCount, SizeOf(RepeatCount)); -end; - -{ TSynCharEvent } - -function TSynCharEvent.GetAsString: string; -var - Ident: string; -begin - EditorCommandToIdent(ecChar, Ident); - Result := Ident + ' ' + Key; - if RepeatCount > 1 then - Result := Result + ' ' + IntToStr(RepeatCount); -end; - -procedure TSynCharEvent.InitEventParameters(aStr: string); -begin - // aStr should be a Key value one character in length - // with an optional repeat count whitespace separated - if Length(aStr) >= 1 then - Key := aStr[1] - else - Key := ' '; - Delete(aStr, 1, 1); // if possible delete the first character - RepeatCount := StrToIntDef(Trim(aStr), 1); -end; - -procedure TSynCharEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; - aData: Pointer); -begin - Key := aChar; - Assert(aData = nil); -end; - -procedure TSynCharEvent.LoadFromStream(aStream: TStream); -begin - aStream.Read(fKey, SizeOf(Key)); - aStream.Read(fRepeatCount, SizeOf(fRepeatCount)); -end; - -procedure TSynCharEvent.Playback(aEditor: TCustomSynEdit); -var - i: Integer; -begin - for i := 1 to RepeatCount do - aEditor.CommandProcessor(ecChar, Key, nil); -end; - -procedure TSynCharEvent.SaveToStream(aStream: TStream); -const - iCharCommand: TSynEditorCommand = ecChar; -begin - aStream.Write(iCharCommand, SizeOf(TSynEditorCommand)); - aStream.Write(Key, SizeOf(Key)); - aStream.Write(RepeatCount, SizeOf(RepeatCount)); -end; - -{ TSynPositionEvent } - -function TSynPositionEvent.GetAsString: string; -begin - Result := inherited GetAsString; - // add position data here - Result := Result + Format(' (%d, %d)', [Position.Char, Position.Line]); - if RepeatCount > 1 then - Result := Result + ' ' + IntToStr(RepeatCount); -end; - -procedure TSynPositionEvent.InitEventParameters(aStr: string); -var - i, o, c, x, y: Integer; - valStr: string; -begin - inherited; - // aStr should be (x, y) with optional repeat count whitespace separated - aStr := Trim(aStr); - i := Pos(',', aStr); - o := Pos('(', aStr); - c := Pos(')', aStr); - if (not ((i = 0) or (o = 0) or (c = 0))) and - ((i > o) and (i < c)) then - begin - valStr := Copy(aStr, o + 1, i - o - 1); - x := StrToIntDef(valStr, 1); - Delete(aStr, 1, i); - aStr := Trim(aStr); - c := Pos(')', aStr); - valStr := Copy(aStr, 1, c - 1); - y := StrToIntDef(valStr, 1); - Position := BufferCoord(x, y); - Delete(aStr, 1, c); - aStr := Trim(aStr); - RepeatCount := StrToIntDef(aStr, 1); - end; -end; - -procedure TSynPositionEvent.Initialize(aCmd: TSynEditorCommand; - aChar: WideChar; aData: Pointer); -begin - inherited; - if aData <> nil then - Position := TBufferCoord(aData^) - else - Position := BufferCoord(0, 0); -end; - -procedure TSynPositionEvent.LoadFromStream(aStream: TStream); -begin - aStream.Read(fPosition, SizeOf(Position)); -end; - -procedure TSynPositionEvent.Playback(aEditor: TCustomSynEdit); -begin - if (Position.Char <> 0) or (Position.Line <> 0) then - aEditor.CommandProcessor(Command, #0, @Position) - else - aEditor.CommandProcessor(Command, #0, nil); -end; - -procedure TSynPositionEvent.SaveToStream(aStream: TStream); -begin - inherited; - aStream.Write(Position, SizeOf(Position)); -end; - -{ TSynStringEvent } - -function TSynStringEvent.GetAsString: string; -var - Ident: string; -begin - EditorCommandToIdent(ecString, Ident); - Result := Ident + ' ' + AnsiQuotedStr(Value, #39); - if RepeatCount > 1 then - Result := Result + ' ' + IntToStr(RepeatCount); -end; - -procedure TSynStringEvent.InitEventParameters(aStr: string); -var - o, c: Integer; - valStr: string; -begin - // aStr = 'test' with optional whitespace separated repeat count - o := Pos('''', aStr); - c := LastDelimiter('''', aStr); - valStr := Copy(aStr, o + 1, c - o - 1); - Value := StringReplace(valStr, '''''', '''', [rfReplaceAll]); - Delete(aStr, 1, c); - RepeatCount := StrToIntDef(Trim(aStr), 1); -end; - -procedure TSynStringEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; - aData: Pointer); -begin - Value := string(aData); -end; - -procedure TSynStringEvent.LoadFromStream(aStream: TStream); -var - l: Integer; - Buff: PWideChar; -begin - aStream.Read(l, sizeof(l)); - GetMem(Buff, l * sizeof(WideChar)); - try - FillMemory(Buff, l, 0); - aStream.Read(Buff^, l * sizeof(WideChar)); - fString := Buff; - finally - FreeMem(Buff); - end; - aStream.Read(fRepeatCount, sizeof(fRepeatCount)); -end; - -procedure TSynStringEvent.Playback(aEditor: TCustomSynEdit); -var - i, j: Integer; -begin - for j := 1 to RepeatCount do - begin -// aEditor.CommandProcessor( ecString, #0, Pointer(Value) ); - // SynEdit doesn't actually support the ecString command so we convert - // it into ecChar commands - for i := 1 to Length(Value) do - aEditor.CommandProcessor(ecChar, Value[i], nil); - end; -end; - -procedure TSynStringEvent.SaveToStream(aStream: TStream); -const - StrCommand: TSynEditorCommand = ecString; -var - l: Integer; - Buff: PWideChar; -begin - aStream.Write(StrCommand, SizeOf(StrCommand)); - l := Length(Value) + 1; - aStream.Write(l, sizeof(l)); - GetMem(Buff, l * sizeof(WideChar)); - try - FillMemory(Buff, l, 0); - StrCopy(Buff, PWideChar(Value)); - aStream.Write(Buff^, l * sizeof(WideChar)); - finally - FreeMem(Buff); - end; - aStream.Write(RepeatCount, sizeof(RepeatCount)); -end; - - -{ TSynMacroEvent } - -constructor TSynMacroEvent.Create; -begin - inherited Create; - fRepeatCount := 1; -end; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynMacroRecorder.pas, released 2001-10-17. + +Author of this file is Flávio Etrusco. +Portions created by Flávio Etrusco are Copyright 2001 Flávio Etrusco. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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: SynMacroRecorder.pas,v 1.31.2.3 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: +-------------------------------------------------------------------------------} + +unit SynMacroRecorder; + +{$I SynEdit.inc} + +interface + +uses + StdCtrls, + Controls, + Windows, + Messages, + Graphics, + Menus, + SynEdit, + SynEditKeyCmds, + SynEditPlugins, + SynEditTypes, + SynUnicode, +{$IFDEF UNICODE} + WideStrUtils, +{$ENDIF} + Classes; + +{$IFDEF SYN_COMPILER_3_UP} +resourcestring +{$ELSE} +const +{$ENDIF} + sCannotRecord = 'Cannot record macro; already recording or playing'; + sCannotPlay = 'Cannot playback macro; already playing or recording'; + sCannotPause = 'Can only pause when recording'; + sCannotResume = 'Can only resume when paused'; + +type + TSynMacroState = (msStopped, msRecording, msPlaying, msPaused); + TSynMacroCommand = (mcRecord, mcPlayback); + + TSynMacroEvent = class(TObject) + protected + FRepeatCount: Byte; + function GetAsString: UnicodeString; virtual; abstract; + procedure InitEventParameters(aStr: UnicodeString); virtual; abstract; + public + constructor Create; virtual; + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + virtual; abstract; + { the CommandID must not be read inside LoadFromStream/SaveToStream. It's read by the + MacroRecorder component to decide which MacroEvent class to instanciate } + procedure LoadFromStream(aStream: TStream); virtual; abstract; + procedure SaveToStream(aStream: TStream); virtual; abstract; + procedure Playback(aEditor: TCustomSynEdit); virtual; abstract; + property AsString: UnicodeString read GetAsString; + property RepeatCount: Byte read FRepeatCount write FRepeatCount; + end; + + TSynBasicEvent = class(TSynMacroEvent) + protected + FCommand: TSynEditorCommand; + function GetAsString: UnicodeString; override; + procedure InitEventParameters(aStr: UnicodeString); override; + public + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + override; + procedure LoadFromStream(aStream: TStream); override; + procedure SaveToStream(aStream: TStream); override; + procedure Playback(aEditor: TCustomSynEdit); override; + public + property Command: TSynEditorCommand read FCommand write FCommand; + end; + + TSynCharEvent = class(TSynMacroEvent) + protected + FKey: WideChar; + function GetAsString: UnicodeString; override; + procedure InitEventParameters(aStr: UnicodeString); override; + public + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + override; + procedure LoadFromStream(aStream: TStream); override; + procedure SaveToStream(aStream: TStream); override; + procedure Playback(aEditor: TCustomSynEdit); override; + public + property Key: WideChar read FKey write FKey; + end; + + TSynStringEvent = class(TSynMacroEvent) + protected + FString: UnicodeString; + function GetAsString: UnicodeString; override; + procedure InitEventParameters(aStr: UnicodeString); override; + public + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + override; + procedure LoadFromStream(aStream: TStream); override; + procedure SaveToStream(aStream: TStream); override; + procedure Playback(aEditor: TCustomSynEdit); override; + public + property Value: UnicodeString read FString write FString; + end; + + TSynPositionEvent = class(TSynBasicEvent) + protected + FPosition: TBufferCoord; + function GetAsString: UnicodeString; override; + procedure InitEventParameters(aStr: UnicodeString); override; + public + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + override; + procedure LoadFromStream(aStream: TStream); override; + procedure SaveToStream(aStream: TStream); override; + procedure Playback(aEditor: TCustomSynEdit); override; + public + property Position: TBufferCoord read FPosition write FPosition; + end; + + TSynDataEvent = class(TSynBasicEvent) + protected + FData: Pointer; + public + procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + override; + procedure LoadFromStream(aStream: TStream); override; + procedure SaveToStream(aStream: TStream); override; + procedure Playback(aEditor: TCustomSynEdit); override; + end; + + TCustomSynMacroRecorder = class; + + TSynUserCommandEvent = procedure (aSender: TCustomSynMacroRecorder; + aCmd: TSynEditorCommand; var aEvent: TSynMacroEvent) of object; + + { TCustomSynMacroRecorder + OnStateChange: + occurs right after start playing, recording, pausing or stopping + SaveMarkerPos: + if true, Bookmark position is recorded in the macro. Otherwise, the Bookmark + is created in the position the Caret is at the time of playback. + } + + TCustomSynMacroRecorder = class(TAbstractSynHookerPlugin) + private + FShortCuts: array [TSynMacroCommand] of TShortCut; + FOnStateChange: TNotifyEvent; + FOnUserCommand: TSynUserCommandEvent; + FMacroName: string; + FSaveMarkerPos: boolean; + function GetEvent(aIndex: Integer): TSynMacroEvent; + function GetEventCount: Integer; + function GetAsString: UnicodeString; + procedure SetAsString(const Value: UnicodeString); + protected + FCurrentEditor: TCustomSynEdit; + FState: TSynMacroState; + FEvents: TList; + FCommandIDs: array [TSynMacroCommand] of TSynEditorCommand; + procedure SetShortCut(const Index: Integer; const Value: TShortCut); + function GetIsEmpty: boolean; + procedure StateChanged; + procedure DoAddEditor(aEditor: TCustomSynEdit); override; + procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; + procedure OnCommand(Sender: TObject; AfterProcessing: boolean; + var Handled: boolean; var Command: TSynEditorCommand; var aChar: WideChar; + Data, HandlerData: Pointer); override; + function CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; + protected + property RecordCommandID: TSynEditorCommand read FCommandIDs[mcRecord]; + property PlaybackCommandID: TSynEditorCommand read FCommandIDs[mcPlayback]; + public + constructor Create(aOwner: TComponent); override; + destructor Destroy; override; + procedure Error(const aMsg: String); + procedure AddEditor(aEditor: TCustomSynEdit); + procedure RemoveEditor(aEditor: TCustomSynEdit); + procedure RecordMacro(aEditor: TCustomSynEdit); + procedure PlaybackMacro(aEditor: TCustomSynEdit); + procedure Stop; + procedure Pause; + procedure Resume; + property IsEmpty: boolean read GetIsEmpty; + property State: TSynMacroState read FState; + procedure Clear; + procedure AddEvent(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + procedure InsertEvent(aIndex: Integer; aCmd: TSynEditorCommand; aChar: WideChar; + aData: Pointer); + procedure AddCustomEvent(aEvent: TSynMacroEvent); + procedure InsertCustomEvent(aIndex: Integer; aEvent: TSynMacroEvent); + procedure DeleteEvent(aIndex: Integer); + procedure LoadFromStream(aSrc: TStream); + procedure LoadFromStreamEx(aSrc: TStream; aClear: boolean); + procedure SaveToStream(aDest: TStream); + procedure LoadFromFile(aFilename : string); + procedure SaveToFile(aFilename : string); + property EventCount: Integer read GetEventCount; + property Events[aIndex: Integer]: TSynMacroEvent read GetEvent; + property RecordShortCut: TShortCut index Ord(mcRecord) + read FShortCuts[mcRecord] write SetShortCut; + property PlaybackShortCut: TShortCut index Ord(mcPlayback) + read FShortCuts[mcPlayback] write SetShortCut; + property SaveMarkerPos: boolean read FSaveMarkerPos + write FSaveMarkerPos default False; + property AsString: UnicodeString read GetAsString write SetAsString; + property MacroName: string read FMacroName write FMacroName; + property OnStateChange: TNotifyEvent read FOnStateChange write FOnStateChange; + property OnUserCommand: TSynUserCommandEvent read FOnUserCommand + write FOnUserCommand; + end; + + TSynMacroRecorder = class(TCustomSynMacroRecorder) + published + property SaveMarkerPos; + property RecordShortCut; + property PlaybackShortCut; + property OnStateChange; + property OnUserCommand; + end; + +implementation + +uses + Forms, + SynEditMiscProcs, +{$IFDEF SYN_COMPILER_6_UP} + RTLConsts, +{$ENDIF} + SysUtils; + +{ TSynDataEvent } + +procedure TSynDataEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; + aData: Pointer); +begin + FCommand := aCmd; + Assert(aChar = #0); + FData := aData; +end; + +procedure TSynDataEvent.LoadFromStream(aStream: TStream); +begin + aStream.Read(FData, SizeOf(FData)); +end; + +procedure TSynDataEvent.Playback(aEditor: TCustomSynEdit); +begin + aEditor.CommandProcessor(Command, #0, FData); +end; + +procedure TSynDataEvent.SaveToStream(aStream: TStream); +begin + inherited; + aStream.Write(FData, SizeOf(FData)); +end; + +{ TCustomSynMacroRecorder } + +procedure TCustomSynMacroRecorder.AddCustomEvent(aEvent: TSynMacroEvent); +begin + InsertCustomEvent(EventCount, aEvent); +end; + +procedure TCustomSynMacroRecorder.AddEditor(aEditor: TCustomSynEdit); +begin + inherited AddEditor(aEditor); +end; + +procedure TCustomSynMacroRecorder.AddEvent(aCmd: TSynEditorCommand; + aChar: WideChar; aData: Pointer); +begin + InsertEvent(EventCount, aCmd, aChar, aData); +end; + +procedure TCustomSynMacroRecorder.Clear; +var + I: Integer; + Obj: TObject; +begin + if Assigned(FEvents) then + begin + for I := FEvents.Count-1 downto 0 do + begin + Obj := FEvents[I]; + FEvents.Delete(I); + Obj.Free; + end; + FreeAndNil(FEvents); + end; +end; + +constructor TCustomSynMacroRecorder.Create(aOwner: TComponent); +begin + inherited; + FMacroName := 'unnamed'; + FCommandIDs[mcRecord] := NewPluginCommand; + FCommandIDs[mcPlayback] := NewPluginCommand; + FShortCuts[mcRecord] := Menus.ShortCut(Ord('R'), [ssCtrl, ssShift]); + FShortCuts[mcPlayback] := Menus.ShortCut(Ord('P'), [ssCtrl, ssShift]); +end; + +function TCustomSynMacroRecorder.CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; + + function WantDefaultEvent(var aEvent: TSynMacroEvent): boolean; + begin + if Assigned(OnUserCommand) then + OnUserCommand(Self, aCmd, aEvent); + Result := aEvent = nil; + end; + +begin + case aCmd of + ecGotoXY, ecSelGotoXY, ecSetMarker0..ecSetMarker9: + begin + Result := TSynPositionEvent.Create; + TSynPositionEvent(Result).Command := aCmd; + end; + ecChar: + Result := TSynCharEvent.Create; + ecString: + Result := TSynStringEvent.Create; + else begin + Result := nil; + if (aCmd < ecUserFirst) or WantDefaultEvent(Result) then + begin + Result := TSynBasicEvent.Create; + TSynBasicEvent(Result).Command := aCmd; + end; + end; + end; +end; + +procedure TCustomSynMacroRecorder.DeleteEvent(aIndex: Integer); +var + iObj: Pointer; +begin + iObj := FEvents[aIndex]; + FEvents.Delete(aIndex); + TObject(iObj).Free; +end; + +destructor TCustomSynMacroRecorder.Destroy; +begin + Clear; + inherited; + ReleasePluginCommand(PlaybackCommandID); + ReleasePluginCommand(RecordCommandID); +end; + +procedure TCustomSynMacroRecorder.DoAddEditor(aEditor: TCustomSynEdit); +begin + HookEditor(aEditor, RecordCommandID, 0, RecordShortCut); + HookEditor(aEditor, PlaybackCommandID, 0, PlaybackShortCut); +end; + +procedure TCustomSynMacroRecorder.DoRemoveEditor(aEditor: TCustomSynEdit); +begin + UnHookEditor(aEditor, RecordCommandID, RecordShortCut); + UnHookEditor(aEditor, PlaybackCommandID, PlaybackShortCut); +end; + +procedure TCustomSynMacroRecorder.Error(const aMsg: String); +begin + raise Exception.Create(aMsg); +end; + +function TCustomSynMacroRecorder.GetEvent(aIndex: Integer): TSynMacroEvent; +begin + Result := TSynMacroEvent(FEvents[aIndex]); +end; + +function TCustomSynMacroRecorder.GetEventCount: Integer; +begin + if FEvents = nil then + Result := 0 + else + Result := FEvents.Count; +end; + +function TCustomSynMacroRecorder.GetIsEmpty: boolean; +begin + Result := (FEvents = nil) or (FEvents.Count = 0); +end; + +procedure TCustomSynMacroRecorder.InsertCustomEvent(aIndex: Integer; + aEvent: TSynMacroEvent); +begin + if FEvents = nil then + FEvents := TList.Create; + FEvents.Insert(aIndex, aEvent); +end; + +procedure TCustomSynMacroRecorder.InsertEvent(aIndex: Integer; + aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); +var + iEvent: TSynMacroEvent; +begin + iEvent := CreateMacroEvent(aCmd); + try + iEvent.Initialize(aCmd, aChar, aData); + InsertCustomEvent(aIndex, iEvent); + except + iEvent.Free; + raise; + end; +end; + +procedure TCustomSynMacroRecorder.LoadFromStream(aSrc: TStream); +begin + LoadFromStreamEx(aSrc, True); +end; + +procedure TCustomSynMacroRecorder.LoadFromStreamEx(aSrc: TStream; + aClear: boolean); +var + iCommand: TSynEditorCommand; + iEvent: TSynMacroEvent; + cnt, i: Integer; +begin + Stop; + if aClear then + Clear; + FEvents := TList.Create; + aSrc.Read(cnt, sizeof(cnt)); + i := 0; + FEvents.Capacity := aSrc.Size div SizeOf(TSynEditorCommand); + while (aSrc.Position < aSrc.Size) and (i < cnt) do + begin + aSrc.Read(iCommand, SizeOf(TSynEditorCommand)); + iEvent := CreateMacroEvent(iCommand); + iEvent.Initialize(iCommand, #0, nil); + iEvent.LoadFromStream(aSrc); + FEvents.Add(iEvent); + Inc(i); + end; +end; + +// TODO: Sender could be also something else then a TCustomSynedit(namely a TObject) but the code below assumes it is a TCustomSynedit even if Sender is of type TObject. +procedure TCustomSynMacroRecorder.OnCommand(Sender: TObject; + AfterProcessing: boolean; var Handled: boolean; + var Command: TSynEditorCommand; var aChar: WideChar; Data, + HandlerData: Pointer); +var + iEvent: TSynMacroEvent; +begin + if AfterProcessing then + begin + if (Sender = FCurrentEditor) and (State = msRecording) and (not Handled) then + begin + iEvent := CreateMacroEvent(Command); + iEvent.Initialize(Command, aChar, Data); + FEvents.Add(iEvent); + if SaveMarkerPos and (Command >= ecSetMarker0) and + (Command <= ecSetMarker9) and (Data = nil) then + begin + TSynPositionEvent(iEvent).Position := FCurrentEditor.CaretXY; + end; + end; + end + else + begin + {not AfterProcessing} + case State of + msStopped: + if Command = RecordCommandID then + begin + RecordMacro(TCustomSynEdit(Sender)); + Handled := True; + end + else if Command = PlaybackCommandID then + begin + PlaybackMacro(TCustomSynEdit(Sender)); + Handled := True; + end; + msPlaying: + ; + msPaused: + if Command = PlaybackCommandID then + begin + Resume; + Handled := True; + end; + msRecording: + if Command = PlaybackCommandID then + begin + Pause; + Handled := True; + end + else if Command = RecordCommandID then + begin + Stop; + Handled := True; + end; + end; + end; +end; + +procedure TCustomSynMacroRecorder.Pause; +begin + if State <> msRecording then + Error(sCannotPause); + FState := msPaused; + StateChanged; +end; + +procedure TCustomSynMacroRecorder.PlaybackMacro(aEditor: TCustomSynEdit); +var + cEvent: Integer; +begin + if State <> msStopped then + Error(sCannotPlay); + FState := msPlaying; + try + StateChanged; + for cEvent := 0 to EventCount -1 do + begin + Events[cEvent].Playback(aEditor); + if State <> msPlaying then + Break; + end; + finally + if State = msPlaying then + begin + FState := msStopped; + StateChanged; + end; + end; +end; + +procedure TCustomSynMacroRecorder.RecordMacro(aEditor: TCustomSynEdit); +begin + if FState <> msStopped then + Error(sCannotRecord); + Clear; + FEvents := TList.Create; + FEvents.Capacity := 512; + FState := msRecording; + FCurrentEditor := aEditor; + StateChanged; +end; + +procedure TCustomSynMacroRecorder.RemoveEditor(aEditor: TCustomSynEdit); +begin + inherited RemoveEditor(aEditor); +end; + +procedure TCustomSynMacroRecorder.Resume; +begin + if FState <> msPaused then + Error(sCannotResume); + FState := msRecording; + StateChanged; +end; + +procedure TCustomSynMacroRecorder.SaveToStream(aDest: TStream); +var + cEvent, eCnt: Integer; +begin + eCnt := EventCount; + aDest.Write(eCnt, sizeof(eCnt)); + for cEvent := 0 to eCnt -1 do + Events[cEvent].SaveToStream(aDest); +end; + +procedure TCustomSynMacroRecorder.SetShortCut(const Index: Integer; + const Value: TShortCut); +var + cEditor: Integer; +begin + if FShortCuts[TSynMacroCommand(Index)] <> Value then + begin + if Assigned(fEditors) then + if Value <> 0 then + begin + for cEditor := 0 to fEditors.Count -1 do + HookEditor(Editors[cEditor], FCommandIDs[TSynMacroCommand(Index)], + FShortCuts[TSynMacroCommand(Index)], Value); + end else + begin + for cEditor := 0 to fEditors.Count -1 do + UnHookEditor(Editors[cEditor], FCommandIDs[TSynMacroCommand(Index)], + FShortCuts[TSynMacroCommand(Index)]); + end; + FShortCuts[TSynMacroCommand(Index)] := Value; + end; +end; + +procedure TCustomSynMacroRecorder.StateChanged; +begin + if Assigned(OnStateChange) then + OnStateChange(Self); +end; + +procedure TCustomSynMacroRecorder.Stop; +begin + if FState = msStopped then + Exit; + FState := msStopped; + FCurrentEditor := nil; + if FEvents.Count = 0 then + FreeAndNil(FEvents); + StateChanged; +end; + +function TCustomSynMacroRecorder.GetAsString: UnicodeString; +var + i: Integer; + eStr: UnicodeString; +begin + Result := 'macro ' + MacroName + #13#10 + 'begin' + #13#10; + if Assigned(FEvents) then + begin + for i := 0 to FEvents.Count -1 do + begin + eStr := Events[i].AsString; + if eStr <> '' then + Result := Result + ' ' + eStr + #13#10; + end; + end; + Result := Result + 'end'; +end; + +procedure TCustomSynMacroRecorder.SetAsString(const Value: UnicodeString); +var + i, p, Cmd: Integer; + S: TUnicodeStrings; + cmdStr: UnicodeString; + iEvent: TSynMacroEvent; +begin + Stop; + Clear; + FEvents := TList.Create; + // process file line by line and create events + S := TUnicodeStringList.Create; + try + S.Text := Value; + for i := 0 to S.Count - 1 do + begin + cmdStr := WideTrim(S[i]); + p := Pos(' ', cmdStr); + if p = 0 then p := Length(cmdStr) + 1; + Cmd := ecNone; + if IdentToEditorCommand(Copy(cmdStr, 1, p - 1), Longint(Cmd)) then // D2 needs type-cast + begin + Delete(cmdStr, 1, p); + iEvent := CreateMacroEvent(Cmd); + try + FEvents.Add(iEvent); + iEvent.InitEventParameters(cmdStr); + except + iEvent.Free; + end; + end; + end; + finally + S.Free; + end; +end; + +procedure TCustomSynMacroRecorder.LoadFromFile(aFilename: string); +var + F : TFileStream; +begin + F := TFileStream.Create(aFilename, fmOpenRead); + try + LoadFromStream(F); + MacroName := ChangeFileExt(ExtractFileName(aFilename), ''); + finally + F.Free; + end; +end; + +procedure TCustomSynMacroRecorder.SaveToFile(aFilename: string); +var + F : TFileStream; +begin + F := TFileStream.Create(aFilename, fmCreate); + try + SaveToStream(F); + finally + F.Free; + end; +end; + +{ TSynBasicEvent } + +function TSynBasicEvent.GetAsString: UnicodeString; +var + Ident: string; +begin + EditorCommandToIdent(Command, Ident); + Result := Ident; + if RepeatCount > 1 then + Result := Result + ' ' + IntToStr(RepeatCount); +end; + +procedure TSynBasicEvent.InitEventParameters(aStr: UnicodeString); +begin + // basic events have no parameters but can contain an optional repeat count + RepeatCount := StrToIntDef(WideTrim(aStr), 1); +end; + +procedure TSynBasicEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; + aData: Pointer); +begin + Command := aCmd; +{$IFDEF SYN_DEVELOPMENT_CHECKS} + if (aChar <> #0) or (aData <> nil) then + raise Exception.Create('TSynBasicEvent cannot handle Char <> #0 or Data <> nil'); +{$ENDIF} +end; + +procedure TSynBasicEvent.LoadFromStream(aStream: TStream); +begin + aStream.Read(FRepeatCount, SizeOf(FRepeatCount)); +end; + +procedure TSynBasicEvent.Playback(aEditor: TCustomSynEdit); +var + i : Integer; +begin + for i := 1 to RepeatCount do + aEditor.CommandProcessor(Command, #0, nil); +end; + +procedure TSynBasicEvent.SaveToStream(aStream: TStream); +begin + aStream.Write(Command, SizeOf(TSynEditorCommand)); + aStream.Write(RepeatCount, SizeOf(RepeatCount)); +end; + +{ TSynCharEvent } + +function TSynCharEvent.GetAsString: UnicodeString; +var + Ident: string; +begin + EditorCommandToIdent(ecChar, Ident); + Result := Ident + ' ' + Key; + if RepeatCount > 1 then + Result := Result + ' ' + IntToStr(RepeatCount); +end; + +procedure TSynCharEvent.InitEventParameters(aStr: UnicodeString); +begin + // aStr should be a Key value one character in length + // with an optional repeat count whitespace separated + if Length(aStr) >= 1 then + Key := aStr[1] + else + Key := ' '; + Delete(aStr, 1, 1); // if possible delete the first character + RepeatCount := StrToIntDef(WideTrim(aStr), 1); +end; + +procedure TSynCharEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; + aData: Pointer); +begin + Key := aChar; + Assert(aData = nil); +end; + +procedure TSynCharEvent.LoadFromStream(aStream: TStream); +begin + aStream.Read(FKey, SizeOf(Key)); + aStream.Read(FRepeatCount, SizeOf(FRepeatCount)); +end; + +procedure TSynCharEvent.Playback(aEditor: TCustomSynEdit); +var + i: Integer; +begin + for i := 1 to RepeatCount do + aEditor.CommandProcessor(ecChar, Key, nil); +end; + +procedure TSynCharEvent.SaveToStream(aStream: TStream); +const + iCharCommand: TSynEditorCommand = ecChar; +begin + aStream.Write(iCharCommand, SizeOf(TSynEditorCommand)); + aStream.Write(Key, SizeOf(Key)); + aStream.Write(RepeatCount, SizeOf(RepeatCount)); +end; + +{ TSynPositionEvent } + +function TSynPositionEvent.GetAsString: UnicodeString; +begin + Result := inherited GetAsString; + // add position data here + Result := Result + Format(' (%d, %d)', [Position.Char, Position.Line]); + if RepeatCount > 1 then + Result := Result + ' ' + IntToStr(RepeatCount); +end; + +procedure TSynPositionEvent.InitEventParameters(aStr: UnicodeString); +var + i, o, c, x, y: Integer; + valStr: UnicodeString; +begin + inherited; + // aStr should be (x, y) with optional repeat count whitespace separated + aStr := WideTrim(aStr); + i := Pos(',', aStr); + o := Pos('(', aStr); + c := Pos(')', aStr); + if (not ((i = 0) or (o = 0) or (c = 0))) and + ((i > o) and (i < c)) then + begin + valStr := Copy(aStr, o + 1, i - o - 1); + x := StrToIntDef(valStr, 1); + Delete(aStr, 1, i); + aStr := WideTrim(aStr); + c := Pos(')', aStr); + valStr := Copy(aStr, 1, c - 1); + y := StrToIntDef(valStr, 1); + Position := BufferCoord(x, y); + Delete(aStr, 1, c); + aStr := WideTrim(aStr); + RepeatCount := StrToIntDef(aStr, 1); + end; +end; + +procedure TSynPositionEvent.Initialize(aCmd: TSynEditorCommand; + aChar: WideChar; aData: Pointer); +begin + inherited; + if aData <> nil then + Position := TBufferCoord(aData^) + else + Position := BufferCoord(0, 0); +end; + +procedure TSynPositionEvent.LoadFromStream(aStream: TStream); +begin + aStream.Read(FPosition, SizeOf(Position)); +end; + +procedure TSynPositionEvent.Playback(aEditor: TCustomSynEdit); +begin + if (Position.Char <> 0) or (Position.Line <> 0) then + aEditor.CommandProcessor(Command, #0, @Position) + else + aEditor.CommandProcessor(Command, #0, nil); +end; + +procedure TSynPositionEvent.SaveToStream(aStream: TStream); +begin + inherited; + aStream.Write(Position, SizeOf(Position)); +end; + +{ TSynStringEvent } + +function TSynStringEvent.GetAsString: UnicodeString; +var + Ident: string; +begin + EditorCommandToIdent(ecString, Ident); + Result := Ident + ' ' + WideQuotedStr(Value, #39); + if RepeatCount > 1 then + Result := Result + ' ' + IntToStr(RepeatCount); +end; + +procedure TSynStringEvent.InitEventParameters(aStr: UnicodeString); +var + o, c: Integer; + valStr: UnicodeString; +begin + // aStr = 'test' with optional whitespace separated repeat count + o := Pos('''', aStr); + c := WideLastDelimiter('''', aStr); + valStr := Copy(aStr, o + 1, c - o - 1); + Value := UnicodeStringReplace(valStr, '''''', '''', [rfReplaceAll]); + Delete(aStr, 1, c); + RepeatCount := StrToIntDef(WideTrim(aStr), 1); +end; + +procedure TSynStringEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; + aData: Pointer); +begin + Value := UnicodeString(aData); +end; + +procedure TSynStringEvent.LoadFromStream(aStream: TStream); +var + l: Integer; + Buff: PWideChar; +begin + aStream.Read(l, sizeof(l)); + GetMem(Buff, l * sizeof(WideChar)); + try + FillMemory(Buff, l, 0); + aStream.Read(Buff^, l * sizeof(WideChar)); + FString := Buff; + finally + FreeMem(Buff); + end; + aStream.Read(FRepeatCount, sizeof(FRepeatCount)); +end; + +procedure TSynStringEvent.Playback(aEditor: TCustomSynEdit); +var + i, j: Integer; +begin + for j := 1 to RepeatCount do + begin +// aEditor.CommandProcessor( ecString, #0, Pointer(Value) ); + // SynEdit doesn't actually support the ecString command so we convert + // it into ecChar commands + for i := 1 to Length(Value) do + aEditor.CommandProcessor(ecChar, Value[i], nil); + end; +end; + +procedure TSynStringEvent.SaveToStream(aStream: TStream); +const + StrCommand: TSynEditorCommand = ecString; +var + l: Integer; + Buff: PWideChar; +begin + aStream.Write(StrCommand, SizeOf(StrCommand)); + l := Length(Value) + 1; + aStream.Write(l, sizeof(l)); + GetMem(Buff, l * sizeof(WideChar)); + try + FillMemory(Buff, l, 0); + WStrCopy(Buff, PWideChar(Value)); + aStream.Write(Buff^, l * sizeof(WideChar)); + finally + FreeMem(Buff); + end; + aStream.Write(RepeatCount, sizeof(RepeatCount)); +end; + + +{ TSynMacroEvent } + +constructor TSynMacroEvent.Create; +begin + inherited Create; + FRepeatCount := 1; +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynMemo.pas b/Source/VCL/SynEdit/Source/SynMemo.pas new file mode 100644 index 00000000..47cf022b --- /dev/null +++ b/Source/VCL/SynEdit/Source/SynMemo.pas @@ -0,0 +1,260 @@ +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynMemo.pas, released 2000-04-07. +The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of +the mwEdit component suite. +Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. +Unicode translation by Maël Hörz. +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: SynMemo.pas,v 1.15.2.3 2008/09/14 16:25:03 maelh Exp $ + +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Known Issues: + - several EM_XXX messages aren't handled yet; + - EM_XXX messages aren't implemented on CLX, although this could be useful; +-------------------------------------------------------------------------------} + +unit SynMemo; + +{$I SynEdit.inc} + +interface + +uses + RichEdit, + Windows, + Messages, + SynEdit, + SynEditTextBuffer, + SynEditTypes, + SysUtils, + Classes; + +type + TSynMemo = class(TSynEdit) + private + // EM_XXX see winuser.h (PSDK August 2001) + procedure EMGetSel(var Message: TMessage); message EM_GETSEL; + procedure EMSetSel(var Message: TMessage); message EM_SETSEL; + procedure EMGetModify(var Message: TMessage); message EM_GETMODIFY; + procedure EMSetModify(var Message: TMessage); message EM_SETMODIFY; + procedure EMGetLineCount(var Message: TMessage); message EM_GETLINECOUNT; + procedure EMGetSelText(var Message: TMessage); message EM_GETSELTEXT; //richedit.h + procedure EMReplaceSel(var Message: TMessage); message EM_REPLACESEL; + procedure EMGetLine(var Message: TMessage); message EM_GETLINE; + procedure EMCanUndo(var Message: TMessage); message EM_CANUNDO; + procedure EMUndo(var Message: TMessage); message EM_UNDO; + procedure EMGetFirstVisibleLine(var Message: TMessage); message EM_GETFIRSTVISIBLELINE; + procedure EMCharFromPos(var Message: TMessage); message EM_CHARFROMPOS; + end; + +implementation + +uses +{$IFDEF SYN_COMPILER_18_UP} + AnsiStrings, +{$ENDIF} +{$IFDEF UNICODE} + WideStrUtils, +{$ENDIF} + SynUnicode, + SynEditMiscProcs; + +{ TSynMemo } + +// EM_GETSEL +// wParam = (WPARAM) (LPDWORD) lpdwStart; // receives starting position +// lParam = (LPARAM) (LPDWORD) lpdwEnd; // receives ending position +procedure TSynMemo.EMGetSel(var Message: TMessage); +var + s, e: Integer; +begin + s := GetSelStart; + e := GetSelEnd; + if Message.wParam <> 0 then PDWORD(Message.wParam)^ := s; + if Message.lParam <> 0 then PDWORD(Message.lParam)^ := e; + Message.Result := MakeLong(s, e) +end; + +// EM_SETSEL +// wParam = (WPARAM) (INT) nStart; // starting position +// lParam = (LPARAM) (INT) nEnd; // ending position +procedure TSynMemo.EMSetSel(var Message: TMessage); +begin + SetSelStart(Message.wParam); + SetSelEnd(Message.lParam); +end; + +procedure TSynMemo.EMSetModify(var Message: TMessage); +begin + Modified := Message.wParam <> 0; +end; + +procedure TSynMemo.EMGetModify(var Message: TMessage); +begin + Message.Result := Integer(Modified); +end; + +procedure TSynMemo.EMGetLineCount(var Message: TMessage); +begin + //(WPARAM) wParam, // not used; must be zero + //(LPARAM) lParam // not used; must be zero + Message.Result := Lines.Count; +end; + +procedure TSynMemo.EMGetSelText(var Message: TMessage); +begin + if Message.lParam <> 0 then + begin + if IsWindowUnicode(Handle) then + WStrLCopy(PWideChar(Message.lParam), PWideChar(SelText), Length(SelText)) + else + {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(PAnsiChar(Message.lParam), PAnsiChar(AnsiString(SelText)), Length(SelText)); + Message.Result := Length(SelText); + end; +end; + + +// EM_REPLACESEL +// fCanUndo = (BOOL) wParam ; // flag that specifies whether replacement can be undone +// lpszReplace = (LPCTSTR) lParam ; // pointer to replacement text string +// see PasteFromClipboard CF_TEXT - use common function ? +// or use SetSelText/SetSelTextPrimitive (no undo) +procedure TSynMemo.EMReplaceSel(var Message: TMessage); +var + StartOfBlock: TBufferCoord; + EndOfBlock: TBufferCoord; +begin + if ReadOnly then Exit; + DoOnPaintTransient(ttBefore); + BeginUndoBlock; + try + if SelAvail and (Message.WParam <> 0){???} then + UndoList.AddChange(crDelete, BlockBegin, BlockEnd, SelText, SelectionMode); + StartOfBlock := BlockBegin; + EndOfBlock := BlockEnd; + BlockBegin := StartOfBlock; + BlockEnd := EndOfBlock; + LockUndo; + try + if IsWindowUnicode(Handle) then + SelText := PWideChar(Message.lParam) + else + SelText := UnicodeString(PAnsiChar(Message.lParam)) + finally + UnlockUndo; + end; + if (Message.WParam <> 0){???} then + UndoList.AddChange(crPaste, StartOfBlock, BlockEnd, SelText, smNormal); + finally + EndUndoBlock; + end; + EnsureCursorPosVisible; + // Selection should have changed... + StatusChanged([scSelection]); + + DoOnPaintTransient(ttAfter); +end; + +// wParam = line number +// lParam = line string (PAnsiChar/PWideChar) +// no terminating #0 +procedure TSynMemo.EMGetLine(var Message: TMessage); +var + DestAnsi, SourceAnsi: PAnsiChar; + DestWide, SourceWide: PWideChar; +begin + if {$IFNDEF SYN_COMPILER_16_UP}(Message.WParam >= 0) and {$ENDIF}(Integer(Message.WParam) < Lines.Count) then + begin + if IsWindowUnicode(Handle) then + begin + DestWide := PWideChar(Message.LParam); + SourceWide := PWideChar(Lines[Message.WParam]); + WStrLCopy(DestWide, SourceWide, PWord(Message.LParam)^); + Message.Result := WStrLen(DestWide); + end + else + begin + DestAnsi := PAnsiChar(Message.LParam); + SourceAnsi := PAnsiChar(AnsiString(Lines[Message.WParam])); + {$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 + Message.Result := 0; +end; + +//(WPARAM) wParam, // not used; must be zero +//(LPARAM) lParam // not used; must be zero +procedure TSynMemo.EMCanUndo(var Message: TMessage); +begin + Message.Result := Integer(CanUndo); +end; + +//(WPARAM) wParam, // not used; must be zero +//(LPARAM) lParam // not used; must be zero +procedure TSynMemo.EMUndo(var Message: TMessage); +begin + Message.Result := Integer(CanUndo); + Undo; +end; + +//(WPARAM) wParam, // not used; must be zero +//(LPARAM) lParam // not used; must be zero +procedure TSynMemo.EMGetFirstVisibleLine(var Message: TMessage); +begin + Message.Result := TopLine; +end; + +//(WPARAM) wParam, // not used; must be zero +//(LPARAM) lParam // point coordinates +procedure TSynMemo.EMCharFromPos(var Message: TMessage); +var + vPos: TBufferCoord; + i: Integer; +begin + vPos := DisplayToBufferPos(PixelsToRowColumn(Message.LParamLo, Message.LParamHi)); + + Dec(vPos.Line); + if vPos.Line >= Lines.Count then + vPos.Char := 1 + else if vPos.Char > Length(Lines[vPos.Line]) then + vPos.Char := Length(Lines[vPos.Line]) + 1; // ??? + + i := vPos.Line; + while i > 0 do + begin + Dec(i); + Inc(vPos.Char, Length(Lines[i]) + 2); + end; + + //todo: this can't be right, CharIndex can easily overflow + Message.Result := MakeLong(vPos.Char{CharIndex}, vPos.Line{Line zero based}); +end; + +end. diff --git a/Source/VCL/SynEdit/Source/SynRegExpr.pas b/Source/VCL/SynEdit/Source/SynRegExpr.pas new file mode 100644 index 00000000..3057cacb --- /dev/null +++ b/Source/VCL/SynEdit/Source/SynRegExpr.pas @@ -0,0 +1,4107 @@ +{$IFNDEF QSYNREGEXPR} +unit SynRegExpr; +{$ENDIF} + +{ + TRegExpr class library + Delphi Regular Expressions + + Copyright (c) 1999-2004 Andrey V. Sorokin, St.Petersburg, Russia + + You may use this software in any kind of development, + including comercial, redistribute, and modify it freely, + under the following restrictions : + 1. This software is provided as it is, without any kind of + warranty given. Use it at Your own risk.The author is not + responsible for any consequences of use of this software. + 2. The origin of this software may not be mispresented, You + must not claim that You wrote the original software. If + You use this software in any kind of product, it would be + appreciated that there in a information box, or in the + documentation would be an acknowledgement like + + Partial Copyright (c) 2004 Andrey V. Sorokin + http://RegExpStudio.com + mailto:anso@mail.ru + + 3. You may not have any income from distributing this source + (or altered version of it) to other developers. When You + use this product in a comercial package, the source may + not be charged seperatly. + 4. Altered versions must be plainly marked as such, and must + not be misrepresented as being the original software. + 5. RegExp Studio application and all the visual components as + well as documentation is not part of the TRegExpr library + and is not free for usage. + + mailto:anso@mail.ru + http://RegExpStudio.com + http://anso.da.ru/ +} + +interface + +{$INCLUDE SynEdit.inc} + +// ======== Determine compiler +{$IFDEF VER80} Sorry, TRegExpr is for 32-bits Delphi only. Delphi 1 is not supported (and whos really care today?!). {$ENDIF} + +// ======== Define base compiler options +{$BOOLEVAL OFF} +{$EXTENDEDSYNTAX ON} +{$LONGSTRINGS ON} +{$OPTIMIZATION ON} +{$IFDEF SYN_COMPILER_6_UP} + {$WARN SYMBOL_PLATFORM OFF} // Suppress .Net warnings +{$ENDIF} +{$IFDEF SYN_COMPILER_7_UP} + {$WARN UNSAFE_CAST OFF} // Suppress .Net warnings + {$WARN UNSAFE_TYPE OFF} // Suppress .Net warnings + {$WARN UNSAFE_CODE OFF} // Suppress .Net warnings +{$ENDIF} +{$IFDEF FPC} + {$MODE DELPHI} // Delphi-compatible mode in FreePascal +{$ENDIF} + +// ======== Define options for TRegExpr engine +{$DEFINE SynRegUniCode} // Unicode support +{$DEFINE RegExpPCodeDump} // p-code dumping (see Dump method) +{$IFNDEF FPC} // the option is not supported in FreePascal + {$DEFINE reRealExceptionAddr} // exceptions will point to appropriate source line, not to Error procedure +{$ENDIF} +{$DEFINE ComplexBraces} // support braces in complex cases +{$IFNDEF SynRegUniCode} // the option applicable only for non-UniCode mode + {$DEFINE UseSetOfChar} // Significant optimization by using set of char +{$ENDIF} +{$IFDEF UseSetOfChar} + {$DEFINE UseFirstCharSet} // Fast skip between matches for r.e. that starts with determined set of chars +{$ENDIF} + +// ======== Define Pascal-language options +// Define 'UseAsserts' option (do not edit this definitions). +// Asserts used to catch 'strange bugs' in TRegExpr implementation (when something goes +// completely wrong). You can swith asserts on/off with help of {$C+}/{$C-} compiler options. +{$IFDEF SYN_COMPILER_3_UP} {$DEFINE UseAsserts} {$ENDIF} +{$IFDEF FPC} {$DEFINE UseAsserts} {$ENDIF} + +// Define 'use subroutine parameters default values' option (do not edit this definition). +{$IFDEF SYN_COMPILER_4_UP} {$DEFINE DefParam} {$ENDIF} + +// Define 'OverMeth' options, to use method overloading (do not edit this definitions). +{$IFDEF SYN_COMPILER_5_UP} {$DEFINE OverMeth} {$ENDIF} +{$IFDEF FPC} {$DEFINE OverMeth} {$ENDIF} + +uses + SynUnicode, + Classes, // TStrings in Split method + SysUtils; // Exception + +type + {$IFDEF SynRegUniCode} + PRegExprChar = PWideChar; + RegExprString = UnicodeString; + REChar = WideChar; + {$ELSE} + PRegExprChar = PChar; + RegExprString = AnsiString; //###0.952 was string + REChar = Char; + {$ENDIF} + TREOp = REChar; // internal p-code type //###0.933 + PREOp = ^TREOp; + TRENextOff = Integer; // internal Next "pointer" (offset to current p-code) //###0.933 + PRENextOff = ^TRENextOff; // used for extracting Next "pointers" from compiled r.e. //###0.933 + TREBracesArg = Integer; // type of {m,n} arguments + PREBracesArg = ^TREBracesArg; + +const + REOpSz = SizeOf (TREOp) div SizeOf (REChar); // size of p-code in RegExprString units + RENextOffSz = SizeOf (TRENextOff) div SizeOf (REChar); // size of Next 'pointer' -"- + REBracesArgSz = SizeOf (TREBracesArg) div SizeOf (REChar); // size of BRACES arguments -"- + +type + TRegExprInvertCaseFunction = function (const Ch: REChar): REChar of object; + +const + EscChar = '\'; // 'Escape'-char ('\' in common r.e.) used for escaping metachars (\w, \d etc). + RegExprModifierI: Boolean = False; // default value for ModifierI + RegExprModifierR: Boolean = True; // default value for ModifierR + RegExprModifierS: Boolean = True; // default value for ModifierS + RegExprModifierG: Boolean = True; // default value for ModifierG + RegExprModifierM: Boolean = False; // default value for ModifierM + RegExprModifierX: Boolean = False; // default value for ModifierX + RegExprSpaceChars: RegExprString = // default value for SpaceChars + ' '#$9#$A#$D#$C; + RegExprWordChars: RegExprString = // default value for WordChars + '0123456789' //###0.940 + + 'abcdefghijklmnopqrstuvwxyz' + + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'; + RegExprLineSeparators: RegExprString =// default value for LineSeparators + #$d#$a{$IFDEF SynRegUniCode}+#$b#$c#$2028#$2029#$85{$ENDIF}; //###0.947 + RegExprLinePairedSeparator : RegExprString =// default value for LinePairedSeparator + #$d#$a; + { if You need Unix-styled line separators (only \n), then use: + RegExprLineSeparators = #$a; + RegExprLinePairedSeparator = ''; + } + + +const + NSUBEXP = 15; // max number of subexpression //###0.929 + // Cannot be more than NSUBEXPMAX + // Be carefull - don't use values which overflow CLOSE opcode + // (in this case you'll get compiler erorr). + // Big NSUBEXP will cause more slow work and more stack required + NSUBEXPMAX = 255; // Max possible value for NSUBEXP. //###0.945 + // Don't change it! It's defined by internal TRegExpr design. + + MaxBracesArg = $7FFFFFFF - 1; // max value for {n,m} arguments //###0.933 + + {$IFDEF ComplexBraces} + LoopStackMax = 10; // max depth of loops stack //###0.925 + {$ENDIF} + + TinySetLen = 3; + // if range includes more then TinySetLen chars, //###0.934 + // then use full (32 bytes) ANYOFFULL instead of ANYOF[BUT]TINYSET + // !!! Attension ! If you change TinySetLen, you must + // change code marked as "//!!!TinySet" + +type +{$IFDEF UseSetOfChar} + PSetOfREChar = ^TSetOfREChar; + TSetOfREChar = set of REChar; +{$ENDIF} + + TRegExpr = class; + + TRegExprReplaceFunction = function (ARegExpr: TRegExpr): string of object; + + TRegExpr = class + private + startp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr starting points + endp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr end points + + {$IFDEF ComplexBraces} + LoopStack : array [1 .. LoopStackMax] of Integer; // state before entering loop + LoopStackIdx : Integer; // 0 - out of all loops + {$ENDIF} + + // The "internal use only" fields to pass info from compile + // to execute that permits the execute phase to run lots faster on + // simple cases. + regstart : REChar; // char that must begin a match; '\0' if none obvious + reganch : REChar; // is the match anchored (at beginning-of-line only)? + regmust : PRegExprChar; // string (pointer into program) that match must include, or nil + regmlen : Integer; // length of regmust string + // Regstart and reganch permit very fast decisions on suitable starting points + // for a match, cutting down the work a lot. Regmust permits fast rejection + // of lines that cannot possibly match. The regmust tests are costly enough + // that regcomp() supplies a regmust only if the r.e. contains something + // potentially expensive (at present, the only such thing detected is * or + + // at the start of the r.e., which can involve a lot of backup). Regmlen is + // supplied because the test in regexec() needs it and regcomp() is computing + // it anyway. + {$IFDEF UseFirstCharSet} //###0.929 + FirstCharSet : TSetOfREChar; + {$ENDIF} + + // work variables for Exec's routins - save stack in recursion} + reginput : PRegExprChar; // String-input pointer. + fInputStart : PRegExprChar; // Pointer to first char of input string. + fInputEnd : PRegExprChar; // Pointer to char AFTER last char of input string + + // work variables for compiler's routines + regparse : PRegExprChar; // Input-scan pointer. + regnpar : Integer; // count. + regdummy : REChar; + regcode : PRegExprChar; // Code-emit pointer; @regdummy = don't. + regsize : Integer; // Code size. + + regexpbeg : PRegExprChar; // only for error handling. Contains + // pointer to beginning of r.e. while compiling + fExprIsCompiled : Boolean; // True if r.e. successfully compiled + + // programm is essentially a linear encoding + // of a nondeterministic finite-state machine (aka syntax charts or + // "railroad normal form" in parsing technology). Each node is an opcode + // plus a "next" pointer, possibly plus an operand. "Next" pointers of + // all nodes except BRANCH implement concatenation; a "next" pointer with + // a BRANCH on both ends of it is connecting two alternatives. (Here we + // have one of the subtle syntax dependencies: an individual BRANCH (as + // opposed to a collection of them) is never concatenated with anything + // because of operator precedence.) The operand of some types of node is + // a literal string; for others, it is a node leading into a sub-FSM. In + // particular, the operand of a BRANCH node is the first node of the branch. + // (NB this is *not* a tree structure: the tail of the branch connects + // to the thing following the set of BRANCHes.) The opcodes are: + programm : PRegExprChar; // Unwarranted chumminess with compiler. + + fExpression : PRegExprChar; // source of compiled r.e. + fInputString : PRegExprChar; // input string + + FLastError : Integer; // see Error, LastError + + fModifiers : Integer; // modifiers + fCompModifiers : Integer; // compiler's copy of modifiers + fProgModifiers : Integer; // modifiers values from last programm compilation + + fSpaceChars : RegExprString; //###0.927 + fWordChars : RegExprString; //###0.929 + fInvertCase : TRegExprInvertCaseFunction; //###0.927 + + FLineSeparators : RegExprString; //###0.941 + fLinePairedSeparatorAssigned : Boolean; + fLinePairedSeparatorHead, + fLinePairedSeparatorTail : REChar; + {$IFNDEF SynRegUniCode} + FLineSeparatorsSet : set of REChar; + {$ENDIF} + + procedure InvalidateProgramm; + // Mark programm as have to be [re]compiled + + function IsProgrammOk : Boolean; //###0.941 + // Check if we can use precompiled r.e. or + // [re]compile it if something changed + + function GetExpression : RegExprString; + procedure SetExpression (const s : RegExprString); + + function GetModifierStr : RegExprString; + class function ParseModifiersStr (const AModifiers : RegExprString; + var AModifiersInt : Integer) : Boolean; //###0.941 class function now + // Parse AModifiers string and return True and set AModifiersInt + // if it's in format 'ismxrg-ismxrg'. + procedure SetModifierStr (const AModifiers : RegExprString); + + function GetModifier (AIndex : Integer) : Boolean; + procedure SetModifier (AIndex : Integer; ASet : Boolean); + + procedure Error (AErrorID : Integer); virtual; // error handler. + // Default handler raise exception ERegExpr with + // Message = ErrorMsg (AErrorID), ErrorCode = AErrorID + // and CompilerErrorPos = value of property CompilerErrorPos. + + + {==================== Compiler section ===================} + function CompileRegExpr (exp : PRegExprChar) : Boolean; + // compile a regular expression into internal code + + procedure Tail (p : PRegExprChar; val : PRegExprChar); + // set the next-pointer at the end of a node chain + + procedure OpTail (p : PRegExprChar; val : PRegExprChar); + // regoptail - regtail on operand of first argument; nop if operandless + + function EmitNode (op : TREOp) : PRegExprChar; + // regnode - emit a node, return location + + procedure EmitC (b : REChar); + // emit (if appropriate) a byte of code + + procedure InsertOperator (op : TREOp; opnd : PRegExprChar; sz : Integer); //###0.90 + // insert an operator in front of already-emitted operand + // Means relocating the operand. + + function ParseReg (paren : Integer; var flagp : Integer) : PRegExprChar; + // regular expression, i.e. main body or parenthesized thing + + function ParseBranch (var flagp : Integer) : PRegExprChar; + // one alternative of an | operator + + function ParsePiece (var flagp : Integer) : PRegExprChar; + // something followed by possible [*+?] + + function ParseAtom (var flagp : Integer) : PRegExprChar; + // the lowest level + + function GetCompilerErrorPos : Integer; + // current pos in r.e. - for error hanling + + {$IFDEF UseFirstCharSet} //###0.929 + procedure FillFirstCharSet (prog : PRegExprChar); + {$ENDIF} + + {===================== Mathing section ===================} + function regrepeat (p : PRegExprChar; AMax : Integer) : Integer; + // repeatedly match something simple, report how many + + function regnext (p : PRegExprChar) : PRegExprChar; + // dig the "next" pointer out of a node + + function MatchPrim (prog : PRegExprChar) : Boolean; + // recursively matching routine + + function ExecPrim (AOffset: Integer) : Boolean; + // Exec for stored InputString + + {$IFDEF RegExpPCodeDump} + function DumpOp (op : REChar) : RegExprString; + {$ENDIF} + + function GetSubExprMatchCount : Integer; + function GetMatchPos (Idx : Integer) : Integer; + function GetMatchLen (Idx : Integer) : Integer; + function GetMatch (Idx : Integer) : RegExprString; + + function GetInputString : RegExprString; + procedure SetInputString (const AInputString : RegExprString); + + {$IFNDEF UseSetOfChar} + function StrScanCI (s : PRegExprChar; ch : REChar) : PRegExprChar; //###0.928 + {$ENDIF} + + procedure SetLineSeparators (const AStr : RegExprString); + procedure SetLinePairedSeparator (const AStr : RegExprString); + function GetLinePairedSeparator : RegExprString; + + public + constructor Create; + destructor Destroy; override; + + class function VersionMajor : Integer; //###0.944 + class function VersionMinor : Integer; //###0.944 + + property Expression : RegExprString read GetExpression write SetExpression; + // Regular expression. + // For optimization, TRegExpr will automatically compiles it into 'P-code' + // (You can see it with help of Dump method) and stores in internal + // structures. Real [re]compilation occures only when it really needed - + // while calling Exec[Next], Substitute, Dump, etc + // and only if Expression or other P-code affected properties was changed + // after last [re]compilation. + // If any errors while [re]compilation occures, Error method is called + // (by default Error raises exception - see below) + + property ModifierStr : RegExprString read GetModifierStr write SetModifierStr; + // Set/get default values of r.e.syntax modifiers. Modifiers in + // r.e. (?ismx-ismx) will replace this default values. + // If you try to set unsupported modifier, Error will be called + // (by defaul Error raises exception ERegExpr). + + property ModifierI : Boolean index 1 read GetModifier write SetModifier; + // Modifier /i - caseinsensitive, initialized from RegExprModifierI + + property ModifierR : Boolean index 2 read GetModifier write SetModifier; + // Modifier /r - use r.e.syntax extended for russian, + // (was property ExtSyntaxEnabled in previous versions) + // If True, then à-ÿ additional include russian letter '¸', + // À-ß additional include '¨', and à-ß include all russian symbols. + // You have to turn it off if it may interfere with you national alphabet. + // , initialized from RegExprModifierR + + property ModifierS : Boolean index 3 read GetModifier write SetModifier; + // Modifier /s - '.' works as any char (else as [^\n]), + // , initialized from RegExprModifierS + + property ModifierG : Boolean index 4 read GetModifier write SetModifier; + // Switching off modifier /g switchs all operators in + // non-greedy style, so if ModifierG = False, then + // all '*' works as '*?', all '+' as '+?' and so on. + // , initialized from RegExprModifierG + + property ModifierM : Boolean index 5 read GetModifier write SetModifier; + // Treat string as multiple lines. That is, change `^' and `$' from + // matching at only the very start or end of the string to the start + // or end of any line anywhere within the string. + // , initialized from RegExprModifierM + + property ModifierX : Boolean index 6 read GetModifier write SetModifier; + // Modifier /x - eXtended syntax, allow r.e. text formatting, + // see description in the help. Initialized from RegExprModifierX + + function Exec (const AInputString : RegExprString) : Boolean; {$IFDEF OverMeth} overload; + {$IFNDEF FPC} // I do not know why FreePascal cannot overload methods with empty param list + function Exec : Boolean; overload; //###0.949 + {$ENDIF} + function Exec (AOffset: Integer) : Boolean; overload; //###0.949 + {$ENDIF} + // match a programm against a string AInputString + // !!! Exec store AInputString into InputString property + // For Delphi 5 and higher available overloaded versions - first without + // parameter (uses already assigned to InputString property value) + // and second that has Integer parameter and is same as ExecPos + + function ExecNext : Boolean; + // find next match: + // ExecNext; + // works same as + // if MatchLen [0] = 0 then ExecPos (MatchPos [0] + 1) + // else ExecPos (MatchPos [0] + MatchLen [0]); + // but it's more simpler ! + // Raises exception if used without preceeding SUCCESSFUL call to + // Exec* (Exec, ExecPos, ExecNext). So You always must use something like + // if Exec (InputString) then repeat { proceed results} until not ExecNext; + + function ExecPos (AOffset: Integer {$IFDEF DefParam}= 1{$ENDIF}) : Boolean; + // find match for InputString starting from AOffset position + // (AOffset=1 - first char of InputString) + + property InputString : RegExprString read GetInputString write SetInputString; + // returns current input string (from last Exec call or last assign + // to this property). + // Any assignment to this property clear Match* properties ! + + function Substitute (const ATemplate : RegExprString) : RegExprString; + // Returns ATemplate with '$&' or '$0' replaced by whole r.e. + // occurence and '$n' replaced by occurence of subexpression #n. + // Since v.0.929 '$' used instead of '\' (for future extensions + // and for more Perl-compatibility) and accept more then one digit. + // If you want place into template raw '$' or '\', use prefix '\' + // Example: '1\$ is $2\\rub\\' -> '1$ is \rub\' + // If you want to place raw digit after '$n' you must delimit + // n with curly braces '{}'. + // Example: 'a$12bc' -> 'abc' + // 'a${1}2bc' -> 'a2bc'. + + procedure Split (AInputStr : RegExprString; APieces : TStrings); + // Split AInputStr into APieces by r.e. occurencies + // Internally calls Exec[Next] + + function Replace (AInputStr : RegExprString; + const AReplaceStr : RegExprString; + AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) //###0.946 + : RegExprString; {$IFDEF OverMeth} overload; + function Replace (AInputStr : RegExprString; + AReplaceFunc : TRegExprReplaceFunction) + : RegExprString; overload; + {$ENDIF} + function ReplaceEx (AInputStr : RegExprString; + AReplaceFunc : TRegExprReplaceFunction) + : RegExprString; + // Returns AInputStr with r.e. occurencies replaced by AReplaceStr + // If AUseSubstitution is True, then AReplaceStr will be used + // as template for Substitution methods. + // For example: + // Expression := '({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*'; + // Replace ('BLOCK( test1)', 'def "$1" value "$2"', True); + // will return: def 'BLOCK' value 'test1' + // Replace ('BLOCK( test1)', 'def "$1" value "$2"') + // will return: def "$1" value "$2" + // Internally calls Exec[Next] + // Overloaded version and ReplaceEx operate with call-back function, + // so You can implement really complex functionality. + + property SubExprMatchCount : Integer read GetSubExprMatchCount; + // Number of subexpressions has been found in last Exec* call. + // If there are no subexpr. but whole expr was found (Exec* returned True), + // then SubExprMatchCount=0, if no subexpressions nor whole + // r.e. found (Exec* returned False) then SubExprMatchCount=-1. + // Note, that some subexpr. may be not found and for such + // subexpr. MathPos=MatchLen=-1 and Match=''. + // For example: Expression := '(1)?2(3)?'; + // Exec ('123'): SubExprMatchCount=2, Match[0]='123', [1]='1', [2]='3' + // Exec ('12'): SubExprMatchCount=1, Match[0]='12', [1]='1' + // Exec ('23'): SubExprMatchCount=2, Match[0]='23', [1]='', [2]='3' + // Exec ('2'): SubExprMatchCount=0, Match[0]='2' + // Exec ('7') - return False: SubExprMatchCount=-1 + + property MatchPos [Idx : Integer] : Integer read GetMatchPos; + // pos of entrance subexpr. #Idx into tested in last Exec* + // string. First subexpr. have Idx=1, last - MatchCount, + // whole r.e. have Idx=0. + // Returns -1 if in r.e. no such subexpr. or this subexpr. + // not found in input string. + + property MatchLen [Idx : Integer] : Integer read GetMatchLen; + // len of entrance subexpr. #Idx r.e. into tested in last Exec* + // string. First subexpr. have Idx=1, last - MatchCount, + // whole r.e. have Idx=0. + // Returns -1 if in r.e. no such subexpr. or this subexpr. + // not found in input string. + // Remember - MatchLen may be 0 (if r.e. match empty string) ! + + property Match [Idx : Integer] : RegExprString read GetMatch; + // == copy (InputString, MatchPos [Idx], MatchLen [Idx]) + // Returns '' if in r.e. no such subexpr. or this subexpr. + // not found in input string. + + function LastError : Integer; + // Returns ID of last error, 0 if no errors (unusable if + // Error method raises exception) and clear internal status + // into 0 (no errors). + + function ErrorMsg (AErrorID : Integer) : RegExprString; virtual; + // Returns Error message for error with ID = AErrorID. + + property CompilerErrorPos : Integer read GetCompilerErrorPos; + // Returns pos in r.e. there compiler stopped. + // Usefull for error diagnostics + + property SpaceChars : RegExprString read fSpaceChars write fSpaceChars; //###0.927 + // Contains chars, treated as /s (initially filled with RegExprSpaceChars + // global constant) + + property WordChars : RegExprString read fWordChars write fWordChars; //###0.929 + // Contains chars, treated as /w (initially filled with RegExprWordChars + // global constant) + + property LineSeparators : RegExprString read FLineSeparators write SetLineSeparators; //###0.941 + // line separators (like \n in Unix) + + property LinePairedSeparator : RegExprString read GetLinePairedSeparator write SetLinePairedSeparator; //###0.941 + // paired line separator (like \r\n in DOS and Windows). + // must contain exactly two chars or no chars at all + + class function InvertCaseFunction (const Ch : REChar) : REChar; + // Converts Ch into upper case if it in lower case or in lower + // if it in upper (uses current system local setings) + + property InvertCase : TRegExprInvertCaseFunction read fInvertCase write fInvertCase; //##0.935 + // Set this property if you want to override case-insensitive functionality. + // Create set it to RegExprInvertCaseFunction (InvertCaseFunction by default) + + procedure Compile; //###0.941 + // [Re]compile r.e. Usefull for example for GUI r.e. editors (to check + // all properties validity). + + {$IFDEF RegExpPCodeDump} + function Dump : RegExprString; + // dump a compiled regexp in vaguely comprehensible form + {$ENDIF} + end; + + ERegExpr = class (Exception) + public + ErrorCode : Integer; + CompilerErrorPos : Integer; + end; + +const + RegExprInvertCaseFunction : TRegExprInvertCaseFunction = {$IFDEF FPC} nil {$ELSE} TRegExpr.InvertCaseFunction{$ENDIF}; + // defaul for InvertCase property + +function ExecRegExpr (const ARegExpr, AInputStr : RegExprString) : Boolean; +// True if string AInputString match regular expression ARegExpr +// ! will raise exeption if syntax errors in ARegExpr + +procedure SplitRegExpr (const ARegExpr, AInputStr : RegExprString; APieces : TStrings); +// Split AInputStr into APieces by r.e. ARegExpr occurencies + +function ReplaceRegExpr (const ARegExpr, AInputStr, AReplaceStr : RegExprString; + AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; //###0.947 +// Returns AInputStr with r.e. occurencies replaced by AReplaceStr +// If AUseSubstitution is True, then AReplaceStr will be used +// as template for Substitution methods. +// For example: +// ReplaceRegExpr ('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*', +// 'BLOCK( test1)', 'def "$1" value "$2"', True) +// will return: def 'BLOCK' value 'test1' +// ReplaceRegExpr ('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*', +// 'BLOCK( test1)', 'def "$1" value "$2"') +// will return: def "$1" value "$2" + +function QuoteRegExprMetaChars (const AStr : RegExprString) : RegExprString; +// Replace all metachars with its safe representation, +// for example 'abc$cd.(' converts into 'abc\$cd\.\(' +// This function usefull for r.e. autogeneration from +// user input + +function RegExprSubExpressions (const ARegExpr : string; + ASubExprs : TStrings; AExtendedSyntax : Boolean{$IFDEF DefParam}= False{$ENDIF}) : Integer; +// Makes list of subexpressions found in ARegExpr r.e. +// In ASubExps every item represent subexpression, +// from first to last, in format: +// String - subexpression text (without '()') +// low word of Object - starting position in ARegExpr, including '(' +// if exists! (first position is 1) +// high word of Object - length, including starting '(' and ending ')' +// if exist! +// AExtendedSyntax - must be True if modifier /m will be On while +// using the r.e. +// Usefull for GUI editors of r.e. etc (You can find example of using +// in TestRExp.dpr project) +// Returns +// 0 Success. No unbalanced brackets was found; +// -1 There are not enough closing brackets ')'; +// -(n+1) At position n was found opening '[' without //###0.942 +// corresponding closing ']'; +// n At position n was found closing bracket ')' without +// corresponding opening '('. +// If Result <> 0, then ASubExpr can contain empty items or illegal ones + + +implementation + +uses +{$IFDEF MSWINDOWS} + Windows; // CharUpper/Lower +{$ELSE} + Libc; //Qt.pas from Borland does not expose char handling functions +{$ENDIF} + +const + TRegExprVersionMajor : Integer = 0; + TRegExprVersionMinor : Integer = 952; + // TRegExpr.VersionMajor/Minor return values of this constants + + MaskModI = 1; // modifier /i bit in fModifiers + MaskModR = 2; // -"- /r + MaskModS = 4; // -"- /s + MaskModG = 8; // -"- /g + MaskModM = 16; // -"- /m + MaskModX = 32; // -"- /x + +{$IFDEF SynRegUniCode} + XIgnoredChars = ' '#9#$d#$a; +{$ELSE} + XIgnoredChars = [' ', #9, #$d, #$a]; +{$ENDIF} + +{=============================================================} +{=================== UnicodeString functions ====================} +{=============================================================} + +{$IFDEF SynRegUniCode} + +function StrPCopy (Dest: PRegExprChar; const Source: RegExprString): PRegExprChar; +var + i, Len : Integer; +begin + Len := length (Source); //###0.932 + for i := 1 to Len do + Dest [i - 1] := Source [i]; + Dest [Len] := #0; + Result := Dest; +end; { of function StrPCopy +--------------------------------------------------------------} + +function StrLCopy (Dest, Source: PRegExprChar; MaxLen: Cardinal): PRegExprChar; +var + i: Integer; +begin + for i := 0 to MaxLen - 1 do + Dest [i] := Source [i]; + Result := Dest; +end; { of function StrLCopy +--------------------------------------------------------------} + +function StrLen (Str: PRegExprChar): Cardinal; +begin + Result := 0; + while Str [result] <> #0 do + Inc (Result); +end; { of function StrLen +--------------------------------------------------------------} + +function StrPos (Str1, Str2: PRegExprChar): PRegExprChar; +var + n: Integer; +begin + Result := nil; + n := Pos (RegExprString (Str2), RegExprString (Str1)); + if n = 0 then + Exit; + Result := Str1 + n - 1; +end; { of function StrPos +--------------------------------------------------------------} + +function StrLComp (Str1, Str2: PRegExprChar; MaxLen: Cardinal): Integer; +var + S1, S2: RegExprString; +begin + S1 := Str1; + S2 := Str2; + if Copy (S1, 1, MaxLen) > Copy (S2, 1, MaxLen) then + Result := 1 + else + if Copy (S1, 1, MaxLen) < Copy (S2, 1, MaxLen) then + Result := -1 + else + Result := 0; +end; { function StrLComp +--------------------------------------------------------------} + +function StrScan (Str: PRegExprChar; Chr: WideChar): PRegExprChar; +begin + Result := nil; + while (Str^ <> #0) and (Str^ <> Chr) do + Inc (Str); + if (Str^ <> #0) then + Result := Str; +end; { of function StrScan +--------------------------------------------------------------} + +{$ENDIF} + + +{=============================================================} +{===================== Global functions ======================} +{=============================================================} + +function ExecRegExpr (const ARegExpr, AInputStr : RegExprString) : Boolean; +var + r : TRegExpr; +begin + r := TRegExpr.Create; + try + r.Expression := ARegExpr; + Result := r.Exec (AInputStr); + finally + r.Free; + end; +end; { of function ExecRegExpr +--------------------------------------------------------------} + +procedure SplitRegExpr (const ARegExpr, AInputStr : RegExprString; APieces : TStrings); +var r : TRegExpr; +begin + APieces.Clear; + r := TRegExpr.Create; + try + r.Expression := ARegExpr; + r.Split (AInputStr, APieces); + finally + r.Free; + end; +end; { of procedure SplitRegExpr +--------------------------------------------------------------} + +function ReplaceRegExpr (const ARegExpr, AInputStr, AReplaceStr : RegExprString; + AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; +begin + with TRegExpr.Create do + try + Expression := ARegExpr; + Result := Replace (AInputStr, AReplaceStr, AUseSubstitution); + finally + Free; + end; +end; { of function ReplaceRegExpr +--------------------------------------------------------------} + +function QuoteRegExprMetaChars (const AStr : RegExprString) : RegExprString; +const + RegExprMetaSet : RegExprString = '^$.[()|?+*'+EscChar+'{' + + ']}'; // - this last are additional to META. + // Very similar to META array, but slighly changed. + // !Any changes in META array must be synchronized with this set. +var + i, i0, Len : Integer; +begin + Result := ''; + Len := length (AStr); + i := 1; + i0 := i; + while i <= Len do + begin + if Pos (AStr [i], RegExprMetaSet) > 0 then + begin + Result := Result + System.Copy (AStr, i0, i - i0) + + EscChar + AStr [i]; + i0 := i + 1; + end; + inc (i); + end; + Result := Result + System.Copy (AStr, i0, MaxInt); // Tail +end; { of function QuoteRegExprMetaChars +--------------------------------------------------------------} + +function RegExprSubExpressions (const ARegExpr : string; + ASubExprs : TStrings; AExtendedSyntax : Boolean{$IFDEF DefParam}= False{$ENDIF}) : Integer; +type + TStackItemRec = record //###0.945 + SubExprIdx : Integer; + StartPos : Integer; + end; + TStackArray = packed array [0 .. NSUBEXPMAX - 1] of TStackItemRec; +var + Len, SubExprLen : Integer; + i, i0 : Integer; + Modif : Integer; + Stack : ^TStackArray; //###0.945 + StackIdx, StackSz : Integer; +begin + Result := 0; // no unbalanced brackets found at this very moment + + ASubExprs.Clear; // I don't think that adding to non empty list + // can be usefull, so I simplified algorithm to work only with empty list + + Len := length (ARegExpr); // some optimization tricks + + // first we have to calculate number of subexpression to reserve + // space in Stack array (may be we'll reserve more then need, but + // it's faster then memory reallocation during parsing) + StackSz := 1; // add 1 for entire r.e. + for i := 1 to Len do + if ARegExpr [i] = '(' then + inc (StackSz); +// SetLength (Stack, StackSz); //###0.945 + GetMem (Stack, SizeOf (TStackItemRec) * StackSz); + try + StackIdx := 0; + i := 1; + while (i <= Len) do + begin + case ARegExpr [i] of + '(': + begin + if (i < Len) and (ARegExpr [i + 1] = '?') then + begin + // this is not subexpression, but comment or other + // Perl extension. We must check is it (?ismxrg-ismxrg) + // and change AExtendedSyntax if /x is changed. + inc (i, 2); // skip '(?' + i0 := i; + while (i <= Len) and (ARegExpr [i] <> ')') do + inc (i); + if i > Len then + Result := -1 // unbalansed '(' + else + if TRegExpr.ParseModifiersStr (System.Copy (ARegExpr, i, i - i0), Modif) then + AExtendedSyntax := (Modif and MaskModX) <> 0; + end + else + begin // subexpression starts + ASubExprs.Add (''); // just reserve space + with Stack [StackIdx] do + begin + SubExprIdx := ASubExprs.Count - 1; + StartPos := i; + end; + inc (StackIdx); + end; + end; + ')': + begin + if StackIdx = 0 then + Result := i // unbalanced ')' + else + begin + dec (StackIdx); + with Stack [StackIdx] do + begin + SubExprLen := i - StartPos + 1; + ASubExprs.Objects [SubExprIdx] := + TObject (StartPos or (SubExprLen shL 16)); + ASubExprs [SubExprIdx] := System.Copy ( + ARegExpr, StartPos + 1, SubExprLen - 2); // add without brackets + end; + end; + end; + EscChar: + inc (i); // skip quoted symbol + '[': + begin + // we have to skip character ranges at once, because they can + // contain '#', and '#' in it must NOT be recognized as eXtended + // comment beginning! + i0 := i; + inc (i); + if ARegExpr [i] = ']' // cannot be 'emty' ranges - this interpretes + then inc (i); // as ']' by itself + while (i <= Len) and (ARegExpr [i] <> ']') do + if ARegExpr [i] = EscChar then + inc (i, 2) // skip 'escaped' char to prevent stopping at '\]' + else + inc (i); + if (i > Len) or (ARegExpr [i] <> ']') then + Result := - (i0 + 1); // unbalansed '[' + end; + '#': + if AExtendedSyntax then + begin + // skip eXtended comments + while (i <= Len) and (ARegExpr [i] <> #$d) and (ARegExpr [i] <> #$a) + // do not use [#$d, #$a] due to UniCode compatibility + do inc (i); + while (i + 1 <= Len) and ((ARegExpr [i + 1] = #$d) or (ARegExpr [i + 1] = #$a)) + do inc (i); // attempt to work with different kinds of line separators + // now we are at the line separator that must be skipped. + end; + // here is no 'else' clause - we simply skip ordinary chars + end; // of case + inc (i); // skip scanned char + // ! can move after Len due to skipping quoted symbol + end; + + // check brackets balance + if StackIdx <> 0 then + Result := -1; // unbalansed '(' + + // check if entire r.e. added + if (ASubExprs.Count = 0) + or ((Integer (ASubExprs.Objects [0]) and $FFFF) <> 1) + or (((Integer (ASubExprs.Objects [0]) shr 16) and $FFFF) <> Len) + // whole r.e. wasn't added because it isn't bracketed + // well, we add it now: + then ASubExprs.InsertObject (0, ARegExpr, TObject ((Len ShL 16) or 1)); + + finally + FreeMem (Stack); + end; +end; { of function RegExprSubExpressions +--------------------------------------------------------------} + + + +const + MAGIC = TREOp (216);// programm signature + +// name opcode opnd? meaning + EEND = TREOp (0); // - End of program + BOL = TREOp (1); // - Match "" at beginning of line + EOL = TREOp (2); // - Match "" at end of line + ANY = TREOp (3); // - Match any one character + ANYOF = TREOp (4); // Str Match any character in string Str + ANYBUT = TREOp (5); // Str Match any char. not in string Str + BRANCH = TREOp (6); // Node Match this alternative, or the next + BACK = TREOp (7); // - Jump backward (Next < 0) + EXACTLY = TREOp (8); // Str Match string Str + NOTHING = TREOp (9); // - Match empty string + STAR = TREOp (10); // Node Match this (simple) thing 0 or more times + PLUS = TREOp (11); // Node Match this (simple) thing 1 or more times + ANYDIGIT = TREOp (12); // - Match any digit (equiv [0-9]) + NOTDIGIT = TREOp (13); // - Match not digit (equiv [0-9]) + ANYLETTER = TREOp (14); // - Match any letter from property WordChars + NOTLETTER = TREOp (15); // - Match not letter from property WordChars + ANYSPACE = TREOp (16); // - Match any space char (see property SpaceChars) + NOTSPACE = TREOp (17); // - Match not space char (see property SpaceChars) + BRACES = TREOp (18); // Node,Min,Max Match this (simple) thing from Min to Max times. + // Min and Max are TREBracesArg + COMMENT = TREOp (19); // - Comment ;) + EXACTLYCI = TREOp (20); // Str Match string Str case insensitive + ANYOFCI = TREOp (21); // Str Match any character in string Str, case insensitive + ANYBUTCI = TREOp (22); // Str Match any char. not in string Str, case insensitive + LOOPENTRY = TREOp (23); // Node Start of loop (Node - LOOP for this loop) + LOOP = TREOp (24); // Node,Min,Max,LoopEntryJmp - back jump for LOOPENTRY. + // Min and Max are TREBracesArg + // Node - next node in sequence, + // LoopEntryJmp - associated LOOPENTRY node addr + ANYOFTINYSET= TREOp (25); // Chrs Match any one char from Chrs (exactly TinySetLen chars) + ANYBUTTINYSET=TREOp (26); // Chrs Match any one char not in Chrs (exactly TinySetLen chars) + ANYOFFULLSET= TREOp (27); // Set Match any one char from set of char + // - very fast (one CPU instruction !) but takes 32 bytes of p-code + BSUBEXP = TREOp (28); // Idx Match previously matched subexpression #Idx (stored as REChar) //###0.936 + BSUBEXPCI = TREOp (29); // Idx -"- in case-insensitive mode + + // Non-Greedy Style Ops //###0.940 + STARNG = TREOp (30); // Same as START but in non-greedy mode + PLUSNG = TREOp (31); // Same as PLUS but in non-greedy mode + BRACESNG = TREOp (32); // Same as BRACES but in non-greedy mode + LOOPNG = TREOp (33); // Same as LOOP but in non-greedy mode + + // Multiline mode \m + BOLML = TREOp (34); // - Match "" at beginning of line + EOLML = TREOp (35); // - Match "" at end of line + ANYML = TREOp (36); // - Match any one character + + // Word boundary + BOUND = TREOp (37); // Match "" between words //###0.943 + NOTBOUND = TREOp (38); // Match "" not between words //###0.943 + + // !!! Change OPEN value if you add new opcodes !!! + + OPEN = TREOp (39); // - Mark this point in input as start of \n + // OPEN + 1 is \1, etc. + CLOSE = TREOp (ord (OPEN) + NSUBEXP); + // - Analogous to OPEN. + + // !!! Don't add new OpCodes after CLOSE !!! + +// We work with p-code thru pointers, compatible with PRegExprChar. +// Note: all code components (TRENextOff, TREOp, TREBracesArg, etc) +// must have lengths that can be divided by SizeOf (REChar) ! +// A node is TREOp of opcode followed Next "pointer" of TRENextOff type. +// The Next is a offset from the opcode of the node containing it. +// An operand, if any, simply follows the node. (Note that much of +// the code generation knows about this implicit relationship!) +// Using TRENextOff=Integer speed up p-code processing. + +// Opcodes description: +// +// BRANCH The set of branches constituting a single choice are hooked +// together with their "next" pointers, since precedence prevents +// anything being concatenated to any individual branch. The +// "next" pointer of the last BRANCH in a choice points to the +// thing following the whole choice. This is also where the +// final "next" pointer of each individual branch points; each +// branch starts with the operand node of a BRANCH node. +// BACK Normal "next" pointers all implicitly point forward; BACK +// exists to make loop structures possible. +// STAR,PLUS,BRACES '?', and complex '*' and '+', are implemented as +// circular BRANCH structures using BACK. Complex '{min,max}' +// - as pair LOOPENTRY-LOOP (see below). Simple cases (one +// character per match) are implemented with STAR, PLUS and +// BRACES for speed and to minimize recursive plunges. +// LOOPENTRY,LOOP {min,max} are implemented as special pair +// LOOPENTRY-LOOP. Each LOOPENTRY initialize loopstack for +// current level. +// OPEN,CLOSE are numbered at compile time. + + +{=============================================================} +{================== Error handling section ===================} +{=============================================================} + +const + reeOk = 0; + reeCompNullArgument = 100; + reeCompRegexpTooBig = 101; + reeCompParseRegTooManyBrackets = 102; + reeCompParseRegUnmatchedBrackets = 103; + reeCompParseRegUnmatchedBrackets2 = 104; + reeCompParseRegJunkOnEnd = 105; + reePlusStarOperandCouldBeEmpty = 106; + reeNestedSQP = 107; + reeBadHexDigit = 108; + reeInvalidRange = 109; + reeParseAtomTrailingBackSlash = 110; + reeNoHexCodeAfterBSlashX = 111; + reeHexCodeAfterBSlashXTooBig = 112; + reeUnmatchedSqBrackets = 113; + reeInternalUrp = 114; + reeQPSBFollowsNothing = 115; + reeTrailingBackSlash = 116; + reeRarseAtomInternalDisaster = 119; + reeBRACESArgTooBig = 122; + reeBracesMinParamGreaterMax = 124; + reeUnclosedComment = 125; + reeComplexBracesNotImplemented = 126; + reeUrecognizedModifier = 127; + reeBadLinePairedSeparator = 128; + reeRegRepeatCalledInappropriately = 1000; + reeMatchPrimMemoryCorruption = 1001; + reeMatchPrimCorruptedPointers = 1002; + reeNoExpression = 1003; + reeCorruptedProgram = 1004; + reeNoInpitStringSpecified = 1005; + reeOffsetMustBeGreaterThen0 = 1006; + reeExecNextWithoutExec = 1007; + reeGetInputStringWithoutInputString = 1008; + reeDumpCorruptedOpcode = 1011; + reeModifierUnsupported = 1013; + reeLoopStackExceeded = 1014; + reeLoopWithoutEntry = 1015; + reeBadPCodeImported = 2000; + +function TRegExpr.ErrorMsg (AErrorID : Integer) : RegExprString; +begin + case AErrorID of + reeOk: Result := 'No errors'; + reeCompNullArgument: Result := 'TRegExpr(comp): Null Argument'; + reeCompRegexpTooBig: Result := 'TRegExpr(comp): Regexp Too Big'; + reeCompParseRegTooManyBrackets: Result := 'TRegExpr(comp): ParseReg Too Many ()'; + reeCompParseRegUnmatchedBrackets: Result := 'TRegExpr(comp): ParseReg Unmatched ()'; + reeCompParseRegUnmatchedBrackets2: Result := 'TRegExpr(comp): ParseReg Unmatched ()'; + reeCompParseRegJunkOnEnd: Result := 'TRegExpr(comp): ParseReg Junk On End'; + reePlusStarOperandCouldBeEmpty: Result := 'TRegExpr(comp): *+ Operand Could Be Empty'; + reeNestedSQP: Result := 'TRegExpr(comp): Nested *?+'; + reeBadHexDigit: Result := 'TRegExpr(comp): Bad Hex Digit'; + reeInvalidRange: Result := 'TRegExpr(comp): Invalid [] Range'; + reeParseAtomTrailingBackSlash: Result := 'TRegExpr(comp): Parse Atom Trailing \'; + reeNoHexCodeAfterBSlashX: Result := 'TRegExpr(comp): No Hex Code After \x'; + reeHexCodeAfterBSlashXTooBig: Result := 'TRegExpr(comp): Hex Code After \x Is Too Big'; + reeUnmatchedSqBrackets: Result := 'TRegExpr(comp): Unmatched []'; + reeInternalUrp: Result := 'TRegExpr(comp): Internal Urp'; + reeQPSBFollowsNothing: Result := 'TRegExpr(comp): ?+*{ Follows Nothing'; + reeTrailingBackSlash: Result := 'TRegExpr(comp): Trailing \'; + reeRarseAtomInternalDisaster: Result := 'TRegExpr(comp): RarseAtom Internal Disaster'; + reeBRACESArgTooBig: Result := 'TRegExpr(comp): BRACES Argument Too Big'; + reeBracesMinParamGreaterMax: Result := 'TRegExpr(comp): BRACE Min Param Greater then Max'; + reeUnclosedComment: Result := 'TRegExpr(comp): Unclosed (?#Comment)'; + reeComplexBracesNotImplemented: Result := 'TRegExpr(comp): If you want take part in beta-testing BRACES ''{min,max}'' and non-greedy ops ''*?'', ''+?'', ''??'' for complex cases - remove ''.'' from {.$DEFINE ComplexBraces}'; + reeUrecognizedModifier: Result := 'TRegExpr(comp): Urecognized Modifier'; + reeBadLinePairedSeparator: Result := 'TRegExpr(comp): LinePairedSeparator must countain two different chars or no chars at all'; + + reeRegRepeatCalledInappropriately: Result := 'TRegExpr(exec): RegRepeat Called Inappropriately'; + reeMatchPrimMemoryCorruption: Result := 'TRegExpr(exec): MatchPrim Memory Corruption'; + reeMatchPrimCorruptedPointers: Result := 'TRegExpr(exec): MatchPrim Corrupted Pointers'; + reeNoExpression: Result := 'TRegExpr(exec): Not Assigned Expression Property'; + reeCorruptedProgram: Result := 'TRegExpr(exec): Corrupted Program'; + reeNoInpitStringSpecified: Result := 'TRegExpr(exec): No Input String Specified'; + reeOffsetMustBeGreaterThen0: Result := 'TRegExpr(exec): Offset Must Be Greater Then 0'; + reeExecNextWithoutExec: Result := 'TRegExpr(exec): ExecNext Without Exec[Pos]'; + reeGetInputStringWithoutInputString: Result := 'TRegExpr(exec): GetInputString Without InputString'; + reeDumpCorruptedOpcode: Result := 'TRegExpr(dump): Corrupted Opcode'; + reeLoopStackExceeded: Result := 'TRegExpr(exec): Loop Stack Exceeded'; + reeLoopWithoutEntry: Result := 'TRegExpr(exec): Loop Without LoopEntry !'; + + reeBadPCodeImported: Result := 'TRegExpr(misc): Bad p-code imported'; + else + Result := 'Unknown error'; + end; +end; { of procedure TRegExpr.Error +--------------------------------------------------------------} + +function TRegExpr.LastError : Integer; +begin + Result := FLastError; + FLastError := reeOk; +end; { of function TRegExpr.LastError +--------------------------------------------------------------} + + +{=============================================================} +{===================== Common section ========================} +{=============================================================} + +class function TRegExpr.VersionMajor : Integer; //###0.944 +begin + Result := TRegExprVersionMajor; +end; { of class function TRegExpr.VersionMajor +--------------------------------------------------------------} + +class function TRegExpr.VersionMinor : Integer; //###0.944 +begin + Result := TRegExprVersionMinor; +end; { of class function TRegExpr.VersionMinor +--------------------------------------------------------------} + +constructor TRegExpr.Create; +begin + inherited; + programm := nil; + fExpression := nil; + fInputString := nil; + + regexpbeg := nil; + fExprIsCompiled := False; + + ModifierI := RegExprModifierI; + ModifierR := RegExprModifierR; + ModifierS := RegExprModifierS; + ModifierG := RegExprModifierG; + ModifierM := RegExprModifierM; //###0.940 + + SpaceChars := RegExprSpaceChars; //###0.927 + WordChars := RegExprWordChars; //###0.929 + fInvertCase := RegExprInvertCaseFunction; //###0.927 + + FLineSeparators := RegExprLineSeparators; //###0.941 + LinePairedSeparator := RegExprLinePairedSeparator; //###0.941 +end; { of constructor TRegExpr.Create +--------------------------------------------------------------} + +destructor TRegExpr.Destroy; +begin + if programm <> nil then + FreeMem (programm); + if fExpression <> nil then + FreeMem (fExpression); + if fInputString <> nil then + FreeMem (fInputString); +end; { of destructor TRegExpr.Destroy +--------------------------------------------------------------} + +class function TRegExpr.InvertCaseFunction (const Ch : REChar) : REChar; +begin + {$IFDEF SynRegUniCode} + if Ch >= #128 then + Result := Ch + else + {$ENDIF} + begin + Result := {$IFDEF FPC}AnsiUpperCase (Ch) [1]{$ELSE} {$IFDEF MSWINDOWS}REChar (CharUpper (PChar (Ch))){$ELSE}REChar (toupper (Integer (Ch))){$ENDIF} {$ENDIF}; + if Result = Ch then + Result := {$IFDEF FPC}AnsiLowerCase (Ch) [1]{$ELSE} {$IFDEF MSWINDOWS}REChar (CharLower (PChar (Ch))){$ELSE}REChar(tolower (Integer (Ch))){$ENDIF} {$ENDIF}; + end; +end; { of function TRegExpr.InvertCaseFunction +--------------------------------------------------------------} + +function TRegExpr.GetExpression : RegExprString; +begin + if fExpression <> nil then + Result := fExpression + else + Result := ''; +end; { of function TRegExpr.GetExpression +--------------------------------------------------------------} + +procedure TRegExpr.SetExpression (const s : RegExprString); +var + Len : Integer; //###0.950 +begin + if (s <> fExpression) or not fExprIsCompiled then begin + fExprIsCompiled := False; + if fExpression <> nil then begin + FreeMem (fExpression); + fExpression := nil; + end; + if s <> '' then begin + Len := length (s); //###0.950 + GetMem (fExpression, (Len + 1) * SizeOf (REChar)); +// StrPCopy (fExpression, s); //###0.950 replaced due to StrPCopy limitation of 255 chars + {$IFDEF SynRegUniCode} + StrPCopy (fExpression, Copy (s, 1, Len)); //###0.950 + {$ELSE} + StrLCopy (fExpression, PRegExprChar (s), Len); //###0.950 + {$ENDIF SynRegUniCode} + + InvalidateProgramm; //###0.941 + end; + end; +end; { of procedure TRegExpr.SetExpression +--------------------------------------------------------------} + +function TRegExpr.GetSubExprMatchCount : Integer; +begin + if Assigned (fInputString) then begin + Result := NSUBEXP - 1; + while (Result > 0) and ((startp [Result] = nil) + or (endp [Result] = nil)) + do dec (Result); + end + else Result := -1; +end; { of function TRegExpr.GetSubExprMatchCount +--------------------------------------------------------------} + +function TRegExpr.GetMatchPos (Idx : Integer) : Integer; +begin + if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) + and Assigned (startp [Idx]) and Assigned (endp [Idx]) then begin + Result := (startp [Idx] - fInputString) + 1; + end + else Result := -1; +end; { of function TRegExpr.GetMatchPos +--------------------------------------------------------------} + +function TRegExpr.GetMatchLen (Idx : Integer) : Integer; +begin + if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) + and Assigned (startp [Idx]) and Assigned (endp [Idx]) then begin + Result := endp [Idx] - startp [Idx]; + end + else Result := -1; +end; { of function TRegExpr.GetMatchLen +--------------------------------------------------------------} + +function TRegExpr.GetMatch (Idx : Integer) : RegExprString; +begin + if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) + and Assigned (startp [Idx]) and Assigned (endp [Idx]) + //then Result := copy (fInputString, MatchPos [Idx], MatchLen [Idx]) //###0.929 + then SetString (Result, startp [idx], endp [idx] - startp [idx]) + else Result := ''; +end; { of function TRegExpr.GetMatch +--------------------------------------------------------------} + +function TRegExpr.GetModifierStr : RegExprString; +begin + Result := '-'; + + if ModifierI + then Result := 'i' + Result + else Result := Result + 'i'; + if ModifierR + then Result := 'r' + Result + else Result := Result + 'r'; + if ModifierS + then Result := 's' + Result + else Result := Result + 's'; + if ModifierG + then Result := 'g' + Result + else Result := Result + 'g'; + if ModifierM + then Result := 'm' + Result + else Result := Result + 'm'; + if ModifierX + then Result := 'x' + Result + else Result := Result + 'x'; + + if Result [length (Result)] = '-' // remove '-' if all modifiers are 'On' + then System.Delete (Result, length (Result), 1); +end; { of function TRegExpr.GetModifierStr +--------------------------------------------------------------} + +class function TRegExpr.ParseModifiersStr (const AModifiers : RegExprString; + var AModifiersInt: Integer) : Boolean; +// !!! Be carefull - this is class function and must not use object instance fields +var + i : Integer; + IsOn : Boolean; + Mask : Integer; +begin + Result := True; + IsOn := True; + {$IFNDEF SYN_COMPILER_24_UP} + {$IFDEF WIN32} + Mask := 0; // prevent compiler warning + {$ENDIF} + {$ENDIF} + for i := 1 to length (AModifiers) do + if AModifiers [i] = '-' + then IsOn := False + else begin + if Pos (AModifiers [i], 'iI') > 0 + then Mask := MaskModI + else if Pos (AModifiers [i], 'rR') > 0 + then Mask := MaskModR + else if Pos (AModifiers [i], 'sS') > 0 + then Mask := MaskModS + else if Pos (AModifiers [i], 'gG') > 0 + then Mask := MaskModG + else if Pos (AModifiers [i], 'mM') > 0 + then Mask := MaskModM + else if Pos (AModifiers [i], 'xX') > 0 + then Mask := MaskModX + else begin + Result := False; + Exit; + end; + if IsOn + then AModifiersInt := AModifiersInt or Mask + else AModifiersInt := AModifiersInt and not Mask; + end; +end; { of function TRegExpr.ParseModifiersStr +--------------------------------------------------------------} + +procedure TRegExpr.SetModifierStr (const AModifiers : RegExprString); +begin + if not ParseModifiersStr (AModifiers, fModifiers) + then Error (reeModifierUnsupported); +end; { of procedure TRegExpr.SetModifierStr +--------------------------------------------------------------} + +function TRegExpr.GetModifier (AIndex : Integer) : Boolean; +var + Mask : Integer; +begin + Result := False; + case AIndex of + 1: Mask := MaskModI; + 2: Mask := MaskModR; + 3: Mask := MaskModS; + 4: Mask := MaskModG; + 5: Mask := MaskModM; + 6: Mask := MaskModX; + else begin + Error (reeModifierUnsupported); + Exit; + end; + end; + Result := (fModifiers and Mask) <> 0; +end; { of function TRegExpr.GetModifier +--------------------------------------------------------------} + +procedure TRegExpr.SetModifier (AIndex : Integer; ASet : Boolean); +var + Mask : Integer; +begin + case AIndex of + 1: Mask := MaskModI; + 2: Mask := MaskModR; + 3: Mask := MaskModS; + 4: Mask := MaskModG; + 5: Mask := MaskModM; + 6: Mask := MaskModX; + else begin + Error (reeModifierUnsupported); + Exit; + end; + end; + if ASet + then fModifiers := fModifiers or Mask + else fModifiers := fModifiers and not Mask; +end; { of procedure TRegExpr.SetModifier +--------------------------------------------------------------} + + +{=============================================================} +{==================== Compiler section =======================} +{=============================================================} + +procedure TRegExpr.InvalidateProgramm; +begin + if programm <> nil then begin + FreeMem (programm); + programm := nil; + end; +end; { of procedure TRegExpr.InvalidateProgramm +--------------------------------------------------------------} + +procedure TRegExpr.Compile; //###0.941 +begin + if fExpression = nil then begin // No Expression assigned + Error (reeNoExpression); + Exit; + end; + CompileRegExpr (fExpression); +end; { of procedure TRegExpr.Compile +--------------------------------------------------------------} + +function TRegExpr.IsProgrammOk : Boolean; +{$IFNDEF SynRegUniCode} +var + i : Integer; + {$ENDIF} +begin + Result := False; + + // check modifiers + if fModifiers <> fProgModifiers //###0.941 + then InvalidateProgramm; + + // can we optimize line separators by using sets? + {$IFNDEF SynRegUniCode} + FLineSeparatorsSet := []; + for i := 1 to length (FLineSeparators) do + System.Include (FLineSeparatorsSet, FLineSeparators [i]); + {$ENDIF} + + // [Re]compile if needed + if programm = nil + then Compile; //###0.941 + + // check [re]compiled programm + if programm = nil + then Exit // error was set/raised by Compile (was reeExecAfterCompErr) + else if programm [0] <> MAGIC // Program corrupted. + then Error (reeCorruptedProgram) + else Result := True; +end; { of function TRegExpr.IsProgrammOk +--------------------------------------------------------------} + +procedure TRegExpr.Tail (p : PRegExprChar; val : PRegExprChar); +// set the next-pointer at the end of a node chain + var + scan : PRegExprChar; + temp : PRegExprChar; +// i : int64; + begin + if p = @regdummy + then Exit; + // Find last node. + scan := p; + REPEAT + temp := regnext (scan); + if temp = nil + then BREAK; + scan := temp; + UNTIL False; + // Set Next 'pointer' + if val < scan + then PRENextOff (scan + REOpSz)^ := - (scan - val) //###0.948 + // work around PWideChar subtraction bug (Delphi uses + // shr after subtraction to calculate widechar distance %-( ) + // so, if difference is negative we have .. the "feature" :( + // I could wrap it in $IFDEF UniCode, but I didn't because + // "P – Q computes the difference between the address given + // by P (the higher address) and the address given by Q (the + // lower address)" - Delphi help quotation. + else PRENextOff (scan + REOpSz)^ := val - scan; //###0.933 + end; { of procedure TRegExpr.Tail +--------------------------------------------------------------} + +procedure TRegExpr.OpTail (p : PRegExprChar; val : PRegExprChar); +// regtail on operand of first argument; nop if operandless + begin + // "Operandless" and "op != BRANCH" are synonymous in practice. + if (p = nil) or (p = @regdummy) or (PREOp (p)^ <> BRANCH) + then Exit; + Tail (p + REOpSz + RENextOffSz, val); //###0.933 + end; { of procedure TRegExpr.OpTail +--------------------------------------------------------------} + +function TRegExpr.EmitNode (op : TREOp) : PRegExprChar; //###0.933 +// emit a node, return location + begin + Result := regcode; + if Result <> @regdummy then begin + PREOp (regcode)^ := op; + inc (regcode, REOpSz); + PRENextOff (regcode)^ := 0; // Next "pointer" := nil + inc (regcode, RENextOffSz); + end + else inc (regsize, REOpSz + RENextOffSz); // compute code size without code generation + end; { of function TRegExpr.EmitNode +--------------------------------------------------------------} + +procedure TRegExpr.EmitC (b : REChar); +// emit a byte to code + begin + if regcode <> @regdummy then begin + regcode^ := b; + inc (regcode); + end + else inc (regsize); // Type of p-code pointer always is ^REChar + end; { of procedure TRegExpr.EmitC +--------------------------------------------------------------} + +procedure TRegExpr.InsertOperator (op : TREOp; opnd : PRegExprChar; sz : Integer); +// insert an operator in front of already-emitted operand +// Means relocating the operand. + var + src, dst, place : PRegExprChar; + i : Integer; + begin + if regcode = @regdummy then begin + inc (regsize, sz); + Exit; + end; + src := regcode; + inc (regcode, sz); + dst := regcode; + while src > opnd do begin + dec (dst); + dec (src); + dst^ := src^; + end; + place := opnd; // Op node, where operand used to be. + PREOp (place)^ := op; + inc (place, REOpSz); + for i := 1 + REOpSz to sz do begin + place^ := #0; + inc (place); + end; + end; { of procedure TRegExpr.InsertOperator +--------------------------------------------------------------} + +function strcspn (s1 : PRegExprChar; s2 : PRegExprChar) : Integer; +// find length of initial segment of s1 consisting +// entirely of characters not from s2 + var scan1, scan2 : PRegExprChar; + begin + Result := 0; + scan1 := s1; + while scan1^ <> #0 do begin + scan2 := s2; + while scan2^ <> #0 do + if scan1^ = scan2^ + then Exit + else inc (scan2); + inc (Result); + inc (scan1) + end; + end; { of function strcspn +--------------------------------------------------------------} + +const +// Flags to be passed up and down. + HASWIDTH = 01; // Known never to match nil string. + SIMPLE = 02; // Simple enough to be STAR/PLUS/BRACES operand. + SPSTART = 04; // Starts with * or +. + WORST = 0; // Worst case. + META : array [0 .. 12] of REChar = ( + '^', '$', '.', '[', '(', ')', '|', '?', '+', '*', EscChar, '{', #0); + // Any modification must be synchronized with QuoteRegExprMetaChars !!! + +{$IFDEF SynRegUniCode} + RusRangeLo : array [0 .. 33] of REChar = + (#$430,#$431,#$432,#$433,#$434,#$435,#$451,#$436,#$437, + #$438,#$439,#$43A,#$43B,#$43C,#$43D,#$43E,#$43F, + #$440,#$441,#$442,#$443,#$444,#$445,#$446,#$447, + #$448,#$449,#$44A,#$44B,#$44C,#$44D,#$44E,#$44F,#0); + RusRangeHi : array [0 .. 33] of REChar = + (#$410,#$411,#$412,#$413,#$414,#$415,#$401,#$416,#$417, + #$418,#$419,#$41A,#$41B,#$41C,#$41D,#$41E,#$41F, + #$420,#$421,#$422,#$423,#$424,#$425,#$426,#$427, + #$428,#$429,#$42A,#$42B,#$42C,#$42D,#$42E,#$42F,#0); + RusRangeLoLow = #$430{'à'}; + RusRangeLoHigh = #$44F{'ÿ'}; + RusRangeHiLow = #$410{'À'}; + RusRangeHiHigh = #$42F{'ß'}; +{$ELSE} + RusRangeLo = 'àáâãäå¸æçèéêëìíîïðñòóôõö÷øùúûüýþÿ'; + RusRangeHi = 'ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß'; + RusRangeLoLow = 'à'; + RusRangeLoHigh = 'ÿ'; + RusRangeHiLow = 'À'; + RusRangeHiHigh = 'ß'; +{$ENDIF} + +function TRegExpr.CompileRegExpr (exp : PRegExprChar) : Boolean; +// compile a regular expression into internal code +// We can't allocate space until we know how big the compiled form will be, +// but we can't compile it (and thus know how big it is) until we've got a +// place to put the code. So we cheat: we compile it twice, once with code +// generation turned off and size counting turned on, and once "for real". +// This also means that we don't allocate space until we are sure that the +// thing really will compile successfully, and we never have to move the +// code and thus invalidate pointers into it. (Note that it has to be in +// one piece because free() must be able to free it all.) +// Beware that the optimization-preparation code in here knows about some +// of the structure of the compiled regexp. + var + scan, longest : PRegExprChar; + len : cardinal; + flags : Integer; + begin + Result := False; // life too dark + + regparse := nil; // for correct error handling + regexpbeg := exp; + try + + if programm <> nil then begin + FreeMem (programm); + programm := nil; + end; + + if exp = nil then begin + Error (reeCompNullArgument); + Exit; + end; + + fProgModifiers := fModifiers; + // well, may it's paranoia. I'll check it later... !!!!!!!! + + // First pass: determine size, legality. + fCompModifiers := fModifiers; + regparse := exp; + regnpar := 1; + regsize := 0; + regcode := @regdummy; + EmitC (MAGIC); + if ParseReg (0, flags) = nil + then Exit; + + // Small enough for 2-bytes programm pointers ? + // ###0.933 no real p-code length limits now :))) +// if regsize >= 64 * 1024 then begin +// Error (reeCompRegexpTooBig); +// Exit; +// end; + + // Allocate space. + GetMem (programm, regsize * SizeOf (REChar)); + + // Second pass: emit code. + fCompModifiers := fModifiers; + regparse := exp; + regnpar := 1; + regcode := programm; + EmitC (MAGIC); + if ParseReg (0, flags) = nil + then Exit; + + // Dig out information for optimizations. + {$IFDEF UseFirstCharSet} //###0.929 + FirstCharSet := []; + FillFirstCharSet (programm + REOpSz); + {$ENDIF} + regstart := #0; // Worst-case defaults. + reganch := #0; + regmust := nil; + regmlen := 0; + scan := programm + REOpSz; // First BRANCH. + if PREOp (regnext (scan))^ = EEND then begin // Only one top-level choice. + scan := scan + REOpSz + RENextOffSz; + + // Starting-point info. + if PREOp (scan)^ = EXACTLY + then regstart := (scan + REOpSz + RENextOffSz)^ + else if PREOp (scan)^ = BOL + then inc (reganch); + + // If there's something expensive in the r.e., find the longest + // literal string that must appear and make it the regmust. Resolve + // ties in favor of later strings, since the regstart check works + // with the beginning of the r.e. and avoiding duplication + // strengthens checking. Not a strong reason, but sufficient in the + // absence of others. + if (flags and SPSTART) <> 0 then begin + longest := nil; + len := 0; + while scan <> nil do begin + if (PREOp (scan)^ = EXACTLY) + and (strlen (scan + REOpSz + RENextOffSz) >= len) then begin + longest := scan + REOpSz + RENextOffSz; + len := strlen (longest); + end; + scan := regnext (scan); + end; + regmust := longest; + regmlen := len; + end; + end; + + Result := True; + + finally begin + if not Result + then InvalidateProgramm; + regexpbeg := nil; + fExprIsCompiled := Result; //###0.944 + end; + end; + + end; { of function TRegExpr.CompileRegExpr +--------------------------------------------------------------} + +function TRegExpr.ParseReg (paren : Integer; var flagp : Integer) : PRegExprChar; +// regular expression, i.e. main body or parenthesized thing +// Caller must absorb opening parenthesis. +// Combining parenthesis handling with the base level of regular expression +// is a trifle forced, but the need to tie the tails of the branches to what +// follows makes it hard to avoid. + var + ret, br, ender : PRegExprChar; + parno : Integer; + flags : Integer; + SavedModifiers : Integer; + begin + Result := nil; + flagp := HASWIDTH; // Tentatively. + parno := 0; // eliminate compiler stupid warning + SavedModifiers := fCompModifiers; + + // Make an OPEN node, if parenthesized. + if paren <> 0 then begin + if regnpar >= NSUBEXP then begin + Error (reeCompParseRegTooManyBrackets); + Exit; + end; + parno := regnpar; + inc (regnpar); + ret := EmitNode (TREOp (ord (OPEN) + parno)); + end + else ret := nil; + + // Pick up the branches, linking them together. + br := ParseBranch (flags); + if br = nil then begin + Result := nil; + Exit; + end; + if ret <> nil + then Tail (ret, br) // OPEN -> first. + else ret := br; + if (flags and HASWIDTH) = 0 + then flagp := flagp and not HASWIDTH; + flagp := flagp or flags and SPSTART; + while (regparse^ = '|') do begin + inc (regparse); + br := ParseBranch (flags); + if br = nil then begin + Result := nil; + Exit; + end; + Tail (ret, br); // BRANCH -> BRANCH. + if (flags and HASWIDTH) = 0 + then flagp := flagp and not HASWIDTH; + flagp := flagp or flags and SPSTART; + end; + + // Make a closing node, and hook it on the end. + if paren <> 0 + then ender := EmitNode (TREOp (ord (CLOSE) + parno)) + else ender := EmitNode (EEND); + Tail (ret, ender); + + // Hook the tails of the branches to the closing node. + br := ret; + while br <> nil do begin + OpTail (br, ender); + br := regnext (br); + end; + + // Check for proper termination. + if paren <> 0 then + if regparse^ <> ')' then begin + Error (reeCompParseRegUnmatchedBrackets); + Exit; + end + else inc (regparse); // skip trailing ')' + if (paren = 0) and (regparse^ <> #0) then begin + if regparse^ = ')' + then Error (reeCompParseRegUnmatchedBrackets2) + else Error (reeCompParseRegJunkOnEnd); + Exit; + end; + fCompModifiers := SavedModifiers; // restore modifiers of parent + Result := ret; + end; { of function TRegExpr.ParseReg +--------------------------------------------------------------} + +function TRegExpr.ParseBranch (var flagp : Integer) : PRegExprChar; +// one alternative of an | operator +// Implements the concatenation operator. + var + ret, chain, latest : PRegExprChar; + flags : Integer; + begin + flagp := WORST; // Tentatively. + + ret := EmitNode (BRANCH); + chain := nil; + while (regparse^ <> #0) and (regparse^ <> '|') + and (regparse^ <> ')') do begin + latest := ParsePiece (flags); + if latest = nil then begin + Result := nil; + Exit; + end; + flagp := flagp or flags and HASWIDTH; + if chain = nil // First piece. + then flagp := flagp or flags and SPSTART + else Tail (chain, latest); + chain := latest; + end; + if chain = nil // Loop ran zero times. + then EmitNode (NOTHING); + Result := ret; + end; { of function TRegExpr.ParseBranch +--------------------------------------------------------------} + +function TRegExpr.ParsePiece (var flagp : Integer) : PRegExprChar; +// something followed by possible [*+?{] +// Note that the branching code sequences used for ? and the general cases +// of * and + and { are somewhat optimized: they use the same NOTHING node as +// both the endmarker for their branch list and the body of the last branch. +// It might seem that this node could be dispensed with entirely, but the +// endmarker role is not redundant. + function parsenum (AStart, AEnd : PRegExprChar) : TREBracesArg; + begin + Result := 0; + if AEnd - AStart + 1 > 8 then begin // prevent stupid scanning + Error (reeBRACESArgTooBig); + Exit; + end; + while AStart <= AEnd do begin + Result := Result * 10 + (ord (AStart^) - ord ('0')); + inc (AStart); + end; + if (Result > MaxBracesArg) or (Result < 0) then begin + Error (reeBRACESArgTooBig); + Exit; + end; + end; + + var + op : REChar; + NonGreedyOp, NonGreedyCh : Boolean; //###0.940 + TheOp : TREOp; //###0.940 + NextNode : PRegExprChar; + flags : Integer; + BracesMin, Bracesmax : TREBracesArg; + p, savedparse : PRegExprChar; + + procedure EmitComplexBraces (ABracesMin, ABracesMax : TREBracesArg; + ANonGreedyOp : Boolean); //###0.940 + {$IFDEF ComplexBraces} + var + off : Integer; + {$ENDIF} + begin + {$IFNDEF ComplexBraces} + Error (reeComplexBracesNotImplemented); + {$ELSE} + if ANonGreedyOp + then TheOp := LOOPNG + else TheOp := LOOP; + InsertOperator (LOOPENTRY, Result, REOpSz + RENextOffSz); + NextNode := EmitNode (TheOp); + if regcode <> @regdummy then begin + off := (Result + REOpSz + RENextOffSz) + - (regcode - REOpSz - RENextOffSz); // back to Atom after LOOPENTRY + PREBracesArg (regcode)^ := ABracesMin; + inc (regcode, REBracesArgSz); + PREBracesArg (regcode)^ := ABracesMax; + inc (regcode, REBracesArgSz); + PRENextOff (regcode)^ := off; + inc (regcode, RENextOffSz); + end + else inc (regsize, REBracesArgSz * 2 + RENextOffSz); + Tail (Result, NextNode); // LOOPENTRY -> LOOP + if regcode <> @regdummy then + Tail (Result + REOpSz + RENextOffSz, NextNode); // Atom -> LOOP + {$ENDIF} + end; + + procedure EmitSimpleBraces (ABracesMin, ABracesMax : TREBracesArg; + ANonGreedyOp : Boolean); //###0.940 + begin + if ANonGreedyOp //###0.940 + then TheOp := BRACESNG + else TheOp := BRACES; + InsertOperator (TheOp, Result, REOpSz + RENextOffSz + REBracesArgSz * 2); + if regcode <> @regdummy then begin + PREBracesArg (Result + REOpSz + RENextOffSz)^ := ABracesMin; + PREBracesArg (Result + REOpSz + RENextOffSz + REBracesArgSz)^ := ABracesMax; + end; + end; + + begin + Result := ParseAtom (flags); + if Result = nil + then Exit; + + op := regparse^; + if not ((op = '*') or (op = '+') or (op = '?') or (op = '{')) then begin + flagp := flags; + Exit; + end; + if ((flags and HASWIDTH) = 0) and (op <> '?') then begin + Error (reePlusStarOperandCouldBeEmpty); + Exit; + end; + + case op of + '*': begin + flagp := WORST or SPSTART; + NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 + NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 + if (flags and SIMPLE) = 0 then begin + if NonGreedyOp //###0.940 + then EmitComplexBraces (0, MaxBracesArg, NonGreedyOp) + else begin // Emit x* as (x&|), where & means "self". + InsertOperator (BRANCH, Result, REOpSz + RENextOffSz); // Either x + OpTail (Result, EmitNode (BACK)); // and loop + OpTail (Result, Result); // back + Tail (Result, EmitNode (BRANCH)); // or + Tail (Result, EmitNode (NOTHING)); // nil. + end + end + else begin // Simple + if NonGreedyOp //###0.940 + then TheOp := STARNG + else TheOp := STAR; + InsertOperator (TheOp, Result, REOpSz + RENextOffSz); + end; + if NonGreedyCh //###0.940 + then inc (regparse); // Skip extra char ('?') + end; { of case '*'} + '+': begin + flagp := WORST or SPSTART or HASWIDTH; + NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 + NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 + if (flags and SIMPLE) = 0 then begin + if NonGreedyOp //###0.940 + then EmitComplexBraces (1, MaxBracesArg, NonGreedyOp) + else begin // Emit x+ as x(&|), where & means "self". + NextNode := EmitNode (BRANCH); // Either + Tail (Result, NextNode); + Tail (EmitNode (BACK), Result); // loop back + Tail (NextNode, EmitNode (BRANCH)); // or + Tail (Result, EmitNode (NOTHING)); // nil. + end + end + else begin // Simple + if NonGreedyOp //###0.940 + then TheOp := PLUSNG + else TheOp := PLUS; + InsertOperator (TheOp, Result, REOpSz + RENextOffSz); + end; + if NonGreedyCh //###0.940 + then inc (regparse); // Skip extra char ('?') + end; { of case '+'} + '?': begin + flagp := WORST; + NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 + NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 + if NonGreedyOp then begin //###0.940 // We emit x?? as x{0,1}? + if (flags and SIMPLE) = 0 + then EmitComplexBraces (0, 1, NonGreedyOp) + else EmitSimpleBraces (0, 1, NonGreedyOp); + end + else begin // greedy '?' + InsertOperator (BRANCH, Result, REOpSz + RENextOffSz); // Either x + Tail (Result, EmitNode (BRANCH)); // or + NextNode := EmitNode (NOTHING); // nil. + Tail (Result, NextNode); + OpTail (Result, NextNode); + end; + if NonGreedyCh //###0.940 + then inc (regparse); // Skip extra char ('?') + end; { of case '?'} + '{': begin + savedparse := regparse; + // !!!!!!!!!!!! + // Filip Jirsak's note - what will happen, when we are at the end of regparse? + inc (regparse); + p := regparse; + while Pos (regparse^, '0123456789') > 0 // MUST appear + do inc (regparse); + if (regparse^ <> '}') and (regparse^ <> ',') or (p = regparse) then begin + regparse := savedparse; + flagp := flags; + Exit; + end; + BracesMin := parsenum (p, regparse - 1); + if regparse^ = ',' then begin + inc (regparse); + p := regparse; + while Pos (regparse^, '0123456789') > 0 + do inc (regparse); + if regparse^ <> '}' then begin + regparse := savedparse; + Exit; + end; + if p = regparse + then BracesMax := MaxBracesArg + else BracesMax := parsenum (p, regparse - 1); + end + else BracesMax := BracesMin; // {n} == {n,n} + if BracesMin > BracesMax then begin + Error (reeBracesMinParamGreaterMax); + Exit; + end; + if BracesMin > 0 + then flagp := WORST; + if BracesMax > 0 + then flagp := flagp or HASWIDTH or SPSTART; + + NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 + NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 + if (flags and SIMPLE) <> 0 + then EmitSimpleBraces (BracesMin, BracesMax, NonGreedyOp) + else EmitComplexBraces (BracesMin, BracesMax, NonGreedyOp); + if NonGreedyCh //###0.940 + then inc (regparse); // Skip extra char '?' + end; { of case '{'} +// else // here we can't be + end; { of case op} + + inc (regparse); + if (regparse^ = '*') or (regparse^ = '+') or (regparse^ = '?') or (regparse^ = '{') then begin + Error (reeNestedSQP); + Exit; + end; + end; { of function TRegExpr.ParsePiece +--------------------------------------------------------------} + +function TRegExpr.ParseAtom (var flagp : Integer) : PRegExprChar; +// the lowest level +// Optimization: gobbles an entire sequence of ordinary characters so that +// it can turn them into a single node, which is smaller to store and +// faster to run. Backslashed characters are exceptions, each becoming a +// separate node; the code is simpler that way and it's not worth fixing. + var + ret : PRegExprChar; + flags : Integer; + RangeBeg, RangeEnd : REChar; + CanBeRange : Boolean; + len : Integer; + ender : REChar; + begmodfs : PRegExprChar; + + {$IFDEF UseSetOfChar} //###0.930 + RangePCodeBeg : PRegExprChar; + RangePCodeIdx : Integer; + RangeIsCI : Boolean; + RangeSet : TSetOfREChar; + RangeLen : Integer; + RangeChMin, RangeChMax : REChar; + {$ENDIF} + + procedure EmitExactly (ch : REChar); + begin + if (fCompModifiers and MaskModI) <> 0 + then ret := EmitNode (EXACTLYCI) + else ret := EmitNode (EXACTLY); + EmitC (ch); + EmitC (#0); + flagp := flagp or HASWIDTH or SIMPLE; + end; + + procedure EmitStr (const s : RegExprString); + var i : Integer; + begin + for i := 1 to length (s) + do EmitC (s [i]); + end; + + function HexDig (ch : REChar) : Integer; + begin + Result := 0; + if (ch >= 'a') and (ch <= 'f') + then ch := REChar (ord (ch) - (ord ('a') - ord ('A'))); + if (ch < '0') or (ch > 'F') or ((ch > '9') and (ch < 'A')) then begin + Error (reeBadHexDigit); + Exit; + end; + Result := ord (ch) - ord ('0'); + if ch >= 'A' + then Result := Result - (ord ('A') - ord ('9') - 1); + end; + + function EmitRange (AOpCode : REChar) : PRegExprChar; + begin + {$IFDEF UseSetOfChar} + case AOpCode of + ANYBUTCI, ANYBUT: + Result := EmitNode (ANYBUTTINYSET); + else // ANYOFCI, ANYOF + Result := EmitNode (ANYOFTINYSET); + end; + case AOpCode of + ANYBUTCI, ANYOFCI: + RangeIsCI := True; + else // ANYBUT, ANYOF + RangeIsCI := False; + end; + RangePCodeBeg := regcode; + RangePCodeIdx := regsize; + RangeLen := 0; + RangeSet := []; + RangeChMin := #255; + RangeChMax := #0; + {$ELSE} + Result := EmitNode (AOpCode); + // ToDo: + // !!!!!!!!!!!!! Implement ANYOF[BUT]TINYSET generation for UniCode !!!!!!!!!! + {$ENDIF} + end; + +{$IFDEF UseSetOfChar} + procedure EmitRangeCPrim (b : REChar); //###0.930 + begin + if b in RangeSet + then Exit; + inc (RangeLen); + if b < RangeChMin + then RangeChMin := b; + if b > RangeChMax + then RangeChMax := b; + Include (RangeSet, b); + end; + {$ENDIF} + + procedure EmitRangeC (b : REChar); + {$IFDEF UseSetOfChar} + var + Ch : REChar; + {$ENDIF} + begin + CanBeRange := False; + {$IFDEF UseSetOfChar} + if b <> #0 then begin + EmitRangeCPrim (b); //###0.930 + if RangeIsCI + then EmitRangeCPrim (InvertCase (b)); //###0.930 + end + else begin + {$IFDEF UseAsserts} + Assert (RangeLen > 0, 'TRegExpr.ParseAtom(subroutine EmitRangeC): empty range'); // impossible, but who knows.. + Assert (RangeChMin <= RangeChMax, 'TRegExpr.ParseAtom(subroutine EmitRangeC): RangeChMin > RangeChMax'); // impossible, but who knows.. + {$ENDIF} + if RangeLen <= TinySetLen then begin // emit "tiny set" + if regcode = @regdummy then begin + regsize := RangePCodeIdx + TinySetLen; // RangeChMin/Max !!! + Exit; + end; + regcode := RangePCodeBeg; + for Ch := RangeChMin to RangeChMax do //###0.930 + if Ch in RangeSet then begin + regcode^ := Ch; + inc (regcode); + end; + // fill rest: + while regcode < RangePCodeBeg + TinySetLen do begin + regcode^ := RangeChMax; + inc (regcode); + end; + end + else begin + if regcode = @regdummy then begin + regsize := RangePCodeIdx + SizeOf (TSetOfREChar); + Exit; + end; + if (RangePCodeBeg - REOpSz - RENextOffSz)^ = ANYBUTTINYSET + then RangeSet := [#0 .. #255] - RangeSet; + PREOp (RangePCodeBeg - REOpSz - RENextOffSz)^ := ANYOFFULLSET; + regcode := RangePCodeBeg; + Move (RangeSet, regcode^, SizeOf (TSetOfREChar)); + inc (regcode, SizeOf (TSetOfREChar)); + end; + end; + {$ELSE} + EmitC (b); + {$ENDIF} + end; + + procedure EmitSimpleRangeC (b : REChar); + begin + RangeBeg := b; + EmitRangeC (b); + CanBeRange := True; + end; + + procedure EmitRangeStr (const s : RegExprString); + var i : Integer; + begin + for i := 1 to length (s) + do EmitRangeC (s [i]); + end; + + function UnQuoteChar (var APtr : PRegExprChar) : REChar; //###0.934 + begin + case APtr^ of + 't': Result := #$9; // tab (HT/TAB) + 'n': Result := #$a; // newline (NL) + 'r': Result := #$d; // car.return (CR) + 'f': Result := #$c; // form feed (FF) + 'a': Result := #$7; // alarm (bell) (BEL) + 'e': Result := #$1b; // escape (ESC) + 'x': begin // hex char + Result := #0; + inc (APtr); + if APtr^ = #0 then begin + Error (reeNoHexCodeAfterBSlashX); + Exit; + end; + if APtr^ = '{' then begin // \x{nnnn} //###0.936 + repeat + inc (APtr); + if APtr^ = #0 then begin + Error (reeNoHexCodeAfterBSlashX); + Exit; + end; + if APtr^ <> '}' then begin + if (Ord (Result) + shr (SizeOf (REChar) * 8 - 4)) and $F <> 0 then begin + Error (reeHexCodeAfterBSlashXTooBig); + Exit; + end; + Result := REChar ((Ord (Result) ShL 4) or HexDig (APtr^)); + // HexDig will cause Error if bad hex digit found + end + else BREAK; + until False; + end + else begin + Result := REChar (HexDig (APtr^)); + // HexDig will cause Error if bad hex digit found + inc (APtr); + if APtr^ = #0 then begin + Error (reeNoHexCodeAfterBSlashX); + Exit; + end; + Result := REChar ((Ord (Result) ShL 4) or HexDig (APtr^)); + // HexDig will cause Error if bad hex digit found + end; + end; + else Result := APtr^; + end; + end; + + begin + Result := nil; + flagp := WORST; // Tentatively. + + inc (regparse); + case (regparse - 1)^ of + '^': if ((fCompModifiers and MaskModM) = 0) + or ((FLineSeparators = '') and not fLinePairedSeparatorAssigned) + then ret := EmitNode (BOL) + else ret := EmitNode (BOLML); + '$': if ((fCompModifiers and MaskModM) = 0) + or ((FLineSeparators = '') and not fLinePairedSeparatorAssigned) + then ret := EmitNode (EOL) + else ret := EmitNode (EOLML); + '.': + if (fCompModifiers and MaskModS) <> 0 then begin + ret := EmitNode (ANY); + flagp := flagp or HASWIDTH or SIMPLE; + end + else begin // not /s, so emit [^:LineSeparators:] + ret := EmitNode (ANYML); + flagp := flagp or HASWIDTH; // not so simple ;) +// ret := EmitRange (ANYBUT); +// EmitRangeStr (LineSeparators); //###0.941 +// EmitRangeStr (LinePairedSeparator); // !!! isn't correct if have to accept only paired +// EmitRangeC (#0); +// flagp := flagp or HASWIDTH or SIMPLE; + end; + '[': begin + if regparse^ = '^' then begin // Complement of range. + if (fCompModifiers and MaskModI) <> 0 + then ret := EmitRange (ANYBUTCI) + else ret := EmitRange (ANYBUT); + inc (regparse); + end + else + if (fCompModifiers and MaskModI) <> 0 + then ret := EmitRange (ANYOFCI) + else ret := EmitRange (ANYOF); + + CanBeRange := False; + + if (regparse^ = ']') then begin + EmitSimpleRangeC (regparse^); // []-a] -> ']' .. 'a' + inc (regparse); + end; + + while (regparse^ <> #0) and (regparse^ <> ']') do begin + if (regparse^ = '-') + and ((regparse + 1)^ <> #0) and ((regparse + 1)^ <> ']') + and CanBeRange then begin + inc (regparse); + RangeEnd := regparse^; + if RangeEnd = EscChar then begin + {$IFDEF SynRegUniCode} //###0.935 + if (ord ((regparse + 1)^) < 256) + and (ansichar ((regparse + 1)^) + in ['d', 'D', 's', 'S', 'w', 'W']) then begin + {$ELSE} + if (regparse + 1)^ in ['d', 'D', 's', 'S', 'w', 'W'] then begin + {$ENDIF} + EmitRangeC ('-'); // or treat as error ?!! + CONTINUE; + end; + inc (regparse); + RangeEnd := UnQuoteChar (regparse); + end; + + // r.e.ranges extension for russian + if ((fCompModifiers and MaskModR) <> 0) + and (RangeBeg = RusRangeLoLow) and (RangeEnd = RusRangeLoHigh) then begin + EmitRangeStr (RusRangeLo); + end + else if ((fCompModifiers and MaskModR) <> 0) + and (RangeBeg = RusRangeHiLow) and (RangeEnd = RusRangeHiHigh) then begin + EmitRangeStr (RusRangeHi); + end + else if ((fCompModifiers and MaskModR) <> 0) + and (RangeBeg = RusRangeLoLow) and (RangeEnd = RusRangeHiHigh) then begin + EmitRangeStr (RusRangeLo); + EmitRangeStr (RusRangeHi); + end + else begin // standard r.e. handling + if RangeBeg > RangeEnd then begin + Error (reeInvalidRange); + Exit; + end; + inc (RangeBeg); + EmitRangeC (RangeEnd); // prevent infinite loop if RangeEnd=$ff + while RangeBeg < RangeEnd do begin //###0.929 + EmitRangeC (RangeBeg); + inc (RangeBeg); + end; + end; + inc (regparse); + end + else begin + if regparse^ = EscChar then begin + inc (regparse); + if regparse^ = #0 then begin + Error (reeParseAtomTrailingBackSlash); + Exit; + end; + case regparse^ of // r.e.extensions + 'd': EmitRangeStr ('0123456789'); + 'w': EmitRangeStr (WordChars); + 's': EmitRangeStr (SpaceChars); + else EmitSimpleRangeC (UnQuoteChar (regparse)); + end; { of case} + end + else EmitSimpleRangeC (regparse^); + inc (regparse); + end; + end; { of while} + EmitRangeC (#0); + if regparse^ <> ']' then begin + Error (reeUnmatchedSqBrackets); + Exit; + end; + inc (regparse); + flagp := flagp or HASWIDTH or SIMPLE; + end; + '(': begin + if regparse^ = '?' then begin + // check for extended Perl syntax : (?..) + if (regparse + 1)^ = '#' then begin // (?#comment) + inc (regparse, 2); // find closing ')' + while (regparse^ <> #0) and (regparse^ <> ')') + do inc (regparse); + if regparse^ <> ')' then begin + Error (reeUnclosedComment); + Exit; + end; + inc (regparse); // skip ')' + ret := EmitNode (COMMENT); // comment + end + else begin // modifiers ? + inc (regparse); // skip '?' + begmodfs := regparse; + while (regparse^ <> #0) and (regparse^ <> ')') + do inc (regparse); + if (regparse^ <> ')') + or not ParseModifiersStr (copy (begmodfs, 1, (regparse - begmodfs)), fCompModifiers) then begin + Error (reeUrecognizedModifier); + Exit; + end; + inc (regparse); // skip ')' + ret := EmitNode (COMMENT); // comment +// Error (reeQPSBFollowsNothing); +// Exit; + end; + end + else begin + ret := ParseReg (1, flags); + if ret = nil then begin + Result := nil; + Exit; + end; + flagp := flagp or flags and (HASWIDTH or SPSTART); + end; + end; + #0, '|', ')': begin // Supposed to be caught earlier. + Error (reeInternalUrp); + Exit; + end; + '?', '+', '*': begin + Error (reeQPSBFollowsNothing); + Exit; + end; + EscChar: begin + if regparse^ = #0 then begin + Error (reeTrailingBackSlash); + Exit; + end; + case regparse^ of // r.e.extensions + 'b': ret := EmitNode (BOUND); //###0.943 + 'B': ret := EmitNode (NOTBOUND); //###0.943 + 'A': ret := EmitNode (BOL); //###0.941 + 'Z': ret := EmitNode (EOL); //###0.941 + 'd': begin // r.e.extension - any digit ('0' .. '9') + ret := EmitNode (ANYDIGIT); + flagp := flagp or HASWIDTH or SIMPLE; + end; + 'D': begin // r.e.extension - not digit ('0' .. '9') + ret := EmitNode (NOTDIGIT); + flagp := flagp or HASWIDTH or SIMPLE; + end; + 's': begin // r.e.extension - any space char + {$IFDEF UseSetOfChar} + ret := EmitRange (ANYOF); + EmitRangeStr (SpaceChars); + EmitRangeC (#0); + {$ELSE} + ret := EmitNode (ANYSPACE); + {$ENDIF} + flagp := flagp or HASWIDTH or SIMPLE; + end; + 'S': begin // r.e.extension - not space char + {$IFDEF UseSetOfChar} + ret := EmitRange (ANYBUT); + EmitRangeStr (SpaceChars); + EmitRangeC (#0); + {$ELSE} + ret := EmitNode (NOTSPACE); + {$ENDIF} + flagp := flagp or HASWIDTH or SIMPLE; + end; + 'w': begin // r.e.extension - any english char / digit / '_' + {$IFDEF UseSetOfChar} + ret := EmitRange (ANYOF); + EmitRangeStr (WordChars); + EmitRangeC (#0); + {$ELSE} + ret := EmitNode (ANYLETTER); + {$ENDIF} + flagp := flagp or HASWIDTH or SIMPLE; + end; + 'W': begin // r.e.extension - not english char / digit / '_' + {$IFDEF UseSetOfChar} + ret := EmitRange (ANYBUT); + EmitRangeStr (WordChars); + EmitRangeC (#0); + {$ELSE} + ret := EmitNode (NOTLETTER); + {$ENDIF} + flagp := flagp or HASWIDTH or SIMPLE; + end; + '1' .. '9': begin //###0.936 + if (fCompModifiers and MaskModI) <> 0 + then ret := EmitNode (BSUBEXPCI) + else ret := EmitNode (BSUBEXP); + EmitC (REChar (ord (regparse^) - ord ('0'))); + flagp := flagp or HASWIDTH or SIMPLE; + end; + else EmitExactly (UnQuoteChar (regparse)); + end; { of case} + inc (regparse); + end; + else begin + dec (regparse); + if ((fCompModifiers and MaskModX) <> 0) and // check for eXtended syntax + ((regparse^ = '#') + or ({$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 + {$ELSE}regparse^ in XIgnoredChars{$ENDIF})) then begin //###0.941 \x + if regparse^ = '#' then begin // Skip eXtended comment + // find comment terminator (group of \n and/or \r) + while (regparse^ <> #0) and (regparse^ <> #$d) and (regparse^ <> #$a) + do inc (regparse); + while (regparse^ = #$d) or (regparse^ = #$a) // skip comment terminator + do inc (regparse); // attempt to support different type of line separators + end + else begin // Skip the blanks! + while {$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 + {$ELSE}regparse^ in XIgnoredChars{$ENDIF} + do inc (regparse); + end; + ret := EmitNode (COMMENT); // comment + end + else begin + len := strcspn (regparse, META); + if len <= 0 then + if regparse^ <> '{' then begin + Error (reeRarseAtomInternalDisaster); + Exit; + end + else len := strcspn (regparse + 1, META) + 1; // bad {n,m} - compile as EXATLY + ender := (regparse + len)^; + if (len > 1) + and ((ender = '*') or (ender = '+') or (ender = '?') or (ender = '{')) + then dec (len); // Back off clear of ?+*{ operand. + flagp := flagp or HASWIDTH; + if len = 1 + then flagp := flagp or SIMPLE; + if (fCompModifiers and MaskModI) <> 0 + then ret := EmitNode (EXACTLYCI) + else ret := EmitNode (EXACTLY); + while (len > 0) + and (((fCompModifiers and MaskModX) = 0) or (regparse^ <> '#')) do begin + if ((fCompModifiers and MaskModX) = 0) or not ( //###0.941 + {$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 + {$ELSE}regparse^ in XIgnoredChars{$ENDIF} ) + then EmitC (regparse^); + inc (regparse); + dec (len); + end; + EmitC (#0); + end; { of if not comment} + end; { of case else} + end; { of case} + + Result := ret; + end; { of function TRegExpr.ParseAtom +--------------------------------------------------------------} + +function TRegExpr.GetCompilerErrorPos : Integer; + begin + Result := 0; + if (regexpbeg = nil) or (regparse = nil) + then Exit; // not in compiling mode ? + Result := regparse - regexpbeg; + end; { of function TRegExpr.GetCompilerErrorPos +--------------------------------------------------------------} + + +{=============================================================} +{===================== Matching section ======================} +{=============================================================} + +{$IFNDEF UseSetOfChar} +function TRegExpr.StrScanCI (s : PRegExprChar; ch : REChar) : PRegExprChar; //###0.928 - now method of TRegExpr + begin + while (s^ <> #0) and (s^ <> ch) and (s^ <> InvertCase (ch)) + do inc (s); + if s^ <> #0 + then Result := s + else Result := nil; + end; { of function TRegExpr.StrScanCI +--------------------------------------------------------------} +{$ENDIF} + +function TRegExpr.regrepeat (p : PRegExprChar; AMax : Integer) : Integer; +// repeatedly match something simple, report how many + var + scan : PRegExprChar; + opnd : PRegExprChar; + TheMax : Integer; + {Ch,} InvCh : REChar; //###0.931 + sestart, seend : PRegExprChar; //###0.936 + begin + Result := 0; + scan := reginput; + opnd := p + REOpSz + RENextOffSz; //OPERAND + TheMax := fInputEnd - scan; + if TheMax > AMax + then TheMax := AMax; + case PREOp (p)^ of + ANY: begin + // note - ANYML cannot be proceeded in regrepeat because can skip + // more than one char at once + Result := TheMax; + inc (scan, Result); + end; + EXACTLY: begin // in opnd can be only ONE char !!! +// Ch := opnd^; // store in register //###0.931 + while (Result < TheMax) and (opnd^ = scan^) do begin + inc (Result); + inc (scan); + end; + end; + EXACTLYCI: begin // in opnd can be only ONE char !!! +// Ch := opnd^; // store in register //###0.931 + while (Result < TheMax) and (opnd^ = scan^) do begin // prevent unneeded InvertCase //###0.931 + inc (Result); + inc (scan); + end; + if Result < TheMax then begin //###0.931 + InvCh := InvertCase (opnd^); // store in register + while (Result < TheMax) and + ((opnd^ = scan^) or (InvCh = scan^)) do begin + inc (Result); + inc (scan); + end; + end; + end; + BSUBEXP: begin //###0.936 + sestart := startp [ord (opnd^)]; + if sestart = nil + then Exit; + seend := endp [ord (opnd^)]; + if seend = nil + then Exit; + repeat + opnd := sestart; + while opnd < seend do begin + if (scan >= fInputEnd) or (scan^ <> opnd^) + then Exit; + inc (scan); + inc (opnd); + end; + inc (Result); + reginput := scan; + until Result >= AMax; + end; + BSUBEXPCI: begin //###0.936 + sestart := startp [ord (opnd^)]; + if sestart = nil + then Exit; + seend := endp [ord (opnd^)]; + if seend = nil + then Exit; + repeat + opnd := sestart; + while opnd < seend do begin + if (scan >= fInputEnd) or + ((scan^ <> opnd^) and (scan^ <> InvertCase (opnd^))) + then Exit; + inc (scan); + inc (opnd); + end; + inc (Result); + reginput := scan; + until Result >= AMax; + end; + ANYDIGIT: + while (Result < TheMax) and + (scan^ >= '0') and (scan^ <= '9') do begin + inc (Result); + inc (scan); + end; + NOTDIGIT: + while (Result < TheMax) and + ((scan^ < '0') or (scan^ > '9')) do begin + inc (Result); + inc (scan); + end; + {$IFNDEF UseSetOfChar} //###0.929 + ANYLETTER: + while (Result < TheMax) and + (Pos (scan^, fWordChars) > 0) //###0.940 + { ((scan^ >= 'a') and (scan^ <= 'z') !! I've forgotten (>='0') and (<='9') + or (scan^ >= 'A') and (scan^ <= 'Z') or (scan^ = '_'))} do begin + inc (Result); + inc (scan); + end; + NOTLETTER: + while (Result < TheMax) and + (Pos (scan^, fWordChars) <= 0) //###0.940 + { not ((scan^ >= 'a') and (scan^ <= 'z') !! I've forgotten (>='0') and (<='9') + or (scan^ >= 'A') and (scan^ <= 'Z') + or (scan^ = '_'))} do begin + inc (Result); + inc (scan); + end; + ANYSPACE: + while (Result < TheMax) and + (Pos (scan^, fSpaceChars) > 0) do begin + inc (Result); + inc (scan); + end; + NOTSPACE: + while (Result < TheMax) and + (Pos (scan^, fSpaceChars) <= 0) do begin + inc (Result); + inc (scan); + end; + {$ENDIF} + ANYOFTINYSET: begin + while (Result < TheMax) and //!!!TinySet + ((scan^ = opnd^) or (scan^ = (opnd + 1)^) + or (scan^ = (opnd + 2)^)) do begin + inc (Result); + inc (scan); + end; + end; + ANYBUTTINYSET: begin + while (Result < TheMax) and //!!!TinySet + (scan^ <> opnd^) and (scan^ <> (opnd + 1)^) + and (scan^ <> (opnd + 2)^) do begin + inc (Result); + inc (scan); + end; + end; + {$IFDEF UseSetOfChar} //###0.929 + ANYOFFULLSET: begin + while (Result < TheMax) and + (scan^ in PSetOfREChar (opnd)^) do begin + inc (Result); + inc (scan); + end; + end; + {$ELSE} + ANYOF: + while (Result < TheMax) and + (StrScan (opnd, scan^) <> nil) do begin + inc (Result); + inc (scan); + end; + ANYBUT: + while (Result < TheMax) and + (StrScan (opnd, scan^) = nil) do begin + inc (Result); + inc (scan); + end; + ANYOFCI: + while (Result < TheMax) and (StrScanCI (opnd, scan^) <> nil) do begin + inc (Result); + inc (scan); + end; + ANYBUTCI: + while (Result < TheMax) and (StrScanCI (opnd, scan^) = nil) do begin + inc (Result); + inc (scan); + end; + {$ENDIF} + else begin // Oh dear. Called inappropriately. + Result := 0; // Best compromise. + Error (reeRegRepeatCalledInappropriately); + Exit; + end; + end; { of case} + reginput := scan; + end; { of function TRegExpr.regrepeat +--------------------------------------------------------------} + +function TRegExpr.regnext (p : PRegExprChar) : PRegExprChar; +// dig the "next" pointer out of a node + var offset : TRENextOff; + begin + if p = @regdummy then begin + Result := nil; + Exit; + end; + offset := PRENextOff (p + REOpSz)^; //###0.933 inlined NEXT + if offset = 0 + then Result := nil + else Result := p + offset; + end; { of function TRegExpr.regnext +--------------------------------------------------------------} + +function TRegExpr.MatchPrim (prog : PRegExprChar) : Boolean; +// recursively matching routine +// Conceptually the strategy is simple: check to see whether the current +// node matches, call self recursively to see whether the rest matches, +// and then act accordingly. In practice we make some effort to avoid +// recursion, in particular by going through "ordinary" nodes (that don't +// need to know whether the rest of the match failed) by a loop instead of +// by recursion. + var + scan : PRegExprChar; // Current node. + next : PRegExprChar; // Next node. + len : Integer; + opnd : PRegExprChar; + no : Integer; + save : PRegExprChar; + nextch : REChar; + BracesMin, BracesMax : Integer; // we use Integer instead of TREBracesArg for better support */+ + {$IFDEF ComplexBraces} + SavedLoopStack : array [1 .. LoopStackMax] of Integer; // :(( very bad for recursion + SavedLoopStackIdx : Integer; //###0.925 + {$ENDIF} + begin + Result := False; + scan := prog; + + while scan <> nil do begin + len := PRENextOff (scan + 1)^; //###0.932 inlined regnext + if len = 0 + then next := nil + else next := scan + len; + + case scan^ of + NOTBOUND, //###0.943 //!!! think about UseSetOfChar !!! + BOUND: + if (scan^ = BOUND) + xor ( + ((reginput = fInputStart) or (Pos ((reginput - 1)^, fWordChars) <= 0)) + and (reginput^ <> #0) and (Pos (reginput^, fWordChars) > 0) + or + (reginput <> fInputStart) and (Pos ((reginput - 1)^, fWordChars) > 0) + and ((reginput^ = #0) or (Pos (reginput^, fWordChars) <= 0))) + then Exit; + + BOL: if reginput <> fInputStart + then Exit; + EOL: if reginput^ <> #0 + then Exit; + BOLML: if reginput > fInputStart then begin + nextch := (reginput - 1)^; + if (nextch <> fLinePairedSeparatorTail) + or ((reginput - 1) <= fInputStart) + or ((reginput - 2)^ <> fLinePairedSeparatorHead) + then begin + if (nextch = fLinePairedSeparatorHead) + and (reginput^ = fLinePairedSeparatorTail) + then Exit; // don't stop between paired separator + if + {$IFNDEF SynRegUniCode} + not (nextch in FLineSeparatorsSet) + {$ELSE} + (pos (nextch, FLineSeparators) <= 0) + {$ENDIF} + then Exit; + end; + end; + EOLML: if reginput^ <> #0 then begin + nextch := reginput^; + if (nextch <> fLinePairedSeparatorHead) + or ((reginput + 1)^ <> fLinePairedSeparatorTail) + then begin + if (nextch = fLinePairedSeparatorTail) + and (reginput > fInputStart) + and ((reginput - 1)^ = fLinePairedSeparatorHead) + then Exit; // don't stop between paired separator + if + {$IFNDEF SynRegUniCode} + not (nextch in FLineSeparatorsSet) + {$ELSE} + (pos (nextch, FLineSeparators) <= 0) + {$ENDIF} + then Exit; + end; + end; + ANY: begin + if reginput^ = #0 + then Exit; + inc (reginput); + end; + ANYML: begin //###0.941 + if (reginput^ = #0) + or ((reginput^ = fLinePairedSeparatorHead) + and ((reginput + 1)^ = fLinePairedSeparatorTail)) + or {$IFNDEF SynRegUniCode} (reginput^ in FLineSeparatorsSet) + {$ELSE} (pos (reginput^, FLineSeparators) > 0) {$ENDIF} + then Exit; + inc (reginput); + end; + ANYDIGIT: begin + if (reginput^ = #0) or (reginput^ < '0') or (reginput^ > '9') + then Exit; + inc (reginput); + end; + NOTDIGIT: begin + if (reginput^ = #0) or ((reginput^ >= '0') and (reginput^ <= '9')) + then Exit; + inc (reginput); + end; + {$IFNDEF UseSetOfChar} //###0.929 + ANYLETTER: begin + if (reginput^ = #0) or (Pos (reginput^, fWordChars) <= 0) //###0.943 + then Exit; + inc (reginput); + end; + NOTLETTER: begin + if (reginput^ = #0) or (Pos (reginput^, fWordChars) > 0) //###0.943 + then Exit; + inc (reginput); + end; + ANYSPACE: begin + if (reginput^ = #0) or not (Pos (reginput^, fSpaceChars) > 0) //###0.943 + then Exit; + inc (reginput); + end; + NOTSPACE: begin + if (reginput^ = #0) or (Pos (reginput^, fSpaceChars) > 0) //###0.943 + then Exit; + inc (reginput); + end; + {$ENDIF} + EXACTLYCI: begin + opnd := scan + REOpSz + RENextOffSz; // OPERAND + // Inline the first character, for speed. + if (opnd^ <> reginput^) + and (InvertCase (opnd^) <> reginput^) + then Exit; + len := strlen (opnd); + //###0.929 begin + no := len; + save := reginput; + while no > 1 do begin + inc (save); + inc (opnd); + if (opnd^ <> save^) + and (InvertCase (opnd^) <> save^) + then Exit; + dec (no); + end; + //###0.929 end + inc (reginput, len); + end; + EXACTLY: begin + opnd := scan + REOpSz + RENextOffSz; // OPERAND + // Inline the first character, for speed. + if opnd^ <> reginput^ + then Exit; + len := strlen (opnd); + //###0.929 begin + no := len; + save := reginput; + while no > 1 do begin + inc (save); + inc (opnd); + if opnd^ <> save^ + then Exit; + dec (no); + end; + //###0.929 end + inc (reginput, len); + end; + BSUBEXP: begin //###0.936 + no := ord ((scan + REOpSz + RENextOffSz)^); + if startp [no] = nil + then Exit; + if endp [no] = nil + then Exit; + save := reginput; + opnd := startp [no]; + while opnd < endp [no] do begin + if (save >= fInputEnd) or (save^ <> opnd^) + then Exit; + inc (save); + inc (opnd); + end; + reginput := save; + end; + BSUBEXPCI: begin //###0.936 + no := ord ((scan + REOpSz + RENextOffSz)^); + if startp [no] = nil + then Exit; + if endp [no] = nil + then Exit; + save := reginput; + opnd := startp [no]; + while opnd < endp [no] do begin + if (save >= fInputEnd) or + ((save^ <> opnd^) and (save^ <> InvertCase (opnd^))) + then Exit; + inc (save); + inc (opnd); + end; + reginput := save; + end; + ANYOFTINYSET: begin + if (reginput^ = #0) or //!!!TinySet + ((reginput^ <> (scan + REOpSz + RENextOffSz)^) + and (reginput^ <> (scan + REOpSz + RENextOffSz + 1)^) + and (reginput^ <> (scan + REOpSz + RENextOffSz + 2)^)) + then Exit; + inc (reginput); + end; + ANYBUTTINYSET: begin + if (reginput^ = #0) or //!!!TinySet + (reginput^ = (scan + REOpSz + RENextOffSz)^) + or (reginput^ = (scan + REOpSz + RENextOffSz + 1)^) + or (reginput^ = (scan + REOpSz + RENextOffSz + 2)^) + then Exit; + inc (reginput); + end; + {$IFDEF UseSetOfChar} //###0.929 + ANYOFFULLSET: begin + if (reginput^ = #0) + or not (reginput^ in PSetOfREChar (scan + REOpSz + RENextOffSz)^) + then Exit; + inc (reginput); + end; + {$ELSE} + ANYOF: begin + if (reginput^ = #0) or (StrScan (scan + REOpSz + RENextOffSz, reginput^) = nil) + then Exit; + inc (reginput); + end; + ANYBUT: begin + if (reginput^ = #0) or (StrScan (scan + REOpSz + RENextOffSz, reginput^) <> nil) + then Exit; + inc (reginput); + end; + ANYOFCI: begin + if (reginput^ = #0) or (StrScanCI (scan + REOpSz + RENextOffSz, reginput^) = nil) + then Exit; + inc (reginput); + end; + ANYBUTCI: begin + if (reginput^ = #0) or (StrScanCI (scan + REOpSz + RENextOffSz, reginput^) <> nil) + then Exit; + inc (reginput); + end; + {$ENDIF} + NOTHING: ; + COMMENT: ; + BACK: ; + Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1) : begin //###0.929 + no := ord (scan^) - ord (OPEN); +// save := reginput; + save := startp [no]; //###0.936 + startp [no] := reginput; //###0.936 + Result := MatchPrim (next); + if not Result //###0.936 + then startp [no] := save; +// if Result and (startp [no] = nil) +// then startp [no] := save; + // Don't set startp if some later invocation of the same + // parentheses already has. + Exit; + end; + Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): begin //###0.929 + no := ord (scan^) - ord (CLOSE); +// save := reginput; + save := endp [no]; //###0.936 + endp [no] := reginput; //###0.936 + Result := MatchPrim (next); + if not Result //###0.936 + then endp [no] := save; +// if Result and (endp [no] = nil) +// then endp [no] := save; + // Don't set endp if some later invocation of the same + // parentheses already has. + Exit; + end; + BRANCH: begin + if (next^ <> BRANCH) // No choice. + then next := scan + REOpSz + RENextOffSz // Avoid recursion + else begin + repeat + save := reginput; + Result := MatchPrim (scan + REOpSz + RENextOffSz); + if Result + then Exit; + reginput := save; + scan := regnext (scan); + until (scan = nil) or (scan^ <> BRANCH); + Exit; + end; + end; + {$IFDEF ComplexBraces} + LOOPENTRY: begin //###0.925 + no := LoopStackIdx; + inc (LoopStackIdx); + if LoopStackIdx > LoopStackMax then begin + Error (reeLoopStackExceeded); + Exit; + end; + save := reginput; + LoopStack [LoopStackIdx] := 0; // init loop counter + Result := MatchPrim (next); // execute LOOP + LoopStackIdx := no; // cleanup + if Result + then Exit; + reginput := save; + Exit; + end; + LOOP, LOOPNG: begin //###0.940 + if LoopStackIdx <= 0 then begin + Error (reeLoopWithoutEntry); + Exit; + end; + opnd := scan + PRENextOff (scan + REOpSz + RENextOffSz + 2 * REBracesArgSz)^; + BracesMin := PREBracesArg (scan + REOpSz + RENextOffSz)^; + BracesMax := PREBracesArg (scan + REOpSz + RENextOffSz + REBracesArgSz)^; + save := reginput; + if LoopStack [LoopStackIdx] >= BracesMin then begin // Min alredy matched - we can work + if scan^ = LOOP then begin + // greedy way - first try to max deep of greed ;) + if LoopStack [LoopStackIdx] < BracesMax then begin + inc (LoopStack [LoopStackIdx]); + no := LoopStackIdx; + Result := MatchPrim (opnd); + LoopStackIdx := no; + if Result + then Exit; + reginput := save; + end; + dec (LoopStackIdx); // Fail. May be we are too greedy? ;) + Result := MatchPrim (next); + if not Result + then reginput := save; + Exit; + end + else begin + // non-greedy - try just now + Result := MatchPrim (next); + if Result + then Exit + else reginput := save; // failed - move next and try again + if LoopStack [LoopStackIdx] < BracesMax then begin + inc (LoopStack [LoopStackIdx]); + no := LoopStackIdx; + Result := MatchPrim (opnd); + LoopStackIdx := no; + if Result + then Exit; + reginput := save; + end; + dec (LoopStackIdx); // Failed - back up + Exit; + end + end + else begin // first match a min_cnt times + inc (LoopStack [LoopStackIdx]); + no := LoopStackIdx; + Result := MatchPrim (opnd); + LoopStackIdx := no; + if Result + then Exit; + dec (LoopStack [LoopStackIdx]); + reginput := save; + Exit; + end; + end; + {$ENDIF} + STAR, PLUS, BRACES, STARNG, PLUSNG, BRACESNG: begin + // Lookahead to avoid useless match attempts when we know + // what character comes next. + nextch := #0; + if next^ = EXACTLY + then nextch := (next + REOpSz + RENextOffSz)^; + BracesMax := MaxInt; // infinite loop for * and + //###0.92 + if (scan^ = STAR) or (scan^ = STARNG) + then BracesMin := 0 // STAR + else if (scan^ = PLUS) or (scan^ = PLUSNG) + then BracesMin := 1 // PLUS + else begin // BRACES + BracesMin := PREBracesArg (scan + REOpSz + RENextOffSz)^; + BracesMax := PREBracesArg (scan + REOpSz + RENextOffSz + REBracesArgSz)^; + end; + save := reginput; + opnd := scan + REOpSz + RENextOffSz; + if (scan^ = BRACES) or (scan^ = BRACESNG) + then inc (opnd, 2 * REBracesArgSz); + + if (scan^ = PLUSNG) or (scan^ = STARNG) or (scan^ = BRACESNG) then begin + // non-greedy mode + BracesMax := regrepeat (opnd, BracesMax); // don't repeat more than BracesMax + // Now we know real Max limit to move forward (for recursion 'back up') + // In some cases it can be faster to check only Min positions first, + // but after that we have to check every position separtely instead + // of fast scannig in loop. + no := BracesMin; + while no <= BracesMax do begin + reginput := save + no; + // If it could work, try it. + if (nextch = #0) or (reginput^ = nextch) then begin + {$IFDEF ComplexBraces} + System.Move (LoopStack, SavedLoopStack, SizeOf (LoopStack)); //###0.925 + SavedLoopStackIdx := LoopStackIdx; + {$ENDIF} + if MatchPrim (next) then begin + Result := True; + Exit; + end; + {$IFDEF ComplexBraces} + System.Move (SavedLoopStack, LoopStack, SizeOf (LoopStack)); + LoopStackIdx := SavedLoopStackIdx; + {$ENDIF} + end; + inc (no); // Couldn't or didn't - move forward. + end; { of while} + Exit; + end + else begin // greedy mode + no := regrepeat (opnd, BracesMax); // don't repeat more than max_cnt + while no >= BracesMin do begin + // If it could work, try it. + if (nextch = #0) or (reginput^ = nextch) then begin + {$IFDEF ComplexBraces} + System.Move (LoopStack, SavedLoopStack, SizeOf (LoopStack)); //###0.925 + SavedLoopStackIdx := LoopStackIdx; + {$ENDIF} + if MatchPrim (next) then begin + Result := True; + Exit; + end; + {$IFDEF ComplexBraces} + System.Move (SavedLoopStack, LoopStack, SizeOf (LoopStack)); + LoopStackIdx := SavedLoopStackIdx; + {$ENDIF} + end; + dec (no); // Couldn't or didn't - back up. + reginput := save + no; + end; { of while} + Exit; + end; + end; + EEND: begin + Result := True; // Success! + Exit; + end; + else begin + Error (reeMatchPrimMemoryCorruption); + Exit; + end; + end; { of case scan^} + scan := next; + end; { of while scan <> nil} + + // We get here only if there's trouble -- normally "case EEND" is the + // terminating point. + Error (reeMatchPrimCorruptedPointers); + end; { of function TRegExpr.MatchPrim +--------------------------------------------------------------} + +{$IFDEF UseFirstCharSet} //###0.929 +procedure TRegExpr.FillFirstCharSet (prog : PRegExprChar); + var + scan : PRegExprChar; // Current node. + next : PRegExprChar; // Next node. + opnd : PRegExprChar; + min_cnt : Integer; + begin + scan := prog; + while scan <> nil do begin + next := regnext (scan); + case PREOp (scan)^ of + BSUBEXP, BSUBEXPCI: begin //###0.938 + FirstCharSet := [#0 .. #255]; // :((( we cannot + // optimize r.e. if it starts with back reference + Exit; + end; + BOL, BOLML: ; // Exit; //###0.937 + EOL, EOLML: begin //###0.948 was empty in 0.947, was Exit in 0.937 + Include (FirstCharSet, #0); + if ModifierM + then begin + opnd := PRegExprChar (LineSeparators); + while opnd^ <> #0 do begin + Include (FirstCharSet, opnd^); + inc (opnd); + end; + end; + Exit; + end; + BOUND, NOTBOUND: ; //###0.943 ?!! + ANY, ANYML: begin // we can better define ANYML !!! + FirstCharSet := [#0 .. #255]; //###0.930 + Exit; + end; + ANYDIGIT: begin + FirstCharSet := FirstCharSet + ['0' .. '9']; + Exit; + end; + NOTDIGIT: begin + FirstCharSet := FirstCharSet + ([#0 .. #255] - ['0' .. '9']); //###0.948 FirstCharSet was forgotten + Exit; + end; + EXACTLYCI: begin + Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); + Include (FirstCharSet, InvertCase ((scan + REOpSz + RENextOffSz)^)); + Exit; + end; + EXACTLY: begin + Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); + Exit; + end; + ANYOFFULLSET: begin + FirstCharSet := FirstCharSet + PSetOfREChar (scan + REOpSz + RENextOffSz)^; + Exit; + end; + ANYOFTINYSET: begin + //!!!TinySet + Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); + Include (FirstCharSet, (scan + REOpSz + RENextOffSz + 1)^); + Include (FirstCharSet, (scan + REOpSz + RENextOffSz + 2)^); + // ... // up to TinySetLen + Exit; + end; + ANYBUTTINYSET: begin + //!!!TinySet + FirstCharSet := FirstCharSet + ([#0 .. #255] - [ //###0.948 FirstCharSet was forgotten + (scan + REOpSz + RENextOffSz)^, + (scan + REOpSz + RENextOffSz + 1)^, + (scan + REOpSz + RENextOffSz + 2)^]); + // ... // up to TinySetLen + Exit; + end; + NOTHING: ; + COMMENT: ; + BACK: ; + Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1) : begin //###0.929 + FillFirstCharSet (next); + Exit; + end; + Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): begin //###0.929 + FillFirstCharSet (next); + Exit; + end; + BRANCH: begin + if (PREOp (next)^ <> BRANCH) // No choice. + then next := scan + REOpSz + RENextOffSz // Avoid recursion. + else begin + repeat + FillFirstCharSet (scan + REOpSz + RENextOffSz); + scan := regnext (scan); + until (scan = nil) or (PREOp (scan)^ <> BRANCH); + Exit; + end; + end; + {$IFDEF ComplexBraces} + LOOPENTRY: begin //###0.925 +// LoopStack [LoopStackIdx] := 0; //###0.940 line removed + FillFirstCharSet (next); // execute LOOP + Exit; + end; + LOOP, LOOPNG: begin //###0.940 + opnd := scan + PRENextOff (scan + REOpSz + RENextOffSz + REBracesArgSz * 2)^; + min_cnt := PREBracesArg (scan + REOpSz + RENextOffSz)^; + FillFirstCharSet (opnd); + if min_cnt = 0 + then FillFirstCharSet (next); + Exit; + end; + {$ENDIF} + STAR, STARNG: //###0.940 + FillFirstCharSet (scan + REOpSz + RENextOffSz); + PLUS, PLUSNG: begin //###0.940 + FillFirstCharSet (scan + REOpSz + RENextOffSz); + Exit; + end; + BRACES, BRACESNG: begin //###0.940 + opnd := scan + REOpSz + RENextOffSz + REBracesArgSz * 2; + min_cnt := PREBracesArg (scan + REOpSz + RENextOffSz)^; // BRACES + FillFirstCharSet (opnd); + if min_cnt > 0 + then Exit; + end; + EEND: begin + FirstCharSet := [#0 .. #255]; //###0.948 + Exit; + end; + else begin + Error (reeMatchPrimMemoryCorruption); + Exit; + end; + end; { of case scan^} + scan := next; + end; { of while scan <> nil} + end; { of procedure FillFirstCharSet +--------------------------------------------------------------} +{$ENDIF} + +function TRegExpr.Exec (const AInputString : RegExprString) : Boolean; + begin + InputString := AInputString; + Result := ExecPrim (1); + end; { of function TRegExpr.Exec +--------------------------------------------------------------} + +{$IFDEF OverMeth} +{$IFNDEF FPC} +function TRegExpr.Exec : Boolean; + begin + Result := ExecPrim (1); + end; { of function TRegExpr.Exec +--------------------------------------------------------------} +{$ENDIF} +function TRegExpr.Exec (AOffset: Integer) : Boolean; + begin + Result := ExecPrim (AOffset); + end; { of function TRegExpr.Exec +--------------------------------------------------------------} +{$ENDIF} + +function TRegExpr.ExecPos (AOffset: Integer {$IFDEF DefParam}= 1{$ENDIF}) : Boolean; + begin + Result := ExecPrim (AOffset); + end; { of function TRegExpr.ExecPos +--------------------------------------------------------------} + +function TRegExpr.ExecPrim (AOffset: Integer) : Boolean; + procedure ClearMatchs; + // Clears matchs array + var i : Integer; + begin + for i := 0 to NSUBEXP - 1 do begin + startp [i] := nil; + endp [i] := nil; + end; + end; { of procedure ClearMatchs; +..............................................................} + function RegMatch (str : PRegExprChar) : Boolean; + // try match at specific point + begin + //###0.949 removed clearing of start\endp + reginput := str; + Result := MatchPrim (programm + REOpSz); + if Result then begin + startp [0] := str; + endp [0] := reginput; + end; + end; { of function RegMatch +..............................................................} + var + s : PRegExprChar; + StartPtr: PRegExprChar; + InputLen : Integer; + begin + Result := False; // Be paranoid... + + ClearMatchs; //###0.949 + // ensure that Match cleared either if optimization tricks or some error + // will lead to leaving ExecPrim without actual search. That is + // importent for ExecNext logic and so on. + + if not IsProgrammOk //###0.929 + then Exit; + + // Check InputString presence + if not Assigned (fInputString) then begin + Error (reeNoInpitStringSpecified); + Exit; + end; + + InputLen := length (fInputString); + + //Check that the start position is not negative + if AOffset < 1 then begin + Error (reeOffsetMustBeGreaterThen0); + Exit; + end; + // Check that the start position is not longer than the line + // If so then Exit with nothing found + if AOffset > (InputLen + 1) // for matching empty string after last char. + then Exit; + + StartPtr := fInputString + AOffset - 1; + + // If there is a "must appear" string, look for it. + if regmust <> nil then begin + s := StartPtr; + repeat + s := StrScan (s, regmust [0]); + if s <> nil then begin + if StrLComp (s, regmust, regmlen) = 0 + then BREAK; // Found it. + inc (s); + end; + until s = nil; + if s = nil // Not present. + then Exit; + end; + + // Mark beginning of line for ^ . + fInputStart := fInputString; + + // Pointer to end of input stream - for + // pascal-style string processing (may include #0) + fInputEnd := fInputString + InputLen; + + {$IFDEF ComplexBraces} + // no loops started + LoopStackIdx := 0; //###0.925 + {$ENDIF} + + // Simplest case: anchored match need be tried only once. + if reganch <> #0 then begin + Result := RegMatch (StartPtr); + Exit; + end; + + // Messy cases: unanchored match. + s := StartPtr; + if regstart <> #0 then // We know what char it must start with. + repeat + s := StrScan (s, regstart); + if s <> nil then begin + Result := RegMatch (s); + if Result + then Exit + else ClearMatchs; //###0.949 + inc (s); + end; + until s = nil + else begin // We don't - general case. + repeat //###0.948 + {$IFDEF UseFirstCharSet} + if s^ in FirstCharSet + then Result := RegMatch (s); + {$ELSE} + Result := RegMatch (s); + {$ENDIF} + if Result or (s^ = #0) // Exit on a match or after testing the end-of-string. + then Exit + else ClearMatchs; //###0.949 + inc (s); + until False; +(* optimized and fixed by Martin Fuller - empty strings + were not allowed to pass thru in UseFirstCharSet mode + {$IFDEF UseFirstCharSet} //###0.929 + while s^ <> #0 do begin + if s^ in FirstCharSet + then Result := RegMatch (s); + if Result + then Exit; + inc (s); + end; + {$ELSE} + repeat + Result := RegMatch (s); + if Result + then Exit; + inc (s); + until s^ = #0; + {$ENDIF} +*) + end; + // Failure +end; { of function TRegExpr.ExecPrim +--------------------------------------------------------------} + +function TRegExpr.ExecNext : Boolean; +var + offset : Integer; +begin + Result := False; + if not Assigned (startp[0]) or not Assigned (endp[0]) then + begin + Error (reeExecNextWithoutExec); + Exit; + end; +// Offset := MatchPos [0] + MatchLen [0]; +// if MatchLen [0] = 0 + Offset := endp [0] - fInputString + 1; //###0.929 + if endp [0] = startp [0] then //###0.929 + inc (Offset); // prevent infinite looping if empty string match r.e. + Result := ExecPrim (Offset); +end; { of function TRegExpr.ExecNext +--------------------------------------------------------------} + +function TRegExpr.GetInputString : RegExprString; +begin + if not Assigned (fInputString) then + begin + Error (reeGetInputStringWithoutInputString); + Exit; + end; + Result := fInputString; +end; { of function TRegExpr.GetInputString +--------------------------------------------------------------} + +procedure TRegExpr.SetInputString (const AInputString : RegExprString); +var + Len : Integer; + i : Integer; +begin + // clear Match* - before next Exec* call it's undefined + for i := 0 to NSUBEXP - 1 do + begin + startp [i] := nil; + endp [i] := nil; + end; + + // need reallocation of input string buffer ? + Len := length (AInputString); + if Assigned (fInputString) and (Length (fInputString) <> Len) then + begin + FreeMem (fInputString); + fInputString := nil; + end; + // buffer [re]allocation + if not Assigned (fInputString) then + GetMem (fInputString, (Len + 1) * SizeOf (REChar)); + + // copy input string into buffer + {$IFDEF SynRegUniCode} +// StrPCopy (fInputString, Copy (AInputString, 1, Len)); //###0.927 + StrPCopy (fInputString, AInputString); //KV Copy above is wastefull. Do not really understand why is there. + {$ELSE} + StrLCopy (fInputString, PRegExprChar (AInputString), Len); + {$ENDIF} + + { + fInputString : string; + fInputStart, fInputEnd : PRegExprChar; + + SetInputString: + fInputString := AInputString; + UniqueString (fInputString); + fInputStart := PChar (fInputString); + Len := length (fInputString); + fInputEnd := PRegExprChar (Integer (fInputStart) + Len); ?? + !! startp/endp âñå ðàâíî áóäåò îïàñíî èñïîëüçîâàòü ? + } +end; { of procedure TRegExpr.SetInputString +--------------------------------------------------------------} + +procedure TRegExpr.SetLineSeparators (const AStr : RegExprString); +begin + if AStr <> FLineSeparators then + begin + FLineSeparators := AStr; + InvalidateProgramm; + end; +end; { of procedure TRegExpr.SetLineSeparators +--------------------------------------------------------------} + +procedure TRegExpr.SetLinePairedSeparator (const AStr : RegExprString); +begin + if length (AStr) = 2 then + begin + if AStr [1] = AStr [2] then + begin + // it's impossible for our 'one-point' checking to support + // two chars separator for identical chars + Error (reeBadLinePairedSeparator); + Exit; + end; + if not fLinePairedSeparatorAssigned + or (AStr [1] <> fLinePairedSeparatorHead) + or (AStr [2] <> fLinePairedSeparatorTail) then + begin + fLinePairedSeparatorAssigned := True; + fLinePairedSeparatorHead := AStr [1]; + fLinePairedSeparatorTail := AStr [2]; + InvalidateProgramm; + end; + end + else if length (AStr) = 0 then + begin + if fLinePairedSeparatorAssigned then + begin + fLinePairedSeparatorAssigned := False; + InvalidateProgramm; + end; + end + else + Error (reeBadLinePairedSeparator); +end; { of procedure TRegExpr.SetLinePairedSeparator +--------------------------------------------------------------} + +function TRegExpr.GetLinePairedSeparator : RegExprString; + begin + if fLinePairedSeparatorAssigned then begin + {$IFDEF SynRegUniCode} + // Here is some UniCode 'magic' + // If You do know better decision to concatenate + // two WideChars, please, let me know! + Result := fLinePairedSeparatorHead; //###0.947 + Result := Result + fLinePairedSeparatorTail; + {$ELSE} + Result := fLinePairedSeparatorHead + fLinePairedSeparatorTail; + {$ENDIF} + end + else Result := ''; + end; { of function TRegExpr.GetLinePairedSeparator +--------------------------------------------------------------} + +function TRegExpr.Substitute (const ATemplate : RegExprString) : RegExprString; +// perform substitutions after a regexp match +// completely rewritten in 0.929 + var + TemplateLen : Integer; + TemplateBeg, TemplateEnd : PRegExprChar; + p, p0, ResultPtr : PRegExprChar; + ResultLen : Integer; + n : Integer; + Ch : REChar; + + function ParseVarName (var APtr : PRegExprChar) : Integer; + // extract name of variable (digits, may be enclosed with + // curly braces) from APtr^, uses TemplateEnd !!! + const + Digits = ['0' .. '9']; + var + p : PRegExprChar; + Delimited : Boolean; + begin + Result := 0; + p := APtr; + Delimited := (p < TemplateEnd) and (p^ = '{'); + if Delimited then + inc (p); // skip left curly brace + if (p < TemplateEnd) and (p^ = '&') then + inc (p) // this is '$&' or '${&}' + else + while (p < TemplateEnd) and + {$IFDEF SynRegUniCode} //###0.935 + (ord (p^) < 256) and (ansichar (p^) in Digits) + {$ELSE} + (p^ in Digits) + {$ENDIF} do + begin + Result := Result * 10 + (ord (p^) - ord ('0')); //###0.939 + inc (p); + end; + if Delimited then + if (p < TemplateEnd) and (p^ = '}') then + inc (p) // skip right curly brace + else + p := APtr; // isn't properly terminated + if p = APtr then + Result := -1; // no valid digits found or no right curly brace + APtr := p; + end; + +begin + // Check programm and input string + if not IsProgrammOk then + Exit; + if not Assigned (fInputString) then + begin + Error (reeNoInpitStringSpecified); + Exit; + end; + // Prepare for working + TemplateLen := length (ATemplate); + if TemplateLen = 0 then // prevent nil pointers + begin + Result := ''; + Exit; + end; + TemplateBeg := Pointer (ATemplate); + TemplateEnd := TemplateBeg + TemplateLen; + // Count result length for speed optimization. + ResultLen := 0; + p := TemplateBeg; + while p < TemplateEnd do begin + Ch := p^; + inc (p); + if Ch = '$' + then n := ParseVarName (p) + else n := -1; + if n >= 0 then begin + if (n < NSUBEXP) and Assigned (startp [n]) and Assigned (endp [n]) + then inc (ResultLen, endp [n] - startp [n]); + end + else begin + if (Ch = EscChar) and (p < TemplateEnd) + then inc (p); // quoted or special char followed + inc (ResultLen); + end; + end; + // Get memory. We do it once and it significant speed up work ! + if ResultLen = 0 then begin + Result := ''; + Exit; + end; + SetString (Result, nil, ResultLen); + // Fill Result + ResultPtr := Pointer (Result); + p := TemplateBeg; + while p < TemplateEnd do + begin + Ch := p^; + inc (p); + if Ch = '$' then + n := ParseVarName (p) + else + n := -1; + if n >= 0 then + begin + p0 := startp [n]; + if (n < NSUBEXP) and Assigned (p0) and Assigned (endp [n]) then + while p0 < endp [n] do + begin + ResultPtr^ := p0^; + inc (ResultPtr); + inc (p0); + end; + end + else + begin + if (Ch = EscChar) and (p < TemplateEnd) then // quoted or special char followed + begin + Ch := p^; + inc (p); + end; + ResultPtr^ := Ch; + inc (ResultPtr); + end; + end; +end; { of function TRegExpr.Substitute +--------------------------------------------------------------} + +procedure TRegExpr.Split (AInputStr : RegExprString; APieces : TStrings); +var + PrevPos: Integer; +begin + PrevPos := 1; + if Exec (AInputStr) then + repeat + APieces.Add (System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos)); + PrevPos := MatchPos [0] + MatchLen [0]; + until not ExecNext; + APieces.Add (System.Copy (AInputStr, PrevPos, MaxInt)); // Tail +end; { of procedure TRegExpr.Split +--------------------------------------------------------------} + +function TRegExpr.Replace (AInputStr : RegExprString; const AReplaceStr : RegExprString; + AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; +var + PrevPos : Integer; +begin + Result := ''; + PrevPos := 1; + if Exec (AInputStr) then + repeat + Result := Result + System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos); + if AUseSubstitution then //###0.946 + Result := Result + Substitute (AReplaceStr) + else + Result := Result + AReplaceStr; + PrevPos := MatchPos [0] + MatchLen [0]; + until not ExecNext; + Result := Result + System.Copy (AInputStr, PrevPos, MaxInt); // Tail +end; { of function TRegExpr.Replace +--------------------------------------------------------------} + +function TRegExpr.ReplaceEx (AInputStr : RegExprString; + AReplaceFunc : TRegExprReplaceFunction) + : RegExprString; +var + PrevPos : Integer; +begin + Result := ''; + PrevPos := 1; + if Exec (AInputStr) then + repeat + Result := Result + System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos) + + AReplaceFunc (Self); + PrevPos := MatchPos [0] + MatchLen [0]; + until not ExecNext; + Result := Result + System.Copy (AInputStr, PrevPos, MaxInt); // Tail +end; { of function TRegExpr.ReplaceEx +--------------------------------------------------------------} + + +{$IFDEF OverMeth} +function TRegExpr.Replace (AInputStr: RegExprString; + AReplaceFunc: TRegExprReplaceFunction): RegExprString; +begin + ReplaceEx (AInputStr, AReplaceFunc); +end; { of function TRegExpr.Replace +--------------------------------------------------------------} +{$ENDIF} + +{=============================================================} +{====================== Debug section ========================} +{=============================================================} + +{$IFDEF RegExpPCodeDump} +function TRegExpr.DumpOp (op : TREOp) : RegExprString; +// printable representation of opcode +begin + case op of + BOL: Result := 'BOL'; + EOL: Result := 'EOL'; + BOLML: Result := 'BOLML'; + EOLML: Result := 'EOLML'; + BOUND: Result := 'BOUND'; //###0.943 + NOTBOUND: Result := 'NOTBOUND'; //###0.943 + ANY: Result := 'ANY'; + ANYML: Result := 'ANYML'; //###0.941 + ANYLETTER: Result := 'ANYLETTER'; + NOTLETTER: Result := 'NOTLETTER'; + ANYDIGIT: Result := 'ANYDIGIT'; + NOTDIGIT: Result := 'NOTDIGIT'; + ANYSPACE: Result := 'ANYSPACE'; + NOTSPACE: Result := 'NOTSPACE'; + ANYOF: Result := 'ANYOF'; + ANYBUT: Result := 'ANYBUT'; + ANYOFCI: Result := 'ANYOF/CI'; + ANYBUTCI: Result := 'ANYBUT/CI'; + BRANCH: Result := 'BRANCH'; + EXACTLY: Result := 'EXACTLY'; + EXACTLYCI: Result := 'EXACTLY/CI'; + NOTHING: Result := 'NOTHING'; + COMMENT: Result := 'COMMENT'; + BACK: Result := 'BACK'; + EEND: Result := 'END'; + BSUBEXP: Result := 'BSUBEXP'; + BSUBEXPCI: Result := 'BSUBEXP/CI'; + Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1): //###0.929 + Result := Format ('OPEN[%d]', [ord (op) - ord (OPEN)]); + Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): //###0.929 + Result := Format ('CLOSE[%d]', [ord (op) - ord (CLOSE)]); + STAR: Result := 'STAR'; + PLUS: Result := 'PLUS'; + BRACES: Result := 'BRACES'; + {$IFDEF ComplexBraces} + LOOPENTRY: Result := 'LOOPENTRY'; //###0.925 + LOOP: Result := 'LOOP'; //###0.925 + LOOPNG: Result := 'LOOPNG'; //###0.940 + {$ENDIF} + ANYOFTINYSET: Result:= 'ANYOFTINYSET'; + ANYBUTTINYSET:Result:= 'ANYBUTTINYSET'; + {$IFDEF UseSetOfChar} //###0.929 + ANYOFFULLSET: Result:= 'ANYOFFULLSET'; + {$ENDIF} + STARNG: Result := 'STARNG'; //###0.940 + PLUSNG: Result := 'PLUSNG'; //###0.940 + BRACESNG: Result := 'BRACESNG'; //###0.940 + else Error (reeDumpCorruptedOpcode); + end; {of case op} + Result := ':' + Result; +end; { of function TRegExpr.DumpOp +--------------------------------------------------------------} + +function TRegExpr.Dump : RegExprString; +// dump a regexp in vaguely comprehensible form +var + s : PRegExprChar; + op : TREOp; // Arbitrary non-END op. + next : PRegExprChar; + i : Integer; + Diff : Integer; +{$IFDEF UseSetOfChar} //###0.929 + Ch : REChar; +{$ENDIF} +begin + if not IsProgrammOk then //###0.929 + Exit; + + op := EXACTLY; + Result := ''; + s := programm + REOpSz; + while op <> EEND do // While that wasn't END last time... + begin + op := s^; + Result := Result + Format ('%2d%s', [s - programm, DumpOp (s^)]); // Where, what. + next := regnext (s); + if next = nil then // Next ptr. + Result := Result + ' (0)' + else + begin + if next > s then //###0.948 PWideChar subtraction workaround (see comments in Tail method for details) + Diff := next - s + else + Diff := - (s - next); + Result := Result + Format (' (%d) ', [(s - programm) + Diff]); + end; + inc (s, REOpSz + RENextOffSz); + if (op = ANYOF) or (op = ANYOFCI) or (op = ANYBUT) or (op = ANYBUTCI) + or (op = EXACTLY) or (op = EXACTLYCI) then + begin + // Literal string, where present. + while s^ <> #0 do + begin + Result := Result + s^; + inc (s); + end; + inc (s); + end; + if (op = ANYOFTINYSET) or (op = ANYBUTTINYSET) then + begin + for i := 1 to TinySetLen do + begin + Result := Result + s^; + inc (s); + end; + end; + if (op = BSUBEXP) or (op = BSUBEXPCI) then + begin + Result := Result + ' \' + IntToStr (Ord (s^)); + inc (s); + end; + {$IFDEF UseSetOfChar} //###0.929 + if op = ANYOFFULLSET then + begin + for Ch := #0 to #255 do + if Ch in PSetOfREChar (s)^ then + if Ch < ' ' then + Result := Result + '#' + IntToStr (Ord (Ch)) //###0.936 + else + Result := Result + Ch; + inc (s, SizeOf (TSetOfREChar)); + end; + {$ENDIF} + if (op = BRACES) or (op = BRACESNG) then + begin //###0.941 + // show min/max argument of BRACES operator + Result := Result + Format ('{%d,%d}', [PREBracesArg (s)^, PREBracesArg (s + REBracesArgSz)^]); + inc (s, REBracesArgSz * 2); + end; + {$IFDEF ComplexBraces} + if (op = LOOP) or (op = LOOPNG) then + begin //###0.940 + Result := Result + Format (' -> (%d) {%d,%d}', [(s - programm - + (REOpSz + RENextOffSz)) + PRENextOff (s + 2 * REBracesArgSz)^, + PREBracesArg (s)^, PREBracesArg (s + REBracesArgSz)^]); + inc (s, 2 * REBracesArgSz + RENextOffSz); + end; + {$ENDIF} + Result := Result + #$d#$a; + end; { of while} + + // Header fields of interest. + + if regstart <> #0 then + Result := Result + 'start ' + regstart; + if reganch <> #0 then + Result := Result + 'anchored '; + if regmust <> nil then + Result := Result + 'must have ' + regmust; + {$IFDEF UseFirstCharSet} //###0.929 + Result := Result + #$d#$a'FirstCharSet:'; + for Ch := #0 to #255 do + if Ch in FirstCharSet then + begin + if Ch < ' ' then + Result := Result + '#' + IntToStr(Ord(Ch)) //###0.948 + else + Result := Result + Ch; + end; + {$ENDIF} + Result := Result + #$d#$a; +end; { of function TRegExpr.Dump +--------------------------------------------------------------} +{$ENDIF} + +{$IFDEF reRealExceptionAddr} +{$OPTIMIZATION ON} +// ReturnAddr works correctly only if compiler optimization is ON +// I placed this method at very end of unit because there are no +// way to restore compiler optimization flag ... +{$ENDIF} +procedure TRegExpr.Error (AErrorID : Integer); + +{$IFDEF reRealExceptionAddr} + function ReturnAddr : Pointer; //###0.938 + asm + mov eax,[ebp+4] + end; +{$ENDIF} + +var + e : ERegExpr; +begin + FLastError := AErrorID; // dummy stub - useless because will raise exception + if AErrorID < 1000 then // compilation error ? + e := ERegExpr.Create (ErrorMsg (AErrorID) // yes - show error pos + + ' (pos ' + IntToStr (CompilerErrorPos) + ')') + else + e := ERegExpr.Create (ErrorMsg (AErrorID)); + e.ErrorCode := AErrorID; + e.CompilerErrorPos := CompilerErrorPos; + raise + e +{$IFDEF reRealExceptionAddr} + At ReturnAddr; //###0.938 +{$ENDIF} +end; { of procedure TRegExpr.Error +--------------------------------------------------------------} + +(* + PCode persistence: + FirstCharSet + programm, regsize + regstart // -> programm + reganch // -> programm + regmust, regmlen // -> programm + fExprIsCompiled +*) + +// be carefull - placed here code will be always compiled with +// compiler optimization flag + +{$IFDEF FPC} +initialization + RegExprInvertCaseFunction := TRegExpr.InvertCaseFunction; + +{$ENDIF} +end. diff --git a/Source/VCL/SynEdit/Source/SynTextDrawer.pas b/Source/VCL/SynEdit/Source/SynTextDrawer.pas index f6dc4a41..25fc1496 100644 --- a/Source/VCL/SynEdit/Source/SynTextDrawer.pas +++ b/Source/VCL/SynEdit/Source/SynTextDrawer.pas @@ -1,1017 +1,1043 @@ -{============================================================================== - Content: TheTextDrawer, a helper class for drawing of - fixed-pitched font characters - ============================================================================== - The contents of this file are subject to the Mozilla Public License Ver. 1.0 - (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. - ============================================================================== - The Original Code is HANAI Tohru's private delphi library. - ============================================================================== - The Initial Developer of the Original Code is HANAI Tohru (Japan) - Portions created by HANAI Tohru are Copyright (C) 1999. - All Rights Reserved. - ============================================================================== - Contributor(s): HANAI Tohru - Unicode translation by Maël Hörz. - ============================================================================== - History: 01/19/1999 HANAI Tohru - Initial Version - 02/13/1999 HANAI Tohru - Changed default intercharacter spacing - 09/09/1999 HANAI Tohru - Redesigned all. Simplified interfaces. - When drawing text now it uses TextOut + SetTextCharacter- - Extra insted ExtTextOut since ExtTextOut has a little - heavy behavior. - 09/10/1999 HANAI Tohru - Added code to call ExtTextOut because there is a problem - when TextOut called with italicized raster type font. - After this changing, ExtTextOut is called without the - last parameter `lpDx' and be with SetTextCharacterExtra. - This pair performs faster than with `lpDx'. - 09/14/1999 HANAI Tohru - Changed code for saving/restoring DC - 09/15/1999 HANAI Tohru - Added X/Y parameters to ExtTextOut. - 09/16/1999 HANAI Tohru - Redesigned for multi-bytes character drawing. - 09/19/1999 HANAI Tohru - Since TheTextDrawer grew fat it was split into three - classes - TheFontStock, TheTextDrawer and TheTextDrawerEx. - Currently it should avoid TheTextDrawer because it is - slower than TheTextDrawer. - 09/25/1999 HANAI Tohru - Added internally definition of LeadBytes for Delphi 2 - 10/01/1999 HANAI Tohru - To save font resources, now all fonts data are shared - among all of TheFontStock instances. With this changing, - there added a new class `TheFontsInfoManager' to manage - those shared data. - 10/09/1999 HANAI Tohru - Added BaseStyle property to TheFontFont class. - ==============================================================================} - -// $Id: SynTextDrawer.pas,v 1.6.2.17 2008/09/17 13:59:12 maelh Exp $ - -// SynEdit note: The name had to be changed to get SynEdit to install -// together with mwEdit into the same Delphi installation - -unit SynTextDrawer; - -{$I SynEdit.inc} - -interface - -uses - SynUnicode, - SysUtils, - Classes, - Windows, - Graphics, - Math; - -const - FontStyleCount = Ord(High(TFontStyle)) +1; - FontStyleCombineCount = (1 shl FontStyleCount); - -type - PIntegerArray = ^TIntegerArray; - TIntegerArray = array[0..MaxInt div SizeOf(Integer) - 1] of Integer; - - TheStockFontPatterns = 0..FontStyleCombineCount -1; - - PheFontData = ^TheFontData; - TheFontData = record - Style: TFontStyles; - Handle: HFont; - CharAdv: Integer; - CharHeight: Integer; - end; - - PheFontsData = ^TheFontsData; - TheFontsData = array[TheStockFontPatterns] of TheFontData; - - PheSharedFontsInfo = ^TheSharedFontsInfo; - TheSharedFontsInfo = record - // reference counters - RefCount: Integer; - LockCount: Integer; - // font information - BaseFont: TFont; - BaseLF: TLogFont; - IsTrueType: Boolean; - FontsData: TheFontsData; - end; - - { TheStockFontManager } - - TheFontsInfoManager = class - private - FFontsInfo: TList; - function FindFontsInfo(const LF: TLogFont): PheSharedFontsInfo; - function CreateFontsInfo(ABaseFont: TFont; - const LF: TLogFont): PheSharedFontsInfo; - procedure DestroyFontHandles(pFontsInfo: PheSharedFontsInfo); - procedure RetrieveLogFontForComparison(ABaseFont: TFont; var LF: TLogFont); - public - constructor Create; - destructor Destroy; override; - procedure LockFontsInfo(pFontsInfo: PheSharedFontsInfo); - procedure UnLockFontsInfo(pFontsInfo: PheSharedFontsInfo); - function GetFontsInfo(ABaseFont: TFont): PheSharedFontsInfo; - procedure ReleaseFontsInfo(pFontsInfo: PheSharedFontsInfo); - end; - - { TheFontStock } - - TTextOutOptions = set of (tooOpaque, tooClipped); - - TheExtTextOutProc = procedure (X, Y: Integer; fuOptions: TTextOutOptions; - const ARect: TRect; const Text: string; Length: Integer) of object; - - EheFontStockException = class(Exception); - - TheFontStock = class - private - // private DC - FDC: HDC; - FDCRefCount: Integer; - - // Shared fonts - FpInfo: PheSharedFontsInfo; - FUsingFontHandles: Boolean; - - // Current font - FCrntFont: HFONT; - FCrntStyle: TFontStyles; - FpCrntFontData: PheFontData; - // local font info - FBaseLF: TLogFont; - function GetBaseFont: TFont; - function GetIsTrueType: Boolean; - protected - function InternalGetDC: HDC; virtual; - procedure InternalReleaseDC(Value: HDC); virtual; - function InternalCreateFont(Style: TFontStyles): HFONT; virtual; - function CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; virtual; - function GetCharAdvance: Integer; virtual; - function GetCharHeight: Integer; virtual; - function GetFontData(idx: Integer): PheFontData; virtual; - procedure UseFontHandles; - procedure ReleaseFontsInfo; - procedure SetBaseFont(Value: TFont); virtual; - procedure SetStyle(Value: TFontStyles); virtual; - property FontData[idx: Integer]: PheFontData read GetFontData; - property FontsInfo: PheSharedFontsInfo read FpInfo; - public - constructor Create(InitialFont: TFont); virtual; - destructor Destroy; override; - procedure ReleaseFontHandles; virtual; - property BaseFont: TFont read GetBaseFont; - property Style: TFontStyles read FCrntStyle write SetStyle; - property FontHandle: HFONT read FCrntFont; - property CharAdvance: Integer read GetCharAdvance; - property CharHeight: Integer read GetCharHeight; - property IsTrueType: Boolean read GetIsTrueType; - end; - - { TheTextDrawer } - EheTextDrawerException = class(Exception); - - TheTextDrawer = class(TObject) - private - FDC: HDC; - FSaveDC: Integer; - - // Font information - FFontStock: TheFontStock; - FStockBitmap: TBitmap; - FCalcExtentBaseStyle: TFontStyles; - FBaseCharWidth: Integer; - FBaseCharHeight: Integer; - - // current font and properties - FCrntFont: HFONT; - FETODist: PIntegerArray; - - // current font attributes - FColor: TColor; - FBkColor: TColor; - FCharExtra: Integer; - - // Begin/EndDrawing calling count - FDrawingCount: Integer; - - // GetCharABCWidthsW cache - FCharABCWidthCache : array [0..127] of TABC; - FCharWidthCache : array [0..127] of Integer; - - protected - procedure ReleaseETODist; virtual; - procedure AfterStyleSet; virtual; - procedure DoSetCharExtra(Value: Integer); virtual; - procedure FlushCharABCWidthCache; - function GetCachedABCWidth(c : Cardinal; var abc : TABC) : Boolean; - property StockDC: HDC read FDC; - property DrawingCount: Integer read FDrawingCount; - property FontStock: TheFontStock read FFontStock; - property BaseCharWidth: Integer read FBaseCharWidth; - property BaseCharHeight: Integer read FBaseCharHeight; - - public - constructor Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); virtual; - destructor Destroy; override; - function GetCharWidth: Integer; virtual; - function GetCharHeight: Integer; virtual; - procedure BeginDrawing(DC: HDC); virtual; - procedure EndDrawing; virtual; - procedure TextOut(X, Y: Integer; Text: PWideChar; Length: Integer); virtual; - procedure ExtTextOut(X, Y: Integer; Options: TTextOutOptions; ARect: TRect; - Text: PWideChar; Length: Integer; UseLigatures: Boolean = False); virtual; - function TextExtent(const Text: string): TSize; overload; - function TextExtent(Text: PWideChar; Count: Integer): TSize; overload; - function TextWidth(const Text: string): Integer; overload; - function TextWidth(Text: PWideChar; Count: Integer): Integer; overload; - procedure SetBaseFont(Value: TFont); virtual; - procedure SetBaseStyle(const Value: TFontStyles); virtual; - procedure SetStyle(Value: TFontStyles); virtual; - procedure SetForeColor(Value: TColor); virtual; - procedure SetBackColor(Value: TColor); virtual; - procedure SetCharExtra(Value: Integer); virtual; - procedure ReleaseTemporaryResources; virtual; - property CharWidth: Integer read GetCharWidth; - property CharHeight: Integer read GetCharHeight; - property BaseFont: TFont write SetBaseFont; - property BaseStyle: TFontStyles write SetBaseStyle; - property ForeColor: TColor write SetForeColor; - property BackColor: TColor write SetBackColor; - property Style: TFontStyles write SetStyle; - property CharExtra: Integer read FCharExtra write SetCharExtra; - end; - -function GetFontsInfoManager: TheFontsInfoManager; - -function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; - Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray; UseLigatures: Boolean = False): Boolean; - -implementation - -uses - Types, UITypes{$IFDEF SYN_UNISCRIBE}, SynUsp10{$ENDIF}; - -var - gFontsInfoManager: TheFontsInfoManager; - -{ utility routines } - -function GetFontsInfoManager: TheFontsInfoManager; -begin - if not Assigned(gFontsInfoManager) then - gFontsInfoManager := TheFontsInfoManager.Create; - Result := gFontsInfoManager; -end; - -function Min(x, y: integer): integer; -begin - if x < y then Result := x else Result := y; -end; - -// UniversalExtTextOut uses UniScribe where available for the best possible -// output quality. This also avoids a bug in (Ext)TextOut that surfaces when -// displaying a combination of Chinese and Korean text. -// -// See here for details: http://groups.google.com/group/microsoft.public.win32.programmer.international/browse_thread/thread/77cd596f2b96dc76/146300208098285c?lnk=st&q=font+substitution+problem#146300208098285c -function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; - Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray; UseLigatures: Boolean = False): Boolean; -{$IFDEF SYN_UNISCRIBE} -const - SSAnalyseFlags = SSA_GLYPHS or SSA_FALLBACK or SSA_LINK; - SpaceString: string = ' '; -{$ENDIF} -var - Glyphs: array of WideChar; - CharPlaceInfo: TGCPResults; - TextOutFlags: DWORD; -{$IFDEF SYN_UNISCRIBE} - GlyphBufferSize: Integer; - saa: TScriptStringAnalysis; -{$ENDIF} -begin - TextOutFlags := 0; - if tooOpaque in Options then - TextOutFlags := TextOutFlags or ETO_OPAQUE; - if tooClipped in Options then - TextOutFlags := TextOutFlags or ETO_CLIPPED; - -{$IFDEF SYN_UNISCRIBE} - if Usp10IsInstalled then - begin - // UniScribe requires that the string contains at least one character. - // If UniversalExtTextOut should be used to fill the background we can just - // pass a string made of a space. - if Count <= 0 then - if tooOpaque in Options then - begin - // Clipping is necessary, since depending on X, Y the space will be - // printed outside Rect and potentially fill more than we want. - TextOutFlags := TextOutFlags or ETO_CLIPPED; - Str := PWideChar(SpaceString); - Count := 1; - end - else - begin - Result := False; - Exit; - end; - - // According to the MS Windows SDK (1.5 * Count + 16) is the recommended - // value for GlyphBufferSize (see documentation of cGlyphs parameter of - // ScriptStringAnalyse function) - GlyphBufferSize := (3 * Count) div 2 + 16; - - Result := Succeeded(ScriptStringAnalyse(DC, Str, Count, GlyphBufferSize, -1, - SSAnalyseFlags, 0, nil, nil, Pointer(ETODist), nil, nil, @saa)); - Result := Result and Succeeded(ScriptStringOut(saa, X, Y, TextOutFlags, - @Rect, 0, 0, False)); - Result := Result and Succeeded(ScriptStringFree(@saa)); - end - else -{$ENDIF} - begin - if UseLigatures and (Str <> nil) and (Str^ <> WideNull) then - begin - TextOutFlags := TextOutFlags or ETO_GLYPH_INDEX; - ZeroMemory(@CharPlaceInfo, SizeOf(CharPlaceInfo)); - CharPlaceInfo.lStructSize := SizeOf(CharPlaceInfo); - SetLength(Glyphs, Length(Str)); - CharPlaceInfo.lpGlyphs := @Glyphs[0]; - CharPlaceInfo.nGlyphs := Length(Glyphs); - if GetCharacterPlacement(DC, PChar(str), Length(str), 0, CharPlaceInfo, GCP_LIGATE) <> 0 then - Result := ExtTextOutW(DC, X, Y, TextOutFlags, @Rect, Pointer(Glyphs), Length(Glyphs), - Pointer(ETODist)) - else - Result := ExtTextOutW(DC, X, Y, TextOutFlags, @Rect, Str, Count, - Pointer(ETODist)); - end - else - Result := ExtTextOutW(DC, X, Y, TextOutFlags, @Rect, Str, Count, - Pointer(ETODist)); - end; -end; - -{ TheFontsInfoManager } - -procedure TheFontsInfoManager.LockFontsInfo( - pFontsInfo: PheSharedFontsInfo); -begin - Inc(pFontsInfo^.LockCount); -end; - -constructor TheFontsInfoManager.Create; -begin - inherited; - - FFontsInfo := TList.Create; -end; - -function TheFontsInfoManager.CreateFontsInfo(ABaseFont: TFont; - const LF: TLogFont): PheSharedFontsInfo; -begin - New(Result); - FillChar(Result^, SizeOf(TheSharedFontsInfo), 0); - with Result^ do - try - BaseFont := TFont.Create; - BaseFont.Assign(ABaseFont); - BaseLF := LF; - IsTrueType := (0 <> (TRUETYPE_FONTTYPE and LF.lfPitchAndFamily)); - except - Result^.BaseFont.Free; - Dispose(Result); - raise; - end; -end; - -procedure TheFontsInfoManager.UnlockFontsInfo( - pFontsInfo: PheSharedFontsInfo); -begin - with pFontsInfo^ do - begin - Dec(LockCount); - if 0 = LockCount then - DestroyFontHandles(pFontsInfo); - end; -end; - -destructor TheFontsInfoManager.Destroy; -begin - gFontsInfoManager := nil; - - if Assigned(FFontsInfo) then - begin - while FFontsInfo.Count > 0 do - begin - ASSERT(1 = PheSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])^.RefCount); - ReleaseFontsInfo(PheSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])); - end; - FFontsInfo.Free; - end; - - inherited; -end; - -procedure TheFontsInfoManager.DestroyFontHandles( - pFontsInfo: PheSharedFontsInfo); -var - i: Integer; -begin - with pFontsInfo^ do - for i := Low(TheStockFontPatterns) to High(TheStockFontPatterns) do - with FontsData[i] do - if Handle <> 0 then - begin - DeleteObject(Handle); - Handle := 0; - end; -end; - -function TheFontsInfoManager.FindFontsInfo( - const LF: TLogFont): PheSharedFontsInfo; -var - i: Integer; -begin - for i := 0 to FFontsInfo.Count - 1 do - begin - Result := PheSharedFontsInfo(FFontsInfo[i]); - if CompareMem(@(Result^.BaseLF), @LF, SizeOf(TLogFont)) then - Exit; - end; - Result := nil; -end; - -function TheFontsInfoManager.GetFontsInfo(ABaseFont: TFont): PheSharedFontsInfo; -var - LF: TLogFont; -begin - ASSERT(Assigned(ABaseFont)); - - RetrieveLogFontForComparison(ABaseFont, LF); - Result := FindFontsInfo(LF); - if not Assigned(Result) then - begin - Result := CreateFontsInfo(ABaseFont, LF); - FFontsInfo.Add(Result); - end; - - if Assigned(Result) then - Inc(Result^.RefCount); -end; - -procedure TheFontsInfoManager.ReleaseFontsInfo(pFontsInfo: PheSharedFontsInfo); -begin - ASSERT(Assigned(pFontsInfo)); - - with pFontsInfo^ do - begin -{$IFDEF HE_ASSERT} - ASSERT(LockCount < RefCount, - 'Call DeactivateFontsInfo before calling this.'); -{$ELSE} - ASSERT(LockCount < RefCount); -{$ENDIF} - if RefCount > 1 then - Dec(RefCount) - else - begin - FFontsInfo.Remove(pFontsInfo); - // free all objects - BaseFont.Free; - Dispose(pFontsInfo); - end; - end; -end; - -procedure TheFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont; - var LF: TLogFont); -var - pEnd: PChar; -begin - GetObject(ABaseFont.Handle, SizeOf(TLogFont), @LF); - with LF do - begin - lfItalic := 0; - lfUnderline := 0; - lfStrikeOut := 0; - pEnd := StrEnd(lfFaceName); - FillChar(pEnd[1], @lfFaceName[High(lfFaceName)] - pEnd, 0); - end; -end; - -{ TheFontStock } - -// CalcFontAdvance : Calculation a advance of a character of a font. -// [*]hCalcFont will be selected as FDC's font if FDC wouldn't be zero. -function TheFontStock.CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; -var - TM: TTextMetric; - ABC: TABC; - HasABC: Boolean; -begin - // Calculate advance of a character. - // The following code uses ABC widths instead TextMetric.tmAveCharWidth - // because ABC widths always tells truth but tmAveCharWidth does not. - // A true-type font will have ABC widths but others like raster type will not - // so if the function fails then use TextMetric.tmAveCharWidth. - GetTextMetrics(DC, TM); - HasABC := GetCharABCWidths(DC, Ord('M'), Ord('M'), ABC); - if not HasABC then - begin - with ABC do - begin - abcA := 0; - abcB := TM.tmAveCharWidth; - abcC := 0; - end; - TM.tmOverhang := 0; - end; - - // Result(CharWidth) - with ABC do - Result := abcA + Integer(abcB) + abcC + TM.tmOverhang; - // pCharHeight - if Assigned(pCharHeight) then - pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading}; -end; - -constructor TheFontStock.Create(InitialFont: TFont); -begin - inherited Create; - - SetBaseFont(InitialFont); -end; - -destructor TheFontStock.Destroy; -begin - ReleaseFontsInfo; - ASSERT(FDCRefCount = 0); - - inherited; -end; - -function TheFontStock.GetBaseFont: TFont; -begin - Result := FpInfo^.BaseFont; -end; - -function TheFontStock.GetCharAdvance: Integer; -begin - Result := FpCrntFontData^.CharAdv; -end; - -function TheFontStock.GetCharHeight: Integer; -begin - Result := FpCrntFontData^.CharHeight; -end; - -function TheFontStock.GetFontData(idx: Integer): PheFontData; -begin - Result := @FpInfo^.FontsData[idx]; -end; - -function TheFontStock.GetIsTrueType: Boolean; -begin - Result := FpInfo^.IsTrueType -end; - -function TheFontStock.InternalCreateFont(Style: TFontStyles): HFONT; -const - Bolds: array[Boolean] of Integer = (400, 700); -begin - with FBaseLF do - begin - lfWeight := Bolds[fsBold in Style]; - lfItalic := Ord(BOOL(fsItalic in Style)); - lfUnderline := Ord(BOOL(fsUnderline in Style)); - lfStrikeOut := Ord(BOOL(fsStrikeOut in Style)); - end; - Result := CreateFontIndirect(FBaseLF); -end; - -function TheFontStock.InternalGetDC: HDC; -begin - if FDCRefCount = 0 then - begin - ASSERT(FDC = 0); - FDC := GetDC(0); - end; - Inc(FDCRefCount); - Result := FDC; -end; - -procedure TheFontStock.InternalReleaseDC(Value: HDC); -begin - Dec(FDCRefCount); - if FDCRefCount <= 0 then - begin - ASSERT((FDC <> 0) and (FDC = Value)); - ReleaseDC(0, FDC); - FDC := 0; - ASSERT(FDCRefCount = 0); - end; -end; - -procedure TheFontStock.ReleaseFontHandles; -begin - if FUsingFontHandles then - with GetFontsInfoManager do - begin - UnlockFontsInfo(FpInfo); - FUsingFontHandles := False; - end; -end; - -procedure TheFontStock.ReleaseFontsInfo; -begin - if Assigned(FpInfo) then - with GetFontsInfoManager do - begin - if FUsingFontHandles then - begin - UnlockFontsInfo(FpInfo); - FUsingFontHandles := False; - end; - ReleaseFontsInfo(FpInfo); - FpInfo := nil; - end; -end; - -procedure TheFontStock.SetBaseFont(Value: TFont); -var - pInfo: PheSharedFontsInfo; -begin - if Assigned(Value) then - begin - pInfo := GetFontsInfoManager.GetFontsInfo(Value); - if pInfo = FpInfo then - GetFontsInfoManager.ReleaseFontsInfo(pInfo) - else - begin - ReleaseFontsInfo; - FpInfo := pInfo; - FBaseLF := FpInfo^.BaseLF; - SetStyle(Value.Style); - end; - end - else - raise EheFontStockException.Create('SetBaseFont: ''Value'' must be specified.'); -end; - -procedure TheFontStock.SetStyle(Value: TFontStyles); -var - idx: Integer; - DC: HDC; - hOldFont: HFONT; - p: PheFontData; -begin -{$IFDEF HE_ASSERT} - ASSERT(SizeOf(TFontStyles) = 1, - 'TheTextDrawer.SetStyle: There''s more than four font styles but the current '+ - 'code expects only four styles.'); -{$ELSE} - ASSERT(SizeOf(TFontStyles) = 1); -{$ENDIF} - - idx := Byte(Value); - ASSERT(idx <= High(TheStockFontPatterns)); - - UseFontHandles; - p := FontData[idx]; - if FpCrntFontData = p then - Exit; - - FpCrntFontData := p; - with p^ do - if Handle <> 0 then - begin - FCrntFont := Handle; - FCrntStyle := Style; - Exit; - end; - - // create font - FCrntFont := InternalCreateFont(Value); - DC := InternalGetDC; - hOldFont := SelectObject(DC, FCrntFont); - - // retrieve height and advances of new font - with FpCrntFontData^ do - begin - Handle := FCrntFont; - CharAdv := CalcFontAdvance(DC, @CharHeight); - end; - - SelectObject(DC, hOldFont); - InternalReleaseDC(DC); -end; - -procedure TheFontStock.UseFontHandles; -begin - if not FUsingFontHandles then - with GetFontsInfoManager do - begin - LockFontsInfo(FpInfo); - FUsingFontHandles := True; - end; -end; - -{ TheTextDrawer } - -constructor TheTextDrawer.Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); -begin - inherited Create; - - FFontStock := TheFontStock.Create(BaseFont); - FStockBitmap := TBitmap.Create; - FCalcExtentBaseStyle := CalcExtentBaseStyle; - SetBaseFont(BaseFont); - FColor := clWindowText; - FBkColor := clWindow; -end; - -destructor TheTextDrawer.Destroy; -begin - FStockBitmap.Free; - FFontStock.Free; - ReleaseETODist; - - inherited; -end; - -procedure TheTextDrawer.ReleaseETODist; -begin - if Assigned(FETODist) then - begin - FreeMem(FETODist); - FETODist := nil; - end; -end; - -procedure TheTextDrawer.BeginDrawing(DC: HDC); -begin - if (FDC = DC) then - ASSERT(FDC <> 0) - else - begin - ASSERT((FDC = 0) and (DC <> 0) and (FDrawingCount = 0)); - FDC := DC; - FSaveDC := SaveDC(DC); - SelectObject(DC, FCrntFont); - Windows.SetTextColor(DC, ColorToRGB(FColor)); - Windows.SetBkColor(DC, ColorToRGB(FBkColor)); - DoSetCharExtra(FCharExtra); - end; - Inc(FDrawingCount); -end; - -procedure TheTextDrawer.EndDrawing; -begin - ASSERT(FDrawingCount >= 1); - Dec(FDrawingCount); - if FDrawingCount <= 0 then - begin - if FDC <> 0 then - RestoreDC(FDC, FSaveDC); - FSaveDC := 0; - FDC := 0; - FDrawingCount := 0; - end; -end; - -function TheTextDrawer.GetCharWidth: Integer; -begin - Result := FBaseCharWidth + FCharExtra; -end; - -function TheTextDrawer.GetCharHeight: Integer; -begin - Result := FBaseCharHeight; -end; - -procedure TheTextDrawer.SetBaseFont(Value: TFont); -begin - if Assigned(Value) then - begin - FlushCharABCWidthCache; - ReleaseETODist; - FStockBitmap.Canvas.Font.Assign(Value); - FStockBitmap.Canvas.Font.Style := []; - with FFontStock do - begin - SetBaseFont(Value); - Style := FCalcExtentBaseStyle; - FBaseCharWidth := CharAdvance; - FBaseCharHeight := CharHeight; - end; - SetStyle(Value.Style); - end - else - raise EheTextDrawerException.Create('SetBaseFont: ''Value'' must be specified.'); -end; - -procedure TheTextDrawer.SetBaseStyle(const Value: TFontStyles); -begin - if FCalcExtentBaseStyle <> Value then - begin - FCalcExtentBaseStyle := Value; - FlushCharABCWidthCache; - ReleaseETODist; - with FFontStock do - begin - Style := Value; - FBaseCharWidth := CharAdvance; - FBaseCharHeight := CharHeight; - end; - end; -end; - -procedure TheTextDrawer.SetStyle(Value: TFontStyles); -begin - with FFontStock do - begin - SetStyle(Value); - Self.FCrntFont := FontHandle; - end; - AfterStyleSet; -end; - -procedure TheTextDrawer.AfterStyleSet; -begin - if FDC <> 0 then - SelectObject(FDC, FCrntFont); -end; - -procedure TheTextDrawer.SetForeColor(Value: TColor); -begin - if FColor <> Value then - begin - FColor := Value; - if FDC <> 0 then - SetTextColor(FDC, ColorToRGB(Value)); - end; -end; - -procedure TheTextDrawer.SetBackColor(Value: TColor); -begin - if FBkColor <> Value then - begin - FBkColor := Value; - if FDC <> 0 then - Windows.SetBkColor(FDC, ColorToRGB(Value)); - end; -end; - -procedure TheTextDrawer.SetCharExtra(Value: Integer); -begin - if FCharExtra <> Value then - begin - FCharExtra := Value; - DoSetCharExtra(FCharExtra); - end; -end; - -procedure TheTextDrawer.DoSetCharExtra(Value: Integer); -begin - if FDC <> 0 then - SetTextCharacterExtra(FDC, Value); -end; - -procedure TheTextDrawer.FlushCharABCWidthCache; -begin - FillChar(FCharABCWidthCache, SizeOf(TABC)*Length(FCharABCWidthCache), 0); - FillChar(FCharWidthCache, SizeOf(Integer)*Length(FCharWidthCache), 0); -end; - -function TheTextDrawer.GetCachedABCWidth(c : Cardinal; var abc : TABC) : Boolean; -begin - if c>High(FCharABCWidthCache) then begin - Result:=GetCharABCWidthsW(FDC, c, c, abc); - Exit; - end; - abc:=FCharABCWidthCache[c]; - if (abc.abcA or Integer(abc.abcB) or abc.abcC)=0 then begin - Result:=GetCharABCWidthsW(FDC, c, c, abc); - if Result then - FCharABCWidthCache[c]:=abc; - end else Result:=True; -end; - -procedure TheTextDrawer.TextOut(X, Y: Integer; Text: PWideChar; - Length: Integer); -var - r: TRect; -begin - r := Rect(X, Y, X, Y); - UniversalExtTextOut(FDC, X, Y, [], r, Text, Length, nil); -end; - -procedure TheTextDrawer.ExtTextOut(X, Y: Integer; Options: TTextOutOptions; - ARect: TRect; Text: PWideChar; Length: Integer; UseLigatures: Boolean = False); - - procedure InitETODist(CharWidth: Integer); - var - Size: TSize; - i: Integer; - begin - ReallocMem(FETODist, Length * SizeOf(Integer)); - for i := 0 to Length - 1 do - begin - Size := TextExtent(PWideChar(@Text[i]), 1); - if Size.cx <> CharWidth then - FETODist[i] := Ceil(Size.cx / CharWidth) * CharWidth - else FETODist[i] := CharWidth; - end; - end; - - procedure AdjustLastCharWidthAndRect; - var - LastChar: Cardinal; - RealCharWidth, CharWidth: Integer; - CharInfo: TABC; - tm: TTextMetricA; - begin - if Length <= 0 then Exit; - - LastChar := Ord(Text[Length - 1]); - CharWidth := FETODist[Length - 1]; - RealCharWidth := CharWidth; - if GetCachedABCWidth(LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(FDC, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; - if RealCharWidth > CharWidth then - Inc(ARect.Right, RealCharWidth - CharWidth); - FETODist[Length - 1] := Max(RealCharWidth, CharWidth); - end; - -begin - InitETODist(GetCharWidth); - AdjustLastCharWidthAndRect; - UniversalExtTextOut(FDC, X, Y, Options, ARect, Text, Length, FETODist, UseLigatures); -end; - -procedure TheTextDrawer.ReleaseTemporaryResources; -begin - FFontStock.ReleaseFontHandles; -end; - -function TheTextDrawer.TextExtent(const Text: string): TSize; -begin - Result := FStockBitmap.Canvas.TextExtent(Text); -end; - -function TheTextDrawer.TextExtent(Text: PWideChar; Count: Integer): TSize; -begin - Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count); -end; - -function TheTextDrawer.TextWidth(const Text: string): Integer; -var - c : Cardinal; -begin - if Length(Text)=1 then begin - c:=Ord(Text[1]); - if c<=High(FCharWidthCache) then begin - Result:=FCharWidthCache[c]; - if Result=0 then begin - Result:=FStockBitmap.Canvas.TextExtent(Text).cX; - FCharWidthCache[c]:=Result; - end; - Exit; - end; - end; - Result := FStockBitmap.Canvas.TextExtent(Text).cX; -end; - -function TheTextDrawer.TextWidth(Text: PWideChar; Count: Integer): Integer; -begin - Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count).cX; -end; - -initialization - -finalization - gFontsInfoManager.Free; - -end. +{============================================================================== + Content: TSynTextDrawer, a helper class for drawing of + fixed-pitched font characters + ============================================================================== + The contents of this file are subject to the Mozilla Public License Ver. 1.0 + (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. + ============================================================================== + The Original Code is HANAI Tohru's private delphi library. + ============================================================================== + The Initial Developer of the Original Code is HANAI Tohru (Japan) + Portions created by HANAI Tohru are Copyright (C) 1999. + All Rights Reserved. + ============================================================================== + Contributor(s): HANAI Tohru + Unicode translation by Maël Hörz. + ============================================================================== + History: 01/19/1999 HANAI Tohru + Initial Version + 02/13/1999 HANAI Tohru + Changed default intercharacter spacing + 09/09/1999 HANAI Tohru + Redesigned all. Simplified interfaces. + When drawing text now it uses TextOut + SetTextCharacter- + Extra insted ExtTextOut since ExtTextOut has a little + heavy behavior. + 09/10/1999 HANAI Tohru + Added code to call ExtTextOut because there is a problem + when TextOut called with italicized raster type font. + After this changing, ExtTextOut is called without the + last parameter `lpDx' and be with SetTextCharacterExtra. + This pair performs faster than with `lpDx'. + 09/14/1999 HANAI Tohru + Changed code for saving/restoring DC + 09/15/1999 HANAI Tohru + Added X/Y parameters to ExtTextOut. + 09/16/1999 HANAI Tohru + Redesigned for multi-bytes character drawing. + 09/19/1999 HANAI Tohru + Since TSynTextDrawer grew fat it was split into three + classes - TSynFontStock, TSynTextDrawer and TheTextDrawerEx. + Currently it should avoid TSynTextDrawer because it is + slower than TSynTextDrawer. + 09/25/1999 HANAI Tohru + Added internally definition of LeadBytes for Delphi 2 + 10/01/1999 HANAI Tohru + To save font resources, now all fonts data are shared + among all of TSynFontStock instances. With this changing, + there added a new class `TSynFontsInfoManager' to manage + those shared data. + 10/09/1999 HANAI Tohru + Added BaseStyle property to TheFontFont class. + ==============================================================================} + +// $Id: SynTextDrawer.pas,v 1.6.2.17 2008/09/17 13:59:12 maelh Exp $ + +// SynEdit note: The name had to be changed to get SynEdit to install +// together with mwEdit into the same Delphi installation + +unit SynTextDrawer; + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_COMPILER_17_UP} + Types, UITypes, + {$ENDIF} + SynUnicode, + SynEditTypes, + SysUtils, + Classes, + Windows, + Graphics; + +const + FontStyleCount = Ord(High(TFontStyle)) + 1; + FontStyleCombineCount = (1 shl FontStyleCount); + +type + PIntegerArray = ^TIntegerArray; + TIntegerArray = array[0..MaxInt div SizeOf(Integer) - 1] of Integer; + + TSynStockFontPatterns = 0..FontStyleCombineCount - 1; + + PSynFontData = ^TSynFontData; + TSynFontData = record + Style: TFontStyles; + Handle: HFont; + CharAdv: Integer; + CharHeight: Integer; + end; + + PSynFontsData = ^TSynFontsData; + TSynFontsData = array[TSynStockFontPatterns] of TSynFontData; + + PSynSharedFontsInfo = ^TSynSharedFontsInfo; + TSynSharedFontsInfo = record + // reference counters + RefCount: Integer; + LockCount: Integer; + // font information + BaseFont: TFont; + BaseLF: TLogFont; + IsTrueType: Boolean; + FontsData: TSynFontsData; + end; + + { TSynStockFontManager } + + TSynFontsInfoManager = class + private + FFontsInfo: TList; + function FindFontsInfo(const LF: TLogFont): PSynSharedFontsInfo; + function CreateFontsInfo(ABaseFont: TFont; + const LF: TLogFont): PSynSharedFontsInfo; + procedure DestroyFontHandles(pFontsInfo: PSynSharedFontsInfo); + procedure RetrieveLogFontForComparison(ABaseFont: TFont; var LF: TLogFont); + public + constructor Create; + destructor Destroy; override; + + procedure LockFontsInfo(pFontsInfo: PSynSharedFontsInfo); + procedure UnLockFontsInfo(pFontsInfo: PSynSharedFontsInfo); + function GetFontsInfo(ABaseFont: TFont): PSynSharedFontsInfo; + procedure ReleaseFontsInfo(pFontsInfo: PSynSharedFontsInfo); + end; + + { TSynFontStock } + + TTextOutOptions = set of (tooOpaque, tooClipped); + + TSynExtTextOutProc = procedure (X, Y: Integer; fuOptions: TTextOutOptions; + const ARect: TRect; const Text: UnicodeString; Length: Integer) of object; + + ESynFontStockException = class(ESynError); + + TSynFontStock = class + private + // Private DC + FDC: HDC; + FDCRefCount: Integer; + + // Shared fonts + FpInfo: PSynSharedFontsInfo; + FUsingFontHandles: Boolean; + + // Current font + FCrntFont: HFONT; + FCrntStyle: TFontStyles; + FpCrntFontData: PSynFontData; + + // Local font info + FBaseLF: TLogFont; + function GetBaseFont: TFont; + function GetIsTrueType: Boolean; + protected + function InternalGetDC: HDC; virtual; + procedure InternalReleaseDC(Value: HDC); virtual; + function InternalCreateFont(Style: TFontStyles): HFONT; virtual; + function CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; virtual; + function GetCharAdvance: Integer; virtual; + function GetCharHeight: Integer; virtual; + function GetFontData(idx: Integer): PSynFontData; virtual; + procedure UseFontHandles; + procedure ReleaseFontsInfo; + procedure SetBaseFont(Value: TFont); virtual; + procedure SetStyle(Value: TFontStyles); virtual; + + property FontData[idx: Integer]: PSynFontData read GetFontData; + property FontsInfo: PSynSharedFontsInfo read FpInfo; + public + constructor Create(InitialFont: TFont); virtual; + destructor Destroy; override; + + procedure ReleaseFontHandles; virtual; + + property BaseFont: TFont read GetBaseFont; + property Style: TFontStyles read FCrntStyle write SetStyle; + property FontHandle: HFONT read FCrntFont; + property CharAdvance: Integer read GetCharAdvance; + property CharHeight: Integer read GetCharHeight; + property IsTrueType: Boolean read GetIsTrueType; + end; + + { TSynTextDrawer } + ESynTextDrawerException = class(ESynError); + + TSynTextDrawer = class(TObject) + private + FDC: HDC; + FSaveDC: Integer; + + // Font information + FFontStock: TSynFontStock; + FStockBitmap: TBitmap; + FCalcExtentBaseStyle: TFontStyles; + FBaseCharWidth: Integer; + FBaseCharHeight: Integer; + + // Current font and properties + FCrntFont: HFONT; + FETODist: PIntegerArray; + + // Current font attributes + FColor: TColor; + FBkColor: TColor; + FCharExtra: Integer; + + // Begin/EndDrawing calling count + FDrawingCount: Integer; + + // GetCharABCWidthsW cache + FCharABCWidthCache: array [0..127] of TABC; + FCharWidthCache: array [0..127] of Integer; + protected + procedure ReleaseETODist; virtual; + procedure AfterStyleSet; virtual; + procedure DoSetCharExtra(Value: Integer); virtual; + procedure FlushCharABCWidthCache; + function GetCachedABCWidth(c : Cardinal; var abc : TABC) : Boolean; + + property StockDC: HDC read FDC; + property DrawingCount: Integer read FDrawingCount; + property FontStock: TSynFontStock read FFontStock; + property BaseCharWidth: Integer read FBaseCharWidth; + property BaseCharHeight: Integer read FBaseCharHeight; + public + constructor Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); virtual; + destructor Destroy; override; + + function GetCharWidth: Integer; virtual; + function GetCharHeight: Integer; virtual; + + procedure BeginDrawing(DC: HDC); virtual; + procedure EndDrawing; virtual; + + procedure TextOut(X, Y: Integer; Text: PWideChar; Length: Integer); virtual; + procedure ExtTextOut(X, Y: Integer; Options: TTextOutOptions; ARect: TRect; + Text: PWideChar; Length: Integer); virtual; + function TextExtent(const Text: UnicodeString): TSize; overload; + function TextExtent(Text: PWideChar; Count: Integer): TSize; overload; + function TextWidth(const Char: WideChar): Integer; overload; + function TextWidth(const Text: UnicodeString): Integer; overload; + function TextWidth(Text: PWideChar; Count: Integer): Integer; overload; + procedure SetBaseFont(Value: TFont); virtual; + procedure SetBaseStyle(const Value: TFontStyles); virtual; + procedure SetStyle(Value: TFontStyles); virtual; + procedure SetForeColor(Value: TColor); virtual; + procedure SetBackColor(Value: TColor); virtual; + procedure SetCharExtra(Value: Integer); virtual; + procedure ReleaseTemporaryResources; virtual; + + property CharWidth: Integer read GetCharWidth; + property CharHeight: Integer read GetCharHeight; + property BaseFont: TFont write SetBaseFont; + property BaseStyle: TFontStyles write SetBaseStyle; + property ForeColor: TColor write SetForeColor; + property BackColor: TColor write SetBackColor; + property Style: TFontStyles write SetStyle; + property CharExtra: Integer read FCharExtra write SetCharExtra; + end; + +function GetFontsInfoManager: TSynFontsInfoManager; + +function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; + Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray): Boolean; + +implementation + +uses + Math +{$IFDEF SYN_UNISCRIBE} + , SynUsp10 +{$ENDIF} + ; + +var + GFontsInfoManager: TSynFontsInfoManager; + +{ utility routines } + +function GetFontsInfoManager: TSynFontsInfoManager; +begin + if not Assigned(GFontsInfoManager) then + GFontsInfoManager := TSynFontsInfoManager.Create; + Result := GFontsInfoManager; +end; + +// UniversalExtTextOut uses UniScribe where available for the best possible +// output quality. This also avoids a bug in (Ext)TextOut that surfaces when +// displaying a combination of Chinese and Korean text. +// +// See here for details: http://groups.google.com/group/microsoft.public.win32.programmer.international/browse_thread/thread/77cd596f2b96dc76/146300208098285c?lnk=st&q=font+substitution+problem#146300208098285c +function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; + Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray): Boolean; +{$IFDEF SYN_UNISCRIBE} +const + SSAnalyseFlags = SSA_GLYPHS or SSA_FALLBACK or SSA_LINK; + SpaceString: UnicodeString = ' '; +{$ENDIF} +var + TextOutFlags: DWORD; +{$IFDEF SYN_UNISCRIBE} + GlyphBufferSize: Integer; + saa: TScriptStringAnalysis; +{$ENDIF} +begin + TextOutFlags := 0; + if tooOpaque in Options then + TextOutFlags := TextOutFlags or ETO_OPAQUE; + if tooClipped in Options then + TextOutFlags := TextOutFlags or ETO_CLIPPED; + +{$IFDEF SYN_UNISCRIBE} + if Usp10IsInstalled then + begin + // UniScribe requires that the string contains at least one character. + // If UniversalExtTextOut should be used to fill the background we can just + // pass a string made of a space. + if Count <= 0 then + if tooOpaque in Options then + begin + // Clipping is necessary, since depending on X, Y the space will be + // printed outside Rect and potentially fill more than we want. + TextOutFlags := TextOutFlags or ETO_CLIPPED; + Str := PWideChar(SpaceString); + Count := 1; + end + else + begin + Result := False; + Exit; + end; + + // According to the MS Windows SDK (1.5 * Count + 16) is the recommended + // value for GlyphBufferSize (see documentation of cGlyphs parameter of + // ScriptStringAnalyse function) + GlyphBufferSize := (3 * Count) div 2 + 16; + + Result := Succeeded(ScriptStringAnalyse(DC, Str, Count, GlyphBufferSize, -1, + SSAnalyseFlags, 0, nil, nil, Pointer(ETODist), nil, nil, @saa)); + Result := Result and Succeeded(ScriptStringOut(saa, X, Y, TextOutFlags, + @Rect, 0, 0, False)); + Result := Result and Succeeded(ScriptStringFree(@saa)); + end + else +{$ENDIF} + begin + Result := ExtTextOutW(DC, X, Y, TextOutFlags, @Rect, Str, Count, + Pointer(ETODist)); + end; +end; + +{ TSynFontsInfoManager } + +procedure TSynFontsInfoManager.LockFontsInfo( + pFontsInfo: PSynSharedFontsInfo); +begin + Inc(pFontsInfo^.LockCount); +end; + +constructor TSynFontsInfoManager.Create; +begin + inherited; + + FFontsInfo := TList.Create; +end; + +function TSynFontsInfoManager.CreateFontsInfo(ABaseFont: TFont; + const LF: TLogFont): PSynSharedFontsInfo; +begin + New(Result); + FillChar(Result^, SizeOf(TSynSharedFontsInfo), 0); + with Result^ do + try + BaseFont := TFont.Create; + BaseFont.Assign(ABaseFont); + BaseLF := LF; + IsTrueType := (0 <> (TRUETYPE_FONTTYPE and LF.lfPitchAndFamily)); + except + Result^.BaseFont.Free; + Dispose(Result); + raise; + end; +end; + +procedure TSynFontsInfoManager.UnlockFontsInfo( + pFontsInfo: PSynSharedFontsInfo); +begin + with pFontsInfo^ do + begin + Dec(LockCount); + if 0 = LockCount then + DestroyFontHandles(pFontsInfo); + end; +end; + +destructor TSynFontsInfoManager.Destroy; +begin + GFontsInfoManager := nil; + + if Assigned(FFontsInfo) then + begin + while FFontsInfo.Count > 0 do + begin + Assert(1 = PSynSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])^.RefCount); + ReleaseFontsInfo(PSynSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])); + end; + FFontsInfo.Free; + end; + + inherited; +end; + +procedure TSynFontsInfoManager.DestroyFontHandles( + pFontsInfo: PSynSharedFontsInfo); +var + i: Integer; +begin + with pFontsInfo^ do + for i := Low(TSynStockFontPatterns) to High(TSynStockFontPatterns) do + with FontsData[i] do + if Handle <> 0 then + begin + DeleteObject(Handle); + Handle := 0; + end; +end; + +function TSynFontsInfoManager.FindFontsInfo( + const LF: TLogFont): PSynSharedFontsInfo; +var + i: Integer; +begin + for i := 0 to FFontsInfo.Count - 1 do + begin + Result := PSynSharedFontsInfo(FFontsInfo[i]); + if CompareMem(@(Result^.BaseLF), @LF, SizeOf(TLogFont)) then + Exit; + end; + Result := nil; +end; + +function TSynFontsInfoManager.GetFontsInfo(ABaseFont: TFont): PSynSharedFontsInfo; +var + LF: TLogFont; +begin + Assert(Assigned(ABaseFont)); + + RetrieveLogFontForComparison(ABaseFont, LF); + Result := FindFontsInfo(LF); + if not Assigned(Result) then + begin + Result := CreateFontsInfo(ABaseFont, LF); + FFontsInfo.Add(Result); + end; + + if Assigned(Result) then + Inc(Result^.RefCount); +end; + +procedure TSynFontsInfoManager.ReleaseFontsInfo(pFontsInfo: PSynSharedFontsInfo); +begin + Assert(Assigned(pFontsInfo)); + + with pFontsInfo^ do + begin + Assert(LockCount < RefCount, 'Call DeactivateFontsInfo before calling this.'); + if RefCount > 1 then + Dec(RefCount) + else + begin + FFontsInfo.Remove(pFontsInfo); + // free all objects + BaseFont.Free; + Dispose(pFontsInfo); + end; + end; +end; + +procedure TSynFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont; + var LF: TLogFont); +var + pEnd: PChar; +begin + GetObject(ABaseFont.Handle, SizeOf(TLogFont), @LF); + with LF do + begin + lfItalic := 0; + lfUnderline := 0; + lfStrikeOut := 0; + pEnd := StrEnd(lfFaceName); + FillChar(pEnd[1], @lfFaceName[High(lfFaceName)] - pEnd, 0); + end; +end; + +{ TSynFontStock } + +// CalcFontAdvance : Calculation a advance of a character of a font. +// [*]hCalcFont will be selected as FDC's font if FDC wouldn't be zero. +function TSynFontStock.CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; +var + TM: TTextMetric; + ABC: TABC; + HasABC: Boolean; +begin + // Calculate advance of a character. + // The following code uses ABC widths instead TextMetric.tmAveCharWidth + // because ABC widths always tells truth but tmAveCharWidth does not. + // A true-type font will have ABC widths but others like raster type will not + // so if the function fails then use TextMetric.tmAveCharWidth. + GetTextMetrics(DC, TM); + HasABC := GetCharABCWidths(DC, Ord('M'), Ord('M'), ABC); + if not HasABC then + begin + with ABC do + begin + abcA := 0; + abcB := TM.tmAveCharWidth; + abcC := 0; + end; + TM.tmOverhang := 0; + end; + + // Result(CharWidth) + with ABC do + Result := abcA + Integer(abcB) + abcC + TM.tmOverhang; + // pCharHeight + if Assigned(pCharHeight) then + pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading}; +end; + +constructor TSynFontStock.Create(InitialFont: TFont); +begin + inherited Create; + + SetBaseFont(InitialFont); +end; + +destructor TSynFontStock.Destroy; +begin + ReleaseFontsInfo; + Assert(FDCRefCount = 0); + + inherited; +end; + +function TSynFontStock.GetBaseFont: TFont; +begin + Result := FpInfo^.BaseFont; +end; + +function TSynFontStock.GetCharAdvance: Integer; +begin + Result := FpCrntFontData^.CharAdv; +end; + +function TSynFontStock.GetCharHeight: Integer; +begin + Result := FpCrntFontData^.CharHeight; +end; + +function TSynFontStock.GetFontData(idx: Integer): PSynFontData; +begin + Result := @FpInfo^.FontsData[idx]; +end; + +function TSynFontStock.GetIsTrueType: Boolean; +begin + Result := FpInfo^.IsTrueType +end; + +function TSynFontStock.InternalCreateFont(Style: TFontStyles): HFONT; +const + Bolds: array[Boolean] of Integer = (400, 700); +begin + with FBaseLF do + begin + lfWeight := Bolds[fsBold in Style]; + lfItalic := Ord(BOOL(fsItalic in Style)); + lfUnderline := Ord(BOOL(fsUnderline in Style)); + lfStrikeOut := Ord(BOOL(fsStrikeOut in Style)); + end; + Result := CreateFontIndirect(FBaseLF); +end; + +function TSynFontStock.InternalGetDC: HDC; +begin + if FDCRefCount = 0 then + begin + Assert(FDC = 0); + FDC := GetDC(0); + end; + Inc(FDCRefCount); + Result := FDC; +end; + +procedure TSynFontStock.InternalReleaseDC(Value: HDC); +begin + Dec(FDCRefCount); + if FDCRefCount <= 0 then + begin + Assert((FDC <> 0) and (FDC = Value)); + ReleaseDC(0, FDC); + FDC := 0; + Assert(FDCRefCount = 0); + end; +end; + +procedure TSynFontStock.ReleaseFontHandles; +begin + if FUsingFontHandles then + with GetFontsInfoManager do + begin + UnlockFontsInfo(FpInfo); + FUsingFontHandles := False; + end; +end; + +procedure TSynFontStock.ReleaseFontsInfo; +begin + if Assigned(FpInfo) then + with GetFontsInfoManager do + begin + if FUsingFontHandles then + begin + UnlockFontsInfo(FpInfo); + FUsingFontHandles := False; + end; + ReleaseFontsInfo(FpInfo); + FpInfo := nil; + end; +end; + +procedure TSynFontStock.SetBaseFont(Value: TFont); +var + pInfo: PSynSharedFontsInfo; +begin + if Assigned(Value) then + begin + pInfo := GetFontsInfoManager.GetFontsInfo(Value); + if pInfo = FpInfo then + GetFontsInfoManager.ReleaseFontsInfo(pInfo) + else + begin + ReleaseFontsInfo; + FpInfo := pInfo; + FBaseLF := FpInfo^.BaseLF; + SetStyle(Value.Style); + end; + end + else + raise ESynFontStockException.Create('SetBaseFont: ''Value'' must be specified.'); +end; + +procedure TSynFontStock.SetStyle(Value: TFontStyles); +var + idx: Integer; + DC: HDC; + hOldFont: HFONT; + p: PSynFontData; +begin + Assert(SizeOf(TFontStyles) = 1, + 'TheTextDrawer.SetStyle: There''s more than four font styles but the current '+ + 'code expects only four styles.'); + + idx := Byte(Value); + Assert(idx <= High(TSynStockFontPatterns)); + + UseFontHandles; + p := FontData[idx]; + if FpCrntFontData = p then + Exit; + + FpCrntFontData := p; + with p^ do + if Handle <> 0 then + begin + FCrntFont := Handle; + FCrntStyle := Style; + Exit; + end; + + // create font + FCrntFont := InternalCreateFont(Value); + DC := InternalGetDC; + hOldFont := SelectObject(DC, FCrntFont); + + // retrieve height and advances of new font + with FpCrntFontData^ do + begin + Handle := FCrntFont; + CharAdv := CalcFontAdvance(DC, @CharHeight); + end; + + SelectObject(DC, hOldFont); + InternalReleaseDC(DC); +end; + +procedure TSynFontStock.UseFontHandles; +begin + if not FUsingFontHandles then + with GetFontsInfoManager do + begin + LockFontsInfo(FpInfo); + FUsingFontHandles := True; + end; +end; + +{ TSynTextDrawer } + +constructor TSynTextDrawer.Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); +begin + inherited Create; + + FFontStock := TSynFontStock.Create(BaseFont); + FStockBitmap := TBitmap.Create; + FCalcExtentBaseStyle := CalcExtentBaseStyle; + SetBaseFont(BaseFont); + FColor := clWindowText; + FBkColor := clWindow; +end; + +destructor TSynTextDrawer.Destroy; +begin + FStockBitmap.Free; + FFontStock.Free; + ReleaseETODist; + + inherited; +end; + +procedure TSynTextDrawer.ReleaseETODist; +begin + if Assigned(FETODist) then + begin + FreeMem(FETODist); + FETODist := nil; + end; +end; + +procedure TSynTextDrawer.BeginDrawing(DC: HDC); +begin + if (FDC = DC) then + Assert(FDC <> 0) + else + begin + Assert((FDC = 0) and (DC <> 0) and (FDrawingCount = 0)); + FDC := DC; + FSaveDC := SaveDC(DC); + SelectObject(DC, FCrntFont); + Windows.SetTextColor(DC, ColorToRGB(FColor)); + Windows.SetBkColor(DC, ColorToRGB(FBkColor)); + DoSetCharExtra(FCharExtra); + end; + Inc(FDrawingCount); +end; + +procedure TSynTextDrawer.EndDrawing; +begin + Assert(FDrawingCount >= 1); + Dec(FDrawingCount); + if FDrawingCount <= 0 then + begin + if FDC <> 0 then + RestoreDC(FDC, FSaveDC); + FSaveDC := 0; + FDC := 0; + FDrawingCount := 0; + end; +end; + +function TSynTextDrawer.GetCharWidth: Integer; +begin + Result := FBaseCharWidth + FCharExtra; +end; + +function TSynTextDrawer.GetCharHeight: Integer; +begin + Result := FBaseCharHeight; +end; + +procedure TSynTextDrawer.SetBaseFont(Value: TFont); +begin + if Assigned(Value) then + begin + FlushCharABCWidthCache; + ReleaseETODist; + FStockBitmap.Canvas.Font.Assign(Value); + FStockBitmap.Canvas.Font.Style := []; + with FFontStock do + begin + SetBaseFont(Value); + Style := FCalcExtentBaseStyle; + FBaseCharWidth := CharAdvance; + FBaseCharHeight := CharHeight; + end; + SetStyle(Value.Style); + end + else + raise ESynTextDrawerException.Create('SetBaseFont: ''Value'' must be specified.'); +end; + +procedure TSynTextDrawer.SetBaseStyle(const Value: TFontStyles); +begin + if FCalcExtentBaseStyle <> Value then + begin + FCalcExtentBaseStyle := Value; + FlushCharABCWidthCache; + ReleaseETODist; + with FFontStock do + begin + Style := Value; + FBaseCharWidth := CharAdvance; + FBaseCharHeight := CharHeight; + end; + end; +end; + +procedure TSynTextDrawer.SetStyle(Value: TFontStyles); +begin + with FFontStock do + begin + SetStyle(Value); + Self.FCrntFont := FontHandle; + end; + AfterStyleSet; +end; + +procedure TSynTextDrawer.AfterStyleSet; +begin + if FDC <> 0 then + SelectObject(FDC, FCrntFont); +end; + +procedure TSynTextDrawer.SetForeColor(Value: TColor); +begin + if FColor <> Value then + begin + FColor := Value; + if FDC <> 0 then + SetTextColor(FDC, ColorToRGB(Value)); + end; +end; + +procedure TSynTextDrawer.SetBackColor(Value: TColor); +begin + if FBkColor <> Value then + begin + FBkColor := Value; + if FDC <> 0 then + Windows.SetBkColor(FDC, ColorToRGB(Value)); + end; +end; + +procedure TSynTextDrawer.SetCharExtra(Value: Integer); +begin + if FCharExtra <> Value then + begin + FCharExtra := Value; + DoSetCharExtra(FCharExtra); + end; +end; + +procedure TSynTextDrawer.DoSetCharExtra(Value: Integer); +begin + if FDC <> 0 then + SetTextCharacterExtra(FDC, Value); +end; + +procedure TSynTextDrawer.FlushCharABCWidthCache; +begin + FillChar(FCharABCWidthCache, SizeOf(TABC) * Length(FCharABCWidthCache), 0); + FillChar(FCharWidthCache, SizeOf(Integer) * Length(FCharWidthCache), 0); +end; + +function TSynTextDrawer.GetCachedABCWidth(c: Cardinal; var abc: TABC) : Boolean; +begin + if c > High(FCharABCWidthCache) then + begin + Result := GetCharABCWidthsW(FDC, c, c, abc); + Exit; + end; + abc := FCharABCWidthCache[c]; + if (abc.abcA or Integer(abc.abcB) or abc.abcC) = 0 then + begin + Result := GetCharABCWidthsW(FDC, c, c, abc); + if Result then + FCharABCWidthCache[c] := abc; + end + else + Result := True; +end; + +procedure TSynTextDrawer.TextOut(X, Y: Integer; Text: PWideChar; + Length: Integer); +var + r: TRect; +begin + r := Rect(X, Y, X, Y); + UniversalExtTextOut(FDC, X, Y, [], r, Text, Length, nil); +end; + +procedure TSynTextDrawer.ExtTextOut(X, Y: Integer; Options: TTextOutOptions; + ARect: TRect; Text: PWideChar; Length: Integer); + + procedure InitETODist(CharWidth: Integer); + var + Size: TSize; + i: Integer; + begin + ReallocMem(FETODist, Length * SizeOf(Integer)); + for i := 0 to Length - 1 do + begin + Size := TextExtent(PWideChar(@Text[i]), 1); + if Size.cx <> CharWidth then + FETODist[i] := Ceil(Size.cx / CharWidth) * CharWidth + else FETODist[i] := CharWidth; + end; + end; + + procedure AdjustLastCharWidthAndRect; + var + LastChar: Cardinal; + RealCharWidth, CharWidth: Integer; + CharInfo: TABC; + tm: TTextMetricA; + begin + if Length <= 0 then Exit; + + LastChar := Ord(Text[Length - 1]); + CharWidth := FETODist[Length - 1]; + RealCharWidth := CharWidth; + if Win32PlatformIsUnicode then + begin + if GetCachedABCWidth(LastChar, CharInfo) then + begin + RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); + if CharInfo.abcC >= 0 then + Inc(RealCharWidth, CharInfo.abcC); + end + else if LastChar < Ord(High(AnsiChar)) then + begin + GetTextMetricsA(FDC, tm); + RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; + end; + end + else if WideChar(LastChar) <= High(AnsiChar) then + begin + if GetCharABCWidthsA(FDC, LastChar, LastChar, CharInfo) then + begin + RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); + if CharInfo.abcC >= 0 then + Inc(RealCharWidth, CharInfo.abcC); + end + else if LastChar < Ord(High(AnsiChar)) then + begin + GetTextMetricsA(FDC, tm); + RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; + end; + end; + if RealCharWidth > CharWidth then + Inc(ARect.Right, RealCharWidth - CharWidth); + FETODist[Length - 1] := Max(RealCharWidth, CharWidth); + end; + +begin + InitETODist(GetCharWidth); + AdjustLastCharWidthAndRect; + UniversalExtTextOut(FDC, X, Y, Options, ARect, Text, Length, FETODist); +end; + +procedure TSynTextDrawer.ReleaseTemporaryResources; +begin + FFontStock.ReleaseFontHandles; +end; + +function TSynTextDrawer.TextExtent(const Text: UnicodeString): TSize; +begin + Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text); +end; + +function TSynTextDrawer.TextExtent(Text: PWideChar; Count: Integer): TSize; +begin + Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count); +end; + +function TSynTextDrawer.TextWidth(const Char: WideChar): Integer; +var + c: Cardinal; +begin + c := Ord(Char); + if c <= High(FCharWidthCache) then + begin + Result := FCharWidthCache[c]; + if Result = 0 then + begin + Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Char).cX; + FCharWidthCache[c] := Result; + end; + end + else + Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Char).cX; +end; + +function TSynTextDrawer.TextWidth(const Text: UnicodeString): Integer; +var + c: Cardinal; +begin + if Length(Text) = 1 then + begin + c := Ord(Text[1]); + if c <= High(FCharWidthCache) then + begin + Result := FCharWidthCache[c]; + if Result = 0 then + begin + Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text).cX; + FCharWidthCache[c] := Result; + end; + Exit; + end; + end; + Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text).cX; +end; + +function TSynTextDrawer.TextWidth(Text: PWideChar; Count: Integer): Integer; +begin + Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count).cX; +end; + +initialization + +finalization + GFontsInfoManager.Free; + +end. diff --git a/Source/VCL/SynEdit/Source/SynURIOpener.pas b/Source/VCL/SynEdit/Source/SynURIOpener.pas index 56e06849..72d36796 100644 --- a/Source/VCL/SynEdit/Source/SynURIOpener.pas +++ b/Source/VCL/SynEdit/Source/SynURIOpener.pas @@ -1,310 +1,392 @@ -{------------------------------------------------------------------------------- -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. - -The Original Code is: SynURIOpener.pas, released 2003-09-25. -The Initial Author of this file is Maël Hörz. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit project 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. - -You may retrieve the latest version of SynEdit from the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} -{ -@abstract(Plugin for SynEdit to make links (URIs) clickable) -@author(Maël Hörz) -@created(2003) -@lastmod(2004-03-19) -The SynURIOpener unit extends SynEdit to make links highlighted by SynURISyn -clickable. - -http://www.mh-net.de.vu -} - -unit SynURIOpener; - -{$I SynEdit.inc} - -interface - -uses - Windows, - Controls, - SynEditTypes, - SynEdit, - SynHighlighterURI, - SynUnicode, - Classes; - -type - TSynURIOpener = class(TComponent) - private - FControlDown: Boolean; - FCtrlActivatesLinks: Boolean; - FEditor: TCustomSynEdit; - FMouseDownX: Integer; - FMouseDownY: Integer; - - FURIHighlighter: TSynURISyn; - FVisitedURIs: TStringList; - procedure OpenLink(URI: string; LinkType: Integer); - function MouseInSynEdit: Boolean; - protected - procedure NewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure NewKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure NewMouseCursor(Sender: TObject; const aLineCharPos: TBufferCoord; - var aCursor: TCursor); - procedure NewMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure NewMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - - procedure Notification(AComponent: TComponent; Operation: TOperation); override; - - procedure SetEditor(const Value: TCustomSynEdit); - procedure SetURIHighlighter(const Value: TSynURISyn); - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - function VisitedURI(URI: string): Boolean; - published - property CtrlActivatesLinks: Boolean read FCtrlActivatesLinks - write FCtrlActivatesLinks default True; - property Editor: TCustomSynEdit read FEditor write SetEditor; - property URIHighlighter: TSynURISyn read FURIHighlighter - write SetURIHighlighter; - end; - - -implementation - -uses - ShellAPI, - Forms, - SynEditHighlighter, - SynEditKeyConst, - SysUtils; - -type - TAccessCustomSynEdit = class(TCustomSynEdit); - TAccessSynURISyn = class(TSynURISyn); - -{ TSynURIOpener } - -constructor TSynURIOpener.Create(AOwner: TComponent); -begin - inherited; - FCtrlActivatesLinks := True; - FVisitedURIs := TStringList.Create; - FVisitedURIs.Sorted := True; -end; - -destructor TSynURIOpener.Destroy; -begin - FVisitedURIs.Free; - inherited; -end; - -function TSynURIOpener.MouseInSynEdit: Boolean; -var - pt: TPoint; -begin - pt := Mouse.CursorPos; - Result := PtInRect(FEditor.ClientRect, FEditor.ScreenToClient(pt)) -end; - -procedure TSynURIOpener.NewKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if (Key = SYNEDIT_CONTROL) and not FControlDown and MouseInSynEdit then - begin - FControlDown := True; - TAccessCustomSynEdit(FEditor).UpdateMouseCursor; - end; -end; - -procedure TSynURIOpener.NewKeyUp(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if (Key = SYNEDIT_CONTROL) and FControlDown then - begin - FControlDown := False; - TAccessCustomSynEdit(FEditor).UpdateMouseCursor; - end; -end; - -function IsControlPressed: Boolean; -begin - Result := GetAsyncKeyState(VK_CONTROL) <> 0; -end; - -procedure TSynURIOpener.NewMouseCursor(Sender: TObject; - const aLineCharPos: TBufferCoord; var aCursor: TCursor); -var - TokenType, Start: Integer; - Token: string; - Attri: TSynHighlighterAttributes; -begin - FControlDown := IsControlPressed; - if not(FCtrlActivatesLinks and not FControlDown or - (csDesigning in FEditor.ComponentState)) and FEditor.Focused - then - with FEditor do - begin - GetHighlighterAttriAtRowColEx(aLineCharPos, Token, TokenType, Start, Attri); - if Assigned(URIHighlighter) and ((Attri = URIHighlighter.URIAttri) or - (Attri = URIHighlighter.VisitedURIAttri)) and - not((eoDragDropEditing in Options) and IsPointInSelection(aLineCharPos)) - then - aCursor := crHandPoint - end -end; - -procedure TSynURIOpener.NewMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if (Button = mbLeft) and not(FCtrlActivatesLinks) or FControlDown then - begin - FMouseDownX := X; - FMouseDownY := Y; - end -end; - -procedure TSynURIOpener.NewMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -var - ptLineCol: TBufferCoord; - TokenType, Start: Integer; - Token: string; - Attri: TSynHighlighterAttributes; -begin - if (Button <> mbLeft) or (FCtrlActivatesLinks and not FControlDown) or - (Abs(FMouseDownX - X) > 4) or (Abs(FMouseDownY - Y) > 4) then exit; - - with TAccessCustomSynEdit(FEditor) do - begin - if (eoDragDropEditing in Options) and IsPointInSelection(ptLineCol) then - exit; - - if X >= fGutterWidth then - begin - ptLineCol := DisplayToBufferPos(PixelsToRowColumn(X,Y)); - - GetHighlighterAttriAtRowColEx(ptLineCol, Token, TokenType, Start, Attri); - if Assigned(URIHighlighter) and ((Attri = URIHighlighter.URIAttri) or - (Attri = URIHighlighter.VisitedURIAttri)) and - not((eoDragDropEditing in Options) and IsPointInSelection(ptLineCol)) then - begin - OpenLink(Token, TokenType); - InvalidateLine(ptLineCol.Line); - end; - end - end; -end; - -procedure TSynURIOpener.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited; - if (Operation = opRemove) and Assigned(Editor) and (AComponent = Editor) then - Editor := nil; - if (Operation = opRemove) and Assigned(URIHighlighter) and - (AComponent = URIHighlighter) - then - URIHighlighter := nil; -end; - -procedure TSynURIOpener.OpenLink(URI: string; LinkType: Integer); -begin - FVisitedURIs.Add(URI); - - case TtkTokenKind(LinkType) of - tkMailtoLink: - if (Pos('mailto:', URI) <> 1) then URI := 'mailto:' + URI; - tkWebLink: - URI := 'http://' + URI; - end; - ShellExecute(0, nil, PChar(URI), nil, nil, 1{SW_SHOWNORMAL}); -end; - -procedure TSynURIOpener.SetEditor(const Value: TCustomSynEdit); -begin - if Editor <> Value then - begin - if not(csDesigning in ComponentState) and Assigned(FEditor) then - begin - with FEditor do - begin - RemoveKeyDownHandler(NewKeyDown); - RemoveKeyUpHandler(NewKeyUp); - RemoveMouseCursorHandler(NewMouseCursor); - RemoveMouseDownHandler(NewMouseDown); - RemoveMouseUpHandler(NewMouseUp); - end; - end; - - FEditor := Value; - - if not(csDesigning in ComponentState) and Assigned(FEditor) then - begin - with FEditor do - begin - AddKeyDownHandler(NewKeyDown); - AddKeyUpHandler(NewKeyUp); - AddMouseCursorHandler(NewMouseCursor); - AddMouseDownHandler(NewMouseDown); - AddMouseUpHandler(NewMouseUp); - end; - end; - end; -end; - -procedure TSynURIOpener.SetURIHighlighter(const Value: TSynURISyn); -begin - if not(csDesigning in ComponentState) and Assigned(URIHighlighter) then - TAccessSynURISyn(FURIHighlighter).SetAlreadyVisitedURIFunc(nil); - - FURIHighlighter := Value; - - if not(csDesigning in ComponentState) and Assigned(URIHighlighter) then - TAccessSynURISyn(FURIHighlighter).SetAlreadyVisitedURIFunc(VisitedURI); -end; - -function TSynURIOpener.VisitedURI(URI: string): Boolean; -var - Dummy: Integer; -begin - Result := FVisitedURIs.Find(URI, Dummy); -end; - -const - IDC_LINK = MakeIntResource(32649); - -var - CursorHandle: THandle; - -initialization - CursorHandle := LoadCursor(0, IDC_LINK); - if CursorHandle <> 0 then - Screen.Cursors[crHandPoint] := CursorHandle; - -end. +{------------------------------------------------------------------------------- +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. + +The Original Code is: SynURIOpener.pas, released 2003-09-25. +The Initial Author of this file is Maël Hörz. +Unicode translation by Maël Hörz. +All Rights Reserved. + +Contributors to the SynEdit project 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. + +You may retrieve the latest version of SynEdit from the SynEdit home page, +located at http://SynEdit.SourceForge.net + +-------------------------------------------------------------------------------} +{ +@abstract(Plugin for SynEdit to make links (URIs) clickable) +@author(Maël Hörz) +@created(2003) +@lastmod(2004-03-19) +The SynURIOpener unit extends SynEdit to make links highlighted by SynURISyn +clickable. + +http://www.mh-net.de.vu +} + +{$IFNDEF QSYNURIOPENER} +unit SynURIOpener; +{$ENDIF} + +{$I SynEdit.inc} + +interface + +uses + {$IFDEF SYN_LINUX} + Xlib, + {$ELSE} + Windows, + {$ENDIF} + Controls, + SynEditTypes, + SynEdit, + SynHighlighterURI, + SynUnicode, + Classes; + +type + TSynURIOpener = class(TComponent) + private + FControlDown: Boolean; + FCtrlActivatesLinks: Boolean; + FEditor: TCustomSynEdit; + FMouseDownX: Integer; + FMouseDownY: Integer; + + FURIHighlighter: TSynURISyn; + FVisitedURIs: TStringList; + {$IFDEF SYN_LINUX} + FFtpClientCmd: string; + FGopherClientCmd: string; + FMailClientCmd: string; + FNewsClientCmd: string; + FNntpClientCmd: string; + FProsperoClientCmd: string; + FTelnetClientCmd: string; + FWaisClientCmd: string; + FWebBrowserCmd: string; + {$ENDIF} + procedure OpenLink(URI: string; LinkType: Integer); + function MouseInSynEdit: Boolean; + protected + procedure NewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure NewKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure NewMouseCursor(Sender: TObject; const aLineCharPos: TBufferCoord; + var aCursor: TCursor); + procedure NewMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure NewMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + + procedure SetEditor(const Value: TCustomSynEdit); + procedure SetURIHighlighter(const Value: TSynURISyn); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function VisitedURI(URI: UnicodeString): Boolean; + published + property CtrlActivatesLinks: Boolean read FCtrlActivatesLinks + write FCtrlActivatesLinks default True; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property URIHighlighter: TSynURISyn read FURIHighlighter + write SetURIHighlighter; + {$IFDEF SYN_LINUX} + // examples how to set WebBrowserCmd; %s is the placeholder for the URI + // 'kfmclient openURL %s' + // 'mozilla %s' + // 'netscape %s' + // 'kfmclient exec %s' similar to Windows ShellExecute + // + // You should let the user set these properties as there is no command + // or environment variable valid/available on all UN*X-systems. + // It depends on what window-manager and browser is installed. + property FtpClientCmd: string read FFtpClientCmd write FFtpClientCmd; + property GopherClientCmd: string read FGopherClientCmd write FGopherClientCmd; + property MailClientCmd: string read FMailClientCmd write FMailClientCmd; + property NewsClientCmd: string read FNewsClientCmd write FNewsClientCmd; + property NntpClientCmd: string read FNntpClientCmd write FNntpClientCmd; + property ProsperoClientCmd: string read FProsperoClientCmd write FProsperoClientCmd; + property TelnetClientCmd: string read FTelnetClientCmd write FTelnetClientCmd; + property WaisClientCmd: string read FWaisClientCmd write FWaisClientCmd; + property WebBrowserCmd: string read FWebBrowserCmd write FWebBrowserCmd; + {$ENDIF} + end; + + +implementation + +uses + {$IFDEF SYN_LINUX} + Libc, + {$ELSE} + ShellAPI, + {$ENDIF} + Forms, + SynEditHighlighter, + SynEditKeyConst, + SysUtils; + +type + TAccessCustomSynEdit = class(TCustomSynEdit); + TAccessSynURISyn = class(TSynURISyn); + +{ TSynURIOpener } + +constructor TSynURIOpener.Create(AOwner: TComponent); +begin + inherited; + FCtrlActivatesLinks := True; + FVisitedURIs := TStringList.Create; + FVisitedURIs.Sorted := True; +end; + +destructor TSynURIOpener.Destroy; +begin + FVisitedURIs.Free; + inherited; +end; + +function TSynURIOpener.MouseInSynEdit: Boolean; +var + pt: TPoint; +begin + {$IFDEF SYN_COMPILER_6_UP} + pt := Mouse.CursorPos; + {$ELSE} + GetCursorPos(pt); + {$ENDIF} + Result := PtInRect(FEditor.ClientRect, FEditor.ScreenToClient(pt)) +end; + +procedure TSynURIOpener.NewKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if (Key = SYNEDIT_CONTROL) and not FControlDown and MouseInSynEdit then + begin + FControlDown := True; + TAccessCustomSynEdit(FEditor).UpdateMouseCursor; + end; +end; + +procedure TSynURIOpener.NewKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if (Key = SYNEDIT_CONTROL) and FControlDown then + begin + FControlDown := False; + TAccessCustomSynEdit(FEditor).UpdateMouseCursor; + end; +end; + +function IsControlPressed: Boolean; +{$IFDEF SYN_LINUX} +var + keymap: TXQueryKeyMap; +{$ENDIF} +begin +{$IFDEF SYN_LINUX} + XQueryKeymap(Xlib.PDisplay(QtDisplay), keymap); + Result := (Byte(keymap[4]) and $20 = $20); +{$ELSE} + Result := GetAsyncKeyState(VK_CONTROL) <> 0; +{$ENDIF} +end; + +procedure TSynURIOpener.NewMouseCursor(Sender: TObject; + const aLineCharPos: TBufferCoord; var aCursor: TCursor); +var + TokenType, Start: Integer; + Token: UnicodeString; + Attri: TSynHighlighterAttributes; +begin + FControlDown := IsControlPressed; + if not(FCtrlActivatesLinks and not FControlDown or + (csDesigning in FEditor.ComponentState)) and FEditor.Focused + then + with FEditor do + begin + GetHighlighterAttriAtRowColEx(aLineCharPos, Token, TokenType, Start, Attri); + if Assigned(URIHighlighter) and ((Attri = URIHighlighter.URIAttri) or + (Attri = URIHighlighter.VisitedURIAttri)) and + not((eoDragDropEditing in Options) and IsPointInSelection(aLineCharPos)) + then + aCursor := crHandPoint + end +end; + +procedure TSynURIOpener.NewMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + if (Button = mbLeft) and not(FCtrlActivatesLinks) or FControlDown then + begin + FMouseDownX := X; + FMouseDownY := Y; + end +end; + +procedure TSynURIOpener.NewMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +var + ptLineCol: TBufferCoord; + TokenType, Start: Integer; + Token: UnicodeString; + Attri: TSynHighlighterAttributes; +begin + if (Button <> mbLeft) or (FCtrlActivatesLinks and not FControlDown) or + (Abs(FMouseDownX - X) > 4) or (Abs(FMouseDownY - Y) > 4) then Exit; + + with TAccessCustomSynEdit(FEditor) do + begin + if (eoDragDropEditing in Options) and IsPointInSelection(ptLineCol) then + Exit; + + if X >= fGutterWidth then + begin + ptLineCol := DisplayToBufferPos(PixelsToRowColumn(X,Y)); + + GetHighlighterAttriAtRowColEx(ptLineCol, Token, TokenType, Start, Attri); + if Assigned(URIHighlighter) and ((Attri = URIHighlighter.URIAttri) or + (Attri = URIHighlighter.VisitedURIAttri)) and + not((eoDragDropEditing in Options) and IsPointInSelection(ptLineCol)) then + begin + OpenLink(Token, TokenType); + InvalidateLine(ptLineCol.Line); + end; + end + end; +end; + +procedure TSynURIOpener.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited; + if (Operation = opRemove) and Assigned(Editor) and (AComponent = Editor) then + Editor := nil; + if (Operation = opRemove) and Assigned(URIHighlighter) and + (AComponent = URIHighlighter) + then + URIHighlighter := nil; +end; + +procedure TSynURIOpener.OpenLink(URI: string; LinkType: Integer); +{$IFDEF SYN_LINUX} +var + CmdLine: string; +{$ENDIF} +begin + FVisitedURIs.Add(URI); + + case TtkTokenKind(LinkType) of + tkMailtoLink: + if (Pos('mailto:', URI) <> 1) then URI := 'mailto:' + URI; + tkWebLink: + URI := 'http://' + URI; + end; + {$IFDEF SYN_LINUX} + case TtkTokenKind(LinkType) of + tkFtpLink: + CmdLine := Format(FFtpClientCmd, [URI]); + tkGopherLink: + CmdLine := Format(FGopherClientCmd, [URI]); + tkMailtoLink: + CmdLine := Format(FMailClientCmd, [URI]); + tkNewsLink: + CmdLine := Format(FNewsClientCmd, [URI]); + tkNntpLink: + CmdLine := Format(FNntpClientCmd, [URI]); + tkProsperoLink: + CmdLine := Format(FProsperoClientCmd, [URI]); + tkTelnetLink: + CmdLine := Format(FTelnetClientCmd, [URI]); + tkWaisLink: + CmdLine := Format(FWaisClientCmd, [URI]); + tkWebLink, tkHttpLink, tkHttpsLink: + CmdLine := Format(FWebBrowserCmd, [URI]); + end; + Libc.system(PAnsiChar(CmdLine + ' &')); // add an ampersand to return immediately + {$ELSE} + ShellExecute(0, nil, PChar(URI), nil, nil, 1{SW_SHOWNORMAL}); + {$ENDIF} +end; + +procedure TSynURIOpener.SetEditor(const Value: TCustomSynEdit); +begin + if Editor <> Value then + begin + if not(csDesigning in ComponentState) and Assigned(FEditor) then + begin + with FEditor do + begin + RemoveKeyDownHandler(NewKeyDown); + RemoveKeyUpHandler(NewKeyUp); + RemoveMouseCursorHandler(NewMouseCursor); + RemoveMouseDownHandler(NewMouseDown); + RemoveMouseUpHandler(NewMouseUp); + end; + end; + + FEditor := Value; + + if not(csDesigning in ComponentState) and Assigned(FEditor) then + begin + with FEditor do + begin + AddKeyDownHandler(NewKeyDown); + AddKeyUpHandler(NewKeyUp); + AddMouseCursorHandler(NewMouseCursor); + AddMouseDownHandler(NewMouseDown); + AddMouseUpHandler(NewMouseUp); + end; + end; + end; +end; + +procedure TSynURIOpener.SetURIHighlighter(const Value: TSynURISyn); +begin + if not(csDesigning in ComponentState) and Assigned(URIHighlighter) then + TAccessSynURISyn(FURIHighlighter).SetAlreadyVisitedURIFunc(nil); + + FURIHighlighter := Value; + + if not(csDesigning in ComponentState) and Assigned(URIHighlighter) then + TAccessSynURISyn(FURIHighlighter).SetAlreadyVisitedURIFunc(VisitedURI); +end; + +function TSynURIOpener.VisitedURI(URI: UnicodeString): Boolean; +var + Dummy: Integer; +begin + Result := FVisitedURIs.Find(URI, Dummy); +end; + +const + IDC_LINK = MakeIntResource(32649); + +var + CursorHandle: THandle; + +initialization + CursorHandle := LoadCursor(0, IDC_LINK); + if CursorHandle <> 0 then + Screen.Cursors[crHandPoint] := CursorHandle; + +end. diff --git a/Source/VCL/SynEdit/Source/SynUnicode.pas b/Source/VCL/SynEdit/Source/SynUnicode.pas index a551b840..2da88f0d 100644 --- a/Source/VCL/SynEdit/Source/SynUnicode.pas +++ b/Source/VCL/SynEdit/Source/SynUnicode.pas @@ -10,6 +10,8 @@ The Original Code is SynUnicode.pas by Maël Hörz, released 2004-05-30. All Rights Reserved. +TUnicodeStrings/TUnicodeStringList-code (originally written by Mike Lischke) is based +on JclUnicode.pas which is part of the JCL (www.delphi-jedi.org). Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. @@ -24,27 +26,61 @@ 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: SynUnicode.pas,v 1.1.3.19 2012/11/07 08:54:20 CodehunterWorks Exp $ +You may retrieve the latest version of this file at the SynEdit home page, +located at http://SynEdit.SourceForge.net + +Provides: +- Unicode(PWideChar) versions of the most important PAnsiChar-functions in + SysUtils and some functions unavailable in Delphi 5. +- An adapted and lighter version of TUnicodeStrings/TUnicodeStringList taken + from JCL, but made portable. +- function for loading and saving of Unicode files, and detecting the encoding +- Unicode clipboard support +- Unicode-version of TCanvas-methods +- Some character constants like CR&LF. + +Last Changes: +- 1.1.3.19: Added TUnicodeStringList.CustomSort +-------------------------------------------------------------------------------} + +{$IFNDEF QSYNUNICODE} unit SynUnicode; +{$ENDIF} {$I SynEdit.inc} interface uses + {$IFDEF MSWINDOWS} Windows, + {$ENDIF} Messages, Controls, Forms, Graphics, Clipbrd, + {$IFDEF SYN_COMPILER_6_UP} Types, + {$ENDIF} Classes, SysUtils, TypInfo; +{$IFNDEF SYN_COMPILER_6_UP} +type + UTF8String = type string; + PUTF8String = ^UTF8String; +{$ENDIF} +{$IFNDEF UNICODE} +type + UnicodeString = WideString; +{$ENDIF} + const + SLineBreak = {$IFDEF SYN_LINUX} #10 {$ELSE} #13#10 {$ENDIF}; UTF8BOM: array[0..2] of Byte = ($EF, $BB, $BF); UTF16BOMLE: array[0..1] of Byte = ($FF, $FE); UTF16BOMBE: array[0..1] of Byte = ($FE, $FF); @@ -55,7 +91,7 @@ interface // constants describing range of the Unicode Private Use Area (Unicode 3.2) PrivateUseLow = WideChar($E000); PrivateUseHigh = WideChar($F8FF); - // filler char: helper for painting wide glyphs + // filler char: helper for painting wide glyphs FillerChar = PrivateUseLow; const @@ -70,386 +106,3603 @@ interface WideFormFeed = WideChar(#12); WideCR = WideChar(#13); WideCarriageReturn = WideChar(#13); - WideCRLF = string(#13#10); + WideCRLF = UnicodeString(#13#10); WideLineSeparator = WideChar($2028); WideParagraphSeparator = WideChar($2029); + // byte order marks for Unicode files + // Unicode text files (in UTF-16 format) should contain $FFFE as first character to + // identify such a file clearly. Depending on the system where the file was created + // on this appears either in big endian or little endian style. + BOM_LSB_FIRST = WideChar($FEFF); + BOM_MSB_FIRST = WideChar($FFFE); + +type + TSaveFormat = (sfUTF16LSB, sfUTF16MSB, sfUTF8, sfAnsi); + +const + sfUnicodeLSB = sfUTF16LSB; + sfUnicodeMSB = sfUTF16MSB; + type TFontCharSet = 0..255; -function SynCharNext(P: PWideChar): PWideChar; overload; -function SynCharNext(P: PWideChar; out Element: String): PWideChar; overload; -function SynUniElementsCount(S: string) : integer; +{$IFDEF UNICODE} + TUnicodeStrings = TStrings; +{$ELSE} +{ TUnicodeStrings } + + TUnicodeStrings = class; + + // Event used to give the application a chance to switch the way of how to save + // the text in TUnicodeStrings if the text contains characters not only from the + // ANSI block but the save type is ANSI. On triggering the event the application + // can change the property SaveUnicode as needed. This property is again checked + // after the callback returns. + TConfirmConversionEvent = procedure (Sender: TUnicodeStrings; var Allowed: Boolean) of object; + + TUnicodeStrings = class(TPersistent) + private + FUpdateCount: Integer; + FSaved: Boolean; // set in SaveToStream, True in case saving was successfull otherwise False + FOnConfirmConversion: TConfirmConversionEvent; + FSaveFormat: TSaveFormat; // overrides the FSaveUnicode flag, initialized when a file is loaded, + // expect losses if it is set to sfAnsi before saving + function GetCommaText: UnicodeString; + function GetName(Index: Integer): UnicodeString; + function GetValue(const Name: UnicodeString): UnicodeString; + procedure ReadData(Reader: TReader); + procedure SetCommaText(const Value: UnicodeString); + procedure SetValue(const Name, Value: UnicodeString); + procedure WriteData(Writer: TWriter); + function GetSaveUnicode: Boolean; + procedure SetSaveUnicode(const Value: Boolean); + protected + procedure DefineProperties(Filer: TFiler); override; + procedure DoConfirmConversion(var Allowed: Boolean); virtual; + procedure Error(const Msg: string; Data: Integer); + function Get(Index: Integer): UnicodeString; virtual; abstract; + function GetCapacity: Integer; virtual; + function GetCount: Integer; virtual; abstract; + function GetObject(Index: Integer): TObject; virtual; + function GetTextStr: UnicodeString; virtual; + procedure Put(Index: Integer; const S: UnicodeString); virtual; abstract; + procedure PutObject(Index: Integer; AObject: TObject); virtual; abstract; + procedure SetCapacity(NewCapacity: Integer); virtual; + procedure SetUpdateState(Updating: Boolean); virtual; + public + constructor Create; + + function Add(const S: UnicodeString): Integer; virtual; + function AddObject(const S: UnicodeString; AObject: TObject): Integer; virtual; + procedure Append(const S: UnicodeString); + procedure AddStrings(Strings: TStrings); overload; virtual; + procedure AddStrings(Strings: TUnicodeStrings); overload; virtual; + procedure Assign(Source: TPersistent); override; + procedure AssignTo(Dest: TPersistent); override; + procedure BeginUpdate; + procedure Clear; virtual; abstract; + procedure Delete(Index: Integer); virtual; abstract; + procedure EndUpdate; + function Equals(Strings: TUnicodeStrings): Boolean; + procedure Exchange(Index1, Index2: Integer); virtual; + function GetSeparatedText(Separators: UnicodeString): UnicodeString; virtual; + function GetText: PWideChar; virtual; + function IndexOf(const S: UnicodeString): Integer; virtual; + function IndexOfName(const Name: UnicodeString): Integer; + function IndexOfObject(AObject: TObject): Integer; + procedure Insert(Index: Integer; const S: UnicodeString); virtual; abstract; + procedure InsertObject(Index: Integer; const S: UnicodeString; AObject: TObject); + procedure LoadFromFile(const FileName: TFileName); virtual; + procedure LoadFromStream(Stream: TStream); virtual; + procedure Move(CurIndex, NewIndex: Integer); virtual; + procedure SaveToFile(const FileName: TFileName); overload; virtual; + procedure SaveToFile(const FileName: TFileName; WithBOM: Boolean); overload; virtual; + procedure SaveToStream(Stream: TStream; WithBOM: Boolean = True); virtual; + procedure SetTextStr(const Value: UnicodeString); virtual; + + property Capacity: Integer read GetCapacity write SetCapacity; + property CommaText: UnicodeString read GetCommaText write SetCommaText; + property Count: Integer read GetCount; + property Names[Index: Integer]: UnicodeString read GetName; + property Objects[Index: Integer]: TObject read GetObject write PutObject; + property Values[const Name: UnicodeString]: UnicodeString read GetValue write SetValue; + property Saved: Boolean read FSaved; + property SaveUnicode: Boolean read GetSaveUnicode write SetSaveUnicode default True; + property SaveFormat: TSaveFormat read FSaveFormat write FSaveFormat default sfUnicodeLSB; + property Strings[Index: Integer]: UnicodeString read Get write Put; default; + property Text: UnicodeString read GetTextStr write SetTextStr; + + property OnConfirmConversion: TConfirmConversionEvent read FOnConfirmConversion write FOnConfirmConversion; + end; +{$ENDIF} + +{$IFDEF UNICODE} + TUnicodeStringList = TStringList; +{$ELSE} +{ TUnicodeStringList } + + //----- TUnicodeStringList class + TDynWideCharArray = array of WideChar; + TUnicodeStringItem = record + {$IFDEF OWN_UnicodeString_MEMMGR} + FString: PWideChar; // "array of WideChar"; + {$ELSE} + FString: UnicodeString; + {$ENDIF OWN_UnicodeString_MEMMGR} + FObject: TObject; + end; + + TUnicodeStringList = class; + TUnicodeStringItemList = array of TUnicodeStringItem; + TUnicodeStringListSortCompare = function (AString1, AString2: UnicodeString): Integer; + + TUnicodeStringList = class(TUnicodeStrings) + private + FList: TUnicodeStringItemList; + FCount: Integer; + FSorted: Boolean; + FDuplicates: TDuplicates; + FOnChange: TNotifyEvent; + FOnChanging: TNotifyEvent; + procedure ExchangeItems(Index1, Index2: Integer); + procedure Grow; + procedure QuickSort(L, R: Integer); overload; + procedure QuickSort(L, R: Integer; SCompare: TUnicodeStringListSortCompare); overload; + procedure InsertItem(Index: Integer; const S: UnicodeString); + procedure SetSorted(Value: Boolean); + {$IFDEF OWN_UnicodeString_MEMMGR} + procedure SetListString(Index: Integer; const S: UnicodeString); + {$ENDIF OWN_UnicodeString_MEMMGR} + protected + procedure Changed; virtual; + procedure Changing; virtual; + function Get(Index: Integer): UnicodeString; override; + function GetCapacity: Integer; override; + function GetCount: Integer; override; + function GetObject(Index: Integer): TObject; override; + procedure Put(Index: Integer; const S: UnicodeString); override; + procedure PutObject(Index: Integer; AObject: TObject); override; + procedure SetCapacity(NewCapacity: Integer); override; + procedure SetUpdateState(Updating: Boolean); override; + public + destructor Destroy; override; + + function Add(const S: UnicodeString): Integer; override; + procedure Clear; override; + procedure Delete(Index: Integer); override; + procedure Exchange(Index1, Index2: Integer); override; + function Find(const S: UnicodeString; var Index: Integer): Boolean; virtual; + function IndexOf(const S: UnicodeString): Integer; override; + procedure Insert(Index: Integer; const S: UnicodeString); override; + procedure Sort; virtual; + procedure CustomSort(Compare: TUnicodeStringListSortCompare); virtual; + + property Duplicates: TDuplicates read FDuplicates write FDuplicates; + property Sorted: Boolean read FSorted write SetSorted; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; + end; +{$ENDIF} + +{$IFNDEF UNICODE} +{ PWideChar versions of important PAnsiChar functions from SysUtils } +function WStrLen(const Str: PWideChar): Cardinal; +function WStrEnd(const Str: PWideChar): PWideChar; +function WStrMove(Dest: PWideChar; const Source: PWideChar; Count: Integer): PWideChar; +function WStrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; +function WStrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; +function WStrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; +function WStrScan(const Str: PWideChar; Chr: WideChar): PWideChar; +function WStrAlloc(Size: Cardinal): PWideChar; +function WStrNew(const Str: PWideChar): PWideChar; +procedure WStrDispose(Str: PWideChar); +{$ENDIF} + + +{$IFNDEF SYN_COMPILER_6_UP} +{$IFDEF MSWINDOWS} +function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: Cardinal; + Source: PWideChar; SourceChars: Cardinal): Cardinal; +function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; + Source: PAnsiChar; SourceBytes: Cardinal): Cardinal; +function UTF8Encode(const WS: UnicodeString): UTF8String; +function UTF8Decode(const S: UTF8String): UnicodeString; +function AnsiToUtf8(const S: string): UTF8String; +function Utf8ToAnsi(const S: UTF8String): string; + +function WideCompareStr(const S1, S2: UnicodeString): Integer; +function WideCompareText(const S1, S2: UnicodeString): Integer; +{$ENDIF} +{$ENDIF} + +// Kylix has them, but Delphi 5 doesn't and Delphi 6&7 versions are buggy +// in Win9X (fix taken from Troy Wolbrinks TntUnicode-package) +{$IFDEF MSWINDOWS} +{$IFNDEF UNICODE} +var + DefaultSystemCodePage: Cardinal; // implicitly used when converting AnsiString <--> UnicodeString. +{$ENDIF} + +function WCharUpper(lpsz: PWideChar): PWideChar; +function WCharUpperBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; +function WCharLower(lpsz: PWideChar): PWideChar; +function WCharLowerBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; +{$ENDIF} +function SynWideUpperCase(const S: UnicodeString): UnicodeString; +function SynWideLowerCase(const S: UnicodeString): UnicodeString; +function SynIsCharAlpha(const C: WideChar): Boolean; +function SynIsCharAlphaNumeric(const C: WideChar): Boolean; +{$IFNDEF UNICODE} +function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} +function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} +{$ENDIF} + +function WideLastDelimiter(const Delimiters, S: UnicodeString): Integer; +function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString; + Flags: TReplaceFlags): UnicodeString; { functions taken from JCLUnicode.pas } +function WStrComp(Str1, Str2: PWideChar): Integer; +function WStrLComp(Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; procedure StrSwapByteOrder(Str: PWideChar); +function WideQuotedStr(const S: UnicodeString; Quote: WideChar): UnicodeString; +function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): UnicodeString; +function UnicodeStringOfChar(C: WideChar; Count: Cardinal): UnicodeString; +function WideTrim(const S: UnicodeString): UnicodeString; +function WideTrimLeft(const S: UnicodeString): UnicodeString; +function WideTrimRight(const S: UnicodeString): UnicodeString; +{$IFDEF MSWINDOWS} function CharSetFromLocale(Language: LCID): TFontCharSet; function CodePageFromLocale(Language: LCID): Integer; function KeyboardCodePage: Word; +function KeyUnicode(C: AnsiChar): WideChar; +function StringToUnicodeStringEx(const S: AnsiString; CodePage: Word): UnicodeString; +function UnicodeStringToStringEx(const WS: UnicodeString; CodePage: Word): AnsiString; +{$ENDIF} { functions providing same behavior on Win9x and WinNT based systems} function GetTextSize(DC: HDC; Str: PWideChar; Count: Integer): TSize; +{ Unicode versions of TCanvas-methods } +function TextExtent(ACanvas: TCanvas; const Text: UnicodeString): TSize; +function TextWidth(ACanvas: TCanvas; const Text: UnicodeString): Integer; +function TextHeight(ACanvas: TCanvas; const Text: UnicodeString): Integer; +procedure TextOut(ACanvas: TCanvas; X, Y: Integer; const Text: UnicodeString); +procedure TextRect(ACanvas: TCanvas; Rect: TRect; X, Y: Integer; + const Text: UnicodeString); + { Unicode streaming-support } type TSynEncoding = (seUTF8, seUTF16LE, seUTF16BE, seAnsi); TSynEncodings = set of TSynEncoding; -function IsAnsiOnly(const WS: string): Boolean; -function IsUTF8(Stream: TStream; out WithBOM: Boolean; BytesToCheck: integer = $4000): Boolean; overload; -function IsUTF8(const FileName: string; out WithBOM: Boolean; BytesToCheck: integer = $4000): Boolean; overload; -function IsUTF8(const Bytes: TBytes; Start: Integer = 0; BytesToCheck: integer = $4000): Boolean; overload; -function GetEncoding(const FileName: string; out WithBOM: Boolean): TEncoding; overload; -function GetEncoding(Stream: TStream; out WithBOM: Boolean): TEncoding; overload; +{$IFDEF UNICODE} + TWideFileStream = TFileStream; +{$ELSE} + TWideFileStream = class(THandleStream) + public + constructor Create(const FileName: UnicodeString; Mode: Word); overload; + constructor Create(const FileName: UnicodeString; Mode: Word; Rights: Cardinal); overload; + destructor Destroy; override; + end; + +function WideFileOpen(const FileName: UnicodeString; Mode: LongWord): Integer; +function WideFileCreate(const FileName: UnicodeString): Integer; overload; +function WideFileCreate(const FileName: UnicodeString; Rights: Integer): Integer; overload; +{$ENDIF} + +function IsAnsiOnly(const WS: UnicodeString): Boolean; +function IsUTF8(Stream: TStream; out WithBOM: Boolean): Boolean; overload; +function IsUTF8(const FileName: UnicodeString; out WithBOM: Boolean): Boolean; overload; +function GetEncoding(const FileName: UnicodeString; out WithBOM: Boolean): TSynEncoding; overload; +function GetEncoding(Stream: TStream; out WithBOM: Boolean): TSynEncoding; overload; +procedure SaveToFile(const WS: UnicodeString; const FileName: UnicodeString; + Encoding: TSynEncoding; WithBom: Boolean = True); overload; +procedure SaveToFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + Encoding: TSynEncoding; WithBom: Boolean = True); overload; +function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + out WithBOM: Boolean): TSynEncoding; overload; +function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; overload; +procedure SaveToStream(const WS: UnicodeString; Stream: TStream; + Encoding: TSynEncoding; WithBom: Boolean = True); overload; +procedure SaveToStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding; WithBom: Boolean = True); overload; +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + out WithBOM: Boolean): TSynEncoding; overload; +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; overload; +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding): TSynEncoding; overload; function ClipboardProvidesText: Boolean; -function GetClipboardText: string; -procedure SetClipboardText(const Text: string); +function GetClipboardText: UnicodeString; +procedure SetClipboardText(const Text: UnicodeString); { misc functions } +{$IFNDEF UNICODE} +{$IFNDEF SYN_COMPILER_6_UP} +function GetWideStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString; +procedure SetWideStrProp(Instance: TObject; PropInfo: PPropInfo; const Value: UnicodeString); +{$ENDIF} +procedure UnicodeDefineProperties(Filer: TFiler; Instance: TPersistent); +{$ENDIF} +{$IFDEF MSWINDOWS} function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; +function IsUnicodeStringMappableToAnsi(const WS: UnicodeString): Boolean; +{$ENDIF} + +{$IFDEF MSWINDOWS} +var + Win32PlatformIsUnicode: Boolean; +{$ENDIF} implementation uses SynEditTextBuffer, + {$IFDEF SYN_UNISCRIBE} + SynUsp10, + {$ENDIF} Math, + {$IFDEF SYN_LINUX} + Libc, + {$ENDIF} + {$IFDEF USE_TNT_RUNTIME_SUPPORT} + TntSysUtils, TntClasses, + {$ENDIF} SysConst, + {$IFDEF SYN_COMPILER_6_UP} RTLConsts; + {$ELSE} + Consts; + {$ENDIF} +{$IFNDEF UNICODE} +{ TUnicodeStrings } -function SynCharNext(P: PWideChar): PWideChar; +constructor TUnicodeStrings.Create; begin - Result := Windows.CharNext(P); + inherited; + FSaveFormat := sfUnicodeLSB; end; -function SynCharNext(P: PWideChar; out Element: String): PWideChar; overload; -Var - Start : PWideChar; +function TUnicodeStrings.GetSaveUnicode: Boolean; begin - Start := P; - Result := Windows.CharNext(P); - SetString(Element, Start, Result - Start); + Result := SaveFormat in [sfUTF16LSB, sfUTF16MSB, sfUTF8]; end; -function SynUniElementsCount(S: string) : integer; -Var - P : PWideChar; +procedure TUnicodeStrings.SetSaveUnicode(const Value: Boolean); begin - Result := 0; - P := PWideChar(S); - while P^ <> #0 do - begin - P := Windows.CharNext(P); - Inc(Result); - end; + if Value then + SaveFormat := sfUnicodeLSB + else + SaveFormat := sfAnsi; end; -// exchanges in each character of the given string the low order and high order -// byte to go from LSB to MSB and vice versa. -// EAX contains address of string -procedure StrSwapByteOrder(Str: PWideChar); -var - P: PWord; +function TUnicodeStrings.Add(const S: UnicodeString): Integer; begin - P := PWord(Str); - while P^ <> 0 do - begin - P^ := MakeWord(HiByte(P^), LoByte(P^)); - Inc(P); - end; + Result := GetCount; + Insert(Result, S); end; -function TranslateCharsetInfoEx(lpSrc: PDWORD; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; - external 'gdi32.dll' name 'TranslateCharsetInfo'; - -function CharSetFromLocale(Language: LCID): TFontCharSet; -var - CP: Cardinal; - CSI: TCharsetInfo; +function TUnicodeStrings.AddObject(const S: UnicodeString; AObject: TObject): Integer; begin - CP:= CodePageFromLocale(Language); - TranslateCharsetInfoEx(Pointer(CP), CSI, TCI_SRCCODEPAGE); - Result:= CSI.ciCharset; + Result := Add(S); + PutObject(Result, AObject); end; -// determines the code page for a given locale -function CodePageFromLocale(Language: LCID): Integer; -var - Buf: array[0..6] of Char; +procedure TUnicodeStrings.Append(const S: UnicodeString); begin - GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6); - Result := StrToIntDef(Buf, GetACP); + Add(S); end; -function KeyboardCodePage: Word; +procedure TUnicodeStrings.AddStrings(Strings: TStrings); +var + I: Integer; +{$IFDEF MSWINDOWS} + S: UnicodeString; + CP: Integer; +{$ENDIF} begin - Result := CodePageFromLocale(GetKeyboardLayout(0) and $FFFF); + BeginUpdate; + try + {$IFDEF MSWINDOWS} + CP := CodePageFromLocale(GetThreadLocale); + for I := 0 to Strings.Count - 1 do + begin + S := StringToUnicodeStringEx(Strings[I], CP); + AddObject(S, Strings.Objects[I]); + end; + {$ELSE} + for I := 0 to Strings.Count - 1 do + AddObject(Strings[I], Strings.Objects[I]); + {$ENDIF} + finally + EndUpdate; + end; end; -function GetTextSize(DC: HDC; Str: PWideChar; Count: Integer): TSize; +procedure TUnicodeStrings.AddStrings(Strings: TUnicodeStrings); +var + I: Integer; begin - Result.cx := 0; - Result.cy := 0; - - begin - GetTextExtentPoint32W(DC, Str, Count, Result); + Assert(Strings <> nil); + + BeginUpdate; + try + for I := 0 to Strings.Count - 1 do + AddObject(Strings[I], Strings.Objects[I]); + finally + EndUpdate; end; end; -function IsAnsiOnly(const WS: string): Boolean; -var - UsedDefaultChar: BOOL; +procedure TUnicodeStrings.Assign(Source: TPersistent); +// usual assignment routine, but able to assign wide and small strings begin - WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(WS), Length(WS), nil, 0, - nil, @UsedDefaultChar); - Result := not UsedDefaultChar; + if Source is TUnicodeStrings then + begin + BeginUpdate; + try + Clear; + AddStrings(TUnicodeStrings(Source)); + finally + EndUpdate; + end; + end + else + begin + if Source is TStrings then + begin + BeginUpdate; + try + Clear; + AddStrings(TStrings(Source)); + finally + EndUpdate; + end; + end + else + inherited Assign(Source); + end; end; -function IsUTF8(const FileName: string; out WithBOM: Boolean; BytesToCheck: integer): Boolean; +procedure TUnicodeStrings.AssignTo(Dest: TPersistent); +// need to do also assignment to old style TStrings, but this class doesn't know +// TUnicodeStrings, so we need to do it from here var - Stream: TStream; + I: Integer; begin - Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - Result := IsUTF8(Stream, WithBOM, BytesToCheck); - finally - Stream.Free; + if Dest is TStrings then + begin + with Dest as TStrings do + begin + BeginUpdate; + try + Clear; + for I := 0 to Self.Count - 1 do + AddObject(Self[I], Self.Objects[I]); + finally + EndUpdate; + end; + end; + end + else + begin + if Dest is TUnicodeStrings then + begin + with Dest as TUnicodeStrings do + begin + BeginUpdate; + try + Clear; + AddStrings(Self); + finally + EndUpdate; + end; + end; + end + else + inherited; end; end; -// checks for a BOM in UTF-8 format or searches the first 4096 bytes for -// typical UTF-8 octet sequences -function IsUTF8(Stream: TStream; out WithBOM: Boolean; BytesToCheck: integer): Boolean; -var - Buffer: TBytes; - BufferSize: Integer; - BomLen: Integer; - Encoding: TEncoding; +procedure TUnicodeStrings.BeginUpdate; begin - // if Stream is nil, let Delphi raise the exception, by accessing Stream, - // to signal an invalid result - - // start analysis at actual Stream.Position - BufferSize := Min(BytesToCheck, Stream.Size - Stream.Position); + if FUpdateCount = 0 then + SetUpdateState(True); + Inc(FUpdateCount); +end; - // if no special characteristics are found it is not UTF-8 - Result := False; - WithBOM := False; +procedure TUnicodeStrings.DefineProperties(Filer: TFiler); +// Defines a private property for the content of the list. +// There's a bug in the handling of text DFMs in Classes.pas which prevents +// UnicodeStrings from loading under some circumstances. Zbysek Hlinka +// (zhlinka att login dott cz) brought this to my attention and supplied also a solution. +// See ReadData and WriteData methods for implementation details. - if BufferSize > 0 then + function DoWrite: Boolean; begin - SetLength(Buffer, BufferSize); - Stream.Read(Buffer, 0, BufferSize); - Stream.Seek(-BufferSize, soFromCurrent); + if Filer.Ancestor <> nil then + begin + Result := True; + if Filer.Ancestor is TUnicodeStrings then + Result := not Equals(TUnicodeStrings(Filer.Ancestor)) + end + else + Result := Count > 0; + end; - { first search for BOM } - Encoding := nil; - BomLen := TEncoding.GetBufferEncoding(Buffer, Encoding); - WithBOM := BOMLen > 0; - if Encoding = TEncoding.UTF8 then - Exit(True) - else if WithBom then - Exit(False); +begin + Filer.DefineProperty('UnicodeStrings', ReadData, WriteData, DoWrite); +end; - { Now check the content for UTF8 sequences } - Result := IsUtf8(Buffer, 0, BytesToCheck); - end; +procedure TUnicodeStrings.DoConfirmConversion(var Allowed: Boolean); +begin + if Assigned(FOnConfirmConversion) then + FOnConfirmConversion(Self, Allowed); end; -function IsUTF8(const Bytes: TBytes; Start: Integer; BytesToCheck: integer): Boolean; overload; -const - MinimumCountOfUTF8Strings = 1; +procedure TUnicodeStrings.EndUpdate; +begin + Dec(FUpdateCount); + if FUpdateCount = 0 then + SetUpdateState(False); +end; + +function TUnicodeStrings.Equals(Strings: TUnicodeStrings): Boolean; var - Len, i, FoundUTF8Strings: Integer; + I, Count: Integer; +begin + Assert(Strings <> nil); - // 3 trailing bytes are the maximum in valid UTF-8 streams, - // so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams - function CountOfTrailingBytes: Integer; - begin - Result := 0; - inc(i); - while (i < Len) and (Result < 4) do - begin - if Bytes[i] in [$80..$BF] then - inc(Result) - else - Break; - inc(i); - end; - end; + Result := False; + Count := GetCount; + if Count <> Strings.GetCount then + Exit; + for I := 0 to Count - 1 do + if Get(I) <> Strings.Get(I) then + Exit; + Result := True; +end; -begin - { NOTE: There is no 100% save way to detect UTF-8 streams. The bigger - MinimumCountOfUTF8Strings, the lower is the probability of - a false positive. On the other hand, a big MinimumCountOfUTF8Strings - makes it unlikely to detect files with only little usage of non - US-ASCII chars, like usual in European languages. } - Result := False; - Len := Min(Start + BytesToCheck, Length(Bytes)); - FoundUTF8Strings := 0; - i := Start; - while i < Len do - begin - case Bytes[i] of - $00..$7F: // skip US-ASCII characters as they could belong to various charsets - ; - $C2..$DF: - if CountOfTrailingBytes = 1 then - inc(FoundUTF8Strings) - else - Break; - $E0: - begin - inc(i); - if (i < Len) and (Bytes[i] in [$A0..$BF]) and (CountOfTrailingBytes = 1) then - inc(FoundUTF8Strings) - else - Break; - end; - $E1..$EC, $EE..$EF: - if CountOfTrailingBytes = 2 then - inc(FoundUTF8Strings) - else - Break; - $ED: - begin - inc(i); - if (i < Len) and (Bytes[i] in [$80..$9F]) and (CountOfTrailingBytes = 1) then - inc(FoundUTF8Strings) - else - Break; - end; - $F0: - begin - inc(i); - if (i < Len) and (Bytes[i] in [$90..$BF]) and (CountOfTrailingBytes = 2) then - inc(FoundUTF8Strings) - else - Break; - end; - $F1..$F3: - if CountOfTrailingBytes = 3 then - inc(FoundUTF8Strings) - else - Break; - $F4: - begin - inc(i); - if (i < Len) and (Bytes[i] in [$80..$8F]) and (CountOfTrailingBytes = 2) then - inc(FoundUTF8Strings) - else - Break; - end; - $C0, $C1, $F5..$FF: // invalid UTF-8 bytes - Break; - $80..$BF: // trailing bytes are consumed when handling leading bytes, - // any occurence of "orphaned" trailing bytes is invalid UTF-8 - Break; - end; +procedure TUnicodeStrings.Error(const Msg: string; Data: Integer); - if FoundUTF8Strings >= MinimumCountOfUTF8Strings then - begin - Result := True; - Break; - end; + function ReturnAddr: Pointer; + asm + MOV EAX, [EBP + 4] + end; - inc(i); - end; +begin + raise EStringListError.CreateFmt(Msg, [Data]) at ReturnAddr; end; -function GetEncoding(const FileName: string; out WithBOM: Boolean): TEncoding; +procedure TUnicodeStrings.Exchange(Index1, Index2: Integer); var - Stream: TStream; + TempObject: TObject; + TempString: UnicodeString; begin - Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + BeginUpdate; try - Result := GetEncoding(Stream, WithBOM); + TempString := Strings[Index1]; + TempObject := Objects[Index1]; + Strings[Index1] := Strings[Index2]; + Objects[Index1] := Objects[Index2]; + Strings[Index2] := TempString; + Objects[Index2] := TempObject; finally - Stream.Free; + EndUpdate; end; end; -function GetEncoding(Stream: TStream; out WithBOM: Boolean): TEncoding; +function TUnicodeStrings.GetCapacity: Integer; +// Descendants may optionally override/replace this default implementation. +begin + Result := Count; +end; - function TBytesEqual(A, B: TBytes; Len: Integer): Boolean; - Var - I: Integer; +function TUnicodeStrings.GetCommaText: UnicodeString; +var + S: UnicodeString; + P: PWideChar; + I, Count: Integer; +begin + Count := GetCount; + if (Count = 1) and (Get(0) = '') then + Result := '""' + else begin - Result := True; - for I := 0 to Len - 1 do - if A[i] <> B[i] then Exit(False) + Result := ''; + for I := 0 to Count - 1 do + begin + S := Get(I); + P := PWideChar(S); + while not (P^ in [WideNull..WideSpace, WideChar('"'), WideChar(',')]) do + Inc(P); + if P^ <> WideNull then + S := WideQuotedStr(S, '"'); + Result := Result + S + ','; + end; + System.Delete(Result, Length(Result), 1); end; +end; +function TUnicodeStrings.GetName(Index: Integer): UnicodeString; var - Buffer: TBytes; - Size: Integer; - Preamble: TBytes; + P: Integer; begin - // if Stream is nil, let Delphi raise the exception, by accessing Stream, - // to signal an invalid result - - // start analysis at actual Stream.Position - Size := Stream.Size - Stream.Position; - - // if no special characteristics are found it is probably ANSI - Result := TEncoding.ANSI; - - if IsUTF8(Stream, WithBOM) then Exit(TEncoding.UTF8); + Result := Get(Index); + P := Pos('=', Result); + if P > 0 then + SetLength(Result, P - 1) + else + Result := ''; +end; - { try to detect UTF-16 by finding a BOM in UTF-16 format } +function TUnicodeStrings.GetObject(Index: Integer): TObject; +begin + Result := nil; +end; - // Check for Unicode - Preamble := TEncoding.Unicode.GetPreamble; - if Size >= Length(Preamble) then - begin - Stream.Read(Buffer, 0, Length(Preamble)); - Stream.Seek(-Length(Preamble), soFromCurrent); - if TBytesEqual(Preamble, Buffer, Length(Preamble)) then - begin - WithBOM := True; - Exit(TEncoding.Unicode); - end; - end; - // Check for BigEndianUnicode - Preamble := TEncoding.BigEndianUnicode.GetPreamble; - if Size >= Length(Preamble) then +function TUnicodeStrings.GetSeparatedText(Separators: UnicodeString): UnicodeString; +// Same as GetText but with customizable separator characters. +var + I, L, + Size, + Count, + SepSize: Integer; + P: PWideChar; + S: UnicodeString; +begin + Count := GetCount; + SepSize := Length(Separators); + Size := 0; + for I := 0 to Count - 1 do + Inc(Size, Length(Get(I)) + SepSize); + + // set one separator less, the last line does not need a trailing separator + SetLength(Result, Size - SepSize); + if Size > 0 then begin - Stream.Read(Buffer, 0, Length(Preamble)); - Stream.Seek(-Length(Preamble), soFromCurrent); - if TBytesEqual(Preamble, Buffer, Length(Preamble)) then + P := Pointer(Result); + I := 0; + while True do begin - WithBOM := True; - Exit(TEncoding.BigEndianUnicode); + S := Get(I); + L := Length(S); + if L <> 0 then + begin + // add current string + System.Move(Pointer(S)^, P^, 2 * L); + Inc(P, L); + end; + Inc(I); + if I = Count then + Break; + + // add separators + System.Move(Pointer(Separators)^, P^, SizeOf(WideChar) * SepSize); + Inc(P, SepSize); end; end; end; -function ClipboardProvidesText: Boolean; +function TUnicodeStrings.GetTextStr: UnicodeString; begin - Result := IsClipboardFormatAvailable(CF_UNICODETEXT); + Result := GetSeparatedText(WideCRLF); end; -function GetClipboardText: string; +function TUnicodeStrings.GetText: PWideChar; begin - Result := Clipboard.AsText; + Result := WStrNew(PWideChar(GetTextStr)); end; -procedure SetClipboardText(const Text: string); +function TUnicodeStrings.GetValue(const Name: UnicodeString): UnicodeString; +var + I: Integer; begin - Clipboard.AsText := Text; + I := IndexOfName(Name); + if I >= 0 then + Result := Copy(Get(I), Length(Name) + 2, MaxInt) + else + Result := ''; end; -function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; +function TUnicodeStrings.IndexOf(const S: UnicodeString): Integer; +begin + for Result := 0 to GetCount - 1 do + if WideCompareText(Get(Result), S) = 0 then + Exit; + Result := -1; +end; + +function TUnicodeStrings.IndexOfName(const Name: UnicodeString): Integer; var - UsedDefaultChar: BOOL; + P: Integer; + S: UnicodeString; begin - WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(@WC), 1, nil, 0, nil, - @UsedDefaultChar); + for Result := 0 to GetCount - 1 do + begin + S := Get(Result); + P := Pos('=', S); + if (P > 0) and (WideCompareText(Copy(S, 1, P - 1), Name) = 0) then + Exit; + end; + Result := -1; +end; + +function TUnicodeStrings.IndexOfObject(AObject: TObject): Integer; +begin + for Result := 0 to GetCount - 1 do + if GetObject(Result) = AObject then + Exit; + Result := -1; +end; + +procedure TUnicodeStrings.InsertObject(Index: Integer; const S: UnicodeString; AObject: TObject); +begin + Insert(Index, S); + PutObject(Index, AObject); +end; + +procedure TUnicodeStrings.LoadFromFile(const FileName: TFileName); +var + Stream: TStream; +begin + Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); + try + LoadFromStream(Stream); + finally + Stream.Free; + end; +end; + +procedure TUnicodeStrings.LoadFromStream(Stream: TStream); +// usual loader routine, but enhanced to handle byte order marks in stream +var + Size, + BytesRead: Integer; + ByteOrderMask: array[0..5] of Byte; // BOM size is max 5 bytes (cf: wikipedia) + // but it is easier to implement with a multiple of 2 + Loaded: Boolean; + SW: UnicodeString; + SA: AnsiString; +begin + BeginUpdate; + try + Loaded := False; + + Size := Stream.Size - Stream.Position; + BytesRead := Stream.Read(ByteOrderMask[0], SizeOf(ByteOrderMask)); + + // UTF16 LSB = Unicode LSB/LE + if (BytesRead >= 2) and (ByteOrderMask[0] = UTF16BOMLE[0]) + and (ByteOrderMask[1] = UTF16BOMLE[1]) then + begin + FSaveFormat := sfUTF16LSB; + SetLength(SW, (Size - 2) div SizeOf(WideChar)); + Assert((Size and 1) <> 1, 'Number of chars must be a multiple of 2'); + if BytesRead > 2 then + begin + System.Move(ByteOrderMask[2], SW[1], BytesRead - 2); // max 4 bytes = 2 widechars + if Size > BytesRead then + // first 2 chars (maximum) were copied by System.Move + Stream.Read(SW[3], Size - BytesRead); + end; + SetTextStr(SW); + Loaded := True; + end; + + // UTF16 MSB = Unicode MSB/BE + if (BytesRead >= 2) and (ByteOrderMask[0] = UTF16BOMBE[0]) + and (ByteOrderMask[1] = UTF16BOMBE[1]) then + begin + FSaveFormat := sfUTF16MSB; + SetLength(SW, (Size - 2) div SizeOf(WideChar)); + Assert((Size and 1) <> 1, 'Number of chars must be a multiple of 2'); + if BytesRead > 2 then + begin + System.Move(ByteOrderMask[2], SW[1] ,BytesRead - 2); // max 4 bytes = 2 widechars + if Size > BytesRead then + // first 2 chars (maximum) were copied by System.Move + Stream.Read(SW[3], Size - BytesRead); + StrSwapByteOrder(PWideChar(SW)); + end; + SetTextStr(SW); + Loaded := True; + end; + + // UTF8 + if (BytesRead >= 3) and (ByteOrderMask[0] = UTF8BOM[0]) + and (ByteOrderMask[1] = UTF8BOM[1]) and (ByteOrderMask[2] = UTF8BOM[2]) then + begin + FSaveFormat := sfUTF8; + SetLength(SA, (Size - 3) div SizeOf(AnsiChar)); + if BytesRead > 3 then + begin + System.Move(ByteOrderMask[3], SA[1], BytesRead - 3); // max 3 bytes = 3 chars + if Size > BytesRead then + // first 3 chars were copied by System.Move + Stream.Read(SA[4], Size - BytesRead); + SW := UTF8Decode(SA); + end; + SetTextStr(SW); + Loaded := True; + end; + + // default case (Ansi) + if not Loaded then + begin + FSaveFormat := sfAnsi; + SetLength(SA, Size div SizeOf(AnsiChar)); + if BytesRead > 0 then + begin + System.Move(ByteOrderMask[0], SA[1], BytesRead); // max 6 bytes = 6 chars + if Size > BytesRead then + Stream.Read(SA[7], Size - BytesRead); // first 6 chars were copied by System.Move + SW := UTF8Decode(SA); + if SW <> '' then + begin + FSaveFormat := sfUTF8; + SetTextStr(SW); + Loaded := True; + end; + end; + if not Loaded then + SetTextStr(SA); + end; + finally + EndUpdate; + end; +end; + +procedure TUnicodeStrings.Move(CurIndex, NewIndex: Integer); +var + TempObject: TObject; + TempString: UnicodeString; +begin + if CurIndex <> NewIndex then + begin + BeginUpdate; + try + TempString := Get(CurIndex); + TempObject := GetObject(CurIndex); + Delete(CurIndex); + InsertObject(NewIndex, TempString, TempObject); + finally + EndUpdate; + end; + end; +end; + +procedure TUnicodeStrings.ReadData(Reader: TReader); +begin + case Reader.NextValue of + vaLString, vaString: + SetTextStr(Reader.ReadString); + else + SetTextStr(Reader.ReadWideString); + end; +end; + +procedure TUnicodeStrings.SaveToFile(const FileName: TFileName); +var + Stream: TStream; +begin + Stream := TFileStream.Create(FileName, fmCreate); + try + SaveToStream(Stream); + finally + Stream.Free; + end; +end; + +procedure TUnicodeStrings.SaveToFile(const FileName: TFileName; WithBOM: Boolean); +var + Stream: TStream; +begin + Stream := TFileStream.Create(FileName, fmCreate); + try + SaveToStream(Stream, WithBOM); + finally + Stream.Free; + end; +end; + +procedure TUnicodeStrings.SaveToStream(Stream: TStream; WithBOM: Boolean = True); +// Saves the currently loaded text into the given stream. WithBOM determines whether to write a +// byte order mark or not. Note: when saved as ANSI text there will never be a BOM. +var + SW: UnicodeString; + SA: AnsiString; + Allowed: Boolean; + Run: PWideChar; +begin + // The application can decide in which format to save the content. + // If FSaveUnicode is False then all strings are saved in standard ANSI format + // which is also loadable by TStrings but you should be aware that all Unicode + // strings are then converted to ANSI based on the current system locale. + // An extra event is supplied to ask the user about the potential loss of + // information when converting Unicode to ANSI strings. + SW := GetTextStr; + Allowed := True; + FSaved := False; // be pessimistic + // A check for potential information loss makes only sense if the application has + // set an event to be used as call back to ask about the conversion. + if not SaveUnicode and Assigned(FOnConfirmConversion) then + begin + // application requests to save only ANSI characters, so check the text and + // call back in case information could be lost + Run := PWideChar(SW); + // only ask if there's at least one Unicode character in the text + while Run^ in [WideChar(#1)..WideChar(#255)] do + Inc(Run); + // Note: The application can still set FSaveUnicode to True in the callback. + if Run^ <> WideNull then + DoConfirmConversion(Allowed); + end; + + if Allowed then + begin + // only save if allowed + case SaveFormat of + sfUTF16LSB: + begin + if WithBOM then + Stream.WriteBuffer(UTF16BOMLE[0], SizeOf(UTF16BOMLE)); + Stream.WriteBuffer(SW[1], Length(SW) * SizeOf(WideChar)); + FSaved := True; + end; + sfUTF16MSB: + begin + if WithBOM then + Stream.WriteBuffer(UTF16BOMBE[0], SizeOf(UTF16BOMBE)); + StrSwapByteOrder(PWideChar(SW)); + Stream.WriteBuffer(SW[1], Length(SW) * SizeOf(WideChar)); + FSaved := True; + end; + sfUTF8: + begin + if WithBOM then + Stream.WriteBuffer(UTF8BOM[0], SizeOf(UTF8BOM)); + SA := UTF8Encode(SW); + Stream.WriteBuffer(SA[1], Length(SA) * SizeOf(AnsiChar)); + FSaved := True; + end; + sfAnsi: + begin + SA := SW; + Stream.WriteBuffer(SA[1], Length(SA) * SizeOf(AnsiChar)); + FSaved := True; + end; + end; + end; +end; + +procedure TUnicodeStrings.SetCapacity(NewCapacity: Integer); +begin + // do nothing - descendants may optionally implement this method +end; + +procedure TUnicodeStrings.SetCommaText(const Value: UnicodeString); +var + P, P1: PWideChar; + S: UnicodeString; +begin + BeginUpdate; + try + Clear; + P := PWideChar(Value); + while P^ in [WideChar(#1)..WideSpace] do + Inc(P); + while P^ <> WideNull do + begin + if P^ = '"' then + S := WideExtractQuotedStr(P, '"') + else + begin + P1 := P; + while (P^ > WideSpace) and (P^ <> ',') do + Inc(P); + SetString(S, P1, P - P1); + end; + Add(S); + + while P^ in [WideChar(#1)..WideSpace] do + Inc(P); + if P^ = ',' then + begin + repeat + Inc(P); + until not (P^ in [WideChar(#1)..WideSpace]); + end; + end; + finally + EndUpdate; + end; +end; + +procedure TUnicodeStrings.SetTextStr(const Value: UnicodeString); +var + Head, + Tail: PWideChar; + S: UnicodeString; +begin + BeginUpdate; + try + Clear; + Head := PWideChar(Value); + while Head^ <> WideNull do + begin + Tail := Head; + while not (Tail^ in [WideNull, WideLineFeed, WideCarriageReturn, WideVerticalTab, WideFormFeed]) and + (Tail^ <> WideLineSeparator) and (Tail^ <> WideParagraphSeparator) do + Inc(Tail); + SetString(S, Head, Tail - Head); + Add(S); + Head := Tail; + if Head^ <> WideNull then + begin + Inc(Head); + if (Tail^ = WideCarriageReturn) and (Head^ = WideLineFeed) then + Inc(Head); + end; + end; + finally + EndUpdate; + end; +end; + +procedure TUnicodeStrings.SetUpdateState(Updating: Boolean); +begin +end; + +procedure TUnicodeStrings.SetValue(const Name, Value: UnicodeString); +var + I : Integer; +begin + I := IndexOfName(Name); + if Value <> '' then + begin + if I < 0 then + I := Add(''); + Put(I, Name + '=' + Value); + end + else + begin + if I >= 0 then + Delete(I); + end; +end; + +procedure TUnicodeStrings.WriteData(Writer: TWriter); +begin + Writer.WriteWideString(GetTextStr); +end; + + +{ TUnicodeStringList } + +destructor TUnicodeStringList.Destroy; +begin + FOnChange := nil; + FOnChanging := nil; + Clear; + inherited; +end; + +function TUnicodeStringList.Add(const S: UnicodeString): Integer; +begin + if not Sorted then + Result := FCount + else + begin + if Find(S, Result) then + begin + case Duplicates of + dupIgnore: + Exit; + dupError: + Error(SDuplicateString, 0); + end; + end; + end; + InsertItem(Result, S); +end; + +procedure TUnicodeStringList.Changed; +begin + if (FUpdateCount = 0) and Assigned(FOnChange) then + FOnChange(Self); +end; + +procedure TUnicodeStringList.Changing; +begin + if (FUpdateCount = 0) and Assigned(FOnChanging) then + FOnChanging(Self); +end; + +procedure TUnicodeStringList.Clear; +{$IFDEF OWN_UnicodeString_MEMMGR} +var + I: Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if FCount <> 0 then + begin + Changing; + {$IFDEF OWN_UnicodeString_MEMMGR} + for I := 0 to FCount - 1 do + with FList[I] do + if TDynWideCharArray(FString) <> nil then + TDynWideCharArray(FString) := nil; + {$ENDIF OWN_UnicodeString_MEMMGR} + // this will automatically finalize the array + FList := nil; + FCount := 0; + SetCapacity(0); + Changed; + end; +end; + +procedure TUnicodeStringList.Delete(Index: Integer); +begin + if Cardinal(Index) >= Cardinal(FCount) then + Error(SListIndexError, Index); + Changing; + + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, ''); + {$ELSE} + FList[Index].FString := ''; + {$ENDIF OWN_UnicodeString_MEMMGR} + Dec(FCount); + if Index < FCount then + begin + System.Move(FList[Index + 1], FList[Index], (FCount - Index) * SizeOf(TUnicodeStringItem)); + Pointer(FList[FCount].FString) := nil; // avoid freeing the string, the address is now used in another element + end; + Changed; +end; + +procedure TUnicodeStringList.Exchange(Index1, Index2: Integer); +begin + if Cardinal(Index1) >= Cardinal(FCount) then + Error(SListIndexError, Index1); + if Cardinal(Index2) >= Cardinal(FCount) then + Error(SListIndexError, Index2); + Changing; + ExchangeItems(Index1, Index2); + Changed; +end; + +procedure TUnicodeStringList.ExchangeItems(Index1, Index2: Integer); +var + Temp: TUnicodeStringItem; +begin + Temp := FList[Index1]; + FList[Index1] := FList[Index2]; + FList[Index2] := Temp; +end; + +function TUnicodeStringList.Find(const S: UnicodeString; var Index: Integer): Boolean; +var + L, H, I, C: Integer; +begin + Result := False; + L := 0; + H := FCount - 1; + while L <= H do + begin + I := (L + H) shr 1; + C := WideCompareText(FList[I].FString, S); + if C < 0 then + L := I+1 + else + begin + H := I - 1; + if C = 0 then + begin + Result := True; + if Duplicates <> dupAccept then + L := I; + end; + end; + end; + Index := L; +end; + +function TUnicodeStringList.Get(Index: Integer): UnicodeString; +{$IFDEF OWN_UnicodeString_MEMMGR} +var + Len: Integer; +{$ENDIF OWN_UnicodeString_MEMMGR} +begin + if Cardinal(Index) >= Cardinal(FCount) then + Error(SListIndexError, Index); + {$IFDEF OWN_UnicodeString_MEMMGR} + with FList[Index] do + begin + Len := Length(TDynWideCharArray(FString)); + if Len > 0 then + begin + SetLength(Result, Len - 1); // exclude #0 + if Result <> '' then + System.Move(FString^, Result[1], Len * SizeOf(WideChar)); + end + else + Result := ''; + end; + {$ELSE} + Result := FList[Index].FString; + {$ENDIF OWN_UnicodeString_MEMMGR} +end; + +function TUnicodeStringList.GetCapacity: Integer; +begin + Result := Length(FList); +end; + +function TUnicodeStringList.GetCount: Integer; +begin + Result := FCount; +end; + +function TUnicodeStringList.GetObject(Index: Integer): TObject; +begin + if Cardinal(Index) >= Cardinal(FCount) then + Error(SListIndexError, Index); + Result := FList[Index].FObject; +end; + +procedure TUnicodeStringList.Grow; +var + Delta, + Len: Integer; +begin + Len := Length(FList); + if Len > 64 then + Delta := Len div 4 + else + begin + if Len > 8 then + Delta := 16 + else + Delta := 4; + end; + SetCapacity(Len + Delta); +end; + +function TUnicodeStringList.IndexOf(const S: UnicodeString): Integer; +begin + if not Sorted then + Result := inherited IndexOf(S) + else + if not Find(S, Result) then + Result := -1; +end; + +procedure TUnicodeStringList.Insert(Index: Integer; const S: UnicodeString); +begin + if Sorted then + Error(SSortedListError, 0); + if Cardinal(Index) > Cardinal(FCount) then + Error(SListIndexError, Index); + InsertItem(Index, S); +end; + +{$IFDEF OWN_UnicodeString_MEMMGR} +procedure TUnicodeStringList.SetListString(Index: Integer; const S: UnicodeString); +var + Len: Integer; + A: TDynWideCharArray; +begin + with FList[Index] do + begin + Pointer(A) := TDynWideCharArray(FString); + if A <> nil then + A := nil; // free memory + + Len := Length(S); + if Len > 0 then + begin + SetLength(A, Len + 1); // include #0 + System.Move(S[1], A[0], Len * SizeOf(WideChar)); + A[Len] := #0; + end; + + FString := PWideChar(A); + Pointer(A) := nil; // do not release the array on procedure exit + end; +end; +{$ENDIF OWN_UnicodeString_MEMMGR} + +procedure TUnicodeStringList.InsertItem(Index: Integer; const S: UnicodeString); +begin + Changing; + if FCount = Length(FList) then + Grow; + if Index < FCount then + System.Move(FList[Index], FList[Index + 1], (FCount - Index) * SizeOf(TUnicodeStringItem)); + with FList[Index] do + begin + Pointer(FString) := nil; // avoid freeing the string, the address is now used in another element + FObject := nil; + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, S); + {$ELSE} + FString := S; + {$ENDIF OWN_UnicodeString_MEMMGR} + end; + Inc(FCount); + Changed; +end; + +procedure TUnicodeStringList.Put(Index: Integer; const S: UnicodeString); +begin + if Sorted then + Error(SSortedListError, 0); + if Cardinal(Index) >= Cardinal(FCount) then + Error(SListIndexError, Index); + Changing; + + {$IFDEF OWN_UnicodeString_MEMMGR} + SetListString(Index, S); + {$ELSE} + FList[Index].FString := S; + {$ENDIF OWN_UnicodeString_MEMMGR} + Changed; +end; + +procedure TUnicodeStringList.PutObject(Index: Integer; AObject: TObject); +begin + if Cardinal(Index) >= Cardinal(FCount) then + Error(SListIndexError, Index); + Changing; + FList[Index].FObject := AObject; + Changed; +end; + +procedure TUnicodeStringList.QuickSort(L, R: Integer); +var + I, J: Integer; + P: UnicodeString; +begin + repeat + I := L; + J := R; + P := FList[(L + R) shr 1].FString; + repeat + while WideCompareText(FList[I].FString, P) < 0 do + Inc(I); + while WideCompareText(FList[J].FString, P) > 0 do + Dec(J); + if I <= J then + begin + ExchangeItems(I, J); + Inc(I); + Dec(J); + end; + until I > J; + if L < J then + QuickSort(L, J); + L := I; + until I >= R; +end; + +procedure TUnicodeStringList.QuickSort(L, R: Integer; SCompare: TUnicodeStringListSortCompare); +var + I, J: Integer; + P: UnicodeString; +begin + repeat + I := L; + J := R; + P := FList[(L + R) shr 1].FString; + repeat + while SCompare(FList[I].FString, P) < 0 do + Inc(I); + while SCompare(FList[J].FString, P) > 0 do + Dec(J); + if I <= J then + begin + ExchangeItems(I, J); + Inc(I); + Dec(J); + end; + until I > J; + if L < J then + QuickSort(L, J); + L := I; + until I >= R; +end; + +procedure TUnicodeStringList.CustomSort(Compare: TUnicodeStringListSortCompare); +begin + if not Sorted and (FCount > 1) then + begin + Changing; + QuickSort(0, FCount - 1, Compare); + Changed; + end; +end; + +procedure TUnicodeStringList.SetCapacity(NewCapacity: Integer); +begin + SetLength(FList, NewCapacity); + if NewCapacity < FCount then + FCount := NewCapacity; +end; + +procedure TUnicodeStringList.SetSorted(Value: Boolean); +begin + if FSorted <> Value then + begin + if Value then + Sort; + FSorted := Value; + end; +end; + +procedure TUnicodeStringList.SetUpdateState(Updating: Boolean); +begin + if Updating then + Changing + else + Changed; +end; + +procedure TUnicodeStringList.Sort; +begin + if not Sorted and (FCount > 1) then + begin + Changing; + QuickSort(0, FCount - 1); + Changed; + end; +end; +{$ENDIF} + +function WStrLen(const Str: PWideChar): Cardinal; +asm + MOV EDX,EDI + MOV EDI,EAX + MOV ECX,0FFFFFFFFH + XOR AX,AX + REPNE SCASW + MOV EAX,0FFFFFFFEH + SUB EAX,ECX + MOV EDI,EDX +end; + +function WStrEnd(const Str: PWideChar): PWideChar; +asm + MOV EDX,EDI + MOV EDI,EAX + MOV ECX,0FFFFFFFFH + XOR AX,AX + REPNE SCASW + LEA EAX,[EDI-2] + MOV EDI,EDX +end; + +function WStrMove(Dest: PWideChar; const Source: PWideChar; Count: Integer): PWideChar; +begin + Result := Dest; + System.Move(Source^, Dest^, Count * SizeOf(WideChar)); +end; + +function WStrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; +{$IFDEF SYN_COMPILER_16_UP} +begin + Result := SysUtils.StrCopy(Dest, Source) +{$ELSE} +asm + PUSH EDI + PUSH ESI + MOV ESI,EAX + MOV EDI,EDX + MOV ECX,0FFFFFFFFH + XOR AX,AX + REPNE SCASW + NOT ECX + MOV EDI,ESI + MOV ESI,EDX + MOV EDX,ECX + MOV EAX,EDI + SHR ECX,1 + REP MOVSD + MOV ECX,EDX + AND ECX,1 + REP MOVSW + POP ESI + POP EDI +{$ENDIF} +end; + +function WStrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; +{$IFDEF SYN_COMPILER_16_UP} +begin + Result := SysUtils.StrLCopy(Dest, Source, MaxLen) +{$ELSE} +asm + PUSH EDI + PUSH ESI + PUSH EBX + MOV ESI,EAX + MOV EDI,EDX + MOV EBX,ECX + XOR AX,AX + TEST ECX,ECX + JZ @@1 + REPNE SCASW + JNE @@1 + Inc ECX +@@1: SUB EBX,ECX + MOV EDI,ESI + MOV ESI,EDX + MOV EDX,EDI + MOV ECX,EBX + SHR ECX,1 + REP MOVSD + MOV ECX,EBX + AND ECX,1 + REP MOVSW + STOSW + MOV EAX,EDX + POP EBX + POP ESI + POP EDI +{$ENDIF} +end; + +function WStrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; +begin + WStrCopy(WStrEnd(Dest), Source); + Result := Dest; +end; + +function WStrScan(const Str: PWideChar; Chr: WideChar): PWideChar; +begin + Result := Str; + while Result^ <> Chr do + begin + if Result^ = #0 then + begin + Result := nil; + Exit; + end; + Inc(Result); + end; +end; + +function WStrAlloc(Size: Cardinal): PWideChar; +begin + Size := SizeOf(WideChar) * Size + SizeOf(Cardinal); + GetMem(Result, Size); + Cardinal(Pointer(Result)^) := Size; + Inc(PByte(Result), SizeOf(Cardinal)); +end; + +function WStrNew(const Str: PWideChar): PWideChar; +var + Size: Cardinal; +begin + if Str = nil then + Result := nil + else + begin + Size := WStrLen(Str) + 1; + Result := WStrMove(WStrAlloc(Size), Str, Size); + end; +end; + +procedure WStrDispose(Str: PWideChar); +begin + if Str <> nil then + begin + Dec(PByte(Str), SizeOf(Cardinal)); + FreeMem(Str, Cardinal(Pointer(Str)^)); + end; +end; + +{$IFNDEF SYN_COMPILER_6_UP} +{$IFDEF MSWINDOWS} +function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: Cardinal; + Source: PWideChar; SourceChars: Cardinal): Cardinal; +var + i, count: Cardinal; + c: Cardinal; +begin + Result := 0; + if Source = nil then Exit; + count := 0; + i := 0; + if Dest <> nil then + begin + while (i < SourceChars) and (count < MaxDestBytes) do + begin + c := Cardinal(Source[i]); + Inc(i); + if c <= $7F then + begin + Dest[count] := Char(c); + Inc(count); + end + else if c > $7FF then + begin + if count + 3 > MaxDestBytes then + Break; + Dest[count] := Char($E0 or (c shr 12)); + Dest[count+1] := Char($80 or ((c shr 6) and $3F)); + Dest[count+2] := Char($80 or (c and $3F)); + Inc(count,3); + end + else // $7F < Source[i] <= $7FF + begin + if count + 2 > MaxDestBytes then + Break; + Dest[count] := Char($C0 or (c shr 6)); + Dest[count+1] := Char($80 or (c and $3F)); + Inc(count,2); + end; + end; + if count >= MaxDestBytes then count := MaxDestBytes-1; + Dest[count] := #0; + end + else + begin + while i < SourceChars do + begin + c := Integer(Source[i]); + Inc(i); + if c > $7F then + begin + if c > $7FF then + Inc(count); + Inc(count); + end; + Inc(count); + end; + end; + Result := count+1; // convert zero based index to byte count +end; + +function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; + Source: PAnsiChar; SourceBytes: Cardinal): Cardinal; +var + i, count: Cardinal; + c: Byte; + wc: Cardinal; +begin + if Source = nil then + begin + Result := 0; + Exit; + end; + Result := Cardinal(-1); + count := 0; + i := 0; + if Dest <> nil then + begin + while (i < SourceBytes) and (count < MaxDestChars) do + begin + wc := Cardinal(Source[i]); + Inc(i); + if (wc and $80) <> 0 then + begin + if i >= SourceBytes then Exit; // incomplete multibyte char + wc := wc and $3F; + if (wc and $20) <> 0 then + begin + c := Byte(Source[i]); + Inc(i); + if (c and $C0) <> $80 then Exit; // malformed trail byte or out of range char + if i >= SourceBytes then Exit; // incomplete multibyte char + wc := (wc shl 6) or (c and $3F); + end; + c := Byte(Source[i]); + Inc(i); + if (c and $C0) <> $80 then Exit; // malformed trail byte + + Dest[count] := WideChar((wc shl 6) or (c and $3F)); + end + else + Dest[count] := WideChar(wc); + Inc(count); + end; + if count >= MaxDestChars then count := MaxDestChars-1; + Dest[count] := #0; + end + else + begin + while (i < SourceBytes) do + begin + c := Byte(Source[i]); + Inc(i); + if (c and $80) <> 0 then + begin + if i >= SourceBytes then Exit; // incomplete multibyte char + c := c and $3F; + if (c and $20) <> 0 then + begin + c := Byte(Source[i]); + Inc(i); + if (c and $C0) <> $80 then Exit; // malformed trail byte or out of range char + if i >= SourceBytes then Exit; // incomplete multibyte char + end; + c := Byte(Source[i]); + Inc(i); + if (c and $C0) <> $80 then Exit; // malformed trail byte + end; + Inc(count); + end; + end; + Result := count+1; +end; + +function Utf8Encode(const WS: UnicodeString): UTF8String; +var + L: Integer; + Temp: UTF8String; +begin + Result := ''; + if WS = '' then Exit; + SetLength(Temp, Length(WS) * 3); // SetLength includes space for null terminator + + L := UnicodeToUtf8(PAnsiChar(Temp), Length(Temp)+1, PWideChar(WS), Length(WS)); + if L > 0 then + SetLength(Temp, L-1) + else + Temp := ''; + Result := Temp; +end; + +function Utf8Decode(const S: UTF8String): UnicodeString; +var + L: Integer; + Temp: UnicodeString; +begin + Result := ''; + if S = '' then Exit; + SetLength(Temp, Length(S)); + + L := Utf8ToUnicode(PWideChar(Temp), Length(Temp)+1, PAnsiChar(S), Length(S)); + if L > 0 then + SetLength(Temp, L-1) + else + Temp := ''; + Result := Temp; +end; + +function AnsiToUtf8(const S: string): UTF8String; +begin + Result := Utf8Encode(S); +end; + +function Utf8ToAnsi(const S: UTF8String): string; +begin + Result := Utf8Decode(S); +end; + +function DumbItDownFor95(const S1, S2: UnicodeString; CmpFlags: Integer): Integer; +var + a1, a2: AnsiString; +begin + a1 := s1; + a2 := s2; + Result := CompareStringA(LOCALE_USER_DEFAULT, CmpFlags, PAnsiChar(a1), + Length(a1), PAnsiChar(a2), Length(a2)) - 2; +end; + +function WideCompareStr(const S1, S2: UnicodeString): Integer; +begin + SetLastError(0); + Result := CompareStringW(LOCALE_USER_DEFAULT, 0, PWideChar(S1), Length(S1), + PWideChar(S2), Length(S2)) - 2; + case GetLastError of + 0: ; + ERROR_CALL_NOT_IMPLEMENTED: Result := DumbItDownFor95(S1, S2, 0); + else + RaiseLastWin32Error; + end; +end; + +function WideCompareText(const S1, S2: UnicodeString): Integer; +begin + SetLastError(0); + Result := CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, PWideChar(S1), + Length(S1), PWideChar(S2), Length(S2)) - 2; + case GetLastError of + 0: ; + ERROR_CALL_NOT_IMPLEMENTED: Result := DumbItDownFor95(S1, S2, NORM_IGNORECASE); + else + RaiseLastWin32Error; + end; +end; +{$ENDIF} +{$ENDIF} + +{$IFDEF MSWINDOWS} +// The Win9X fix for SynWideUpperCase and SynWideLowerCase was taken +// from Troy Wolbrinks, TntUnicode-package. + +function WCharUpper(lpsz: PWideChar): PWideChar; +var + AStr: AnsiString; + WStr: UnicodeString; +begin + if Win32PlatformIsUnicode then + Result := Windows.CharUpperW(lpsz) + else + begin + if HiWord(Cardinal(lpsz)) = 0 then + begin + // literal char mode + Result := lpsz; + if IsWideCharMappableToAnsi(WideChar(lpsz)) then + begin + AStr := AnsiString(WideChar(lpsz)); // single character may be more than one byte + Windows.CharUpperA(PAnsiChar(AStr)); + WStr := UnicodeString(AStr); // should always be single wide char + if Length(WStr) = 1 then + Result := PWideChar(WStr[1]); + end + end + else + begin + // null-terminated string mode + Result := lpsz; + while lpsz^ <> #0 do + begin + lpsz^ := WideChar(SynUnicode.WCharUpper(PWideChar(lpsz^))); + Inc(lpsz); + end; + end; + end; +end; + +function WCharUpperBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; +var + i: Integer; +begin + if Win32PlatformIsUnicode then + Result := Windows.CharUpperBuffW(lpsz, cchLength) + else + begin + Result := cchLength; + for i := 1 to cchLength do + begin + lpsz^ := WideChar(SynUnicode.WCharUpper(PWideChar(lpsz^))); + Inc(lpsz); + end; + end; +end; + +function WCharLower(lpsz: PWideChar): PWideChar; +var + AStr: AnsiString; + WStr: UnicodeString; +begin + if Win32PlatformIsUnicode then + Result := Windows.CharLowerW(lpsz) + else + begin + if HiWord(Cardinal(lpsz)) = 0 then + begin + // literal char mode + Result := lpsz; + if IsWideCharMappableToAnsi(WideChar(lpsz)) then + begin + AStr := AnsiString(WideChar(lpsz)); // single character may be more than one byte + Windows.CharLowerA(PAnsiChar(AStr)); + WStr := UnicodeString(AStr); // should always be single wide char + if Length(WStr) = 1 then + Result := PWideChar(WStr[1]); + end + end + else + begin + // null-terminated string mode + Result := lpsz; + while lpsz^ <> #0 do + begin + lpsz^ := WideChar(SynUnicode.WCharLower(PWideChar(lpsz^))); + Inc(lpsz); + end; + end; + end; +end; + +function WCharLowerBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; +var + i: Integer; +begin + if Win32PlatformIsUnicode then + Result := Windows.CharLowerBuffW(lpsz, cchLength) + else + begin + Result := cchLength; + for i := 1 to cchLength do + begin + lpsz^ := WideChar(SynUnicode.WCharLower(PWideChar(lpsz^))); + Inc(lpsz); + end; + end; +end; + +function SynWideUpperCase(const S: UnicodeString): UnicodeString; +var + Len: Integer; +begin + Len := Length(S); + SetString(Result, PWideChar(S), Len); + if Len > 0 then + SynUnicode.WCharUpperBuff(Pointer(Result), Len); +end; + +function SynWideLowerCase(const S: UnicodeString): UnicodeString; +var + Len: Integer; +begin + Len := Length(S); + SetString(Result, PWideChar(S), Len); + if Len > 0 then + SynUnicode.WCharLowerBuff(Pointer(Result), Len); +end; +{$ELSE} +function SynWideUpperCase(const S: UnicodeString): UnicodeString; +begin + Result := WideUpperCase(S); +end; + +function SynWideLowerCase(const S: UnicodeString): UnicodeString; +begin + Result := WideLowerCase(S); +end; +{$ENDIF} + +{$IFDEF MSWINDOWS} +function SynIsCharAlpha(const C: WideChar): Boolean; +begin + if Win32PlatformIsUnicode then + Result := IsCharAlphaW(C) + else + // returns false if C is not mappable to ANSI + Result := IsCharAlphaA(AnsiChar(C)); +end; + +function SynIsCharAlphaNumeric(const C: WideChar): Boolean; +begin + if Win32PlatformIsUnicode then + Result := IsCharAlphaNumericW(C) + else + // returns false if C is not mappable to ANSI + Result := IsCharAlphaNumericA(AnsiChar(C)); +end; +{$ELSE} +function SynIsCharAlpha(const C: WideChar): Boolean; +begin + Result := IsAlpha(Integer(ch)) <> 0; +end; + +function SynIsCharAlphaNumeric(const C: WideChar): Boolean; +begin + Result := IsAlNum(Integer(ch)) <> 0; +end; +{$ENDIF} + +{$IFNDEF UNICODE} +function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; +begin + Result := C in CharSet; +end; + +function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; +begin + Result := (C < #$0100) and (AnsiChar(C) in CharSet); +end; +{$ENDIF} + +function WideLastDelimiter(const Delimiters, S: UnicodeString): Integer; +var + P: PWideChar; +begin + Result := Length(S); + P := PWideChar(Delimiters); + while Result > 0 do + begin + if (S[Result] <> #0) and (WStrScan(P, S[Result]) <> nil) then + Exit; + Dec(Result); + end; +end; + +function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString; + Flags: TReplaceFlags): UnicodeString; +var + SearchStr, Patt, NewStr: UnicodeString; + Offset: Integer; +begin + if rfIgnoreCase in Flags then + begin + SearchStr := SynWideUpperCase(S); + Patt := SynWideUpperCase(OldPattern); + end + else + begin + SearchStr := S; + Patt := OldPattern; + end; + NewStr := S; + Result := ''; + while SearchStr <> '' do + begin + Offset := Pos(Patt, SearchStr); + if Offset = 0 then + begin + Result := Result + NewStr; + Break; + end; + Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern; + NewStr := Copy(NewStr, Offset + Length(OldPattern), MaxInt); + if not (rfReplaceAll in Flags) then + begin + Result := Result + NewStr; + Break; + end; + SearchStr := Copy(SearchStr, Offset + Length(Patt), MaxInt); + end; +end; + +const + // data used to bring UTF-16 coded strings into correct UTF-32 order for correct comparation + UTF16Fixup: array[0..31] of Word = ( + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + $2000, $F800, $F800, $F800, $F800 + ); + +// Binary comparation of Str1 and Str2 with surrogate fix-up. +// Returns < 0 if Str1 is smaller in binary order than Str2, = 0 if both strings are +// equal and > 0 if Str1 is larger than Str2. +// +// This code is based on an idea of Markus W. Scherer (IBM). +// Note: The surrogate fix-up is necessary because some single value code points have +// larger values than surrogates which are in UTF-32 actually larger. +function WStrComp(Str1, Str2: PWideChar): Integer; +var + C1, C2: Word; + Run1, Run2: PWideChar; +begin + Run1 := Str1; + Run2 := Str2; + repeat + C1 := Word(Run1^); + C1 := Word(C1 + UTF16Fixup[C1 shr 11]); + C2 := Word(Run2^); + C2 := Word(C2 + UTF16Fixup[C2 shr 11]); + + // now C1 and C2 are in UTF-32-compatible order + Result := Integer(C1) - Integer(C2); + if(Result <> 0) or (C1 = 0) or (C2 = 0) then + Break; + Inc(Run1); + Inc(Run2); + until False; + + // If the strings have different lengths but the comparation returned equity so far + // then adjust the result so that the longer string is marked as the larger one. + if Result = 0 then + Result := (Run1 - Str1) - (Run2 - Str2); +end; + +// compares strings up to MaxLen code points +// see also StrCompW +function WStrLComp(Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; +var + C1, C2: Word; +begin + if MaxLen > 0 then + begin + repeat + C1 := Word(Str1^); + C1 := Word(C1 + UTF16Fixup[C1 shr 11]); + C2 := Word(Str2^); + C2 := Word(C2 + UTF16Fixup[C2 shr 11]); + + // now C1 and C2 are in UTF-32-compatible order + { TODO : surrogates take up 2 words and are counted twice here, count them only once } + Result := Integer(C1) - Integer(C2); + Dec(MaxLen); + if(Result <> 0) or (C1 = 0) or (C2 = 0) or (MaxLen = 0) then + Break; + Inc(Str1); + Inc(Str2); + until False; + end + else + Result := 0; +end; + +// exchanges in each character of the given string the low order and high order +// byte to go from LSB to MSB and vice versa. +// EAX contains address of string +procedure StrSwapByteOrder(Str: PWideChar); +{$IFDEF SYN_COMPILER_16_UP} +var + P: PWord; +begin + P := PWord(Str); + while P^ <> 0 do + begin + P^ := MakeWord(HiByte(P^), LoByte(P^)); + Inc(P); + end; +{$ELSE} +asm + PUSH ESI + PUSH EDI + MOV ESI, EAX + MOV EDI, ESI + XOR EAX, EAX // clear high order byte to be able to use 32bit operand below +@@1: + LODSW + OR EAX, EAX + JZ @@2 + XCHG AL, AH + STOSW + JMP @@1 + + +@@2: + POP EDI + POP ESI +{$ENDIF} +end; + +// works like QuotedStr from SysUtils.pas but can insert any quotation character +function WideQuotedStr(const S: UnicodeString; Quote: WideChar): UnicodeString; +var + P, Src, + Dest: PWideChar; + AddCount: Integer; +begin + AddCount := 0; + P := WStrScan(PWideChar(S), Quote); + while (P <> nil) do + begin + Inc(P); + Inc(AddCount); + P := WStrScan(P, Quote); + end; + + if AddCount = 0 then + Result := Quote + S + Quote + else + begin + SetLength(Result, Length(S) + AddCount + 2); + Dest := PWideChar(Result); + Dest^ := Quote; + Inc(Dest); + Src := PWideChar(S); + P := WStrScan(Src, Quote); + repeat + Inc(P); + Move(Src^, Dest^, 2 * (P - Src)); + Inc(Dest, P - Src); + Dest^ := Quote; + Inc(Dest); + Src := P; + P := WStrScan(Src, Quote); + until P = nil; + P := WStrEnd(Src); + Move(Src^, Dest^, 2 * (P - Src)); + Inc(Dest, P - Src); + Dest^ := Quote; + end; +end; + +// extracts a string enclosed in quote characters given by Quote +function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): UnicodeString; +var + P, Dest: PWideChar; + DropCount: Integer; +begin + Result := ''; + if (Src = nil) or (Src^ <> Quote) then + Exit; + + Inc(Src); + DropCount := 1; + P := Src; + Src := WStrScan(Src, Quote); + + while Src <> nil do // count adjacent pairs of quote chars + begin + Inc(Src); + if Src^ <> Quote then + Break; + Inc(Src); + Inc(DropCount); + Src := WStrScan(Src, Quote); + end; + + if Src = nil then + Src := WStrEnd(P); + if (Src - P) <= 1 then + Exit; + + if DropCount = 1 then + SetString(Result, P, Src - P - 1) + else + begin + SetLength(Result, Src - P - DropCount); + Dest := PWideChar(Result); + Src := WStrScan(P, Quote); + while Src <> nil do + begin + Inc(Src); + if Src^ <> Quote then + Break; + Move(P^, Dest^, 2 * (Src - P)); + Inc(Dest, Src - P); + Inc(Src); + P := Src; + Src := WStrScan(Src, Quote); + end; + if Src = nil then + Src := WStrEnd(P); + Move(P^, Dest^, 2 * (Src - P - 1)); + end; +end; + +// returns a string of Count characters filled with C +function UnicodeStringOfChar(C: WideChar; Count: Cardinal): UnicodeString; +var + I: Integer; +begin + SetLength(Result, Count); + for I := 1 to Count do + Result[I] := C; +end; + +function WideTrim(const S: UnicodeString): UnicodeString; +var + I, L: Integer; +begin + L := Length(S); + I := 1; + while (I <= L) and (S[I] <= ' ') do Inc(I); + if I > L then + Result := '' + else + begin + while S[L] <= ' ' do Dec(L); + Result := Copy(S, I, L - I + 1); + end; +end; + +function WideTrimLeft(const S: UnicodeString): UnicodeString; +var + I, L: Integer; +begin + L := Length(S); + I := 1; + while (I <= L) and (S[I] <= ' ') do Inc(I); + Result := Copy(S, I, Maxint); +end; + +function WideTrimRight(const S: UnicodeString): UnicodeString; +var + I: Integer; +begin + I := Length(S); + while (I > 0) and (S[I] <= ' ') do Dec(I); + Result := Copy(S, 1, I); +end; + +{$IFDEF MSWINDOWS} +function TranslateCharsetInfoEx(lpSrc: PDWORD; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; + external 'gdi32.dll' name 'TranslateCharsetInfo'; + +function CharSetFromLocale(Language: LCID): TFontCharSet; +var + CP: Cardinal; + CSI: TCharsetInfo; +begin + CP:= CodePageFromLocale(Language); + TranslateCharsetInfoEx(Pointer(CP), CSI, TCI_SRCCODEPAGE); + Result:= CSI.ciCharset; +end; + +// determines the code page for a given locale +function CodePageFromLocale(Language: LCID): Integer; +var + Buf: array[0..6] of Char; +begin + GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6); + Result := StrToIntDef(Buf, GetACP); +end; + +function KeyboardCodePage: Word; +begin + Result := CodePageFromLocale(GetKeyboardLayout(0) and $FFFF); +end; + +// converts the given character (as it comes with a WM_CHAR message) into its +// corresponding Unicode character depending on the active keyboard layout +function KeyUnicode(C: AnsiChar): WideChar; +begin + MultiByteToWideChar(KeyboardCodePage, MB_USEGLYPHCHARS, @C, 1, @Result, 1); +end; + +function StringToUnicodeStringEx(const S: AnsiString; CodePage: Word): UnicodeString; +var + InputLength, + OutputLength: Integer; +begin + InputLength := Length(S); + OutputLength := MultiByteToWideChar(CodePage, 0, PAnsiChar(S), InputLength, + nil, 0); + SetLength(Result, OutputLength); + MultiByteToWideChar(CodePage, 0, PAnsiChar(S), InputLength, PWideChar(Result), + OutputLength); +end; + +function UnicodeStringToStringEx(const WS: UnicodeString; CodePage: Word): AnsiString; +var + InputLength, + OutputLength: Integer; +begin + InputLength := Length(WS); + OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, + nil, 0, nil, nil); + SetLength(Result, OutputLength); + WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, PAnsiChar(Result), + OutputLength, nil, nil); +end; +{$ENDIF} + +function GetTextSize(DC: HDC; Str: PWideChar; Count: Integer): TSize; +{$IFDEF SYN_UNISCRIBE} +const + SSAnalyseFlags = SSA_GLYPHS or SSA_FALLBACK or SSA_LINK; +{$ENDIF} +var + tm: TTextMetricA; + {$IFDEF SYN_UNISCRIBE} + GlyphBufferSize: Integer; + saa: TScriptStringAnalysis; + lpSize: PSize; + {$ENDIF} +begin + Result.cx := 0; + Result.cy := 0; + +{$IFDEF SYN_UNISCRIBE} + if Usp10IsInstalled then + begin + if Count <= 0 then Exit; + + // According to the MS Windows SDK (1.5 * Count + 16) is the recommended + // value for GlyphBufferSize (see documentation of cGlyphs parameter of + // ScriptStringAnalyse function) + GlyphBufferSize := (3 * Count) div 2 + 16; + + if Succeeded(ScriptStringAnalyse(DC, Str, Count, GlyphBufferSize, -1, + SSAnalyseFlags, 0, nil, nil, nil, nil, nil, @saa)) then + begin + lpSize := ScriptString_pSize(saa); + if lpSize <> nil then + begin + Result := lpSize^; + if Result.cx = 0 then + begin + GetTextMetricsA(DC, tm); + Result.cx := tm.tmAveCharWidth; + end; + end; + ScriptStringFree(@saa); + end; + end + else +{$ENDIF} + begin + GetTextExtentPoint32W(DC, Str, Count, Result); + if not Win32PlatformIsUnicode then + begin + GetTextMetricsA(DC, tm); + if tm.tmPitchAndFamily and TMPF_TRUETYPE <> 0 then + Result.cx := Result.cx - tm.tmOverhang + else + Result.cx := tm.tmAveCharWidth * Count; + end; + end; +end; + +type + TAccessCanvas = class(TCanvas) + end; + +function TextExtent(ACanvas: TCanvas; const Text: UnicodeString): TSize; +begin + with TAccessCanvas(ACanvas) do + begin + RequiredState([csHandleValid, csFontValid]); + Result := GetTextSize(Handle, PWideChar(Text), Length(Text)); + end; +end; + +function TextWidth(ACanvas: TCanvas; const Text: UnicodeString): Integer; +begin + Result := TextExtent(ACanvas, Text).cX; +end; + +function TextHeight(ACanvas: TCanvas; const Text: UnicodeString): Integer; +begin + Result := TextExtent(ACanvas, Text).cY; +end; + +procedure TextOut(ACanvas: TCanvas; X, Y: Integer; const Text: UnicodeString); +begin + with TAccessCanvas(ACanvas) do + begin + Changing; + RequiredState([csHandleValid, csFontValid, csBrushValid]); + if CanvasOrientation = coRightToLeft then + Inc(X, SynUnicode.TextWidth(ACanvas, Text) + 1); + Windows.ExtTextOutW(Handle, X, Y, TextFlags, nil, PWideChar(Text), + Length(Text), nil); + MoveTo(X + SynUnicode.TextWidth(ACanvas, Text), Y); + Changed; + end; +end; + +procedure TextRect(ACanvas: TCanvas; Rect: TRect; X, Y: Integer; + const Text: UnicodeString); +var + Options: Longint; +begin + with TAccessCanvas(ACanvas) do + begin + Changing; + RequiredState([csHandleValid, csFontValid, csBrushValid]); + Options := ETO_CLIPPED or TextFlags; + if Brush.Style <> bsClear then + Options := Options or ETO_OPAQUE; + if ((TextFlags and ETO_RTLREADING) <> 0) and + (CanvasOrientation = coRightToLeft) + then + Inc(X, SynUnicode.TextWidth(ACanvas, Text) + 1); + Windows.ExtTextOutW(Handle, X, Y, Options, @Rect, PWideChar(Text), + Length(Text), nil); + Changed; + end; +end; + +{$IFNDEF UNICODE} +{ TWideFileStream } + +constructor TWideFileStream.Create(const FileName: UnicodeString; Mode: Word); +begin +{$IFDEF MSWINDOWS} + Create(Filename, Mode, 0); +{$ELSE} + Create(Filename, Mode, FileAccessRights); +{$ENDIF} +end; + +constructor TWideFileStream.Create(const FileName: UnicodeString; Mode: Word; + Rights: Cardinal); +{$IFDEF USE_TNT_RUNTIME_SUPPORT} +var + ErrorMessage: UnicodeString; +{$ENDIF} +begin + if ((Mode and fmCreate) = fmCreate) then + begin + inherited Create(WideFileCreate(FileName, Rights)); + if Handle < 0 then + begin +{$IFDEF USE_TNT_RUNTIME_SUPPORT} + {$IFDEF SYN_COMPILER_7_UP} + ErrorMessage := WideSysErrorMessage(GetLastError); + raise EWideFCreateError.CreateResFmt(PResStringRec(@SFCreateErrorEx), + [WideExpandFileName(FileName), ErrorMessage]); + {$ELSE} + raise EWideFCreateError.CreateResFmt(@SFCreateError, [FileName]); + {$ENDIF} +{$ELSE} + {$IFDEF SYN_COMPILER_7_UP} + raise EFCreateError.CreateResFmt(PResStringRec(@SFCreateErrorEx), + [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); + {$ELSE} + raise EFCreateError.CreateResFmt(PResStringRec(@SFCreateError), [FileName]); + {$ENDIF} +{$ENDIF} + end + end + else + begin + inherited Create(WideFileOpen(FileName, Mode)); + if Handle < 0 then + begin +{$IFDEF USE_TNT_RUNTIME_SUPPORT} + {$IFDEF SYN_COMPILER_7_UP} + ErrorMessage := WideSysErrorMessage(GetLastError); + raise EWideFOpenError.CreateResFmt(PResStringRec(@SFOpenErrorEx), + [WideExpandFileName(FileName), ErrorMessage]); + {$ELSE} + raise EWideFOpenError.CreateResFmt(@SFOpenError, [FileName]); + {$ENDIF} +{$ELSE} + {$IFDEF SYN_COMPILER_7_UP} + raise EFOpenError.CreateResFmt(PResStringRec(@SFOpenErrorEx), + [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); + {$ELSE} + raise EFOpenError.CreateResFmt(PResStringRec(@SFOpenError), [FileName]); + {$ENDIF} +{$ENDIF} + end; + end; +end; + +destructor TWideFileStream.Destroy; +begin + if Handle >= 0 then FileClose(Handle); + inherited Destroy; +end; + +function WideFileOpen(const FileName: UnicodeString; Mode: LongWord): Integer; +{$IFDEF MSWINDOWS} +const + AccessMode: array[0..2] of LongWord = ( + GENERIC_READ, + GENERIC_WRITE, + GENERIC_READ or GENERIC_WRITE); + ShareMode: array[0..4] of LongWord = ( + 0, + 0, + FILE_SHARE_READ, + FILE_SHARE_WRITE, + FILE_SHARE_READ or FILE_SHARE_WRITE); +begin + Result := -1; + if ((Mode and 3) <= fmOpenReadWrite) and + ((Mode and $F0) <= fmShareDenyNone) then + begin + if Win32PlatformIsUnicode then + Result := Integer(CreateFileW(PWideChar(FileName), AccessMode[Mode and 3], + ShareMode[(Mode and $F0) shr 4], nil, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0)) + else + Result := Integer(CreateFileA(PAnsiChar(AnsiString(FileName)), AccessMode[Mode and 3], + ShareMode[(Mode and $F0) shr 4], nil, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0)); + end; +end; +{$ENDIF} +{$IFDEF SYN_LINUX} +const + ShareMode: array[0..fmShareDenyNone shr 4] of Byte = ( + 0, //No share mode specified + F_WRLCK, //fmShareExclusive + F_RDLCK, //fmShareDenyWrite + 0); //fmShareDenyNone +var + FileHandle, Tvar: Integer; + LockVar: TFlock; + smode: Byte; +begin + Result := -1; + if FileExists(FileName) and + ((Mode and 3) <= fmOpenReadWrite) and + ((Mode and $F0) <= fmShareDenyNone) then + begin + FileHandle := open(PChar(AnsiString(FileName)), (Mode and 3), FileAccessRights); + + if FileHandle = -1 then Exit; + + smode := Mode and $F0 shr 4; + if ShareMode[smode] <> 0 then + begin + with LockVar do + begin + l_whence := SEEK_SET; + l_start := 0; + l_len := 0; + l_type := ShareMode[smode]; + end; + Tvar := fcntl(FileHandle, F_SETLK, LockVar); + if Tvar = -1 then + begin + __close(FileHandle); + Exit; + end; + end; + Result := FileHandle; + end; +end; +{$ENDIF} + +function WideFileCreate(const FileName: UnicodeString): Integer; +{$IFDEF MSWINDOWS} +begin + if Win32PlatformIsUnicode then + Result := Integer(CreateFileW(PWideChar(FileName), GENERIC_READ or GENERIC_WRITE, + 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)) + else + Result := Integer(CreateFileA(PAnsiChar(AnsiString(FileName)), GENERIC_READ or GENERIC_WRITE, + 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)); +end; +{$ENDIF} +{$IFDEF SYN_LINUX} +begin + Result := FileCreate(FileName, FileAccessRights); +end; +{$ENDIF} + +function WideFileCreate(const FileName: UnicodeString; Rights: Integer): Integer; +{$IFDEF MSWINDOWS} +begin + Result := WideFileCreate(FileName); +end; +{$ENDIF} +{$IFDEF SYN_LINUX} +begin + Result := Integer(open(PChar(AnsiString(FileName)), O_RDWR or O_CREAT or O_TRUNC, Rights)); +end; +{$ENDIF} +{$ENDIF} + +function IsAnsiOnly(const WS: UnicodeString): Boolean; +{$IFDEF MSWINDOWS} +begin + Result := IsUnicodeStringMappableToAnsi(WS); +end; +{$ELSE} +var + Run: PWideChar; +begin + Run := PWideChar(WS); + while Run^ in [WideChar(#1)..WideChar(#255)] do + Inc(Run); + Result := Run^ = WideNull; +end; +{$ENDIF} + +function IsUTF8(const FileName: UnicodeString; out WithBOM: Boolean): Boolean; +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + try + Result := IsUTF8(Stream, WithBOM); + finally + Stream.Free; + end; +end; + +// checks for a BOM in UTF-8 format or searches the first 4096 bytes for +// typical UTF-8 octet sequences +function IsUTF8(Stream: TStream; out WithBOM: Boolean): Boolean; +const + MinimumCountOfUTF8Strings = 1; + MaxBufferSize = $4000; +var + Buffer: array of Byte; + BufferSize, i, FoundUTF8Strings: Integer; + + // 3 trailing bytes are the maximum in valid UTF-8 streams, + // so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams + function CountOfTrailingBytes: Integer; + begin + Result := 0; + Inc(i); + while (i < BufferSize) and (Result < 4) do + begin + if Buffer[i] in [$80..$BF] then + Inc(Result) + else + Break; + Inc(i); + end; + end; + +begin + // if Stream is nil, let Delphi raise the exception, by accessing Stream, + // to signal an invalid result + + // start analysis at actual Stream.Position + BufferSize := Min(MaxBufferSize, Stream.Size - Stream.Position); + + // if no special characteristics are found it is not UTF-8 + Result := False; + WithBOM := False; + + if BufferSize > 0 then + begin + SetLength(Buffer, BufferSize); + Stream.ReadBuffer(Buffer[0], BufferSize); + Stream.Seek(-BufferSize, soFromCurrent); + + { first search for BOM } + + if (BufferSize >= Length(UTF8BOM)) and CompareMem(@Buffer[0], @UTF8BOM[0], Length(UTF8BOM)) then + begin + WithBOM := True; + Result := True; + Exit; + end; + + { If no BOM was found, check for leading/trailing byte sequences, + which are uncommon in usual non UTF-8 encoded text. + + NOTE: There is no 100% save way to detect UTF-8 streams. The bigger + MinimumCountOfUTF8Strings, the lower is the probability of + a false positive. On the other hand, a big MinimumCountOfUTF8Strings + makes it unlikely to detect files with only little usage of non + US-ASCII chars, like usual in European languages. } + + FoundUTF8Strings := 0; + i := 0; + while i < BufferSize do + begin + case Buffer[i] of + $00..$7F: // skip US-ASCII characters as they could belong to various charsets + ; + $C2..$DF: + if CountOfTrailingBytes = 1 then + Inc(FoundUTF8Strings) + else + Break; + $E0: + begin + Inc(i); + if (i < BufferSize) and (Buffer[i] in [$A0..$BF]) and (CountOfTrailingBytes = 1) then + Inc(FoundUTF8Strings) + else + Break; + end; + $E1..$EC, $EE..$EF: + if CountOfTrailingBytes = 2 then + Inc(FoundUTF8Strings) + else + Break; + $ED: + begin + Inc(i); + if (i < BufferSize) and (Buffer[i] in [$80..$9F]) and (CountOfTrailingBytes = 1) then + Inc(FoundUTF8Strings) + else + Break; + end; + $F0: + begin + Inc(i); + if (i < BufferSize) and (Buffer[i] in [$90..$BF]) and (CountOfTrailingBytes = 2) then + Inc(FoundUTF8Strings) + else + Break; + end; + $F1..$F3: + if CountOfTrailingBytes = 3 then + Inc(FoundUTF8Strings) + else + Break; + $F4: + begin + Inc(i); + if (i < BufferSize) and (Buffer[i] in [$80..$8F]) and (CountOfTrailingBytes = 2) then + Inc(FoundUTF8Strings) + else + Break; + end; + $C0, $C1, $F5..$FF: // invalid UTF-8 bytes + Break; + $80..$BF: // trailing bytes are consumed when handling leading bytes, + // any occurence of "orphaned" trailing bytes is invalid UTF-8 + Break; + end; + + if FoundUTF8Strings = MinimumCountOfUTF8Strings then + begin + Result := True; + Break; + end; + + Inc(i); + end; + end; +end; + +function GetEncoding(const FileName: UnicodeString; out WithBOM: Boolean): TSynEncoding; +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + try + Result := GetEncoding(Stream, WithBOM); + finally + Stream.Free; + end; +end; + +function GetEncoding(Stream: TStream; out WithBOM: Boolean): TSynEncoding; +var + BOM: WideChar; + Size: Integer; +begin + // if Stream is nil, let Delphi raise the exception, by accessing Stream, + // to signal an invalid result + + // start analysis at actual Stream.Position + Size := Stream.Size - Stream.Position; + + // if no special characteristics are found it is probably ANSI + Result := seAnsi; + + if IsUTF8(Stream, WithBOM) then + begin + Result := seUTF8; + Exit; + end; + + { try to detect UTF-16 by finding a BOM in UTF-16 format } + + if Size >= 2 then + begin + Stream.ReadBuffer(BOM, sizeof(BOM)); + Stream.Seek(-sizeof(BOM), soFromCurrent); + if BOM = WideChar(UTF16BOMLE) then + begin + Result := seUTF16LE; + WithBOM := True; + Exit; + end + else if BOM = WideChar(UTF16BOMBE) then + begin + Result := seUTF16BE; + WithBOM := True; + Exit; + end + end; +end; + +procedure SaveToFile(const WS: UnicodeString; const FileName: UnicodeString; + Encoding: TSynEncoding; WithBom: Boolean = True); +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmCreate); + try + SaveToStream(WS, Stream, Encoding, WithBom); + finally + Stream.Free; + end; +end; + +procedure SaveToFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + Encoding: TSynEncoding; WithBom: Boolean = True); +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmCreate); + try + SaveToStream(UnicodeStrings, Stream, Encoding, WithBom); + finally + Stream.Free; + end; +end; + +function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + out WithBOM: Boolean): TSynEncoding; +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + try + Result := LoadFromStream(UnicodeStrings, Stream, WithBOM); + finally + Stream.Free; + end; +end; + +function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; + Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; +var + Stream: TStream; +begin + Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); + try + Result := LoadFromStream(UnicodeStrings, Stream, Encoding, WithBOM); + finally + Stream.Free; + end; +end; + +procedure SaveToStream(const WS: UnicodeString; Stream: TStream; Encoding: TSynEncoding; + WithBom: Boolean = True); +var + UTF16BOM: UnicodeString; + + UTF8Str: UTF8String; + AnsiStr: AnsiString; +begin + if WithBom then + case Encoding of + seUTF8: + Stream.WriteBuffer(UTF8BOM, 3); + seUTF16LE: + begin + UTF16BOM := BOM_LSB_FIRST; + Stream.WriteBuffer(PWideChar(UTF16BOM)^, 2); + end; + seUTF16BE: + begin + UTF16BOM := BOM_MSB_FIRST; + Stream.WriteBuffer(PWideChar(UTF16BOM)^, 2); + end; + end; + + case Encoding of + seUTF8: + begin + UTF8Str := UTF8Encode(WS); + Stream.WriteBuffer(UTF8Str[1], Length(UTF8Str)); + end; + seUTF16LE: + Stream.WriteBuffer(WS[1], Length(WS) * sizeof(WideChar)); + seUTF16BE: + begin + StrSwapByteOrder(PWideChar(WS)); + Stream.WriteBuffer(WS[1], Length(WS) * sizeof(WideChar)); + end; + seAnsi: + begin + AnsiStr := AnsiString(PWideChar(WS)); + Stream.WriteBuffer(AnsiStr[1], Length(AnsiStr)); + end; + end; +end; + +type + TSynEditStringListAccess = class(TSynEditStringList); + +procedure SaveToStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding; WithBom: Boolean = True); +var + SText: UnicodeString; + SaveFStreaming: Boolean; +begin + // if UnicodeStrings or Stream is nil, let Delphi raise the exception to flag the error + + if UnicodeStrings is TSynEditStringList then + begin + SaveFStreaming := TSynEditStringListAccess(UnicodeStrings).FStreaming; + TSynEditStringListAccess(UnicodeStrings).FStreaming := True; + SText := UnicodeStrings.Text; + TSynEditStringListAccess(UnicodeStrings).FStreaming := SaveFStreaming; + end + else + SText := UnicodeStrings.Text; + SaveToStream(SText, Stream, Encoding, WithBom); +end; + +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + out WithBOM: Boolean): TSynEncoding; +var + Dummy: Boolean; +begin + Result := LoadFromStream(UnicodeStrings, Stream, GetEncoding(Stream, WithBOM), + Dummy); +end; + +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding): TSynEncoding; overload; +var + Dummy: Boolean; +begin + Result := LoadFromStream(UnicodeStrings, Stream, Encoding, Dummy); +end; + +function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; + Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; +var + WideStr: UnicodeString; + UTF8Str: UTF8String; + AnsiStr: AnsiString; + Size: Integer; + + function SkipBOM: Boolean; + var + BOM: array of Byte; + begin + Result := False; + case Encoding of + seUTF8: + begin + SetLength(BOM, Min(Length(UTF8BOM), Size)); + Stream.ReadBuffer(BOM[0], Length(BOM)); + if (Length(BOM) <> Length(UTF8BOM)) or + not CompareMem(@BOM[0], @UTF8BOM[0], Length(UTF8BOM)) + then + Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) + else + Result := True; + end; + seUTF16LE: + begin + SetLength(BOM, Min(Length(UTF16BOMLE), Size)); + Stream.ReadBuffer(BOM[0], Length(BOM)); + if (Length(BOM) <> Length(UTF16BOMLE)) or + not CompareMem(@BOM[0], @UTF16BOMLE[0], Length(UTF16BOMLE)) + then + Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) + else + Result := True; + end; + seUTF16BE: + begin + SetLength(BOM, Min(Length(UTF16BOMBE), Size)); + Stream.ReadBuffer(BOM[0], Length(BOM)); + if (Length(BOM) <> Length(UTF16BOMBE)) or + not CompareMem(@BOM[0], @UTF16BOMBE[0], Length(UTF16BOMBE)) + then + Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) + else + Result := True; + end; + end; + Size := Stream.Size - Stream.Position; + end; + +begin + // if UnicodeStrings or Stream is nil, let Delphi raise the exception to + // signal an invalid result + UnicodeStrings.BeginUpdate; + try + Result := Encoding; + // start decoding at actual Stream.Position + Size := Stream.Size - Stream.Position; + + // skip BOM, if it exists + WithBOM := SkipBOM; + + case Result of + seUTF8: + begin + SetLength(UTF8Str, Size); + Stream.ReadBuffer(UTF8Str[1], Size); +{$IFDEF UNICODE} + UnicodeStrings.Text := UTF8ToUnicodeString(UTF8Str); +{$ELSE} + UnicodeStrings.Text := UTF8Decode(UTF8Str); + UnicodeStrings.SaveFormat := sfUTF8; +{$ENDIF} + end; + seUTF16LE: + begin + SetLength(WideStr, Size div 2); + Stream.ReadBuffer(WideStr[1], Size); + UnicodeStrings.Text := WideStr; +{$IFNDEF UNICODE} + UnicodeStrings.SaveFormat := sfUTF16LSB; +{$ENDIF} + end; + seUTF16BE: + begin + SetLength(WideStr, Size div 2); + Stream.ReadBuffer(WideStr[1], Size); + StrSwapByteOrder(PWideChar(WideStr)); + UnicodeStrings.Text := WideStr; +{$IFNDEF UNICODE} + UnicodeStrings.SaveFormat := sfUTF16MSB; +{$ENDIF} + end; + seAnsi: + begin + SetLength(AnsiStr, Size); + Stream.ReadBuffer(AnsiStr[1], Size); + UnicodeStrings.Text := UnicodeString(AnsiStr); +{$IFNDEF UNICODE} + UnicodeStrings.SaveFormat := sfAnsi; +{$ENDIF} + end; + end; + finally + UnicodeStrings.EndUpdate + end +end; + +function ClipboardProvidesText: Boolean; +begin + Result := IsClipboardFormatAvailable(CF_TEXT) or IsClipboardFormatAvailable(CF_UNICODETEXT); +end; + +function GetClipboardText: UnicodeString; +var + Mem: HGLOBAL; + LocaleID: LCID; + P: PByte; +begin + Result := ''; + Clipboard.Open; + try + if Clipboard.HasFormat(CF_UNICODETEXT) then + begin + Mem := Clipboard.GetAsHandle(CF_UNICODETEXT); + try + if Mem <> 0 then + Result := PWideChar(GlobalLock(Mem)); + finally + if Mem <> 0 then GlobalUnlock(Mem); + end; + end + else + begin + LocaleID := 0; + Mem := Clipboard.GetAsHandle(CF_LOCALE); + try + if Mem <> 0 then LocaleID := PInteger(GlobalLock(Mem))^; + finally + if Mem <> 0 then GlobalUnlock(Mem); + end; + + Mem := Clipboard.GetAsHandle(CF_TEXT); + try + if Mem <> 0 then + begin + P := GlobalLock(Mem); + Result := StringToUnicodeStringEx(PAnsiChar(P), CodePageFromLocale(LocaleID)); + end + finally + if Mem <> 0 then GlobalUnlock(Mem); + end; + end; + finally + Clipboard.Close; + end; +end; + +procedure SetClipboardText(const Text: UnicodeString); +var + Mem: HGLOBAL; + P: PByte; + SLen: Integer; +begin + if Text = '' then Exit; + SLen := Length(Text); + Clipboard.Open; + try + Clipboard.Clear; + + // set ANSI text only on Win9X, WinNT automatically creates ANSI from Unicode + if Win32Platform <> VER_PLATFORM_WIN32_NT then + begin + Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, SLen + 1); + if Mem <> 0 then + begin + P := GlobalLock(Mem); + try + if P <> nil then + begin + Move(PAnsiChar(AnsiString(Text))^, P^, SLen + 1); + Clipboard.SetAsHandle(CF_TEXT, Mem); + end; + finally + GlobalUnlock(Mem); + end; + end; + end; + + // set unicode text, this also works on Win9X, even if the clipboard-viewer + // can't show it, Word 2000+ can paste it including the unicode only characters + Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, + (SLen + 1) * sizeof(WideChar)); + if Mem <> 0 then + begin + P := GlobalLock(Mem); + try + if P <> nil then + begin + Move(PWideChar(Text)^, P^, (SLen + 1) * sizeof(WideChar)); + Clipboard.SetAsHandle(CF_UNICODETEXT, Mem); + end; + finally + GlobalUnlock(Mem); + end; + end; + // Don't free Mem! It belongs to the clipboard now, and it will free it + // when it is done with it. + finally + Clipboard.Close; + end; +end; + +{$IFNDEF UNICODE} +{$IFNDEF SYN_COMPILER_6_UP} +procedure AssignWideStr(var Dest: UnicodeString; const Source: UnicodeString); +begin + Dest := Source; +end; + +procedure IntGetWideStrProp(Instance: TObject; PropInfo: PPropInfo; + var Value: UnicodeString); assembler; +asm + { -> EAX Pointer to instance } + { EDX Pointer to property info } + { ECX Pointer to result string } + + PUSH ESI + PUSH EDI + MOV EDI,EDX + + MOV EDX,[EDI].TPropInfo.Index { pass index in EDX } + CMP EDX,$80000000 + JNE @@hasIndex + MOV EDX,ECX { pass value in EDX } +@@hasIndex: + MOV ESI,[EDI].TPropInfo.GetProc + CMP [EDI].TPropInfo.GetProc.Byte[3],$FE + JA @@isField + JB @@isStaticMethod + +@@isVirtualMethod: + MOVSX ESI,SI { sign extend slot offset } + ADD ESI,[EAX] { vmt + slot offset } + CALL DWORD PTR [ESI] + JMP @@exit + +@@isStaticMethod: + CALL ESI + JMP @@exit + +@@isField: + AND ESI,$00FFFFFF + MOV EDX,[EAX+ESI] + MOV EAX,ECX + CALL AssignWideStr + +@@exit: + POP EDI + POP ESI +end; + +function GetWideStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString; +begin + IntGetWideStrProp(Instance, PropInfo, Result); +end; + +procedure SetWideStrProp(Instance: TObject; PropInfo: PPropInfo; + const Value: UnicodeString); assembler; +asm + { -> EAX Pointer to instance } + { EDX Pointer to property info } + { ECX Pointer to string value } + + PUSH ESI + PUSH EDI + MOV ESI,EDX + + MOV EDX,[ESI].TPropInfo.Index { pass index in EDX } + CMP EDX,$80000000 + JNE @@hasIndex + MOV EDX,ECX { pass value in EDX } +@@hasIndex: + MOV EDI,[ESI].TPropInfo.SetProc + CMP [ESI].TPropInfo.SetProc.Byte[3],$FE + JA @@isField + JB @@isStaticMethod + +@@isVirtualMethod: + MOVSX EDI,DI + ADD EDI,[EAX] + CALL DWORD PTR [EDI] + JMP @@exit + +@@isStaticMethod: + CALL EDI + JMP @@exit + +@@isField: + AND EDI,$00FFFFFF + ADD EAX,EDI + MOV EDX,ECX + CALL AssignWideStr + +@@exit: + POP EDI + POP ESI +end; +{$ENDIF} + +type + TUnicodeStringPropertyFiler = class + private + FInstance: TPersistent; + FPropInfo: PPropInfo; + procedure ReadData(Reader: TReader); + procedure WriteData(Writer: TWriter); + public + procedure DefineProperties(Filer: TFiler; Instance: TPersistent; PropName: AnsiString); + end; + + TWideCharPropertyFiler = class + private + FInstance: TPersistent; + FPropInfo: PPropInfo; + FWriter: TWriter; + procedure GetLookupInfo(var Ancestor: TPersistent; + var Root, LookupRoot, RootAncestor: TComponent); + procedure ReadData(Reader: TReader); + procedure WriteData(Writer: TWriter); + function ReadChar(Reader: TReader): WideChar; + public + procedure DefineProperties(Filer: TFiler; Instance: TPersistent; PropName: AnsiString); + end; + +type + TGetLookupInfoEvent = procedure(var Ancestor: TPersistent; + var Root, LookupRoot, RootAncestor: TComponent) of object; + +function AncestorIsValid(Ancestor: TPersistent; Root, RootAncestor: TComponent): Boolean; +begin + Result := (Ancestor <> nil) and (RootAncestor <> nil) and + Root.InheritsFrom(RootAncestor.ClassType); +end; + +function IsDefaultOrdPropertyValue(Instance: TObject; PropInfo: PPropInfo; + OnGetLookupInfo: TGetLookupInfoEvent): Boolean; +var + Ancestor: TPersistent; + LookupRoot: TComponent; + RootAncestor: TComponent; + Root: TComponent; + AncestorValid: Boolean; + Value: Longint; + Default: LongInt; +begin + Ancestor := nil; + Root := nil; + LookupRoot := nil; + RootAncestor := nil; + + if Assigned(OnGetLookupInfo) then + OnGetLookupInfo(Ancestor, Root, LookupRoot, RootAncestor); + + AncestorValid := AncestorIsValid(Ancestor, Root, RootAncestor); + + Result := True; + if (PropInfo^.GetProc <> nil) and (PropInfo^.SetProc <> nil) then + begin + Value := GetOrdProp(Instance, PropInfo); + if AncestorValid then + Result := Value = GetOrdProp(Ancestor, PropInfo) + else + begin + Default := PPropInfo(PropInfo)^.Default; + Result := (Default <> LongInt($80000000)) and (Value = Default); + end; + end; +end; + +procedure ReadError(S: string); +begin + raise EReadError.Create(S); +end; + +procedure PropValueError; +begin + ReadError(SInvalidPropertyValue); +end; + +{ TUnicodeStringPropertyFiler } + +procedure TUnicodeStringPropertyFiler.DefineProperties(Filer: TFiler; Instance: TPersistent; + PropName: AnsiString); + + function HasData: Boolean; + var + CurrPropValue: UnicodeString; + begin + // must be stored + Result := IsStoredProp(Instance, FPropInfo); + if Result + and (Filer.Ancestor <> nil) + and (GetPropInfo(Filer.Ancestor, PropName, [tkWString]) <> nil) then + begin + // must be different than ancestor + CurrPropValue := GetWideStrProp(Instance, FPropInfo); + Result := CurrPropValue <> GetWideStrProp(Filer.Ancestor, GetPropInfo(Filer.Ancestor, PropName)); + end; + if Result then + Result := GetWideStrProp(Instance, FPropInfo) <> ''; + end; + +begin + FInstance := Instance; + FPropInfo := GetPropInfo(Instance, PropName, [tkWString]); + if FPropInfo <> nil then + // must be published (and of type UnicodeString) + Filer.DefineProperty(PropName + 'W', ReadData, WriteData, HasData); + FInstance := nil; + FPropInfo := nil; +end; + +procedure TUnicodeStringPropertyFiler.ReadData(Reader: TReader); +begin + case Reader.NextValue of + vaLString, vaString: + SetWideStrProp(FInstance, FPropInfo, Reader.ReadString); + else + SetWideStrProp(FInstance, FPropInfo, Reader.ReadWideString); + end; +end; + +procedure TUnicodeStringPropertyFiler.WriteData(Writer: TWriter); +begin + Writer.WriteWideString(GetWideStrProp(FInstance, FPropInfo)); +end; + +{ TWideCharPropertyFiler } + +procedure TWideCharPropertyFiler.GetLookupInfo(var Ancestor: TPersistent; + var Root, LookupRoot, RootAncestor: TComponent); +begin + Ancestor := FWriter.Ancestor; + Root := FWriter.Root; + LookupRoot := FWriter.LookupRoot; + RootAncestor := FWriter.RootAncestor; +end; + +function TWideCharPropertyFiler.ReadChar(Reader: TReader): WideChar; +var + Temp: UnicodeString; +begin + case Reader.NextValue of + vaWString: + Temp := Reader.ReadWideString; + vaString: + Temp := Reader.ReadString; + else + PropValueError; + end; + + if Length(Temp) > 1 then + PropValueError; + Result := Temp[1]; +end; + +procedure TWideCharPropertyFiler.ReadData(Reader: TReader); +begin + SetOrdProp(FInstance, FPropInfo, Ord(ReadChar(Reader))); +end; + +type + TAccessWriter = class(TWriter) + end; + +procedure TWideCharPropertyFiler.WriteData(Writer: TWriter); +var + L: Integer; + Temp: UnicodeString; +begin + Temp := WideChar(GetOrdProp(FInstance, FPropInfo)); + + TAccessWriter(Writer).WriteValue(vaWString); + L := Length(Temp); + Writer.Write(L, SizeOf(Integer)); + Writer.Write(Pointer(@Temp[1])^, L * 2); +end; + +procedure TWideCharPropertyFiler.DefineProperties(Filer: TFiler; + Instance: TPersistent; PropName: AnsiString); + + function HasData: Boolean; + var + CurrPropValue: Integer; + begin + // must be stored + Result := IsStoredProp(Instance, FPropInfo); + if Result and (Filer.Ancestor <> nil) and + (GetPropInfo(Filer.Ancestor, PropName, [tkWChar]) <> nil) then + begin + // must be different than ancestor + CurrPropValue := GetOrdProp(Instance, FPropInfo); + Result := CurrPropValue <> GetOrdProp(Filer.Ancestor, GetPropInfo(Filer.Ancestor, PropName)); + end; + + if Result and (Filer is TWriter) then + begin + FWriter := TWriter(Filer); + Result := not IsDefaultOrdPropertyValue(Instance, FPropInfo, GetLookupInfo); + end; + end; + +begin + FInstance := Instance; + FPropInfo := GetPropInfo(Instance, PropName, [tkWChar]); + if FPropInfo <> nil then // must be published (and of type WideChar) + begin + // W suffix causes Delphi's native streaming system to ignore the property + // and let us do the reading. + Filer.DefineProperty(PropName + 'W', ReadData, WriteData, HasData); + end; + FInstance := nil; + FPropInfo := nil; +end; + +procedure UnicodeDefineProperties(Filer: TFiler; Instance: TPersistent); +var + I, Count: Integer; + PropInfo: PPropInfo; + PropList: PPropList; + UnicodeStringFiler: TUnicodeStringPropertyFiler; + WideCharFiler: TWideCharPropertyFiler; +begin + Count := GetTypeData(Instance.ClassInfo)^.PropCount; + if Count > 0 then + begin + UnicodeStringFiler := TUnicodeStringPropertyFiler.Create; + try + WideCharFiler := TWideCharPropertyFiler.Create; + try + GetMem(PropList, Count * SizeOf(Pointer)); + try + GetPropInfos(Instance.ClassInfo, PropList); + for I := 0 to Count - 1 do + begin + PropInfo := PropList^[I]; + if (PropInfo = nil) then + Break; + if (PropInfo.PropType^.Kind = tkWString) then + UnicodeStringFiler.DefineProperties(Filer, Instance, PropInfo.Name) + else if (PropInfo.PropType^.Kind = tkWChar) then + WideCharFiler.DefineProperties(Filer, Instance, PropInfo.Name) + end; + finally + FreeMem(PropList, Count * SizeOf(Pointer)); + end; + finally + WideCharFiler.Free; + end; + finally + UnicodeStringFiler.Free; + end; + end; +end; +{$ENDIF} + +{$IFDEF MSWINDOWS} +function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; +var + UsedDefaultChar: BOOL; +begin + WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(@WC), 1, nil, 0, nil, + @UsedDefaultChar); + Result := not UsedDefaultChar; +end; + +function IsUnicodeStringMappableToAnsi(const WS: UnicodeString): Boolean; +var + UsedDefaultChar: BOOL; +begin + WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(WS), Length(WS), nil, 0, + nil, @UsedDefaultChar); Result := not UsedDefaultChar; end; +{$ENDIF} initialization - Assert(Win32Platform = VER_PLATFORM_WIN32_NT, 'Unsupported Windows version'); +{$IFDEF MSWINDOWS} + Win32PlatformIsUnicode := (Win32Platform = VER_PLATFORM_WIN32_NT); + {$IFNDEF UNICODE} + DefaultSystemCodePage := GetACP; + {$ENDIF} +{$ENDIF} end. diff --git a/Source/VCL/SynEdit/Source/SynUsp10.pas b/Source/VCL/SynEdit/Source/SynUsp10.pas index 4cc72a57..0c5f4435 100644 --- a/Source/VCL/SynEdit/Source/SynUsp10.pas +++ b/Source/VCL/SynEdit/Source/SynUsp10.pas @@ -42,6 +42,10 @@ // $Id: SynUsp10.pas,v 1.1.2.2 2008/09/17 13:59:12 maelh Exp $ +{$IFDEF FPC} +{$mode objfpc} +{$ENDIF} + // necessary for dynamic linking {$STACKFRAMES ON} {$WARNINGS OFF} @@ -50,8 +54,6 @@ interface -{$IFDEF CPUX86} - uses Windows; @@ -84,13 +86,10 @@ interface - - - - ///// USP Status Codes // - USP_E_SCRIPT_NOT_IN_FONT = DWord((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16)) or $200; // MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200) // Script doesn't exist in font + USP_E_SCRIPT_NOT_IN_FONT = DWord((SEVERITY_ERROR shl 31) or + (FACILITY_ITF shl 16)) or $200; // MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200) // Script doesn't exist in font @@ -139,8 +138,6 @@ interface - - ///// ScriptFreeCache // // The client may free a SCRIPT_CACHE at any time. Uniscribe maintains @@ -160,10 +157,6 @@ function ScriptFreeCache( ): HRESULT; stdcall; - - - - type ///// SCRIPT_CONTROL // @@ -172,23 +165,23 @@ function ScriptFreeCache( // // - TScriptControl_enum = ( - fContextDigits, // Means use previous script instead of uDefaultLanguage + TScriptControlFlag = ( + scContextDigits, // Means use previous script instead of uDefaultLanguage // The following flags provide legacy support for GetCharacterPlacement features - fInvertPreBoundDir, // Reading order of virtual item immediately prior to string - fInvertPostBoundDir, // Reading order of virtual item immediately following string - fLinkStringBefore, // Equivalent to presence of ZWJ before string - fLinkStringAfter, // Equivalent to presence of ZWJ after string - fNeutralOverride, // Causes all neutrals to be strong in the current embedding direction - fNumericOverride, // Causes all numerals to be strong in the current embedding direction - fLegacyBidiClass // Causes plus and minus to be reated as neutrals, slash as a common separator + scInvertPreBoundDir, // Reading order of virtual item immediately prior to string + scInvertPostBoundDir, // Reading order of virtual item immediately following string + scLinkStringBefore, // Equivalent to presence of ZWJ before string + scLinkStringAfter, // Equivalent to presence of ZWJ after string + scNeutralOverride, // Causes all neutrals to be strong in the current embedding direction + scNumericOverride, // Causes all numerals to be strong in the current embedding direction + scLegacyBidiClass // Causes plus and minus to be reated as neutrals, slash as a common separator ); - TScriptControl_set = set of TScriptControl_enum; + TScriptControlFlags = set of TScriptControlFlag; PScriptControl = ^TScriptControl; tag_SCRIPT_CONTROL = packed record uDefaultLanguage: Word; // For NADS, also default for context - fFlags: TScriptControl_set; + fFlags: TScriptControlFlags; fReserved: Byte; end; (* uDefaultLanguage: DWORD {:16}; // For NADS, also default for context @@ -213,36 +206,36 @@ function ScriptFreeCache( // //p uDefaultLanguage: Language to use when Unicode values are ambiguous. // Used by numeric processing to select digit shape when -// fDigitSubstitute (see SCRIPT_STATE) is in force. +// ssDigitSubstitute (see SCRIPT_STATE) is in force. // -//p fContextDigits: Specifies that national digits are chosen according to +//p scContextDigits: Specifies that national digits are chosen according to // the nearest previous strong text, rather than using // uDefaultLanguage. // -//p fInvertPreBoundDir: By default text at the start of the string is +//p scInvertPreBoundDir: By default text at the start of the string is // laid out as if it follows strong text of the same direction -// as the base embedding level. Set fInvertPreBoundDir to change +// as the base embedding level. Set scInvertPreBoundDir to change // the initial context to the opposite of the base embedding // level. This flag is for GetCharacterPlacement legacy support. // -//p fInvertPostBoundDir: By default text at the end of the string is +//p scInvertPostBoundDir: By default text at the end of the string is // laid out as if it preceeds strong text of the same direction -// as the base embedding level. Set fInvertPostBoundDir to change +// as the base embedding level. Set scInvertPostBoundDir to change // the final context to the opposite of the base embedding // level. This flag is for GetCharacterPlacement legacy support. // -//p fLinkStringBefore: Causes the first character of the string to be +//p scLinkStringBefore: Causes the first character of the string to be // shaped as if were joined to a previous character. // -//p fLinkStringAfter: Causes the last character of the string to be +//p scLinkStringAfter: Causes the last character of the string to be // shaped as if were joined to a following character. // -//p fNeutralOverride: Causes all neutral characters in the string to be +//p scNeutralOverride: Causes all neutral characters in the string to be // treated as if they were strong characters of their enclosing // embedding level. This effectively locks neutrals in place, // reordering occuring only between neutrals. // -//p fNumericOverride: Causes all numeric characters in the string to be +//p scNumericOverride: Causes all numeric characters in the string to be // treated as if they were strong characters of their enclosing // embedding level. This effectively locks numerics in place, // reordering occuring only between numerics. @@ -251,9 +244,6 @@ function ScriptFreeCache( - - - ///// SCRIPT_STATE // // The SCRIPT_STATE structure is used both to initialise the unicode @@ -261,24 +251,24 @@ function ScriptFreeCache( // a component of each item analysis returned by ScriptItemize. // // - TScriptState_enum = ( + TScriptStateFlag = ( uBidiLevel_reserved1, uBidiLevel_r2, uBidiLevel_r3, uBidiLevel_r4, uBidiLevel_r5, - fOverrideDirection, // Set when in LRO/RLO embedding - fInhibitSymSwap, // Set by U+206A (ISS), cleared by U+206B (ASS) - fCharShape, // Set by U+206D (AAFS), cleared by U+206C (IAFS) - fDigitSubstitute, // Set by U+206E (NADS), cleared by U+206F (NODS) - fInhibitLigate, // Equiv !GCP_Ligate, no Unicode control chars yet - fDisplayZWG, // Equiv GCP_DisplayZWG, no Unicode control characters yet - fArabicNumContext, // For EN->AN Unicode rule - fGcpClusters // For Generating Backward Compatible GCP Clusters (legacy Apps) + ssOverrideDirection, // Set when in LRO/RLO embedding + ssInhibitSymSwap, // Set by U+206A (ISS), cleared by U+206B (ASS) + ssCharShape, // Set by U+206D (AAFS), cleared by U+206C (IAFS) + ssDigitSubstitute, // Set by U+206E (NADS), cleared by U+206F (NODS) + ssInhibitLigate, // Equiv !GCP_Ligate, no Unicode control chars yet + ssDisplayZWG, // Equiv GCP_DisplayZWG, no Unicode control characters yet + ssArabicNumContext, // For EN->AN Unicode rule + ssGcpClusters // For Generating Backward Compatible GCP Clusters (legacy Apps) ); - TScriptState_set = set of TScriptState_enum; + TScriptStateFlags = set of TScriptStateFlag; PScriptState = ^TScriptState; tag_SCRIPT_STATE = packed record case Byte of 0: (uBidiLevel: Byte) {:5}; // Unicode Bidi algorithm embedding level (0-16) - 1: (fFlags: TScriptState_set) + 1: (fFlags: TScriptStateFlags) end; (* uBidiLevel: Word {:5}; // Unicode Bidi algorithm embedding level (0-16) fOverrideDirection: Word {:1}; // Set when in LRO/RLO embedding @@ -288,7 +278,7 @@ function ScriptFreeCache( fInhibitLigate: Word {:1}; // Equiv !GCP_Ligate, no Unicode control chars yet fDisplayZWG: Word {:1}; // Equiv GCP_DisplayZWG, no Unicode control characters yet fArabicNumContext: Word {:1}; // For EN->AN Unicode rule - fGcpClusters: Word {:1}; // For Generating Backward Compatible GCP Clusters (legacy Apps) + fcpClusters: Word {:1}; // For Generating Backward Compatible GCP Clusters (legacy Apps) fReserved: Word {:1}; fEngineReserved: Word {:2}; // For use by shaping engine end; *) @@ -308,38 +298,38 @@ function ScriptFreeCache( // ScriptItemize, should be initialised to 0 for an LTR base // embedding level, or 1 for RTL. // -//p fOverrideDirection: TRUE if this level is an override level (LRO/RLO). +//p ssOverrideDirection: TRUE if this level is an override level (LRO/RLO). // In an override level, characters are layed out purely // left to right, or purely right to left. No reordering of digits // or strong characters of opposing direction takes place. // Note that this initial value is reset by LRE, RLE, LRO or // RLO codes in the string. // -//p fInhibitSymSwap: TRUE if the shaping engine is to bypass mirroring of +//p ssInhibitSymSwap: TRUE if the shaping engine is to bypass mirroring of // Unicode Mirrored glyphs such as brackets. Set by Unicode // character ISS, cleared by ASS. // -//p fCharShape: TRUE if character codes in the Arabic Presentation Forms +//p ssCharShape: TRUE if character codes in the Arabic Presentation Forms // areas of Unicode should be shaped. (Not implemented). // -//p fDigitSubstitute: TRUE if character codes U+0030 through U+0039 +//p ssDigitSubstitute: TRUE if character codes U+0030 through U+0039 // (European digits) are to be substituted by national digits. // Set by Unicode NADS, Cleared by NODS. // -//p fInhibitLigate: TRUE if ligatures are not to be used in the shaping +//p ssInhibitLigate: TRUE if ligatures are not to be used in the shaping // of Arabic or Hebrew characters. // -//p fDisplayZWG: TRUE if control characters are to be shaped as +//p ssDisplayZWG: TRUE if control characters are to be shaped as // representational glyphs. (Normally, control characters are // shaped to the blank glyph and given a width of zero). // -//p fArabicNumContext: TRUE indicates prior strong characters were Arabic +//p ssArabicNumContext: TRUE indicates prior strong characters were Arabic // for the purposes of rule P0 on page 3-19 of 'The Unicode // Standard, version 2.0'. Should normally be set TRUE before // itemizing an RTL paragraph in an Arabic language, FALSE // otherwise. // -//p fGcpClusters: For GetCharaterPlacement legacy support only. +//p ssGcpClusters: For GetCharaterPlacement legacy support only. // Initialise to TRUE to request ScriptShape to generate // the LogClust array the same way as GetCharacterPlacement // does in Arabic and Hebrew Windows95. Affects only Arabic @@ -463,9 +453,6 @@ tag_SCRIPT_ITEM = record - - - ///// ScriptItemize - break text into items // // Breaks a run of unicode into individually shapeable items. @@ -495,9 +482,6 @@ function ScriptItemize( - - - ///// // // @@ -531,14 +515,14 @@ function ScriptItemize( // European digits U+0030 through U+0039 may be rendered as national // digits as follows: // -//t fDigitSubstitute | FContextDigits | Digit shapes displayed for Unicode U+0030 through U+0039 +//t ssDigitSubstitute | scContextDigits | Digit shapes displayed for Unicode U+0030 through U+0039 //t ---------------- | -------------- | ------------------------------------ //t False | Any | Western (European / American) digits //t True | False | As specified in SCRIPT_CONTROL.uDefaultLanguage //t True | True | As prior strong text, defaulting to SCRIPT_CONTROL.uDefaultLanguage // // -// For fContextDigits, any Western digits (U+0030 - U+0039) encountered +// For scContextDigits, any Western digits (U+0030 - U+0039) encountered // before the first strongly directed character are substituted by the // traditional digits of the SCRIPT_CONTROL.uDefaultLanguage when that // language is written in the same direction as SCRIPT_STATE.uBidiLevel. @@ -574,11 +558,11 @@ function ScriptItemize( // //t SCRIPT_STATE flag | Set by | Cleared by //t ----------------- | ------ ---------- -//t fDigitSubstitute | NADS | NODS -//t fInhibitSymSwap | ISS | ASS -//t fCharShape | AAFS | IAFS +//t ssDigitSubstitute | NADS | NODS +//t ssInhibitSymSwap | ISS | ASS +//t ssCharShape | AAFS | IAFS // -// SCRIPT_STATE.fArabicNumContext controls the Unicode EN->AN rule. +// SCRIPT_STATE.ssArabicNumContext controls the Unicode EN->AN rule. // It should normally be initialised to TRUE // before itemizing an RTL paragraph in an Arabic language, FALSE // otherwise. @@ -822,8 +806,8 @@ function ScriptShape( type PGOffset = ^TGOffset; tagGOFFSET = record - du: Integer; - dv: Integer; + du: Longint; + dv: Longint; end; GOFFSET = tagGOFFSET; {$EXTERNALSYM GOFFSET} @@ -1647,7 +1631,7 @@ function ScriptGetFontProperties( function ScriptCacheGetHeight( hdc: HDC; // In Optional (see notes on caching) psc: PScriptCache; // InOut Address of Cache handle - tmHeight: PInteger // Out Receives font height in pixels + tmHeight: PLongint // Out Receives font height in pixels ): HRESULT; stdcall; @@ -2159,10 +2143,10 @@ function ScriptApplyDigitSubstitution( // If NULL, ScriptApplyDigitSubstitution calls // ScriptRecordDigitSubstitution with LOCALE_USER_DEFAULT. // -//p psc: SCRIPT_CONTROL structure. The fContextDigits and uDefaultLanguage +//p psc: SCRIPT_CONTROL structure. The scContextDigits and uDefaultLanguage // fields will be updated. // -//p pss: SCRIPT_CONTROL structure. The fDigitSubstitute field will be +//p pss: SCRIPT_CONTROL structure. The ssDigitSubstitute field will be // updated. // //p returns: E_INVALIDARG if the DigitSubstitute field of the @@ -2171,12 +2155,8 @@ function ScriptApplyDigitSubstitution( var Usp10IsInstalled: Boolean; -{$ENDIF} - implementation -{$IFDEF CPUX86} - uses SysUtils; @@ -2648,6 +2628,4 @@ initialization finalization if Usp10DllModule <> 0 then FreeLibrary(Usp10DllModule); -{$ENDIF} - end. diff --git a/Source/VCL/SynEdit/SynGen/GenLex.pas b/Source/VCL/SynEdit/SynGen/GenLex.pas index 3a466aa8..d27bbb19 100644 --- a/Source/VCL/SynEdit/SynGen/GenLex.pas +++ b/Source/VCL/SynEdit/SynGen/GenLex.pas @@ -88,7 +88,7 @@ TGenLex = class(TObject) FTokenPositionsList: TLongIntList; fIdentFuncTable: array[0..150] of function: TIdTokenKind of object; function KeyHash(ToHash: PWideChar): Integer; - function KeyComp(aKey: string): Boolean; + function KeyComp(aKey: UnicodeString): Boolean; function Func49: TIdTokenKind; function Func60: TIdTokenKind; function Func67: TIdTokenKind; @@ -123,7 +123,7 @@ TGenLex = class(TObject) procedure SetRunPos(Value: Integer); procedure MakeMethodTables; function GetRunId: TIdTokenKind; - function GetRunToken: string; + function GetRunToken: UnicodeString; protected public constructor Create; @@ -133,10 +133,11 @@ TGenLex = class(TObject) property IgnoreComments: Boolean read fIgnoreComments write fIgnoreComments; property Origin: PWideChar read fOrigin write SetOrigin; property RunPos: Integer read Run write SetRunPos; - function NextToken: string; + function NextToken: UnicodeString; function EOF: Boolean; property RunId: TIdTokenKind read GetRunId; - property RunToken: string read GetRunToken; + property RunToken: UnicodeString read GetRunToken; + published end; implementation @@ -194,7 +195,7 @@ function TGenLex.KeyHash(ToHash: PWideChar): Integer; fStringLen := ToHash - fToIdent; end; { KeyHash } -function TGenLex.KeyComp(aKey: string): Boolean; +function TGenLex.KeyComp(aKey: UnicodeString): Boolean; var I: Integer; Temp: PWideChar; @@ -570,7 +571,7 @@ function TGenLex.GetRunId: TIdTokenKind; Result := fFuncTable[Char(fOrigin[Running])]; end; -function TGenLex.GetRunToken: string; +function TGenLex.GetRunToken: UnicodeString; var StartPos, EndPos, StringLen: Integer; begin @@ -595,7 +596,7 @@ procedure TGenLex.Next; Inc(Run); end; -function TGenLex.NextToken: string; +function TGenLex.NextToken: UnicodeString; var StartPos, EndPos, Len: LongInt; begin diff --git a/Source/VCL/SynEdit/SynGen/HashTableGen.pas b/Source/VCL/SynEdit/SynGen/HashTableGen.pas index eaf84d9a..11d0e4e5 100644 --- a/Source/VCL/SynEdit/SynGen/HashTableGen.pas +++ b/Source/VCL/SynEdit/SynGen/HashTableGen.pas @@ -29,6 +29,7 @@ TFrmHashTableGen = class(TForm) procedure FormClose(Sender: TObject; var Action: TCloseAction); private FKeyList: TList; + FCaseSensitive: Boolean; public procedure AssignKeyWords(KeyList: TList; CaseSensitive: Boolean); function GetHashKeyFunctionSource(ClassName: string): string; @@ -57,21 +58,23 @@ implementation {$R *.dfm} uses +{$IFDEF SYN_COMPILER_6_UP} StrUtils, +{$ENDIF} SynGenUnit, SynUnicode; {$I primenumbers.inc} var - m: Cardinal; + c, d, m: Cardinal; FinalC, FinalD, FinalM: Cardinal; searching: Boolean; - KeyWords: array of string; + KeyWords: array of UnicodeString; HashKeyList: THashKeyList; {$Q-} -function HashKey(const S: string; c, d: Cardinal): Cardinal; +function HashKey(const S: UnicodeString): Cardinal; var i: Integer; begin @@ -83,7 +86,7 @@ function HashKey(const S: string; c, d: Cardinal): Cardinal; {$Q+} {$Q-} -function FinalHashKey(const S: string): Cardinal; +function FinalHashKey(const S: UnicodeString): Cardinal; var i: Integer; begin @@ -140,6 +143,7 @@ procedure TFrmHashTableGen.AssignKeyWords(KeyList: TList; CaseSensitive: Boolean KeyWordsList: TStringList; begin FKeyList := nil; + FCaseSensitive := CaseSensitive; SetLength(KeyWords, 0); HashKeyList.Clear; @@ -156,7 +160,7 @@ procedure TFrmHashTableGen.AssignKeyWords(KeyList: TList; CaseSensitive: Boolean KeyWords[i] := KeyWordsList[i] else for i := 0 to KeyWordsList.Count - 1 do - KeyWords[i] := SysUtils.AnsiLowerCase(KeyWordsList[i]); + KeyWords[i] := SynWideLowerCase(KeyWordsList[i]); FKeyList := KeyList; finally @@ -166,6 +170,8 @@ procedure TFrmHashTableGen.AssignKeyWords(KeyList: TList; CaseSensitive: Boolean procedure TFrmHashTableGen.FormShow(Sender: TObject); begin + c := 0; + d := 0; m := 0; FinalC := 0; FinalD := 0; @@ -189,14 +195,17 @@ procedure TFrmHashTableGen.FormClose(Sender: TObject; for i := 0 to FKeyList.Count - 1 do with TLexKeys(FKeyList[i]) do begin - Key := FinalHashKey(SysUtils.AnsiLowerCase(KeyName)); + if FCaseSensitive then + key := FinalHashKey(KeyName) + else + Key := FinalHashKey(SynWideLowerCase(KeyName)); end; end; end; procedure TFrmHashTableGen.ButtonFindHashClick(Sender: TObject); var - i, j, c, d: Integer; + i, j: Integer; collided: Boolean; Key, smallestM: Cardinal; @@ -244,7 +253,7 @@ procedure TFrmHashTableGen.ButtonFindHashClick(Sender: TObject); end; for i := Low(KeyWords) to High(KeyWords) do begin - Key := HashKey(KeyWords[i], c, d); + Key := HashKey(KeyWords[i]); collided := HashKeyList.Add(Key); if collided then begin @@ -337,7 +346,7 @@ function TFrmHashTableGen.GetKeyWordConstantsSource(CaseSensitive: Boolean): str // write KeyWords if not CaseSensitive then Result := Result + ' // as this language is case-insensitive keywords *must* be in lowercase'#13#10; - Result := Result + Format(' KeyWords: array[0..%d] of string = (', [High(KeyWords)]) + #13#10; + Result := Result + Format(' KeyWords: array[0..%d] of UnicodeString = (', [High(KeyWords)]) + #13#10; sl := TStringList.Create; try for i := Low(KeyWords) to High(KeyWords) do diff --git a/Source/VCL/SynEdit/SynGen/LongIntList.pas b/Source/VCL/SynEdit/SynGen/LongIntList.pas index 2f846c69..dfa806b7 100644 --- a/Source/VCL/SynEdit/SynGen/LongIntList.pas +++ b/Source/VCL/SynEdit/SynGen/LongIntList.pas @@ -43,9 +43,6 @@ interface StdCtrls, ExtCtrls; -const - MaxListSize = MaxInt div 16; - type PLongIntArray = ^TLongIntArray; TLongIntArray = array[0..MaxListSize] of LongInt; diff --git a/Source/VCL/SynEdit/SynGen/SynGen.dpr b/Source/VCL/SynEdit/SynGen/SynGen.dpr index 4926b3a3..0690128e 100644 --- a/Source/VCL/SynEdit/SynGen/SynGen.dpr +++ b/Source/VCL/SynEdit/SynGen/SynGen.dpr @@ -41,7 +41,7 @@ program SynGen; uses Forms, - SynGenUnit in 'SynGenUnit.pas' {FrmMain}, + SynGenUnit in 'SynGenUnit.pas' {FormMain}, GenLex in 'GenLex.pas', HashTableGen in 'HashTableGen.pas' {FrmHashTableGen}; @@ -50,7 +50,7 @@ uses begin Application.Initialize; Application.Title := 'SynGen'; - Application.CreateForm(TFrmMain, FrmMain); + Application.CreateForm(TFormMain, FormMain); Application.CreateForm(TFrmHashTableGen, FrmHashTableGen); Application.Run; end. diff --git a/Source/VCL/SynEdit/SynGen/SynGenUnit.dfm b/Source/VCL/SynEdit/SynGen/SynGenUnit.dfm index 3cd6cdde..5be357cd 100644 --- a/Source/VCL/SynEdit/SynGen/SynGenUnit.dfm +++ b/Source/VCL/SynEdit/SynGen/SynGenUnit.dfm @@ -1,7 +1,7 @@ -object FrmMain: TFrmMain +object FormMain: TFormMain Left = 379 Top = 238 - ActiveControl = BtnStart + ActiveControl = ButtonStart BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'SynGen' @@ -30,21 +30,21 @@ object FrmMain: TFrmMain TabWidth = 80 object TabHighlighter: TTabSheet Caption = 'Highlighter' - object LblAuthor: TLabel + object LabelAuthor: TLabel Left = 8 Top = 20 Width = 34 Height = 13 Caption = 'Author:' end - object LblDescription: TLabel + object LabelDescription: TLabel Left = 8 Top = 52 Width = 56 Height = 13 Caption = 'Description:' end - object LblVersion: TLabel + object LabelVersion: TLabel Left = 8 Top = 84 Width = 38 @@ -72,7 +72,7 @@ object FrmMain: TFrmMain Height = 21 TabOrder = 2 end - object ChkGetKeyWords: TCheckBox + object CheckBoxGetKeyWords: TCheckBox Left = 8 Top = 188 Width = 249 @@ -82,7 +82,7 @@ object FrmMain: TFrmMain State = cbChecked TabOrder = 4 end - object ChkGPLHeader: TCheckBox + object CheckBoxGPLHeader: TCheckBox Left = 8 Top = 168 Width = 249 @@ -95,29 +95,28 @@ object FrmMain: TFrmMain end object TabLanguage: TTabSheet Caption = 'Language' - object LblFilter: TLabel + object LabelFilter: TLabel Left = 8 Top = 20 Width = 59 Height = 13 Caption = 'Default filter:' end - object LblLangName: TLabel + object LabelLangName: TLabel Left = 8 Top = 52 Width = 80 Height = 13 Caption = 'Language name:' end - object CboFilter: TComboBox + object ComboBoxFilter: TComboBox Left = 96 Top = 16 Width = 241 Height = 21 - ItemHeight = 13 TabOrder = 0 Text = 'All files (*.*)|*.*' - OnChange = CboLangNameChange + OnChange = ComboBoxLangNameChange Items.Strings = ( 'Pascal files (*.pas,*.dpr,*.dpk,*.inc)|*.pas;*.dpr;*.dpk;*.inc' 'HP48 files (*.s,*.sou,*.a,*.hp)|*.s;*.sou;*.a;*.hp' @@ -154,14 +153,13 @@ object FrmMain: TFrmMain 'Fortran Files (*.for)|*.for' '68HC11 Assembler files (*.hc11,*.asm,*.asc)|*.hc11;*.asm;*.asc') end - object CboLangName: TComboBox + object ComboBoxLangName: TComboBox Left = 96 Top = 48 Width = 241 Height = 21 - ItemHeight = 13 TabOrder = 1 - OnChange = CboLangNameChange + OnChange = ComboBoxLangNameChange Items.Strings = ( 'HP48' 'CA-Clipper' @@ -200,7 +198,7 @@ object FrmMain: TFrmMain end object TabAttributes: TTabSheet Caption = 'Attributes' - object LblUnknownTokenAttr: TLabel + object LabelUnknownTokenAttr: TLabel Left = 8 Top = 120 Width = 164 @@ -214,46 +212,43 @@ object FrmMain: TFrmMain Height = 96 Caption = 'Attribute names' TabOrder = 0 - object LblIdentifier: TLabel + object LabelIdentifier: TLabel Left = 16 Top = 32 Width = 43 Height = 13 Caption = 'Identifier:' end - object LblReservedWord: TLabel + object LabelReservedWord: TLabel Left = 16 Top = 64 Width = 75 Height = 13 Caption = 'Reserved word:' end - object CboAttrIdentifier: TComboBox + object ComboBoxAttrIdentifier: TComboBox Left = 104 Top = 28 Width = 209 Height = 21 Style = csDropDownList - ItemHeight = 13 TabOrder = 0 end - object CboAttrReservedWord: TComboBox + object ComboBoxAttrReservedWord: TComboBox Left = 104 Top = 60 Width = 209 Height = 21 Style = csDropDownList - ItemHeight = 13 TabOrder = 1 end end - object CboUnknownTokenAttr: TComboBox + object ComboBoxUnknownTokenAttr: TComboBox Left = 184 Top = 116 Width = 153 Height = 21 Style = csDropDownList - ItemHeight = 13 TabOrder = 1 Items.Strings = ( 'Identifier' @@ -273,7 +268,7 @@ object FrmMain: TFrmMain TabOrder = 3 OnClick = ListBoxFieldsClick end - object BtnAdd: TButton + object ButtonAdd: TButton Left = 264 Top = 8 Width = 73 @@ -281,9 +276,9 @@ object FrmMain: TFrmMain Caption = 'Add' Enabled = False TabOrder = 0 - OnClick = BtnAddClick + OnClick = ButtonAddClick end - object BtnDelete: TButton + object ButtonDelete: TButton Left = 264 Top = 40 Width = 73 @@ -291,7 +286,7 @@ object FrmMain: TFrmMain Caption = 'Delete' Enabled = False TabOrder = 1 - OnClick = BtnDeleteClick + OnClick = ButtonDeleteClick end object EditAddField: TEdit Left = 8 @@ -304,7 +299,7 @@ object FrmMain: TFrmMain end end end - object BtnStart: TButton + object ButtonStart: TButton Left = 288 Top = 257 Width = 75 @@ -312,7 +307,7 @@ object FrmMain: TFrmMain Caption = 'Start!' Default = True TabOrder = 0 - OnClick = BtnStartClick + OnClick = ButtonStartClick end object OpenDialog: TOpenDialog Filter = 'Grammar file (*.msg)|*.msg' @@ -322,22 +317,22 @@ object FrmMain: TFrmMain object MainMenu: TMainMenu Left = 288 Top = 184 - object MnuFile: TMenuItem + object MenuItemFile: TMenuItem Caption = '&File' - object MnuOpen: TMenuItem + object MenuItemOpen: TMenuItem Caption = '&Open...' ShortCut = 16463 - OnClick = MnuOpenClick + OnClick = MenuItemOpenClick end - object MnuExit: TMenuItem + object MenuItemExit: TMenuItem Caption = 'E&xit' ShortCut = 32883 - OnClick = MnuExitClick + OnClick = MenuItemExitClick end end - object MnuStart: TMenuItem + object MenuItemStart: TMenuItem Caption = '&Start!' - OnClick = BtnStartClick + OnClick = ButtonStartClick end end end diff --git a/Source/VCL/SynEdit/SynGen/SynGenUnit.pas b/Source/VCL/SynEdit/SynGen/SynGenUnit.pas index bdfdffdc..ced7069d 100644 --- a/Source/VCL/SynEdit/SynGen/SynGenUnit.pas +++ b/Source/VCL/SynEdit/SynGen/SynGenUnit.pas @@ -97,70 +97,70 @@ TLexDefaultAttri = class constructor Create; end; - TFrmMain = class(TForm) - BtnStart: TButton; + TFormMain = class(TForm) + ButtonAdd: TButton; + ButtonDelete: TButton; + ButtonStart: TButton; + ComboBoxAttrIdentifier: TComboBox; + ComboBoxAttrReservedWord: TComboBox; + ComboBoxFilter: TComboBox; + ComboBoxLangName: TComboBox; + ComboBoxUnknownTokenAttr: TComboBox; + CheckBoxGetKeyWords: TCheckBox; + CheckBoxGPLHeader: TCheckBox; + EditAddField: TEdit; + EditAuthor: TEdit; + EditDescription: TEdit; + EditVersion: TEdit; + GrpAttrNames: TGroupBox; + LabelAuthor: TLabel; + LabelDescription: TLabel; + LabelFilter: TLabel; + LabelIdentifier: TLabel; + LabelLangName: TLabel; + LabelReservedWord: TLabel; + LabelUnknownTokenAttr: TLabel; + LabelVersion: TLabel; + ListBoxFields: TListBox; + MainMenu: TMainMenu; + MenuItemExit: TMenuItem; + MenuItemFile: TMenuItem; + MenuItemOpen: TMenuItem; + MenuItemStart: TMenuItem; OpenDialog: TOpenDialog; PageControl: TPageControl; - TabLanguage: TTabSheet; - LblFilter: TLabel; - CboFilter: TComboBox; - LblLangName: TLabel; - CboLangName: TComboBox; TabAttributes: TTabSheet; - GrpAttrNames: TGroupBox; - LblIdentifier: TLabel; - LblReservedWord: TLabel; - CboAttrIdentifier: TComboBox; - CboAttrReservedWord: TComboBox; - LblUnknownTokenAttr: TLabel; - CboUnknownTokenAttr: TComboBox; TabFields: TTabSheet; - BtnAdd: TButton; - BtnDelete: TButton; - EditAddField: TEdit; - ListBoxFields: TListBox; - MainMenu: TMainMenu; - MnuFile: TMenuItem; - MnuOpen: TMenuItem; - MnuExit: TMenuItem; TabHighlighter: TTabSheet; - LblAuthor: TLabel; - LblDescription: TLabel; - LblVersion: TLabel; - EditAuthor: TEdit; - EditDescription: TEdit; - EditVersion: TEdit; - MnuStart: TMenuItem; - ChkGetKeyWords: TCheckBox; - ChkGPLHeader: TCheckBox; - procedure BtnStartClick(Sender: TObject); + TabLanguage: TTabSheet; + procedure ButtonStartClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); - procedure CboLangNameChange(Sender: TObject); + procedure ComboBoxLangNameChange(Sender: TObject); procedure ListBoxFieldsClick(Sender: TObject); - procedure BtnAddClick(Sender: TObject); - procedure BtnDeleteClick(Sender: TObject); + procedure ButtonAddClick(Sender: TObject); + procedure ButtonDeleteClick(Sender: TObject); procedure EditAddFieldChange(Sender: TObject); procedure EditAddFieldKeyPress(Sender: TObject; var Key: Char); - procedure MnuExitClick(Sender: TObject); - procedure MnuOpenClick(Sender: TObject); + procedure MenuItemExitClick(Sender: TObject); + procedure MenuItemOpenClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private - LexName: string; - IdentPre: string; - IdentStart: string; - IdentContent: string; + FLexName: string; + FIdentPre: string; + FIdentStart: string; + FIdentContent: string; FFileName: string; - IniFile: string; - OutFile: TextFile; - Sensitivity: Boolean; - LexFileContents: string; - Lex: TGenLex; - KeyList: TList; - SetList: TList; - EnclosedList: TList; - SampleSourceList: TStringList; - IdentList: TStringList; + FIniFile: string; + FOutFile: TextFile; + FSensitivity: Boolean; + FLexFileContents: UnicodeString; + FLex: TGenLex; + FKeyList: TList; + FSetList: TList; + FEnclosedList: TList; + FSampleSourceList: TStringList; + FIdentList: TStringList; procedure ClearAll; function GetFilterName: string; function GetLangName: string; @@ -185,14 +185,17 @@ TFrmMain = class(TForm) end; var - FrmMain: TFrmMain; + FormMain: TFormMain; implementation -{$R *.dfm} +{$R *.DFM} uses - UITypes, StrUtils, Registry, HashTableGen; +{$IFDEF SYN_COMPILER_6_UP} + StrUtils, +{$ENDIF} + Registry, HashTableGen; const BoolStrs: array[Boolean] of string = ('False', 'True'); // Do not localize @@ -221,7 +224,7 @@ function AddInt(const aValue: Integer): string; Result := ''; end; -function StuffString(const Value: string): string; +function StuffString(const Value: UnicodeString): UnicodeString; var i: Integer; begin @@ -235,11 +238,11 @@ function StuffString(const Value: string): string; end; end; -function FirstLetterCap(S: string): string; +function FirstLetterCap(S: UnicodeString): UnicodeString; begin - Result := SysUtils.AnsiLowerCase(S); + Result := SynWideLowerCase(S); if Length(Result) > 0 then - Result[1] := SysUtils.AnsiUpperCase(S[1])[1]; + Result[1] := SynWideUpperCase(S[1])[1]; end; {$IFNDEF SYN_COMPILER_6_UP} @@ -249,7 +252,7 @@ function AnsiReplaceStr(const AText, AFromText, AToText: string): string; end; {$ENDIF} -function ToAlphaNum(S: string): string; +function ToAlphaNum(S: UnicodeString): UnicodeString; var c: Char; begin @@ -268,7 +271,7 @@ function ToAlphaNum(S: string): string; Result := S; end; -function IsASCIIAlphaNum(S: string): Boolean; +function IsASCIIAlphaNum(S: UnicodeString): Boolean; var i: Integer; begin @@ -305,7 +308,7 @@ constructor TLexDefaultAttri.Create; Background := ''; end; -procedure TFrmMain.MakeSensitiveHashTable; +procedure TFormMain.MakeSensitiveHashTable; var I: Char; begin @@ -325,7 +328,7 @@ procedure TFrmMain.MakeSensitiveHashTable; end; end; -procedure TFrmMain.MakeHashTable; +procedure TFormMain.MakeHashTable; var I, J: Char; begin @@ -340,31 +343,35 @@ procedure TFrmMain.MakeHashTable; end; end; -procedure TFrmMain.WriteSettings; +procedure TFormMain.WriteSettings; begin - with TRegIniFile.Create(IniFile) do + with TRegIniFile.Create(FIniFile) do try WriteString('General', 'OpenDir', OpenDialog.InitialDir); - WriteBool(FFileName, 'GetKeyWords', ChkGetKeyWords.Checked); - WriteBool(FFileName, 'ChkGPLHeader', ChkGPLHeader.Checked); + WriteBool(FFileName, 'GetKeyWords', CheckBoxGetKeyWords.Checked); + WriteBool(FFileName, 'CheckBoxGPLHeader', CheckBoxGPLHeader.Checked); WriteString(FFileName, 'Author', EditAuthor.Text); WriteString(FFileName, 'Description', EditDescription.Text); WriteString(FFileName, 'Version', EditVersion.Text); - WriteString(FFileName, 'Filter', CboFilter.Text); - WriteString(FFileName, 'Language', CboLangName.Text); - WriteString(FFileName, 'AttrIdentifier', CboAttrIdentifier.Text); - WriteString(FFileName, 'AttrReservedWord', CboAttrReservedWord.Text); - WriteString(FFileName, 'UnknownTokenAttr', CboUnknownTokenAttr.Text); + WriteString(FFileName, 'Filter', ComboBoxFilter.Text); + WriteString(FFileName, 'Language', ComboBoxLangName.Text); + WriteString(FFileName, 'AttrIdentifier', ComboBoxAttrIdentifier.Text); + WriteString(FFileName, 'AttrReservedWord', ComboBoxAttrReservedWord.Text); + WriteString(FFileName, 'UnknownTokenAttr', ComboBoxUnknownTokenAttr.Text); WriteString(FFileName, 'Fields', ListBoxFields.Items.CommaText); finally Free; end; end; -function TFrmMain.PerformFileOpen: Boolean; +function TFormMain.PerformFileOpen: Boolean; var UserName: PChar; +{$IFDEF SYN_COMPILER_5_UP} Count: Cardinal; +{$ELSE} + Count: Integer; +{$ENDIF} begin if OpenDialog.Execute then begin @@ -378,115 +385,117 @@ function TFrmMain.PerformFileOpen: Boolean; // retrieve the required size of the user name buffer UserName := StrAlloc(Count); // allocate memory for the user name GetUserName(UserName, Count); // retrieve the user name - with TRegIniFile.Create(IniFile) do + with TRegIniFile.Create(FIniFile) do try EditAuthor.Text := ReadString(FFileName, 'Author', StrPas(UserName)); EditDescription.Text := ReadString(FFileName, 'Description', 'Syntax Parser/Highlighter'); EditVersion.Text := ReadString(FFileName, 'Version', '0.1'); - CboFilter.Text := ReadString(FFileName, 'Filter', 'All files (*.*)|*.*'); - CboLangName.Text := ReadString(FFileName, 'Language', ''); - ChkGetKeyWords.Checked := ReadBool(FFileName, 'GetKeyWords', True); - ChkGPLHeader.Checked := ReadBool(FFileName, 'ChkGPLHeader', True); - CboAttrIdentifier.ItemIndex := CboAttrIdentifier.Items.IndexOf + ComboBoxFilter.Text := ReadString(FFileName, 'Filter', 'All files (*.*)|*.*'); + ComboBoxLangName.Text := ReadString(FFileName, 'Language', ''); + CheckBoxGetKeyWords.Checked := ReadBool(FFileName, 'GetKeyWords', True); + CheckBoxGPLHeader.Checked := ReadBool(FFileName, 'CheckBoxGPLHeader', True); + ComboBoxAttrIdentifier.ItemIndex := ComboBoxAttrIdentifier.Items.IndexOf (ReadString(FFileName, 'AttrIdentifier', 'SYNS_AttrIdentifier')); - CboAttrReservedWord.ItemIndex := CboAttrReservedWord.Items.IndexOf + ComboBoxAttrReservedWord.ItemIndex := ComboBoxAttrReservedWord.Items.IndexOf (ReadString(FFileName, 'AttrReservedWord', 'SYNS_AttrReservedWord')); - CboUnknownTokenAttr.ItemIndex := CboUnknownTokenAttr.Items.IndexOf + ComboBoxUnknownTokenAttr.ItemIndex := ComboBoxUnknownTokenAttr.Items.IndexOf (ReadString(FFileName, 'UnknownTokenAttr', 'Identifier')); ListBoxFields.Items.CommaText := ReadString(FFileName, 'Fields', ''); finally Free; end; StrDispose(UserName); - CboLangNameChange(Self); + ComboBoxLangNameChange(Self); end else Result := False; end; -procedure TFrmMain.FormCreate(Sender: TObject); +procedure TFormMain.FormCreate(Sender: TObject); var i: Integer; + items: TStrings; begin - for i := FrmMain.ComponentCount - 1 downto 0 do - if FrmMain.Components[i] is TComboBox then - if TComboBox(FrmMain.Components[i]).Parent = GrpAttrNames then + for i := FormMain.ComponentCount - 1 downto 0 do + if FormMain.Components[i] is TComboBox then + if TComboBox(FormMain.Components[i]).Parent = GrpAttrNames then begin - TComboBox(FrmMain.Components[i]).Items.Clear; - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrAsm'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrAsmComment'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrAsmKey'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrASP'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrAssembler'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrBlock'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrBrackets'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrCharacter'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrClass'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrComment'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrCondition'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrDir'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrDirective'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrDocumentation'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrEmbedSQL'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrEmbedText'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrEscapeAmpersand'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrForm'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrFunction'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrIcon'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrIdentifier'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrIllegalChar'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrIndirect'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrInvalidSymbol'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrInternalFunction'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrKey'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrLabel'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrMacro'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrMarker'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrMessage'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrMiscellaneous'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrNull'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrNumber'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrOperator'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrPragma'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrPreprocessor'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrQualifier'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrRegister'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrReservedWord'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrRpl'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrRplKey'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrRplComment'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSASM'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSASMComment'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSASMKey'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSecondReservedWord'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSection'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSpace'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSpecialVariable'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrString'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSymbol'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSyntaxError'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSystem'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrSystemValue'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrText'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrUnknownWord'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrUser'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrUserFunction'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrValue'); - TComboBox(FrmMain.Components[i]).Items.Add('SYNS_AttrVariable'); + items := TComboBox(FormMain.Components[i]).Items; + items.Clear; + items.Add('SYNS_AttrAsm'); + items.Add('SYNS_AttrAsmComment'); + items.Add('SYNS_AttrAsmKey'); + items.Add('SYNS_AttrASP'); + items.Add('SYNS_AttrAssembler'); + items.Add('SYNS_AttrBlock'); + items.Add('SYNS_AttrBrackets'); + items.Add('SYNS_AttrCharacter'); + items.Add('SYNS_AttrClass'); + items.Add('SYNS_AttrComment'); + items.Add('SYNS_AttrCondition'); + items.Add('SYNS_AttrDir'); + items.Add('SYNS_AttrDirective'); + items.Add('SYNS_AttrDocumentation'); + items.Add('SYNS_AttrEmbedSQL'); + items.Add('SYNS_AttrEmbedText'); + items.Add('SYNS_AttrEscapeAmpersand'); + items.Add('SYNS_AttrForm'); + items.Add('SYNS_AttrFunction'); + items.Add('SYNS_AttrIcon'); + items.Add('SYNS_AttrIdentifier'); + items.Add('SYNS_AttrIllegalChar'); + items.Add('SYNS_AttrIndirect'); + items.Add('SYNS_AttrInvalidSymbol'); + items.Add('SYNS_AttrInternalFunction'); + items.Add('SYNS_AttrKey'); + items.Add('SYNS_AttrLabel'); + items.Add('SYNS_AttrMacro'); + items.Add('SYNS_AttrMarker'); + items.Add('SYNS_AttrMessage'); + items.Add('SYNS_AttrMiscellaneous'); + items.Add('SYNS_AttrNull'); + items.Add('SYNS_AttrNumber'); + items.Add('SYNS_AttrOperator'); + items.Add('SYNS_AttrPragma'); + items.Add('SYNS_AttrPreprocessor'); + items.Add('SYNS_AttrQualifier'); + items.Add('SYNS_AttrRegister'); + items.Add('SYNS_AttrReservedWord'); + items.Add('SYNS_AttrRpl'); + items.Add('SYNS_AttrRplKey'); + items.Add('SYNS_AttrRplComment'); + items.Add('SYNS_AttrSASM'); + items.Add('SYNS_AttrSASMComment'); + items.Add('SYNS_AttrSASMKey'); + items.Add('SYNS_AttrSecondReservedWord'); + items.Add('SYNS_AttrSection'); + items.Add('SYNS_AttrSpace'); + items.Add('SYNS_AttrSpecialVariable'); + items.Add('SYNS_AttrString'); + items.Add('SYNS_AttrSymbol'); + items.Add('SYNS_AttrSyntaxError'); + items.Add('SYNS_AttrSystem'); + items.Add('SYNS_AttrSystemValue'); + items.Add('SYNS_AttrText'); + items.Add('SYNS_AttrUnknownWord'); + items.Add('SYNS_AttrUser'); + items.Add('SYNS_AttrUserFunction'); + items.Add('SYNS_AttrValue'); + items.Add('SYNS_AttrVariable'); end; PageControl.ActivePage := PageControl.Pages[0]; - Lex := TGenLex.Create; - KeyList := TList.Create; - SetList := TList.Create; - EnclosedList := TList.Create; - SampleSourceList := TStringList.Create; - IdentList := TStringList.Create; + FLex := TGenLex.Create; + FKeyList := TList.Create; + FSetList := TList.Create; + FEnclosedList := TList.Create; + FSampleSourceList := TStringList.Create; + FIdentList := TStringList.Create; // read ini file - IniFile := Copy(ExtractFileName(Application.ExeName), 0, + FIniFile := Copy(ExtractFileName(Application.ExeName), 0, Length(ExtractFileName(Application.ExeName)) - Length(ExtractFileExt(Application.ExeName))) + '.ini'; - with TRegIniFile.Create(IniFile) do + with TRegIniFile.Create(FIniFile) do try OpenDialog.InitialDir := ReadString('General', 'OpenDir', ExtractFilePath(Application.ExeName)); @@ -508,44 +517,44 @@ procedure TFrmMain.FormCreate(Sender: TObject); Application.Terminate end; -procedure TFrmMain.ClearAll; +procedure TFormMain.ClearAll; var I: Integer; begin - // Clear the contents of KeyList - for I := 0 to (KeyList.Count - 1) do - TObject(KeyList[I]).Free; - KeyList.Clear; - // Clear the contents of SetList - for I := 0 to (SetList.Count - 1) do - TObject(SetList[I]).Free; - SetList.Clear; - // Clear the contents of EnclosedList - for I := 0 to (EnclosedList.Count - 1) do - TObject(EnclosedList[I]).Free; - EnclosedList.Clear; - // Clear the contents of IdentList - for I := 0 to (IdentList.Count - 1) do + // Clear the contents of FKeyList + for I := 0 to (FKeyList.Count - 1) do + TObject(FKeyList[I]).Free; + FKeyList.Clear; + // Clear the contents of FSetList + for I := 0 to (FSetList.Count - 1) do + TObject(FSetList[I]).Free; + FSetList.Clear; + // Clear the contents of FEnclosedList + for I := 0 to (FEnclosedList.Count - 1) do + TObject(FEnclosedList[I]).Free; + FEnclosedList.Clear; + // Clear the contents of FIdentList + for I := 0 to (FIdentList.Count - 1) do begin - if Assigned(IdentList.Objects[I]) then - TObject(IdentList.Objects[I]).Free; + if Assigned(FIdentList.Objects[I]) then + TObject(FIdentList.Objects[I]).Free; end; - IdentList.Clear; - // Clear the contents of SampleSourceList - SampleSourceList.Clear; + FIdentList.Clear; + // Clear the contents of FSampleSourceList + FSampleSourceList.Clear; end; -procedure TFrmMain.FormDestroy(Sender: TObject); +procedure TFormMain.FormDestroy(Sender: TObject); begin ClearAll; - Lex.Free; - IdentList.Free; - KeyList.Free; - SetList.Free; - EnclosedList.Free; + FLex.Free; + FIdentList.Free; + FKeyList.Free; + FSetList.Free; + FEnclosedList.Free; end; -procedure TFrmMain.BtnStartClick(Sender: TObject); +procedure TFormMain.ButtonStartClick(Sender: TObject); var LexFileLines: TUnicodeStringList; begin @@ -556,118 +565,118 @@ procedure TFrmMain.BtnStartClick(Sender: TObject); LexFileLines := TUnicodeStringList.Create; try LexFileLines.LoadFromFile(OpenDialog.FileName); - LexFileContents := LexFileLines.Text; + FLexFileContents := LexFileLines.Text; finally LexFileLines.Free; end; - Lex.Origin := PWideChar(LexFileContents); - Lex.Tokenize; + FLex.Origin := PWideChar(FLexFileContents); + FLex.Tokenize; - while Lex.RunId <> IDIdentifier do - Lex.Next; - LexName := Lex.RunToken; + while FLex.RunId <> IDIdentifier do + FLex.Next; + FLexName := FLex.RunToken; - Lex.Next; - while Lex.RunId <> IDIdentifier do - Lex.Next; - IdentPre := Lex.RunToken; + FLex.Next; + while FLex.RunId <> IDIdentifier do + FLex.Next; + FIdentPre := FLex.RunToken; OutFileCreate(OpenDialog.FileName); try - while not (Lex.RunId in [IdSensitive, IdIdentStart]) do - Lex.Next; + while not (FLex.RunId in [IdSensitive, IdIdentStart]) do + FLex.Next; - if Lex.RunId = IdSensitive then - Sensitivity := True + if FLex.RunId = IdSensitive then + FSensitivity := True else - Sensitivity := False; - Lex.Next; + FSensitivity := False; + FLex.Next; - while Lex.RunId <> IDCharSet do - Lex.Next; - IdentStart := Lex.RunToken; - Lex.Next; + while FLex.RunId <> IDCharSet do + FLex.Next; + FIdentStart := FLex.RunToken; + FLex.Next; - while Lex.RunId <> IDNull do + while FLex.RunId <> IDNull do begin - case Lex.RunId of - IDCharSet: IdentContent := Lex.RunToken; + case FLex.RunId of + IDCharSet: FIdentContent := FLex.RunToken; IDKeys: FillKeyList; IDTokenTypes: FillTokenTypeList; IDChars: ParseCharSets; IDEnclosedBy: ParseEnclosedBy; IDSampleSource: ParseSampleSource; end; - Lex.Next; + FLex.Next; end; - if (KeyList.Count = 0) then + if (FKeyList.Count = 0) then raise Exception.Create('You should specify at least 1 keyword!'); - if (IdentList.Count = 0) then + if (FIdentList.Count = 0) then raise Exception.Create('You should specify at least 1 token type'); if not KeywordsAreAllAlphaNumAndDifferent then raise Exception.Create('One or more keywords contain unhandable characters'); - FrmHashTableGen.AssignKeyWords(KeyList, Sensitivity); + FrmHashTableGen.AssignKeyWords(FKeyList, FSensitivity); FrmHashTableGen.ShowModal; WriteRest; - while (Lex.RunId <> IdNull) do + while (FLex.RunId <> IdNull) do begin - Lex.Next; + FLex.Next; end; finally Screen.Cursor := crDefault; - CloseFile(OutFile); + CloseFile(FOutFile); end; - MessageDlg(LexName + ' created on ' + DateTimeToStr(Now), mtInformation, + MessageDlg(FLexName + ' created on ' + DateTimeToStr(Now), mtInformation, [mbOk], 0); end; -procedure TFrmMain.FillKeyList; +procedure TFormMain.FillKeyList; var aLexKey: TLexKeys; aString: string; aTokenType: string; begin - Lex.Next; + FLex.Next; aTokenType := ''; - while Lex.RunId <> IdCRLF do + while FLex.RunId <> IdCRLF do begin - if not (Lex.RunId in [IdSpace, IdBraceOpen]) then - aTokenType := aTokenType + Lex.RunToken; - Lex.Next; + if not (FLex.RunId in [IdSpace, IdBraceOpen]) then + aTokenType := aTokenType + FLex.RunToken; + FLex.Next; end; if (aTokenType = '') then aTokenType := 'Key'; - while Lex.RunId <> IdStop do + while FLex.RunId <> IdStop do begin - while Lex.RunId in [IdSpace, IdBraceOpen, IdCRLF] do - Lex.Next; - if Lex.RunId <> IdStop then + while FLex.RunId in [IdSpace, IdBraceOpen, IdCRLF] do + FLex.Next; + if FLex.RunId <> IdStop then begin aString := ''; - while not (Lex.RunId in [IdSpace, IdBraceOpen, IdCRLF]) do + while not (FLex.RunId in [IdSpace, IdBraceOpen, IdCRLF]) do begin - aString := aString + Lex.RunToken; - Lex.Next; + aString := aString + FLex.RunToken; + FLex.Next; end; aLexKey := TLexKeys.Create; aLexKey.TokenType := aTokenType; aLexKey.KeyName := aString; - KeyList.Add(aLexKey); + FKeyList.Add(aLexKey); end else Break; - Lex.Next; + FLex.Next; end; - KeyList.Sort(CompareKeys); + FKeyList.Sort(CompareKeys); end; -procedure TFrmMain.FillTokenTypeList; +procedure TFormMain.FillTokenTypeList; var i: Integer; List: TStringList; @@ -675,30 +684,30 @@ procedure TFrmMain.FillTokenTypeList; sLine: string; DefAttri: TLexDefaultAttri; begin - Lex.Next; - IdentList.Add(IdentPre + 'Unknown'); - IdentList.Add(IdentPre + 'Null'); - while (Lex.RunId <> IdStop) do + FLex.Next; + FIdentList.Add(FIdentPre + 'Unknown'); + FIdentList.Add(FIdentPre + 'Null'); + while (FLex.RunId <> IdStop) do begin - while Lex.RunId in [IdSpace, IdBraceOpen, IdCRLF, IDUnknown] do - Lex.Next; - if (Lex.RunId <> IdStop) then + while FLex.RunId in [IdSpace, IdBraceOpen, IdCRLF, IDUnknown] do + FLex.Next; + if (FLex.RunId <> IdStop) then begin - sIdent := IdentPre + Lex.RunToken; + sIdent := FIdentPre + FLex.RunToken; if not IsValidIdent(sIdent) then raise Exception.Create('Invalid identifier for token type: ' + sIdent); - if (IdentList.IndexOf(sIdent) < 0) then - IdentList.Add(sIdent); - Lex.Next; + if (FIdentList.IndexOf(sIdent) < 0) then + FIdentList.Add(sIdent); + FLex.Next; sLine := ''; - while (Lex.RunId = IdSpace) do - Lex.Next; - while not (Lex.RunId in [IdStop, IdCRLF]) do + while (FLex.RunId = IdSpace) do + FLex.Next; + while not (FLex.RunId in [IdStop, IdCRLF]) do begin { is there more data on this line? } - sLine := sLine + Lex.RunToken; - Lex.Next; + sLine := sLine + FLex.RunToken; + FLex.Next; end; if (sLine <> '') then { The Msg file specifies default attributes } @@ -720,14 +729,14 @@ procedure TFrmMain.FillTokenTypeList; end; end; - i := IdentList.IndexOf(sIdent); + i := FIdentList.IndexOf(sIdent); if (i >= 0) then begin DefAttri := TLexDefaultAttri.Create; DefAttri.Style := List.Values['Style']; DefAttri.Foreground := List.Values['Foreground']; DefAttri.Background := List.Values['Background']; - IdentList.Objects[i] := DefAttri; + FIdentList.Objects[i] := DefAttri; end; finally List.Free; @@ -739,7 +748,7 @@ procedure TFrmMain.FillTokenTypeList; end; end; -procedure TFrmMain.OutFileCreate(InName: string); +procedure TFormMain.OutFileCreate(InName: string); var OutName, UName: string; sysTime: TSystemTime; @@ -747,188 +756,190 @@ procedure TFrmMain.OutFileCreate(InName: string); begin OutName := ChangeFileExt(InName, '.pas'); Uname := ExtractFileName(ChangeFileExt(InName, '')); - AssignFile(OutFile, OutName); - rewrite(OutFile); + AssignFile(FOutFile, OutName); + rewrite(FOutFile); GetSystemTime(sysTime); ISODate := Format('%.4d-%.2d-%.2d', [sysTime.wYear, sysTime.wMonth, sysTime.wDay]); - if ChkGPLHeader.Checked then + if CheckBoxGPLHeader.Checked then begin - Writeln(OutFile, + Writeln(FOutFile, '{-------------------------------------------------------------------------------'); - Writeln(OutFile, + Writeln(FOutFile, 'The contents of this file are subject to the Mozilla Public License'); - Writeln(OutFile, + Writeln(FOutFile, 'Version 1.1 (the "License"); you may not use this file except in compliance'); - Writeln(OutFile, + Writeln(FOutFile, 'with the License. You may obtain a copy of the License at'); - Writeln(OutFile, 'http://www.mozilla.org/MPL/'); - Writeln(OutFile); - Writeln(OutFile, + Writeln(FOutFile, 'http://www.mozilla.org/MPL/'); + Writeln(FOutFile); + Writeln(FOutFile, 'Software distributed under the License is distributed on an "AS IS" basis,'); - Writeln(OutFile, + Writeln(FOutFile, 'WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for'); - Writeln(OutFile, + Writeln(FOutFile, 'the specific language governing rights and limitations under the License.'); - Writeln(OutFile); - Writeln(OutFile, 'Code template generated with SynGen.'); - Writeln(OutFile, 'The original code is: ' + OutName + ', released ' + ISODate + Writeln(FOutFile); + Writeln(FOutFile, 'Code template generated with SynGen.'); + Writeln(FOutFile, 'The original code is: ' + OutName + ', released ' + ISODate + '.'); - Writeln(OutFile, 'Description: ' + EditDescription.Text); - Writeln(OutFile, 'The initial author of this file is ' + EditAuthor.Text + + Writeln(FOutFile, 'Description: ' + EditDescription.Text); + Writeln(FOutFile, 'The initial author of this file is ' + EditAuthor.Text + '.'); - Writeln(OutFile, 'Copyright (c) ' + Format('%d', [sysTime.wYear]) + + Writeln(FOutFile, 'Copyright (c) ' + Format('%d', [sysTime.wYear]) + ', all rights reserved.'); - Writeln(OutFile); - Writeln(OutFile, + Writeln(FOutFile); + Writeln(FOutFile, 'Contributors to the SynEdit and mwEdit projects are listed in the'); - Writeln(OutFile, 'Contributors.txt file.'); - Writeln(OutFile); - Writeln(OutFile, + Writeln(FOutFile, 'Contributors.txt file.'); + Writeln(FOutFile); + Writeln(FOutFile, 'Alternatively, the contents of this file may be used under the terms of the'); - Writeln(OutFile, + Writeln(FOutFile, 'GNU General Public License Version 2 or later (the "GPL"), in which case'); - Writeln(OutFile, + Writeln(FOutFile, 'the provisions of the GPL are applicable instead of those above.'); - Writeln(OutFile, + Writeln(FOutFile, 'If you wish to allow use of your version of this file only under the terms'); - Writeln(OutFile, + Writeln(FOutFile, 'of the GPL and not to allow others to use your version of this file'); - Writeln(OutFile, + Writeln(FOutFile, 'under the MPL, indicate your decision by deleting the provisions above and'); - Writeln(OutFile, + Writeln(FOutFile, 'replace them with the notice and other provisions required by the GPL.'); - Writeln(OutFile, + Writeln(FOutFile, 'If you do not delete the provisions above, a recipient may use your version'); - Writeln(OutFile, 'of this file under either the MPL or the GPL.'); - Writeln(OutFile); - Writeln(OutFile, '$' + 'Id: ' + '$'); - Writeln(OutFile); - Writeln(OutFile, + Writeln(FOutFile, 'of this file under either the MPL or the GPL.'); + Writeln(FOutFile); + Writeln(FOutFile, '$' + 'Id: ' + '$'); + Writeln(FOutFile); + Writeln(FOutFile, 'You may retrieve the latest version of this file at the SynEdit home page,'); - Writeln(OutFile, 'located at http://SynEdit.SourceForge.net'); - Writeln(OutFile); - Writeln(OutFile, + Writeln(FOutFile, 'located at http://SynEdit.SourceForge.net'); + Writeln(FOutFile); + Writeln(FOutFile, '-------------------------------------------------------------------------------}'); end else begin - Writeln(OutFile, + Writeln(FOutFile, '{+-----------------------------------------------------------------------------+'); - Writeln(OutFile, ' | Class: ' + LexName); - Writeln(OutFile, ' | Created: ' + ISODate); - Writeln(OutFile, ' | Last change: ' + ISODate); - Writeln(OutFile, ' | Author: ' + EditAuthor.Text); - Writeln(OutFile, ' | Description: ' + EditDescription.Text); - Writeln(OutFile, ' | Version: ' + EditVersion.Text); - Writeln(OutFile, ' |'); - Writeln(OutFile, ' | Copyright (c) ' + Format('%d', [sysTime.wYear]) + #32 + + Writeln(FOutFile, ' | Class: ' + FLexName); + Writeln(FOutFile, ' | Created: ' + ISODate); + Writeln(FOutFile, ' | Last change: ' + ISODate); + Writeln(FOutFile, ' | Author: ' + EditAuthor.Text); + Writeln(FOutFile, ' | Description: ' + EditDescription.Text); + Writeln(FOutFile, ' | Version: ' + EditVersion.Text); + Writeln(FOutFile, ' |'); + Writeln(FOutFile, ' | Copyright (c) ' + Format('%d', [sysTime.wYear]) + #32 + EditAuthor.Text + '. All rights reserved.'); - Writeln(OutFile, ' |'); - Writeln(OutFile, ' | Generated with SynGen.'); - Writeln(OutFile, + Writeln(FOutFile, ' |'); + Writeln(FOutFile, ' | Generated with SynGen.'); + Writeln(FOutFile, ' +----------------------------------------------------------------------------+}'); end; - Writeln(OutFile); - Writeln(OutFile, 'unit ' + Uname + ';'); - Writeln(OutFile); - Writeln(OutFile, 'interface'); - Writeln(OutFile); - Writeln(OutFile, 'uses'); - Writeln(OutFile, ' Graphics,'); - Writeln(OutFile, ' SynEditTypes,'); - Writeln(OutFile, ' SynEditHighlighter,'); - Writeln(OutFile, ' SynUnicode,'); - Writeln(OutFile, ' SysUtils,'); - Writeln(OutFile, ' Classes;'); - Writeln(OutFile); - Writeln(OutFile, 'type'); - Writeln(OutFile, ' T' + IdentPre + 'TokenKind = ('); + Writeln(FOutFile); + Writeln(FOutFile, 'unit ' + Uname + ';'); + Writeln(FOutFile); + Writeln(FOutFile, '{$I SynEdit.inc}'); + Writeln(FOutFile); + Writeln(FOutFile, 'interface'); + Writeln(FOutFile); + Writeln(FOutFile, 'uses'); + Writeln(FOutFile, ' Graphics,'); + Writeln(FOutFile, ' SynEditTypes,'); + Writeln(FOutFile, ' SynEditHighlighter,'); + Writeln(FOutFile, ' SynUnicode,'); + Writeln(FOutFile, ' SysUtils,'); + Writeln(FOutFile, ' Classes;'); + Writeln(FOutFile); + Writeln(FOutFile, 'type'); + Writeln(FOutFile, ' T' + FIdentPre + 'TokenKind = ('); end; -procedure TFrmMain.ParseCharsets; +procedure TFormMain.ParseCharsets; begin - Lex.Next; - while Lex.RunId <> IdStop do + FLex.Next; + while FLex.RunId <> IdStop do begin - case Lex.RunId of + case FLex.RunId of IdCharset: RetrieveCharset; else - Lex.Next; + FLex.Next; end; end; end; -procedure TFrmMain.ParseEnclosedBy; +procedure TFormMain.ParseEnclosedBy; begin - Lex.Next; - while not (Lex.RunId in [IdStop, IdNull]) do + FLex.Next; + while not (FLex.RunId in [IdStop, IdNull]) do RetrieveEnclosedBy; end; -procedure TFrmMain.ParseSampleSource; +procedure TFormMain.ParseSampleSource; begin - Lex.Next; - if (Lex.RunId = IdCRLF) then - Lex.Next; + FLex.Next; + if (FLex.RunId = IdCRLF) then + FLex.Next; - while not (Lex.RunId in [IdStop, IdNull]) do + while not (FLex.RunId in [IdStop, IdNull]) do RetrieveSampleSource; end; -procedure TFrmMain.RetrieveCharset; +procedure TFormMain.RetrieveCharset; var aSet: TLexCharsets; begin aSet := TLexCharsets.Create; - aSet.Charset := Lex.RunToken; - while Lex.RunId <> IDIdentifier do - Lex.Next; - aSet.SetName := Lex.RunToken; - while Lex.RunId <> IDBeginProc do - Lex.Next; - Lex.Next; - while Lex.RunId in [IdCRLF, IdSpace] do - Lex.Next; - while not (Lex.RunId = IdEndProc) do + aSet.Charset := FLex.RunToken; + while FLex.RunId <> IDIdentifier do + FLex.Next; + aSet.SetName := FLex.RunToken; + while FLex.RunId <> IDBeginProc do + FLex.Next; + FLex.Next; + while FLex.RunId in [IdCRLF, IdSpace] do + FLex.Next; + while not (FLex.RunId = IdEndProc) do begin - aSet.ProcData := aSet.ProcData + Lex.RunToken; - Lex.Next; + aSet.ProcData := aSet.ProcData + FLex.RunToken; + FLex.Next; end; - SetList.Add(aSet); - Lex.Next; + FSetList.Add(aSet); + FLex.Next; end; -procedure TFrmMain.RetrieveSampleSource; +procedure TFormMain.RetrieveSampleSource; var sLine: string; begin sLine := ''; - while not (Lex.RunId in [IdCRLF, IdNull, IdStop]) do + while not (FLex.RunId in [IdCRLF, IdNull, IdStop]) do begin - sLine := sLine + Lex.RunToken; - Lex.Next; + sLine := sLine + FLex.RunToken; + FLex.Next; end; - if (Lex.RunId = IdCRLF) then - Lex.Next; + if (FLex.RunId = IdCRLF) then + FLex.Next; - SampleSourceList.Add(sLine); + FSampleSourceList.Add(sLine); end; -procedure TFrmMain.RetrieveEnclosedBy; +procedure TFormMain.RetrieveEnclosedBy; var aThing: TLexEnclosedBy; sLine: string; iPos: Integer; begin - while Lex.RunId in [IdCRLF, IdSpace] do - Lex.Next; + while FLex.RunId in [IdCRLF, IdSpace] do + FLex.Next; sLine := ''; - while not (Lex.RunId in [IdCRLF, IdNull, IdStop]) do + while not (FLex.RunId in [IdCRLF, IdNull, IdStop]) do begin - sLine := sLine + Lex.RunToken; - Lex.Next; + sLine := sLine + FLex.RunToken; + FLex.Next; end; if (sLine <> '') then @@ -958,13 +969,13 @@ procedure TFrmMain.RetrieveEnclosedBy; else aThing.EndsWith := sLine; - EnclosedList.Add(aThing); + FEnclosedList.Add(aThing); end - else if (Lex.RunId <> IdStop) then - Lex.Next; + else if (FLex.RunId <> IdStop) then + FLex.Next; end; { RetrieveEnclosedBy } -function TFrmMain.FilterInvalidChars(const Value: string): string; +function TFormMain.FilterInvalidChars(const Value: string): string; var i: Integer; begin @@ -976,13 +987,13 @@ function TFrmMain.FilterInvalidChars(const Value: string): string; end; end; { FilterInvalidChars } -function TFrmMain.GetFilterName: string; +function TFormMain.GetFilterName: string; var FilterName: string; begin FilterName := ''; - case CboFilter.ItemIndex of - -1: FilterName := 'SYNS_Filter' + FilterInvalidChars(CboLangName.Text); + case ComboBoxFilter.ItemIndex of + -1: FilterName := 'SYNS_Filter' + FilterInvalidChars(ComboBoxLangName.Text); 0: FilterName := 'SYNS_FilterPascal'; 1: FilterName := 'SYNS_FilterHP48'; 2: FilterName := 'SYNS_FilterCAClipper'; @@ -1018,12 +1029,12 @@ function TFrmMain.GetFilterName: string; Result := FilterName; end; -function TFrmMain.GetFriendlyLangName: string; +function TFormMain.GetFriendlyLangName: string; var LangName: string; begin - case CboLangName.ItemIndex of - -1: LangName := 'SYNS_FriendlyLang' + FilterInvalidChars(CboLangName.Text); + case ComboBoxLangName.ItemIndex of + -1: LangName := 'SYNS_FriendlyLang' + FilterInvalidChars(ComboBoxLangName.Text); 0: LangName := 'SYNS_FriendlyLangHP48'; 1: LangName := 'SYNS_FriendlyLangCAClipper'; 2: LangName := 'SYNS_FriendlyLangCPP'; @@ -1061,12 +1072,12 @@ function TFrmMain.GetFriendlyLangName: string; Result := LangName; end; -function TFrmMain.GetLangName: string; +function TFormMain.GetLangName: string; var LangName: string; begin - case CboLangName.ItemIndex of - -1: LangName := 'SYNS_Lang' + FilterInvalidChars(CboLangName.Text); + case ComboBoxLangName.ItemIndex of + -1: LangName := 'SYNS_Lang' + FilterInvalidChars(ComboBoxLangName.Text); 0: LangName := 'SYNS_LangHP48'; 1: LangName := 'SYNS_LangCAClipper'; 2: LangName := 'SYNS_LangCPP'; @@ -1104,7 +1115,7 @@ function TFrmMain.GetLangName: string; Result := LangName; end; -procedure TFrmMain.WriteRest; +procedure TFormMain.WriteRest; var I, J: Integer; LineLength: Integer; @@ -1116,403 +1127,403 @@ procedure TFrmMain.WriteRest; sPrefix: string; DefAttri: TLexDefaultAttri; begin - IdentList.Sort; - SetList.Sort(CompareSets); + FIdentList.Sort; + FSetList.Sort(CompareSets); I := 0; - while I < IdentList.Count - 1 do + while I < FIdentList.Count - 1 do begin - Writeln(OutFile, ' ' + IdentList[I] + ','); + Writeln(FOutFile, ' ' + FIdentList[I] + ','); inc(I); end; - Writeln(OutFile, ' ' + IdentList[I] + ');'); - Writeln(OutFile); - Write(OutFile, ' TRangeState = (rsUnKnown'); - for I := 0 to (EnclosedList.Count - 1) do - Write(OutFile, ', rs' + TLexEnclosedBy(EnclosedList[I]).ProcName); - Writeln(OutFile, ');'); - Writeln(OutFile); - Writeln(OutFile, ' TProcTableProc = procedure of object;'); - Writeln(OutFile); - Writeln(OutFile, ' PIdentFuncTableFunc = ^TIdentFuncTableFunc;'); - Writeln(OutFile, ' TIdentFuncTableFunc = function (Index: Integer): T' + IdentPre + + Writeln(FOutFile, ' ' + FIdentList[I] + ');'); + Writeln(FOutFile); + Write(FOutFile, ' TRangeState = (rsUnknown'); + for I := 0 to (FEnclosedList.Count - 1) do + Write(FOutFile, ', rs' + TLexEnclosedBy(FEnclosedList[I]).ProcName); + Writeln(FOutFile, ');'); + Writeln(FOutFile); + Writeln(FOutFile, ' TProcTableProc = procedure of object;'); + Writeln(FOutFile); + Writeln(FOutFile, ' PIdentFuncTableFunc = ^TIdentFuncTableFunc;'); + Writeln(FOutFile, ' TIdentFuncTableFunc = function (Index: Integer): T' + FIdentPre + 'TokenKind of object;'); - Writeln(OutFile); + Writeln(FOutFile); - Writeln(OutFile, 'type'); - Writeln(OutFile, ' ' + LexName + ' = class(TSynCustomHighlighter)'); - Writeln(OutFile, ' private'); - Writeln(OutFile, ' fRange: TRangeState;'); + Writeln(FOutFile, 'type'); + Writeln(FOutFile, ' ' + FLexName + ' = class(TSynCustomHighlighter)'); + Writeln(FOutFile, ' private'); + Writeln(FOutFile, ' FRange: TRangeState;'); if ListBoxFields.Items.Count > 0 then for i := 0 to ListBoxFields.Items.Count - 1 do - Writeln(OutFile, ' ' + ListBoxFields.Items[i] + ';'); + Writeln(FOutFile, ' ' + ListBoxFields.Items[i] + ';'); - Writeln(OutFile, ' fTokenID: TtkTokenKind;'); - Writeln(OutFile, + Writeln(FOutFile, ' FTokenId: TtkTokenKind;'); + Writeln(FOutFile, ' fIdentFuncTable: array[0..' + IntToStr(FrmHashTableGen.KeyIndicesCount - 1) + ']' + ' of TIdentFuncTableFunc;'); I := 0; - while I < IdentList.Count do + while I < FIdentList.Count do begin - if (IdentList[I] <> IdentPre + 'Null') and (IdentList[I] <> IdentPre + + if (FIdentList[I] <> FIdentPre + 'Null') and (FIdentList[I] <> FIdentPre + 'Unknown') then - Writeln(OutFile, ' f' + Copy(IdentList[I], Length(IdentPre) + 1, - Length(IdentList[I])) + 'Attri: TSynHighlighterAttributes;'); + Writeln(FOutFile, ' f' + Copy(FIdentList[I], Length(FIdentPre) + 1, + Length(FIdentList[I])) + 'Attri: TSynHighlighterAttributes;'); inc(I); end; - Writeln(OutFile, ' function HashKey(Str: PWideChar): Cardinal;'); + Writeln(FOutFile, ' function HashKey(Str: PWideChar): Cardinal;'); I := 0; - while I < KeyList.Count do + while I < FKeyList.Count do begin - Writeln(OutFile, AnsiString(' function Func' + - ToAlphaNum(FirstLetterCap(TLexKeys(KeyList[I]).KeyName)) + - '(Index: Integer): T' + IdentPre + 'TokenKind;')); + Writeln(FOutFile, AnsiString(' function Func' + + ToAlphaNum(FirstLetterCap(TLexKeys(FKeyList[I]).KeyName)) + + '(Index: Integer): T' + FIdentPre + 'TokenKind;')); inc(I); end; I := 0; - while I < SetList.Count do + while I < FSetList.Count do begin - Writeln(OutFile, ' procedure ' + TLexCharsets(SetList[I]).SetName + + Writeln(FOutFile, ' procedure ' + TLexCharsets(FSetList[I]).SetName + 'Proc;'); inc(I); end; - Writeln(OutFile, ' procedure UnknownProc;'); - Writeln(OutFile, ' function AltFunc(Index: Integer): T' + IdentPre + 'TokenKind;'); - Writeln(OutFile, ' procedure InitIdent;'); - Writeln(OutFile, ' function IdentKind(MayBe: PWideChar): T' + IdentPre + + Writeln(FOutFile, ' procedure UnknownProc;'); + Writeln(FOutFile, ' function AltFunc(Index: Integer): T' + FIdentPre + 'TokenKind;'); + Writeln(FOutFile, ' procedure InitIdent;'); + Writeln(FOutFile, ' function IdentKind(MayBe: PWideChar): T' + FIdentPre + 'TokenKind;'); - Writeln(OutFile, ' procedure NullProc;'); - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' procedure SpaceProc;'); - Writeln(OutFile, ' procedure CRProc;'); - Writeln(OutFile, ' procedure LFProc;'); - for I := 0 to (EnclosedList.Count - 1) do + Writeln(FOutFile, ' procedure NullProc;'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' procedure SpaceProc;'); + Writeln(FOutFile, ' procedure CRProc;'); + Writeln(FOutFile, ' procedure LFProc;'); + for I := 0 to (FEnclosedList.Count - 1) do begin - Writeln(OutFile, ' procedure ' + TLexEnclosedBy(EnclosedList[I]).ProcName + Writeln(FOutFile, ' procedure ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'OpenProc;'); - Writeln(OutFile, ' procedure ' + TLexEnclosedBy(EnclosedList[I]).ProcName + Writeln(FOutFile, ' procedure ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'Proc;'); end; - Writeln(OutFile, ' protected'); - Writeln(OutFile, ' function GetSampleSource: string; override;'); - Writeln(OutFile, ' function IsFilterStored: Boolean; override;'); - Writeln(OutFile, ' public'); - Writeln(OutFile, ' constructor Create(AOwner: TComponent); override;'); - Writeln(OutFile, ' class function GetFriendlyLanguageName: string; override;'); - Writeln(OutFile, ' class function GetLanguageName: string; override;'); - Writeln(OutFile, ' function GetRange: Pointer; override;'); - Writeln(OutFile, ' procedure ResetRange; override;'); - Writeln(OutFile, ' procedure SetRange(Value: Pointer); override;'); - Writeln(OutFile, + Writeln(FOutFile, ' protected'); + Writeln(FOutFile, ' function GetSampleSource: UnicodeString; override;'); + Writeln(FOutFile, ' function IsFilterStored: Boolean; override;'); + Writeln(FOutFile, ' public'); + Writeln(FOutFile, ' constructor Create(AOwner: TComponent); override;'); + Writeln(FOutFile, ' class function GetFriendlyLanguageName: UnicodeString; override;'); + Writeln(FOutFile, ' class function GetLanguageName: string; override;'); + Writeln(FOutFile, ' function GetRange: Pointer; override;'); + Writeln(FOutFile, ' procedure ResetRange; override;'); + Writeln(FOutFile, ' procedure SetRange(Value: Pointer); override;'); + Writeln(FOutFile, ' function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;'); - Writeln(OutFile, ' function GetEol: Boolean; override;'); - if ChkGetKeyWords.Checked then - Writeln(OutFile, ' function GetKeyWords(TokenKind: Integer): string; override;'); - Writeln(OutFile, ' function GetTokenID: TtkTokenKind;'); - Writeln(OutFile, + Writeln(FOutFile, ' function GetEol: Boolean; override;'); + if CheckBoxGetKeyWords.Checked then + Writeln(FOutFile, ' function GetKeyWords(TokenKind: Integer): UnicodeString; override;'); + Writeln(FOutFile, ' function GetTokenID: TtkTokenKind;'); + Writeln(FOutFile, ' function GetTokenAttribute: TSynHighlighterAttributes; override;'); - Writeln(OutFile, ' function GetTokenKind: Integer; override;'); - Writeln(OutFile, ' function IsIdentChar(AChar: WideChar): Boolean; override;'); - Writeln(OutFile, ' procedure Next; override;'); - Writeln(OutFile, ' published'); + Writeln(FOutFile, ' function GetTokenKind: Integer; override;'); + Writeln(FOutFile, ' function IsIdentChar(AChar: WideChar): Boolean; override;'); + Writeln(FOutFile, ' procedure Next; override;'); + Writeln(FOutFile, ' published'); I := 0; - while I < IdentList.Count do + while I < FIdentList.Count do begin - if (IdentList[I] <> IdentPre + 'Null') and (IdentList[I] <> IdentPre + + if (FIdentList[I] <> FIdentPre + 'Null') and (FIdentList[I] <> FIdentPre + 'Unknown') then - Writeln(OutFile, ' property ' + Copy(IdentList[I], Length(IdentPre) + - 1, Length(IdentList[I])) - + 'Attri: TSynHighlighterAttributes read f' + Copy(IdentList[I], - Length(IdentPre) + 1, Length(IdentList[I])) + - 'Attri write f' + Copy(IdentList[I], Length(IdentPre) + 1, - Length(IdentList[I])) + 'Attri;'); + Writeln(FOutFile, ' property ' + Copy(FIdentList[I], Length(FIdentPre) + + 1, Length(FIdentList[I])) + + 'Attri: TSynHighlighterAttributes read f' + Copy(FIdentList[I], + Length(FIdentPre) + 1, Length(FIdentList[I])) + + 'Attri write f' + Copy(FIdentList[I], Length(FIdentPre) + 1, + Length(FIdentList[I])) + 'Attri;'); inc(I); end; - Writeln(OutFile, ' end;'); - Writeln(OutFile); - Writeln(OutFile, 'implementation'); - Writeln(OutFile); - Writeln(OutFile, 'uses'); - Writeln(OutFile, ' SynEditStrConst;'); - Writeln(OutFile); - if (CboFilter.ItemIndex = -1) or (CboLangName.ItemIndex = -1) then + Writeln(FOutFile, ' end;'); + Writeln(FOutFile); + Writeln(FOutFile, 'implementation'); + Writeln(FOutFile); + Writeln(FOutFile, 'uses'); + Writeln(FOutFile, ' SynEditStrConst;'); + Writeln(FOutFile); + if (ComboBoxFilter.ItemIndex = -1) or (ComboBoxLangName.ItemIndex = -1) then begin - Writeln(OutFile, 'resourcestring'); - if (CboFilter.ItemIndex = -1) then - Writeln(OutFile, ' SYNS_Filter' + FilterInvalidChars(CboLangName.Text) + - ' = ''' + CboFilter.Text + ''';'); - if (CboLangName.ItemIndex = -1) then + Writeln(FOutFile, 'resourcestring'); + if (ComboBoxFilter.ItemIndex = -1) then + Writeln(FOutFile, ' SYNS_Filter' + FilterInvalidChars(ComboBoxLangName.Text) + + ' = ''' + ComboBoxFilter.Text + ''';'); + if (ComboBoxLangName.ItemIndex = -1) then begin - Writeln(OutFile, ' SYNS_Lang' + FilterInvalidChars(CboLangName.Text) + - ' = ''' + CboLangName.Text + ''';'); + Writeln(FOutFile, ' SYNS_Lang' + FilterInvalidChars(ComboBoxLangName.Text) + + ' = ''' + ComboBoxLangName.Text + ''';'); - Writeln(OutFile, ' SYNS_FriendlyLang' + FilterInvalidChars(CboLangName.Text) + - ' = ''' + CboLangName.Text + ''';'); + Writeln(FOutFile, ' SYNS_FriendlyLang' + FilterInvalidChars(ComboBoxLangName.Text) + + ' = ''' + ComboBoxLangName.Text + ''';'); end; I := 0; - while I < IdentList.Count do + while I < FIdentList.Count do begin - AttrTemp := Copy(IdentList[I], Length(IdentPre) + 1, - Length(IdentList[I])); - if (CboAttrIdentifier.Items.IndexOf('SYNS_Attr' + AttrTemp) < 0) and + AttrTemp := Copy(FIdentList[I], Length(FIdentPre) + 1, + Length(FIdentList[I])); + if (ComboBoxAttrIdentifier.Items.IndexOf('SYNS_Attr' + AttrTemp) < 0) and (AttrTemp <> 'Unknown') then begin - Writeln(OutFile, ' SYNS_Attr' + FilterInvalidChars(AttrTemp) + ' = ''' + Writeln(FOutFile, ' SYNS_Attr' + FilterInvalidChars(AttrTemp) + ' = ''' + AttrTemp + ''';'); - Writeln(OutFile, ' SYNS_FriendlyAttr' + FilterInvalidChars(AttrTemp) + ' = ''' + Writeln(FOutFile, ' SYNS_FriendlyAttr' + FilterInvalidChars(AttrTemp) + ' = ''' + AttrTemp + ''';'); end; Inc(i); end; - Writeln(OutFile); + Writeln(FOutFile); end; - Writeln(OutFile, 'const'); - Write(OutFile, FrmHashTableGen.GetKeyWordConstantsSource(Sensitivity)); - Writeln(OutFile); + Writeln(FOutFile, 'const'); + Write(FOutFile, FrmHashTableGen.GetKeyWordConstantsSource(FSensitivity)); + Writeln(FOutFile); - Writeln(OutFile, 'procedure ' + LexName + '.InitIdent;'); - Writeln(OutFile, 'var'); - Writeln(OutFile, ' i: Integer;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do'); - Writeln(OutFile, ' if KeyIndices[i] = -1 then'); - Writeln(OutFile, ' fIdentFuncTable[i] := AltFunc;'); - Writeln(OutFile, ''); + Writeln(FOutFile, 'procedure ' + FLexName + '.InitIdent;'); + Writeln(FOutFile, 'var'); + Writeln(FOutFile, ' i: Integer;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do'); + Writeln(FOutFile, ' if KeyIndices[i] = -1 then'); + Writeln(FOutFile, ' fIdentFuncTable[i] := AltFunc;'); + Writeln(FOutFile, ''); I := 0; - while I < KeyList.Count do + while I < FKeyList.Count do begin - if I < KeyList.Count - 1 then - while TLexKeys(KeyList[I]).Key = TLexKeys(KeyList[I + 1]).Key do + if I < FKeyList.Count - 1 then + while TLexKeys(FKeyList[I]).Key = TLexKeys(FKeyList[I + 1]).Key do begin inc(I); - if I >= KeyList.Count - 1 then + if I >= FKeyList.Count - 1 then break; end; - KeyString := IntToStr(TLexKeys(KeyList[I]).Key); - Writeln(OutFile, ' fIdentFuncTable[' + KeyString + '] := Func' + - ToAlphaNum(FirstLetterCap(TLexKeys(KeyList[I]).KeyName)) + ';'); + KeyString := IntToStr(TLexKeys(FKeyList[I]).Key); + Writeln(FOutFile, ' fIdentFuncTable[' + KeyString + '] := Func' + + ToAlphaNum(FirstLetterCap(TLexKeys(FKeyList[I]).KeyName)) + ';'); inc(I); end; - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); - Write(OutFile, FrmHashTableGen.GetHashKeyFunctionSource(LexName)); - Writeln(OutFile); + Write(FOutFile, FrmHashTableGen.GetHashKeyFunctionSource(FLexName)); + Writeln(FOutFile); I := 0; - while I < KeyList.Count do + while I < FKeyList.Count do begin - KeyString := ToAlphaNum(FirstLetterCap(TLexKeys(KeyList[I]).KeyName)); - Writeln(OutFile, 'function ' + LexName + '.Func' + KeyString + '(Index: Integer): T' + - IdentPre + 'TokenKind;'); - Writeln(OutFile, 'begin'); - if I < KeyList.Count - 1 then - while TLexKeys(KeyList[I]).Key = TLexKeys(KeyList[I + 1]).Key do + KeyString := ToAlphaNum(FirstLetterCap(TLexKeys(FKeyList[I]).KeyName)); + Writeln(FOutFile, 'function ' + FLexName + '.Func' + KeyString + '(Index: Integer): T' + + FIdentPre + 'TokenKind;'); + Writeln(FOutFile, 'begin'); + if I < FKeyList.Count - 1 then + while TLexKeys(FKeyList[I]).Key = TLexKeys(FKeyList[I + 1]).Key do begin - Writeln(OutFile, ' if IsCurrentToken(KeyWords[Index]) then'); - Writeln(OutFile, ' Result := ' + IdentPre + TLexKeys(KeyList[I]).TokenType); - Writeln(OutFile, ' else'); + Writeln(FOutFile, ' if IsCurrentToken(KeyWords[Index]) then'); + Writeln(FOutFile, ' Result := ' + FIdentPre + TLexKeys(FKeyList[I]).TokenType); + Writeln(FOutFile, ' else'); inc(I); - if I >= KeyList.Count - 1 then + if I >= FKeyList.Count - 1 then break; end; - Writeln(OutFile, ' if IsCurrentToken(KeyWords[Index]) then'); - Writeln(OutFile, ' Result := ' + IdentPre + TLexKeys(KeyList[I]).TokenType); - Writeln(OutFile, ' else'); - Writeln(OutFile, ' Result := ' + IdentPre + 'Identifier;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, ' if IsCurrentToken(KeyWords[Index]) then'); + Writeln(FOutFile, ' Result := ' + FIdentPre + TLexKeys(FKeyList[I]).TokenType); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' Result := ' + FIdentPre + 'Identifier;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); inc(I); end; - Writeln(OutFile, 'function ' + LexName + '.AltFunc(Index: Integer): T' + IdentPre + + Writeln(FOutFile, 'function ' + FLexName + '.AltFunc(Index: Integer): T' + FIdentPre + 'TokenKind;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := ' + IdentPre + 'Identifier;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.IdentKind(MayBe: PWideChar): T' + - IdentPre + 'TokenKind;'); - Writeln(OutFile, 'var'); - Writeln(OutFile, ' Key: Cardinal;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' fToIdent := MayBe;'); - Writeln(OutFile, ' Key := HashKey(MayBe);'); - Writeln(OutFile, ' if Key <= High(fIdentFuncTable) then'); - Writeln(OutFile, ' Result := fIdentFuncTable[Key](KeyIndices[Key])'); - Writeln(OutFile, ' else'); - Writeln(OutFile, ' Result := ' + IdentPre + 'Identifier;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := ' + FIdentPre + 'Identifier;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.IdentKind(MayBe: PWideChar): T' + + FIdentPre + 'TokenKind;'); + Writeln(FOutFile, 'var'); + Writeln(FOutFile, ' Key: Cardinal;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' fToIdent := MayBe;'); + Writeln(FOutFile, ' Key := HashKey(MayBe);'); + Writeln(FOutFile, ' if Key <= High(fIdentFuncTable) then'); + Writeln(FOutFile, ' Result := FIdentFuncTable[Key](KeyIndices[Key])'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' Result := ' + FIdentPre + 'Identifier;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then begin - Writeln(OutFile, 'procedure ' + LexName + '.SpaceProc;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Space;'); - Writeln(OutFile, ' while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, 'procedure ' + FLexName + '.SpaceProc;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Space;'); + Writeln(FOutFile, ' while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); end; - Writeln(OutFile, 'procedure ' + LexName + '.NullProc;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Null;'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'procedure ' + LexName + '.CRProc;'); - Writeln(OutFile, 'begin'); - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Space;') + Writeln(FOutFile, 'procedure ' + FLexName + '.NullProc;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Null;'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'procedure ' + FLexName + '.CRProc;'); + Writeln(FOutFile, 'begin'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Space;') else - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Unknown;'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, ' if fLine[Run] = #10 then'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'procedure ' + LexName + '.LFProc;'); - Writeln(OutFile, 'begin'); - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Space;') + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Unknown;'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, ' if FLine[Run] = #10 then'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'procedure ' + FLexName + '.LFProc;'); + Writeln(FOutFile, 'begin'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Space;') else - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Unknown;'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Unknown;'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); - for I := 0 to (EnclosedList.Count - 1) do + for I := 0 to (FEnclosedList.Count - 1) do begin - Writeln(OutFile, 'procedure ' + LexName + '.' + - TLexEnclosedBy(EnclosedList[I]).ProcName + 'OpenProc;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Inc(Run);'); - if (Length(TLexEnclosedBy(EnclosedList[I]).StartsWith) > 1) then + Writeln(FOutFile, 'procedure ' + FLexName + '.' + + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'OpenProc;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Inc(Run);'); + if (Length(TLexEnclosedBy(FEnclosedList[I]).StartsWith) > 1) then begin - Write(OutFile, ' if '); - for J := 2 to Length(TLexEnclosedBy(EnclosedList[I]).StartsWith) do + Write(FOutFile, ' if '); + for J := 2 to Length(TLexEnclosedBy(FEnclosedList[I]).StartsWith) do begin if (J > 2) then begin - Writeln(OutFile, ' and'); - Write(OutFile, ' '); + Writeln(FOutFile, ' and'); + Write(FOutFile, ' '); end; - Write(OutFile, '(fLine[Run' + AddInt(J - 2) + '] = ''' + - StuffString(TLexEnclosedBy(EnclosedList[I]).StartsWith[J]) + ''')'); + Write(FOutFile, '(FLine[Run' + AddInt(J - 2) + '] = ''' + + StuffString(TLexEnclosedBy(FEnclosedList[I]).StartsWith[J]) + ''')'); end; - Writeln(OutFile, ' then'); - Writeln(OutFile, ' begin'); - Writeln(OutFile, ' Inc(Run, ' + - IntToStr(Length(TLexEnclosedBy(EnclosedList[I]).StartsWith)-1) + ');'); - Writeln(OutFile, ' fRange := rs' + - TLexEnclosedBy(EnclosedList[I]).ProcName + ';'); - if not TLexEnclosedBy(EnclosedList[I]).MultiLine then + Writeln(FOutFile, ' then'); + Writeln(FOutFile, ' begin'); + Writeln(FOutFile, ' Inc(Run, ' + + IntToStr(Length(TLexEnclosedBy(FEnclosedList[I]).StartsWith)-1) + ');'); + Writeln(FOutFile, ' FRange := rs' + + TLexEnclosedBy(FEnclosedList[I]).ProcName + ';'); + if not TLexEnclosedBy(FEnclosedList[I]).MultiLine then begin - Writeln(OutFile, ' ' + TLexEnclosedBy(EnclosedList[I]).ProcName + + Writeln(FOutFile, ' ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'Proc;'); end; - Writeln(OutFile, ' fTokenID := ' + IdentPre + - TLexEnclosedBy(EnclosedList[I]).TokenName + ';'); - Writeln(OutFile, ' end'); - Writeln(OutFile, ' else'); - if (IdentList.IndexOf(IdentPre + 'Symbol') >= 0) then - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Symbol;') + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + + TLexEnclosedBy(FEnclosedList[I]).TokenName + ';'); + Writeln(FOutFile, ' end'); + Writeln(FOutFile, ' else'); + if (FIdentList.IndexOf(FIdentPre + 'Symbol') >= 0) then + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Symbol;') else - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Identifier;'); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Identifier;'); end else begin - Writeln(OutFile, ' fRange := rs' + - TLexEnclosedBy(EnclosedList[I]).ProcName + ';'); - if not TLexEnclosedBy(EnclosedList[I]).MultiLine then + Writeln(FOutFile, ' FRange := rs' + + TLexEnclosedBy(FEnclosedList[I]).ProcName + ';'); + if not TLexEnclosedBy(FEnclosedList[I]).MultiLine then begin - Writeln(OutFile, ' ' + TLexEnclosedBy(EnclosedList[I]).ProcName + + Writeln(FOutFile, ' ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'Proc;'); end; - Writeln(OutFile, ' fTokenID := ' + IdentPre + - TLexEnclosedBy(EnclosedList[I]).TokenName + ';'); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + + TLexEnclosedBy(FEnclosedList[I]).TokenName + ';'); end; - Writeln(OutFile, 'end;'); - Writeln(OutFile); - Writeln(OutFile, 'procedure ' + LexName + '.' + - TLexEnclosedBy(EnclosedList[I]).ProcName + 'Proc;'); - Writeln(OutFile, 'begin'); - if TLexEnclosedBy(EnclosedList[I]).MultiLine then + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + Writeln(FOutFile, 'procedure ' + FLexName + '.' + + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'Proc;'); + Writeln(FOutFile, 'begin'); + if TLexEnclosedBy(FEnclosedList[I]).MultiLine then begin - Writeln(OutFile, ' case fLine[Run] of'); - Writeln(OutFile, ' #0: NullProc;'); - Writeln(OutFile, ' #10: LFProc;'); - Writeln(OutFile, ' #13: CRProc;'); - Writeln(OutFile, ' else'); - Writeln(OutFile, ' begin'); + Writeln(FOutFile, ' case FLine[Run] of'); + Writeln(FOutFile, ' #0: NullProc;'); + Writeln(FOutFile, ' #10: LFProc;'); + Writeln(FOutFile, ' #13: CRProc;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' begin'); sPrefix := ' '; end else sPrefix := ''; - Writeln(OutFile, sPrefix, ' fTokenID := ' + IdentPre + - TLexEnclosedBy(EnclosedList[I]).TokenName + ';'); - Writeln(OutFile, sPrefix, ' repeat'); - Write(OutFile, sPrefix, ' if '); - for J := 1 to Length(TLexEnclosedBy(EnclosedList[I]).EndsWith) do + Writeln(FOutFile, sPrefix, ' FTokenId := ' + FIdentPre + + TLexEnclosedBy(FEnclosedList[I]).TokenName + ';'); + Writeln(FOutFile, sPrefix, ' repeat'); + Write(FOutFile, sPrefix, ' if '); + for J := 1 to Length(TLexEnclosedBy(FEnclosedList[I]).EndsWith) do begin if (J > 1) then begin - Writeln(OutFile, ' and'); - Write(OutFile, sPrefix, ' '); + Writeln(FOutFile, ' and'); + Write(FOutFile, sPrefix, ' '); end; - Write(OutFile, '(fLine[Run' + AddInt(J - 1) + '] = ''' + - StuffString(TLexEnclosedBy(EnclosedList[I]).EndsWith[J]) + ''')'); + Write(FOutFile, '(FLine[Run' + AddInt(J - 1) + '] = ''' + + StuffString(TLexEnclosedBy(FEnclosedList[I]).EndsWith[J]) + ''')'); end; - Writeln(OutFile, ' then'); - Writeln(OutFile, sPrefix, ' begin'); - Writeln(OutFile, sPrefix, ' Inc(Run, ' + - IntToStr(Length(TLexEnclosedBy(EnclosedList[I]).EndsWith)) + ');'); - Writeln(OutFile, sPrefix, ' fRange := rsUnKnown;'); - Writeln(OutFile, sPrefix, ' Break;'); - Writeln(OutFile, sPrefix, ' end;'); - Writeln(OutFile, sPrefix, ' if not IsLineEnd(Run) then'); - Writeln(OutFile, sPrefix, ' Inc(Run);'); - Writeln(OutFile, sPrefix, ' until IsLineEnd(Run);'); - Writeln(OutFile, sPrefix, 'end;'); - if TLexEnclosedBy(EnclosedList[I]).MultiLine then + Writeln(FOutFile, ' then'); + Writeln(FOutFile, sPrefix, ' begin'); + Writeln(FOutFile, sPrefix, ' Inc(Run, ' + + IntToStr(Length(TLexEnclosedBy(FEnclosedList[I]).EndsWith)) + ');'); + Writeln(FOutFile, sPrefix, ' FRange := rsUnknown;'); + Writeln(FOutFile, sPrefix, ' Break;'); + Writeln(FOutFile, sPrefix, ' end;'); + Writeln(FOutFile, sPrefix, ' if not IsLineEnd(Run) then'); + Writeln(FOutFile, sPrefix, ' Inc(Run);'); + Writeln(FOutFile, sPrefix, ' until IsLineEnd(Run);'); + Writeln(FOutFile, sPrefix, 'end;'); + if TLexEnclosedBy(FEnclosedList[I]).MultiLine then begin - Writeln(OutFile, ' end;'); - Writeln(OutFile, 'end;'); + Writeln(FOutFile, ' end;'); + Writeln(FOutFile, 'end;'); end; - Writeln(OutFile); + Writeln(FOutFile); end; - Writeln(OutFile, 'constructor ' + LexName + '.Create(AOwner: TComponent);'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' inherited Create(AOwner);'); - Writeln(OutFile, ' fCaseSensitive := ' + BoolStrs[Sensitivity] + ';'); - Writeln(OutFile); + Writeln(FOutFile, 'constructor ' + FLexName + '.Create(AOwner: TComponent);'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' inherited Create(AOwner);'); + Writeln(FOutFile, ' fCaseSensitive := ' + BoolStrs[FSensitivity] + ';'); + Writeln(FOutFile); I := 0; - while I < IdentList.Count do + while I < FIdentList.Count do begin - AttrTemp := Copy(IdentList[I], Length(IdentPre) + 1, Length(IdentList[I])); + AttrTemp := Copy(FIdentList[I], Length(FIdentPre) + 1, Length(FIdentList[I])); if AttrTemp = 'Key' then - AttrName := CboAttrReservedWord.Text + AttrName := ComboBoxAttrReservedWord.Text else if AttrTemp = 'Identifier' then - AttrName := CboAttrIdentifier.Text + AttrName := ComboBoxAttrIdentifier.Text else AttrName := 'SYNS_Attr' + FilterInvalidChars(AttrTemp); @@ -1524,364 +1535,364 @@ Writeln(OutFile, ' ' + LexName + ' = class(TSynCustomHighlighter)'); else FriendlyAttrName := 'Friendly' + AttrName; - if (IdentList[I] <> IdentPre + 'Null') and (IdentList[I] <> IdentPre + + if (FIdentList[I] <> FIdentPre + 'Null') and (FIdentList[I] <> FIdentPre + 'Unknown') then begin AttrTemp := 'f' + AttrTemp + 'Attri'; - Writeln(OutFile, ' ' + AttrTemp + ' := TSynHighLighterAttributes.Create(' + Writeln(FOutFile, ' ' + AttrTemp + ' := TSynHighLighterAttributes.Create(' + AttrName + ', ' + FriendlyAttrName + ');'); - if Assigned(IdentList.Objects[i]) then + if Assigned(FIdentList.Objects[i]) then begin - DefAttri := TLexDefaultAttri(IdentList.Objects[i]); + DefAttri := TLexDefaultAttri(FIdentList.Objects[i]); if (DefAttri.Style <> '') then - Writeln(OutFile, ' ' + AttrTemp + '.Style := ' + DefAttri.Style + + Writeln(FOutFile, ' ' + AttrTemp + '.Style := ' + DefAttri.Style + ';'); if (DefAttri.Foreground <> '') then - Writeln(OutFile, ' ' + AttrTemp + '.Foreground := ' + + Writeln(FOutFile, ' ' + AttrTemp + '.Foreground := ' + DefAttri.Foreground + ';'); if (DefAttri.Background <> '') then - Writeln(OutFile, ' ' + AttrTemp + '.Background := ' + + Writeln(FOutFile, ' ' + AttrTemp + '.Background := ' + DefAttri.Background + ';'); end - else if (IdentList[I] = IdentPre + 'Key') then - Writeln(OutFile, ' ' + AttrTemp + '.Style := [fsBold];') - else if (IdentList[I] = IdentPre + 'Comment') then + else if (FIdentList[I] = FIdentPre + 'Key') then + Writeln(FOutFile, ' ' + AttrTemp + '.Style := [fsBold];') + else if (FIdentList[I] = FIdentPre + 'Comment') then begin - Writeln(OutFile, ' ' + AttrTemp + '.Style := [fsItalic];'); - Writeln(OutFile, ' ' + AttrTemp + '.Foreground := clNavy;'); + Writeln(FOutFile, ' ' + AttrTemp + '.Style := [fsItalic];'); + Writeln(FOutFile, ' ' + AttrTemp + '.Foreground := clNavy;'); end; - Writeln(OutFile, ' AddAttribute(' + AttrTemp + ');'); - Writeln(OutFile); + Writeln(FOutFile, ' AddAttribute(' + AttrTemp + ');'); + Writeln(FOutFile); end; Inc(I); end; - Writeln(OutFile, ' SetAttributesOnChange(DefHighlightChange);'); - Writeln(OutFile, ' InitIdent;'); + Writeln(FOutFile, ' SetAttributesOnChange(DefHighlightChange);'); + Writeln(FOutFile, ' InitIdent;'); - Writeln(OutFile, ' fDefaultFilter := ' + GetFilterName + ';'); - Writeln(OutFile, ' fRange := rsUnknown;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, ' fDefaultFilter := ' + GetFilterName + ';'); + Writeln(FOutFile, ' FRange := rsUnknown;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); I := 0; - while I < SetList.Count do + while I < FSetList.Count do begin - Writeln(OutFile, 'procedure ' + LexName + '.' + - TLexCharsets(SetList[I]).SetName + 'Proc;'); - Writeln(OutFile, 'begin'); - Write(OutFile, ' ' + TLexCharsets(SetList[I]).ProcData); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, 'procedure ' + FLexName + '.' + + TLexCharsets(FSetList[I]).SetName + 'Proc;'); + Writeln(FOutFile, 'begin'); + Write(FOutFile, ' ' + TLexCharsets(FSetList[I]).ProcData); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); inc(I); end; - Writeln(OutFile, 'procedure ' + LexName + '.UnknownProc;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' inc(Run);'); - Writeln(OutFile, ' fTokenID := ' + IdentPre + 'Unknown;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'procedure ' + LexName + '.Next;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' fTokenPos := Run;'); - if (EnclosedList.Count > 0) then + Writeln(FOutFile, 'procedure ' + FLexName + '.UnknownProc;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' inc(Run);'); + Writeln(FOutFile, ' FTokenId := ' + FIdentPre + 'Unknown;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'procedure ' + FLexName + '.Next;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' fTokenPos := Run;'); + if (FEnclosedList.Count > 0) then begin - Writeln(OutFile, ' case fRange of'); - for I := 0 to (EnclosedList.Count - 1) do + Writeln(FOutFile, ' case FRange of'); + for I := 0 to (FEnclosedList.Count - 1) do begin - if TLexEnclosedBy(EnclosedList[I]).MultiLine then + if TLexEnclosedBy(FEnclosedList[I]).MultiLine then begin - Writeln(OutFile, ' rs' + TLexEnclosedBy(EnclosedList[I]).ProcName + - ': ' + TLexEnclosedBy(EnclosedList[I]).ProcName + 'Proc;'); + Writeln(FOutFile, ' rs' + TLexEnclosedBy(FEnclosedList[I]).ProcName + + ': ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'Proc;'); end; end; - Writeln(OutFile, ' else'); - Writeln(OutFile, ' case fLine[Run] of'); - Writeln(OutFile, ' #0: NullProc;'); - Writeln(OutFile, ' #10: LFProc;'); - Writeln(OutFile, ' #13: CRProc;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' case FLine[Run] of'); + Writeln(FOutFile, ' #0: NullProc;'); + Writeln(FOutFile, ' #10: LFProc;'); + Writeln(FOutFile, ' #13: CRProc;'); - for I := 0 to (EnclosedList.Count - 1) do + for I := 0 to (FEnclosedList.Count - 1) do begin - if (TLexEnclosedBy(EnclosedList[I]).StartsWith <> '') then + if (TLexEnclosedBy(FEnclosedList[I]).StartsWith <> '') then begin - Writeln(OutFile, ' ''' + - StuffString(TLexEnclosedBy(EnclosedList[I]).StartsWith[1]) + - ''': ' + TLexEnclosedBy(EnclosedList[I]).ProcName + 'OpenProc;'); + Writeln(FOutFile, ' ''' + + StuffString(TLexEnclosedBy(FEnclosedList[I]).StartsWith[1]) + + ''': ' + TLexEnclosedBy(FEnclosedList[I]).ProcName + 'OpenProc;'); end; end; - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' #1..#9, #11, #12, #14..#32: SpaceProc;'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' #1..#9, #11, #12, #14..#32: SpaceProc;'); I := 0; - while I < SetList.Count do + while I < FSetList.Count do begin - Writeln(OutFile, ' ' + TLexCharsets(SetList[I]).Charset + - ': ' + TLexCharsets(SetList[I]).SetName + 'Proc;'); + Writeln(FOutFile, ' ' + TLexCharsets(FSetList[I]).Charset + + ': ' + TLexCharsets(FSetList[I]).SetName + 'Proc;'); Inc(I); end; - Writeln(OutFile, ' else'); - Writeln(OutFile, ' UnknownProc;'); - Writeln(OutFile, ' end;'); - Writeln(OutFile, ' end;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' UnknownProc;'); + Writeln(FOutFile, ' end;'); + Writeln(FOutFile, ' end;'); end else begin - Writeln(OutFile, ' case fLine[Run] of'); - Writeln(OutFile, ' #0: NullProc;'); - Writeln(OutFile, ' #10: LFProc;'); - Writeln(OutFile, ' #13: CRProc;'); + Writeln(FOutFile, ' case FLine[Run] of'); + Writeln(FOutFile, ' #0: NullProc;'); + Writeln(FOutFile, ' #10: LFProc;'); + Writeln(FOutFile, ' #13: CRProc;'); - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' #1..#9, #11, #12, #14..#32: SpaceProc;'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' #1..#9, #11, #12, #14..#32: SpaceProc;'); I := 0; - while I < SetList.Count do + while I < FSetList.Count do begin - Writeln(OutFile, ' ' + TLexCharsets(SetList[I]).Charset + - ': ' + TLexCharsets(SetList[I]).SetName + 'Proc;'); + Writeln(FOutFile, ' ' + TLexCharsets(FSetList[I]).Charset + + ': ' + TLexCharsets(FSetList[I]).SetName + 'Proc;'); Inc(I); end; - Writeln(OutFile, ' else'); - Writeln(OutFile, ' UnknownProc;'); - Writeln(OutFile, ' end;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' UnknownProc;'); + Writeln(FOutFile, ' end;'); end; - Writeln(OutFile, ' inherited;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, ' inherited;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); - Writeln(OutFile, 'function ' + LexName + + Writeln(FOutFile, 'function ' + FLexName + '.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' case Index of'); - if (IdentList.IndexOf(IdentPre + 'Comment') >= 0) then - Writeln(OutFile, ' SYN_ATTR_COMMENT: Result := fCommentAttri;'); - if (IdentList.IndexOf(IdentPre + 'Identifier') >= 0) then - Writeln(OutFile, ' SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;'); - if (IdentList.IndexOf(IdentPre + 'Key') >= 0) then - Writeln(OutFile, ' SYN_ATTR_KEYWORD: Result := fKeyAttri;'); - if (IdentList.IndexOf(IdentPre + 'String') >= 0) then - Writeln(OutFile, ' SYN_ATTR_STRING: Result := fStringAttri;'); - if (IdentList.IndexOf(IdentPre + 'Space') >= 0) then - Writeln(OutFile, ' SYN_ATTR_WHITESPACE: Result := fSpaceAttri;'); - if (IdentList.IndexOf(IdentPre + 'Symbol') >= 0) then - Writeln(OutFile, ' SYN_ATTR_SYMBOL: Result := fSymbolAttri;'); - Writeln(OutFile, ' else'); - Writeln(OutFile, ' Result := nil;'); - Writeln(OutFile, ' end;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.GetEol: Boolean;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := Run = fLineLen + 1;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - if ChkGetKeyWords.Checked then + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' case Index of'); + if (FIdentList.IndexOf(FIdentPre + 'Comment') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_COMMENT: Result := FCommentAttri;'); + if (FIdentList.IndexOf(FIdentPre + 'Identifier') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;'); + if (FIdentList.IndexOf(FIdentPre + 'Key') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_KEYWORD: Result := FKeyAttri;'); + if (FIdentList.IndexOf(FIdentPre + 'String') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_STRING: Result := FStringAttri;'); + if (FIdentList.IndexOf(FIdentPre + 'Space') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_WHITESPACE: Result := FSpaceAttri;'); + if (FIdentList.IndexOf(FIdentPre + 'Symbol') >= 0) then + Writeln(FOutFile, ' SYN_ATTR_SYMBOL: Result := FSymbolAttri;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' Result := nil;'); + Writeln(FOutFile, ' end;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.GetEol: Boolean;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := Run = FLineLen + 1;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + if CheckBoxGetKeyWords.Checked then begin - Writeln(OutFile, 'function ' + LexName + '.GetKeyWords(TokenKind: Integer): string;'); - Writeln(OutFile, 'begin'); + Writeln(FOutFile, 'function ' + FLexName + '.GetKeyWords(TokenKind: Integer): UnicodeString;'); + Writeln(FOutFile, 'begin'); TempStringList := TStringList.Create; try TempStringList.Sorted := True; - for I := 0 to KeyList.Count - 1 do - TempStringList.Add(TLexKeys(KeyList[I]).KeyName); + for I := 0 to FKeyList.Count - 1 do + TempStringList.Add(TLexKeys(FKeyList[I]).KeyName); if TempStringList.Count > 0 then begin - Writeln(OutFile, ' Result := '); + Writeln(FOutFile, ' Result := '); for I := 0 to Trunc(Int(Length(TempStringList.CommaText) div 70)) - 1 do begin if I = 0 then LineLength := 69 else LineLength := 70; - Writeln(OutFile, ' ' + #39 + Copy(TempStringList.CommaText, + Writeln(FOutFile, ' ' + #39 + Copy(TempStringList.CommaText, I * 70, LineLength) + #39 + #32 + #43); end; I := Trunc(Int(Length(TempStringList.CommaText) div 70)); - Writeln(OutFile, ' ' + #39 + Copy(TempStringList.CommaText, + Writeln(FOutFile, ' ' + #39 + Copy(TempStringList.CommaText, I * 70, Length(TempStringList.CommaText)) + #39 + ';') end else - Writeln(OutFile, ' Result := ' + #39 + #39 + ';'); + Writeln(FOutFile, ' Result := ' + #39 + #39 + ';'); finally TempStringList.Free; end; - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); end; - Writeln(OutFile, 'function ' + LexName + '.GetTokenID: TtkTokenKind;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := fTokenId;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); + Writeln(FOutFile, 'function ' + FLexName + '.GetTokenID: TtkTokenKind;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := FTokenId;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); - Writeln(OutFile, 'function ' + LexName + + Writeln(FOutFile, 'function ' + FLexName + '.GetTokenAttribute: TSynHighLighterAttributes;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' case GetTokenID of'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' case GetTokenID of'); I := 0; - while I < IdentList.Count do + while I < FIdentList.Count do begin - if (IdentList[I] <> IdentPre + 'Null') and (IdentList[I] <> IdentPre + + if (FIdentList[I] <> FIdentPre + 'Null') and (FIdentList[I] <> FIdentPre + 'Unknown') then - Writeln(OutFile, ' ' + IdentList[I] + ': Result := f' + - Copy(IdentList[I], Length(IdentPre) + 1, Length(IdentList[I])) + + Writeln(FOutFile, ' ' + FIdentList[I] + ': Result := F' + + Copy(FIdentList[I], Length(FIdentPre) + 1, Length(FIdentList[I])) + 'Attri;'); inc(I); end; - Writeln(OutFile, ' ' + IdentPre + 'Unknown: Result := f' + - CboUnknownTokenAttr.Text + 'Attri;'); - - Writeln(OutFile, ' else'); - Writeln(OutFile, ' Result := nil;'); - Writeln(OutFile, ' end;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.GetTokenKind: Integer;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := Ord(fTokenId);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.IsIdentChar(AChar: WideChar): Boolean;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' case AChar of'); - Writeln(OutFile, ' ' + IdentContent + ':'); - Writeln(OutFile, ' Result := True;'); - Writeln(OutFile, ' else'); - Writeln(OutFile, ' Result := False;'); - Writeln(OutFile, ' end;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.GetSampleSource: string;'); - Writeln(OutFile, 'begin'); - if (SampleSourceList.Count = 0) then + Writeln(FOutFile, ' ' + FIdentPre + 'Unknown: Result := F' + + ComboBoxUnknownTokenAttr.Text + 'Attri;'); + + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' Result := nil;'); + Writeln(FOutFile, ' end;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.GetTokenKind: Integer;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := Ord(FTokenId);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.IsIdentChar(AChar: WideChar): Boolean;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' case AChar of'); + Writeln(FOutFile, ' ' + FIdentContent + ':'); + Writeln(FOutFile, ' Result := True;'); + Writeln(FOutFile, ' else'); + Writeln(FOutFile, ' Result := False;'); + Writeln(FOutFile, ' end;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.GetSampleSource: UnicodeString;'); + Writeln(FOutFile, 'begin'); + if (FSampleSourceList.Count = 0) then begin - Writeln(OutFile, ' Result := '); - Writeln(OutFile, ' ''Sample source for: ''#13#10 +'); - Writeln(OutFile, ' ''' + EditDescription.Text + ''';'); + Writeln(FOutFile, ' Result := '); + Writeln(FOutFile, ' ''Sample source for: ''#13#10 +'); + Writeln(FOutFile, ' ''' + EditDescription.Text + ''';'); end else begin - Writeln(OutFile, ' Result := '); - for i := 0 to SampleSourceList.Count - 1 do + Writeln(FOutFile, ' Result := '); + for i := 0 to FSampleSourceList.Count - 1 do begin - if (i > 0) and (i < SampleSourceList.Count - 1) then - Writeln(OutFile, '#13#10 +'); - if (i < SampleSourceList.Count - 1) then - Write(OutFile, ' '); - if SampleSourceList[i] <> '' then - Write(OutFile, '''', StuffString(SampleSourceList[i]), ''''); + if (i > 0) and (i < FSampleSourceList.Count - 1) then + Writeln(FOutFile, '#13#10 +'); + if (i < FSampleSourceList.Count - 1) then + Write(FOutFile, ' '); + if FSampleSourceList[i] <> '' then + Write(FOutFile, '''', StuffString(FSampleSourceList[i]), ''''); end; - Writeln(OutFile, ';'); + Writeln(FOutFile, ';'); end; - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.IsFilterStored: Boolean;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := fDefaultFilter <> ' + GetFilterName + ';'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'class function ' + LexName + '.GetFriendlyLanguageName: string;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := ' + GetFriendlyLangName + ';'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'class function ' + LexName + '.GetLanguageName: string;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := ' + GetLangName + ';'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'procedure ' + LexName + '.ResetRange;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' fRange := rsUnknown;'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'procedure ' + LexName + '.SetRange(Value: Pointer);'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' fRange := TRangeState(Value);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'function ' + LexName + '.GetRange: Pointer;'); - Writeln(OutFile, 'begin'); - Writeln(OutFile, ' Result := Pointer(fRange);'); - Writeln(OutFile, 'end;'); - Writeln(OutFile); - - Writeln(OutFile, 'initialization'); - Writeln(OutFile, '{$IFNDEF SYN_CPPB_1}'); - Writeln(OutFile, ' RegisterPlaceableHighlighter(' + LexName + ');'); - Writeln(OutFile, '{$ENDIF}'); - Writeln(OutFile, 'end.'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.IsFilterStored: Boolean;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := FDefaultFilter <> ' + GetFilterName + ';'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'class function ' + FLexName + '.GetFriendlyLanguageName: UnicodeString;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := ' + GetFriendlyLangName + ';'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'class function ' + FLexName + '.GetLanguageName: string;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := ' + GetLangName + ';'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'procedure ' + FLexName + '.ResetRange;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' FRange := rsUnknown;'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'procedure ' + FLexName + '.SetRange(Value: Pointer);'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' FRange := TRangeState(Value);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'function ' + FLexName + '.GetRange: Pointer;'); + Writeln(FOutFile, 'begin'); + Writeln(FOutFile, ' Result := Pointer(FRange);'); + Writeln(FOutFile, 'end;'); + Writeln(FOutFile); + + Writeln(FOutFile, 'initialization'); + Writeln(FOutFile, '{$IFNDEF SYN_CPPB_1}'); + Writeln(FOutFile, ' RegisterPlaceableHighlighter(' + FLexName + ');'); + Writeln(FOutFile, '{$ENDIF}'); + Writeln(FOutFile, 'end.'); end; -procedure TFrmMain.CboLangNameChange(Sender: TObject); +procedure TFormMain.ComboBoxLangNameChange(Sender: TObject); begin - if (CboLangName.Text <> '') and (CboFilter.Text <> '') then - BtnStart.Enabled := True + if (ComboBoxLangName.Text <> '') and (ComboBoxFilter.Text <> '') then + ButtonStart.Enabled := True else - BtnStart.Enabled := False; + ButtonStart.Enabled := False; end; -procedure TFrmMain.ListBoxFieldsClick(Sender: TObject); +procedure TFormMain.ListBoxFieldsClick(Sender: TObject); begin - BtnDelete.Enabled := True; + ButtonDelete.Enabled := True; end; -procedure TFrmMain.BtnAddClick(Sender: TObject); +procedure TFormMain.ButtonAddClick(Sender: TObject); begin ListBoxFields.Items.Add(EditAddField.Text); EditAddField.Clear; end; -procedure TFrmMain.BtnDeleteClick(Sender: TObject); +procedure TFormMain.ButtonDeleteClick(Sender: TObject); begin - BtnDelete.Enabled := False; + ButtonDelete.Enabled := False; ListBoxFields.Items.Delete(ListBoxFields.ItemIndex); end; -procedure TFrmMain.EditAddFieldChange(Sender: TObject); +procedure TFormMain.EditAddFieldChange(Sender: TObject); begin - BtnAdd.Enabled := EditAddField.Text <> ''; + ButtonAdd.Enabled := EditAddField.Text <> ''; end; -procedure TFrmMain.EditAddFieldKeyPress(Sender: TObject; var Key: Char); +procedure TFormMain.EditAddFieldKeyPress(Sender: TObject; var Key: Char); begin if (Key = ';') or (Key = #32) then Key := #0; end; -procedure TFrmMain.MnuExitClick(Sender: TObject); +procedure TFormMain.MenuItemExitClick(Sender: TObject); begin Close; end; -procedure TFrmMain.MnuOpenClick(Sender: TObject); +procedure TFormMain.MenuItemOpenClick(Sender: TObject); begin WriteSettings; PerformFileOpen; end; -procedure TFrmMain.FormClose(Sender: TObject; var Action: TCloseAction); +procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction); begin WriteSettings; end; -function TFrmMain.KeywordsAreAllAlphaNumAndDifferent: Boolean; +function TFormMain.KeywordsAreAllAlphaNumAndDifferent: Boolean; var i: Integer; KeyWordList: TStringList; @@ -1894,8 +1905,8 @@ function TFrmMain.KeywordsAreAllAlphaNumAndDifferent: Boolean; KeyWordList.Duplicates := dupError; try - for i := 0 to KeyList.Count - 1 do - KeyWordList.Add(TLexKeys(KeyList[i]).KeyName); + for i := 0 to FKeyList.Count - 1 do + KeyWordList.Add(TLexKeys(FKeyList[i]).KeyName); except Result := False; Exit; @@ -1904,8 +1915,8 @@ function TFrmMain.KeywordsAreAllAlphaNumAndDifferent: Boolean; KeyWordList.Free; end; - for i := 0 to KeyList.Count - 1 do - if not IsASCIIAlphaNum(TLexKeys(KeyList[i]).KeyName) then + for i := 0 to FKeyList.Count - 1 do + if not IsASCIIAlphaNum(TLexKeys(FKeyList[i]).KeyName) then begin Result := False; Exit; @@ -1913,4 +1924,3 @@ function TFrmMain.KeywordsAreAllAlphaNumAndDifferent: Boolean; end; end. - diff --git a/Source/VCL/SynEdit/readme.md b/Source/VCL/SynEdit/readme.md index 82d520c8..e520e20f 100644 --- a/Source/VCL/SynEdit/readme.md +++ b/Source/VCL/SynEdit/readme.md @@ -1,56 +1,26 @@ -# TurboPack SynEdit +SynEdit +======= -Updated for **10.4 Sydney** / VER340 / PKG 270 +This is a fork of the Unicode version of SynEdit hosted at SourceForge. When it became more and more difficult to maintain, Eric Grange decided to fork this project on GitHub. This way it's possible to fork, merge and maintain easier than before. -The master branch remains compatible with Delphi 10.1 Berlin or later. You can also access the [10.3 Rio](https://github.com/TurboPack/SynEdit/releases/tag/103RIO), [10.2 Tokyo](https://github.com/TurboPack/SynEdit/releases/tag/102Tokyo) and [10.1 Berlin](https://github.com/TurboPack/SynEdit/releases/tag/101Berlin) releases. +The original project (with the original readme.txt file) is located here: -### Table of contents -1. [Introduction](#Introduction) -2. [Package names](#Package-names) -3. [Installation](#Installation) +http://synedit.sourceforge.net ---- +To get started check out the different examples. If you have questions, please subscribe to the SynEdit user list and ask there, if you want to hack SynEdit you should subscribe to the SynEdit developer list. General feedback and suggestions or fixes are welcome. -## Introduction +There is no documentation yet, help in this area is especially welcome! -![SynEdit](https://raw.githubusercontent.com/TurboPack/SynEdit/master/Doc/SynEdit-1.3.png "TurboPower SynEdit") +Historical Note +--------------- +SynEdit had been started as an attempt to continue the no longer maintained +sources of the mwEdit project. The last public version 0.92a of mwEdit can be +found at the SynEdit website in the download section. +The mwEdit project was started in 1998 by Martin Waldenburg, aim was to produce a syntax highlighting editor component for an Open Source IDE. In the 15 months that mwEdit was developed in public Martin was increasingly dissatisfied with the direction the development of mwEdit took, so he finally requested that his name and initials had to be removed from the project. +Therefore this is now called SynEdit, and it is an Open Source project under the MPL (Mozilla Public License, but see the individual source files for the terms). +There would however be no such project if Martin had not started to develop mwEdit, so we would like to thank Martin Waldenburg for his efforts, and of course all the other developers of the mwEdit project. -SynEdit is a syntax highlighting edit control, not based on the Windows -common controls. SynEdit is compatible with both Delphi and C++ Builder. - -This is a source-only release of TurboPack SynEdit. It includes -designtime and runtime packages for Delphi and C++Builder and supports Win32 and Win64. - ---- - -## Package names - -TurboPack SynEdit package names have the following form: - -Delphi -* SynEditDR.bpl (Delphi Runtime) -* SynEditDD.bpl (Delphi Designtime) - -C++Builder -* SynEditCR.bpl (C++Builder Runtime) -* SynEditCD.bpl (C++Builder Designtime) - ---- - -## Installation - -TurboPack SynEdit is available via the [GetIt Package Manager](http://docwiki.embarcadero.com/RADStudio/en/Installing_a_Package_Using_GetIt_Package_Manager) where you can quickly and easily install and uninstall it. - -To manually install TurboPack SynEdit into your IDE, take the following -steps: - -1. Unzip the release files into a directory (e.g., d:\SynEdit). - -2. Start RAD Studio. - -3. Add the source subdirectory (e.g., d:\SynEdit\source) to the IDE's library path. For CBuilder, add the hpp subdirectory -(e.g., d:\SynEdit\source\hpp\Win32\Release) to the IDE's system include path. - -4. Open & install the designtime package specific to the IDE being used. The IDE should notify you the components have been -installed. +Misc. +----- +Delphinus support added diff --git a/Source/devCFG.pas b/Source/devCFG.pas index 519b25ac..e57c6e5e 100644 --- a/Source/devCFG.pas +++ b/Source/devCFG.pas @@ -2641,7 +2641,7 @@ procedure TdevEditor.AssignEditor(editor: TSynEdit; const FileName: String); if fTrimTrailingSpaces then Options := Options + [eoTrimTrailingSpaces]; if fShowLigatures then - Options := Options + [eoShowLigatures]; + //Options := Options + [eoShowLigatures]; finally EndUpdate; end; diff --git a/Source/devcpp.stat b/Source/devcpp.stat new file mode 100644 index 00000000..25d2f0d3 --- /dev/null +++ b/Source/devcpp.stat @@ -0,0 +1,10 @@ +[Stats] +EditorSecs=1 +DesignerSecs=5 +InspectorSecs=1 +CompileSecs=1 +OtherSecs=18 +StartTime=1/15/2022 4:44:11 PM +RealKeys=0 +EffectiveKeys=0 +DebugSecs=1 diff --git a/Source/main.dfm b/Source/main.dfm index 72682387..1d3044ab 100644 --- a/Source/main.dfm +++ b/Source/main.dfm @@ -720,7 +720,7 @@ object MainForm: TMainForm end end object tbCompile: TToolBar - Left = 414 + Left = 677 Top = 2 Width = 256 Height = 24 @@ -803,7 +803,7 @@ object MainForm: TMainForm end end object tbProject: TToolBar - Left = 306 + Left = 569 Top = 2 Width = 95 Height = 24 @@ -994,7 +994,7 @@ object MainForm: TMainForm end end object tbCompilers: TToolBar - Left = 683 + Left = 306 Top = 2 Width = 250 Height = 24 diff --git a/Source/main.pas b/Source/main.pas index 1f3c4e33..38f5830d 100644 --- a/Source/main.pas +++ b/Source/main.pas @@ -3486,7 +3486,6 @@ procedure TMainForm.actEnviroOptionsExecute(Sender: TObject); TabIndex := 4; if (Sender = ButtonChangeLanguage) then TabIndex := 0; - with TEnviroForm.Create(nil) do try PagesMain.TabIndex := TabIndex; if ShowModal = mrOk then begin